Handle standard menu items defined by Nodes in the browser.

The File menu now includes a "Create" submenu, and Delete/Rename
options. Nodes can offer Delete/Rename functionality, and the
options on the menu are automatically enabled/disabled based on
the selected node. Each node can also offer Create functionality,
and specify a list of node types (including itself) from which the
option should be made available. The menu is dynamically generated
based on the selected node.

The Context menu on the treeview works in a similar way, except that
nodes can offer any context menu items (we don't allow this on the
top menu, as that should stay consistent to avoid user confusion).
This commit is contained in:
Dave Page
2015-03-13 10:35:12 +00:00
parent af7dcd49b4
commit 751f8383fa
13 changed files with 314 additions and 83 deletions

View File

@@ -1,7 +1,7 @@
// Add a server
function add_server() {
function create_server() {
var alert = alertify.prompt(
'{{ _('Add a server') }}',
'{{ _('Create a server') }}',
'{{ _('Enter a name for the new server') }}',
'',
function(evt, value) {
@@ -32,12 +32,12 @@ function add_server() {
}
// Delete a server
function delete_server(item) {
function drop_server(item) {
alertify.confirm(
'{{ _('Delete server?') }}',
'{{ _('Are you sure you wish to delete the server "{0}"?') }}'.replace('{0}', tree.getLabel(item)),
'{{ _('Drop server?') }}',
'{{ _('Are you sure you wish to drop the server "{0}"?') }}'.replace('{0}', tree.getLabel(item)),
function() {
var id = tree.getId(item)
var id = tree.getId(item).split('/').pop()
$.post("{{ url_for('NODE-server.delete') }}", { id: id })
.done(function(data) {
if (data.success == 0) {
@@ -66,7 +66,7 @@ function rename_server(item) {
'{{ _('Enter a new name for the server') }}',
tree.getLabel(item),
function(evt, value) {
var id = tree.getId(item)
var id = tree.getId(item).split('/').pop()
$.post("{{ url_for('NODE-server.rename') }}", { id: id, name: value })
.done(function(data) {
if (data.success == 0) {