diff options
author | 2020-09-04 15:27:00 +0100 | |
---|---|---|
committer | 2020-09-07 13:28:22 +0000 | |
commit | 3e9a9769dd21f0b16b3f238e42349cba3b1a78de (patch) | |
tree | 1517e5266d5b9ae8e5c386d06937eb503d59d431 /catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list | |
parent | 84a51513bca9c41c8757db017eb45b2d801da195 (diff) |
Enable selection of requirements
Instead of all requirements of the component instances in a component being exposed outside the component, this change will enable the component designer to specifiy which should be exposed outside the component and which are to be internal to the component
Change-Id: Ib063f7b8b0aca94896e78a46f069725bae3d494d
Issue-ID: SDC-2771
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/req-capabilities-tab/requirement-list')
2 files changed, 29 insertions, 3 deletions
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); });; + + } + }; |