summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/utils
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/utils')
-rw-r--r--catalog-ui/src/app/utils/component-factory.ts19
-rw-r--r--catalog-ui/src/app/utils/component-instance-factory.ts18
-rw-r--r--catalog-ui/src/app/utils/constants.ts5
-rw-r--r--catalog-ui/src/app/utils/menu-handler.ts6
4 files changed, 41 insertions, 7 deletions
diff --git a/catalog-ui/src/app/utils/component-factory.ts b/catalog-ui/src/app/utils/component-factory.ts
index b35918c0f6..f869ef68d3 100644
--- a/catalog-ui/src/app/utils/component-factory.ts
+++ b/catalog-ui/src/app/utils/component-factory.ts
@@ -70,6 +70,22 @@ export class ComponentFactory {
return newResource;
};
+ public updateComponentFromCsar = (csarComponent:Resource, oldComponent:Resource):Component => {
+ _.pull(oldComponent.tags, oldComponent.name);
+ oldComponent.name = csarComponent.name;
+ oldComponent.selectedCategory = csarComponent.selectedCategory;
+ oldComponent.categories = csarComponent.categories;
+ oldComponent.vendorName = csarComponent.vendorName;
+ oldComponent.vendorRelease = csarComponent.vendorRelease;
+ oldComponent.csarUUID = csarComponent.csarUUID;
+ oldComponent.csarPackageType = csarComponent.csarPackageType;
+ oldComponent.csarVersion = csarComponent.csarVersion;
+ oldComponent.packageId = csarComponent.packageId;
+ oldComponent.description = csarComponent.description;
+ oldComponent.filterTerm = oldComponent.name + ' ' + oldComponent.description + ' ' + oldComponent.vendorName + ' ' + oldComponent.csarVersion
+ return oldComponent;
+ };
+
public createFromCsarComponent = (csar:ICsarComponent):Component => {
let newResource:Resource = <Resource>this.createEmptyComponent(ComponentType.RESOURCE);
newResource.name = csar.vspName;
@@ -124,7 +140,7 @@ export class ComponentFactory {
let newComponent:Component;
switch (componentType) {
-
+ case ComponentType.SERVICE_PROXY:
case ComponentType.SERVICE:
newComponent = new Service(this.ServiceService, this.$q);
break;
@@ -136,6 +152,7 @@ export class ComponentFactory {
case ResourceType.CP:
case ResourceType.PNF:
case ResourceType.CVFC:
+ case ResourceType.CONFIGURATION:
newComponent = new Resource(this.ResourceService, this.$q);
break;
}
diff --git a/catalog-ui/src/app/utils/component-instance-factory.ts b/catalog-ui/src/app/utils/component-instance-factory.ts
index 9e25e6b02f..25916cc055 100644
--- a/catalog-ui/src/app/utils/component-instance-factory.ts
+++ b/catalog-ui/src/app/utils/component-instance-factory.ts
@@ -21,7 +21,8 @@
* Created by obarda on 3/7/2016.
*/
'use strict';
-import {ComponentInstance, ServiceInstance, ResourceInstance, Component} from "../models";
+import {ComponentInstance, ServiceInstance, ResourceInstance, Component, ServiceProxyInstance} from "../models";
+import {ComponentType} from "app/utils";
import {LeftPaletteComponent} from "../models/components/displayComponent";
export class ComponentInstanceFactory {
@@ -29,10 +30,12 @@ export class ComponentInstanceFactory {
static createComponentInstance(componentInstance:ComponentInstance):ComponentInstance {
let newComponentInstance:ComponentInstance;
switch (componentInstance.originType) {
- case 'SERVICE':
+ case ComponentType.SERVICE:
newComponentInstance = new ServiceInstance(componentInstance);
break;
-
+ case ComponentType.SERVICE_PROXY:
+ newComponentInstance = new ServiceProxyInstance(componentInstance);
+ break;
default :
newComponentInstance = new ResourceInstance(componentInstance);
break;
@@ -43,10 +46,12 @@ export class ComponentInstanceFactory {
public createEmptyComponentInstance = (componentInstanceType?:string):ComponentInstance => {
let newComponentInstance:ComponentInstance;
switch (componentInstanceType) {
- case 'SERVICE':
+ case ComponentType.SERVICE:
newComponentInstance = new ServiceInstance();
break;
-
+ case ComponentType.SERVICE_PROXY:
+ newComponentInstance = new ServiceProxyInstance();
+ break;
default :
newComponentInstance = new ResourceInstance();
break;
@@ -62,6 +67,9 @@ export class ComponentInstanceFactory {
newComponentInstance.name = component.name;
newComponentInstance.componentVersion = component.version;
newComponentInstance.originType = component.getComponentSubType();
+ if(component.getComponentSubType() === ComponentType.SERVICE){
+ newComponentInstance.originType = ComponentType.SERVICE_PROXY
+ }
//new component instance -> req. & cap. are added on successful instance creation
newComponentInstance.requirements = component.requirements;
newComponentInstance.capabilities = component.capabilities;
diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts
index 6ec6a7762b..3ea652a7dd 100644
--- a/catalog-ui/src/app/utils/constants.ts
+++ b/catalog-ui/src/app/utils/constants.ts
@@ -29,6 +29,7 @@ export let CHANGE_COMPONENT_CSAR_VERSION_FLAG = 'changeComponentCsarVersion';
export class ComponentType {
static SERVICE = 'SERVICE';
static RESOURCE = 'RESOURCE';
+ static SERVICE_PROXY = 'ServiceProxy'
}
export class ServerTypeUrl {
@@ -44,6 +45,7 @@ export class ResourceType {
static VFCMT = 'VFCMT';
static PNF = 'PNF';
static CVFC = 'CVFC';
+ static CONFIGURATION = 'Configuration';
}
export class ComponentState {
@@ -114,6 +116,7 @@ export class SOURCES {
export class PROPERTY_DATA {
public static TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME, PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP];
public static SIMPLE_TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME];
+ public static SCALAR_TYPES = [PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME];
public static ROOT_DATA_TYPE = "tosca.datatypes.Root";
public static OPENECOMP_ROOT = "org.openecomp.datatypes.Root";
public static SUPPLEMENTAL_DATA = "supplemental_data";
@@ -150,6 +153,7 @@ export class WorkspaceMode {
export class ImagesUrl {
public static RESOURCE_ICONS = '/assets/styles/images/resource-icons/';
public static SERVICE_ICONS = '/assets/styles/images/service-icons/';
+ public static SERVICE_PROXY_ICONS = '/assets/styles/images/service-proxy-icons/';
public static SELECTED_UCPE_INSTANCE = '/assets/styles/images/resource-icons/selectedUcpeInstance.png';
public static SELECTED_CP_INSTANCE = '/assets/styles/images/resource-icons/selectedCPInstance.png';
public static SELECTED_VL_INSTANCE = '/assets/styles/images/resource-icons/selectedVLInstance.png';
@@ -249,6 +253,7 @@ export class EVENTS {
static ON_WORKSPACE_SAVE_BUTTON_SUCCESS = "onWorkspaceSaveButtonSuccess";
static ON_WORKSPACE_SAVE_BUTTON_ERROR = "onWorkspaceSaveButtonError";
static ON_CHECKOUT = "onCheckout";
+ static ON_REVERT = "onRevert";
//Loader events
static SHOW_LOADER_EVENT = "showLoaderEvent";
diff --git a/catalog-ui/src/app/utils/menu-handler.ts b/catalog-ui/src/app/utils/menu-handler.ts
index 351311a48f..1a3215bf80 100644
--- a/catalog-ui/src/app/utils/menu-handler.ts
+++ b/catalog-ui/src/app/utils/menu-handler.ts
@@ -116,7 +116,11 @@ export class MenuHandler {
});
}
- result.selectedIndex = components.indexOf(selectedItem);
+ if(!selectedItem){
+ result.selectedIndex = components.length;
+ }else{
+ result.selectedIndex = components.indexOf(selectedItem);
+ }
components[result.selectedIndex] = selected;
let clickItemCallback = (component:Component):ng.IPromise<boolean> => {
this.$state.go('workspace.general', {