Usability: highlight the link that the currently-shown chart config popup relates to, and make a second click close the popup.

This commit is contained in:
Simon MacMullen 2013-02-28 13:23:53 +00:00
parent 3f8324892a
commit 5913198ddd
8 changed files with 38 additions and 11 deletions

View File

@ -130,6 +130,8 @@ div.form-popup-rate-options {
z-index: 1; position: absolute; right: 35px; padding: 15px; background: white; border-left: 1px solid #ccc; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; border-radius: 10px 0 0 10px; -moz-border-radius: 10px 0 0 10px; z-index: 1; position: absolute; right: 35px; padding: 15px; background: white; border-left: 1px solid #ccc; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; border-radius: 10px 0 0 10px; -moz-border-radius: 10px 0 0 10px;
} }
.popup-owner { background: #eee; padding: 5px; border-radius: 3px; -moz-border-radius: 3px; }
p.status-error, p.warning { margin: 20px; padding: 15px; border-radius: 10px; -moz-border-radius: 10px; text-align: center; font-weight: bold; } p.status-error, p.warning { margin: 20px; padding: 15px; border-radius: 10px; -moz-border-radius: 10px; text-align: center; font-weight: bold; }
.highlight { min-width: 120px; font-size: 120%; text-align:center; padding:10px; background-color: #ddd; margin: 0 20px 0 0; color: #888; border-radius: 10px; -moz-border-radius: 10px; } .highlight { min-width: 120px; font-size: 120%; text-align:center; padding:10px; background-color: #ddd; margin: 0 20px 0 0; color: #888; border-radius: 10px; -moz-border-radius: 10px; }

View File

@ -613,7 +613,7 @@ function rates_chart_or_text(id, stats, items, chart_fmt, text_fmt, chart_rates,
var mode = get_pref('rate-mode-' + id); var mode = get_pref('rate-mode-' + id);
var range = get_pref('chart-range-' + id); var range = get_pref('chart-range-' + id);
var prefix = '<h3>' + heading + var prefix = '<h3>' + heading +
' <span class="rate-options" for="' ' <span class="rate-options" title="Click to change" for="'
+ id + '">(' + prefix_title(mode, range) + ')</span>' + + id + '">(' + prefix_title(mode, range) + ')</span>' +
(heading_help == undefined ? '' : (heading_help == undefined ? '' :
' <span class="help" id="' + heading_help + '"></span>') + ' <span class="help" id="' + heading_help + '"></span>') +
@ -632,7 +632,7 @@ function rates_chart_or_text(id, stats, items, chart_fmt, text_fmt, chart_rates,
else { else {
res = '<p>Currently idle</p>'; res = '<p>Currently idle</p>';
} }
return prefix + res; return prefix + '<div class="updatable">' + res + '</div>';
} }
function prefix_title(mode, range) { function prefix_title(mode, range) {

View File

@ -415,7 +415,10 @@ function show_popup(type, text, mode) {
else { else {
$(cssClass).center().slideDown(200); $(cssClass).center().slideDown(200);
} }
$(cssClass + ' span').click(hide); $(cssClass + ' span').click(function () {
$('.popup-owner').removeClass('popup-owner');
hide();
});
} }
function postprocess() { function postprocess() {
@ -465,8 +468,19 @@ function postprocess() {
help($(this).attr('id')) help($(this).attr('id'))
}); });
$('.rate-options').die().live('click', function() { $('.rate-options').die().live('click', function() {
show_popup('rate-options', format('rate-options', {span: $(this)}), var remove = $('.popup-owner').length == 1 &&
'fade'); $('.popup-owner').get(0) == $(this).get(0);
$('.popup-owner').removeClass('popup-owner');
if (remove) {
$('.form-popup-rate-options').fadeOut(200, function() {
$(this).remove();
});
}
else {
$(this).addClass('popup-owner');
show_popup('rate-options', format('rate-options', {span: $(this)}),
'fade');
}
}); });
$('input, select').live('focus', function() { $('input, select').live('focus', function() {
update_counter = 0; // If there's interaction, reset the counter. update_counter = 0; // If there's interaction, reset the counter.

View File

@ -2,11 +2,12 @@
<div class="section"> <div class="section">
<h2>Overview</h2> <h2>Overview</h2>
<div class="hider updatable"> <div class="hider">
<% if (statistics_level == 'fine') { %> <% if (statistics_level == 'fine') { %>
<%= message_rates('msg-rates-ch', channel.message_stats) %> <%= message_rates('msg-rates-ch', channel.message_stats) %>
<% } %> <% } %>
<div class="updatable">
<h3>Details</h3> <h3>Details</h3>
<table class="facts"> <table class="facts">
<tr> <tr>
@ -68,6 +69,8 @@
<td><%= fmt_idle_long(channel) %></td> <td><%= fmt_idle_long(channel) %></td>
</tr> </tr>
</table> </table>
</div>
</div> </div>
</div> </div>

View File

@ -2,9 +2,10 @@
<div class="section"> <div class="section">
<h2>Overview</h2> <h2>Overview</h2>
<div class="hider updatable"> <div class="hider">
<%= data_rates('data-rates-conn', connection, 'Data rates') %> <%= data_rates('data-rates-conn', connection, 'Data rates') %>
<div class="updatable">
<h3>Details</h3> <h3>Details</h3>
<table class="facts"> <table class="facts">
<% if (nodes_interesting) { %> <% if (nodes_interesting) { %>
@ -59,6 +60,7 @@
</tr> </tr>
</table> </table>
<% } %> <% } %>
</div>
</div> </div>
</div> </div>

View File

@ -1,13 +1,14 @@
<h1>Exchange: <b><%= fmt_exchange(exchange.name) %></b></h1> <h1>Exchange: <b><%= fmt_exchange(exchange.name) %></b></h1>
<div class="section"> <div class="section">
<div class="hider updatable"> <div class="hider">
<h2>Overview</h2> <h2>Overview</h2>
<% if (statistics_level == 'fine') { %> <% if (statistics_level == 'fine') { %>
<%= message_rates('msg-rates-x', exchange.message_stats) %> <%= message_rates('msg-rates-x', exchange.message_stats) %>
<% } %> <% } %>
<h3>Details</h3> <div class="updatable">
<h3>Details</h3>
<table class="facts"> <table class="facts">
<tr> <tr>
<th>Type</th> <th>Type</th>
@ -28,6 +29,7 @@
</tr> </tr>
<% } %> <% } %>
</table> </table>
</div>
</div> </div>
</div> </div>

View File

@ -4,7 +4,7 @@
<% } %> <% } %>
<div class="section"> <div class="section">
<h2>Totals</h2> <h2>Totals</h2>
<div class="hider updatable"> <div class="hider">
<% if (overview.statistics_db_node != 'not_running') { %> <% if (overview.statistics_db_node != 'not_running') { %>
<%= queue_lengths('lengths-over', overview.queue_totals) %> <%= queue_lengths('lengths-over', overview.queue_totals) %>
<% if (statistics_level == 'fine') { %> <% if (statistics_level == 'fine') { %>
@ -14,6 +14,7 @@
Totals not available Totals not available
<% } %> <% } %>
<div class="updatable">
<h3>Global counts <span class="help" id="resource-counts"></span></h3> <h3>Global counts <span class="help" id="resource-counts"></span></h3>
<div class="box"> <div class="box">
@ -43,6 +44,7 @@
</div> </div>
<% } %> <% } %>
</div> </div>
</div>
</div> </div>
</div> </div>

View File

@ -2,12 +2,13 @@
<div class="section"> <div class="section">
<h2>Overview</h2> <h2>Overview</h2>
<div class="hider updatable"> <div class="hider">
<%= queue_lengths('lengths-q', queue) %> <%= queue_lengths('lengths-q', queue) %>
<% if (statistics_level == 'fine') { %> <% if (statistics_level == 'fine') { %>
<%= message_rates('msg-rates-q', queue.message_stats) %> <%= message_rates('msg-rates-q', queue.message_stats) %>
<% } %> <% } %>
<div class="updatable">
<h3>Details</h3> <h3>Details</h3>
<table class="facts"> <table class="facts">
<tr> <tr>
@ -103,6 +104,7 @@
</tr> </tr>
<% } %> <% } %>
</table> </table>
</div>
</div> </div>
</div> </div>