mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
Merge pull request #34142 from rhcs-dashboard/wip-44667-fix-reload-issues
Reviewed-by: Tiago Melo <tmelo@suse.com> Reviewed-by: Volker Theile <vtheile@suse.com>
This commit is contained in:
commit
88cb9f7adc
@ -1,3 +1,7 @@
|
||||
<cd-alert-panel *ngIf="isStale"
|
||||
type="warning"
|
||||
size="slim"
|
||||
i18n>The bucket list data might be stale. If needed, you can manually reload it.</cd-alert-panel>
|
||||
<cd-table #table
|
||||
[autoReload]="false"
|
||||
[data]="buckets"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { Component, NgZone, ViewChild } from '@angular/core';
|
||||
|
||||
import { I18n } from '@ngx-translate/i18n-polyfill';
|
||||
import { BsModalService } from 'ngx-bootstrap/modal';
|
||||
@ -35,6 +35,8 @@ export class RgwBucketListComponent extends ListWithDetails {
|
||||
columns: CdTableColumn[] = [];
|
||||
buckets: object[] = [];
|
||||
selection: CdTableSelection = new CdTableSelection();
|
||||
isStale = false;
|
||||
staleTimeout: number;
|
||||
|
||||
constructor(
|
||||
private authStorageService: AuthStorageService,
|
||||
@ -42,7 +44,8 @@ export class RgwBucketListComponent extends ListWithDetails {
|
||||
private bsModalService: BsModalService,
|
||||
private i18n: I18n,
|
||||
private urlBuilder: URLBuilderService,
|
||||
public actionLabels: ActionLabelsI18n
|
||||
public actionLabels: ActionLabelsI18n,
|
||||
private ngZone: NgZone
|
||||
) {
|
||||
super();
|
||||
this.permission = this.authStorageService.getPermissions().rgw;
|
||||
@ -82,9 +85,23 @@ export class RgwBucketListComponent extends ListWithDetails {
|
||||
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.isStale = true;
|
||||
});
|
||||
}, 10000);
|
||||
});
|
||||
}
|
||||
|
||||
getBucketList(context: CdTableFetchDataContext) {
|
||||
this.isStale = false;
|
||||
this.timeConditionReached();
|
||||
this.rgwBucketService.list().subscribe(
|
||||
(resp: object[]) => {
|
||||
this.buckets = resp;
|
||||
|
@ -1,3 +1,7 @@
|
||||
<cd-alert-panel *ngIf="isStale"
|
||||
type="warning"
|
||||
size="slim"
|
||||
i18n>The user list data might be stale. If needed, you can manually reload it.</cd-alert-panel>
|
||||
<cd-table #table
|
||||
[autoReload]="false"
|
||||
[data]="users"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { Component, NgZone, ViewChild } from '@angular/core';
|
||||
|
||||
import { I18n } from '@ngx-translate/i18n-polyfill';
|
||||
import { BsModalService } from 'ngx-bootstrap/modal';
|
||||
@ -30,12 +30,13 @@ const BASE_URL = 'rgw/user';
|
||||
export class RgwUserListComponent extends ListWithDetails {
|
||||
@ViewChild(TableComponent, { static: true })
|
||||
table: TableComponent;
|
||||
|
||||
permission: Permission;
|
||||
tableActions: CdTableAction[];
|
||||
columns: CdTableColumn[] = [];
|
||||
users: object[] = [];
|
||||
selection: CdTableSelection = new CdTableSelection();
|
||||
isStale = false;
|
||||
staleTimeout: number;
|
||||
|
||||
constructor(
|
||||
private authStorageService: AuthStorageService,
|
||||
@ -43,7 +44,8 @@ export class RgwUserListComponent extends ListWithDetails {
|
||||
private bsModalService: BsModalService,
|
||||
private i18n: I18n,
|
||||
private urlBuilder: URLBuilderService,
|
||||
public actionLabels: ActionLabelsI18n
|
||||
public actionLabels: ActionLabelsI18n,
|
||||
private ngZone: NgZone
|
||||
) {
|
||||
super();
|
||||
this.permission = this.authStorageService.getPermissions().rgw;
|
||||
@ -105,9 +107,23 @@ export class RgwUserListComponent extends ListWithDetails {
|
||||
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.isStale = true;
|
||||
});
|
||||
}, 10000);
|
||||
});
|
||||
}
|
||||
|
||||
getUserList(context: CdTableFetchDataContext) {
|
||||
this.isStale = false;
|
||||
this.timeConditionReached();
|
||||
this.rgwUserService.list().subscribe(
|
||||
(resp: object[]) => {
|
||||
this.users = resp;
|
||||
|
Loading…
Reference in New Issue
Block a user