From 99e1063a5715dcfe3451e8d9d00c013f30d852b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 9 Sep 2019 16:52:11 +0200 Subject: [PATCH] Add user group selector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../src/components/Checks/FileMimeType.vue | 3 +- .../src/components/Checks/FileSystemTag.vue | 86 +++++++++---------- .../components/Checks/MultiselectTag/api.js | 10 +-- .../src/components/Checks/RequestTime.vue | 4 +- .../src/components/Checks/RequestURL.vue | 12 +-- .../components/Checks/RequestUserAgent.vue | 7 +- .../components/Checks/RequestUserGroup.vue | 77 +++++++++++++++++ .../src/components/Checks/file.js | 2 +- .../src/components/Checks/request.js | 5 +- apps/workflowengine/src/css/multiselect.css | 11 +++ apps/workflowengine/src/mixins/valueMixin.js | 54 ++++++++++++ 11 files changed, 208 insertions(+), 63 deletions(-) create mode 100644 apps/workflowengine/src/components/Checks/RequestUserGroup.vue create mode 100644 apps/workflowengine/src/css/multiselect.css create mode 100644 apps/workflowengine/src/mixins/valueMixin.js diff --git a/apps/workflowengine/src/components/Checks/FileMimeType.vue b/apps/workflowengine/src/components/Checks/FileMimeType.vue index a3e3798304..e99bf679f0 100644 --- a/apps/workflowengine/src/components/Checks/FileMimeType.vue +++ b/apps/workflowengine/src/components/Checks/FileMimeType.vue @@ -16,7 +16,8 @@ {{ props.option.label }} - + diff --git a/apps/workflowengine/src/components/Checks/FileSystemTag.vue b/apps/workflowengine/src/components/Checks/FileSystemTag.vue index ead4edf60c..2875b64d48 100644 --- a/apps/workflowengine/src/components/Checks/FileSystemTag.vue +++ b/apps/workflowengine/src/components/Checks/FileSystemTag.vue @@ -22,59 +22,59 @@ diff --git a/apps/workflowengine/src/components/Checks/file.js b/apps/workflowengine/src/components/Checks/file.js index 431a3f9358..80bd120079 100644 --- a/apps/workflowengine/src/components/Checks/file.js +++ b/apps/workflowengine/src/components/Checks/file.js @@ -22,7 +22,7 @@ import FileMimeType from './FileMimeType' import { stringValidator, validateIPv4, validateIPv6 } from './../../helpers/validators' -import FileSystemTag from './FileSystemTag'; +import FileSystemTag from './FileSystemTag' const FileChecks = [ { class: 'OCA\\WorkflowEngine\\Check\\FileName', diff --git a/apps/workflowengine/src/components/Checks/request.js b/apps/workflowengine/src/components/Checks/request.js index ee574f9de9..1059bf45b5 100644 --- a/apps/workflowengine/src/components/Checks/request.js +++ b/apps/workflowengine/src/components/Checks/request.js @@ -23,6 +23,7 @@ import RequestUserAgent from './RequestUserAgent' import RequestTime from './RequestTime' import RequestURL from './RequestURL' +import RequestUserGroup from './RequestUserGroup' const RequestChecks = [ { @@ -62,8 +63,8 @@ const RequestChecks = [ operators: [ { operator: 'is', name: t('workflowengine', 'is member of') }, { operator: '!is', name: t('workflowengine', 'is not member of') } - ] - // TODO: implement component + ], + component: RequestUserGroup } ] diff --git a/apps/workflowengine/src/css/multiselect.css b/apps/workflowengine/src/css/multiselect.css new file mode 100644 index 0000000000..8eb7583744 --- /dev/null +++ b/apps/workflowengine/src/css/multiselect.css @@ -0,0 +1,11 @@ +.multiselect::v-deep .multiselect__single { + display: flex; +} + +.option__icon { + min-width: 25px; +} + +input, .multiselect { + width: 100%; +} diff --git a/apps/workflowengine/src/mixins/valueMixin.js b/apps/workflowengine/src/mixins/valueMixin.js new file mode 100644 index 0000000000..e6ea5bbdcf --- /dev/null +++ b/apps/workflowengine/src/mixins/valueMixin.js @@ -0,0 +1,54 @@ +/* + * @copyright Copyright (c) 2019 Julius Härtl + * + * @author Julius Härtl + * + * @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 . + * + */ + +const valueMixin = { + props: { + value: { + type: String, + default: '' + }, + check: { + type: Object, + default: () => { return {} } + } + }, + data() { + return { + newValue: '' + } + }, + watch: { + value: { + immediate: true, + handler: function(value) { + this.updateInternalValue(value) + } + } + }, + methods: { + updateInternalValue(value) { + this.newValue = value + } + } +} + +export default valueMixin