diff options
Diffstat (limited to 'catalog-ui/src/app/ng2')
9 files changed, 53 insertions, 14 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/sdc-element-icon/sdc-element-icon.component.ts b/catalog-ui/src/app/ng2/components/ui/sdc-element-icon/sdc-element-icon.component.ts index dd48af2f89..fc81a5bfdb 100644 --- a/catalog-ui/src/app/ng2/components/ui/sdc-element-icon/sdc-element-icon.component.ts +++ b/catalog-ui/src/app/ng2/components/ui/sdc-element-icon/sdc-element-icon.component.ts @@ -40,6 +40,7 @@ export class SdcElementIconComponent { this.elementIcon = new ElementIcon(this.iconName, "services_24", "lightBlue"); break; case ComponentType.SERVICE_PROXY: + case ComponentType.SERVICE_SUBSTITUTION: this.elementIcon = new ElementIcon(this.iconName, "services_24", "white", "primary"); break; case ResourceType.CONFIGURATION: diff --git a/catalog-ui/src/app/ng2/pages/composition/graph/composition-graph.component.ts b/catalog-ui/src/app/ng2/pages/composition/graph/composition-graph.component.ts index 5467ecedbc..45a7d4c576 100644 --- a/catalog-ui/src/app/ng2/pages/composition/graph/composition-graph.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/graph/composition-graph.component.ts @@ -622,7 +622,7 @@ export class CompositionGraphComponent implements AfterViewInit { this.eventListenerService.registerObserverCallback(GRAPH_EVENTS.ON_PALETTE_COMPONENT_DRAG_START, (dragElement, dragComponent) => { this.dragElement = dragElement; - this.dragComponent = ComponentInstanceFactory.createComponentInstanceFromComponent(dragComponent); + this.dragComponent = ComponentInstanceFactory.createComponentInstanceFromComponent(dragComponent, this.workspaceService.metadata.categories[0].useServiceSubstitutionForNestedServices); }); this.eventListenerService.registerObserverCallback(GRAPH_EVENTS.ON_PALETTE_COMPONENT_DRAG_ACTION, (position: Point) => { diff --git a/catalog-ui/src/app/ng2/pages/composition/graph/utils/composition-graph-palette-utils.ts b/catalog-ui/src/app/ng2/pages/composition/graph/utils/composition-graph-palette-utils.ts index 922f19cb7f..72780ec0e5 100644 --- a/catalog-ui/src/app/ng2/pages/composition/graph/utils/composition-graph-palette-utils.ts +++ b/catalog-ui/src/app/ng2/pages/composition/graph/utils/composition-graph-palette-utils.ts @@ -116,8 +116,7 @@ export class CompositionGraphPaletteUtils { * @param component */ private _createComponentInstanceOnGraphFromPaletteComponent(cy:Cy.Instance, fullComponent:LeftPaletteComponent, event:DragEvent) { - - let componentInstanceToCreate:ComponentInstance = ComponentInstanceFactory.createComponentInstanceFromComponent(fullComponent); + let componentInstanceToCreate:ComponentInstance = ComponentInstanceFactory.createComponentInstanceFromComponent(fullComponent, this.workspaceService.metadata.categories[0].useServiceSubstitutionForNestedServices); let cytoscapePosition:Cy.Position = this.commonGraphUtils.getCytoscapeNodePosition(cy, event); componentInstanceToCreate.posX = cytoscapePosition.x; componentInstanceToCreate.posY = cytoscapePosition.y; diff --git a/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.ts b/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.ts index 7587c5206f..d1d48507a5 100644 --- a/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.ts +++ b/catalog-ui/src/app/ng2/pages/composition/palette/services/palette.service.ts @@ -3,6 +3,7 @@ import { Inject, Injectable } from '@angular/core'; import { LeftPaletteComponent, LeftPaletteMetadataTypes } from 'app/models/components/displayComponent'; import { GroupMetadata } from 'app/models/group-metadata'; import { PolicyMetadata } from 'app/models/policy-metadata'; +import { IComponentMetadata } from 'app/models/component-metadata'; import { SdcConfigToken } from 'app/ng2/config/sdc-config.config'; import { ISdcConfig } from 'app/ng2/config/sdc-config.config.factory'; import { WorkspaceService } from 'app/ng2/pages/workspace/workspace.service'; @@ -75,10 +76,20 @@ export class CompositionPaletteService { private combineResoponses(resInstances: object, resGrouops: object, resPolicies: object) { const retValObject = {}; - // Generic will be the 1st category in the left Pallete + if (resInstances['Generic']) { - retValObject['Generic'] = resInstances['Generic']; - } + if (this.isSubstitutionForNestedServices()) { + const serviceGroup = this.createServiceGroup(resInstances); + if (serviceGroup) { + retValObject['Service'] = serviceGroup; + } + } + else { + // Generic will be the 1st category in the left Pallete + retValObject['Generic'] = resInstances['Generic']; + } + } + // Add all other categories for (const category in resInstances) { if (category === 'Generic') { @@ -95,4 +106,25 @@ export class CompositionPaletteService { return retValObject; } + + private isSubstitutionForNestedServices(): boolean { + return this.workspaceService.metadata.categories[0].useServiceSubstitutionForNestedServices; + } + + private createServiceGroup(resInstances: object): object { + const servicesList = resInstances['Generic']['Generic']; + if (Array.isArray(servicesList) && servicesList.length > 0) { + delete resInstances['Generic']['Generic']; + return servicesList.reduce(function (map, component) { + if (map[component.categories[0].name]) { + map[component.categories[0].name].push(component); + } else { + map[component.categories[0].name] = [component]; + } + return map; + }, {}); + } + return null; + } + } diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/__snapshots__/composition-panel.component.spec.ts.snap b/catalog-ui/src/app/ng2/pages/composition/panel/__snapshots__/composition-panel.component.spec.ts.snap index fdede9d09e..beaa72f4fb 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/__snapshots__/composition-panel.component.spec.ts.snap +++ b/catalog-ui/src/app/ng2/pages/composition/panel/__snapshots__/composition-panel.component.spec.ts.snap @@ -9,6 +9,7 @@ exports[`composition-panel component should match current snapshot of compositio isConfiguration={[Function Function]} isPNF={[Function Function]} selectedComponentIsServiceProxyInstance={[Function Function]} + selectedComponentIsServiceSubstitutionInstance={[Function Function]} selectedComponentIsVfcInstance={[Function Function]} setActive={[Function Function]} store={[Function Store]} diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.ts index bf8cc27bfb..89634ef000 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.ts @@ -121,29 +121,29 @@ export class CompositionPanelComponent { } // Deployment artifacts - if (!this.isPNF() && !this.isConfiguration() && !this.selectedComponentIsServiceProxyInstance()) { + if (!this.isPNF() && !this.isConfiguration() && !this.selectedComponentIsServiceProxyInstance() && !this.selectedComponentIsServiceSubstitutionInstance()) { this.tabs.push(tabs.deploymentArtifacts); } // Properties or Inputs - if (component.isResource() || this.selectedComponentIsServiceProxyInstance()) { + if (component.isResource() || this.selectedComponentIsServiceProxyInstance() || this.selectedComponentIsServiceSubstitutionInstance()) { this.tabs.push(tabs.properties); } else { this.tabs.push(tabs.inputs); } - if (!this.isConfiguration() && !this.selectedComponentIsServiceProxyInstance()) { + if (!this.isConfiguration() && !this.selectedComponentIsServiceProxyInstance() && !this.selectedComponentIsServiceSubstitutionInstance()) { this.tabs.push(tabs.infoArtifacts); } - if (!(component.isService()) || this.selectedComponentIsServiceProxyInstance()) { + if (!(component.isService()) || this.selectedComponentIsServiceProxyInstance() || this.selectedComponentIsServiceSubstitutionInstance()) { this.tabs.push(tabs.reqAndCapabilities); } - if (component.isService() && !this.selectedComponentIsServiceProxyInstance()) { + if (component.isService() && !this.selectedComponentIsServiceProxyInstance() && !this.selectedComponentIsServiceSubstitutionInstance()) { this.tabs.push(tabs.apiArtifacts); } - if (component.isService() && this.selectedComponentIsServiceProxyInstance()) { + if (component.isService() && (this.selectedComponentIsServiceProxyInstance() || this.selectedComponentIsServiceSubstitutionInstance())) { this.tabs.push(tabs.consumption); this.tabs.push(tabs.dependencies); this.tabs.push(tabs.substitutionFilter) @@ -173,6 +173,10 @@ export class CompositionPanelComponent { private selectedComponentIsServiceProxyInstance = (): boolean => { return this.isComponentInstanceSelected() && this.selectedComponent.isServiceProxy(); } + + private selectedComponentIsServiceSubstitutionInstance = (): boolean => { + return this.isComponentInstanceSelected() && this.selectedComponent.isServiceSubstitution(); + } private selectedComponentIsVfcInstance = (): boolean => { return this.isComponentInstanceSelected() && this.selectedComponent.isVFC(); diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.ts index 45f31e7b35..cb889a2583 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.ts @@ -110,7 +110,7 @@ export class InfoTabComponent implements OnInit, OnDestroy { }, onCancel); }; - if (this.component.isService() || this.component.isServiceProxy()) { + if (this.component.isService() || this.component.isServiceProxy() || this.component.isServiceSubstitution()) { this.serviceService.checkComponentInstanceVersionChange(this.workspaceService.metadata.componentType, this.workspaceService.metadata.uniqueId, this.component.uniqueId, newVersionValue).subscribe((pathsToDelete:string[]) => { if (pathsToDelete && pathsToDelete.length) { diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts index 725847bc6d..9fb1a928fe 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts @@ -316,7 +316,8 @@ export class PropertiesAssignmentComponent { this.selectedInstance_FlattenCapabilitiesList, (result, cap: Capability) => { isCapabilityOwnedByInstance = cap.ownerId === currentUniqueId || - selectedComponentInstanceData.isServiceProxy() && cap.ownerId === selectedComponentInstanceData.sourceModelUid; + selectedComponentInstanceData.isServiceProxy() || selectedComponentInstanceData.isServiceSubstitution() && + cap.ownerId === selectedComponentInstanceData.sourceModelUid; if (cap.properties && isCapabilityOwnedByInstance) { _.forEach(cap.properties, prop => { if (!prop.origName) { diff --git a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts index cf30ea8a75..fde110957f 100644 --- a/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts +++ b/catalog-ui/src/app/ng2/services/component-services/topology-template.service.ts @@ -465,6 +465,7 @@ export class TopologyTemplateService { switch (componentType) { case ComponentType.SERVICE: case ComponentType.SERVICE_PROXY: + case ComponentType.SERVICE_SUBSTITUTION: return ServerTypeUrl.SERVICES; default: return ServerTypeUrl.RESOURCES; |