@@ -24,14 +24,16 @@ import constants from '../../../constants';
2424import settings from '../../settings' ;
2525import variables from '../../../../generated/variables.pass2' ;
2626
27+ import { EventHandlingControllerBase } from '../controllers/ControllerBases' ;
28+
2729import type { $DecoratedScope } from '../decorateScope' ;
2830import type { ComicService } from '../services/comicService' ;
2931import type { EventService } from '../services/eventService' ;
3032import type { MessageReportingService } from '../services/messageReportingService' ;
3133import type { ComicData , ComicItem } from '../api/comicData' ;
3234import type { LogEntryData } from '../api/logEntryData' ;
3335
34- export class EditLogController {
36+ export class EditLogController extends EventHandlingControllerBase < EditLogController > {
3537 static $inject : string [ ] ;
3638
3739 $scope : $DecoratedScope < EditLogController > ;
@@ -48,24 +50,31 @@ export class EditLogController {
4850 $scope : $DecoratedScope < EditLogController > ,
4951 $log : $Log ,
5052 $http : $Http ,
51- messageReportingService : MessageReportingService
53+ messageReportingService : MessageReportingService ,
54+ eventService : EventService
5255 ) {
5356 $log . debug ( 'START EditLogController' ) ;
5457
55- this . $scope = $scope ;
58+ super ( $scope , eventService ) ;
59+
5660 this . $log = $log ;
5761 this . $http = $http ;
5862 this . messageReportingService = messageReportingService ;
5963
6064 this . currentPage = 1 ;
6165
6266 $ ( '#editLogDialog' ) . on ( 'show.bs.modal' , ( ) => {
67+ this . currentPage = 1 ;
6368 this . _loadLogs ( ) ;
6469 } ) ;
6570
6671 $log . debug ( 'END EditLogController' ) ;
6772 }
6873
74+ _maintenance ( ) {
75+ this . close ( ) ;
76+ }
77+
6978 async _loadLogs ( ) {
7079 this . $scope . safeApply ( ( ) => {
7180 this . isLoading = true ;
@@ -80,8 +89,7 @@ export class EditLogController {
8089 } ) ;
8190 } else {
8291 if ( response . status === 503 ) {
83- this . messageReportingService . reportError ( constants . messages . maintenance ) ;
84- this . close ( ) ;
92+ this . eventService . maintenanceEvent . publish ( ) ;
8593 } else {
8694 this . messageReportingService . reportError ( response . data ) ;
8795 }
@@ -108,7 +116,7 @@ export class EditLogController {
108116 ( $ ( '#editLogDialog' ) : any ) . modal ( 'hide' ) ;
109117 }
110118}
111- EditLogController . $inject = [ '$scope' , '$log' , '$http' , 'messageReportingService' ] ;
119+ EditLogController . $inject = [ '$scope' , '$log' , '$http' , 'messageReportingService' , 'eventService' ] ;
112120
113121export default function ( app : AngularModule ) {
114122 app . directive ( 'qcEditLog' , function ( ) {
0 commit comments