from .. import mgr
from ..security import Scope
from ..services.ceph_service import CephService
+from ..exceptions import DashboardException
@ApiController('/cluster_conf', Scope.CONFIG_OPT)
return options
def list(self):
- options = mgr.get("config_options")['options']
+ options = mgr.get('config_options')['options']
return self._append_config_option_values(options)
def get(self, name):
- for option in mgr.get('config_options')['options']:
- if option['name'] == name:
- return self._append_config_option_values([option])[0]
-
- raise cherrypy.HTTPError(404)
+ return self._get_config_option(name)
def create(self, name, value):
+ # Check if config option is updateable at runtime
+ config_option = self._get_config_option(name)
+ if not config_option['can_update_at_runtime']:
+ raise DashboardException(
+ msg='Config option {} is not updatable at runtime'.format(name),
+ code='config_option_not_updatable_at_runtime',
+ component='cluster_configuration')
+
+ # Update config option
availSections = ['global', 'mon', 'mgr', 'osd', 'mds', 'client']
for section in availSections:
for name, value in options.items():
CephService.send_command('mon', 'config set', who=value['section'],
name=name, value=str(value['value']))
+
+ def _get_config_option(self, name):
+ for option in mgr.get('config_options')['options']:
+ if option['name'] == name:
+ return self._append_config_option_values([option])[0]
+
+ raise cherrypy.HTTPError(404)
</tr>
<tr>
<td i18n
- class="bold col-sm-1">Can be updated at runtime</td>
+ class="bold col-sm-1">Can be updated at runtime (editable)</td>
<td class="col-sm-3">{{ selectedItem.can_update_at_runtime }}</td>
</tr>
<tr>
import { I18n } from '@ngx-translate/i18n-polyfill';
import { ConfigurationService } from '../../../shared/api/configuration.service';
+import { CellTemplate } from '../../../shared/enum/cell-template.enum';
import { CdTableAction } from '../../../shared/models/cd-table-action';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
permission: 'update',
icon: 'fa-pencil',
routerLink: () => `/configuration/edit/${getConfigOptUri()}`,
- name: this.i18n('Edit')
+ name: this.i18n('Edit'),
+ disable: () => !this.isEditable(this.selection)
};
this.tableActions = [editAction];
}
cellClass: 'wrap',
cellTemplate: this.confValTpl
},
- { prop: 'default', name: this.i18n('Default'), cellClass: 'wrap' }
+ { prop: 'default', name: this.i18n('Default'), cellClass: 'wrap' },
+ {
+ prop: 'can_update_at_runtime',
+ name: this.i18n('Editable'),
+ cellTransformation: CellTemplate.checkIcon,
+ flexGrow: 0.4,
+ cellClass: 'text-center'
+ }
];
}
});
this.data = [...this.data];
}
+
+ isEditable(selection: CdTableSelection): boolean {
+ if (selection.selected.length !== 1) {
+ return false;
+ }
+
+ return selection.selected[0].can_update_at_runtime;
+ }
}
<context context-type="sourcefile">app/ceph/cluster/configuration/configuration-details/configuration-details.component.html</context>
<context context-type="linenumber">82</context>
</context-group>
- </trans-unit><trans-unit id="4180e8c1a344da14bdef061df596a4457bbb8d6c" datatype="html">
- <source>Can be updated at runtime</source>
+ </trans-unit><trans-unit id="39f2fb094e9b2eda13163fa3f3a31594cf9c1307" datatype="html">
+ <source>Can be updated at runtime (editable)</source>
<context-group purpose="location">
<context context-type="sourcefile">app/ceph/cluster/configuration/configuration-details/configuration-details.component.html</context>
<context context-type="linenumber">87</context>
<context context-type="linenumber">1</context>
</context-group>
</trans-unit>
+ <trans-unit id="4a01c175f90dd92b432f4a4a199d2c7bb9d997ff" datatype="html">
+ <source>Editable</source>
+ <context-group purpose="location">
+ <context context-type="sourcefile">src/app/ceph/cluster/configuration/configuration.component.ts</context>
+ <context context-type="linenumber">1</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="7099a8878af7a0a26fe5663c4f46cfe87142b75d" datatype="html">
<source>Public Address</source>
<context-group purpose="location">