Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions apps/workflowengine/js/workflowengine.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/workflowengine/js/workflowengine.js.map

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions apps/workflowengine/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ function () {
class_exists(Template::class, true);
}

style(self::APP_ID, [
'admin',
]);

script('core', [
'files/fileinfo',
'files/client',
Expand Down
9 changes: 5 additions & 4 deletions apps/workflowengine/src/components/Check.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class="option"
@input="updateCheck"
@valid="(valid=true) && validate()"
@invalid="(valid=false) && validate()" />
@invalid="!(valid=false) && validate()" />
<input v-else
v-model="check.value"
type="text"
Expand Down Expand Up @@ -111,7 +111,7 @@ export default {
if (this.check.class === null) {
this.$nextTick(() => this.$refs.checkSelector.$el.focus())
}
this.check.invalid = !this.validate()
this.validate()
},
methods: {
showDelete() {
Expand All @@ -124,7 +124,8 @@ export default {
if (this.currentOption && this.currentOption.validate) {
this.valid = !!this.currentOption.validate(this.check)
}
return this.valid
this.check.invalid = !this.valid
this.$emit('validate', this.valid)
},
updateCheck() {
const matchingOperator = this.operators.findIndex((operator) => this.check.operator === operator.operator)
Expand All @@ -134,7 +135,7 @@ export default {
this.check.class = this.currentOption.class
this.check.operator = this.currentOperator.operator

this.check.invalid = !this.validate()
this.validate()

this.$emit('update', this.check)
},
Expand Down
17 changes: 13 additions & 4 deletions apps/workflowengine/src/components/Checks/RequestTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default {
},
}
},
mounted() {
this.validate()
},
methods: {
updateInternalValue(value) {
try {
Expand All @@ -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
}
},
},
Expand Down
25 changes: 10 additions & 15 deletions apps/workflowengine/src/components/Rule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<Check :check="check"
:rule="rule"
@update="updateRule"
@validate="validate"
@remove="removeCheck(check)" />
</p>
<p>
Expand Down Expand Up @@ -77,7 +78,6 @@ export default {
checks: [],
error: null,
dirty: this.rule.id < 0,
checking: false,
originalRule: null,
}
},
Expand All @@ -93,7 +93,7 @@ export default {
tooltip: { placement: 'bottom', show: true, content: this.error },
}
}
if (!this.dirty || this.checking) {
if (!this.dirty) {
return { title: t('workflowengine', 'Active'), class: 'icon icon-checkmark' }
}
return { title: t('workflowengine', 'Save'), class: 'icon-confirm-white primary' }
Expand All @@ -112,22 +112,17 @@ export default {
this.$set(this.rule, 'operation', operation)
await this.updateRule()
},
async updateRule() {
this.checking = true
validate(state) {
this.error = null
this.$store.dispatch('updateRule', this.rule)
},
updateRule() {
if (!this.dirty) {
this.dirty = true
}
try {
// TODO: add new verify endpoint
// let result = await axios.post(OC.generateUrl(`/apps/workflowengine/operations/test`), this.rule)
this.error = null
this.checking = false
this.$store.dispatch('updateRule', this.rule)
} catch (e) {
console.error('Failed to update operation', e)
this.error = e.response.ocs.meta.message
this.checking = false
}

this.error = null
this.$store.dispatch('updateRule', this.rule)
},
async saveRule() {
try {
Expand Down
4 changes: 3 additions & 1 deletion apps/workflowengine/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ const store = new Vuex.Store({
context.commit('removeRule', rule)
},
async pushUpdateRule(context, rule) {
await confirmPassword()
if (context.state.scope === 0) {
await confirmPassword()
}
let result
if (rule.id < 0) {
result = await axios.post(getApiUrl(''), rule)
Expand Down
2 changes: 2 additions & 0 deletions apps/workflowengine/src/workflowengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*
*/

import '@babel/polyfill'

import Vue from 'vue'
import Vuex from 'vuex'
import store from './store'
Expand Down