aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src/store.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/src/store.js')
-rw-r--r--apps/workflowengine/src/store.js48
1 files changed, 18 insertions, 30 deletions
diff --git a/apps/workflowengine/src/store.js b/apps/workflowengine/src/store.js
index b6fb252cbed..84a76a644a8 100644
--- a/apps/workflowengine/src/store.js
+++ b/apps/workflowengine/src/store.js
@@ -1,35 +1,20 @@
/**
- * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import Vue from 'vue'
-import Vuex from 'vuex'
+import Vuex, { Store } from 'vuex'
import axios from '@nextcloud/axios'
-import { getApiUrl } from './helpers/api'
-import confirmPassword from '@nextcloud/password-confirmation'
+import { confirmPassword } from '@nextcloud/password-confirmation'
import { loadState } from '@nextcloud/initial-state'
+import { getApiUrl } from './helpers/api.js'
+
+import '@nextcloud/password-confirmation/dist/style.css'
Vue.use(Vuex)
-const store = new Vuex.Store({
+const store = new Store({
state: {
rules: [],
scope: loadState('workflowengine', 'scope'),
@@ -84,7 +69,8 @@ const store = new Vuex.Store({
context.commit('addRule', rule)
})
},
- createNewRule(context, rule) {
+ async createNewRule(context, rule) {
+ await confirmPassword()
let entity = null
let events = []
if (rule.isComplex === false && rule.fixedEntity === '') {
@@ -115,9 +101,7 @@ const store = new Vuex.Store({
context.commit('removeRule', rule)
},
async pushUpdateRule(context, rule) {
- if (context.state.scope === 0) {
- await confirmPassword()
- }
+ await confirmPassword()
let result
if (rule.id < 0) {
result = await axios.post(getApiUrl(''), rule)
@@ -143,6 +127,10 @@ const store = new Vuex.Store({
return rule1.id - rule2.id || rule2.class - rule1.class
})
},
+ /**
+ * @param state
+ * @return {OperatorPlugin}
+ */
getOperationForRule(state) {
return (rule) => state.operations[rule.class]
},
@@ -155,9 +143,9 @@ const store = new Vuex.Store({
/**
* Return all available checker plugins for a given entity class
- * @param {Object} state the store state
- * @param {Object} entity the entity class
- * @returns {Array} the available plugins
+ *
+ * @param {object} state the store state
+ * @return {Function} the available plugins
*/
getChecksForEntity(state) {
return (entity) => {