From f992ef807e78ed979c055b7fbe4d54f06d4a1b6d Mon Sep 17 00:00:00 2001 From: Tim Marx Date: Fri, 29 Mar 2019 12:42:43 +0100 Subject: [PATCH] ui: ceph: differentiate between install & configure only Signed-off-by: Tim Marx --- 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@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 '

' + + Ext.String.format(gettext('{0} is not initialized.'), 'Ceph') + ' '+ + gettext('You need to create a initial config once.') + '

'; + } else { + return '

' + + Ext.String.format(gettext('{0} is not installed on this node.'), 'Ceph') + '
' + + gettext('Would you like to install it now?') + '

'; + } } } }, items: [ { - html: '

' + Ext.String.format(gettext('{0} is not installed on this node.'), 'Ceph') + '
' + - gettext('Would you like to install it now?') + '

', + 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");