diff --git a/lib/www/client/source/src/views/ProjectSettings.vue b/lib/www/client/source/src/views/ProjectSettings.vue index 72c1ba2..165fc35 100644 --- a/lib/www/client/source/src/views/ProjectSettings.vue +++ b/lib/www/client/source/src/views/ProjectSettings.vue @@ -55,7 +55,12 @@ - + @@ -206,68 +211,41 @@ export default { values: (obj) => ({ id: obj?.id, name: obj?.name - }), - save: async (data, cfg) => { - await this.patch({ - id: data.id, - name: data.name, - }); - } + }) }, { id: "groups", name: "Groups", values: (obj) => ({ groups: obj?.groups - }), - save: async (data, cfg) => { - await this.patch({ - groups: data.groups, - }); - } + }) }, { id: "geodetics", name: "Geodetics", values: (obj) => ({ epsg: obj?.epsg - }), - save: async (data, cfg) => { - await this.patch({ - epsg: data.epsg - }); - } + }) }, { id: "binning", name: "Binning", - values: (obj) => { - const data = {...obj.binning}; - data.origin = {...obj.binning.origin}; - return data; - }, - save: async (data, cfg) => { - await this.patch({binning: {...data}}); - } + values: (obj) => ({ + ...obj.binning + }) }, { id: "input_files", name: "Input files", - values: obj => ({ path: obj.rootPath}), - save: async (data, cfg) => { - await this.patch({rootPath: data.path}); - }, + values: obj => ({ rootPath: obj.rootPath}), children: [ { id: "preplots", name: "Preplots", values: (obj) => ({ - preplots: obj.preplots, + preplots: structuredClone(obj.preplots), rootPath: obj.rootPath - }), - save: async (data, cfg) => { - await this.patch({preplots: [...data.preplots]}) - } + }) }, { id: "raw_data", @@ -278,16 +256,14 @@ export default { name: "P1/11", values: (obj) => ({ rootPath: obj.rootPath, - globs: [...obj.raw.p111.globs], - paths: [...obj.raw.p111.paths], - pattern: structuredClone(obj.raw.p111.pattern) - }), - save: async (data, cfg) => { - await this.patch({raw: {p111: {...data}}}); - } + globs: obj.raw.p111.globs, + paths: obj.raw.p111.paths, + pattern: obj.raw?.p111?.pattern, + lineNameInfo: obj.raw?.p111?.lineNameInfo + }) }, { - id: "raw_data_smartsource", + id: "raw_data_smsrc", name: "Smartsource", values: (obj) => ({ rootPath: obj.rootPath, @@ -305,19 +281,7 @@ export default { values: (obj) => ({ regex: obj.raw.ntbp?.pattern?.regex, flags: obj.raw.ntbp?.pattern?.flags - }), - save: async (data, cfg) => { - await this.patch({ - raw:{ - ntbp: { - pattern: { - regex: data.regex, - flags: data.flags - } - } - } - }) - } + }) } ] }, @@ -330,13 +294,10 @@ export default { name: "P1/11", values: (obj) => ({ rootPath: obj.rootPath, - globs: [...obj.final.p111.globs], - paths: [...obj.final.p111.paths], - pattern: structuredClone(obj.final.p111.pattern) - }), - save: async (data, cfg) => { - await this.patch({final: {p111: {...data}}}); - } + globs: obj.final.p111.globs, + paths: obj.final.p111.paths, + pattern: obj.final.p111.pattern + }) }, { id: "final_data_pending", @@ -344,19 +305,7 @@ export default { values: (obj) => ({ regex: obj.final.pending?.pattern?.regex, flags: obj.final.pending?.pattern?.flags - }), - save: async (data, cfg) => { - await this.patch({ - final:{ - pending: { - pattern: { - regex: data.regex, - flags: data.flags - } - } - } - }) - } + }) } ] }, @@ -365,52 +314,19 @@ export default { { id: "line_name_format", name: "Line name format", - values: (obj) => ({...obj.online?.line?.pattern}), - save: async (data, cfg) => { - await this.patch({ - online: { - line: { - pattern: { - ...data - } - } - } - }); - } + values: (obj) => ({ + lineNameInfo: obj?.online?.line?.lineNameInfo + }) }, { id: "planner_settings", name: "Planner settings", - values: (obj) => ({...obj.planner}), - save: async (data, cfg) => { - await this.patch({ - planner: {...data} - }); - } + values: (obj) => ({planner: obj?.planner}) }, { id: "production", name: "Production settings", - values: (obj) => ({...obj.production}), - save: async (data, cfg) => { - await this.patch({ - production: {...data} - }); - } - }, - { - id: "logging", - name: "Logging", - children: [ - { - id: "logging_preset_comments", - name: "Preset comments" - }, - { - id: "logging_labels", - name: "Labels" - } - ] + values: (obj) => ({production: obj?.production}) }, { id: "cloud_apis", @@ -419,10 +335,7 @@ export default { { id: "asaqc", name: "ASAQC", - values: (obj) => ({...obj.asaqc}), - save: async (data, cfg) => { - await this.patch({asaqc: {...cfg}}); - } + values: (obj) => ({value: obj?.cloud?.asaqc}), } ] } @@ -530,20 +443,12 @@ export default { this.active.pop(); }, - async save (data) { - console.log("SAVING", data); - if (this.activeItem?.save) { - await this.activeItem.save(data, this.configuration); - /* - const cfg = this.activeItem.save(data, this.configuration); - this.configuration = {...cfg}; - - this.surveyState = false; - */ - // TODO And now push to the server - } + merge ([path, value]) { + console.log("MERGING", path, value); + deepSet(this.configuration, path, value); }, + // Use to change the project's archival status async patch (data) { const url = `/project/${this.$route.params.project}/configuration`; const init = {