summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.spec.ts44
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/panel/composition-panel.component.ts13
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html2
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts9
4 files changed, 54 insertions, 14 deletions
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 d5c0b6093b..2f27f468b6 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
@@ -169,28 +169,49 @@ describe('composition-panel component', () => {
expect(fixture).toMatchSnapshot();
});
- it('When Topology Template is Service and no instance is selected Expect (info, deployment, inputs, info and api)', () => {
-
+ it('When Topology Template is Service and no instance is selected Expect tabs info, deployment, inputs, info, api, substitution filter', () => {
const selectedComponent: Service = new Service(null, null);
selectedComponent.isResource = jest.fn(() => false);
- selectedComponent.isService = jest.fn(() => true );
+ selectedComponent.isService = jest.fn(() => true);
+ selectedComponent.isSubstituteCandidate = jest.fn(() => true);
+ fixture.componentInstance.store.select = jest.fn(() => Observable.of(selectedComponent));
+
+ fixture.componentInstance.topologyTemplate = selectedComponent;
+
+ // Call ngOnInit
+ fixture.componentInstance.ngOnInit();
+
+ // Expect that
+ 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.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);
+ });
+
+ it('When Topology Template is Service without base type, and no instance is selected. Expect tabs info, deployment, inputs, info and api', () => {
+
+ const selectedComponent: Service = new Service(null, null);
+ selectedComponent.isResource = jest.fn(() => false);
+ selectedComponent.isService = jest.fn(() => true);
+ selectedComponent.isSubstituteCandidate = jest.fn(() => false);
fixture.componentInstance.store.select = jest.fn(() => Observable.of(selectedComponent));
- // const pnfMock = Mock.of<Service>({ isResource : () => false });
fixture.componentInstance.topologyTemplate = selectedComponent;
// Call ngOnInit
fixture.componentInstance.ngOnInit();
// Expect that
- 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.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);
+ expect(fixture.componentInstance.tabs.length).toBe(5);
+ expect(fixture.componentInstance.tabs[0]).toEqual(tabs.infoTab);
+ expect(fixture.componentInstance.tabs[1]).toEqual(tabs.deploymentArtifacts);
+ expect(fixture.componentInstance.tabs[2]).toEqual(tabs.inputs);
+ expect(fixture.componentInstance.tabs[3]).toEqual(tabs.infoArtifacts);
+ expect(fixture.componentInstance.tabs[4]).toEqual(tabs.apiArtifacts);
});
@@ -223,6 +244,7 @@ describe('composition-panel component', () => {
const selectedComponent: Service = new Service(null, null);
selectedComponent.isResource = jest.fn(() => false);
selectedComponent.isService = jest.fn(() => true );
+ selectedComponent.isSubstituteCandidate = jest.fn(() => true );
fixture.componentInstance.store.select = jest.fn(() => Observable.of(selectedComponent));
fixture.componentInstance.selectedComponentIsServiceProxyInstance = jest.fn(() => true);
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 6ed73b3384..3422cc142d 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
@@ -264,7 +264,7 @@ export class CompositionPanelComponent {
this.tabs.push(tabs.apiArtifacts);
}
- if((component.isService() || this.isVF()) && !this.isComponentInstanceSelected()){
+ if (this.showSubstitutionFilterTab(component)) {
this.tabs.push(tabs.substitutionFilter);
}
@@ -279,6 +279,17 @@ export class CompositionPanelComponent {
}
+ private showSubstitutionFilterTab(component): boolean {
+ if ((component.isService() || this.isVF()) && !this.isComponentInstanceSelected()) {
+ if (component.isService()) {
+ return (<Service>component).isSubstituteCandidate();
+ }
+ return true;
+ }
+
+ return false;
+ }
+
private toggleSidebarDisplay = () => {
// this.withSidebar = !this.withSidebar;
this.store.dispatch(new OnSidebarOpenOrCloseAction());
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html
index b54cbc97c2..747624a03f 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html
@@ -87,7 +87,7 @@
</div>
<div class="right-column">
<div *ngIf="!isReadonly && !isInputsTabSelected" class="add-btn"
- (click)="addProperty(component.model)" data-tests-id="properties-add-button" [ngClass]="{'disabled': !isSelf()}">Add Property</div>
+ (click)="addProperty(component.model)" data-tests-id="properties-add-button" [ngClass]="{'disabled': !showAddProperties()}">Add Property</div>
<div *ngIf="!isReadonly && isInputsTabSelected" class="add-btn"
(click)="addInput()" [ngClass]="{'disabled': !isSelf()}">Add Input</div>
<tabs #hierarchyNavTabs tabStyle="simple-tabs" class="gray-border">
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 09fd888755..e0a1cbf8ff 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
@@ -38,6 +38,7 @@ import {
PropertyBEModel,
PropertyFEModel,
PropertyInputDetail,
+ Service,
SimpleFlatProperty
} from "app/models";
import {ResourceType} from "app/utils";
@@ -67,7 +68,6 @@ import {ToscaPresentationData} from "../../../models/tosca-presentation";
import {Observable} from "rxjs";
import {ToscaGetFunctionType} from "../../../models/tosca-get-function-type.enum";
import {TranslateService} from "../../shared/translator/translate.service";
-import {Model} from '../../../models/model';
const SERVICE_SELF_TITLE = "SELF";
@Component({
@@ -250,6 +250,13 @@ export class PropertiesAssignmentComponent {
return this.selectedInstanceData && this.selectedInstanceData.uniqueId == this.component.uniqueId;
}
+ showAddProperties = (): boolean => {
+ if (this.component.isService() && !(<Service>this.component).isSubstituteCandidate()) {
+ return false;
+ }
+ return this.isSelf();
+ }
+
getServiceProperties() {
this.loadingProperties = true;
this.topologyTemplateService