aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src')
-rw-r--r--catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts4
-rw-r--r--catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts2
-rw-r--r--catalog-ui/src/app/ng2/services/plugins.service.ts6
-rw-r--r--catalog-ui/src/app/services/components/component-service.ts4
-rw-r--r--catalog-ui/src/app/services/components/service-service.ts3
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view-model.ts65
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view.html6
7 files changed, 52 insertions, 38 deletions
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 12f8df8296..a0b6b2b543 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
@@ -143,9 +143,9 @@ export class TopNavComponent {
}
}
- goToState(state:string, params:Array<any>):Promise<boolean> {
+ goToState(state:string, params:any):Promise<boolean> {
return new Promise((resolve, reject) => {
- this.$state.go(state, params && params.length > 0 ? [0] : undefined);
+ this.$state.go(state, params || undefined);
resolve(true);
});
}
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 eb7d138232..fc0af53a44 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
@@ -48,7 +48,7 @@ export class PluginFrameComponent implements OnInit {
// Listening to the stateChangeStart event in order to notify the plugin about it being closed
// before moving to a new state
this.$scope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) => {
- if (fromState.name !== toState.name) {
+ if ((fromState.name !== toState.name) || (fromState.name === toState.name) && (toParams.path !== fromParams.path)) {
if (!this.isClosed) {
event.preventDefault();
diff --git a/catalog-ui/src/app/ng2/services/plugins.service.ts b/catalog-ui/src/app/ng2/services/plugins.service.ts
index 12432256d7..4ec90d1ac4 100644
--- a/catalog-ui/src/app/ng2/services/plugins.service.ts
+++ b/catalog-ui/src/app/ng2/services/plugins.service.ts
@@ -13,5 +13,11 @@ export class PluginsService {
});
return PluginsConfiguration.plugins[pluginKey];
+ };
+
+ public isPluginDisplayedInContext = (plugin: Plugin ,userRole: string, contextType: string) => {
+ return plugin.pluginDisplayOptions["context"] &&
+ plugin.pluginDisplayOptions["context"].displayRoles.includes(userRole) &&
+ plugin.pluginDisplayOptions["context"].displayContext.indexOf(contextType) !== -1
}
}
diff --git a/catalog-ui/src/app/services/components/component-service.ts b/catalog-ui/src/app/services/components/component-service.ts
index 74166a0c9f..8331bdbfb6 100644
--- a/catalog-ui/src/app/services/components/component-service.ts
+++ b/catalog-ui/src/app/services/components/component-service.ts
@@ -232,10 +232,10 @@ export class ComponentService implements IComponentService {
// Notifying about events before executing the actual actions
switch (state) {
- case "checkIn":
+ case "lifecycleState/CHECKIN":
this.eventBusService.notify("CHECK_IN");
break;
- case "submitForTesting":
+ case "lifecycleState/certificationRequest":
this.eventBusService.notify("SUBMIT_FOR_TESTING");
break;
}
diff --git a/catalog-ui/src/app/services/components/service-service.ts b/catalog-ui/src/app/services/components/service-service.ts
index d55cae75ce..ee3a02371a 100644
--- a/catalog-ui/src/app/services/components/service-service.ts
+++ b/catalog-ui/src/app/services/components/service-service.ts
@@ -42,7 +42,8 @@ export class ServiceService extends ComponentService implements IServiceService
'sdcConfig',
'Sdc.Services.SharingService',
'$q',
- '$base64'
+ '$base64',
+ 'EventBusService'
];
public distribution:string = "distribution";
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 01b3aa3b22..5d83c34db8 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,6 +37,7 @@ import {
} from "app/services";
import {FileUploadModel} from "../../directives/file-upload/file-upload";
import {EventBusService} from "../../ng2/services/event-bus.service";
+import {PluginsService} from "../../ng2/services/plugins.service";
export interface IWorkspaceViewModelScope extends ng.IScope {
@@ -119,7 +120,8 @@ export class WorkspaceViewModel {
'Notification',
'$stateParams',
'Sdc.Services.ProgressService',
- 'EventBusService'
+ 'EventBusService',
+ 'PluginsService'
];
constructor(private $scope:IWorkspaceViewModelScope,
@@ -139,7 +141,8 @@ export class WorkspaceViewModel {
private Notification:any,
private $stateParams:any,
private progressService:ProgressService,
- private eventBusService:EventBusService) {
+ private eventBusService:EventBusService,
+ private pluginsService:PluginsService) {
this.initScope();
this.initAfterScope();
@@ -669,8 +672,15 @@ export class WorkspaceViewModel {
let selectedIndex = selectedItem ? this.$scope.leftBarTabs.menuItems.indexOf(selectedItem) : 0;
- if (stateArray[1] === 'plugins') {
- selectedIndex += _.findIndex(PluginsConfiguration.plugins, (plugin: Plugin) => plugin.pluginStateUrl === this.$state.params.path);
+ if (stateArray[1] === 'plugins') {
+ _.forEach(PluginsConfiguration.plugins, (plugin) => {
+ if (plugin.pluginStateUrl == this.$state.params.path) {
+ return false;
+ }
+ else if (this.pluginsService.isPluginDisplayedInContext(plugin, this.role, this.$scope.component.getComponentSubType())) {
+ selectedIndex++;
+ }
+ });
}
this.$scope.leftBarTabs.selectedIndex = selectedIndex;
@@ -678,7 +688,7 @@ export class WorkspaceViewModel {
this.$scope.isSelected = (menuItem:MenuItem): boolean => {
return this.$scope.leftBarTabs.selectedIndex === _.indexOf(this.$scope.leftBarTabs.menuItems, menuItem);
- }
+ };
this.$scope.$watch('$state.current.name', (newVal:string):void => {
if (newVal) {
@@ -730,9 +740,9 @@ export class WorkspaceViewModel {
return new MenuItem(text, null, States.WORKSPACE_GENERAL, 'goToState', [this.$state.params]);
};
- private updateMenuItemByRole = (menuItems:Array<MenuItem>, role:string) => {
- let tempMenuItems:Array<MenuItem> = new Array<MenuItem>();
- menuItems.forEach((item:MenuItem) => {
+ private updateMenuItemByRole = (menuItems:Array<any>, role:string) => {
+ let tempMenuItems:Array<any> = new Array<any>();
+ menuItems.forEach((item:any) => {
//remove item if role is disabled
if (!(item.disabledRoles && item.disabledRoles.indexOf(role) > -1)) {
tempMenuItems.push(item);
@@ -765,31 +775,28 @@ export class WorkspaceViewModel {
// 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}
- });
- }
+ if (this.pluginsService.isPluginDisplayedInContext(plugin, this.role, this.$scope.component.getComponentSubType())) {
+ menuItemsObjects.push({
+ text: plugin.pluginDisplayOptions["context"].displayName,
+ action: 'onMenuItemPressed',
+ state: 'workspace.plugins',
+ params: {path: plugin.pluginStateUrl}
+ });
}
});
this.$scope.leftBarTabs.menuItems = menuItemsObjects.map((item:MenuItem) => {
- if (item.params) {
- item.params.state = item.state;
+ const menuItem = new MenuItem(item.text, item.callback, item.state, item.action, item.params, item.blockedForTypes);
+ if (menuItem.params) {
+ menuItem.params.state = menuItem.state;
}
else {
- item.params = {state: item.state};
+ menuItem.params = {state: menuItem.state};
}
- item.callback = () => this.$scope[item.action](item.state, item.params);
- item.isDisabled = (inCreateMode && States.WORKSPACE_GENERAL != item.state) ||
- (States.WORKSPACE_DEPLOYMENT === item.state && this.$scope.component.groups && this.$scope.component.groups.length === 0 && this.$scope.component.isResource());
- return new MenuItem(item.text, item.callback, item.state, item.action, item.params, item.blockedForTypes);
+ menuItem.callback = () => this.$scope[menuItem.action](menuItem.state, menuItem.params);
+ menuItem.isDisabled = (inCreateMode && States.WORKSPACE_GENERAL != menuItem.state) ||
+ (States.WORKSPACE_DEPLOYMENT === menuItem.state && this.$scope.component.groups && this.$scope.component.groups.length === 0 && this.$scope.component.isResource());
+ return menuItem;
});
if (this.cacheService.get('breadcrumbsComponents')) {
@@ -822,4 +829,4 @@ export class WorkspaceViewModel {
});
};
-} \ No newline at end of file
+}
diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view.html b/catalog-ui/src/app/view-models/workspace/workspace-view.html
index 0f686b1d64..1452754024 100644
--- a/catalog-ui/src/app/view-models/workspace/workspace-view.html
+++ b/catalog-ui/src/app/view-models/workspace/workspace-view.html
@@ -5,8 +5,8 @@
<div class="menu-header" tooltips tooltip-content="{{menuComponentTitle}}">
{{menuComponentTitle}}
</div>
- <div class="i-sdc-designer-sidebar-section-content-item" ng-class="{'selected': menuItem.state == $state.current.name}" ng-repeat="menuItem in leftBarTabs.menuItems track by $index">
- <div class="expand-collapse-menu-box-item-text" ng-click="onMenuItemPressed(menuItem.state)" ng-class="{'disabled': menuItem.isDisabled }" data-tests-id="{{menuItem.text}}LeftSideMenu">{{menuItem.text}}</div>
+ <div class="i-sdc-designer-sidebar-section-content-item" ng-class="{'selected': isSelected(menuItem)}" ng-repeat="menuItem in leftBarTabs.menuItems track by $index">
+ <div class="expand-collapse-menu-box-item-text" ng-click="menuItem.callback()" ng-class="{'disabled': menuItem.isDisabled }" data-tests-id="{{menuItem.text}}LeftSideMenu">{{menuItem.text}}</div>
</div>
</div>
@@ -62,7 +62,7 @@
<span data-ng-if="isDesigner()" data-ng-class="{'disabled' :isDisableMode() || isViewMode() || !isActiveTopBar}" ng-click="revert()" class="sprite-new revert-btn" data-tests-id="revert"
data-ng-show="showFullIcons()" sdc-smart-tooltip="">Revert</span>
-
+
<span class="delimiter"></span>
<span class="sprite-new x-btn" data-ng-click="goToBreadcrumbHome()" sdc-smart-tooltip="">Close</span>