Skip to content
Prev Previous commit
refactor: TT-304 Handle message: New approach for the ticket
  • Loading branch information
Edgar Guaman committed Aug 21, 2021
commit 9bff77928f7f65be6c8fcf6d650276ec99017054
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
<th class="col"></th>
</tr>
</thead>
<tr *ngIf="checkIfDataSourceIsLoadingorEmpty(dataSource)">
<tr *ngIf="dataSource.isLoading">
<td class="text-center" colspan="7">{{NO_DATA_MESSAGE}}</td>
</tr>
<app-loading-bar *ngIf="dataSource.isLoading"></app-loading-bar>
<tbody *ngIf="!dataSource.isLoading">
<tr *ngIf="!checkIfDataSourceIsLoadingorEmpty(dataSource)">
<tr *ngIf="!dataSource?.data.length">
<td class="text-center" colspan="7">{{NO_DATA_MESSAGE}}</td>
</tr>
<tr class="d-flex" *ngFor="let entry of dataSource.data">
Expand Down
10 changes: 0 additions & 10 deletions src/app/modules/time-entries/pages/time-entries.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,14 +668,4 @@ describe('TimeEntriesComponent', () => {

expect(HTMLTimeEntriesView).not.toBeNull();
});

it('checkIfDataSourceIsLoadingorEmpty should be true when dataSource is Loading and data is not empty', () => {
state.timeEntriesDataSource.isLoading = true;
state.timeEntriesDataSource.data = [];
expect(component.checkIfDataSourceIsLoadingorEmpty(state.timeEntriesDataSource)).toBeTrue();
});

it('checkIfDataSourceIsLoadingorEmpty should be false when just dataSource.data.length is empty', () => {
expect(component.checkIfDataSourceIsLoadingorEmpty(state.timeEntriesDataSource)).toBeFalse();
});
});
7 changes: 0 additions & 7 deletions src/app/modules/time-entries/pages/time-entries.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,4 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
});
}
}

checkIfDataSourceIsLoadingorEmpty(source?: DataSource<Entry>): boolean {
if (source.isLoading && source.data.length === 0) {
return true;
}
return false;
}
}