import { RgwMultisiteSyncPolicyComponent } from '../rgw-multisite-sync-policy/rgw-multisite-sync-policy.component';
import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
+import { MgrModuleInfo } from '~/app/shared/models/mgr-modules.interface';
+import { RGW } from '../utils/constants';
const BASE_URL = 'rgw/multisite/configuration';
);
// 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;
- }
- });
- }
+ if (this.permissions.configOpt.read) this.getRgwModuleStatus();
}
ngOnDestroy() {
this.sub.unsubscribe();
}
+ private getRgwModuleStatus() {
+ this.mgrModuleService.list().subscribe((moduleData: MgrModuleInfo[]) => {
+ this.rgwModuleData = moduleData.filter((module: MgrModuleInfo) => module.name === RGW);
+ if (this.rgwModuleData.length > 0) {
+ this.rgwModuleStatus = this.rgwModuleData[0].enabled;
+ }
+ });
+ }
+
private abstractTreeData(multisiteInfo: [object, object, object]): any[] {
let allNodes: object[] = [];
let rootNodes = {};
};
if (!this.rgwModuleStatus) {
- $obs = this.mgrModuleService.enable('rgw');
+ $obs = this.mgrModuleService.enable(RGW);
}
$obs.subscribe(
() => undefined,
import { NotificationService } from '../services/notification.service';
import { TableComponent } from '../datatable/table/table.component';
import { Router } from '@angular/router';
+import { MgrModuleInfo } from '../models/mgr-modules.interface';
@Injectable({
providedIn: 'root'
* Get the list of Ceph Mgr modules and their state (enabled/disabled).
* @return {Observable<Object[]>}
*/
- list(): Observable<Object[]> {
- return this.http.get<Object[]>(`${this.url}`);
+ list(): Observable<MgrModuleInfo[]> {
+ return this.http.get<MgrModuleInfo[]>(`${this.url}`);
}
/**
--- /dev/null
+export interface MgrModuleInfo {
+ name: string;
+ enabled: boolean;
+ always_on: boolean;
+ options: Record<string, MgrModuleOption>;
+}
+
+interface MgrModuleOption {
+ name: string;
+ type: string;
+ level: string;
+ flags: number;
+ default_value: number;
+ min: string;
+ max: string;
+ enum_allowed: string[];
+ desc: string;
+ long_desc: string;
+ tags: string[];
+ see_also: string[];
+}