summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/services-list/scale-model/scale-model.component.ts
blob: c1b9a86e54504050da6190be80788e8abc52c9f0 (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
47
48
49
50
51
52
53
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';

@Component({
  selector: 'app-scale-model',
  templateUrl: './scale-model.component.html',
  styleUrls: ['./scale-model.component.less']
})
export class ScaleModelComponent implements OnInit {
  @Input()scaleModelVisible: boolean;
  @Input()templatescalestarting;
  @Input()templateScaleSuccessFaild;
  @Input()thisService;
  @Input()e2e_nsData;
  @Input()customerSelected;
  @Input()serviceTypeSelected;

  @Output() cancel = new EventEmitter<boolean>();
  @Output() scaleModalOK = new EventEmitter<any>();
  constructor() { }

  ngOnInit() {
  }

    scaleOk() {
        this.scaleModelVisible = false;
        let requestBody = {
            "service": {
                "serviceInstanceName": this.thisService["service-instance-name"],
                "serviceType": this.serviceTypeSelected.name,
                "globalSubscriberId": this.customerSelected.id,
                "resources": this.e2e_nsData.map((item) => {
                    return {
                        "resourceInstanceId": item["netWorkServiceId"],
                        "scaleType": item["scaleType"],
                        "scaleNsData": {
                            "scaleNsByStepsData": {
                                "aspectId": item["aspectId"],
                                "numberOfSteps": item["numberOfSteps"],
                                "scalingDirection": item["scalingDirection"]
                            }
                        }
                    }
                })
            }
        };
        this.scaleModalOK.emit(requestBody)
    }

    scaleCancel() {
        this.scaleModelVisible = false;
    }

}