1 import {Component, Input, ViewChild, OnInit, TemplateRef} from '@angular/core';
2 import {Observable, Observer, of} from 'rxjs';
3 import {DialogComponent} from '@eg/share/dialog/dialog.component';
4 import {AuthService} from '@eg/core/auth.service';
5 import {NetService} from '@eg/core/net.service';
6 import {OrgService} from '@eg/core/org.service';
7 import {Pager} from '@eg/share/util/pager';
8 import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
9 import {GridDataSource} from '@eg/share/grid/grid';
10 import {GridComponent} from '@eg/share/grid/grid.component';
11 import {GridToolbarCheckboxComponent
12 } from '@eg/share/grid/grid-toolbar-checkbox.component';
13 import {OrgUnitSetting} from '@eg/staff/admin/local/org-unit-settings/org-unit-settings.component';
16 selector: 'eg-admin-ou-setting-history-dialog',
17 templateUrl: './org-unit-setting-history-dialog.component.html'
20 export class OuSettingHistoryDialogComponent extends DialogComponent {
24 gridDataSource: GridDataSource;
25 @ViewChild('historyGrid', { static:true }) historyGrid: GridComponent;
29 private auth: AuthService,
30 private net: NetService,
31 private org: OrgService,
32 private modal: NgbModal
35 this.gridDataSource = new GridDataSource();
39 this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
40 return this.fetchHistory(pager);
44 fetchHistory(pager: Pager): Observable<any> {
45 return new Observable<any>(observer => {
46 this.gridDataSource.data = this.history;
53 var intTypes = ["integer", "currency", "link"];
54 if (intTypes.includes(this.entry.dataType)) {
55 log.new_value = parseInt(log.new_value);
57 log.new_value = log.new_value.replace(/^"(.*)"$/, '$1');
60 setting: {[this.entry.name]: log.new_value},
61 context: this.org.get(log.org),
64 this.gridDataSource.data = null;