Skip to content

Commit

Permalink
allow indicies to be deleted from the cluster overview
Browse files Browse the repository at this point in the history
  • Loading branch information
mobz committed May 21, 2011
1 parent ef6e8b7 commit 051d4cf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
40 changes: 34 additions & 6 deletions lib/es/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,14 @@
}.bind(this)
}).open();
},
_deleteIndexAction_handler: function(index) {
if(prompt("type 'DELETE' to delete " + index.name + ". There is no undo") === "DELETE") {
this.cluster.delete(index.name, null, function(r) {
alert(JSON.stringify(r));
this.redraw("reset");
}.bind(this) );
}
},
_replica_template: function(replica) {
var r = replica.replica;
return { tag: "DIV",
Expand Down Expand Up @@ -767,9 +775,15 @@
]},
{ tag: "DIV", text: node.cluster.http_address },
{ tag: "DIV", children: [
{ tag: "SPAN", cls: "textLink", text: "cluster", onclick: function() { new es.ui.JsonPanel({ json: node.cluster, title: node.name });} },
" ",
{ tag: "SPAN", cls: "textLink", text: "stats", onclick: function() { new es.ui.JsonPanel({ json: node.stats, title: node.name });} },
new acx.ui.MenuButton({
label: "Info",
menu: new acx.ui.MenuPanel({
items: [
{ text: "Cluster Node Info", onclick: function() { new es.ui.JsonPanel({ json: node.cluster, title: node.name });} },
{ text: "Node Stats", onclick: function() { new es.ui.JsonPanel({ json: node.stats, title: node.name });} }
]
})
})
] }
] }
].concat(node.routings.map(this._routing_template, this))};
Expand All @@ -780,9 +794,23 @@
{ tag: "DIV", text: "size: " + (index.status && index.status.index ? index.status.index.primary_size + " (" + index.status.index.size + ")" : "unknown" ) },
{ tag: "DIV", text: "docs: " + (index.status ? index.status.docs.num_docs + " (" + index.status.docs.max_doc + ")" : "unknown" ) },
{ tag: "DIV", children: [
{ tag: "SPAN", cls: "textLink", text: "status", onclick: function() { new es.ui.JsonPanel({ json: index.status, title: index.name });} },
" ",
{ tag: "SPAN", cls: "textLink", text: "metadata", onclick: function() { new es.ui.JsonPanel({ json: index.metadata, title: index.name });} },
new acx.ui.MenuButton({
label: "Info",
menu: new acx.ui.MenuPanel({
items: [
{ text: "Index Status", onclick: function() { new es.ui.JsonPanel({ json: index.status, title: index.name }); } },
{ text: "Index Metadata", onclick: function() { new es.ui.JsonPanel({ json: index.metadata, title: index.name }); } }
]
})
}),
new acx.ui.MenuButton({
label: "Actions",
menu: new acx.ui.MenuPanel({
items: [
{ text: "Delete...", onclick: function() { this._deleteIndexAction_handler(index) }.bind(this) }
]
})
})
] }
]} : { tag: "TH" };
},
Expand Down
3 changes: 2 additions & 1 deletion lib/jsacx/src/jsacx-widgets.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ BUTTON::-moz-focus-inner {
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
height: auto;
min-width: auto;
min-width: 0;
}
.uiMenuButton .uiButton-label {
padding-right: 20px;
background-image: url('images/menu-button.gif');
background-position: right 50%;
background-repeat: no-repeat;
padding: 0px 17px 0px 5px;
text-align: left;
}

/* acx.ui.Table */
Expand Down

0 comments on commit 051d4cf

Please sign in to comment.