summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src/components/Checks
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-12-30 13:22:49 +0100
committerJulius Härtl <jus@bitgrid.net>2020-01-02 11:07:37 +0100
commit7320de184b9e783dad33d0fbb5e157917f682e3d (patch)
treef424c7b7a820bf6095950805730c88a033f7a475 /apps/workflowengine/src/components/Checks
parent75b217cf8ddc65a5e434268c6405b8f09c9a8a4e (diff)
downloadnextcloud-server-7320de184b9e783dad33d0fbb5e157917f682e3d.tar.gz
nextcloud-server-7320de184b9e783dad33d0fbb5e157917f682e3d.zip
Refactor validity propagation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/src/components/Checks')
-rw-r--r--apps/workflowengine/src/components/Checks/RequestTime.vue17
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/workflowengine/src/components/Checks/RequestTime.vue b/apps/workflowengine/src/components/Checks/RequestTime.vue
index df859c01866..42f5ff20671 100644
--- a/apps/workflowengine/src/components/Checks/RequestTime.vue
+++ b/apps/workflowengine/src/components/Checks/RequestTime.vue
@@ -50,6 +50,9 @@ export default {
},
}
},
+ mounted() {
+ this.validate()
+ },
methods: {
updateInternalValue(value) {
try {
@@ -66,17 +69,23 @@ export default {
}
},
validate() {
- return this.newValue.startTime && this.newValue.startTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i) !== null
+ this.valid = this.newValue.startTime && this.newValue.startTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i) !== null
&& this.newValue.endTime && this.newValue.endTime.match(/^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/i) !== null
&& moment.tz.zone(this.newValue.timezone) !== null
+ if (this.valid) {
+ this.$emit('valid')
+ } else {
+ this.$emit('invalid')
+ }
+ return this.valid
},
update() {
+ if (this.newValue.timezone === null) {
+ this.newValue.timezone = moment.tz.guess()
+ }
if (this.validate()) {
const output = `["${this.newValue.startTime} ${this.newValue.timezone}","${this.newValue.endTime} ${this.newValue.timezone}"]`
this.$emit('input', output)
- this.valid = true
- } else {
- this.valid = false
}
},
},