aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-05-30 14:19:51 +0200
committerGitHub <noreply@github.com>2024-05-30 14:19:51 +0200
commit99af78cd66cb489b52f985e9a5b7d165b60b0e82 (patch)
treee0ea396f5eefcd8a5a4b6f7ec35769d42cb32a7f /apps/workflowengine/src
parentf80282a5ed1891224e3fa71c69ca2d60412c4c63 (diff)
parent31b0a44cf65b6625636ea0fa15fb1a1122b525e1 (diff)
downloadnextcloud-server-99af78cd66cb489b52f985e9a5b7d165b60b0e82.tar.gz
nextcloud-server-99af78cd66cb489b52f985e9a5b7d165b60b0e82.zip
Merge branch 'master' into refactor/OC-Server-getL10NFactory
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
Diffstat (limited to 'apps/workflowengine/src')
-rw-r--r--apps/workflowengine/src/components/Checks/RequestUserGroup.vue21
-rw-r--r--apps/workflowengine/src/components/Checks/request.js2
-rw-r--r--apps/workflowengine/src/components/Workflow.vue64
-rw-r--r--apps/workflowengine/src/store.js7
4 files changed, 63 insertions, 31 deletions
diff --git a/apps/workflowengine/src/components/Checks/RequestUserGroup.vue b/apps/workflowengine/src/components/Checks/RequestUserGroup.vue
index 2b248153aa6..ee774b7939f 100644
--- a/apps/workflowengine/src/components/Checks/RequestUserGroup.vue
+++ b/apps/workflowengine/src/components/Checks/RequestUserGroup.vue
@@ -22,21 +22,26 @@
<template>
<div>
- <NcSelect :value="currentValue"
+ <NcSelect :aria-label-combobox="t('workflowengine', 'Select groups')"
+ :aria-label-listbox="t('workflowengine', 'Groups')"
+ :clearable="false"
:loading="status.isLoading && groups.length === 0"
+ :placeholder="t('workflowengine', 'Type to search for group …')"
:options="groups"
- :clearable="false"
+ :value="currentValue"
label="displayname"
- @search-change="searchAsync"
+ @search="searchAsync"
@input="(value) => $emit('input', value.id)" />
</div>
</template>
<script>
-import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
-import axios from '@nextcloud/axios'
+import { translate as t } from '@nextcloud/l10n'
import { generateOcsUrl } from '@nextcloud/router'
+import axios from '@nextcloud/axios'
+import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
+
const groups = []
const status = {
isLoading: false,
@@ -69,14 +74,18 @@ export default {
},
},
async mounted() {
+ // If empty, load first chunk of groups
if (this.groups.length === 0) {
await this.searchAsync('')
}
- if (this.currentValue === null) {
+ // If a current group is set but not in our list of groups then search for that group
+ if (this.currentValue === null && this.value) {
await this.searchAsync(this.value)
}
},
methods: {
+ t,
+
searchAsync(searchQuery) {
if (this.status.isLoading) {
return
diff --git a/apps/workflowengine/src/components/Checks/request.js b/apps/workflowengine/src/components/Checks/request.js
index 9f33bac6676..e04ed1b9c93 100644
--- a/apps/workflowengine/src/components/Checks/request.js
+++ b/apps/workflowengine/src/components/Checks/request.js
@@ -59,7 +59,7 @@ const RequestChecks = [
},
{
class: 'OCA\\WorkflowEngine\\Check\\UserGroupMembership',
- name: t('workflowengine', 'User group membership'),
+ name: t('workflowengine', 'Group membership'),
operators: [
{ operator: 'is', name: t('workflowengine', 'is member of') },
{ operator: '!is', name: t('workflowengine', 'is not member of') },
diff --git a/apps/workflowengine/src/components/Workflow.vue b/apps/workflowengine/src/components/Workflow.vue
index 96d633ee60d..342e7113251 100644
--- a/apps/workflowengine/src/components/Workflow.vue
+++ b/apps/workflowengine/src/components/Workflow.vue
@@ -2,18 +2,27 @@
<div id="workflowengine">
<NcSettingsSection :name="t('workflowengine', 'Available flows')"
:doc-url="workflowDocUrl">
- <p v-if="scope === 0" class="settings-hint">
+ <p v-if="isAdminScope" class="settings-hint">
<a href="https://nextcloud.com/developer/">{{ t('workflowengine', 'For details on how to write your own flow, check out the development documentation.') }}</a>
</p>
- <transition-group name="slide" tag="div" class="actions">
- <Operation v-for="operation in getMainOperations"
+ <NcEmptyContent v-if="!isUserAdmin && mainOperations.length === 0"
+ :name="t('workflowengine', 'No flows installed')"
+ :description="!isUserAdmin ? t('workflowengine', 'Ask your administrator to install new flows.') : undefined">
+ <template #icon>
+ <NcIconSvgWrapper :svg="WorkflowOffSvg" :size="20" />
+ </template>
+ </NcEmptyContent>
+ <transition-group v-else
+ name="slide"
+ tag="div"
+ class="actions">
+ <Operation v-for="operation in mainOperations"
:key="operation.id"
:operation="operation"
@click.native="createNewRule(operation)" />
-
<a v-if="showAppStoreHint"
- :key="'add'"
+ key="add"
:href="appstoreUrl"
class="actions__item colored more">
<div class="icon icon-add" />
@@ -33,49 +42,58 @@
{{ showMoreOperations ? t('workflowengine', 'Show less') : t('workflowengine', 'Show more') }}
</NcButton>
</div>
-
- <h2 v-if="scope === 0" class="configured-flows">
- {{ t('workflowengine', 'Configured flows') }}
- </h2>
- <h2 v-else class="configured-flows">
- {{ t('workflowengine', 'Your flows') }}
- </h2>
</NcSettingsSection>
- <transition-group v-if="rules.length > 0" name="slide">
- <Rule v-for="rule in rules" :key="rule.id" :rule="rule" />
- </transition-group>
+ <NcSettingsSection v-if="mainOperations.length > 0"
+ :name="isAdminScope ? t('workflowengine', 'Configured flows') : t('workflowengine', 'Your flows')">
+ <transition-group v-if="rules.length > 0" name="slide">
+ <Rule v-for="rule in rules" :key="rule.id" :rule="rule" />
+ </transition-group>
+ <NcEmptyContent v-else :name="t('workflowengine', 'No flows configured')">
+ <template #icon>
+ <NcIconSvgWrapper :svg="WorkflowOffSvg" :size="20" />
+ </template>
+ </NcEmptyContent>
+ </NcSettingsSection>
</div>
</template>
<script>
import Rule from './Rule.vue'
import Operation from './Operation.vue'
-import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
+import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
+import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
+import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'
import { mapGetters, mapState } from 'vuex'
import { generateUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
import MenuUp from 'vue-material-design-icons/MenuUp.vue'
import MenuDown from 'vue-material-design-icons/MenuDown.vue'
+import WorkflowOffSvg from '../../img/workflow-off.svg?raw'
const ACTION_LIMIT = 3
+const ADMIN_SCOPE = 0
+// const PERSONAL_SCOPE = 1
export default {
name: 'Workflow',
components: {
- NcButton,
MenuDown,
MenuUp,
+ NcButton,
+ NcEmptyContent,
+ NcIconSvgWrapper,
+ NcSettingsSection,
Operation,
Rule,
- NcSettingsSection,
},
data() {
return {
showMoreOperations: false,
appstoreUrl: generateUrl('settings/apps/workflow'),
workflowDocUrl: loadState('workflowengine', 'doc-url'),
+ WorkflowOffSvg,
}
},
computed: {
@@ -90,14 +108,20 @@ export default {
hasMoreOperations() {
return Object.keys(this.operations).length > ACTION_LIMIT
},
- getMainOperations() {
+ mainOperations() {
if (this.showMoreOperations) {
return Object.values(this.operations)
}
return Object.values(this.operations).slice(0, ACTION_LIMIT)
},
showAppStoreHint() {
- return this.scope === 0 && this.appstoreEnabled && OC.isUserAdmin()
+ return this.appstoreEnabled && OC.isUserAdmin()
+ },
+ isUserAdmin() {
+ return OC.isUserAdmin()
+ },
+ isAdminScope() {
+ return this.scope === ADMIN_SCOPE
},
},
mounted() {
diff --git a/apps/workflowengine/src/store.js b/apps/workflowengine/src/store.js
index 49c881e67b6..6f8905687cf 100644
--- a/apps/workflowengine/src/store.js
+++ b/apps/workflowengine/src/store.js
@@ -89,7 +89,8 @@ const store = new 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 === '') {
@@ -120,9 +121,7 @@ const store = new 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)