Files
dougal-software/lib/www/client/source/src/components/project-settings/input-smartsource-segy.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

139 lines
3.1 KiB
Vue

<template>
<dougal-project-settings-file-matching-parameters
title="Smartsource hydrophone data"
subtitle="Smartsource SEG-Y hydrophone data 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 setIfDifferent from '@/lib/watcher-mixin';
import DougalProjectSettingsFileMatchingParameters from '@/components/project-settings/file-matching-parameters';
import { mapActions, mapGetters } from 'vuex';
export default {
name: "DougalProjectSettingsSmartsourceSegy",
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?.raw?.source?.smsrc?.segy) {
deepSet(this.value, [ "raw", "source", "smsrc", "segy" ], {
globs: [ "**/*.hdr", "**/*.HDR" ],
paths: [],
lineNameInfo: {
example: "",
fields: {
line: {
length: 4,
type: "int"
},
sequence: {
length: 3,
type: "int"
}
}
}
});
}
return this.value.raw.source.smsrc.segy;
} else {
return {
globs: [ "**/*.hdr", "**/*.HDR" ],
paths: [],
lineNameInfo: {
example: "",
fields: {
}
}
};
}
},
set (v) {
if (this.value) {
deepSet(this.value, [ "raw", "source", "smsrc", "segy" ], 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>