mirror of
https://github.com/goharbor/harbor
synced 2025-04-21 17:14:12 +00:00
Correct total count for schedule list datagrid (#18148)
1.Fixes #18120 Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
parent
8b203ef01c
commit
fdf93470c5
@ -45,7 +45,7 @@
|
||||
{{ pagination.lastItem + 1 }}
|
||||
{{ 'GROUP.OF' | translate }}
|
||||
</span>
|
||||
{{ total }} {{ 'GROUP.ITEMS' | translate }}
|
||||
<span id="total">{{ total }}</span> {{ 'GROUP.ITEMS' | translate }}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
|
@ -5,6 +5,7 @@ import { of } from 'rxjs';
|
||||
import { SharedTestingModule } from '../../../../shared/shared.module';
|
||||
import { JobServiceDashboardSharedDataService } from '../job-service-dashboard-shared-data.service';
|
||||
import { ScheduleListResponse } from '../job-service-dashboard.interface';
|
||||
import { delay } from 'rxjs/operators';
|
||||
|
||||
describe('ScheduleListComponent', () => {
|
||||
let component: ScheduleListComponent;
|
||||
@ -18,12 +19,13 @@ describe('ScheduleListComponent', () => {
|
||||
const fakedJobServiceDashboardSharedDataService = {
|
||||
_scheduleListResponse: {
|
||||
scheduleList: mockedSchedules,
|
||||
total: mockedSchedules.length,
|
||||
},
|
||||
getScheduleListResponse(): ScheduleListResponse {
|
||||
return this._scheduleListResponse;
|
||||
},
|
||||
retrieveScheduleListResponse() {
|
||||
return of({});
|
||||
return of(this._scheduleListResponse).pipe(delay(0));
|
||||
},
|
||||
};
|
||||
|
||||
@ -41,7 +43,6 @@ describe('ScheduleListComponent', () => {
|
||||
|
||||
fixture = TestBed.createComponent(ScheduleListComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.loadingSchedules = false;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@ -56,4 +57,13 @@ describe('ScheduleListComponent', () => {
|
||||
const rows = fixture.nativeElement.querySelectorAll('clr-dg-row');
|
||||
expect(rows.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should show the right total count', async () => {
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
const span: HTMLSpanElement =
|
||||
fixture.nativeElement.querySelector('#total');
|
||||
expect(span.innerText).toEqual('2');
|
||||
});
|
||||
});
|
||||
|
@ -55,6 +55,7 @@ export class ScheduleListComponent {
|
||||
.pipe(finalize(() => (this.loadingSchedules = false)))
|
||||
.subscribe({
|
||||
next: res => {
|
||||
this.total = res.total;
|
||||
doSorting(res.scheduleList, state);
|
||||
},
|
||||
error: err => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user