summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/services
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-07-17 21:12:03 +0300
committerMichael Lando <ml636r@att.com>2017-07-17 21:12:03 +0300
commit75aacbbe1acf78fa53378f07f0a8c7769449a17e (patch)
tree68a9799eb8f4704dd9a3d513401df9bb11af7739 /catalog-ui/src/app/services
parentdec02e7cc74e1c401be51bd9d266575e1e008f5f (diff)
[SDC] rebase 1710 code
Change-Id: I532ed68979fee7840ea8a5395e7e965b155fb9f9 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/services')
-rw-r--r--catalog-ui/src/app/services/available-icons-service.ts17
-rw-r--r--catalog-ui/src/app/services/components/product-service.ts55
-rw-r--r--catalog-ui/src/app/services/components/utils/composition-left-palette-service.ts45
-rw-r--r--catalog-ui/src/app/services/data-types-service.ts3
-rw-r--r--catalog-ui/src/app/services/entity-service.ts17
5 files changed, 26 insertions, 111 deletions
diff --git a/catalog-ui/src/app/services/available-icons-service.ts b/catalog-ui/src/app/services/available-icons-service.ts
index ebb6c5ff77..13b6caea2a 100644
--- a/catalog-ui/src/app/services/available-icons-service.ts
+++ b/catalog-ui/src/app/services/available-icons-service.ts
@@ -81,23 +81,6 @@ export class AvailableIconsService implements IAvailableIconsService {
'firewall'
];
break;
-
- case ComponentType.PRODUCT:
- icons = [
- 'vfw',
- 'network',
- 'security',
- 'cloud',
- 'setting',
- 'orphan',
- 'wanx',
- 'vrouter',
- 'ucpe',
- 'mobility'
-
- ];
- break;
-
}
return icons;
}
diff --git a/catalog-ui/src/app/services/components/product-service.ts b/catalog-ui/src/app/services/components/product-service.ts
deleted file mode 100644
index 09199ea172..0000000000
--- a/catalog-ui/src/app/services/components/product-service.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/**
- * Created by obarda on 2/8/2016.
- */
-'use strict';
-import {IComponentService, ComponentService} from "./component-service";
-import {SharingService} from "../sharing-service";
-import {Product, Component, IAppConfigurtaion} from "../../models";
-
-export interface IProductService extends IComponentService {
-
-}
-
-export class ProductService extends ComponentService implements IProductService {
-
- static '$inject' = [
- 'Restangular',
- 'sdcConfig',
- 'Sdc.Services.SharingService',
- '$q',
- '$base64'
- ];
-
- constructor(protected restangular:restangular.IElement,
- protected sdcConfig:IAppConfigurtaion,
- protected sharingService:SharingService,
- protected $q:ng.IQService,
- protected $base64:any) {
- super(restangular, sdcConfig, sharingService, $q, $base64);
- this.restangular = restangular.one("products");
- }
-
- createComponentObject = (component:Component):Component => {
- return new Product(this, this.$q, <Product>component);
- };
-}
diff --git a/catalog-ui/src/app/services/components/utils/composition-left-palette-service.ts b/catalog-ui/src/app/services/components/utils/composition-left-palette-service.ts
index 52cb78f6d5..a1fa65159f 100644
--- a/catalog-ui/src/app/services/components/utils/composition-left-palette-service.ts
+++ b/catalog-ui/src/app/services/components/utils/composition-left-palette-service.ts
@@ -28,6 +28,7 @@ import {ComponentFactory} from "../../../utils/component-factory";
import {IAppConfigurtaion} from "../../../models/app-config";
import {ResourceType, ComponentType, EVENTS} from "../../../utils/constants";
import {ComponentMetadata} from "../../../models/component-metadata";
+import {Resource} from "app/models/components/resource";
export class LeftPaletteDataObject {
displayLeftPanelComponents:Array<LeftPaletteComponent>;
@@ -58,24 +59,27 @@ export class LeftPaletteLoaderService {
protected EventListenerService:EventListenerService) {
this.restangular.setBaseUrl(sdcConfig.api.root + sdcConfig.api.component_api_root);
-
+
}
private serviceLeftPaletteData:LeftPaletteDataObject;
private resourceLeftPaletteData:LeftPaletteDataObject;
- private productLeftPaletteData:LeftPaletteDataObject;
+ private resourcePNFLeftPaletteData:LeftPaletteDataObject;
private vlData:LeftPaletteDataObject;
- public loadLeftPanel = (componentType: string):void => {
+ public loadLeftPanel = (component:Component):void => {
this.serviceLeftPaletteData = new LeftPaletteDataObject(EVENTS.SERVICE_LEFT_PALETTE_UPDATE_EVENT);
this.resourceLeftPaletteData = new LeftPaletteDataObject(EVENTS.RESOURCE_LEFT_PALETTE_UPDATE_EVENT);
- this.updateComponentLeftPalette(componentType);
+ this.resourcePNFLeftPaletteData = new LeftPaletteDataObject(EVENTS.RESOURCE_PNF_LEFT_PALETTE_UPDATE_EVENT);
+ this.updateComponentLeftPalette(component);
}
-
- private getTypeUrl = (componentType:string):string => {
- return ComponentType.PRODUCT === componentType ? "services" : "resources";
- };
+ private getResourceLeftPaletteDataByResourceType = (resourceType:string):LeftPaletteDataObject => {
+ if(resourceType == ResourceType.PNF) {
+ return this.resourcePNFLeftPaletteData;
+ }
+ return this.resourceLeftPaletteData;
+ }
private onFinishLoading = (componentType:string, leftPaletteData:LeftPaletteDataObject):void => {
this.EventListenerService.notifyObservers(leftPaletteData.onFinishLoadingEvent);
@@ -83,7 +87,7 @@ export class LeftPaletteLoaderService {
private updateLeftPalette = (componentType, componentInternalType:string, leftPaletteData:LeftPaletteDataObject):void => {
- this.restangular.one(this.getTypeUrl(componentType)).one('/latestversion/notabstract/metadata').get({'internalComponentType': componentInternalType}).then((leftPaletteComponentMetadata:Array<ComponentMetadata>) => {
+ this.restangular.one("resources").one('/latestversion/notabstract/metadata').get({'internalComponentType': componentInternalType}).then((leftPaletteComponentMetadata:Array<ComponentMetadata>) => {
_.forEach(leftPaletteComponentMetadata, (componentMetadata:ComponentMetadata) => {
leftPaletteData.displayLeftPanelComponents.push(new LeftPaletteComponent(componentMetadata));
});
@@ -91,30 +95,25 @@ export class LeftPaletteLoaderService {
});
};
- public getLeftPanelComponentsForDisplay = (componentType:string):Array<LeftPaletteComponent> => {
- switch (componentType) {
+ public getLeftPanelComponentsForDisplay = (component:Component):Array<LeftPaletteComponent> => {
+ switch (component.componentType) {
case ComponentType.SERVICE:
return this.serviceLeftPaletteData.displayLeftPanelComponents;
- case ComponentType.PRODUCT:
- return this.productLeftPaletteData.displayLeftPanelComponents;
- default:
- return this.resourceLeftPaletteData.displayLeftPanelComponents;
+ default://resource
+ return this.getResourceLeftPaletteDataByResourceType((<Resource>component).resourceType).displayLeftPanelComponents;
}
};
- public updateComponentLeftPalette = (componentType):void => {
- switch (componentType) {
- case ResourceType.VL:
- this.updateLeftPalette(ComponentType.RESOURCE, ResourceType.VL, this.vlData);
- break;
+ public updateComponentLeftPalette = (component:Component):void => {
+ switch (component.componentType) {
case ComponentType.SERVICE:
this.updateLeftPalette(ComponentType.SERVICE, ComponentType.SERVICE, this.serviceLeftPaletteData);
break;
- case ComponentType.PRODUCT:
- this.updateLeftPalette(ComponentType.PRODUCT, ComponentType.SERVICE, this.productLeftPaletteData);
+ case ComponentType.RESOURCE:
+ this.updateLeftPalette(ComponentType.RESOURCE, (<Resource>component).resourceType, this.getResourceLeftPaletteDataByResourceType((<Resource>component).resourceType));
break;
default:
- this.updateLeftPalette(ComponentType.RESOURCE, ResourceType.VF, this.resourceLeftPaletteData);
+ console.log('ERROR: Component type '+ component.componentType + ' is not exists');
}
};
}
diff --git a/catalog-ui/src/app/services/data-types-service.ts b/catalog-ui/src/app/services/data-types-service.ts
index a6dbf7f12d..84fe42e9f3 100644
--- a/catalog-ui/src/app/services/data-types-service.ts
+++ b/catalog-ui/src/app/services/data-types-service.ts
@@ -132,7 +132,8 @@ export class DataTypesService implements IDataTypesService {
public isDataTypeForDataTypePropertyType = (property:DataTypePropertyModel):boolean=> {
property.simpleType = "";
- if (property.type && PROPERTY_DATA.TYPES.indexOf(property.type) > -1) {
+ let isScalarForNFoD:boolean = property.type === 'scalar-unit.size';
+ if (property.type && PROPERTY_DATA.TYPES.indexOf(property.type) > -1 || isScalarForNFoD) {
return false;
}
let simpleType = this.getTypeForDataTypeDerivedFromSimple(property.type);
diff --git a/catalog-ui/src/app/services/entity-service.ts b/catalog-ui/src/app/services/entity-service.ts
index a255dcff34..75ea036b3e 100644
--- a/catalog-ui/src/app/services/entity-service.ts
+++ b/catalog-ui/src/app/services/entity-service.ts
@@ -19,7 +19,7 @@
*/
'use strict';
-import {Product, Service, IApi, IAppConfigurtaion, Resource, Component} from "../models";
+import { Service, IApi, IAppConfigurtaion, Resource, Component} from "../models";
import {SharingService} from "./sharing-service";
import {ComponentFactory} from "../utils/component-factory";
import {CacheService} from "./cache-service";
@@ -31,7 +31,6 @@ interface IEntityService {
interface IComponentsArray {
services:Array<Service>;
resources:Array<Resource>;
- products:Array<Product>;
}
export class EntityService implements IEntityService {
@@ -66,13 +65,6 @@ export class EntityService implements IEntityService {
this.sharingService.addUuidValue(component.uniqueId, component.uuid);
});
- followedResponse.products.forEach((productResponse:Product) => {
-
- let component:Product = this.ComponentFactory.createProduct(productResponse);
- componentsList.push(component);
- this.sharingService.addUuidValue(component.uniqueId, component.uuid);
- });
-
this.cacheService.set('breadcrumbsComponents', componentsList);
defer.resolve(componentsList);
},(responce) => {
@@ -99,12 +91,7 @@ export class EntityService implements IEntityService {
componentsList.push(component);
this.sharingService.addUuidValue(component.uniqueId, component.uuid);
});
-
- componentResponse.products && componentResponse.products.forEach((productsResponse:Product) => {
- let component:Product = this.ComponentFactory.createProduct(productsResponse);
- componentsList.push(component);
- this.sharingService.addUuidValue(component.uniqueId, component.uuid);
- });
+
this.cacheService.set('breadcrumbsComponents', componentsList);
defer.resolve(componentsList);
});