| Barath Kumar R | f2ae546 | 2021-03-01 12:52:33 +0530 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2020 TATA ELXSI |
| 3 | |
| 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 |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 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. |
| 15 | |
| 16 | Author: BARATH KUMAR R (barath.r@tataelxsi.co.in) |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * @file Page for Operational View App actions Component |
| 21 | */ |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame^] | 22 | import { isNullOrUndefined } from 'util'; |
| Barath Kumar R | f2ae546 | 2021-03-01 12:52:33 +0530 | [diff] [blame] | 23 | import { Component, Injector, Input, OnInit } from '@angular/core'; |
| 24 | import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; |
| 25 | import { URLPARAMS } from 'CommonModel'; |
| Barath Kumar R | f2ae546 | 2021-03-01 12:52:33 +0530 | [diff] [blame] | 26 | /** |
| 27 | * Creating component |
| 28 | * @Component takes OperationalViewAppActionsComponent.html as template url |
| 29 | */ |
| 30 | @Component({ |
| 31 | selector: 'app-operational-view-app-actions', |
| 32 | templateUrl: './OperationalViewAppActionsComponent.html' |
| 33 | }) |
| 34 | /** Exporting a class @exports OperationalViewAppActionsComponent */ |
| 35 | export class OperationalViewAppActionsComponent implements OnInit { |
| 36 | /** Invoke service injectors @public */ |
| 37 | public injector: Injector; |
| 38 | |
| 39 | /** Get the actions data @public */ |
| 40 | public actionsData: {}[]; |
| 41 | |
| 42 | /** Instance for active modal service @public */ |
| 43 | public activeModal: NgbActiveModal; |
| 44 | |
| 45 | /** Input contains component objects @private */ |
| 46 | @Input() private params: URLPARAMS; |
| 47 | |
| 48 | /** creates Operational view app actions component */ |
| 49 | constructor(injector: Injector) { |
| 50 | this.injector = injector; |
| 51 | this.activeModal = this.injector.get(NgbActiveModal); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Lifecyle Hooks the trigger before component is instantiate |
| 56 | */ |
| 57 | public ngOnInit(): void { |
| 58 | this.actionsData = []; |
| 59 | if (!isNullOrUndefined(this.params.actions)) { |
| 60 | this.actionsData = Object.keys(this.params.actions).map((key: string): Object => ( |
| 61 | { |
| 62 | actions: key, |
| SANDHYA.JS | 0a34dfa | 2023-04-25 23:59:41 +0530 | [diff] [blame^] | 63 | // eslint-disable-next-line security/detect-object-injection |
| Barath Kumar R | f2ae546 | 2021-03-01 12:52:33 +0530 | [diff] [blame] | 64 | description: this.params.actions[key] |
| 65 | })); |
| 66 | } |
| 67 | } |
| 68 | } |