import { RgwUserService } from '~/app/shared/api/rgw-user.service';
import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { TableStatus } from '~/app/shared/classes/table-status';
import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
import { TableComponent } from '~/app/shared/datatable/table/table.component';
columns: CdTableColumn[] = [];
users: object[] = [];
selection: CdTableSelection = new CdTableSelection();
- tableStatus = new TableStatus();
staleTimeout: number;
constructor(
private modalService: ModalService,
private urlBuilder: URLBuilderService,
public actionLabels: ActionLabelsI18n,
- private ngZone: NgZone
+ protected ngZone: NgZone
) {
- super();
+ super(ngZone);
}
ngOnInit() {
canBePrimary: (selection: CdTableSelection) => selection.hasMultiSelection
};
this.tableActions = [addAction, editAction, deleteAction];
- this.timeConditionReached();
- }
-
- timeConditionReached() {
- clearTimeout(this.staleTimeout);
- this.ngZone.runOutsideAngular(() => {
- this.staleTimeout = window.setTimeout(() => {
- this.ngZone.run(() => {
- this.tableStatus = new TableStatus(
- 'warning',
- $localize`The user list data might be stale. If needed, you can manually reload it.`
- );
- });
- }, 10000);
- });
+ this.setTableRefreshTimeout();
}
getUserList(context: CdTableFetchDataContext) {
- this.tableStatus = new TableStatus();
- this.timeConditionReached();
+ this.setTableRefreshTimeout();
this.rgwUserService.list().subscribe(
(resp: object[]) => {
this.users = resp;