Commit 23e46fc2 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

There were more .php endpoints than were dreamed of in my philosophy.

parent f27f35dd
......@@ -22,12 +22,7 @@ function ($, sup)
function initialize()
{
sup.UpdateProfileSelection($('#profile_name li:eq(0)'));
$('#quickvm_topomodal').on('hidden.bs.modal', function() {
sup.ShowProfileList($('.current'))
});
sup.InitProfileSelector();
var pageType = 'index';
if (window.APT_OPTIONS)
{
console.log('APT_OPTIONS: ' + JSON.stringify(window.APT_OPTIONS));
......@@ -35,18 +30,47 @@ function ($, sup)
{
sup.ShowModal('#working');
}
if (window.APT_OPTIONS.pageType)
{
pageType = window.APT_OPTIONS.pageType;
}
}
else
{
console.log('APT_OPTIONS is undefined');
}
initButtons();
if (pageType === 'index')
{
initIndex();
}
else if (pageType === 'sshterm')
{
sup.StartSSH('sshpanel', window.APT_OPTIONS.authObject);
}
else if (pageType === 'status')
{
sup.InitQuickVM(window.APT_OPTIONS.uuid,
window.APT_OPTIONS.sliceExpires);
initStatusButtons();
}
$('body').show();
}
function initButtons()
function initIndex()
{
sup.UpdateProfileSelection($('#profile_name li:eq(0)'));
$('#quickvm_topomodal').on('hidden.bs.modal', function() {
sup.ShowProfileList($('.current'))
});
sup.InitProfileSelector();
initIndexButtons();
}
function initIndexButtons()
{
$('button#reset-form').click(function (event) {
event.preventDefault();
......@@ -61,9 +85,31 @@ function ($, sup)
sup.ShowProfileList(event.target);
});
$('button#showtopo_select').click(function (event) {
event.preventDefault();
sup.UpdateProfileSelection($('.selected'));
});
}
function initStatusButtons()
{
$('button#register-account').click(function (event) {
event.preventDefault();
sup.RegisterAccount(window.APT_OPTIONS.creatorUid,
window.APT_OPTIONS.creatorEmail);
});
$('button#request-extension').click(function (event) {
event.preventDefault();
sup.RequestExtension(window.APT_OPTIONS.uuid);
});
$('button#extend').click(function (event) {
event.preventDefault();
sup.Extend(window.APT_OPTIONS.uuid);
});
$('button#terminate').click(function (event) {
event.preventDefault();
sup.Terminate(window.APT_OPTIONS.uuid, 'quickvm.php');
});
}
$(document).ready(initialize);
});
......@@ -922,9 +922,11 @@ function ConvertManifestToJSON(name, xml)
// Exports from this module for use elsewhere
return {
InitProfileSelector: InitProfileSelector,
InitQuickVM: InitQuickVM,
resetForm: resetForm,
ShowModal: ShowModal,
ShowProfileList: ShowProfileList,
StartSSH: StartSSH,
UpdateProfileSelection: UpdateProfileSelection
};
});
......@@ -292,6 +292,7 @@ function SPITFORM($username, $email, $sshkey, $profile, $newuser, $errors)
</div>\n";
echo "<script type='text/javascript'>\n";
echo "window.APT_OPTIONS = {\n";
echo " pageType: 'index',\n";
if ($newuser) {
echo " isNewUser: true\n";
}
......
......@@ -246,15 +246,15 @@ echo "</table>\n";
echo "<div class='pull-right'>\n";
echo " <button class='btn btn-primary'
id='register_button' type=button
onclick=\"ShowModal('#register_modal'); return false;\">
data-toggle='modal' data-target='#register_modal'>
Register</button>\n";
echo " <button class='btn btn-success' $disabled
id='extend_button' type=button
onclick=\"ShowModal('#extend_modal'); return false;\">
data-toggle='modal' data-target='#extend_modal'>
Extend</button>\n";
echo " <button class='btn btn-danger' $disabled
id='terminate_button' type=button
onclick=\"ShowModal('#terminate_modal'); return false;\">
data-toggle='modal' data-target='#terminate_modal'>
Terminate</button>\n";
echo "</div>\n";
echo "</div>\n";
......@@ -301,8 +301,7 @@ echo "<!-- This is a modal -->
Click on the link below to take you to the registration page.
</p><br>
<button class='btn btn-primary align-center'
onclick=\"RegisterAccount('$creator_uid',
'$creator_email'); return false;\"
id='register-account'
type='submit' name='register'>Register</button>
</div>
</div>
......@@ -337,7 +336,7 @@ echo "<!-- This is a modal -->
</div></div>
<br>
<button class='btn btn-primary btn-sm align-center'
onclick=\"RequestExtension('$uuid'); return false;\"
id='request-extension'
type='submit' name='request'>Request Extension</button>
</form>
</div>
......@@ -350,8 +349,7 @@ echo "<!-- This is a modal -->
class='align-center'
placeholder='Extension code' autofocus type='text' />
<br>
<button class='btn btn-primary btn-sm align-center'
onclick=\"Extend('$uuid'); return false;\"
<button class='btn btn-primary btn-sm align-center' id='extend'
type='submit' name='extend'>Extend</button>
</form>
</div>
......@@ -373,18 +371,21 @@ echo "<!-- This is a modal -->
aria-hidden='true'>&times;</button>
<p>Are you sure you want to terminate this experiment?
Click on the button below if you are really sure.</p><br>
<button class='btn btn-primary align-center'
onclick=\"Terminate('$uuid', 'quickvm.php'); return false;\"
<button class='btn btn-primary align-center' id='terminate'
type='submit' name='terminate'>Terminate</button>
</div>
</div>
</div>
</div>\n";
echo "<script src='d3.v3.js'></script>\n";
echo "<SCRIPT LANGUAGE=JavaScript>
InitQuickVM('$uuid', '$slice_expires');
</SCRIPT>\n";
echo "<script type='text/javascript'>\n";
echo "window.APT_OPTIONS = {\n";
echo " pageType: 'status',\n";
echo " uuid: '" . $uuid . "',\n";
echo " sliceExpires: '" . $slice_expires . "',\n";
echo " creatorUid: '" . $creator_uid . "',\n";
echo " creatorEmail: '" . $creator_email . "'\n";
echo "</script>\n";
SPITFOOTER();
?>
......@@ -51,9 +51,12 @@ echo "<ul class='nav nav-tabs'>
echo "</div>\n";
echo "</div>\n";
echo "<SCRIPT LANGUAGE=JavaScript>
StartSSH('sshpanel', '$auth_object');
</script>\n";
echo "<script type='text/javascript'>\n";
echo "window.APT_OPTIONS = {\n";
echo " pageType: 'sshterm',\n";
echo " authObject: '" . $auth_object . "'\n";
echo "};\n";
echo "</script>\n";
SPITFOOTER();
?>
......
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