aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/utils
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-07-29 16:13:45 +0300
committerMichael Lando <ml636r@att.com>2018-07-29 16:20:34 +0300
commit5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch)
tree2f9dfc45191e723da69cf74be7829784e9741b94 /catalog-ui/src/app/utils
parent9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (diff)
re base code
Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5 Issue-ID: SDC-1566 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/utils')
-rw-r--r--catalog-ui/src/app/utils/common-utils.ts12
-rw-r--r--catalog-ui/src/app/utils/component-factory.ts10
-rw-r--r--catalog-ui/src/app/utils/constants.ts59
-rw-r--r--catalog-ui/src/app/utils/menu-handler.ts23
-rw-r--r--catalog-ui/src/app/utils/modals-handler.ts15
5 files changed, 101 insertions, 18 deletions
diff --git a/catalog-ui/src/app/utils/common-utils.ts b/catalog-ui/src/app/utils/common-utils.ts
index 1868550225..d215183fa9 100644
--- a/catalog-ui/src/app/utils/common-utils.ts
+++ b/catalog-ui/src/app/utils/common-utils.ts
@@ -23,6 +23,7 @@ import {Module, AttributeModel, ResourceInstance, PropertyModel, InputFEModel, O
import {ComponentInstanceFactory} from "./component-instance-factory";
import {InputBEModel, PropertyBEModel, RelationshipModel} from "app/models";
import { PolicyInstance } from "app/models/graph/zones/policy-instance";
+import { GroupInstance } from "../models/graph/zones/group-instance";
export class CommonUtils {
@@ -126,6 +127,17 @@ export class CommonUtils {
return policies;
}
+ static initGroups = (groupsObj: Array<GroupInstance>):Array<GroupInstance> => {
+ let groups = new Array<GroupInstance>();
+
+ if(groupsObj) {
+ _.forEach(groupsObj, (group: GroupInstance):void => {
+ groups.push(new GroupInstance(group));
+ });
+ }
+
+ return groups;
+ }
static initInterfaceOperations(interfaces: any): Array<OperationModel> {
diff --git a/catalog-ui/src/app/utils/component-factory.ts b/catalog-ui/src/app/utils/component-factory.ts
index bf4f23b6eb..bdcfc2cc2d 100644
--- a/catalog-ui/src/app/utils/component-factory.ts
+++ b/catalog-ui/src/app/utils/component-factory.ts
@@ -73,9 +73,11 @@ export class ComponentFactory {
public updateComponentFromCsar = (csarComponent:Resource, oldComponent:Resource):Component => {
_.pull(oldComponent.tags, oldComponent.name);
- oldComponent.name = csarComponent.name;
- oldComponent.selectedCategory = csarComponent.selectedCategory;
- oldComponent.categories = csarComponent.categories;
+ if (!oldComponent.isAlreadyCertified()) {
+ oldComponent.name = csarComponent.name;
+ oldComponent.categories = csarComponent.categories;
+ oldComponent.selectedCategory = csarComponent.selectedCategory;
+ }
oldComponent.vendorName = csarComponent.vendorName;
oldComponent.vendorRelease = csarComponent.vendorRelease;
oldComponent.csarUUID = csarComponent.csarUUID;
@@ -177,7 +179,7 @@ export class ComponentFactory {
};
public getComponentWithMetadataFromServer = (componentType:string, componentId:string):ng.IPromise<Component> => {
- let deferred = this.$q.defer();
+ let deferred = this.$q.defer<Component>();
let component = this.createEmptyComponent(componentType);
component.setUniqueId(componentId);
this.ComponentServiceNg2.getComponentMetadata(component).subscribe((response:ComponentGenericResponse) => {
diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts
index 9665999dcf..b0f22ac1f8 100644
--- a/catalog-ui/src/app/utils/constants.ts
+++ b/catalog-ui/src/app/utils/constants.ts
@@ -25,6 +25,13 @@
export let DEFAULT_ICON = 'defaulticon';
export let CP_END_POINT = 'CpEndPoint';
export let CHANGE_COMPONENT_CSAR_VERSION_FLAG = 'changeComponentCsarVersion';
+export let PREVIOUS_CSAR_COMPONENT = 'previousCsarComponent'
+
+
+export class GeneralStatus {
+ static OK = 'OK';
+ static GENERAL_ERROR = 'GENERAL_ERROR';
+}
export class ComponentType {
static SERVICE = 'SERVICE';
@@ -144,6 +151,11 @@ export enum FormState{
VIEW
}
+export class instantiationType {
+ public static MACRO = 'Macro';
+ public static A_LA_CARTE = 'A-la-carte';
+}
+
export class WorkspaceMode {
public static CREATE = 'create';
public static EDIT = 'edit';
@@ -159,6 +171,9 @@ export class ImagesUrl {
public static SELECTED_CP_INSTANCE = '/assets/styles/images/resource-icons/selectedCPInstance.png';
public static SELECTED_VL_INSTANCE = '/assets/styles/images/resource-icons/selectedVLInstance.png';
public static CANVAS_PLUS_ICON = '/assets/styles/images/resource-icons/canvasPlusIcon.png';
+ public static CANVAS_TAG_ICON = '/assets/styles/images/canvas-tagging-icons/indication.svg';
+ public static CANVAS_POLICY_TAGGED_ICON = '/assets/styles/images/canvas-tagging-icons/policy_added.svg';
+ public static CANVAS_GROUP_TAGGED_ICON = '/assets/styles/images/canvas-tagging-icons/group_added.svg';
public static MODULE_ICON = '/assets/styles/images/resource-icons/module.png';
public static OPEN_MODULE_ICON = '/assets/styles/images/resource-icons/openModule.png';
public static OPEN_MODULE_HOVER_ICON = '/assets/styles/images/resource-icons/openModuleHover.png';
@@ -166,6 +181,14 @@ export class ImagesUrl {
public static CLOSE_MODULE_HOVER_ICON = '/assets/styles/images/resource-icons/closeModuleHover.png';
}
+
+export class CanvasHandleTypes {
+ public static ADD_EDGE = 'add-edge';
+ public static TAG_AVAILABLE = 'tag-available';
+ public static TAGGED_POLICY = 'tagged-policy';
+ public static TAGGED_GROUP = 'tagged-group';
+}
+
export class ModalType {
static STANDARD = 'standard';
static ERROR = 'error';
@@ -247,22 +270,21 @@ export class States {
}
export class EVENTS {
- // static RESOURCE_LEFT_PALETTE_UPDATE_EVENT = "resourceLeftPanelUpdateEvent";
- // static RESOURCE_PNF_LEFT_PALETTE_UPDATE_EVENT = "resourcePNFLeftPanelUpdateEvent";
- // static SERVICE_LEFT_PALETTE_UPDATE_EVENT = "serviceLeftPanelUpdateEvent";
- //static VL_LEFT_PALETTE_UPDATE_EVENT = "vlLeftPanelUdateEvent";
static LEFT_PALETTE_UPDATE_EVENT = "leftPanelUpdateEvent";
static ON_CSAR_LOADING = "onCsarLoading";
static DOWNLOAD_ARTIFACT_FINISH_EVENT = "downloadArtifactFinishEvent";
static ON_WORKSPACE_SAVE_BUTTON_CLICK = "onWorkspaceSaveButtonClick";
static ON_WORKSPACE_SAVE_BUTTON_SUCCESS = "onWorkspaceSaveButtonSuccess";
static ON_WORKSPACE_SAVE_BUTTON_ERROR = "onWorkspaceSaveButtonError";
+ static ON_WORKSPACE_UNSAVED_CHANGES = "onWorkspaceUnsavedChanges";
static ON_CHECKOUT = "onCheckout";
- static ON_REVERT = "onRevert";
+ static ON_LIFECYCLE_CHANGE_WITH_SAVE = "onLifecycleChangeWithSave";
+ static ON_LIFECYCLE_CHANGE = "onCheckout";
//Loader events
static SHOW_LOADER_EVENT = "showLoaderEvent";
static HIDE_LOADER_EVENT = "hideLoaderEvent";
+ static UPDATE_PANEL = 'updatePanel';
}
@@ -282,6 +304,7 @@ export class GRAPH_EVENTS {
static ON_COMPOSITION_GRAPH_DATA_LOADED = 'onCompositionGraphDataLoaded';
static ON_DEPLOYMENT_GRAPH_DATA_LOADED = 'onDeploymentGraphDataLoaded';
static ON_NODE_SELECTED = "onNodeSelected";
+ static ON_ZONE_INSTANCE_SELECTED = "onZoneInstanceSelected";
static ON_GRAPH_BACKGROUND_CLICKED = "onGraphBackgroundClicked";
static ON_PALETTE_COMPONENT_HOVER_IN = 'onPaletteComponentHoverIn';
static ON_PALETTE_COMPONENT_HOVER_OUT = 'onPaletteComponentHoverOut';
@@ -290,16 +313,20 @@ export class GRAPH_EVENTS {
static ON_PALETTE_COMPONENT_SHOW_POPUP_PANEL = 'onPaletteComponentShowPopupPanel';
static ON_PALETTE_COMPONENT_HIDE_POPUP_PANEL = 'onPaletteComponentHidePopupPanel';
static ON_COMPONENT_INSTANCE_NAME_CHANGED = 'onComponentInstanceNameChanged';
+ static ON_ZONE_INSTANCE_NAME_CHANGED = 'onZoneInstanceNameChanged';
static ON_DELETE_COMPONENT_INSTANCE = 'onDeleteComponentInstance';
- static ON_DELETE_MULTIPLE_COMPONENTS = 'onDeleteMultipleComponents';
+ static ON_DELETE_ZONE_INSTANCE = 'onDeleteZoneInstance';
+ static ON_DELETE_COMPONENT_INSTANCE_SUCCESS = 'onDeleteComponentInstanceSuccess';
static ON_DELETE_EDGE = 'onDeleteEdge';
static ON_INSERT_NODE_TO_UCPE = 'onInsertNodeToUCPE';
static ON_REMOVE_NODE_FROM_UCPE = 'onRemoveNodeFromUCPE';
static ON_VERSION_CHANGED = 'onVersionChanged';
static ON_CREATE_COMPONENT_INSTANCE = 'onCreateComponentInstance';
- static ON_ADD_COMPONENT_INSTANCE_ZONE_START = 'onCreateComponentInstanceZone';
- static ON_FINISH_ANIMATION_ZONE = 'onFinishAnimationZone';
- static ON_ZONE_SIZE_CHANGE = 'onZoneSizeChange';
+ static ON_ADD_ZONE_INSTANCE_FROM_PALETTE = 'onAddZoneInstanceFromPalette';
+ static ON_CANVAS_TAG_START = 'onCanvasTagStart';
+ static ON_CANVAS_TAG_END = 'onCanvasTagEnd';
+ static ON_POLICY_INSTANCE_UPDATE = 'onPolicyInstanceUpdate';
+ static ON_GROUP_INSTANCE_UPDATE = 'onGroupInstanceUpdate';
}
@@ -320,6 +347,8 @@ export class COMPONENT_FIELDS {
static COMPONENT_POLICIES = "policies";
static COMPONENT_GROUPS = "groups";
static COMPONENT_INTERFACE_OPERATIONS = "interfaces";
+ static COMPONENT_NON_EXCLUDED_GROUPS = "nonExcludedGroups";
+ static COMPONENT_NON_EXCLUDED_POLICIES = "nonExcludedPolicies";
}
export class SERVICE_FIELDS {
@@ -329,3 +358,15 @@ export class SERVICE_FIELDS {
export class API_QUERY_PARAMS {
static INCLUDE = "include";
}
+
+export enum TargetOrMemberType {
+ COMPONENT_INSTANCES,
+ GROUPS
+}
+
+export class CANVAS_TAG_MODE {
+ static POLICY_TAGGING = "policy-tagging";
+ static POLICY_TAGGING_HOVER = "policy-tagging-hover";
+ static GROUP_TAGGING = "group-tagging";
+ static GROUP_TAGGING_HOVER= "group-tagging-hover";
+}
diff --git a/catalog-ui/src/app/utils/menu-handler.ts b/catalog-ui/src/app/utils/menu-handler.ts
index fc6eb2081a..4c25a025da 100644
--- a/catalog-ui/src/app/utils/menu-handler.ts
+++ b/catalog-ui/src/app/utils/menu-handler.ts
@@ -65,7 +65,10 @@ export class MenuItemGroup {
}
public updateSelectedMenuItemText(newText:string) {
- this.menuItems[this.selectedIndex].text = newText;
+ const selectedMenuItem = this.menuItems[this.selectedIndex];
+ if (selectedMenuItem) {
+ this.menuItems[this.selectedIndex].text = newText;
+ }
}
}
@@ -112,7 +115,7 @@ export class MenuHandler {
// If not found search by name (name is unique).
if (selectedItemIdx === -1) {
selectedItemIdx = _.findIndex(components, (item:Component) => {
- return item.name === selected.name;
+ return item.name === selected.name && item.componentType === selected.componentType;
});
}
@@ -144,6 +147,22 @@ export class MenuHandler {
// menuItem.text = component.name;
result.menuItems.push(menuItem);
});
+
+ result.selectedIndex = this.findBreadcrumbComponentIndex(components, selected);
+
+ // if component does not exist, then add a temporary menu item for the current component
+ if (result.selectedIndex === -1) {
+ let menuItem = new MenuItem(
+ // component.name,
+ selected.getComponentSubType() + ': ' + this.$filter('resourceName')(selected.name),
+ clickItemCallback,
+ null,
+ null,
+ [selected]
+ );
+ result.menuItems.unshift(menuItem);
+ result.selectedIndex = 0;
+ }
}
return result;
};
diff --git a/catalog-ui/src/app/utils/modals-handler.ts b/catalog-ui/src/app/utils/modals-handler.ts
index 48ce487f9d..001d35d386 100644
--- a/catalog-ui/src/app/utils/modals-handler.ts
+++ b/catalog-ui/src/app/utils/modals-handler.ts
@@ -36,7 +36,7 @@ export interface IModalsHandler {
openServerMessageModal(data:IServerMessageModalModel):ng.IPromise<any>;
openClientMessageModal(data:IClientMessageModalModel):ng.IPromise<ng.ui.bootstrap.IModalServiceInstance>;
openArtifactModal(artifact:ArtifactModel, component:Component):ng.IPromise<any>;
- openEditPropertyModal(property:PropertyModel, component:Component, filteredProperties:Array<PropertyModel>, isPropertyOwnValue:boolean):ng.IPromise<any>;
+ openEditPropertyModal(property:PropertyModel, component:Component, filteredProperties:Array<PropertyModel>, isPropertyOwnValue:boolean, propertyOwnerType:string, propertyOwnerId:string):ng.IPromise<any>;
}
export class ModalsHandler implements IModalsHandler {
@@ -166,7 +166,7 @@ export class ModalsHandler implements IModalsHandler {
return deferred.promise;
};
- openOnboadrdingModal = (okButtonText:string, currentCsarUUID?:string):ng.IPromise<any> => {
+ openOnboadrdingModal = (okButtonText:string, currentCsarUUID?:string, currentCsarVersion?:string):ng.IPromise<any> => {
let deferred = this.$q.defer();
let modalOptions:ng.ui.bootstrap.IModalSettings = {
templateUrl: '../view-models/modals/onboarding-modal/onboarding-modal-view.html',
@@ -179,6 +179,9 @@ export class ModalsHandler implements IModalsHandler {
},
currentCsarUUID: ():string=> {
return currentCsarUUID || null;
+ },
+ currentCsarVersion: ():string=> {
+ return currentCsarVersion || null;
}
}
};
@@ -279,7 +282,7 @@ export class ModalsHandler implements IModalsHandler {
* @param isPropertyValueOwner - boolean telling if the component is eligible of editing the property
* @returns {IPromise<T>} - Promise telling if the modal has opened or not
*/
- openEditPropertyModal = (property:PropertyModel, component:Component, filteredProperties:Array<PropertyModel>, isPropertyValueOwner:boolean):ng.IPromise<any> => {
+ openEditPropertyModal = (property:PropertyModel, component:Component, filteredProperties:Array<PropertyModel>, isPropertyValueOwner:boolean, propertyOwnerType:string, propertyOwnerId:string):ng.IPromise<any> => {
let deferred = this.$q.defer();
let modalOptions:ng.ui.bootstrap.IModalSettings = {
@@ -300,6 +303,12 @@ export class ModalsHandler implements IModalsHandler {
},
isPropertyValueOwner: ():boolean => {
return isPropertyValueOwner;
+ },
+ propertyOwnerType: ():string => {
+ return propertyOwnerType;
+ },
+ propertyOwnerId: ():string => {
+ return propertyOwnerId;
}
}
};