summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/utils
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-03-04 14:53:33 +0200
committerMichael Lando <ml636r@att.com>2018-03-07 13:19:05 +0000
commita5445100050e49e83f73424198d73cd72d672a4d (patch)
treecacf4df817df31be23e4e790d1dda857bdae061e /catalog-ui/src/app/utils
parent51157f92c21976cba4914c378aaa3cba49826931 (diff)
Sync Integ to Master
Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/utils')
-rw-r--r--catalog-ui/src/app/utils/artifacts-utils.ts2
-rw-r--r--catalog-ui/src/app/utils/common-utils.ts14
-rw-r--r--catalog-ui/src/app/utils/component-factory.ts2
-rw-r--r--catalog-ui/src/app/utils/constants.ts22
-rw-r--r--catalog-ui/src/app/utils/menu-handler.ts53
-rw-r--r--catalog-ui/src/app/utils/modals-handler.ts5
-rw-r--r--catalog-ui/src/app/utils/validation-utils.ts2
7 files changed, 69 insertions, 31 deletions
diff --git a/catalog-ui/src/app/utils/artifacts-utils.ts b/catalog-ui/src/app/utils/artifacts-utils.ts
index d6ea616c1e..e99b6411c4 100644
--- a/catalog-ui/src/app/utils/artifacts-utils.ts
+++ b/catalog-ui/src/app/utils/artifacts-utils.ts
@@ -18,10 +18,12 @@
* ============LICENSE_END=========================================================
*/
+import * as _ from "lodash";
import {ArtifactModel} from "../models/artifacts";
import {IArtifactResourceFormViewModelScope} from "../view-models/forms/artifact-form/artifact-form-view-model";
import {Component} from "../models/components/component";
import {ArtifactGroupType, ArtifactType} from "./constants";
+
export class ArtifactsUtils {
static '$inject' = [
diff --git a/catalog-ui/src/app/utils/common-utils.ts b/catalog-ui/src/app/utils/common-utils.ts
index 1719034354..97177949ee 100644
--- a/catalog-ui/src/app/utils/common-utils.ts
+++ b/catalog-ui/src/app/utils/common-utils.ts
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
+import * as _ from "lodash";
import {Module, AttributeModel, ResourceInstance, PropertyModel, InputFEModel} from "../models";
import {ComponentInstanceFactory} from "./component-instance-factory";
import {InputBEModel, PropertyBEModel, RelationshipModel} from "app/models";
+import { PolicyInstance } from "app/models/graph/zones/policy-instance";
export class CommonUtils {
@@ -112,5 +114,17 @@ export class CommonUtils {
return componentInstancesRelations;
}
};
+
+ static initPolicies = (policiesObj: Array<PolicyInstance>):Array<PolicyInstance> => {
+ let policies = new Array<PolicyInstance>();
+
+ if (policiesObj) {
+ _.forEach(policiesObj, (policy: PolicyInstance): void => {
+ policies.push(new PolicyInstance(policy));
+ })
+ }
+
+ return policies;
+ }
}
diff --git a/catalog-ui/src/app/utils/component-factory.ts b/catalog-ui/src/app/utils/component-factory.ts
index f869ef68d3..bf4f23b6eb 100644
--- a/catalog-ui/src/app/utils/component-factory.ts
+++ b/catalog-ui/src/app/utils/component-factory.ts
@@ -19,6 +19,7 @@
*/
'use strict';
+import * as _ from "lodash";
import {DEFAULT_ICON, ResourceType, ComponentType} from "./constants";
import {ServiceService, CacheService, ResourceService} from "app/services";
import {IMainCategory, ISubCategory, ICsarComponent, Component, Resource, Service} from "app/models";
@@ -150,6 +151,7 @@ export class ComponentFactory {
case ResourceType.VL:
case ResourceType.VFC:
case ResourceType.CP:
+ case ResourceType.CR:
case ResourceType.PNF:
case ResourceType.CVFC:
case ResourceType.CONFIGURATION:
diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts
index ea0848eee6..c8603424bb 100644
--- a/catalog-ui/src/app/utils/constants.ts
+++ b/catalog-ui/src/app/utils/constants.ts
@@ -46,6 +46,7 @@ export class ResourceType {
static PNF = 'PNF';
static CVFC = 'CVFC';
static CONFIGURATION = 'Configuration';
+ static CR = 'CR';
}
export class ComponentState {
@@ -189,6 +190,7 @@ export class GraphColors {
public static NODE_UCPE_CP = '#9063cd';
public static NODE_UCPE = '#fbfbfb';
public static NODE_SELECTED_BORDER_COLOR = '#30bdf2';
+ public static SERVICE_PATH_LINK = '#70208a';
}
export class GraphTransactionLogText {
public static REMOVE_TEMP_LINK = "remove tempLink";
@@ -244,10 +246,11 @@ 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 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";
@@ -283,6 +286,8 @@ export class GRAPH_EVENTS {
static ON_PALETTE_COMPONENT_HOVER_OUT = 'onPaletteComponentHoverOut';
static ON_PALETTE_COMPONENT_DRAG_START = 'onPaletteComponentDragStart';
static ON_PALETTE_COMPONENT_DRAG_ACTION = 'onPaletteComponentDragAction';
+ 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_DELETE_COMPONENT_INSTANCE = 'onDeleteComponentInstance';
static ON_DELETE_MULTIPLE_COMPONENTS = 'onDeleteMultipleComponents';
@@ -291,6 +296,9 @@ export class GRAPH_EVENTS {
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';
}
@@ -308,9 +316,15 @@ export class COMPONENT_FIELDS {
static COMPONENT_CAPABILITIES = "capabilities";
static COMPONENT_REQUIREMENTS = "requirements";
static COMPONENT_TOSCA_ARTIFACTS = "toscaArtifacts";
+ static COMPONENT_POLICIES = "policies";
static COMPONENT_GROUPS = "groups";
}
+
+export class SERVICE_FIELDS {
+ static FORWARDING_PATHS = "forwardingPaths";
+}
+
export class API_QUERY_PARAMS {
static INCLUDE = "include";
}
diff --git a/catalog-ui/src/app/utils/menu-handler.ts b/catalog-ui/src/app/utils/menu-handler.ts
index d48412a6ed..fc6eb2081a 100644
--- a/catalog-ui/src/app/utils/menu-handler.ts
+++ b/catalog-ui/src/app/utils/menu-handler.ts
@@ -19,6 +19,7 @@
*/
'use strict';
+import * as _ from "lodash";
import {WorkspaceMode, ComponentState} from "./constants";
import {IAppConfigurtaion, IAppMenu, Component} from "../models";
import {ComponentFactory} from "./component-factory";
@@ -92,36 +93,36 @@ export class MenuHandler {
}
- generateBreadcrumbsModelFromComponents = (components:Array<Component>, selected:Component):MenuItemGroup => {
- let result = new MenuItemGroup(0, [], false);
- if (components) {
+ findBreadcrumbComponentIndex = (components:Array<Component>, selected:Component):number => {
+ let selectedItemIdx;
+
+ // Search the component in all components by uuid (and not uniqueid, gives access to an assets's minor versions).
+ selectedItemIdx = _.findIndex(components, (item:Component) => {
+ return item.uuid === selected.uuid;
+ });
- // Search the component in all components by uuid (and not uniqueid, gives access to an assets's minor versions).
- let selectedItem = _.find(components, (item:Component) => {
- return item.uuid === selected.uuid;
+ // If not found search by invariantUUID
+ if (selectedItemIdx === -1) {
+ selectedItemIdx = _.findIndex(components, (item:Component) => {
+ //invariantUUID && Certified State matches between major versions
+ return item.invariantUUID === selected.invariantUUID && item.lifecycleState === ComponentState.CERTIFIED;
});
+ }
- // If not found search by invariantUUID
- if (undefined == selectedItem) {
- selectedItem = _.find(components, (item:Component) => {
- //invariantUUID && Certified State matches between major versions
- return item.invariantUUID === selected.invariantUUID && item.lifecycleState === ComponentState.CERTIFIED;
- });
- }
+ // If not found search by name (name is unique).
+ if (selectedItemIdx === -1) {
+ selectedItemIdx = _.findIndex(components, (item:Component) => {
+ return item.name === selected.name;
+ });
+ }
- // If not found search by name (name is unique).
- if (undefined == selectedItem) {
- selectedItem = _.find(components, (item:Component) => {
- return item.name === selected.name;
- });
- }
-
- if(!selectedItem){
- result.selectedIndex = components.length;
- }else{
- result.selectedIndex = components.indexOf(selectedItem);
- }
- components[result.selectedIndex] = selected;
+ return selectedItemIdx;
+ };
+
+ generateBreadcrumbsModelFromComponents = (components:Array<Component>, selected:Component):MenuItemGroup => {
+ let result = new MenuItemGroup(0, [], false);
+ if (components) {
+ result.selectedIndex = this.findBreadcrumbComponentIndex(components, selected);
let clickItemCallback = (component:Component):ng.IPromise<boolean> => {
this.$state.go('workspace.general', {
id: component.uniqueId,
diff --git a/catalog-ui/src/app/utils/modals-handler.ts b/catalog-ui/src/app/utils/modals-handler.ts
index 0d17683116..48ce487f9d 100644
--- a/catalog-ui/src/app/utils/modals-handler.ts
+++ b/catalog-ui/src/app/utils/modals-handler.ts
@@ -310,7 +310,7 @@ export class ModalsHandler implements IModalsHandler {
};
- openEditModulePropertyModal = (property:PropertyModel, component:Component, selectedModule:DisplayModule):ng.IPromise<any> => {
+ openEditModulePropertyModal = (property:PropertyModel, component:Component, selectedModule:DisplayModule, filteredProperties:Array<PropertyModel>):ng.IPromise<any> => {
let deferred = this.$q.defer();
let modalOptions:ng.ui.bootstrap.IModalSettings = {
@@ -328,6 +328,9 @@ export class ModalsHandler implements IModalsHandler {
},
selectedModule: ():DisplayModule => {
return selectedModule;
+ },
+ filteredProperties: ():Array<PropertyModel> => {
+ return filteredProperties;
}
}
};
diff --git a/catalog-ui/src/app/utils/validation-utils.ts b/catalog-ui/src/app/utils/validation-utils.ts
index 6b45149b1e..cd90ba7752 100644
--- a/catalog-ui/src/app/utils/validation-utils.ts
+++ b/catalog-ui/src/app/utils/validation-utils.ts
@@ -18,6 +18,8 @@
* ============LICENSE_END=========================================================
*/
+import * as _ from "lodash";
+
class basePattern {
pattern:RegExp;
base:number;