Commit 9623dd35 authored by Jonathon Duerig's avatar Jonathon Duerig

Add stub for image server to talk to Jacks. Fix namespace issue. Remove hardcoded site list.

parent 4fa9d2ea
......@@ -191,10 +191,10 @@ function (_, editModalString, editInlineString)
var expression = /^\s*$/;
if (this.xml && ! expression.exec(this.xml))
{
var rspec = $.parseXML(this.xml);
convertNamespace(rspec.documentElement);
var rspecString = this.xml;
rspecString = this.xml.replace(v2ns, v3ns);
this.input.trigger('change-topology',
[{ rspec: rspec.documentElement.outerHTML }]);
[{ rspec: rspecString }]);
}
else
{
......
......@@ -194,6 +194,9 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
if ($('#amlist-json').length) {
amlist = JSON.parse(_.unescape($('#amlist-json')[0].textContent));
_.each(_.keys(amlist), function (key) {
amValueToKey[amlist[key]] = key;
});
}
$('#waitwait_div').html(waitwaitString);
......@@ -377,7 +380,10 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
editor = new JacksEditor(root, true, true,
selectionPane, true, !multisite);
var continuation = function(rspec, description, name, amdefault, ispp) {
if (rspec)
{
editor.show(rspec);
}
};
GetProfile($(selectedElement).attr('value'), continuation);
}
......@@ -625,6 +631,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
readyCallback: function (input, output) {
jacks.input = input;
jacks.output = output;
jacks.output.on('found-images', onFoundImages);
$('#profile_where').prop('disabled', false);
$('#instantiate_submit').prop('disabled', false);
updateWhere();
......@@ -634,6 +641,53 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
});
}
var foundImages = [];
function onFoundImages(images)
{
console.log(images);
if (! _.isEqual(foundImages, images))
{
foundImages = images;
// STUB: Replace this with an ajax call to get images
_.delay(imageUpdate, 5000);
}
}
function imageUpdate()
{
// STUB: Parse ajax call results and generate new context options and constraints
var newOptions = {
contextOptions: {
images: [
{
"id": "urn:publicid:IDN+emulab.net+image+emulab-ops:SOME_NAME",
"name": "SOME_NAME Blah Blah"
},
]
},
constraints: [
{
"node": {
"aggregates": [
"urn:publicid:IDN+apt.emulab.net+authority+cm"
],
"images": [
"urn:publicid:IDN+emulab.net+image+emulab-ops:SOME_TYPE"
],
"types": [
"raw-pc"
]
}
},
]
};
constraints.addPossibles(newOptions.contextOptions);
constraints.allowAllSets(newOptions.constraints);
console.log('imageUpdate');
updateWhere();
}
function contextFail(fail1, fail2)
{
console.log('Failed to fetch context', fail1, fail2);
......@@ -650,7 +704,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
}
}
var amValueToKey = {
var amValueToKey = {};
/*
'Cloudlab Utah':
"urn:publicid:IDN+utah.cloudlab.us+authority+cm",
......@@ -669,7 +724,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
'Emulab':
"urn:publicid:IDN+emulab.net+authority+cm"
};
*/
function finishUpdateWhere(allNodes, nodesBySite)
{
if (!multisite || Object.keys(sites).length <= 1) {
......
......@@ -219,8 +219,12 @@ function(_, sup, JacksEditor, ppmodalString, ppbodyString, chooserString)
}
// Got the rspec, show the editor.
RSPEC = json.value.rspec;
console.log(json);
if (json.value.rspec)
{
editor.show(json.value.rspec,
EditorDone, EditorCancel, button_label);
}
}
}
// Convert form data into formfields array, like all our
......
......@@ -723,11 +723,19 @@ function(_, sup, JacksEditor, ppmodalString, ppbodyString, chooserString)
}
function ChangeJacksRoot(root, selectionPane) {
// console.log(RSPEC);
if (RSPEC)
{
editor = new JacksEditor(root, true, true, selectionPane, true);
editor.show(RSPEC);
}
}
function ShowEditor() {
// console.log(RSPEC);
if (RSPEC)
{
editor.show(RSPEC);
}
}
return {
......
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