aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src/workflowengine.js
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-08-30 14:14:12 +0200
committerJulius Härtl <jus@bitgrid.net>2019-09-10 09:01:24 +0200
commitf36b50c5029f4540b3310a4249667a48dfdb7606 (patch)
tree6c886f6c3563deccab03acd12c1778278d5a0cb6 /apps/workflowengine/src/workflowengine.js
parentb3bafb1614df951127c2f3666ea254a31fceef5e (diff)
downloadnextcloud-server-f36b50c5029f4540b3310a4249667a48dfdb7606.tar.gz
nextcloud-server-f36b50c5029f4540b3310a4249667a48dfdb7606.zip
Migrate plugins to vuex store
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/src/workflowengine.js')
-rw-r--r--apps/workflowengine/src/workflowengine.js34
1 files changed, 32 insertions, 2 deletions
diff --git a/apps/workflowengine/src/workflowengine.js b/apps/workflowengine/src/workflowengine.js
index 866f049b0bf..bdf30397883 100644
--- a/apps/workflowengine/src/workflowengine.js
+++ b/apps/workflowengine/src/workflowengine.js
@@ -14,11 +14,41 @@ import Vuex from 'vuex'
import store from './store'
import Settings from './components/Workflow'
+import FileMimeType from './components/Values/FileMimeType';
-window.OCA.WorkflowEngine = OCA.WorkflowEngine
-Vue.use(Vuex)
+window.OCA.WorkflowEngine = Object.assign({}, OCA.WorkflowEngine, {
+ registerCheck: function (Plugin) {
+ store.commit('addPluginCheck', Plugin)
+ },
+ registerOperator: function (Plugin) {
+ store.commit('addPluginOperator', Plugin)
+ }
+})
+
+// Load legacy plugins for now and register them in the new plugin system
+Object.values(OCA.WorkflowEngine.Plugins).map((plugin) => {
+ if (plugin.component) {
+ return { ...plugin.getCheck(), component: plugin.component() }
+ }
+ return plugin.getCheck()
+}).forEach((legacyCheckPlugin) => window.OCA.WorkflowEngine.registerCheck(legacyCheckPlugin))
+
+// new way of registering checks
+window.OCA.WorkflowEngine.registerCheck({
+ class: 'OCA\\WorkflowEngine\\Check\\FileMimeType',
+ name: t('workflowengine', 'File MIME type'),
+ operators: [
+ { operator: 'is', name: t('workflowengine', 'is') },
+ { operator: '!is', name: t('workflowengine', 'is not') },
+ { operator: 'matches', name: t('workflowengine', 'matches') },
+ { operator: '!matches', name: t('workflowengine', 'does not match') }
+ ],
+ component: FileMimeType
+})
+Vue.use(Vuex)
Vue.prototype.t = t
+
const View = Vue.extend(Settings)
new View({
store