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 Executed actions Component
22 import { isNullOrUndefined } from 'util';
23 import { Component, Injector, Input, OnInit } from '@angular/core';
24 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
25 import { URLPARAMS } from 'CommonModel';
26 import { EXECUTEDACTIONS } from 'OperationalModel';
29 * @Component takes OperationalViewAppExecutedActionsComponent.html as template url
32 selector: 'app-operational-view-executed-app-actions',
33 templateUrl: './OperationalViewAppExecutedActionsComponent.html'
35 /** Exporting a class @exports OperationalViewAppExecutedActionsComponent */
36 export class OperationalViewAppExecutedActionsComponent implements OnInit {
37 /** Invoke service injectors @public */
38 public injector: Injector;
40 /** Get the Executed actions data @public */
41 public executedActionsData: EXECUTEDACTIONS[];
43 /** Instance for active modal service @public */
44 public activeModal: NgbActiveModal;
46 /** Is executed action not available @public */
47 public isExecutedActionNotAvailable: boolean = false;
49 /** Input contains component objects @private */
50 @Input() private params: URLPARAMS;
52 /** creates Operational view app executed actions component */
53 constructor(injector: Injector) {
54 this.injector = injector;
55 this.activeModal = this.injector.get(NgbActiveModal);
59 * Lifecyle Hooks the trigger before component is instantiate
61 public ngOnInit(): void {
62 if (!isNullOrUndefined(this.params.executedActions) && this.params.executedActions.length > 0) {
63 this.params.executedActions.sort((a: EXECUTEDACTIONS, b: EXECUTEDACTIONS): number => (+a.id > +b.id ? 1 : +a.id < +b.id ? -1 : 0));
64 this.executedActionsData = this.params.executedActions;
66 this.isExecutedActionNotAvailable = true;