2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
20 import { Component, OnInit } from '@angular/core';
21 import { FormControl, Validators } from '@angular/forms';
22 import { StatsService } from '../../services/stats/stats.service';
25 selector: 'rd-app-config-event',
26 templateUrl: './config-event.component.html',
27 styleUrls: ['./config-event.component.scss']
29 export class ConfigEventComponent implements OnInit {
33 contactFormModalJsonUrl = new FormControl('', Validators.required);
34 contactFormModalHost = new FormControl('', Validators.required);
35 contactFormModalMetrics = new FormControl('', Validators.required);
36 contactFormModalDelay = new FormControl('', Validators.required);
37 contactFormModalLoad = new FormControl('', Validators.required);
38 contactFormModalDelayMax = new FormControl('', Validators.required);
39 contactFormModalLoadMax = new FormControl('', Validators.required);
40 onOpened(event: any) {
41 this.service.loadConfig();
42 this.contactFormModalJsonUrl.setValue(this.service.jsonURL);
43 this.contactFormModalHost.setValue(this.service.hostURL);
44 this.contactFormModalMetrics.setValue(this.service.metricsPath);
45 this.contactFormModalDelay.setValue(this.service.delayPath);
46 this.contactFormModalLoad.setValue(this.service.loadPath);
47 this.contactFormModalDelayMax.setValue(this.service.delayMax);
48 this.contactFormModalLoadMax.setValue(this.service.loadMax);
53 constructor(private service: StatsService) { }
57 this.service.loadConfig();
58 // console.log(this.service.hostURL);
59 //this.contactFormModalHost.setValue(this.service.hostURL);
60 //this.contactFormModalJsonUrl.setValue(this.service.jsonURL);
65 this.service.saveConfig('jsonURL', this.contactFormModalJsonUrl.value);
66 this.service.saveConfig('host', this.contactFormModalHost.value);
67 this.service.saveConfig('metricspath', this.contactFormModalMetrics.value);
68 this.service.saveConfig('delaypath', this.contactFormModalDelay.value);
69 this.service.saveConfig('loadpath', this.contactFormModalLoad.value);
70 this.service.saveConfig('delaymax', this.contactFormModalDelayMax.value);
71 this.service.saveConfig('loadmax', this.contactFormModalLoadMax.value);
72 this.service.loadConfig();