summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/shared/components/notification/notification.component.ts
blob: 18f91b35b620961d9535f75861adbc0c3e1260b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { Component, OnInit, ViewChild, Input } from '@angular/core';
import { NzNotificationService } from 'ng-zorro-antd';

@Component({
  selector: 'app-notification',
  templateUrl: './notification.component.html',
  styleUrls: ['./notification.component.less']
})
export class NotificationComponent implements OnInit {
  @ViewChild('notificationModel')notificationModel: any;
  @Input()isServicesList: boolean;
  @Input()parentComponent: string;
  @Input()customerSelected: object;

  notificationAttributes: {
    title: string,
    imgPath: string,
    action: string,
    status: string,
    name: string
  };

  constructor(private notification: NzNotificationService) { }

  ngOnInit() { }

  setNotification({ title, imgPath, action, status, name }):void{
    this.notificationAttributes = { title, imgPath, action, status, name };
  }
  notificationSuccess(title: string, action: string, name: string): void {
    this.notification.remove();
    this.setNotification({ title, imgPath: "assets/images/execute-success.png", action, status: 'Success', name })
    this.notification.template(this.notificationModel);
  }
  notificationFailed(title: string, action: string, name: string): void {
    this.notification.remove();
    this.setNotification({ title, imgPath: "assets/images/execute-faild.png", action, status: 'Failed', name })
    this.notification.template(this.notificationModel)
  }
  notificationStart(title: string, action: string, name: string): void {
    this.notification.remove();
    this.setNotification({ title, imgPath: "assets/images/execute-inproess.png", action , status: 'instance temination is starting', name })
    this.notification.template(this.notificationModel)
  }

}