From 8895a948cf0ecae5722af44d25c5b1a61fe16439 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Mon, 13 Nov 2023 22:18:03 +0100 Subject: [PATCH] Refactor preplots configuration GUI. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces a number of changes, most notably an easier way to specify fixed width formats and support for configuring multiple import options (actual SPSv1, SPSv2.1, P1/90, CSV, …) Note that only the configuration GUI is done, support for actually importing those formats has not been implemented as of this commit. --- .../decoder/saillines-string-decoder.vue | 14 +- .../project-settings/preplots-preplot.vue | 520 ++++++++++++++++++ .../components/project-settings/preplots.vue | 194 ++++--- 3 files changed, 640 insertions(+), 88 deletions(-) create mode 100644 lib/www/client/source/src/components/project-settings/preplots-preplot.vue diff --git a/lib/www/client/source/src/components/decoder/saillines-string-decoder.vue b/lib/www/client/source/src/components/decoder/saillines-string-decoder.vue index 49e1e85..b4cdf21 100644 --- a/lib/www/client/source/src/components/decoder/saillines-string-decoder.vue +++ b/lib/www/client/source/src/components/decoder/saillines-string-decoder.vue @@ -143,7 +143,7 @@ export default { props: { text: String, - fields: Object, + //fields: Object, //delimiter: String, headerRow: { type: [ Boolean, Number ], default: false}, numberedLines: [ Boolean, Number ], @@ -215,12 +215,18 @@ export default { // Properties of the sailline object const keys = [ "incr", "ntba", "remarks", "source_line", "meta.colour" ]; + function to_bool (v, missing=false) { + return (v === undefined || v === null) + ? missing // Missing value meaning + : /^t(rue)|^[1-9-]+$/i.test(String(v).trim()) + } + // To transform the input text into the required format for each field const transformer = (key) => { const transformers = { - incr: (v) => Boolean(Number(v)), - ntba: (v) => Boolean(Number(v)), - remarks: String, + incr: (v) => to_bool(v, true), + ntba: (v) => to_bool(v, false), + remarks: (v) => (v === undefined || v === null) ? "" : String, source_line: Number, }; return transformers[key] ?? String; diff --git a/lib/www/client/source/src/components/project-settings/preplots-preplot.vue b/lib/www/client/source/src/components/project-settings/preplots-preplot.vue new file mode 100644 index 0000000..f36fed3 --- /dev/null +++ b/lib/www/client/source/src/components/project-settings/preplots-preplot.vue @@ -0,0 +1,520 @@ + + + diff --git a/lib/www/client/source/src/components/project-settings/preplots.vue b/lib/www/client/source/src/components/project-settings/preplots.vue index a8ad9a1..3893c37 100644 --- a/lib/www/client/source/src/components/project-settings/preplots.vue +++ b/lib/www/client/source/src/components/project-settings/preplots.vue @@ -3,51 +3,43 @@ Preplots Preplot files location and format. - - {{tabNameFor(item)}} - - - - - - - - - + + + + {{ titleFor(preplot) }} + + + - - + + mdi-delete-outline + Delete + + + + + + + + + mdi-file-document-plus-outline + New preplot + - - - Column settings - - - - - - - - - - -