Commit 13e27a18 authored by Jonathon Duerig's avatar Jonathon Duerig

Load jacksmod (image picker, etc.) statically via PHP

parent cc5fe807
......@@ -427,10 +427,6 @@ function SPITFORM($formfields, $newuser, $errors)
echo "<script src='js/lib/d3.v3.js'></script>\n";
echo "<script src='js/lib/nv.d3.js'></script>\n";
echo "<script src='js/lib/jquery-2.0.3.min.js'></script>\n";
echo "<script src='js/lib/jquery-ui.js'></script>\n";
echo "<script src='https://www.emulab.net/protogeni/jacksmod/stable/jacksmod.js'></script>";
echo "<script src='https://www.emulab.net/protogeni/jacksmod/stable/imagepicker.js'></script>";
echo "<script src='https://www.emulab.net/protogeni/jacksmod/stable/thumb.js'></script>";
REQUIRE_UNDERSCORE();
REQUIRE_SUP();
......@@ -442,6 +438,7 @@ function SPITFORM($formfields, $newuser, $errors)
REQUIRE_FILESTYLE();
REQUIRE_MARKED();
REQUIRE_MOMENT();
REQUIRE_JACKSMOD();
REQUIRE_JACKS();
REQUIRE_JQUERY_STEPS();
AddLibrary("js/resgraphs.js");
......
......@@ -1933,7 +1933,9 @@ $(function ()
" </select>" +
" </div>" +
"<div class='col-sm-4'></div>" +
"<div class='col-sm-6 alert alert-danger' id='where-nowhere' style='display: none; margin-top: 5px; margin-bottom: 5px'>This profile <b>will not work on any clusters</b>. Please check your profile or parameters for errors. If you are sure they are correct, you can report the problem to support@cloudlab.us and make sure to link to the problematic profile.</div>" +
"<div class='col-sm-6 alert alert-danger' id='where-nowhere' style='display: none; margin-top: 5px; margin-bottom: 5px'>This profile <b>will not work on any clusters</b>. Please check your profile or parameters for errors. If you are sure they are correct, you can report the problem to support@cloudlab.us and make sure to link to the problematic profile.</div>" +
"<div class='col-sm-4 col-sm-offset-1' style='margin-top: 5px; margin-bottom: 5px;'><button class='btn btn-default' type='button' data-toggle='collapse' data-target='#nowhere-breakdown' aria-expanded='false' id='nowhere-breakdown-button'>Cluster Compatibility Report</button></div>" +
"<div class='col-sm-12 collapse' id='nowhere-breakdown'></div>"+
"<div class='col-sm-6 alert alert-warning' id='where-deprecated' style='display: none; margin-top: 5px; margin-bottom: 5px'></div>" +
"<div class='col-sm-2 site-wait'><img src='images/spinner.gif' /></div>" +
" </div>" +
......@@ -2281,6 +2283,8 @@ $(function ()
clause, rejected,
breakdown);
console.log('REJECT BREAKDOWN', breakdown);
console.log('POSSIBLES', constraints.possible);
console.log('GROUPS', constraints.groups);
if (0) {
console.info("updateSiteConstraints");
console.info(domNode);
......@@ -2289,6 +2293,7 @@ $(function ()
console.info(rejected);
}
updateBreakdown(domNode.find('#nowhere-breakdown'), breakdown);
if (allowed.length == 0)
{
domNode.find('#where-warning').hide();
......@@ -2358,6 +2363,57 @@ $(function ()
});
}
function updateBreakdown(dom, breakdown)
{
var list = $('<ul class="list-group"></ul>');
_.each(breakdown, function (site, key) {
var choices = $('<ul style="margin-left: 20px"></ul>');
var chosen = {};
_.each(site, function (candidate) {
delete candidate.node.aggregates;
var unique = JSON.stringify(candidate.node, undefined, "");
if (chosen[unique] === undefined)
{
chosen[unique] = 1;
var line = $('<li></li>');
var found = 0;
if (candidate.node.hardware !== undefined)
{
line.append('Hardware <b>' +
candidate.node.hardware + '</b>');
++found;
}
if (candidate.node.types !== undefined)
{
if (found == 1)
{
line.append(' with ');
}
line.append('Type <b>' +
candidate.node.types + '</b>');
++found
}
if (candidate.node.images !== undefined)
{
if (found == 1)
{
line.append(' with ');
}
else if (found == 2)
{
line.append(' and ');
}
line.append('Image <b>' +
sup.ImageDisplay(candidate.node.images) + '</b>');
}
choices.append(line);
}
});
list.append($('<li class="list-group-item">Site <b>' + amlist[key] + '</b> can\'t instantiate </li>').append(choices));
});
dom.html(list);
}
// When the project is changed, look to see if the new project includes
// multiple subgroups. If only one subgroup, hide the group selector.
// Otherwise build/show a group selector.
......
......@@ -163,6 +163,31 @@ function REQUIRE_JACKS()
AddLibrary("https://www.emulab.net/protogeni/jacks-utah/js/jacks.js");
}
function REQUIRE_JACKSMOD()
{
$root = "https://www.emulab.net/protogeni/app/jacksmod-test/";
AddLibrary($root . "jacksmod.js");
AddLibrary($root . "common/loadbase.js");
AddLibrary($root . "common/base.js");
AddLibrary($root . "common/Component.js");
AddLibrary($root . "common/util.js");
AddLibrary($root . "common/ForceGraph.js");
AddLibrary($root . "common/Graph.js");
AddLibrary($root . "common/RspecLib.js");
AddLibrary($root . "common/RspecParser.js");
AddLibrary($root . "common/component/WaitingComponent.js");
AddLibrary($root . "common/component/MapComponent.js");
AddLibrary($root . "common/component/GraphNodeComponent.js");
AddLibrary($root . "common/component/GraphLanComponent.js");
AddLibrary($root . "common/component/GraphComponent.js");
AddLibrary($root . "common/component/FailedComponent.js");
AddLibrary($root . "common/component/ImagePickerComponent.js");
AddLibrary($root . "thumb/ThumbComponent.js");
AddLibrary($root . "imagepicker/main.js");
AddLibrary($root . "thumb/main.js");
AddLibrary($root . "common/loadcomplete.js");
}
function REQUIRE_JACKS_EDITOR()
{
REQUIRE_UNDERSCORE();
......
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