-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the TaskAuditLogPage component [#413]
- Loading branch information
Showing
19 changed files
with
266 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ntend/src/app/backend-status/pages/task-audit-log-page/task-audit-log-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h2>{{"task-audit-log-page.title"|translate}}</h2> | ||
<p-table [value]="entries" | ||
[rows]="rows" | ||
[paginator]="true" | ||
paginatorPosition="both"> | ||
<ng-template pTemplate="colgroup"> | ||
<col class="cx-table-column-medium"/> | ||
<col class="cx-table-column-medium"/> | ||
<col class="cx-table-column-medium"/> | ||
<col/> | ||
</ng-template> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th id="task-start-time">{{"task-audit-log-page.table.header.start-time"|translate}}</th> | ||
<th id="task-end-time">{{"task-audit-log-page.table.header.end-time"|translate}}</th> | ||
<th id="task-successful">{{"task-audit-log-page.table.header.successful"|translate}}</th> | ||
<th id="task-description">{{"task-audit-log-page.table.header.description"|translate}}</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" | ||
let-entry> | ||
<tr> | ||
<td class="cx-table-column-align-center">{{entry.startTime|date:'medium'}}</td> | ||
<td class="cx-table-column-align-center">{{entry.endTime|date:'medium'}}</td> | ||
<td class="cx-table-column-align-center">{{entry.successful}}</td> | ||
<td class="cx-no-wrap-text">{{entry.description}}</td> | ||
</tr> | ||
</ng-template> | ||
</p-table> |
Empty file.
68 changes: 68 additions & 0 deletions
68
...nd/src/app/backend-status/pages/task-audit-log-page/task-audit-log-page.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { TaskAuditLogPageComponent } from './task-audit-log-page.component'; | ||
import { TableModule } from 'primeng/table'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { LoggerModule } from '@angular-ru/logger'; | ||
import { StoreModule } from '@ngrx/store'; | ||
import { | ||
reducer, | ||
TASK_AUDIT_LOG_FEATURE_KEY | ||
} from 'app/backend-status/reducers/task-audit-log.reducer'; | ||
import { EffectsModule } from '@ngrx/effects'; | ||
import { TaskAuditLogEffects } from 'app/backend-status/effects/task-audit-log.effects'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { MessageService } from 'primeng/api'; | ||
import { LibraryModule } from 'app/library/library.module'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { BreadcrumbAdaptor } from 'app/adaptors/breadcrumb.adaptor'; | ||
|
||
describe('TaskAuditLogPageComponent', () => { | ||
let component: TaskAuditLogPageComponent; | ||
let fixture: ComponentFixture<TaskAuditLogPageComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
LibraryModule, | ||
RouterTestingModule, | ||
HttpClientTestingModule, | ||
TranslateModule.forRoot(), | ||
LoggerModule.forRoot(), | ||
StoreModule.forRoot({}), | ||
StoreModule.forFeature(TASK_AUDIT_LOG_FEATURE_KEY, reducer), | ||
EffectsModule.forRoot([]), | ||
EffectsModule.forFeature([TaskAuditLogEffects]), | ||
TableModule | ||
], | ||
declarations: [TaskAuditLogPageComponent], | ||
providers: [MessageService, BreadcrumbAdaptor] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TaskAuditLogPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
94 changes: 94 additions & 0 deletions
94
...rontend/src/app/backend-status/pages/task-audit-log-page/task-audit-log-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { Subscription } from 'rxjs'; | ||
import { TaskAuditLogEntry } from 'app/backend-status/models/task-audit-log-entry'; | ||
import { LoggerService } from '@angular-ru/logger'; | ||
import { TaskAuditLogAdaptor } from 'app/backend-status/adaptors/task-audit-log.adaptor'; | ||
import { LibraryDisplayAdaptor } from 'app/user/adaptors/library-display.adaptor'; | ||
import { BreadcrumbAdaptor } from 'app/adaptors/breadcrumb.adaptor'; | ||
import { TranslateService } from '@ngx-translate/core'; | ||
import { Title } from '@angular/platform-browser'; | ||
|
||
@Component({ | ||
selector: 'app-task-audit-log-page', | ||
templateUrl: './task-audit-log-page.component.html', | ||
styleUrls: ['./task-audit-log-page.component.scss'] | ||
}) | ||
export class TaskAuditLogPageComponent implements OnInit, OnDestroy { | ||
fetchingSubscription: Subscription; | ||
fetching = false; | ||
entriesSubscription: Subscription; | ||
entries: TaskAuditLogEntry[] = []; | ||
rowsSubscription: Subscription; | ||
rows = 0; | ||
langChangeSubscription: Subscription; | ||
|
||
constructor( | ||
private logger: LoggerService, | ||
private taskAuditLogAdaptor: TaskAuditLogAdaptor, | ||
private libraryDisplayAdaptor: LibraryDisplayAdaptor, | ||
private breadcrumbAdaptor: BreadcrumbAdaptor, | ||
private translateService: TranslateService, | ||
private titleService: Title | ||
) { | ||
this.fetchingSubscription = this.taskAuditLogAdaptor.fetchingEntries$.subscribe( | ||
fetching => { | ||
this.fetching = fetching; | ||
if (fetching === false) { | ||
this.taskAuditLogAdaptor.getEntries(); | ||
} | ||
} | ||
); | ||
this.entriesSubscription = this.taskAuditLogAdaptor.entries$.subscribe( | ||
entries => (this.entries = entries) | ||
); | ||
this.rowsSubscription = this.libraryDisplayAdaptor.rows$.subscribe( | ||
rows => (this.rows = rows) | ||
); | ||
this.langChangeSubscription = this.translateService.onLangChange.subscribe( | ||
() => { | ||
this.loadTranslations(); | ||
} | ||
); | ||
this.loadTranslations(); | ||
} | ||
|
||
ngOnInit() {} | ||
|
||
ngOnDestroy() { | ||
this.fetchingSubscription.unsubscribe(); | ||
this.entriesSubscription.unsubscribe(); | ||
this.rowsSubscription.unsubscribe(); | ||
} | ||
|
||
private loadTranslations() { | ||
this.titleService.setTitle( | ||
this.translateService.instant('task-audit-log-page.title') | ||
); | ||
this.breadcrumbAdaptor.loadEntries([ | ||
{ label: this.translateService.instant('breadcrumb.entry.admin.root') }, | ||
{ | ||
label: this.translateService.instant( | ||
'breadcrumb.entry.admin.task-audit-log' | ||
) | ||
} | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters