Align configuration for new design
Aligned the designers configuration according to the new design addition and changes
Change-Id: Id08942b5a8adbac10bbe76bdd8a2a6f093ec8b46
Issue-ID: SDC-975
Signed-off-by: Idan Amit <ia096e@intl.att.com>
diff --git a/catalog-ui/src/app/models/plugins-config.ts b/catalog-ui/src/app/models/plugins-config.ts
index 18782ec..3f687a3 100644
--- a/catalog-ui/src/app/models/plugins-config.ts
+++ b/catalog-ui/src/app/models/plugins-config.ts
@@ -1,17 +1,16 @@
export class Plugin {
pluginId: string;
- pluginHost: string;
- pluginPort: string;
- pluginPath: string;
+ pluginDiscoveryUrl: string;
+ pluginSourceUrl: string;
pluginStateUrl: string;
- pluginProtocol: string;
pluginDisplayOptions: Map<string, PluginDisplayOptions>;
}
export class PluginDisplayOptions {
displayName: string;
displayContext: Array<string>;
+ displayRoles: Array<string>;
}
export type Plugins = Array<Plugin>;
diff --git a/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts b/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts
index 5e43fec..b8b0e80 100644
--- a/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts
+++ b/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts
@@ -120,14 +120,15 @@
tmpArray.push(new MenuItem(hostedApp.navTitle, null, hostedApp.defaultState, "goToState", null, null));
}
});
-
- _.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
- if (plugin.pluginDisplayOptions["top"]) {
- tmpArray.push(new MenuItem(plugin.pluginDisplayOptions["top"].displayName, null, "plugins", "goToState", {path: plugin.pluginStateUrl}, null));
- }
- })
}
+ // Adding plugins to top-nav only if they can be displayed for the current connected user role
+ _.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
+ if (plugin.pluginDisplayOptions["tab"] && (this.user && plugin.pluginDisplayOptions["tab"].displayRoles.includes(this.user.role))) {
+ tmpArray.push(new MenuItem(plugin.pluginDisplayOptions["tab"].displayName, null, "plugins", "goToState", {path: plugin.pluginStateUrl}, null));
+ }
+ });
+
this.topLvlMenu = new MenuItemGroup(0, tmpArray, true);
this.topLvlMenu.selectedIndex = isNaN(this.topLvlSelectedIndex) ? this._getTopLvlSelectedIndexByState() : this.topLvlSelectedIndex;
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
index 169cad0..801dfa9 100644
--- a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
+++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts
@@ -21,10 +21,7 @@
ngOnInit(): void {
- this.pluginUrl = this.plugin.pluginProtocol + "://" +
- this.plugin.pluginHost + ":" +
- this.plugin.pluginPort +
- this.plugin.pluginPath;
+ this.pluginUrl = this.plugin.pluginSourceUrl;
if (this.queryParams && !_.isEmpty(this.queryParams)) {
_.forOwn(this.queryParams, (value, key) => {
diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts
index ce09800..d9dc40b 100644
--- a/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts
+++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts
@@ -34,7 +34,9 @@
this.$scope.user = this.cacheService.get('user');
this.$scope.queryParams = {
- userId: this.$scope.user.userId
+ userId: this.$scope.user.userId,
+ userRole: this.$scope.user.role,
+ displayType: "tab"
};
}
}
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts
index 76010b5..ca8c269 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts
@@ -33,6 +33,8 @@
this.$scope.queryParams = {
userId: this.$scope.user.userId,
+ userRole: this.$scope.user.role,
+ displayType: "context",
contextType: this.$scope.component.componentType,
uuid: this.$scope.component.uuid,
lifecycleState: this.$scope.component.lifecycleState,
diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
index 59dd2d8..0f9d759 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts
@@ -719,23 +719,21 @@
this.$scope.leftBarTabs = new MenuItemGroup();
const menuItemsObjects:Array<any> = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role);
- // Only need to add plugins to the menu if the current role is Designer
- if (this.role === "DESIGNER") {
- _.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
- if (plugin.pluginDisplayOptions["context"]) {
- let displayOptions : PluginDisplayOptions = plugin.pluginDisplayOptions["context"];
+ // Only adding plugins to the workspace if they can be displayed for the current user role
+ _.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
+ if (plugin.pluginDisplayOptions["context"] && plugin.pluginDisplayOptions["context"].displayRoles.includes(this.role)) {
+ let displayOptions : PluginDisplayOptions = plugin.pluginDisplayOptions["context"];
- if (displayOptions.displayContext.indexOf(this.$scope.component.componentType) !== -1) {
- menuItemsObjects.push({
- text: displayOptions.displayName,
- action: 'onMenuItemPressed',
- state: 'workspace.plugins',
- params: {path: plugin.pluginStateUrl}
- });
- }
+ if (displayOptions.displayContext.indexOf(this.$scope.component.getComponentSubType()) !== -1) {
+ menuItemsObjects.push({
+ text: displayOptions.displayName,
+ action: 'onMenuItemPressed',
+ state: 'workspace.plugins',
+ params: {path: plugin.pluginStateUrl}
+ });
}
- });
- }
+ }
+ });
this.$scope.leftBarTabs.menuItems = menuItemsObjects.map((item:MenuItem) => {
if (item.params) {