blob: 4bca4734e32ddfbe02c7368af4c3ffcd78f249e6 [file] [log] [blame]
/*
******************************************************************************
* Copyright 2018 PTA GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*
******************************************************************************
*/
import { Component } from '@angular/core';
import { AbstractListComponent } from '../common-components/abstract-list/abstract-list.component';
import { ErrorType } from '../../common/enums';
import { Globals } from './../../common/globals';
import { GridOptions } from 'ag-grid/dist/lib/entities/gridOptions';
import { StatusChangesAgGridConfiguration } from './status-changes-ag-grid-configuration';
@Component({
selector: 'app-status-changes',
templateUrl: './status-changes.component.html',
styleUrls: ['./status-changes.component.css', '../common-components/abstract-list/abstract-list.component.css']
})
export class StatusChangesComponent extends AbstractListComponent {
Globals = Globals;
statuschanges: any;
currentDate = new Date();
isStatusCollapsed = true;
initAgGrid() {
const localGridOptions = <GridOptions>{
columnDefs: StatusChangesAgGridConfiguration.createColumnDefs(this.sessionContext)
};
this.gridOptions = Object.assign(this.globalGridOptions, localGridOptions);
}
retrieveData() {
if (this.gridId) {
this.gridMeasureService.getHistoricalStatusChanges(parseInt(this.gridId, 10)).subscribe(statchanges => {
this.statuschanges = statchanges;
this.showSpinner = false;
}, error => {
console.log(error);
// this.messageService.emitError(this.gridId, ErrorType.retrieve, error);
this.toasterMessageService.showError(ErrorType.retrieve, this.gridId, error);
});
} else {
this.statuschanges = [];
this.showSpinner = false;
}
}
changeAllSelection(): void {
if (this.selectAll) {
for (const info of this.statuschanges) {
info.selected = true;
}
} else {
for (const info of this.statuschanges) {
info.selected = false;
}
}
}
}