Adapt log for online shot input

This commit is contained in:
D. Berge
2020-09-04 01:29:00 +02:00
parent 45885c0081
commit 5b21f57587
2 changed files with 31 additions and 17 deletions

View File

@@ -180,7 +180,8 @@ export default {
sequences: { type: Object, default: null },
defaultTimestamp: { type: [ Date, String, Number, Function ], default: null },
defaultSequence: { type: Number, default: null },
defaultShotNumber: { type: Number, default: null },
defaultShotpoint: { type: Number, default: null },
eventMode: { type: String, default: "timed" },
presetRemarks: { type: [ Object, Array ], default: null },
presetLabels: { type: [ Object, Array ], default: null }
},
@@ -210,18 +211,20 @@ export default {
computed: {
eventType () {
return this.timeInput
? "timed"
: this.shotInput
? "seq"
: this.eventMode;
},
formTitle () {
if (this.timeInput) {
return "New event at time";
} else if (this.shotInput) {
return "New event at shotpoint";
} else if (this.defaultTimestamp) {
return "New event at " +
this.defaultTimestampAsDate.toISOString().replace(/(.{10})T(.{8}).{4}Z$/, "$1 $2");
} else if (this.defaultShotNumber) {
return "New event on shotpoint " + this.defaultShotNumber;
if (this.eventType == "seq") {
return `New event at shotpoint ${this.shot.point}`;
} else {
return "New event at time "+this.tstamp.toISOString().replace(/(.{10})T(.{8}).{4}Z$/, "$1 $2");
}
return "New event";
},
defaultTimestampAsDate () {
@@ -239,13 +242,13 @@ export default {
tstamp () {
return this.timeInput
? new Date(this.tsDate+"T"+this.tsTime+"Z")
: this.defaultTimestampAsDate;
: this.defaultTimestampAsDate || new Date();
},
shot () {
return this.shotInput
? { sequence: this.sequence, point: Number(this.point) }
: { sequence: this.defaultSequence, point: this.defaultShotNumber };
: { sequence: this.defaultSequence, point: this.defaultShotpoint };
},
isTimedEvent () {
@@ -255,7 +258,7 @@ export default {
isShotEvent () {
return Boolean((this.shotInput && this.shot.sequence && this.shot.point) ||
(this.defaultSequence && this.defaultShotNumber && !this.timeInput));
(this.defaultSequence && this.defaultShotpoint && !this.timeInput));
},
isValid () {
@@ -307,7 +310,8 @@ export default {
this.updateTimeFields();
await this.updateSequences();
this.sequence = this.defaultSequence;
this.point = this.defaultShotNumber;
this.point = this.defaultShotpoint;
this.shotInput = this.eventMode == "seq";
}
},

View File

@@ -23,7 +23,9 @@
:allowed-labels="userLabels"
:preset-remarks="presetRemarks"
:default-timestamp="defaultEventTimestamp"
:default-sequence="$route.params.sequence && (Number($route.params.sequence) || Number($route.params.sequence.split(';').sort().pop()))"
:default-sequence="defaultSequence"
:default-shotpoint="point"
:event-mode="online?'seq':'timed'"
@save="saveEvent"
></dougal-event-edit-dialog>
@@ -340,7 +342,15 @@ export default {
return filtered;
},
...mapGetters(['loading'])
defaultSequence () {
if (this.$route.params.sequence) {
return Number(this.$route.params.sequence.split(";").pop());
} else {
return this.sequence;
}
},
...mapGetters(['loading', 'online', 'sequence', 'line', 'point', 'lineName'])
},