[pve-devel] [PATCH manager 3/5] move cephdisk selector and create osd into osd panel

Dominik Csapak d.csapak at proxmox.com
Tue Aug 23 14:49:15 CEST 2016


this patch moves the create osd button into the osd panel
and puts the ceph diskselector into ceph/OSD.js

also remove the vdev parameter there, because on the osd panel
we cannot preselect a disk

this patch makes it possible to remove the ceph disk panel alltogether

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/ceph/OSD.js | 90 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 2 deletions(-)

diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index 41c90b2..e2ea36d 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -1,3 +1,78 @@
+Ext.define('PVE.form.CephDiskSelector', {
+    extend: 'PVE.form.ComboGrid',
+    alias: ['widget.pveCephDiskSelector'],
+
+    diskType: 'journal_disks',
+
+    valueField: 'dev',
+    displayField: 'dev',
+    emptyText: gettext('No Disks unused'),
+    listConfig: {
+	columns: [
+	    {
+		header: gettext('Device'),
+		width: 80,
+		sortable: true,
+		dataIndex: 'dev'
+	    },
+	    {
+		header: gettext('Size'),
+		width: 60,
+		sortable: false,
+		renderer: PVE.Utils.format_size,
+		dataIndex: 'size'
+	    },
+	    {
+		header: gettext('Serial'),
+		flex: 1,
+		sortable: true,
+		dataIndex: 'serial'
+	    }
+	]
+    },
+    initComponent: function() {
+	var me = this;
+
+	var nodename = me.nodename;
+	if (!nodename) {
+	    throw "no node name specified";
+	}
+
+	var store = Ext.create('Ext.data.Store', {
+	    filterOnLoad: true,
+	    model: 'ceph-disk-list',
+	    proxy: {
+                type: 'pve',
+                url: "/api2/json/nodes/" + nodename + "/ceph/disks",
+		extraParams: { type: me.diskType }
+	    },
+	    sorters: [
+		{
+		    property : 'dev',
+		    direction: 'ASC'
+		}
+	    ]
+	});
+
+	Ext.apply(me, {
+	    store: store
+	});
+
+        me.callParent();
+
+	store.load();
+    }
+}, function() {
+
+    Ext.define('ceph-disk-list', {
+	extend: 'Ext.data.Model',
+	fields: [ 'dev', 'used', { name: 'size', type: 'number'},
+		  {name: 'osdid', type: 'number'},
+		  'vendor', 'model', 'serial'],
+	idProperty: 'dev'
+    });
+});
+
 Ext.define('PVE.CephCreateOsd', {
     extend: 'PVE.window.Edit',
     alias: ['widget.pveCephCreateOsd'],
@@ -24,7 +99,6 @@ Ext.define('PVE.CephCreateOsd', {
 		   xtype: 'pveCephDiskSelector',
 		   name: 'dev',
 		   nodename: me.nodename,
-		   value: me.dev,
 		   diskType: 'unused',
 		   fieldLabel: gettext('Disk'),
 		   allowBlank: false
@@ -268,6 +342,18 @@ Ext.define('PVE.node.CephOsdTree', {
 	    });
 	};
 
+	var create_btn = new PVE.button.Button({
+	    text: gettext('Create') + ': OSD',
+	    handler: function() {
+		var rec = sm.getSelection()[0];
+
+		var win = Ext.create('PVE.CephCreateOsd', {
+                    nodename: nodename
+		});
+		win.show();
+	    }
+	});
+
 	var start_btn = new Ext.Button({
 	    text: gettext('Start'),
 	    disabled: true,
@@ -340,7 +426,7 @@ Ext.define('PVE.node.CephOsdTree', {
 	});
 
 	Ext.apply(me, {
-	    tbar: [ reload_btn, start_btn, stop_btn, osd_out_btn, osd_in_btn, remove_btn ],
+	    tbar: [ create_btn, reload_btn, start_btn, stop_btn, osd_out_btn, osd_in_btn, remove_btn ],
 	    rootVisible: false,
 	    fields: ['name', 'type', 'status', 'host', 'in', 'id' ,
 		     { type: 'number', name: 'reweight' },
-- 
2.1.4





More information about the pve-devel mailing list