WIP Adding support for Text entry measurements (renamed from List).
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
<div>
|
||||
<SimpleEntry v-if="measure.config.type === 'simple'"
|
||||
:measure=measure v-model=value />
|
||||
<TextEntry v-if="measure.config.type === 'text'"
|
||||
:measure=measure v-model=value />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" src="./measurement-entry.ts"></script>
|
||||
|
@ -2,7 +2,9 @@
|
||||
<fieldset>
|
||||
<div>
|
||||
<label for=timestamp>Timestamp</label>
|
||||
<input type=datetime-local
|
||||
<input
|
||||
name=timestamp
|
||||
type=datetime-local
|
||||
v-model=value.timestamp
|
||||
v-show=editTimestamp
|
||||
:disabled=disabled />
|
||||
|
26
web/src/components/measurement-entry/TextEntry.vue
Normal file
26
web/src/components/measurement-entry/TextEntry.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<fieldset>
|
||||
<div>
|
||||
<label for=timestamp>Timestamp</label>
|
||||
<input
|
||||
name=timestamp
|
||||
type=datetime-local
|
||||
v-model=value.timestamp
|
||||
v-show=editTimestamp
|
||||
:disabled=disabled />
|
||||
<span v-show="!editTimestamp">
|
||||
now <a href="#" v-on:click.stop.prevent="editTimestamp = true"> (set a time)</a>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<label for=measurementEntry>{{measure.name}}</label>
|
||||
<input
|
||||
name=measurementEntry
|
||||
required
|
||||
type=text
|
||||
v-model=value.extData.entry
|
||||
:disabled=disabled />
|
||||
</div>
|
||||
</fieldset>
|
||||
</template>
|
||||
<script lang="ts" src="./text-entry.ts"></script>
|
@ -1,9 +1,13 @@
|
||||
import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator';
|
||||
import { Measure, MeasureConfig, MeasureType, Measurement, MeasurementMeta } from '@/models';
|
||||
import SimpleEntry from './SimpleEntry.vue';
|
||||
import TextEntry from './TextEntry.vue';
|
||||
|
||||
@Component({
|
||||
components: { SimpleEntry }
|
||||
components: {
|
||||
SimpleEntry,
|
||||
TextEntry
|
||||
}
|
||||
})
|
||||
export class MeasurementEntry extends Vue {
|
||||
@Prop() private measure!: Measure<MeasureConfig>;
|
||||
|
@ -11,8 +11,6 @@ export class SimpleEntry extends Vue {
|
||||
@Watch('value', { immediate: true, deep: true })
|
||||
@Emit('input')
|
||||
private onMeasurementChanged(newVal: Measurement<MeasurementMeta>, oldVal: Measurement<MeasurementMeta>) {
|
||||
newVal.extData.measureType = 'simple' as MeasureType;
|
||||
|
||||
if (typeof(newVal.value) === 'string' ) {
|
||||
newVal.value = parseInt(newVal.value, 10);
|
||||
}
|
||||
|
13
web/src/components/measurement-entry/text-entry.ts
Normal file
13
web/src/components/measurement-entry/text-entry.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator';
|
||||
import { Measure, MeasureConfig, MeasureType, Measurement, MeasurementMeta } from '@/models';
|
||||
|
||||
@Component({})
|
||||
export class TextEntry extends Vue {
|
||||
@Prop() public measure!: Measure<MeasureConfig>;
|
||||
@Prop() public value!: Measurement<MeasurementMeta>;
|
||||
@Prop() public disabled!: boolean;
|
||||
private editTimestamp: boolean = false;
|
||||
|
||||
}
|
||||
|
||||
export default TextEntry;
|
Reference in New Issue
Block a user