Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507
Issue-ID: SDC-714
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
diff --git a/catalog-ui/src/app/utils/component-factory.ts b/catalog-ui/src/app/utils/component-factory.ts
index b35918c..f869ef6 100644
--- a/catalog-ui/src/app/utils/component-factory.ts
+++ b/catalog-ui/src/app/utils/component-factory.ts
@@ -70,6 +70,22 @@
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 @@
let newComponent:Component;
switch (componentType) {
-
+ case ComponentType.SERVICE_PROXY:
case ComponentType.SERVICE:
newComponent = new Service(this.ServiceService, this.$q);
break;
@@ -136,6 +152,7 @@
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 9e25e6b..25916cc 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 @@
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 @@
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 @@
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 6ec6a77..3ea652a 100644
--- a/catalog-ui/src/app/utils/constants.ts
+++ b/catalog-ui/src/app/utils/constants.ts
@@ -29,6 +29,7 @@
export class ComponentType {
static SERVICE = 'SERVICE';
static RESOURCE = 'RESOURCE';
+ static SERVICE_PROXY = 'ServiceProxy'
}
export class ServerTypeUrl {
@@ -44,6 +45,7 @@
static VFCMT = 'VFCMT';
static PNF = 'PNF';
static CVFC = 'CVFC';
+ static CONFIGURATION = 'Configuration';
}
export class ComponentState {
@@ -114,6 +116,7 @@
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 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 @@
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 351311a..1a3215b 100644
--- a/catalog-ui/src/app/utils/menu-handler.ts
+++ b/catalog-ui/src/app/utils/menu-handler.ts
@@ -116,7 +116,11 @@
});
}
- 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', {