From 2b9dcf9565a38ce6def32a47c05f792c506289b6 Mon Sep 17 00:00:00 2001 From: Stig Ofstad Date: Tue, 28 May 2024 12:27:42 +0200 Subject: [PATCH] docs: add docs on HeaderPlugin --- .../blueprints/header/HeaderPluginConfig.json | 7 +++- .../HeaderPlugin/Documentation.mdx} | 39 ++++++++++++++---- .../docs/HeaderPlugin/blueprints.json | 4 ++ .../HeaderPlugin}/headerPlugin.png | Bin 4 files changed, 41 insertions(+), 9 deletions(-) rename packages/dm-core-plugins/{src/header/README.mdx => docs/HeaderPlugin/Documentation.mdx} (53%) create mode 100644 packages/dm-core-plugins/docs/HeaderPlugin/blueprints.json rename packages/dm-core-plugins/{src/header => docs/HeaderPlugin}/headerPlugin.png (100%) diff --git a/packages/dm-core-plugins/blueprints/header/HeaderPluginConfig.json b/packages/dm-core-plugins/blueprints/header/HeaderPluginConfig.json index e2a2e2cd8..980be9c4f 100644 --- a/packages/dm-core-plugins/blueprints/header/HeaderPluginConfig.json +++ b/packages/dm-core-plugins/blueprints/header/HeaderPluginConfig.json @@ -11,24 +11,29 @@ "name": "hideAbout", "type": "dmss://system/SIMOS/BlueprintAttribute", "attributeType": "boolean", + "description": "Hide the about link in the header", "default": false }, { "name": "hideUserInfo", "type": "dmss://system/SIMOS/BlueprintAttribute", "attributeType": "boolean", + "description": "Hide the user info in the header", "default": false }, { "name": "uiRecipesList", "type": "dmss://system/SIMOS/BlueprintAttribute", "attributeType": "string", - "dimensions": "*" + "dimensions": "*", + "description": "Can be used to specify a list of UI recipes the user can select. By default, the fist UI recipe in\n the list is displayed. If the list is empty, all UI recipes will be included." }, { "name": "adminRole", "type": "dmss://system/SIMOS/BlueprintAttribute", "attributeType": "string", + "default": "dmss-admin", + "description": "The role that is considered an admin role. If the user has this role, the user will see the 'admin menu' in the header.", "optional": true } ] diff --git a/packages/dm-core-plugins/src/header/README.mdx b/packages/dm-core-plugins/docs/HeaderPlugin/Documentation.mdx similarity index 53% rename from packages/dm-core-plugins/src/header/README.mdx rename to packages/dm-core-plugins/docs/HeaderPlugin/Documentation.mdx index 37e019f37..8094596af 100644 --- a/packages/dm-core-plugins/src/header/README.mdx +++ b/packages/dm-core-plugins/docs/HeaderPlugin/Documentation.mdx @@ -1,19 +1,15 @@ import headerPluginConfig from '../../blueprints/header/HeaderPluginConfig.json' - -# Data Modelling Framework - UiPlugin - Header - The `header` plugin is meant to be used as a web application header. Providing user information, application information, and an application recipe selector. Below the header, another UI plugin is displayed. If you want to specify a config object in some UiRecipe-entity, the Blueprint is included in the npm package. -Copy it like so: `cp -R node_modules/@development-framework/dm-core-plugins/blueprint/header ./myApplicationBlueprints/` +Copy it like so: `cp -R node_modules/@development-framework/dm-core-plugins/blueprints/header ./myApplicationBlueprints/` # Config -The Header plugin can accept a config of type `HeaderPluginConfig` ( -see `dm-core-plugins/blueprints/header/HeaderPluginConfig.json`). +The Header plugin can accept a config of type `HeaderPluginConfig`. Explanation of the attributes: * `uiRecipesList`: Can be used to specify a list of UI recipes the user can select. By default, the fist UI recipe in @@ -23,10 +19,37 @@ Explanation of the attributes: defaults to false. * `hideUserInfo`: Is a boolean value that determines if the User info button in the header is activated. If not specified, defaults to false. +* `adminRole`: The role that is considered an admin role. If the user has this role, the user will see the 'admin menu' in the header. -![alt text](image.png) +![headerPlugin](./headerPlugin.png) ```json -{headerPluginConfig} +{ + "type": "CORE:RecipeLink", + "_blueprintPath_": "/apps/ExampleApplication/ExampleApplication", + "initialUiRecipe": { + "name": "Header", + "type": "CORE:UiRecipe", + "plugin": "@development-framework/dm-core-plugins/header", + "config": { + "type": "PLUGINS:dm-core-plugins/header/HeaderPluginConfig", + "hideAbout": false, + "hideUserInfo": false, + "uiRecipesList": ["Explorer", "Yaml"] + } + }, + "uiRecipes": [ + { + "name": "Explorer", + "type": "CORE:UiRecipe", + "plugin": "@development-framework/dm-core-plugins/explorer" + }, + { + "name": "Yaml", + "type": "CORE:UiRecipe", + "plugin": "@development-framework/dm-core-plugins/yaml" + } + ] +} ``` \ No newline at end of file diff --git a/packages/dm-core-plugins/docs/HeaderPlugin/blueprints.json b/packages/dm-core-plugins/docs/HeaderPlugin/blueprints.json new file mode 100644 index 000000000..fa4cf133f --- /dev/null +++ b/packages/dm-core-plugins/docs/HeaderPlugin/blueprints.json @@ -0,0 +1,4 @@ +{ + "folder": "header", + "main": "HeaderPluginConfig" +} diff --git a/packages/dm-core-plugins/src/header/headerPlugin.png b/packages/dm-core-plugins/docs/HeaderPlugin/headerPlugin.png similarity index 100% rename from packages/dm-core-plugins/src/header/headerPlugin.png rename to packages/dm-core-plugins/docs/HeaderPlugin/headerPlugin.png