[pve-devel] [PATCH manager 3/3] ui: cephfs: only allow CephFS creation if MDS is configured
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Nov 26 18:22:30 CET 2018
Introduce the mdsCount again, I know remember again why I had it in
v3 of my CephFS series.. Use this to disable the CephFS create button
if we have no MDS configured, as this is a requirement.
Further change the gettext for 'No XY configure' to a format string
so that it can be reused.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
while the latter is not directly related it can be seen as 'notify
the user about no configured MDS' a bit better, so all in one patch.
www/manager6/ceph/FS.js | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/www/manager6/ceph/FS.js b/www/manager6/ceph/FS.js
index d67eec37..4e8dc9f9 100644
--- a/www/manager6/ceph/FS.js
+++ b/www/manager6/ceph/FS.js
@@ -114,7 +114,7 @@ Ext.define('PVE.NodeCephFSPanel', {
xtype: 'pveNodeCephFSPanel',
mixins: ['Proxmox.Mixin.CBind'],
- title: gettext('Cluster Administration'),
+ title: gettext('CephFS'),
onlineHelp: 'chapter_pvecm',
border: false,
@@ -125,17 +125,23 @@ Ext.define('PVE.NodeCephFSPanel', {
}
},
+ viewModel: {
+ parent: null,
+ data: {
+ cephfsConfigured: false,
+ mdsCount: 0
+ },
+ formulas: {
+ canCreateFS: function(get) {
+ return (!get('cephfsConfigured') && get('mdsCount') > 0);
+ }
+ }
+ },
+
items: [
{
xtype: 'grid',
- title: gettext('CephFS'),
- viewModel: {
- parent: null,
- data: {
- cephfsConfigured: false
- }
- },
- emptyText: gettext('No CephFS configured.'),
+ emptyText: Ext.String.format(gettext('No {0} configured.'), 'CephFS'),
controller: {
xclass: 'Ext.app.ViewController',
@@ -190,7 +196,7 @@ Ext.define('PVE.NodeCephFSPanel', {
handler: 'onCreate',
bind: {
// only one CephFS per Ceph cluster makes sense for now
- disabled: '{cephfsConfigured}'
+ disabled: '{!canCreateFS}'
}
}
],
@@ -218,6 +224,7 @@ Ext.define('PVE.NodeCephFSPanel', {
{
xtype: 'grid',
title: gettext('Metadata Servers'),
+ emptyText: Ext.String.format(gettext('No {0} configured.'), 'MDS'),
controller: {
xclass: 'Ext.app.ViewController',
@@ -238,9 +245,17 @@ Ext.define('PVE.NodeCephFSPanel', {
}
}));
Proxmox.Utils.monStoreErrors(view, view.rstore);
+ view.rstore.on('load', this.onLoad, this);
view.on('destroy', view.rstore.stopUpdate);
},
-
+ onLoad: function(store, records, success) {
+ var vm = this.getViewModel();
+ if (!success || !records) {
+ vm.set('mdsCount', 0);
+ return;
+ }
+ vm.set('mdsCount', records.length);
+ },
onCreateMDS: function() {
var view = this.getView();
view.rstore.stopUpdate();
--
2.19.1
More information about the pve-devel
mailing list