diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/classes/table-status-view-cache.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/classes/table-status-view-cache.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/classes/table-status-view-cache.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/classes/table-status-view-cache.ts new file mode 100644 index 000000000..91c53a0aa --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/classes/table-status-view-cache.ts @@ -0,0 +1,37 @@ +import { ViewCacheStatus } from '../enum/view-cache-status.enum'; +import { TableStatus } from './table-status'; + +export class TableStatusViewCache extends TableStatus { + constructor(status: ViewCacheStatus = ViewCacheStatus.ValueOk, statusFor: string = '') { + super(); + + switch (status) { + case ViewCacheStatus.ValueOk: + this.type = 'light'; + this.msg = ''; + break; + case ViewCacheStatus.ValueNone: + this.type = 'info'; + this.msg = + (statusFor ? $localize`Retrieving data for ${statusFor}.` : $localize`Retrieving data.`) + + ' ' + + $localize`Please wait...`; + break; + case ViewCacheStatus.ValueStale: + this.type = 'warning'; + this.msg = statusFor + ? $localize`Displaying previously cached data for ${statusFor}.` + : $localize`Displaying previously cached data.`; + break; + case ViewCacheStatus.ValueException: + this.type = 'danger'; + this.msg = + (statusFor + ? $localize`Could not load data for ${statusFor}.` + : $localize`Could not load data.`) + + ' ' + + $localize`Please check the cluster health.`; + break; + } + } +} |