Commit df1cf588 authored by Leigh Stoller's avatar Leigh Stoller

Minor fix to new geni-lib testing.

parent 7ce9ec69
......@@ -851,6 +851,15 @@ function Do_RunScript()
global $ajax_args;
global $suexec_output, $suexec_output_array;
$newgenilib = 0;
$profile = null;
if (isset($ajax_args["uuid"])) {
$profile = Profile::Lookup($ajax_args["uuid"]);
if (!$profile) {
SPITAJAX_ERROR(1, "Unknown profile uuid");
return;
}
}
$script = "";
if (isset($ajax_args["script"])) {
......@@ -866,11 +875,6 @@ function Do_RunScript()
SPITAJAX_ERROR(1, "Missing profile uuid");
return;
}
$profile = Profile::Lookup($ajax_args["uuid"]);
if (!$profile) {
SPITAJAX_ERROR(1, "Unknown profile uuid");
return;
}
if (!$profile->script()) {
SPITAJAX_ERROR(1, "Not a geni-lib script");
return;
......@@ -891,9 +895,10 @@ function Do_RunScript()
SPITAJAX_ERROR(1, "Not enough permission to instantiate profile");
return;
}
if ($profile->UseNewGeniLib()) {
$newgenilib = 1;
}
}
# Temporary
if ($profile && $profile->UseNewGeniLib()) {
$newgenilib = 1;
}
if (preg_match("/^import/m", $script)) {
......
......@@ -19,6 +19,7 @@ $(function ()
var isReadOnly = false;
var isShown = false;
var hasChanged = false;
var profile_uuid = null;
function initialize()
{
......@@ -63,11 +64,13 @@ $(function ()
// Hide the current page (#page-body) and show the genilib editor.
// 'source' is a plaintext genilib source code string
// 'callback' is called when the user clicks ok or cancel with either the new source (if they clicked ok in edit mode) or null (if they clicked cancel or are in readonly mode).
window.SHOW_GENILIB_EDITOR = function (source, newCallback, newIsReadOnly)
window.SHOW_GENILIB_EDITOR = function (source, newCallback,
newIsReadOnly, uuid)
{
isShown = true;
callback = newCallback;
isReadOnly = newIsReadOnly;
profile_uuid = uuid;
$('#page-body').hide();
$('#genilib-editor-body').show();
render();
......@@ -231,9 +234,12 @@ $(function ()
isWaiting = true;
var script = editor.getValue();
var call = sup.CallServerMethod(null, "instantiate",
"RunScript",
{"script" : script});
var args = {"script" : script};
if (profile_uuid) {
args["uuid"] = profile_uuid;
}
var call = sup.CallServerMethod(null, "instantiate", "RunScript", args);
call.done(runComplete);
}
}
......
......@@ -1637,7 +1637,7 @@ $(function ()
{
readonly = false;
}
window.SHOW_GENILIB_EDITOR(source, closeEditor, readonly);
window.SHOW_GENILIB_EDITOR(source, closeEditor, readonly, profile_uuid);
}
function closeEditor(source)
......
......@@ -304,7 +304,7 @@ $(function ()
function openEditor(source)
{
window.SHOW_GENILIB_EDITOR(source, null, true);
window.SHOW_GENILIB_EDITOR(source, null, true, profile_uuid);
}
function SetupRepo()
......
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