diff options
author | Michael Lando <ml636r@att.com> | 2018-07-29 16:13:45 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-07-29 16:20:34 +0300 |
commit | 5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch) | |
tree | 2f9dfc45191e723da69cf74be7829784e9741b94 /catalog-ui/src/app/services/components/utils | |
parent | 9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (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/services/components/utils')
-rw-r--r-- | catalog-ui/src/app/services/components/utils/composition-left-palette-service.ts | 60 |
1 files changed, 16 insertions, 44 deletions
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 2ed995c78c..99be788547 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 @@ -33,17 +33,6 @@ import {GroupMetadata, GroupTpes} from "app/models/group-metadata"; import {PolicyMetadata, PolicyTpes} from "app/models/policy-metadata"; import {Resource} from "app/models/components/resource"; -// export class LeftPaletteDataObject { -// displayLeftPanelComponents:Array<LeftPaletteComponent>; -// onFinishLoadingEvent:string; - -// constructor(onFinishEventListener:string) { - -// this.displayLeftPanelComponents = new Array<LeftPaletteComponent>(); -// this.onFinishLoadingEvent = onFinishEventListener; -// } -// } - export class LeftPaletteLoaderService { static '$inject' = [ @@ -65,56 +54,39 @@ export class LeftPaletteLoaderService { } - // private serviceLeftPaletteData:LeftPaletteDataObject; - // private resourceLeftPaletteData:LeftPaletteDataObject; - // private resourcePNFLeftPaletteData:LeftPaletteDataObject; - // private vlData:LeftPaletteDataObject; leftPanelComponents:Array<LeftPaletteComponent>; 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.resourcePNFLeftPaletteData = new LeftPaletteDataObject(EVENTS.RESOURCE_PNF_LEFT_PALETTE_UPDATE_EVENT); this.leftPanelComponents = []; this.updateLeftPaletteForTopologyTemplate(component); } - // private getResourceLeftPaletteDataByResourceType = (resourceType:string):LeftPaletteDataObject => { - // if(resourceType == ResourceType.PNF) { - // return this.resourcePNFLeftPaletteData; - // } - // return this.resourceLeftPaletteData; - // } - private updateLeftPalette = (componentInternalType:string):void => { /* add components */ - this.restangular.one("resources").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) => { this.leftPanelComponents.push(new LeftPaletteComponent(LeftPaletteMetadataTypes.Component, componentMetadata)); }); - this.EventListenerService.notifyObservers(EVENTS.LEFT_PALETTE_UPDATE_EVENT); - }); - - /* add groups */ - //TODO: In backend implement like this: - //this.restangular.one("groups").one('/latestversion/notabstract/metadata').get({'internalComponentType': componentInternalType}).then((leftPaletteComponentMetadata:Array<ComponentMetadata>) => { - this.restangular.one('/groupTypes').get().then((leftPaletteGroupTypes:GroupTpes) => { - _.forEach(leftPaletteGroupTypes.groupTypes, (groupMetadata: GroupMetadata) => { - this.leftPanelComponents.push(new LeftPaletteComponent(LeftPaletteMetadataTypes.Group, groupMetadata)); + + /* add groups */ + this.restangular.one('/groupTypes').get({'internalComponentType': componentInternalType}).then((leftPaletteGroupTypes:GroupTpes) => { + _.forEach(leftPaletteGroupTypes, (groupMetadata: GroupMetadata) => { + this.leftPanelComponents.push(new LeftPaletteComponent(LeftPaletteMetadataTypes.Group, groupMetadata)); + }); + this.EventListenerService.notifyObservers(EVENTS.LEFT_PALETTE_UPDATE_EVENT); }); - this.EventListenerService.notifyObservers(EVENTS.LEFT_PALETTE_UPDATE_EVENT); - }); - /* add policies */ - //TODO: In backend implement like this: - //this.restangular.one("policies").one('/latestversion/notabstract/metadata').get({'internalComponentType': componentInternalType}).then((leftPaletteComponentMetadata:Array<ComponentMetadata>) => { - this.restangular.one('/policyTypes').get().then((leftPalettePolicyTypes:PolicyTpes) => { - _.forEach(leftPalettePolicyTypes.policyTypes, (policyMetadata: PolicyMetadata) => { - this.leftPanelComponents.push(new LeftPaletteComponent(LeftPaletteMetadataTypes.Policy, policyMetadata)); + /* add policies */ + this.restangular.one('/policyTypes').get({'internalComponentType': componentInternalType}).then((leftPalettePolicyTypes:PolicyTpes) => { + _.forEach(leftPalettePolicyTypes, (policyMetadata: PolicyMetadata) => { + this.leftPanelComponents.push(new LeftPaletteComponent(LeftPaletteMetadataTypes.Policy, policyMetadata)); + }); + this.EventListenerService.notifyObservers(EVENTS.LEFT_PALETTE_UPDATE_EVENT); }); - this.EventListenerService.notifyObservers(EVENTS.LEFT_PALETTE_UPDATE_EVENT); }); + + } public getLeftPanelComponentsForDisplay = (component:Component):Array<LeftPaletteComponent> => { |