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

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

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