From 65be860e2a6844da71d4046254a189d911adbbd9 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Tue, 15 Oct 2019 16:28:59 +0800 Subject: feat:add healModel component of services-list page Change-Id: I0665fb880663645fd620355387f1a113f72d40c5 Issue-ID: USECASEUI-307 Signed-off-by: cyuamber --- .../heal-model/heal-model.component.html | 72 ++++++++++++++++++++++ .../heal-model/heal-model.component.less | 0 .../heal-model/heal-model.component.spec.ts | 25 ++++++++ .../heal-model/heal-model.component.ts | 68 ++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.html create mode 100644 usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.less create mode 100644 usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.spec.ts create mode 100644 usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.ts (limited to 'usecaseui-portal/src/app/views/services/services-list/heal-model') diff --git a/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.html b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.html new file mode 100644 index 00000000..0117669f --- /dev/null +++ b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.html @@ -0,0 +1,72 @@ + +

{{"i18nTextDefine_SureHeal" | translate}}

+
+

{{"i18nTextDefine_InstanceID" | translate}} :

+
{{ thisService["service-instance-id"] || + thisService["nsInstanceId"] || + thisService["vnfInstanceId"]}} +
+
+ +
+
+

{{"i18nTextDefine_degreeHealing" | translate}} :

+ + + + + + +
+
+ {{"i18nTextDefine_actionsHealing" | translate}} : + +
+
+ + +   +
+
+ {{"i18nTextDefine_healScript" | translate}} : + +
+ {{"i18nTextDefine_additionalParamsforNs" | translate}} : + +
+
+ Key:   + Value: + +
+
+
+ +
+
+

{{"i18nTextDefine_cause" | translate}} :

+ +
+
+

{{"i18nTextDefine_action" | translate}} :

+ +
+
+

{{"i18nTextDefine_actionvminfo" | translate}}:

+ + + +
+
+
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.less b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.less new file mode 100644 index 00000000..e69de29b diff --git a/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.spec.ts b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.spec.ts new file mode 100644 index 00000000..af1c07bd --- /dev/null +++ b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HealModelComponent } from './heal-model.component'; + +describe('HealModelComponent', () => { + let component: HealModelComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HealModelComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HealModelComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.ts b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.ts new file mode 100644 index 00000000..a7ffe663 --- /dev/null +++ b/usecaseui-portal/src/app/views/services/services-list/heal-model/heal-model.component.ts @@ -0,0 +1,68 @@ +import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; + +@Component({ + selector: 'app-heal-model', + templateUrl: './heal-model.component.html', + styleUrls: ['./heal-model.component.less'] +}) +export class HealModelComponent implements OnInit { + @Input()healModelVisible: boolean; + @Input()thisService; + @Input()nsParams; + @Input()healActions; + @Input()nsAdditional; + @Input()vnfParams; + @Input()vmSelected; + @Input()vnfVms; + @Input()templatehealstarting; + @Input()templatehealSuccessFaild; + + @Output() cancel = new EventEmitter(); + @Output() healModalOK = new EventEmitter(); + + constructor() { } + + ngOnInit() { + } + + + addActionsHealing() { + this.healActions.push({ value: "" }) + } + + minusActionsHealing(index) { + this.healActions.splice(index, 1); + } + + addNsAdditional() { + this.nsAdditional.push({ key: "", value: "" }) + } + + minusNsAdditional(index) { + this.nsAdditional.splice(index, 1); + } + + healOk() { + this.healModelVisible = false; + // nsParams + this.nsParams.actionsHealing = this.healActions.map((item) => { + return item.value + }); + let additional = {}; + this.nsAdditional.forEach((item) => { + additional[item.key] = item.value; + }); + this.nsParams.additionalParamsforNs = JSON.stringify(additional); + // vnfParams + this.vnfParams.additionalParams.actionvminfo.vmid = this.vmSelected["vmId"]; + this.vnfParams.additionalParams.actionvminfo.vmname = this.vmSelected["vmName"]; + + let requestBody = this.thisService["serviceDomain"] == "Network Service" ? { healNsData: this.nsParams } : { healVnfData: this.vnfParams }; + this.healModalOK.emit(requestBody) + } + + healCancel() { + this.healModelVisible = false; + } + +} -- cgit 1.2.3-korg