From a9d47b2bb3502beeb5b63ecb9a855e3452a2c57d Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 26 Nov 2018 16:56:27 +0100 Subject: [PATCH] ui: cephfs: only allow CephFS creation if MDS is configured 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 Reviewed-by: Dominik Csapak Tested-by: Dominik Csapak --- 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();