From 46f5455bd0ae67b9de2159f9d04b054a711832e1 Mon Sep 17 00:00:00 2001 From: Emmy Leke Date: Thu, 27 Apr 2023 18:09:01 +0100 Subject: [PATCH] Add 3-dots menu to resource lists --- .../admin/src/components/Apigw/CRouteList.vue | 103 +++++++++++++----- .../web/admin/src/components/CTheMainNav.vue | 1 + .../Connection/CExternalConnectionList.vue | 65 +++++++++-- client/web/admin/src/components/faIcons.js | 2 + client/web/admin/src/mixins/listHelpers.js | 34 ++++++ .../src/views/Automation/Session/List.vue | 6 +- .../src/views/Automation/Workflow/List.vue | 98 +++++++++++++++-- .../admin/src/views/Federation/Nodes/List.vue | 56 ++++++---- .../src/views/System/Application/List.vue | 81 ++++++++++++-- .../src/views/System/AuthClient/Editor.vue | 6 +- .../src/views/System/AuthClient/List.vue | 83 ++++++++++++-- .../admin/src/views/System/Queue/Editor.vue | 2 +- .../web/admin/src/views/System/Queue/List.vue | 60 ++++++++-- .../web/admin/src/views/System/Role/List.vue | 80 ++++++++++++-- .../views/System/SensitivityLevel/List.vue | 64 +++++++++-- .../admin/src/views/System/Template/List.vue | 77 +++++++++++-- .../web/admin/src/views/System/User/List.vue | 79 ++++++++++++-- .../components/Admin/Module/RelatedPages.vue | 7 +- .../compose/src/views/Admin/Charts/Edit.vue | 2 +- .../compose/src/views/Admin/Charts/List.vue | 68 ++++++++++-- .../compose/src/views/Admin/Modules/List.vue | 96 ++++++++++++---- .../web/compose/src/views/Namespace/Edit.vue | 22 +++- .../web/compose/src/views/Namespace/List.vue | 1 + .../compose/src/views/Namespace/Manage.vue | 103 +++++++++++++++--- client/web/reporter/src/components/faIcons.js | 2 + client/web/reporter/src/mixins/report.js | 2 +- client/web/reporter/src/views/Report/List.vue | 97 ++++++++++++++--- .../src/components/Configurator/Workflow.vue | 1 + client/web/workflow/src/components/faIcons.js | 2 + .../web/workflow/src/views/Workflow/List.vue | 103 ++++++++++++++++-- .../components/resourceList/CResourceList.vue | 23 +++- .../automation.workflows.yaml | 3 + .../en/corteza-webapp-admin/system.apigw.yaml | 2 + .../system.applications.yaml | 2 + .../system.authclients.yaml | 2 + .../system.connections.yaml | 3 + .../corteza-webapp-admin/system.queues.yaml | 4 +- .../en/corteza-webapp-admin/system.roles.yaml | 4 + .../system.sensitivityLevel.yaml | 2 + .../system.templates.yaml | 2 + .../en/corteza-webapp-admin/system.users.yaml | 5 + locale/en/corteza-webapp-compose/block.yaml | 1 + locale/en/corteza-webapp-compose/module.yaml | 1 + .../en/corteza-webapp-compose/namespace.yaml | 1 + .../corteza-webapp-compose/permissions.yaml | 1 + locale/en/corteza-webapp-reporter/list.yaml | 1 + .../corteza-webapp-reporter/permissions.yaml | 1 + locale/en/corteza-webapp-workflow/list.yaml | 2 + .../corteza-webapp-workflow/notification.yaml | 5 +- .../corteza-webapp-workflow/permissions.yaml | 1 + 50 files changed, 1231 insertions(+), 238 deletions(-) create mode 100644 locale/en/corteza-webapp-workflow/list.yaml diff --git a/client/web/admin/src/components/Apigw/CRouteList.vue b/client/web/admin/src/components/Apigw/CRouteList.vue index ac97be58b8..43e1e24407 100644 --- a/client/web/admin/src/components/Apigw/CRouteList.vue +++ b/client/web/admin/src/components/Apigw/CRouteList.vue @@ -35,7 +35,9 @@ }" class="h-100" + clickable @search="filterList" + @row-clicked="handleRowClicked" > - diff --git a/client/web/admin/src/components/CTheMainNav.vue b/client/web/admin/src/components/CTheMainNav.vue index 23d651aecd..dd158e3a2b 100644 --- a/client/web/admin/src/components/CTheMainNav.vue +++ b/client/web/admin/src/components/CTheMainNav.vue @@ -22,6 +22,7 @@ + diff --git a/client/web/admin/src/components/faIcons.js b/client/web/admin/src/components/faIcons.js index 2fabce2cb1..9c37890424 100644 --- a/client/web/admin/src/components/faIcons.js +++ b/client/web/admin/src/components/faIcons.js @@ -47,6 +47,7 @@ import { faQuestion, faStamp, faInfoCircle, + faEllipsisV, } from '@fortawesome/free-solid-svg-icons' import { @@ -111,4 +112,5 @@ library.add( faQuestion, faStamp, faInfoCircle, + faEllipsisV, ) diff --git a/client/web/admin/src/mixins/listHelpers.js b/client/web/admin/src/mixins/listHelpers.js index f95609b566..cd449a7750 100644 --- a/client/web/admin/src/mixins/listHelpers.js +++ b/client/web/admin/src/mixins/listHelpers.js @@ -197,5 +197,39 @@ export default { genericRowClass (item) { return { 'text-secondary': item && !!item.deletedAt } }, + + handleRowClicked (item) { + this.$router.push({ name: this.editRoute, params: { [this.primaryKey]: item[this.primaryKey] } }) + }, + + handleItemDelete ({ resource, resourceName, locale, api = 'system' }) { + this.incLoader() + const { deletedAt = '' } = resource + const method = deletedAt ? `${resourceName}Undelete` : `${resourceName}Delete` + const event = deletedAt ? 'undelete' : 'delete' + const toastLocale = locale || resourceName + const API = api === 'system' ? this.$SystemAPI : this.$AutomationAPI + + API[method](resource) + .then(() => { + this.toastSuccess(this.$t(`notification:${toastLocale}.${event}.success`)) + this.filterList() + }) + .catch(this.toastErrorHandler(this.$t(`notification:${toastLocale}.${event}.error`))) + .finally(() => { + this.decLoader() + }) + }, + + areActionsVisible ({ resource, conditions = [] }) { + const condition = conditions.some(c => { + if (!resource[c]) { + return false + } + + return true + }) + return condition + }, }, } diff --git a/client/web/admin/src/views/Automation/Session/List.vue b/client/web/admin/src/views/Automation/Session/List.vue index d6fb4a386d..ffd186dafa 100644 --- a/client/web/admin/src/views/Automation/Session/List.vue +++ b/client/web/admin/src/views/Automation/Session/List.vue @@ -26,10 +26,12 @@ resourceSingle: $t('general:label.session.single'), resourcePlural: $t('general:label.session.plural') }" + clickable sticky-header hide-search hide-total class="custom-resource-list-height-no-buttons" + @row-clicked="handleRowClicked" >