Files
dougal-software/lib/www/client/source/src/components/project-settings/input-final-p111.vue
D. Berge 62ab06b4a7 Refactor configuration GUI.
Another refactoring. What we're doing now is eliminating the
need to save individually on each section. Configuration changes
are done directly on the local configuration and then the local
configuration is saved, downloaded or discarded in one go.
2024-05-01 10:40:04 +02:00

150 lines
3.3 KiB
Vue

<template>
<dougal-project-settings-file-matching-parameters
title="Final P1/11"
subtitle="Final P1/11 files location and parameters."
v-bind="{rootPath: value.rootPath}"
v-bind.sync="bind"
:is-valid="isValid"
:save="save"
>
</dougal-project-settings-file-matching-parameters>
</template>
<style scoped>
.sample {
font-family: mono;
white-space: pre;
}
</style>
<script>
import { deepSet } from '@/lib/utils';
import DougalProjectSettingsFileMatchingParameters from '@/components/project-settings/file-matching-parameters';
import { mapActions, mapGetters } from 'vuex';
export default {
name: "DougalProjectSettingsFinal111",
components: {
DougalProjectSettingsFileMatchingParameters
},
props: {
title: String,
subtitle: String,
value: Object
},
data () {
return {
tab: null,
}
},
computed: {
// Current working object.
// A shortcut so we don't have to specify the full path
// on every input control. It also makes it easier to
// change that path if necessary. Finally, it ensures that
// the properties being modified are always available.
cwo: {
get () {
if (this.value) {
if (!this.value?.final?.p111) {
deepSet(this.value, [ "final", "p111" ], {
globs: [ "**/*.p111", "**/*.P111" ],
paths: [],
lineNameInfo: {
example: "",
fields: {
line: {
length: 4,
type: "int"
},
sequence: {
length: 3,
type: "int"
},
incr: {
length: 1,
type: "bool"
},
attempt: {
length: 1,
type: "int"
},
file_no: {
length: 3,
type: "int"
}
}
}
});
}
return this.value.final.p111;
} else {
return {
globs: [ "**/*.p111", "**/*.P111" ],
paths: [],
lineNameInfo: {
example: "",
fields: {
}
}
};
}
},
set (v) {
if (this.value) {
deepSet(this.value, [ "final", "p111" ], v);
}
}
},
bind () {
return {
globs: this.cwo?.globs,
paths: this.cwo?.paths,
pattern: this.cwo?.pattern,
lineNameInfo: this.cwo?.lineNameInfo
};
},
isValid () {
return !!(this.cwo?.paths.length && this.cwo?.globs.length && (
this.cwo?.pattern?.regex &&
["direction", "line", "sequence"].every( i => this.cwo?.pattern?.captures?.includes(i) )) || (
this.cwo?.lineNameInfo &&
this.cwo?.lineNameInfo?.fields &&
[ "line", "sequence", "incr" ].every( i =>
["offset", "length"].every( j => j in this.cwo?.lineNameInfo.fields[i] ))));
}
},
watch: {
},
methods: {
reset () {
},
save () {
},
back () {
this.$emit('close');
},
},
mounted () {
this.reset();
}
}
</script>