diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
4 files changed, 37 insertions, 9 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.html b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.html index 27e05ec1f0..c73f69734f 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.html +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.html @@ -10,7 +10,7 @@ </div> <div class="w-sdc-designer-sidebar-section w-sdc-designer-sidebar-section-relations"> <sdc-accordion [title]="'Requirements'" [arrow-direction]="'right'" [testId]="'Requirements-accordion'"> - <requirement-list [component]='component' [requirements]="requirements" [isInstanceSelected]="isComponentInstanceSelected"></requirement-list> + <requirement-list [component]='component' [requirements]="requirements" [isInstanceSelected]="isComponentInstanceSelected" [isViewOnly]='isViewOnly'></requirement-list> </sdc-accordion> </div> @@ -28,7 +28,7 @@ <sdc-accordion *ngIf="requirementsInstancesMap" [title]="'Requirements'" [arrow-direction]="'right'" [testId]="'Requirements-accordion'"> <sdc-accordion *ngFor="let key of objectKeys(requirementsInstancesMap); let i = index" [title]="key"> - <requirement-list [component]='component' [requirements]="requirementsInstancesMap[key]" [isInstanceSelected]="isComponentInstanceSelected"></requirement-list> + <requirement-list [component]='component' [requirements]="requirementsInstancesMap[key]" [isInstanceSelected]="isComponentInstanceSelected" [isViewOnly]='isViewOnly'></requirement-list> </sdc-accordion> </sdc-accordion> diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.ts index 03697b38f2..7c91cbc4b8 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/req-capabilities-tab.component.ts @@ -122,10 +122,12 @@ export class ReqAndCapabilitiesTabComponent implements OnInit, OnDestroy { this.requirementsInstancesMap = new InstanceRequirementsMap(); _.forEach(this.requirements, (requirement:Requirement) => { - if (this.requirementsInstancesMap[requirement.ownerName]) { - this.requirementsInstancesMap[requirement.ownerName] = this.requirementsInstancesMap[requirement.ownerName].concat(requirement); - } else { - this.requirementsInstancesMap[requirement.ownerName] = new Array<Requirement>(requirement); + if(this.isComponentInstanceSelected || requirement.external){ + if (this.requirementsInstancesMap[requirement.ownerName]) { + this.requirementsInstancesMap[requirement.ownerName] = this.requirementsInstancesMap[requirement.ownerName].concat(requirement); + } else { + this.requirementsInstancesMap[requirement.ownerName] = new Array<Requirement>(requirement); + } } }); } diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.html b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.html index 8292729cf8..291b103344 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.html +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.html @@ -13,6 +13,17 @@ </div> </div> </div> + <div class="checkbox-label-mark-as-external" + *ngIf="isInstanceSelected"> + <checkbox + class="checkbox-label" + data-tests-id="checkbox-mark-as-external" + [label]="'External'" + (checkedChange)="onMarkAsExternal(requirement)" + [(checked)]="requirement.external" + [disabled]="isViewOnly"> + </checkbox> + </div> </div> </div> </div> diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.ts index e167c47dcc..3716ef0af0 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list/requirement-list.component.ts @@ -2,6 +2,8 @@ import { Component, Input } from '@angular/core'; import { Component as TopologyTemplate, RelationshipModel, Relationship, Requirement } from "app/models"; import { CompositionService } from "app/ng2/pages/composition/composition.service"; import { ResourceNamePipe } from "app/ng2/pipes/resource-name.pipe"; +import { ComponentInstanceServiceNg2 } from "app/ng2/services/component-instance-services/component-instance.service"; +import { WorkspaceService } from "app/ng2/pages/workspace/workspace.service"; @Component({ selector: 'requirement-list', @@ -11,10 +13,12 @@ export class RequirementListComponent { @Input() component: TopologyTemplate; @Input() requirements: Array<Requirement>; @Input() isInstanceSelected:boolean; + @Input() isViewOnly: boolean; + readonly:boolean; - - constructor(private compositionService: CompositionService) { } - + constructor(private compositionService: CompositionService, + private workspaceService: WorkspaceService, + private componentInstanceServiceNg2: ComponentInstanceServiceNg2) {} public getRelation = (requirement:any):any => { if (this.isInstanceSelected && this.component.componentInstancesRelations) { @@ -36,5 +40,16 @@ export class RequirementListComponent { return null; }; + onMarkAsExternal(requirement:Requirement) { + if (requirement.external){ + requirement.external = false; + } else { + requirement.external = true; + } + this.componentInstanceServiceNg2.updateInstanceRequirement(this.workspaceService.metadata.getTypeUrl(), this.workspaceService.metadata.uniqueId, this.component.uniqueId, requirement).subscribe((response:any) => { + }, (error) => { console.log("An error has occured setting external: ", error); });; + + } + }; |