summaryrefslogtreecommitdiffstats
path: root/catalog-ui
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-03-13 19:59:46 +0200
committerIdan Amit <ia096e@intl.att.com>2018-03-13 20:02:12 +0200
commitfad1d735d7ac3896e28277c733920d15e105db6e (patch)
tree22dabd78b1383707776fc06ccd1c8b5814461131 /catalog-ui
parent0f3a80869bf57fc909ec5908601ba04271d92d97 (diff)
Fixed merge issues
Fixed merge issues that broke the behavior of the plugins development Change-Id: I6333944939628f745eb36c4619be33780881d27d Issue-ID: SDC-1126 Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui')
-rw-r--r--catalog-ui/configurations/dev.js1
-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
-rw-r--r--catalog-ui/webpack.server.js16
9 files changed, 65 insertions, 42 deletions
diff --git a/catalog-ui/configurations/dev.js b/catalog-ui/configurations/dev.js
index e15dae6b94..7e67dbbcb3 100644
--- a/catalog-ui/configurations/dev.js
+++ b/catalog-ui/configurations/dev.js
@@ -47,6 +47,7 @@ const SDC_CONFIG = {
"GET_lifecycle_state_CERTIFICATIONREQUEST":"lifecycleState/CERTIFICATIONREQUEST",
"GET_lifecycle_state_UNDOCHECKOUT":"lifecycleState/UNDOCHECKOUT",
"root": "/sdc1/feProxy/rest",
+ "no_proxy_root": "/sdc1/rest",
"PUT_service": "/v1/catalog/services/:id/metadata",
"GET_download_artifact": "/v1/catalog/",
"GET_SDC_Version": "/version",
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>
diff --git a/catalog-ui/webpack.server.js b/catalog-ui/webpack.server.js
index 608063aa02..f55be99715 100644
--- a/catalog-ui/webpack.server.js
+++ b/catalog-ui/webpack.server.js
@@ -40,15 +40,23 @@ module.exports = function(env) {
// Redirect all '/sdc1/feProxy/rest' to feHost
middlewares.push(
proxy(['/sdc1/feProxy/rest'],{
- target: 'http://' + loclahost + ':' + fePort,
+ target: 'http://localhost:' + fePort,
changeOrigin: true,
secure: false
}));
+ // Redirect all '/sdc1/rest' to feHost
+ middlewares.push(
+ proxy(['/sdc1/rest'],{
+ target: 'http://localhost:' + fePort,
+ changeOrigin: true,
+ secure: false
+ }));
+
// Redirect dcae urls to feHost
middlewares.push(
proxy(['/dcae','/sdc1/feProxy/dcae-api'],{
- target: 'http://' + loclahost + ':' + fePort,
+ target: 'http://localhost:' + fePort,
changeOrigin: true,
secure: false,
onProxyRes: (proxyRes, req, res) => {
@@ -62,7 +70,7 @@ module.exports = function(env) {
// Redirect onboarding urls to feHost
middlewares.push(
proxy(['/onboarding','/sdc1/feProxy/onboarding-api'],{
- target: 'http://' + loclahost + ':' + fePort,
+ target: 'http://localhost:' + fePort,
changeOrigin: true,
secure: false,
onProxyRes: (proxyRes, req, res) => {
@@ -78,4 +86,4 @@ module.exports = function(env) {
};
return ServerConfig;
-} \ No newline at end of file
+}