Commit 5977a3f8 authored by Leigh Stoller's avatar Leigh Stoller

Fixes to ensure that some a couple popups do not get left behind when

clicking on their buttons. Also some fixes to hopefully prevent node
context menus from getting left behind (cause Jacks is not passing out
the event I need).
parent 8ca7071e
......@@ -1207,6 +1207,10 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
// Per node context menus.
var contextMenus = {};
// Global current showing contect menu. Some kind of bug is leaving them
// around, so keep the last one around so we can try to kill it.
var currentContextMenu = null;
//
// Show a context menu over nodes in the topo viewer.
//
......@@ -1220,6 +1224,10 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
var client_id = jacksevent.client_id;
var cid = "context-menu-" + client_id;
if (currentContextMenu) {
$('#context').contextmenu('closemenu');
$('#context').contextmenu('destroy');
}
if (!_.has(contextMenus, client_id)) {
return;
}
......@@ -1236,6 +1244,10 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
ActionHandler($(e.target).attr("name"), [client_id]);
}
})
currentContextMenu = cid;
$('#' + cid).one('hidden.bs.context', function (event) {
currentContextMenu = null;
});
$('#context').contextmenu('show', event);
}
......@@ -1515,8 +1527,8 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
// Change the ID of the clone so its unique.
clone.attr('id', "context-menu-" + node);
// Insert into the context div.
$('#context').append(clone);
// Insert into the context-menus div.
$('#context-menus').append(clone);
// If no console, then grey out the options.
if (!_.has(consolenodes, node)) {
......@@ -2278,6 +2290,8 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
// Handler for the linktest modal button
$('button#linktest-modal-button').click(function (event) {
event.preventDefault();
// Make the popover go away when button clicked.
$('button#linktest-modal-button').popover('hide');
sup.ShowModal('#linktest-modal');
});
// And for the start button in the modal.
......@@ -2288,7 +2302,13 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
// Stop button for a running or wedged linktest.
$('button#linktest-stop-button').click(function (event) {
event.preventDefault();
StopLinktest();
// Gack, we have to confirm popover hidden, or it sticks around.
// Probably cause we disable the button before popover is hidden?
$('button#linktest-stop-button')
.one('hidden.bs.popover', function (event) {
StopLinktest();
});
$('button#linktest-stop-button').popover('hide');
});
ToggleLinktestButtons(status);
}
......
......@@ -142,12 +142,14 @@
<% } %>
<div class='pull-right'>
<% if (registered && !isfadmin) { %>
<button class='btn btn-xs btn-success hidden' disabled
style='margin-right: 10px;'
id='linktest-stop-button' type=button
data-toggle='popover'
data-content='Stop a running or wedged linktest'>
Stop Linktest</button>
<span>
<button class='btn btn-xs btn-success hidden' disabled
style='margin-right: 10px;'
id='linktest-stop-button' type=button
data-toggle='popover'
data-content='Stop a running or wedged linktest'>
Stop Linktest</button>
</span>
<button class='btn btn-xs btn-primary hidden' disabled
id='clone_button' type=button>
Clone</button>
......@@ -266,12 +268,14 @@
data-toggle='popover'
data-content='Ask cluster for updated node status'>
Refresh Status</button>
<button class='btn btn-xs btn-success pull-right hidden' disabled
style='margin-right: 10px;'
id='linktest-modal-button' type=button
data-toggle='popover'
data-content='Run linktest on the topology'>
Run Linktest</button>
<span>
<button class='btn btn-xs btn-success pull-right hidden' disabled
data-toggle='popover'
data-content='Run linktest on the topology'
style='margin-right: 10px;'
id='linktest-modal-button' type=button>
Run Linktest</button>
</span>
<% } %>
</div>
<div class='tab-pane' id='listview'>
......@@ -418,8 +422,7 @@
</div>
</div>
</div>
<div id="context">
<div id="context-menu">
<div id="context-menu">
<ul class="dropdown-menu" role="menu"
style='cursor: pointer; cursor: hand'>
<li id="shell"><a name="shell">Shell</a></li>
......@@ -430,8 +433,9 @@
<li id="snapshot"><a name="snapshot">Snapshot</a></li>
<li id="delete"><a name="delete">Delete Node</a></li>
</ul>
</div>
</div>
<div id="context"></div>
<div id="context-menus"></div>
<div id='console_password_modal' class='modal fade'>
<div class='modal-dialog'>
<div class='modal-content'>
......
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