From 0d626b017f7d2a256c86a50a25f804e7c4b813f7 Mon Sep 17 00:00:00 2001 From: ETLaurent Date: Thu, 10 Aug 2023 08:47:22 +0200 Subject: [PATCH] add utility operations in page manager (#4261) --- CHANGELOG.md | 1 + modules/@apostrophecms/page/index.js | 10 +++++++++- .../page/ui/apos/components/AposPagesManager.vue | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de1c41ffa..8bfbba7037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Add `@apostrophecms/log` module to allow structured logging. All modules have `logDebug`, `logInfo`, `logWarn` and `logError` methods now. See the [documentation](https://v3.docs.apostrophecms.org/guide/logging.html) for more details. * Add `@apostrophecms/settings` translations. * Add the ability to have custom modals for batch operations. +* Add the possibility to display utility operations inside a 3-dots menu on the page manager, the same way it is done for the docs manager. ### Changes diff --git a/modules/@apostrophecms/page/index.js b/modules/@apostrophecms/page/index.js index 7a5faaa15b..5cc19aea62 100644 --- a/modules/@apostrophecms/page/index.js +++ b/modules/@apostrophecms/page/index.js @@ -5,7 +5,7 @@ const { SemanticAttributes } = require('@opentelemetry/semantic-conventions'); const expressCacheOnDemand = require('express-cache-on-demand')(); module.exports = { - cascades: [ 'batchOperations' ], + cascades: [ 'batchOperations', 'utilityOperations' ], options: { alias: 'page', types: [ @@ -659,6 +659,13 @@ database.`); }; } } + }, + composeUtilityOperations() { + self.utilityOperations = Object.entries(self.utilityOperations || {}) + .map(([ action, properties ]) => ({ + action, + ...properties + })); } }, 'apostrophe:ready': { @@ -830,6 +837,7 @@ database.`); browserOptions.localized && Object.keys(self.apos.i18n.locales).length > 1 && Object.values(self.apos.i18n.locales).some(locale => locale._edit); + browserOptions.utilityOperations = self.utilityOperations; return browserOptions; }, // Returns a query that finds pages the current user can edit diff --git a/modules/@apostrophecms/page/ui/apos/components/AposPagesManager.vue b/modules/@apostrophecms/page/ui/apos/components/AposPagesManager.vue index 2cbd1c5185..3460c45059 100644 --- a/modules/@apostrophecms/page/ui/apos/components/AposPagesManager.vue +++ b/modules/@apostrophecms/page/ui/apos/components/AposPagesManager.vue @@ -20,6 +20,10 @@ />