diff --git a/web/package-lock.json b/web/package-lock.json index 89fbc99..75cb590 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1059,6 +1059,14 @@ "@types/lodash": "*" } }, + "@types/lodash.omit": { + "version": "4.5.6", + "resolved": "https://registry.npmjs.org/@types/lodash.omit/-/lodash.omit-4.5.6.tgz", + "integrity": "sha512-KXPpOSNX2h0DAG2w7ajpk7TXvWF28ZHs5nJhOJyP0BQHkehgr948RVsToItMme6oi0XJkp19CbuNXkIX8FiBlQ==", + "requires": { + "@types/lodash": "*" + } + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", diff --git a/web/package.json b/web/package.json index 601c373..20faacf 100644 --- a/web/package.json +++ b/web/package.json @@ -18,6 +18,7 @@ "@types/lodash.assign": "^4.2.6", "@types/lodash.findindex": "^4.6.6", "@types/lodash.merge": "^4.6.6", + "@types/lodash.omit": "^4.5.6", "apexcharts": "^3.15.6", "axios": "^0.18.1", "js-cookie": "^2.2.1", diff --git a/web/src/components/measure-config/MeasureConfigForm.vue b/web/src/components/measure-config/MeasureConfigForm.vue index b127e1e..a9afcdd 100644 --- a/web/src/components/measure-config/MeasureConfigForm.vue +++ b/web/src/components/measure-config/MeasureConfigForm.vue @@ -2,9 +2,11 @@
diff --git a/web/src/components/measure-config/measure-config-form.ts b/web/src/components/measure-config/measure-config-form.ts index e8518dd..ad50aab 100644 --- a/web/src/components/measure-config/measure-config-form.ts +++ b/web/src/components/measure-config/measure-config-form.ts @@ -2,6 +2,7 @@ import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator'; import { logService } from '@/services/logging'; import { Measure, MeasureConfig } from '@/models'; import TextMeasureConfigForm from './TextMeasureConfigForm.vue'; +import moment from 'moment'; @Component({ components: { @@ -11,12 +12,41 @@ import TextMeasureConfigForm from './TextMeasureConfigForm.vue'; export class MeasureConfigForm extends Vue { @Prop({}) public value!: MeasureConfig; @Prop({}) public disabled: boolean = false; + @Prop({}) public measureExists: boolean = false; + + public now = moment(); + public formatStrings = [ + 'l', + 'L', + 'll', + 'LL', + 'lll', + 'LLL', + 'llll', + 'LLLL', + 'Y-MM-DD', + 'Y-MM-DDTHH:mm', + 'Y-MM-DDTHH:mm:ss', + 'Y-MM-DDTHH:mm:ss.SSSZZ', + 'MM/DD', + 'MMM Do', + 'HH:mm', + 'hh:mmA' + ]; + + private selectedFormat: string = 'l'; @Watch('value', { immediate: true, deep: true }) @Emit('input') private onConfigChanged(newVal: MeasureConfig, oldVal: MeasureConfig) { return newVal; } + + private formatSelectionChanged() { + if (this.selectedFormat !== 'custom') { + this.value.timestampDisplayFormat = this.selectedFormat; + } + } } export default MeasureConfigForm; diff --git a/web/src/components/measure-details/simple-details.ts b/web/src/components/measure-details/simple-details.ts index ef28330..ab8599a 100644 --- a/web/src/components/measure-details/simple-details.ts +++ b/web/src/components/measure-details/simple-details.ts @@ -1,10 +1,9 @@ import { Component, Prop, Vue } from 'vue-property-decorator'; import { Measure, MeasureConfig, MeasureType, Measurement, MeasurementMeta } from '@/models'; -import moment from 'moment'; import assign from 'lodash.assign'; import { library } from '@fortawesome/fontawesome-svg-core'; import { faPencilAlt } from '@fortawesome/free-solid-svg-icons'; -import { byTimestampComparator } from '@/util'; +import { byTimestampComparator, formatTS } from '@/util'; library.add(faPencilAlt); @@ -13,8 +12,6 @@ export class SimpleDetails extends Vue { @Prop() private measure!: Measure