Commit 7932cae3 authored by Dietmar Maurer's avatar Dietmar Maurer

implement add/remove monitor

parent 6d806418
Ext.define('PVE.CephCreateMon', {
extend: 'PVE.window.Edit',
alias: ['widget.pveCephCreateMon'],
create: true,
subject: 'Ceph Monitor',
setNode: function(nodename) {
var me = this;
me.nodename = nodename;
me.url = "/nodes/" + nodename + "/ceph/mon";
},
initComponent : function() {
var me = this;
if (!me.nodename) {
throw "no node name specified";
}
me.setNode(me.nodename);
Ext.applyIf(me, {
method: 'POST',
items: [
{
xtype: 'PVE.form.NodeSelector',
submitValue: false,
fieldLabel: gettext('Comment'),
selectCurNode: true,
allowBlank: false,
listeners: {
change: function(f, value) {
me.setNode(value);
}
}
}
]
});
me.callParent();
}
});
Ext.define('PVE.node.CephMonList', { Ext.define('PVE.node.CephMonList', {
extend: 'Ext.grid.GridPanel', extend: 'Ext.grid.GridPanel',
alias: 'widget.pveNodeCephMonList', alias: 'widget.pveNodeCephMonList',
...@@ -29,8 +75,12 @@ Ext.define('PVE.node.CephMonList', { ...@@ -29,8 +75,12 @@ Ext.define('PVE.node.CephMonList', {
var service_cmd = function(cmd) { var service_cmd = function(cmd) {
var rec = sm.getSelection()[0]; var rec = sm.getSelection()[0];
if (!rec.data.host) {
Ext.Msg.alert(gettext('Error'), "entry has no host");
return;
}
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: "/nodes/" + nodename + "/ceph/" + cmd, url: "/nodes/" + rec.data.host + "/ceph/" + cmd,
method: 'POST', method: 'POST',
params: { service: "mon." + rec.data.name }, params: { service: "mon." + rec.data.name },
failure: function(response, opts) { failure: function(response, opts) {
...@@ -57,11 +107,44 @@ Ext.define('PVE.node.CephMonList', { ...@@ -57,11 +107,44 @@ Ext.define('PVE.node.CephMonList', {
} }
}); });
var add_btn = new Ext.Button({
text: gettext('Create'),
handler: function(){
var win = Ext.create('PVE.CephCreateMon', {
nodename: nodename
});
win.show();
}
});
var remove_btn = new PVE.button.Button({
text: gettext('Remove'),
selModel: sm,
disabled: true,
handler: function() {
var rec = sm.getSelection()[0];
if (!rec.data.host) {
Ext.Msg.alert(gettext('Error'), "entry has no host");
return;
}
PVE.Utils.API2Request({
url: "/nodes/" + rec.data.host + "/ceph/mon/" +
rec.data.name,
method: 'DELETE',
failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
}
});
}
});
Ext.apply(me, { Ext.apply(me, {
store: store, store: store,
selModel: sm, selModel: sm,
stateful: false, stateful: false,
tbar: [ start_btn, stop_btn ], tbar: [ start_btn, stop_btn, add_btn, remove_btn ],
columns: [ columns: [
{ {
header: gettext('Name'), header: gettext('Name'),
...@@ -140,8 +223,7 @@ Ext.define('PVE.node.CephConfig', { ...@@ -140,8 +223,7 @@ Ext.define('PVE.node.CephConfig', {
} }
Ext.apply(me, { Ext.apply(me, {
url: '/api2/extjs/nodes/' + nodename + '/ceph/config', url: '/nodes/' + nodename + '/ceph/config',
// style: 'padding-left:10px',
bodyStyle: 'white-space:pre', bodyStyle: 'white-space:pre',
bodyPadding: 5, bodyPadding: 5,
autoScroll: true, autoScroll: true,
...@@ -187,8 +269,7 @@ Ext.define('PVE.node.CephCrushMap', { ...@@ -187,8 +269,7 @@ Ext.define('PVE.node.CephCrushMap', {
} }
Ext.apply(me, { Ext.apply(me, {
url: '/api2/extjs/nodes/' + nodename + '/ceph/crush', url: '/nodes/' + nodename + '/ceph/crush',
// style: 'padding-left:10px',
bodyStyle: 'white-space:pre', bodyStyle: 'white-space:pre',
bodyPadding: 5, bodyPadding: 5,
autoScroll: true, autoScroll: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment