Commit e55c461a authored by Leigh B Stoller's avatar Leigh B Stoller Committed by Gary Wong
Browse files

Checkpoint.

parent 30126588
......@@ -234,12 +234,9 @@ INSTALLFILES = $(addprefix $(INSTALL_SBINDIR)/, htmlinstall) \
$(addprefix $(INSTALL_WWWDIR)/cvsweb/, $(ALLCVSWEB)) \
$(addprefix $(INSTALL_DIR)/opsdir/www/cvsweb/, $(ALLOPSCVSWEB)) \
$(INSTALL_WWWDIR)/wikidocs/wiki/ignore.html \
$(INSTALL_WWWDIR)/doc/LICENSE.txt \
$(INSTALL_WWWDIR)/aptui/uikit/js/uikit.js \
$(INSTALL_WWWDIR)/aptui/uikit/css/uikit.almost-flat.css \
$(addprefix $(INSTALL_WWWDIR)/aptui/uikit/fonts/, $(ALLUIKITFONTS))
$(INSTALL_WWWDIR)/doc/LICENSE.txt
install: $(INSTALLFILES)
install: $(INSTALLFILES) apt-install
-mkdir -p $(INSTALL_WWWDIR)/wikidocs/wiki
(swish-e -c ./swish.conf)
cd $(INSTALL_WWWDIR) && \
......@@ -255,6 +252,10 @@ endif
$(INSTALL_OPSCVSWEBCONF)
$(INSTALL_OPSCVSWEBCGI)
apt-install: $(INSTALL_WWWDIR)/apt/uikit/js/uikit.js \
$(INSTALL_WWWDIR)/apt/uikit/css/uikit.almost-flat.css \
$(addprefix $(INSTALL_WWWDIR)/apt/uikit/fonts/, $(ALLUIKITFONTS))
post-install:
boss-install: install
......@@ -279,6 +280,11 @@ $(INSTALL_WWWDIR)/%: %
-mkdir -p $(patsubst %/,%,$(dir $@))
$(INSTALL_DATA) $(subst $$,\$$,$<) $(subst $$,\$$,$@)
$(INSTALL_WWWDIR)/apt/%: aptui/%
@echo "Installing $<"
-mkdir -p $(patsubst %/,%,$(dir $@))
$(INSTALL_DATA) $(subst $$,\$$,$<) $(subst $$,\$$,$@)
$(INSTALL_DIR)/opsdir/www/%.html: %.html htmlinstall
@echo "Installing $<"
-mkdir -p $(patsubst %/,%,$(dir $@))
......
......@@ -35,7 +35,8 @@ $ajax_request = 0;
#
$reqargs = OptionalPageArguments("uuid", PAGEARG_STRING,
"ajax_request", PAGEARG_BOOLEAN,
"ajax_method", PAGEARG_STRING);
"ajax_method", PAGEARG_STRING,
"ajax_argument", PAGEARG_STRING);
if (!isset($uuid)) {
if ($ajax_request) {
SPITAJAX_ERROR("must provide uuid");
......@@ -136,6 +137,14 @@ if (isset($ajax_request)) {
elseif ($ajax_method == "gateone_authobject") {
SPITAJAX_RESPONSE(GateOneAuthObject($creator->uid()));
}
elseif ($ajax_method == "request_extension") {
TBMAIL($TBMAIL_OPS, "Request Extension", $ajax_argument);
SPITAJAX_RESPONSE("");
}
elseif ($ajax_method == "extend") {
TBMAIL($TBMAIL_OPS, "Extend", $ajax_argument);
SPITAJAX_RESPONSE("");
}
exit();
}
SPITHEADER(1);
......@@ -206,43 +215,106 @@ echo "</tr>\n";
echo "</table>\n";
echo "<div class='uk-float-right'>\n";
echo " <button class='uk-button uk-button-primary'
id='register_button' type=button
onclick=\"ShowModal('#register_modal'); return false;\">
Register</button>\n";
echo " <button class='uk-button uk-button-success'
id='extend_button' type=button
onclick=\"ShowModal('#extend_modal'); return false;\">
Extend</button>\n";
echo " <button class='uk-button uk-button-danger'
id='terminate_button' type=button
onclick=\"Terminate('$uuid', 'quickvm.php'); return false;\">
onclick=\"ShowModal('#terminate_modal'); return false;\">
Terminate</button>\n";
echo "</div>\n";
echo "</div>\n";
echo "<div id='showtopo_div'>\n";
#echo "<button class='uk-button uk-button-mini uk-align-center'
# id='showtopo_button' type=button
# onclick=\"ShowTopo('$uuid'); return false;\">
# Show Topology</button>\n";
echo "</div>\n";
#
# The topo diagram goes inside this div, when it becomes available.
#
echo "<div id='showtopo_div'></div>\n";
#
# A modal to tell people how to extend.
# A modal to tell people how to register
#
echo "<!-- This is a modal -->
<div id='extend_modal' class='uk-modal'>
<div id='register_modal' class='uk-modal'>
<div class='uk-modal-dialog'>
<a href='' class='uk-modal-close uk-close'></a>
<div class='uk-panel uk-panel-box uk-panel-margin'>
<p>If you want to extend this experiment so that it does
not self-terminate at the time shown, you will need to register
for a full account. Click on the link below to take you to
the registration page.</p><br>
<h3>Register for an account</h3>
<p>If you want to design your own experiments, have more then
one active experiment at a time, or extend the life of an
experiment longer, you should register for a full account.
Click on the link below to take you to the registration page.
</p><br>
<button class='uk-button uk-button-primary uk-align-center'
onclick=\"RegisterAccount('$creator_uid',
'$creator_email'); return false;\"
type='submit' name='register'>Register</button>
</div>
</div>\n";
#
# A modal to tell people how to extend their experiment
#
echo "<!-- This is a modal -->
<div id='extend_modal' class='uk-modal'>
<div class='uk-modal-dialog'>
<a href='' class='uk-modal-close uk-close'></a>
<div class='uk-grid uk-grid-divider' data-uk-grid-match>
<div class='uk-width-2-3'>
If you want to extend this experiment so that it does
not self-terminate at the time shown, you can request an
extension code from us. Just tell us why. A reply will
arrive via email as soon as possible.
<form id='extend_request_form'>
<div class='uk-form-controls'>
<textarea id='why_extend' name='why_extend'
placeholder='Tell us a story please'
class='uk-width-100 uk-align-center'
rows=5></textarea>
<br>
<button class='uk-button uk-button-primary uk-button-small
uk-align-center'
onclick=\"RequestExtension('$uuid'); return false;\"
type='submit' name='request'>Request Extension</button>
</div>
</form>
</div>
<div class='uk-width-1-3'>
<form id='extend_form'>
<center>Got your code?</center><br>
<div class='uk-form-controls'>
<input id='extend_code' name='extend_code'
class='uk-form-width-small uk-align-center'
placeholder='Extension code' autofocus type='text' />
<br>
<button class='uk-button uk-button-primary uk-button-small
uk-align-center'
onclick=\"Extend('$uuid'); return false;\"
type='submit' name='extend'>Extend</button>
</div>
</form>
</div>
</div>
</div>
</div>\n";
#
# A modal to verify termination.
#
echo "<!-- This is a modal -->
<div id='terminate_modal' class='uk-modal'>
<div class='uk-modal-dialog'>
<a href='' class='uk-modal-close uk-close'></a>
<p>Are you sure you want to terminate this experiment?
Click on the button below if you are really sure.</p><br>
<button class='uk-button uk-button-primary uk-align-center'
onclick=\"Terminate('$uuid', 'quickvm.php'); return false;\"
type='submit' name='terminate'>Terminate</button>
</div>
</div>\n";
if (0) {
echo "<div class='uk-panel uk-panel-box uk-panel-header
uk-container-center'>\n";
......
......@@ -11,7 +11,7 @@ function HideModal(which)
console.log('Showing modal ' + which);
}
function CallMethod(method, callback, uuid)
function CallMethod(method, callback, uuid, arg)
{
return $.ajax({
// the URL for the request
......@@ -22,6 +22,7 @@ function CallMethod(method, callback, uuid)
uuid: uuid,
ajax_request: 1,
ajax_method: method,
ajax_argument: arg,
},
// whether this is a POST or GET request
......@@ -36,9 +37,8 @@ function GetStatus(uuid)
{
var callback = function(json) {
StatusWatchCallBack(uuid, json.value);
setTimeout(function f() { GetStatus(uuid) }, 5000);
}
var $xmlthing = CallMethod("status", null, uuid);
var $xmlthing = CallMethod("status", null, uuid, null);
$xmlthing.done(callback);
}
......@@ -83,9 +83,17 @@ function StatusWatchCallBack(uuid, status)
$("#quickvm_progress_bar").width("100%");
}
}
else if (status == 'terminating') {
status_html = "<font color=red>failed</font>";
$("#terminate_button").prop("disabled", true);
$("#extend_button").prop("disabled", true);
}
$("#quickvm_status").html(status_html);
}
StatusWatchCallBack.laststatus = status;
if (status != "terminating") {
setTimeout(function f() { GetStatus(uuid) }, 5000);
}
}
function Terminate(uuid, url)
......@@ -94,7 +102,8 @@ function Terminate(uuid, url)
window.location.replace(url);
}
$("#terminate_button").prop("disabled", true);
var $xmlthing = CallMethod("terminate", null, uuid);
$("#extend_button").prop("disabled", true);
var $xmlthing = CallMethod("terminate", null, uuid, null);
$xmlthing.done(callback);
}
......@@ -110,7 +119,7 @@ function ShowTopo(uuid)
$("#showtopo_div").html(html);
}
var $xmlthing = CallMethod("gettopomap", null, uuid);
var $xmlthing = CallMethod("gettopomap", null, uuid, null);
$xmlthing.done(callback);
}
......@@ -130,7 +139,40 @@ function Setsshurl(uuid)
$("#quickvm_sshurl").html(href);
// StartGateOne(url);
}
var $xmlthing = CallMethod("manifest", null, uuid);
var $xmlthing = CallMethod("manifest", null, uuid, null);
$xmlthing.done(callback);
}
//
// Request experiment extension.
//
function RequestExtension(uuid)
{
var reason = $("#why_extend").val();
console.log(reason);
if (reason == "") {
return;
}
var callback = function(json) {
alert("Your request has been sent");
}
var $xmlthing = CallMethod("request_extension", null, uuid, reason);
$('#extend_modal').hide();
$xmlthing.done(callback);
}
function Extend(uuid)
{
var code = $("#extend_code").val();
console.log(code);
if (code == "") {
return;
}
var callback = function(json) {
alert("Your request has been sent");
}
var $xmlthing = CallMethod("extend", null, uuid, code);
$('#extend_modal').hide();
$xmlthing.done(callback);
}
......@@ -139,7 +181,7 @@ function Setsshurl(uuid)
//
function RegisterAccount(uid, email)
{
$('#extend_modal').hide();
$('#register_modal').hide();
var url = "../newproject.php3?uid=" + uid + "&email=" + email + "";
var win = window.open(url, '_blank');
win.focus();
......@@ -168,7 +210,7 @@ function StartSSH(uuid, sshurl)
var callback = function(json) {
console.log(json.value);
}
var $xmlthing = CallMethod("gateone_authobject", null, uuid);
var $xmlthing = CallMethod("gateone_authobject", null, uuid, null);
$xmlthing.done(callback);
}
......
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