diff options
Diffstat (limited to 'catalog-ui/src/app/view-models')
3 files changed, 19 insertions, 17 deletions
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 ce098009f3..d9dc40bdaf 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 @@ export class PluginsTabViewModel { 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 76010b56f4..ca8c269116 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 @@ export class PluginsContextViewModel { 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 59dd2d8f00..0f9d7590c7 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 @@ export class WorkspaceViewModel { 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"]; - - if (displayOptions.displayContext.indexOf(this.$scope.component.componentType) !== -1) { - menuItemsObjects.push({ - text: displayOptions.displayName, - action: 'onMenuItemPressed', - state: 'workspace.plugins', - params: {path: plugin.pluginStateUrl} - }); - } + // 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.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) { |