Skip to content

Commit 20d0cad

Browse files
FNI18300mahesh-wor
authored andcommitted
Display version of custom plugins (geosolutions-it#11624)
1 parent 2829034 commit 20d0cad

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

docs/developer-guide/context-editor-config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The configuration file has this shape:
1010
{
1111
"name": "Map",
1212
"mandatory": true, // <-- mandatory should not be shown in editor OR not movable and directly added to the right list.
13+
"version": "1.2.3",
1314
}, {
1415
"name": "Notifications",
1516
"mandatory": true, // <-- mandatory should not be shown in editor OR not movable and directly added to the right list.
@@ -52,6 +53,7 @@ Each entry of `plugins` array is an object that describes the plugin, it's depen
5253
These are the properties allowed for the plugin entry object:
5354

5455
* `name`: `{string}` the name (ID) of the plugin
56+
* `version`: `{string}` the version of the plugn
5557
* `title`: `{string}` the title string OR messageId (from localization file)
5658
* `description`: `{string}`: the description string OR messageId (from localization file)
5759
* `docUrl`: `{string}`: the plugin/extension specific documentation url

web/client/components/contextcreator/ConfigurePluginsStep.jsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ const getAvailableTools = (plugin, onShowDialog, hideUploadExtension) => {
8383
}];
8484
};
8585

86+
const formatPluginTitle = (plugin) => {
87+
var version = '';
88+
if (plugin.version && plugin.version !== 'undefined') {
89+
version = ' (' + plugin.version + ')';
90+
}
91+
return (plugin.title || plugin.label || plugin.name) + version;
92+
};
93+
94+
const formatPluginDescription = (plugin) => {
95+
return plugin.description || 'plugin name: ' + plugin.name;
96+
};
97+
8698
/**
8799
* Converts plugin objects to Transform items
88100
* @param {string} editedPlugin currently edited plugin
@@ -128,9 +140,9 @@ const pluginsToItems = ({
128140
const isMandatory = plugin.forcedMandatory || plugin.mandatory;
129141
return {
130142
id: plugin.name,
131-
title: plugin.title || plugin.label || plugin.name,
143+
title: formatPluginTitle(plugin),
132144
cardSize: 'sm',
133-
description: plugin.description || 'plugin name: ' + plugin.name,
145+
description: formatPluginDescription(plugin),
134146
showDescriptionTooltip,
135147
descriptionTooltipDelay,
136148
mandatory: isMandatory,

web/client/reducers/contextcreator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const makeNode = (plugin, parent = null, plugins = [], localPlugins = []) => ({
7474
name: plugin.name,
7575
title: plugin.title,
7676
description: plugin.description,
77+
version: plugin.version,
7778
docUrl: plugin.docUrl, // custom documentation url (useful for plugin as extension with extension specific documentation)
7879
glyph: plugin.glyph,
7980
parent,

0 commit comments

Comments
 (0)