22 <div id =" workflowengine" >
33 <NcSettingsSection :name =" t('workflowengine', 'Available flows')"
44 :doc-url =" workflowDocUrl" >
5- <p v-if =" scope === 0 " class =" settings-hint" >
5+ <p v-if =" isAdminScope " class =" settings-hint" >
66 <a href =" https://nextcloud.com/developer/" >{{ t('workflowengine', 'For details on how to write your own flow, check out the development documentation.') }}</a >
77 </p >
88
9- <transition-group name =" slide" tag =" div" class =" actions" >
10- <Operation v-for =" operation in getMainOperations"
9+ <NcEmptyContent v-if =" !isUserAdmin && mainOperations.length === 0"
10+ :name =" t('workflowengine', 'No flows installed')"
11+ :description =" !isUserAdmin ? t('workflowengine', 'Ask your administrator to install new flows.') : undefined" >
12+ <template #icon >
13+ <NcIconSvgWrapper :svg =" WorkflowOffSvg" :size =" 20" />
14+ </template >
15+ </NcEmptyContent >
16+ <transition-group v-else
17+ name =" slide"
18+ tag =" div"
19+ class =" actions" >
20+ <Operation v-for =" operation in mainOperations"
1121 :key =" operation.id"
1222 :operation =" operation"
1323 @click.native =" createNewRule(operation)" />
14-
1524 <a v-if =" showAppStoreHint"
16- : key =" ' add' "
25+ key =" add"
1726 :href =" appstoreUrl"
1827 class =" actions__item colored more" >
1928 <div class =" icon icon-add" />
3342 {{ showMoreOperations ? t('workflowengine', 'Show less') : t('workflowengine', 'Show more') }}
3443 </NcButton >
3544 </div >
36-
37- <h2 v-if =" scope === 0" class =" configured-flows" >
38- {{ t('workflowengine', 'Configured flows') }}
39- </h2 >
40- <h2 v-else class =" configured-flows" >
41- {{ t('workflowengine', 'Your flows') }}
42- </h2 >
4345 </NcSettingsSection >
4446
45- <transition-group v-if =" rules.length > 0" name =" slide" >
46- <Rule v-for =" rule in rules" :key =" rule.id" :rule =" rule" />
47- </transition-group >
47+ <NcSettingsSection v-if =" mainOperations.length > 0"
48+ :name =" isAdminScope ? t('workflowengine', 'Configured flows') : t('workflowengine', 'Your flows')" >
49+ <transition-group v-if =" rules.length > 0" name =" slide" >
50+ <Rule v-for =" rule in rules" :key =" rule.id" :rule =" rule" />
51+ </transition-group >
52+ <NcEmptyContent v-else :name =" t('workflowengine', 'No flows configured')" >
53+ <template #icon >
54+ <NcIconSvgWrapper :svg =" WorkflowOffSvg" :size =" 20" />
55+ </template >
56+ </NcEmptyContent >
57+ </NcSettingsSection >
4858 </div >
4959</template >
5060
5161<script >
5262import Rule from ' ./Rule.vue'
5363import Operation from ' ./Operation.vue'
54- import NcSettingsSection from ' @nextcloud/vue/dist/Components/NcSettingsSection.js'
5564import NcButton from ' @nextcloud/vue/dist/Components/NcButton.js'
65+ import NcEmptyContent from ' @nextcloud/vue/dist/Components/NcEmptyContent.js'
66+ import NcIconSvgWrapper from ' @nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
67+ import NcSettingsSection from ' @nextcloud/vue/dist/Components/NcSettingsSection.js'
5668import { mapGetters , mapState } from ' vuex'
5769import { generateUrl } from ' @nextcloud/router'
5870import { loadState } from ' @nextcloud/initial-state'
5971import MenuUp from ' vue-material-design-icons/MenuUp.vue'
6072import MenuDown from ' vue-material-design-icons/MenuDown.vue'
73+ import WorkflowOffSvg from ' ../../img/workflow-off.svg?raw'
6174
6275const ACTION_LIMIT = 3
76+ const ADMIN_SCOPE = 0
77+ // const PERSONAL_SCOPE = 1
6378
6479export default {
6580 name: ' Workflow' ,
6681 components: {
67- NcButton,
6882 MenuDown,
6983 MenuUp,
84+ NcButton,
85+ NcEmptyContent,
86+ NcIconSvgWrapper,
87+ NcSettingsSection,
7088 Operation,
7189 Rule,
72- NcSettingsSection,
7390 },
7491 data () {
7592 return {
7693 showMoreOperations: false ,
7794 appstoreUrl: generateUrl (' settings/apps/workflow' ),
7895 workflowDocUrl: loadState (' workflowengine' , ' doc-url' ),
96+ WorkflowOffSvg,
7997 }
8098 },
8199 computed: {
@@ -90,14 +108,20 @@ export default {
90108 hasMoreOperations () {
91109 return Object .keys (this .operations ).length > ACTION_LIMIT
92110 },
93- getMainOperations () {
111+ mainOperations () {
94112 if (this .showMoreOperations ) {
95113 return Object .values (this .operations )
96114 }
97115 return Object .values (this .operations ).slice (0 , ACTION_LIMIT )
98116 },
99117 showAppStoreHint () {
100- return this .scope === 0 && this .appstoreEnabled && OC .isUserAdmin ()
118+ return this .appstoreEnabled && OC .isUserAdmin ()
119+ },
120+ isUserAdmin () {
121+ return OC .isUserAdmin ()
122+ },
123+ isAdminScope () {
124+ return this .scope === ADMIN_SCOPE
101125 },
102126 },
103127 mounted () {
0 commit comments