import * as widgets from "oasi-widgets"; import { DocumentRestService, DocumentLogItem } from "isogd-document-rest"; interface ILog { dateEdit: string; userName: string; jsonPatch: string; } class HistoryController { static $inject = ['documentRestService']; private loadingStatus: widgets.LoadingStatus = widgets.LoadingStatus.LOADING; private logs: DocumentLogItem[]; private id: string; constructor(private documentRestService: DocumentRestService) { } $onInit() { this.loadingStatus = widgets.LoadingStatus.LOADING; this.documentRestService.log(this.id).then(response => { this.logs = response; this.logs.forEach(l => { l.jsonPatch = JSON.parse(l.jsonPatch); }); this.loadingStatus = widgets.LoadingStatus.SUCCESS; }).catch(error => { this.loadingStatus = widgets.LoadingStatus.ERROR; }); } } export const HistoryComponent: angular.IComponentOptions = { controller: HistoryController, template: require('./history.html'), bindings: { id: '<' } };