Commit fedb9868 authored by Keith Downie's avatar Keith Downie Committed by Leigh B Stoller

Updated status to support multisite

parent c8512d6b
......@@ -317,74 +317,74 @@ left: -999em;
}
}
#cluster_picker_status button {
.cluster_picker_status button {
padding-left: 16px;
}
#cluster_picker_status .btn {
.cluster_picker_status .btn {
cursor: default;
background-color: #FFF;
border-radius: 4px;
text-align: left;
}
#cluster_picker_status .caret {
.cluster_picker_status .caret {
position: absolute;
right: 16px;
top: 15px;
}
#cluster_picker_status .btn-default:hover, #cluster_picker_status .btn-default:focus, #cluster_picker_status .btn-default:active, #cluster_picker_status .btn-default.active, #cluster_picker_status .open .dropdown-toggle.btn-default {
.cluster_picker_status .btn-default:hover, .cluster_picker_status .btn-default:focus, .cluster_picker_status .btn-default:active, .cluster_picker_status .btn-default.active, .cluster_picker_status .open .dropdown-toggle.btn-default {
background-color: #FFF;
}
#cluster_picker_status
.cluster_picker_status
#cluster_picker_status .btn-group.open .dropdown-toggle {
.cluster_picker_status .btn-group.open .dropdown-toggle {
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6)
}
#cluster_picker_status.btn-group {width: 100%}
#cluster_picker_status .dropdown-menu {width: 100%;}
.cluster_picker_status.btn-group {width: 100%}
.cluster_picker_status .dropdown-menu {width: 100%;}
#cluster_picker_status li {
.cluster_picker_status li {
position: relative;
}
#cluster_picker_status .picker_stats {
.cluster_picker_status .picker_stats {
position: absolute;
right: 10px;
top: 4px;
}
#cluster_picker_status .dropdown-toggle .picker_stats {
.cluster_picker_status .dropdown-toggle .picker_stats {
right: 35px;
top: 8px;
z-index: 2;
}
#cluster_picker_status .text-healthy {
.cluster_picker_status .text-healthy {
color: #8ab800;
}
#cluster_picker_status .text-unhealthy {
.cluster_picker_status .text-unhealthy {
color: #FF6600;
}
#cluster_picker_status .selected {
.cluster_picker_status .selected {
background-color: #f5f5f5;
}
#cluster_picker_status .dropdown-menu:hover .selected {
.cluster_picker_status .dropdown-menu:hover .selected {
background-color: #FFF;
}
#cluster_picker_status .tooltip .tooltip-inner div {
.cluster_picker_status .tooltip .tooltip-inner div {
text-align: left;
white-space: nowrap;
}
#cluster_picker_status .tooltip .tooltip-inner {
.cluster_picker_status .tooltip .tooltip-inner {
max-width: 400px;
}
......@@ -571,7 +571,7 @@ function SPITFORM($formfields, $newuser, $errors)
$html = "<div id='aggregate_selector'>
<div class='form-horizontal experiment_option' id='nosite_selector'>
<div class='form-group'>
<div class='form-group cluster-group'>
<label class='col-sm-4 control-label'
style='text-align: right;'>Cluster:</label>
<div class='col-sm-6'>
......
......@@ -39,7 +39,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, aboutaptString, aboutcl
$('#instantiate_submit').prop('disabled', true);
$.get(contextUrl).then(contextReady, contextFail);
var jqxhr = $.getJSON('https://clnode049.clemson.cloudlab.us:8081/index.html?names=urn&callback=?')
var jqxhr = $.getJSON('https://clnode063.clemson.cloudlab.us:8081/index.html?names=urn&callback=?')
.done(function(data) {
monitor = data;
// Check if third tab is already active.
......@@ -132,10 +132,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, aboutaptString, aboutcl
}
});
// Build the picker that uses the monitoring stats.
// Currently does not support multisite, so don't call if it is multisite.
if ($('#aggregate_selector #site_selector').hasClass('hidden')) {
CreateClusterStatus();
}
CreateClusterStatus();
if (!$('#cluster_status_link').length) {
$('#stepsContainer-p-2 #finalize_options').parent().append(''
+'<div id="cluster_status_link"><center>'
......@@ -363,62 +361,42 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, aboutaptString, aboutcl
if (monitor == null || $.isEmptyObject(monitor)) {
return;
}
var which = 'nosite_selector';
// Need to add support for multisite
/*if (!$('#aggregate_selector #site_selector').hasClass('hidden')) {
which = 'site_selector';
}*/
$('#finalize_options .cluster-group').each(function() {
var which = $(this).parent().parent().attr('class');
var html = wt.ClusterStatusHTML($('#'+which+' #profile_where option'));
var html = wt.ClusterStatusHTML($('#'+which+' .form-control option'));
$('.'+which+' #profile_where').after(html);
$('.'+which+' #profile_where').addClass('hidden');
$('.'+which+' .form-control').after(html);
$('.'+which+' select.form-control').addClass('hidden');
html.find('.dropdown-menu a').on('click', function(){
wt.StatusClickEvent(html, this);
$('.'+which+' #profile_where').val($('#cluster_picker_status .value').html());
});
/*$('#cluster_picker_status .dropdown-menu a').on('click', function(){
$('#cluster_picker_status .dropdown-toggle .value').html($(this).attr('value'));
$('.'+which+' #profile_where').val($('#cluster_picker_status .value').html());
if ($(this).children('.picker_stats').length) {
if (!$('#cluster_picker_status .dropdown-toggle > .picker_stats').length) {
$('#cluster_picker_status .dropdown-toggle').append('<div class="picker_stats"></div>');
}
else {
$('#cluster_picker_status .dropdown-toggle > .picker_stats').html('');
}
$('#cluster_picker_status .dropdown-toggle > .picker_stats').append($(this).children('.picker_stats').html());
}
$('#cluster_picker_status .selected').removeClass('selected');
$(this).parent().addClass('selected');
});*/
_.each(amlist, function(name, key) {
var data = monitor[key];
var target = $('#cluster_picker_status .dropdown-menu .enabled a:contains("'+name+'")');
if (data && !$.isEmptyObject(data)) {
// Calculate testbed rating and set up tooltips.
var rating = wt.CalculateRating(data);
target.parent().attr('data-rating', rating[0]);
var stats = wt.StatsLineHTML(wt.AssignGlyph(rating[0]), rating[1]);
target.append(stats);
}
});
html.find('.dropdown-menu a').on('click', function(){
wt.StatusClickEvent(html, this);
$('.'+which+' .form-control').val($('.'+which+' .cluster_picker_status .value').html());
});
$('#cluster_picker_status .dropdown-menu').find('.enabled').sort(function (a, b) {
return +b.dataset.rating - +a.dataset.rating;
}).prependTo($('#cluster_picker_status .dropdown-menu'));
_.each(amlist, function(name, key) {
var data = monitor[key];
var target = $('.'+which+' .cluster_picker_status .dropdown-menu .enabled a:contains("'+name+'")');
if (data && !$.isEmptyObject(data)) {
// Calculate testbed rating and set up tooltips.
var rating = wt.CalculateRating(data);
$('[data-toggle="tooltip"]').tooltip();
target.parent().attr('data-rating', rating[0]);
var stats = wt.StatsLineHTML(wt.AssignGlyph(rating[0]), rating[1]);
target.append(stats);
}
});
$('#cluster_picker_status .dropdown-menu .enabled a')[0].click();
$('.'+which+' .cluster_picker_status .dropdown-menu').find('.enabled').sort(function (a, b) {
return +b.dataset.rating - +a.dataset.rating;
}).prependTo($('.'+which+' .cluster_picker_status .dropdown-menu'));
$('.'+which+' .cluster_picker_status .dropdown-menu .enabled a')[0].click();
});
$('[data-toggle="tooltip"]').tooltip();
}
function SwitchJacks(which) {
......@@ -698,7 +676,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, aboutaptString, aboutcl
html = html +
"<div id='site"+sitenum+"cluster' " +
" class='form-horizontal experiment_option'>" +
" <div class='form-group'>" +
" <div class='form-group cluster-group'>" +
" <label class='col-sm-4 control-label' " +
" style='text-align: right;'>"+
" Site " + siteid + " Cluster:</a>" +
......
......@@ -2,7 +2,7 @@ define(['underscore'],
function(_) {
function ClusterStatusHTML(options) {
var html = $('<div id="cluster_picker_status" class="btn-group">'
var html = $('<div class="cluster_picker_status btn-group">'
+'<button type="button" class="form-control btn btn-default dropdown-toggle" data-toggle="dropdown">'
+'<span class="value"></span>'
+'<span class="caret"></span>'
......@@ -22,6 +22,10 @@ function(_) {
}
});
if (!html.find('.disabled').length) {
html.find('.divider').remove();
}
return html;
}
......
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