this patch adds a set/unset noout button (for easy maintenance of your
ceph cluster) and reorders the buttons so that global actions (reload,
add osd, set noout) are left, and osd specific actions are on the right

to reduce confusion, there is now a label left of the osd actions which
displays the selected osd

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 www/manager6/ceph/OSD.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
index 588e3d3..25c4f12 100644
--- a/www/manager6/ceph/OSD.js
+++ b/www/manager6/ceph/OSD.js
@@ -280,6 +280,9 @@ Ext.define('PVE.node.CephOsdTree', {
         /*jslint confusion: true */
         var me = this;
 
+       // we expect noout to be not set by default
+       var noout = false;
+
        var nodename = me.pveSelNode.data.node;
        if (!nodename) {
            throw "no node name specified";
@@ -301,6 +304,13 @@ Ext.define('PVE.node.CephOsdTree', {
                    sm.deselectAll();
                    me.setRootNode(response.result.data.root);
                    me.expandAll();
+                   // extract noout flag
+                   if (response.result.data.flags &&
+                       response.result.data.flags.search(/noout/) !== -1) {
+                       noout = true;
+                   } else {
+                       noout = false;
+                   }
                    set_button_status();
                }
            });
@@ -399,8 +409,41 @@ Ext.define('PVE.node.CephOsdTree', {
            }
        });
 
+       var noout_btn = new Ext.Button({
+           text: gettext('Set noout'),
+           handler: function() {
+               PVE.Utils.API2Request({
+                   url: "/nodes/" + nodename + "/ceph/flags",
+                   params: {
+                       flag: 'noout',
+                       set: noout ? 0 : 1
+                   },
+                   waitMsgTarget: me,
+                   method: 'PUT',
+                   failure: function(response, opts) {
+                       Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+                   },
+                   success: reload
+               });
+           }
+       });
+
+       var osd_label = new Ext.toolbar.TextItem({
+           data: {
+               osd: undefined
+           },
+           tpl: [
+               '<tpl if="osd">',
+               '{osd}:',
+               '<tpl else>',
+               gettext('No OSD selected'),
+               '</tpl>'
+           ]
+       });
+
        set_button_status = function() {
            var rec = sm.getSelection()[0];
+           noout_btn.setText(noout?gettext('Unset noout'):gettext('Set 
noout'));
 
            if (!rec) {
                start_btn.setDisabled(true);
@@ -419,6 +462,8 @@ Ext.define('PVE.node.CephOsdTree', {
 
            osd_out_btn.setDisabled(!(isOsd && rec.data['in']));
            osd_in_btn.setDisabled(!(isOsd && !rec.data['in']));
+
+           osd_label.update(isOsd?{osd:rec.data.name}:undefined);
        };
 
        sm.on('selectionchange', set_button_status);
@@ -429,7 +474,7 @@ Ext.define('PVE.node.CephOsdTree', {
        });
 
        Ext.apply(me, {
-           tbar: [ create_btn, reload_btn, start_btn, stop_btn, osd_out_btn, 
osd_in_btn, remove_btn ],
+           tbar: [ create_btn, reload_btn, noout_btn, '->', osd_label, 
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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to