From a59642337e47fd8c58a618cae4b9af1de7962270 Mon Sep 17 00:00:00 2001 From: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:50:13 +0200 Subject: [PATCH] [ACS-8410] Extension schema review (#3958) * [ACS-8410] Extension schema review * [ACS-8410] Remove the dot --- docs/extending/application-features.md | 59 ++++++++++++++------------ extension.schema.json | 23 +++------- 2 files changed, 38 insertions(+), 44 deletions(-) diff --git a/docs/extending/application-features.md b/docs/extending/application-features.md index e87c0f75d4..7b7f50b98e 100644 --- a/docs/extending/application-features.md +++ b/docs/extending/application-features.md @@ -36,7 +36,8 @@ All the customizations are stored in the `features` section of the configuration "extensions": [] }, "sidebar": [], - "content-metadata-presets": [] + "content-metadata-presets": [], + "badges": [] } } ``` @@ -147,32 +148,6 @@ Please refer to the [Content Actions](#content-actions) section for more details **Tip:** It is also possible to update or disable existing entries from within the external extension files. You will need to know the `id` of the target element to customize. -## Main action - -Add possibility to show application `Main Action` button. The action is going to be shown above the `New` button, additionally `Main Action` will be highlighted as primary button, and `New` as secondary. - -```json -{ - "$schema": "../../../extension.schema.json", - "$version": "1.0.0", - "$name": "plugin1", - - "features": { - "mainAction": { - "id": "plugin1.id", - "type": "button", - "title": "Create", - "actions": { - "click": "MAIN_ACTION_CALL" - }, - "rules": { - "enabled": "app.navigation.canCall" - } - } - } -} -``` - ## Navigation Bar The Navigation bar consists of Link elements (`NavBarLinkRef`) organized into Groups (`NavBarGroupRef`). @@ -754,6 +729,36 @@ Here is the initial setting from `app.extension.json`: **Tip:** In order to allow the content-metadata presets to be extended, the settings from `app.config.json` must be copied to the `app.extensions.json` file and its ids must be added to all the items. Having ids allows external plugins to extend the current setting. +## Badges + +If you would like to display any additional status information for any node you can create a badge for it. Badge is an icon that will be displayed inside document list in the name column, next to a name of the file. For each badge you can provide a custom tooltip, custom icon, a click action that will be triggered by clicking the badge and a custom rule for badge's visibility. The different badges are configured in the `app.extensions.json` file, but they can also be set on runtime through extension files. Badge may be defined like this: + +```json +{ + "id": "app.my-extension.badge", + "icon": "adf:custom-icon", + "tooltip": "MY_EXTENSION.BADGE_TOOLTIP", + "actions": { + "click": "CUSTOM_BADGE_ACTION" + }, + "rules": { + "visible": "app.my-extension.canDisplayCustomBadge" + } +} +``` + +There is also another option to provide the badge, which is registering the custom component for it that will display the icon. It is particularly useful when status that you want to add the badge for require some asynchronous operations. In that case badge configuration would look like this: + +```json +{ + "id": "app.my-extension.badge", + "component": "my-extension.components.my-badge-icon", + "rules": { + "visible": "app.my-extension.canDisplayCustomBadge" + } +} +``` + ## Search The search configurations are needed by the [Search Filter Component](https://www.alfresco.com/abn/adf/docs/content-services/components/search-filter.component/) to render the filters. diff --git a/extension.schema.json b/extension.schema.json index 22064d0a70..d1fac19d27 100644 --- a/extension.schema.json +++ b/extension.schema.json @@ -651,12 +651,6 @@ "items": { "ref": "#/definitions/contentActionRef" }, "minItems": 1 }, - "badges": { - "description": "List of badges to display in the name column", - "type": "array", - "items": { "$ref": "#/definitions/badge" }, - "minItems": 1 - }, "badge": { "type": "object", "required": ["id", "icon", "tooltip"], @@ -758,12 +752,6 @@ "items": { "$ref": "#/definitions/iconRef" }, "minItems": 1 }, - "userActions": { - "description": "User option menu extensions", - "type": "array", - "items": { "$ref": "#/definitions/contentActionRef" }, - "minItems": 1 - }, "header": { "description": "Application header extensions", "type": "array", @@ -776,11 +764,6 @@ "items": { "$ref": "#/definitions/contentActionRef" }, "minItems": 1 }, - "mainAction": { - "description": "Main actions displayed on every page", - "type": "object", - "$ref": "#/definitions/contentActionRef" - }, "viewer": { "description": "Viewer component extensions", "type": "object", @@ -933,6 +916,12 @@ } } }, + "badges": { + "description": "List of badges to display in the name column", + "type": "array", + "items": { "$ref": "#/definitions/badge" }, + "minItems": 1 + }, "search": { "description": "aca search extension", "type": "array",