[pve-devel] [PATCH v3 manager 3/3] added basic ability to install ceph via gui

Tim Marx t.marx at proxmox.com
Tue Jan 22 12:22:01 CET 2019


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
changed since v2:
* whitespace fix

 www/manager6/Makefile              |  1 +
 www/manager6/ceph/Status.js        | 19 ++++++++++++++++-
 www/manager6/window/CephInstall.js | 42 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 www/manager6/window/CephInstall.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e75f0de6..c4dcb786 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -83,6 +83,7 @@ JSSRC= 				                 	\
 	window/BackupConfig.js				\
 	window/Settings.js				\
 	window/StartupEdit.js				\
+	window/CephInstall.js				\
 	panel/NotesView.js				\
 	grid/ResourceGrid.js				\
 	grid/PoolMembers.js				\
diff --git a/www/manager6/ceph/Status.js b/www/manager6/ceph/Status.js
index 78fa1cf8..45702c20 100644
--- a/www/manager6/ceph/Status.js
+++ b/www/manager6/ceph/Status.js
@@ -308,7 +308,24 @@ Ext.define('PVE.node.CephStatus', {
 	me.version = me.sp.get('ceph-version');
 	me.change_version(me.version);
 
-	Proxmox.Utils.monStoreErrors(me,me.store);
+	me.mon(me.store.proxy, 'exception', function (proxy, response) {
+
+	    if (response.statusText.match(/not installed/i)) {
+		if (Proxmox.UserName === 'root at pam') {
+		    me.store.stopUpdate();
+		    me.el.mask(gettext("Ceph not installed"), ['pve-static-mask']);
+
+		    var win = Ext.create('PVE.ceph.Install', {
+			nodename: nodename
+		    });
+		    win.show();
+		} else {
+		    me.store.stopUpdate();
+		    me.el.mask(gettext("Ceph not installed. Log in as root to install."), ['pve-static-mask']);
+		}
+	    }
+	});
+
 	me.mon(me.store, 'load', me.updateAll, me);
 	me.on('destroy', me.store.stopUpdate);
 	me.store.startUpdate();
diff --git a/www/manager6/window/CephInstall.js b/www/manager6/window/CephInstall.js
new file mode 100644
index 00000000..9152c44f
--- /dev/null
+++ b/www/manager6/window/CephInstall.js
@@ -0,0 +1,42 @@
+Ext.define('PVE.ceph.Install', {
+    extend: 'Ext.window.Window',
+
+    width: 300,
+    title: gettext('Install Ceph'),
+
+    nodename: undefined,
+    cephVersion: 'luminous',
+
+    initComponent: function () {
+	var me = this;
+	if (!me.nodename) {
+	    throw "no node name specified";
+	}
+
+	me.items = [
+	    {
+		html: '<p>' + gettext('Ceph is not installed on this node. ') +
+		gettext('Would you like to install it now?')+'</p>',
+		border: false,
+		padding: 5
+	    }
+	];
+
+	me.buttons = [
+	    {
+		xtype: 'pveConsoleButton',
+		disabled: Proxmox.UserName !== 'root at pam',
+		text: gettext('Install Ceph-') + me.cephVersion,
+		consoleType: 'cmd',
+		cmd: "ceph_install",
+		nodename: me.nodename
+	    }
+	];
+
+	Ext.applyIf(me, {
+		modal: true,
+		border: false
+	});
+	me.callParent();
+    }
+});
-- 
2.11.0




More information about the pve-devel mailing list