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 --- usecaseui-portal/src/app/app.module.ts | 2 + .../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 ++++++++++ .../services-list/services-list.component.html | 146 +++++++-------------- .../services-list/services-list.component.ts | 41 +----- 7 files changed, 214 insertions(+), 140 deletions(-) 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 diff --git a/usecaseui-portal/src/app/app.module.ts b/usecaseui-portal/src/app/app.module.ts index 04651d01..17804649 100644 --- a/usecaseui-portal/src/app/app.module.ts +++ b/usecaseui-portal/src/app/app.module.ts @@ -78,6 +78,7 @@ import { CreateModelComponent } from './views/services/services-list/create-mode import { DeleteModelComponent } from './views/services/services-list/delete-model/delete-model.component'; import { NotificationComponent } from './shared/components/notification/notification.component'; import { ScaleModelComponent } from './views/services/services-list/scale-model/scale-model.component'; +import { HealModelComponent } from './views/services/services-list/heal-model/heal-model.component'; @NgModule({ providers: [ @@ -123,6 +124,7 @@ import { ScaleModelComponent } from './views/services/services-list/scale-model/ DeleteModelComponent, NotificationComponent, ScaleModelComponent, + HealModelComponent ], imports: [ BrowserModule, 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; + } + +} diff --git a/usecaseui-portal/src/app/views/services/services-list/services-list.component.html b/usecaseui-portal/src/app/views/services/services-list/services-list.component.html index ff1924fb..216e92df 100644 --- a/usecaseui-portal/src/app/views/services/services-list/services-list.component.html +++ b/usecaseui-portal/src/app/views/services/services-list/services-list.component.html @@ -179,108 +179,21 @@ (scaleModalOK)="scaleModalOK($event,templatescalestarting,templateScaleSuccessFaild)" > - -

{{"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}}:

- - - -
-
- - -
-
- - instance temination is starting - -
NS   - {{"i18nTextDefine_InstanceHealingStarting" | translate}} -
-
-
-

{{"i18nTextDefine_InstanceName" | translate}} :

- {{ thisService["service-instance-name"] || - thisService["nsInstanceName"] }} - -
-
-

{{"i18nTextDefine_Customer" | translate}} :

- {{ customerSelected.name }} -
-
-

{{"i18nTextDefine_UseCase" | translate}} :

- {{ thisService["serviceDomain"] }} -
-
-
{{"i18nTextDefine_Close" | translate}}
-
-
-
-
+ @@ -498,6 +411,35 @@ + +
+
+ + instance temination is starting + +
NS   + {{"i18nTextDefine_InstanceHealingStarting" | translate}} +
+
+
+

{{"i18nTextDefine_InstanceName" | translate}} :

+ {{ thisService["service-instance-name"] || + thisService["nsInstanceName"] }} + +
+
+

{{"i18nTextDefine_Customer" | translate}} :

+ {{ customerSelected.name }} +
+
+

{{"i18nTextDefine_UseCase" | translate}} :

+ {{ thisService["serviceDomain"] }} +
+
+
{{"i18nTextDefine_Close" | translate}}
+
+
+
diff --git a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts index 47ba6f9d..da027028 100644 --- a/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts +++ b/usecaseui-portal/src/app/views/services/services-list/services-list.component.ts @@ -408,23 +408,7 @@ export class ServicesListComponent implements OnInit { vmname: "" } } - } - - 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); - } + }; healService(service) { this.thisService = service; @@ -439,30 +423,11 @@ export class ServicesListComponent implements OnInit { } } - healOk(templatehealstarting, templatehealSuccessFaild) { - 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.healNsVnfService(this.thisService, requestBody, templatehealSuccessFaild); + healModalOK(obj: any,templatehealstarting,templatehealSuccessFaild) :void{ + this.healNsVnfService(this.thisService, obj, templatehealSuccessFaild); this.healNotification(templatehealstarting); } - healCancel() { - this.healModelVisible = false; - } - healNotification(template: TemplateRef<{}>): void { this.notification.template(template); } -- cgit 1.2.3-korg