[pve-devel] [PATCH manager 1/2] ui: ceph: differentiate between install & configure only

Tim Marx t.marx at proxmox.com
Fri Mar 29 12:42:43 CET 2019


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
 www/manager6/Utils.js                  |  2 ++
 www/manager6/ceph/CephInstallWizard.js | 12 +++++++++---
 www/manager6/window/CephInstall.js     | 28 +++++++++++++++++++++++-----
 3 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index d8e6f275..ffa6970a 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1138,9 +1138,11 @@ Ext.define('PVE.Utils', { utilities: {
 	    if (Proxmox.UserName === 'root at pam') {
 		container.el.mask();
 		if (!container.down('pveCephInstallWindow')){
+		    var isInstalled = msg.match(/not initialized/i) ? true : false;
 		    var win = Ext.create('PVE.ceph.Install', {
 			nodename: nodename
 		    });
+		    win.getViewModel().set('isInstalled', isInstalled);
 		    container.add(win);
 		    win.show();
 		    callback(win);
diff --git a/www/manager6/ceph/CephInstallWizard.js b/www/manager6/ceph/CephInstallWizard.js
index 968b1294..a9ab0c24 100644
--- a/www/manager6/ceph/CephInstallWizard.js
+++ b/www/manager6/ceph/CephInstallWizard.js
@@ -8,13 +8,14 @@ Ext.define('PVE.ceph.CephInstallWizard', {
 	viewModel: {
 	    data: {
 		nodename: '',
-		configuration: true
+		configuration: true,
+		isInstalled: false
 	    }
 	},
 	cbindData: {
 	    nodename: undefined
 	},
-	title: gettext('Installation'),
+	title: gettext('Setup'),
 	navigateNext: function() {
 	    var tp = this.down('#wizcontent');
 	    var atab = tp.getActiveTab();
@@ -63,10 +64,15 @@ Ext.define('PVE.ceph.CephInstallWizard', {
 		cbind:{
 		    nodename: '{nodename}'
 		},
+		viewModel: {}, // needed to inherit parent viewModel data
 		listeners: {
 		    afterrender: function() {
 			var me = this;
-			me.down('pveNoVncConsole').fireEvent('activate');
+			if (this.getViewModel().get('isInstalled')) {
+			    this.mask("Ceph is already installed, click next to create your configuration.",['pve-static-mask']);
+			} else {
+			    me.down('pveNoVncConsole').fireEvent('activate');
+			}
 		    },
 		    activate: function() {
 			var me = this;
diff --git a/www/manager6/window/CephInstall.js b/www/manager6/window/CephInstall.js
index cd38dd0b..bb5046a6 100644
--- a/www/manager6/window/CephInstall.js
+++ b/www/manager6/window/CephInstall.js
@@ -22,20 +22,36 @@ Ext.define('PVE.ceph.Install', {
 	type: 'vbox'
     },
     viewModel: {
-	parent: null,
 	data: {
-	      cephVersion: 'luminous'
+	      cephVersion: 'luminous',
+	      isInstalled: false
 	},
 	formulas: {
 	    buttonText: function (get){
-		return gettext('Install Ceph-') + get('cephVersion');
+		if (get('isInstalled')) {
+		    return gettext('Configure Ceph');
+		} else {
+		    return gettext('Install Ceph-') + get('cephVersion');
+		}
+	    },
+	    windowText: function (get) {
+		if (get('isInstalled')) {
+		    return '<p class="install-mask">' + 
+		    Ext.String.format(gettext('{0} is not initialized.'), 'Ceph') + ' '+
+		    gettext('You need to create a initial config once.') + '</p>';
+		} else {
+		    return '<p class="install-mask">' + 
+		    Ext.String.format(gettext('{0} is not installed on this node.'), 'Ceph') + '<br>' +
+		    gettext('Would you like to install it now?') + '</p>';
+		}
 	    }
 	}
     },
     items: [
 	{
-	    html: '<p class="install-mask">' + Ext.String.format(gettext('{0} is not installed on this node.'), 'Ceph') + '<br>' +
-	    gettext('Would you like to install it now?') + '</p>',
+	    bind: {
+		html: '{windowText}'
+	    },
 	    border: false,
 	    padding: 5,
 	    bodyCls: 'install-mask'
@@ -46,6 +62,7 @@ Ext.define('PVE.ceph.Install', {
 	    bind: {
 		text: '{buttonText}'
 	    },
+	    viewModel: {},
 	    cbind: {
 		nodename: '{nodename}'
 	    },
@@ -54,6 +71,7 @@ Ext.define('PVE.ceph.Install', {
 		var win = Ext.create('PVE.ceph.CephInstallWizard',{
 		    nodename: me.nodename
 		});
+		win.getViewModel().set('isInstalled', this.getViewModel().get('isInstalled'));
 		win.show();
 		me.mon(win,'beforeClose', function(){
 		    me.fireEvent("cephInstallWindowClosed");
-- 
2.11.0




More information about the pve-devel mailing list