@Input()
data: any;
@Input()
- highThreshold: number;
+ highThreshold = 0;
@Input()
- lowThreshold: number;
+ lowThreshold = 0;
color: string;
const percentAvailable = this.calcPercentage(max - current, max);
const percentUsed = this.calcPercentage(current, max);
- if (fullRatioPercent >= 0 && percentUsed >= fullRatioPercent) {
+ if (fullRatioPercent > 0 && percentUsed >= fullRatioPercent) {
this.color = 'chart-color-red';
- } else if (nearFullRatioPercent >= 0 && percentUsed >= nearFullRatioPercent) {
+ } else if (nearFullRatioPercent > 0 && percentUsed >= nearFullRatioPercent) {
this.color = 'chart-color-yellow';
} else {
this.color = 'chart-color-blue';
}
- if (fullRatioPercent >= 0 && nearFullRatioPercent >= 0) {
+ if (fullRatioPercent > 0 && nearFullRatioPercent > 0) {
chart.dataset[0].data = [
Math.round(nearFullRatioPercent),
Math.round(Math.abs(nearFullRatioPercent - fullRatioPercent)),
[fullHeight]="true"
aria-label="Capacity card">
<ng-container class="ms-4 me-4"
- *ngIf="capacity && osdSettings">
+ *ngIf="capacity">
<cd-dashboard-pie [data]="{max: capacity.total_bytes, current: capacity.total_used_raw_bytes}"
[lowThreshold]="osdSettings.nearfull_ratio"
[highThreshold]="osdSettings.full_ratio">
import { AlertClass } from '~/app/shared/enum/health-icon.enum';
import { HardwareService } from '~/app/shared/api/hardware.service';
import { SettingsService } from '~/app/shared/api/settings.service';
+import { OsdSettings } from '~/app/shared/models/osd-settings';
@Component({
selector: 'cd-dashboard-v3',
export class DashboardV3Component extends PrometheusListHelper implements OnInit, OnDestroy {
detailsCardData: DashboardDetails = {};
osdSettingsService: any;
- osdSettings: any;
+ osdSettings = new OsdSettings();
interval = new Subscription();
permissions: Permissions;
enabledFeature$: FeatureTogglesMap$;
}
this.interval = this.refreshIntervalService.intervalData$.subscribe(() => {
this.getHealth();
- this.getCapacityCardData();
+ this.getCapacity();
+ if (this.permissions.configOpt.read) this.getOsdSettings();
if (this.hardwareEnabled) this.hardwareSubject.next([]);
});
this.getPrometheusData(this.prometheusService.lastHourDateObject);
);
}
- getCapacityCardData() {
+ private getCapacity() {
+ this.capacityService = this.healthService.getClusterCapacity().subscribe((data: any) => {
+ this.capacity = data;
+ });
+ }
+
+ private getOsdSettings() {
this.osdSettingsService = this.osdService
.getOsdSettings()
.pipe(take(1))
- .subscribe((data: any) => {
+ .subscribe((data: OsdSettings) => {
this.osdSettings = data;
});
- this.capacityService = this.healthService.getClusterCapacity().subscribe((data: any) => {
- this.capacity = data;
- });
}
public getPrometheusData(selectedTime: any) {
<cd-rgw-multisite-tabs></cd-rgw-multisite-tabs>
<div>
- <cd-alert-panel *ngIf="!rgwModuleStatus"
+ <!-- Show the alert only when the user has the permission to configure -->
+ <cd-alert-panel *ngIf="permissions.configOpt.create && !rgwModuleStatus"
type="info"
spacingClass="mb-3"
class="d-flex align-items-center"
Cluster->Services</a>
</cd-alert-panel>
<cd-table-actions class="btn-group mb-4 me-2"
- [permission]="permission"
+ [permission]="permissions.rgw"
[selection]="selection"
[tableActions]="multisiteReplicationActions">
</cd-table-actions>
<cd-table-actions *ngIf="showMigrateAndReplicationActions"
class="btn-group mb-4 me-2 secondary"
- [permission]="permission"
+ [permission]="permissions.rgw"
[btnColor]="'light'"
[selection]="selection"
[tableActions]="migrateTableAction">
</cd-table-actions>
<cd-table-actions *ngIf="!showMigrateAndReplicationActions"
class="btn-group mb-4 me-2"
- [permission]="permission"
+ [permission]="permissions.rgw"
[selection]="selection"
[tableActions]="createTableActions"
[primaryDropDown]="true">
</cd-table-actions>
<cd-table-actions class="btn-group mb-4 me-2"
- [permission]="permission"
+ [permission]="permissions.rgw"
[btnColor]="'light'"
[selection]="selection"
[tableActions]="importAction">
</cd-table-actions>
<cd-table-actions class="btn-group mb-4 me-2"
- [permission]="permission"
+ [permission]="permissions.rgw"
[btnColor]="'light'"
[selection]="selection"
[tableActions]="exportAction">
import { NotificationType } from '~/app/shared/enum/notification-type.enum';
import { CdTableAction } from '~/app/shared/models/cd-table-action';
import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
-import { Permission } from '~/app/shared/models/permissions';
+import { Permissions } from '~/app/shared/models/permissions';
import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
import { ModalService } from '~/app/shared/services/modal.service';
import { NotificationService } from '~/app/shared/services/notification.service';
blockUI: NgBlockUI;
icons = Icons;
- permission: Permission;
+ permissions: Permissions;
selection = new CdTableSelection();
createTableActions: CdTableAction[];
migrateTableAction: CdTableAction[];
private rgwMultisiteService: RgwMultisiteService,
private changeDetectionRef: ChangeDetectorRef
) {
- this.permission = this.authStorageService.getPermissions().rgw;
+ this.permissions = this.authStorageService.getPermissions();
}
openModal(entity: any | string, edit = false) {
},
(_error) => {}
);
- this.mgrModuleService.list().subscribe((moduleData: any) => {
- this.rgwModuleData = moduleData.filter((module: object) => module['name'] === 'rgw');
- if (this.rgwModuleData.length > 0) {
- this.rgwModuleStatus = this.rgwModuleData[0].enabled;
- }
- });
+
+ // Only get the module status if you can read from configOpt
+ if (this.permissions.configOpt.read) {
+ this.mgrModuleService.list().subscribe((moduleData: any) => {
+ this.rgwModuleData = moduleData.filter((module: object) => module['name'] === 'rgw');
+ if (this.rgwModuleData.length > 0) {
+ this.rgwModuleStatus = this.rgwModuleData[0].enabled;
+ }
+ });
+ }
}
- /* setConfigValues() {
- this.rgwDaemonService
- .setMultisiteConfig(
- this.defaultsInfo['defaultRealmName'],
- this.defaultsInfo['defaultZonegroupName'],
- this.defaultsInfo['defaultZoneName']
- )
- .subscribe(() => {});
- }*/
ngOnDestroy() {
this.sub.unsubscribe();
<cds-overflow-menu [customTrigger]="customTrigger"
[flip]="true">
- <li class="cds--overflow-menu-options__option mb-2"
- *ngIf="userPermission.read">
+ <li class="cds--overflow-menu-options__option mb-2">
<button routerLink="/user-management"
class="cds--overflow-menu-options__btn"
i18n>User management</button>
<div class="cds--btn cds--btn--icon-only cds--header__action">
<cd-dashboard-help></cd-dashboard-help>
</div>
- <div class="cds--btn cds--btn--icon-only cds--header__action">
+ <div class="cds--btn cds--btn--icon-only cds--header__action"
+ *ngIf="permissions.user.read">
<cd-administration></cd-administration>
</div>
<div class="cds--btn cds--btn--icon-only cds--header__action">
</cds-sidenav-item>
<!-- Multi-cluster Dashboard -->
<cds-sidenav-menu title="Multi-Cluster"
+ *ngIf="permissions.configOpt.read"
i18n-title>
<svg cdsIcon="edge-cluster"
icon
Scope.RBD_MIRRORING: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.GRAFANA: [_P.READ],
Scope.NVME_OF: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
+ Scope.PROMETHEUS: [_P.READ]
})
'rgw-manager', 'allows full permissions for the rgw scope', {
Scope.RGW: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.GRAFANA: [_P.READ],
+ Scope.PROMETHEUS: [_P.READ]
})
'pool-manager', 'allows full permissions for the pool scope', {
Scope.POOL: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.GRAFANA: [_P.READ],
+ Scope.PROMETHEUS: [_P.READ]
})
# CephFS manager role provides all permissions for CephFS related scopes
'cephfs-manager', 'allows full permissions for the cephfs scope', {
Scope.CEPHFS: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.GRAFANA: [_P.READ],
+ Scope.PROMETHEUS: [_P.READ]
})
GANESHA_MGR_ROLE = Role(
Scope.CEPHFS: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.RGW: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.GRAFANA: [_P.READ],
- Scope.SMB: [_P.READ]
+ Scope.SMB: [_P.READ],
+ Scope.PROMETHEUS: [_P.READ]
})
SMB_MGR_ROLE = Role(
Scope.CEPHFS: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.RGW: [_P.READ, _P.CREATE, _P.UPDATE, _P.DELETE],
Scope.GRAFANA: [_P.READ],
- Scope.NFS_GANESHA: [_P.READ]
+ Scope.NFS_GANESHA: [_P.READ],
+ Scope.PROMETHEUS: [_P.READ]
})