2 Copyright 2020 TATA ELXSI
4 Licensed under the Apache License, Version 2.0 (the 'License');
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 Author: BARATH KUMAR R (barath.r@tataelxsi.co.in)
20 * @file Page for Operational View App configs Component
22 import { Component, Injector, Input, OnInit } from '@angular/core';
23 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
24 import { URLPARAMS } from 'CommonModel';
25 import { isNullOrUndefined } from 'SharedService';
28 * @Component takes OperationalViewAppConfigsComponent.html as template url
31 selector: 'app-operational-view-app-configs',
32 templateUrl: './OperationalViewAppConfigsComponent.html'
34 /** Exporting a class @exports OperationalViewAppConfigsComponent */
35 export class OperationalViewAppConfigsComponent implements OnInit {
36 /** Invoke service injectors @public */
37 public injector: Injector;
39 /** Get the config data @public */
40 public configData: {}[];
42 /** Instance for active modal service @public */
43 public activeModal: NgbActiveModal;
45 /** Input contains component objects @private */
46 @Input() private params: URLPARAMS;
48 /** creates Operational view app config component */
49 constructor(injector: Injector) {
50 this.injector = injector;
51 this.activeModal = this.injector.get(NgbActiveModal);
55 * Lifecyle Hooks the trigger before component is instantiate
57 public ngOnInit(): void {
59 if (!isNullOrUndefined(this.params.configs)) {
60 this.configData = Object.keys(this.params.configs).map((key: string): Object => (
63 // eslint-disable-next-line security/detect-object-injection
64 default: this.params.configs[key].default,
65 // eslint-disable-next-line security/detect-object-injection
66 description: this.params.configs[key].description,
67 // eslint-disable-next-line security/detect-object-injection
68 source: this.params.configs[key].source,
69 // eslint-disable-next-line security/detect-object-injection
70 type: this.params.configs[key].type,
71 // eslint-disable-next-line security/detect-object-injection
72 value: this.params.configs[key].value