Commit df1cf588 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor fix to new geni-lib testing.

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