summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2020-10-28 19:14:54 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2020-12-07 21:39:20 +0000
commit4ef4aa9051ea37b6de49811108319a005fbacb72 (patch)
tree3592ae5798fa12a09b18bbe315604982869db35c
parenta85240fe7160862a0b9f8fb95eb48e0ac6c03fad (diff)
Allow substitution_filter for a VF
Issue-ID: SDC-3365 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: I5894bffbc8e605de26832d03c6f988f17413393b
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java11
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java60
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java25
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java1
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/panel/__snapshots__/composition-panel.component.spec.ts.snap1
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.spec.ts11
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.ts8
8 files changed, 87 insertions, 32 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogic.java
index c02db7a9e3..0f55ddfff1 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogic.java
@@ -237,7 +237,7 @@ public class ComponentSubstitutionFilterBusinessLogic extends BaseBusinessLogic
boolean wasLocked = false;
try {
if (shouldLock) {
- lockComponent(component.getUniqueId(), component,"Add Node Filter on Component");
+ lockComponent(component.getUniqueId(), component,"Delete substitution Filter on Component");
wasLocked = true;
}
final Either<SubstitutionFilterDataDefinition, StorageOperationStatus> result = substitutionFilterOperation
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java
index 65c3b0e78e..d742fb3aea 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java
@@ -378,6 +378,17 @@ public class UiComponentDataConverter {
.getMetadataDataDefinition());
dataTransfer.setMetadata(metadata);
break;
+ case SUBSTITUTION_FILTER:
+ if (resource.getSubstitutionFilter() == null) {
+ dataTransfer.setSubstitutionFilterForTopologyTemplate(null);
+ } else {
+ final SubstitutionFilterConverter substitutionFilterConverter = new SubstitutionFilterConverter();
+ final Map<String, UINodeFilter> filterUiMap = new HashMap<>();
+ filterUiMap.put(resource.getUniqueId(),
+ substitutionFilterConverter.convertToUi(resource.getSubstitutionFilter()));
+ dataTransfer.setSubstitutionFilterForTopologyTemplate(filterUiMap);
+ }
+ break;
default:
setUiTranferDataByFieldName(dataTransfer, resource, fieldName);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java
index 666d1e7f39..1d643b704c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java
@@ -57,6 +57,8 @@ import org.openecomp.sdc.be.datatypes.elements.SubstitutionFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.SubstitutionFilterOperation;
@@ -94,7 +96,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Mock
private NodeFilterValidator nodeFilterValidator;
- private Service service;
+ private Component component;
private SubstitutionFilterDataDefinition substitutionFilterDataDefinition;
private RequirementSubstitutionFilterPropertyDataDefinition requirementSubstitutionFilterPropertyDataDefinition;
private String constraint;
@@ -118,9 +120,9 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void doNotCreateSubstitutionFilterAsExistsTest() throws BusinessLogicException {
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
final Optional<SubstitutionFilterDataDefinition> result = componentSubstitutionFilterBusinessLogic
.createSubstitutionFilterIfNotExist(componentId, true, ComponentTypeEnum.SERVICE);
@@ -131,7 +133,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void createSubstitutionFilterIfNotExistTest() throws BusinessLogicException {
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
when(substitutionFilterOperation.createSubstitutionFilter(componentId))
@@ -151,7 +153,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void createSubstitutionFilterIfNotExistFailTest() {
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
when(substitutionFilterOperation.createSubstitutionFilter(componentId))
@@ -170,12 +172,12 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void addSubstitutionFilterTest() throws BusinessLogicException {
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
- when(nodeFilterValidator.validateComponentFilter(service, Collections.singletonList(constraint),
+ when(nodeFilterValidator.validateComponentFilter(component, Collections.singletonList(constraint),
NodeFilterConstraintAction.ADD)).thenReturn(Either.left(true));
when(substitutionFilterOperation
.addPropertyFilter(anyString(), any(SubstitutionFilterDataDefinition.class),
@@ -192,7 +194,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
assertThat(result.get().getProperties().getListToscaDataDefinition()).hasSize(1);
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Service);
- verify(nodeFilterValidator, times(1)).validateComponentFilter(service,
+ verify(nodeFilterValidator, times(1)).validateComponentFilter(component,
Collections.singletonList(constraint), NodeFilterConstraintAction.ADD);
verify(substitutionFilterOperation, times(1))
.addPropertyFilter(anyString(), any(SubstitutionFilterDataDefinition.class),
@@ -203,12 +205,12 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void addSubstitutionFilterFailTest() {
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
- when(nodeFilterValidator.validateComponentFilter(service, Collections.singletonList(constraint),
+ when(nodeFilterValidator.validateComponentFilter(component, Collections.singletonList(constraint),
NodeFilterConstraintAction.ADD)).thenReturn(Either.left(true));
when(substitutionFilterOperation
.addPropertyFilter(componentId, substitutionFilterDataDefinition,
@@ -224,7 +226,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Service);
- verify(nodeFilterValidator, times(1)).validateComponentFilter(service,
+ verify(nodeFilterValidator, times(1)).validateComponentFilter(component,
Collections.singletonList(constraint), NodeFilterConstraintAction.ADD);
verify(substitutionFilterOperation, times(0))
.addPropertyFilter(componentId, substitutionFilterDataDefinition,
@@ -234,13 +236,13 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void updateSubstitutionFilterTest() throws BusinessLogicException {
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
final List<String> constraints = requirementSubstitutionFilterPropertyDataDefinition.getConstraints();
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
- when(nodeFilterValidator.validateComponentFilter(service, Collections.singletonList(constraint),
+ when(nodeFilterValidator.validateComponentFilter(component, Collections.singletonList(constraint),
NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true));
when(substitutionFilterOperation.updateProperties(anyString(), any(SubstitutionFilterDataDefinition.class), anyList()))
.thenReturn(Either.left(substitutionFilterDataDefinition));
@@ -255,7 +257,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
assertThat(result.get().getProperties().getListToscaDataDefinition()).hasSize(1);
verify(substitutionFilterOperation, times(1))
.updateProperties(anyString(), any(SubstitutionFilterDataDefinition.class), anyList());
- verify(nodeFilterValidator, times(1)).validateComponentFilter(service,
+ verify(nodeFilterValidator, times(1)).validateComponentFilter(component,
Collections.singletonList(constraint), NodeFilterConstraintAction.UPDATE);
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Service);
@@ -264,12 +266,12 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void updateSubstitutionFilterFailTest() {
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
- when(nodeFilterValidator.validateComponentFilter(service, Collections.singletonList(constraint),
+ when(nodeFilterValidator.validateComponentFilter(component, Collections.singletonList(constraint),
NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true));
when(graphLockOperation.unlockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
@@ -280,7 +282,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Service);
- verify(nodeFilterValidator, times(1)).validateComponentFilter(service,
+ verify(nodeFilterValidator, times(1)).validateComponentFilter(component,
Collections.singletonList(constraint), NodeFilterConstraintAction.UPDATE);
verify(graphLockOperation, times(1)).unlockComponent(componentId, NodeTypeEnum.Service);
}
@@ -288,9 +290,9 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void deleteSubstitutionFilterTest() throws BusinessLogicException {
substitutionFilterDataDefinition.setProperties(new ListDataDefinition<>());
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
when(substitutionFilterOperation.deleteConstraint(anyString(), any(SubstitutionFilterDataDefinition.class), anyInt()))
@@ -310,9 +312,9 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
@Test
public void deleteSubstitutionFilterFailTest() {
- service.setSubstitutionFilter(substitutionFilterDataDefinition);
+ component.setSubstitutionFilter(substitutionFilterDataDefinition);
- when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(service));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Service))
.thenReturn(StorageOperationStatus.OK);
when(substitutionFilterOperation.deleteConstraint(anyString(),
@@ -334,9 +336,9 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
public void initResource() {
try {
- service = new Service();
- service.setName("MyTestService");
- service.setUniqueId(componentId);
+ component = new Service();
+ component.setName("MyTestService");
+ component.setUniqueId(componentId);
final UIConstraint uiConstraint =
new UIConstraint(servicePropertyName, constraintOperator, sourceType, sourceName, propertyValue);
@@ -358,7 +360,7 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
final PropertyDefinition property = new PropertyDefinition();
property.setName(uiConstraint.getServicePropertyName());
- service.setProperties(new LinkedList<>(Arrays.asList(property)));
+ component.setProperties(new LinkedList<>(Arrays.asList(property)));
} catch (final Exception e) {
fail(e.getMessage());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java
index 1b65912e48..84dd3b1e8c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java
@@ -34,6 +34,7 @@ import org.openecomp.sdc.be.components.utils.ServiceBuilder;
import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter;
import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GetPolicyValueDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.SubstitutionFilterDataDefinition;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.InputDefinition;
@@ -73,6 +74,7 @@ public class UiComponentDataConverterTest {
private static final String PROPERTY_UID = "propertyUid";
private static final String NODE_FILTER_UID = "nodeFilterUid";
+ private static final String SUBSTITUTION_FILTER_UID = "substitutionFilterUid";
private static final String COMPONENT_UID = "componentUid";
@BeforeClass
@@ -313,6 +315,29 @@ public class UiComponentDataConverterTest {
assertThat(uiComponentDataTransfer.getNodeFilter()).isNotEmpty();
}
+ @Test
+ public void testGetSubstitutionFilterEmptyList() {
+ Resource resource = new ResourceBuilder().build();
+ UiComponentDataTransfer uiComponentDataTransfer = uiComponentDataConverter.getUiDataTransferFromResourceByParams(resource,
+ Collections.singletonList("substitutionFilter"));
+
+ assertThat(uiComponentDataTransfer.getSubstitutionFilter()).isNull();
+ }
+
+ @Test
+ public void testGetSubstitutionFilter() {
+ SubstitutionFilterDataDefinition substitutionFilter = new SubstitutionFilterDataDefinition();
+ substitutionFilter.setID(SUBSTITUTION_FILTER_UID);
+
+ Resource resource = new ResourceBuilder().build();
+ resource.setSubstitutionFilter(substitutionFilter);
+
+ UiComponentDataTransfer uiComponentDataTransfer = uiComponentDataConverter.getUiDataTransferFromResourceByParams(resource,
+ Collections.singletonList("substitutionFilter"));
+
+ assertThat(uiComponentDataTransfer.getSubstitutionFilterForTopologyTemplate()).isNotEmpty();
+ }
+
private Resource buildResourceWithGroups() {
return new ResourceBuilder()
.addGroup(group1)
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 0d9e6a0fc9..146d5d6c80 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -277,6 +277,7 @@ public class ModelConverter {
setCapabilitiesToComponentAndGroups(topologyTemplate, resource);
convertPolicies(topologyTemplate, resource);
convertNodeFiltersComponents(topologyTemplate, resource);
+ convertSubstitutionFiltersComponents(topologyTemplate, resource);
convertProperties(topologyTemplate, resource);
setCapabilitiesToComponent(topologyTemplate, resource);
setRequirementsToComponent(topologyTemplate, resource);
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 beaa72f4fb..2c96e92c7e 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
@@ -8,6 +8,7 @@ exports[`composition-panel component should match current snapshot of compositio
isComponentInstanceSelected={[Function Function]}
isConfiguration={[Function Function]}
isPNF={[Function Function]}
+ isVF={[Function Function]}
selectedComponentIsServiceProxyInstance={[Function Function]}
selectedComponentIsServiceSubstitutionInstance={[Function Function]}
selectedComponentIsVfcInstance={[Function Function]}
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.spec.ts b/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.spec.ts
index 75fab9abe7..1761bfdd03 100644
--- a/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.spec.ts
+++ b/catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.spec.ts
@@ -18,6 +18,7 @@ import { InfoTabComponent } from './panel-tabs/info-tab/info-tab.component';
import { PolicyTargetsTabComponent } from './panel-tabs/policy-targets-tab/policy-targets-tab.component';
import { PropertiesTabComponent } from './panel-tabs/properties-tab/properties-tab.component';
import { ReqAndCapabilitiesTabComponent } from './panel-tabs/req-capabilities-tab/req-capabilities-tab.component';
+import {SubstitutionFilterTabComponent} from "./panel-tabs/substitution-filter-tab/substitution-filter-tab.component";
describe('composition-panel component', () => {
@@ -54,8 +55,13 @@ describe('composition-panel component', () => {
titleIcon: 'req-capabilities-o', component: ReqAndCapabilitiesTabComponent, input: {},
isActive: false, tooltipText: 'Requirements and Capabilities'
},
+ substitutionFilter: {
+ titleIcon: 'composition-o', component: SubstitutionFilterTabComponent, input: {title: 'SUBSTITUTION FILTER'},
+ isActive: false, tooltipText: 'Substitution Filter'
+ },
inputs: {titleIcon: 'inputs-o', component: PropertiesTabComponent, input: {title: 'Inputs'}, isActive: false, tooltipText: 'Inputs'},
settings: {titleIcon: 'settings-o', component: PropertiesTabComponent, input: {}, isActive: false, tooltipText: 'Settings'},
+
};
beforeEach(
@@ -114,6 +120,7 @@ describe('composition-panel component', () => {
expect (fixture.componentInstance.tabs[2]).toEqual(tabs.inputs);
expect (fixture.componentInstance.tabs[3]).toEqual(tabs.infoArtifacts);
expect (fixture.componentInstance.tabs[4]).toEqual(tabs.apiArtifacts);
+ expect (fixture.componentInstance.tabs[5]).toEqual(tabs.substitutionFilter);
});
@@ -157,7 +164,7 @@ describe('composition-panel component', () => {
fixture.componentInstance.ngOnInit();
// Expect that
- expect (fixture.componentInstance.tabs.length).toBe(5);
+ expect (fixture.componentInstance.tabs.length).toBe(6);
expect (fixture.componentInstance.tabs[0]).toEqual(tabs.infoTab);
expect (fixture.componentInstance.tabs[1]).toEqual(tabs.properties);
expect (fixture.componentInstance.tabs[2]).toEqual(tabs.reqAndCapabilities);
@@ -180,7 +187,7 @@ describe('composition-panel component', () => {
fixture.componentInstance.ngOnInit();
// Expect that
- expect (fixture.componentInstance.tabs.length).toBe(5);
+ expect (fixture.componentInstance.tabs.length).toBe(6);
expect (fixture.componentInstance.tabs[0]).toEqual(tabs.infoTab);
expect (fixture.componentInstance.tabs[1]).toEqual(tabs.deploymentArtifacts);
expect (fixture.componentInstance.tabs[2]).toEqual(tabs.properties);
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 53c569be11..4feaac8272 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
@@ -142,8 +142,12 @@ export class CompositionPanelComponent {
if (component.isService() && !this.selectedComponentIsServiceProxyInstance() && !this.selectedComponentIsServiceSubstitutionInstance()) {
this.tabs.push(tabs.apiArtifacts);
+ }
+
+ if((component.isService() || this.isVF()) && !this.isComponentInstanceSelected()){
this.tabs.push(tabs.substitutionFilter);
}
+
if (component.isService() && (this.selectedComponentIsServiceProxyInstance() || this.selectedComponentIsServiceSubstitutionInstance())) {
this.tabs.push(tabs.consumption);
this.tabs.push(tabs.dependencies);
@@ -162,6 +166,10 @@ export class CompositionPanelComponent {
return this.topologyTemplate.isResource() && (this.topologyTemplate as Resource).resourceType === ResourceType.PNF;
}
+ private isVF = (): boolean => {
+ return this.topologyTemplate.isResource() && (this.topologyTemplate as Resource).resourceType === ResourceType.VF;
+ }
+
private isConfiguration = (): boolean => {
return this.topologyTemplate.isResource() && (this.topologyTemplate as Resource).resourceType === ResourceType.CONFIGURATION;
}