Merge pull request #2871 from pengpengshui/master

fix #2839 about project log has no logs
This commit is contained in:
Steven Zou 2017-07-26 12:55:26 +08:00 committed by GitHub
commit 7a0fe1034a
3 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,7 @@ export const LOG_TEMPLATE: string = `
</clr-dg-row>
<clr-dg-footer>
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
of {{pagination.totalItems}} {{'AUDIT_LOG.ITEMS' | translate}}
{{'AUDIT_LOG.OF' | translate}} {{pagination.totalItems}} {{'AUDIT_LOG.ITEMS' | translate}}
<clr-dg-pagination #pagination [(clrDgPage)]="currentPage" [clrDgPageSize]="pageSize" [clrDgTotalItems]="totalCount"></clr-dg-pagination>
</clr-dg-footer>
</clr-datagrid>

View File

@ -58,7 +58,7 @@
<clr-dg-footer>
<span *ngIf="pagination.totalItems">{{pagination.firstItem + 1}} - {{pagination.lastItem +1 }} {{'AUDIT_LOG.OF' | translate}} </span>
{{pagination.totalItems }} {{'AUDIT_LOG.ITEMS' | translate}}
<clr-dg-pagination #pagination [clrDgPageSize]="15"></clr-dg-pagination>
<clr-dg-pagination #pagination [clrDgPageSize]="15" [(clrDgPage)]="currentPage" [clrDgTotalItems]="totalRecordCount"></clr-dg-pagination>
<!--{{totalRecordCount}} {{'AUDIT_LOG.ITEMS' | translate}}
<clr-dg-pagination [clrDgPageSize]="pageOffset" [clrDgTotalItems]="totalPage"></clr-dg-pagination>-->
</clr-dg-footer>

View File

@ -69,6 +69,7 @@ export class AuditLogComponent implements OnInit {
pageOffset: number = 1;
pageSize: number = 15;
totalRecordCount: number;
currentPage: number;
totalPage: number;
@ViewChild('fromTime') fromTimeInput: NgModel;
@ -96,14 +97,14 @@ export class AuditLogComponent implements OnInit {
retrieve(state?: State): void {
if(state) {
this.queryParam.page = state.page.to + 1;
this.queryParam.page = Math.ceil((state.page.to + 1) / this.pageSize);
this.currentPage = this.queryParam.page;
}
this.auditLogService
.listAuditLogs(this.queryParam)
.subscribe(
response=>{
this.totalRecordCount = response.headers.get('x-total-count');
this.totalPage = Math.ceil(this.totalRecordCount / this.pageSize);
this.totalRecordCount =parseInt(response.headers.get('x-total-count'));
this.auditLogs = response.json();
},
error=>{