From 816841486589afe416ebd65a55f6010b0ea338ab Mon Sep 17 00:00:00 2001 From: cyuamber Date: Tue, 15 Oct 2019 14:53:28 +0800 Subject: feat:add deleteModel component of service-list page Change-Id: I29c64343321f216152f466a7f8650b54e63dde53 Issue-ID: USECASEUI-307 Signed-off-by: cyuamber --- usecaseui-portal/src/app/app.module.ts | 4 +- .../delete-model/delete-model.component.html | 34 +++++++++++++++ .../delete-model/delete-model.component.less | 0 .../delete-model/delete-model.component.spec.ts | 25 +++++++++++ .../delete-model/delete-model.component.ts | 42 +++++++++++++++++++ .../services-list/services-list.component.html | 48 ++++++---------------- .../services-list/services-list.component.ts | 18 +++----- 7 files changed, 121 insertions(+), 50 deletions(-) create mode 100644 usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.html create mode 100644 usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.less create mode 100644 usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.spec.ts create mode 100644 usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.ts diff --git a/usecaseui-portal/src/app/app.module.ts b/usecaseui-portal/src/app/app.module.ts index 07080bbc..cbc95de9 100644 --- a/usecaseui-portal/src/app/app.module.ts +++ b/usecaseui-portal/src/app/app.module.ts @@ -75,7 +75,7 @@ import { TestComponent } from './test/test.component'; import { TextService } from './core/services/text.service'; import { TopCardComponent } from './views/services/services-list/top-card/top-card.component'; import { CreateModelComponent } from './views/services/services-list/create-model/create-model.component'; -// import { DeleteModalComponent } from './views/services/services-list/delete-modal/delete-modal.component'; +import { DeleteModelComponent } from './views/services/services-list/delete-model/delete-model.component'; import { NotificationComponent } from './shared/components/notification/notification.component'; @NgModule({ @@ -119,7 +119,7 @@ import { NotificationComponent } from './shared/components/notification/notifica TestComponent, TopCardComponent, CreateModelComponent, - // DeleteModalComponent, + DeleteModelComponent, NotificationComponent ], imports: [ diff --git a/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.html b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.html new file mode 100644 index 00000000..5b516a0f --- /dev/null +++ b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.html @@ -0,0 +1,34 @@ + +

{{"i18nTextDefine_SureDelete" | translate}}

+
+

{{"i18nTextDefine_InstanceName" | translate}} :

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

{{"i18nTextDefine_InstanceID" | translate}} :

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

{{"i18nTextDefine_terminationType" | translate}} :

+ + + + +
+
+

{{"i18nTextDefine_gracefulTerminationTimeout" | translate}} + :

+ +
+
+
diff --git a/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.less b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.less new file mode 100644 index 00000000..e69de29b diff --git a/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.spec.ts b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.spec.ts new file mode 100644 index 00000000..e5e94c94 --- /dev/null +++ b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DeleteModelComponent } from './delete-model.component'; + +describe('DeleteModelComponent', () => { + let component: DeleteModelComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DeleteModelComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DeleteModelComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.ts b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.ts new file mode 100644 index 00000000..f9bf9a9c --- /dev/null +++ b/usecaseui-portal/src/app/views/services/services-list/delete-model/delete-model.component.ts @@ -0,0 +1,42 @@ +import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; + +@Component({ + selector: 'app-delete-model', + templateUrl: './delete-model.component.html', + styleUrls: ['./delete-model.component.less'] +}) +export class DeleteModelComponent implements OnInit { + @Input()deleteModalVisible: boolean; + @Input()thisService; + @Input()terminationType; + @Input()loadingAnimateShow; + @Input()templateDeleteSuccessFaild; + @Input()gracefulTerminationTimeout; + + @Output() cancel = new EventEmitter(); + @Output() deleteModalOK = new EventEmitter(); + + constructor() { } + + ngOnInit() { + } + + deleteOk() { + this.deleteModalVisible = false; + this.loadingAnimateShow = true; + + if (this.thisService["serviceDomain"] === "Network Service") { + this.deleteModalOK.emit({ + terminationType: this.terminationType, + gracefulTerminationTimeout: this.gracefulTerminationTimeout + }) + } else { + this.deleteModalOK.emit() + } + } + deleteCancel() { + this.deleteModalVisible = 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 a97c3766..ce3844c1 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 @@ -222,41 +222,19 @@ - - -

{{"i18nTextDefine_SureDelete" | translate}}

-
-

{{"i18nTextDefine_InstanceName" | translate}} :

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

{{"i18nTextDefine_InstanceID" | translate}} :

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

{{"i18nTextDefine_terminationType" | translate}} :

- - - - -
-
-

{{"i18nTextDefine_gracefulTerminationTimeout" | translate}} - :

- -
-
-
+ + + ): void { this.notification.template(template); } @@ -992,7 +988,7 @@ export class ServicesListComponent implements OnInit { }) } - deleteService(service, templateDeleteSuccessFaild) { + deleteService(service:any, templateDeleteSuccessFaild) { let allprogress = {}; let querypros = []; service.rate = 0; @@ -1069,18 +1065,14 @@ export class ServicesListComponent implements OnInit { }) } - deleteNsService(service) { + deleteNsService(obj:any,service:any) { service.rate = 0; service.status = "In Progress"; service.tips = ""; service.statusClass = "1002"; let id = service.nsInstanceId || service["service-instance-id"]; let operationType = "1002"; - let requestBody = { - terminationType: this.terminationType, - gracefulTerminationTimeout: this.gracefulTerminationTimeout - } - this.stopNsService(id, requestBody).then((jobid) => { + this.stopNsService(id, obj).then((jobid) => { if (jobid === "Failed") { service.status = "Failed"; this.notification1.notificationFailed(service.serviceDomain,'deleteStarting',service["service-instance-name"] ||service["nsInstanceName"]) -- cgit 1.2.3-korg