diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2020-08-21 18:04:52 +0100 |
---|---|---|
committer | Sébastien Determe <sebastien.determe@intl.att.com> | 2020-09-07 07:11:49 +0000 |
commit | 0c61108fca142e7e6a9d59453e3b14f2b402e89d (patch) | |
tree | a5f11f4255e6c9259ab853ebd2e6a03f95214d78 /catalog-ui/src/app | |
parent | 38511702dcdbf1f78b6457509e9c276bee36279a (diff) |
Enable node_filter update action
Issue-ID: SDC-3257
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: Id8ae9a7bfe941aa11891f472e830b4ca59b3e839
Diffstat (limited to 'catalog-ui/src/app')
4 files changed, 28 insertions, 32 deletions
diff --git a/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.html b/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.html index f093143054..4238a4e96f 100644 --- a/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.html +++ b/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.html @@ -18,13 +18,13 @@ <div class="i-sdc-designer-sidebar-section-content-item-rules-section" *ngIf="isDependent"> <div class="i-sdc-designer-sidebar-section-content-item-rule" [ngClass]="{'hand': !readonly}" - *ngFor="let rule of rulesList; let i = index"> + *ngFor="let constraint of constraintObjects; let i = index"> <div class="rule-details" [ngClass]="{'readonly': readonly}"> <div class="rule-desc" (click)="!readonly && onSelectRule(i)" tooltips - tooltip="{{rule.servicePropertyName + ' ' + getSymbol(rule.constraintOperator) + ' ' - + (rule.sourceName ? rule.sourceName + ':' : '') + rule.value}}"> - {{rule.servicePropertyName + ' ' + getSymbol(rule.constraintOperator) + ' ' - + (rule.sourceName ? rule.sourceName + ':' : '') + rule.value}} + tooltip="{{constraint.servicePropertyName + ' ' + getSymbol(constraint.constraintOperator) + ' ' + + (constraint.sourceName ? constraint.sourceName + ':' : '') + constraint.value}}"> + {{constraint.servicePropertyName + ' ' + getSymbol(constraint.constraintOperator) + ' ' + + (constraint.sourceName ? constraint.sourceName + ':' : '') + constraint.value}} </div> <span *ngIf="!readonly" class="sprite-new delete-btn delete-icon" (click)="openDeleteModal(i)" data-tests-id="delete-input-button"></span> @@ -41,4 +41,4 @@ </button> </div> </div> -</div>
\ No newline at end of file +</div> diff --git a/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts b/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts index 495782494c..55c933c38d 100644 --- a/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts +++ b/catalog-ui/src/app/ng2/components/logic/service-dependencies/service-dependencies.component.ts @@ -123,7 +123,7 @@ export class ServiceDependenciesComponent { isDependent: boolean; isLoading: boolean; parentServiceInputs: InputBEModel[] = []; - rulesList: ConstraintObject[] = []; + constraintObjects: ConstraintObject[] = []; operatorTypes: any[]; @Input() readonly: boolean; @@ -150,7 +150,7 @@ export class ServiceDependenciesComponent { this.topologyTemplateService.getComponentInputsWithProperties(this.compositeService.componentType, this.compositeService.uniqueId).subscribe((result: ComponentGenericResponse) => { this.parentServiceInputs = result.inputs; }); - this.loadRules(); + this.loadNodeFilter(); this.translateService.languageChangedObservable.subscribe((lang) => { I18nTexts.translateTexts(this.translateService); }); @@ -163,18 +163,13 @@ export class ServiceDependenciesComponent { } if (changes.selectedInstanceConstraints && changes.selectedInstanceConstraints.currentValue !== changes.selectedInstanceConstraints.previousValue) { this.selectedInstanceConstraints = changes.selectedInstanceConstraints.currentValue; - this.loadRules(); + this.loadNodeFilter(); } } private getActualDirectiveValue = (): string => { return this.currentServiceInstance.directives.length > 0 ? this.currentServiceInstance.directives[0] : ""; } - - private isServiceProxy = (): boolean => { - return this.currentServiceInstance.isServiceProxy(); - } - public openRemoveDependencyModal = (): ComponentRef<ModalComponent> => { const actionButton: ButtonModel = new ButtonModel(I18nTexts.modalApprove, 'blue', this.onUncheckDependency); const cancelButton: ButtonModel = new ButtonModel(I18nTexts.modalCancel, 'grey', this.onCloseRemoveDependencyModal); @@ -191,21 +186,22 @@ export class ServiceDependenciesComponent { return this.modalServiceNg2.createCustomModal(modalModel); } - loadRules() { - this.rulesList = this.selectedInstanceConstraints && this.selectedInstanceConstraints.map((co: ConstraintObject) => ({ - servicePropertyName: co.servicePropertyName, - constraintOperator: co.constraintOperator, - sourceType: co.sourceType, - sourceName: co.sourceName !== 'SELF' ? co.sourceName : this.compositeService.name, - value: co.value, - })); + private loadNodeFilter = (): void => { + this.topologyTemplateService.getServiceFilterConstraints(this.compositeService.componentType, this.compositeService.uniqueId).subscribe((response) => { + if (response.nodeFilterforNode) { + const nodeFilterResponse: ConstraintObject[] = response.nodeFilterforNode[this.currentServiceInstance.uniqueId].properties; + if (nodeFilterResponse) { + this.constraintObjects = nodeFilterResponse; + } + } + }); } onUncheckDependency = () => { this.modalServiceNg2.closeCurrentModal(); this.isLoading = true; const isDepOrig = this.isDependent; - const rulesListOrig = this.rulesList; + const rulesListOrig = this.constraintObjects; this.currentServiceInstance.unmarkAsDependent(this.getActualDirectiveValue()); this.updateComponentInstance(isDepOrig, rulesListOrig); } @@ -218,16 +214,16 @@ export class ServiceDependenciesComponent { onOptionsSelected(event: any) { const newDirectiveValue = event.target.value; if (newDirectiveValue.toLowerCase() !== this.getActualDirectiveValue()) { - const rulesListOrig = this.rulesList; + const rulesListOrig = this.constraintObjects; this.setDirectiveValue(newDirectiveValue); - this.rulesList = []; + this.constraintObjects = []; this.updateComponentInstance(this.isDependent, rulesListOrig); } } private onRemoveDirective() { this.openRemoveDependencyModal().instance.open(); - this.rulesList = []; + this.constraintObjects = []; } private setDirectiveValue(newDirectiveValue: string) { @@ -257,7 +253,7 @@ export class ServiceDependenciesComponent { this.isLoading = false; }, (err) => { this.isDependent = isDependentOrigVal; - this.rulesList = rulesListOrig; + this.constraintObjects = rulesListOrig; this.isLoading = false; console.log('An error has occurred.'); }); @@ -293,7 +289,7 @@ export class ServiceDependenciesComponent { ServiceDependenciesEditorComponent, { serviceRuleIndex: index, - serviceRules: _.map(this.rulesList, (rule) => new ConstraintObjectUI(rule)), + serviceRules: _.map(this.constraintObjects, (rule) => new ConstraintObjectUI(rule)), currentServiceName: this.currentServiceInstance.name, operatorTypes: this.operatorTypes, compositeServiceName: this.compositeService.name, diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts index 5171e3b607..fb0898d53e 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/service-dependencies-tab/service-dependencies-tab.component.ts @@ -61,7 +61,7 @@ export class ServiceDependenciesTabComponent { public loadConstraints = (): void => { this.topologyTemplateService.getServiceFilterConstraints(this.metaData.componentType, this.metaData.uniqueId).subscribe((response) => { - this.componentInstancesConstraints = response.nodeFilterData; + this.componentInstancesConstraints = response.nodeFilterforNode; }); } diff --git a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts index 2c502d9fd5..c6be9c369a 100644 --- a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts +++ b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts @@ -56,7 +56,7 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR public interfaceOperations:Array<OperationModel>; public additionalInformation:any; public derivedList:Array<any>; - public nodeFilterData: Array<any>; + public nodeFilterforNode: Array<any>; public substitutionFilterForTopologyTemplate: Array<any>; deserialize (response): ComponentGenericResponse { @@ -120,8 +120,8 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR if(response.policies) { this.policies = CommonUtils.initPolicies(response.policies); } - if(response.nodeFilterData) { - this.nodeFilterData = response.nodeFilterData; + if(response.nodeFilterforNode) { + this.nodeFilterforNode = response.nodeFilterforNode; } if(response.substitutionFilterForTopologyTemplate) { this.substitutionFilterForTopologyTemplate = response.substitutionFilterForTopologyTemplate; |