All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 8dc2af90 authored by Leigh Stoller's avatar Leigh Stoller

Merge branch 'master' into 'master'

Merge request for ticket #210

See merge request !22
parents 5191ced6 837177b1
......@@ -27,6 +27,9 @@ chdir("apt");
include_once("profile_defs.php");
include_once("instance_defs.php");
# Need to make non-hardcoded
$maxduration = 16;
#
# Return info about specific profile.
#
......@@ -570,6 +573,7 @@ function CheckStep2()
global $ajax_args;
global $ISAPT, $ISPNET, $ISCLOUD, $ISEMULAB;
global $TB_PROJECT_CREATEEXPT;
global $maxduration;
if (!isset($ajax_args["formfields"])) {
SPITAJAX_ERROR(-1, "Missing formfields");
......@@ -683,6 +687,13 @@ function CheckStep2()
$errors["name"] = "Already in use by another experiment";
}
}
if (!isset($formfields["duration"]) || $formfields["duration"] == "") {
$errors["duration"] = "Must set an experiment duration";
}
elseif (!ctype_digit($formfields["duration"]) || (((int)$formfields["duration"]) <= 0 || ((int)$formfields["duration"]) > $maxduration)) {
$errors["duration"] = "Must be an integer between 1 and ".$maxduration;
}
}
if (count($errors)) {
SPITAJAX_ERROR(2, $errors);
......
......@@ -81,6 +81,9 @@ if ($ISAPT && !$this_user) {
}
}
# Need to make non-hardcoded
$maxduration = 16;
$skipfirststep = 0;
if (isset($from) && ($from == "manage-profile" || $from == "show-profile")) {
$skipfirststep = 1;
......@@ -325,7 +328,7 @@ function SPITFORM($formfields, $newuser, $errors)
{
global $TBBASE, $APTMAIL, $ISAPT, $ISCLOUD, $ISPNET, $PORTAL_NAME;
global $profile_array, $this_user, $profilename, $profile;
global $projlist, $skipfirststep, $TBMAINSITE;
global $projlist, $skipfirststep, $maxduration, $TBMAINSITE;
global $refspec;
$showabout = ($ISAPT && !$this_user ? 1 : 0);
......@@ -399,6 +402,7 @@ function SPITFORM($formfields, $newuser, $errors)
echo " window.WEBONLY = $webonly;\n";
echo " window.PORTAL = '$portal';\n";
echo " window.SHOWPICKER = $showpicker;\n";
echo " window.MAXDURATION = $maxduration;\n";
echo " window.CANCOPY = $cancopy;\n";
$isadmin = (isset($this_user) && ISADMIN() ? 1 : 0);
echo " window.ISADMIN = $isadmin;\n";
......
......@@ -13,8 +13,8 @@ $(function ()
var amlist = null;
var amstatus = null;
var projlist = null;
var sysprojlist = ['emulab-ops', 'PortalProfiles', 'emulab-ops-test'];
var psysprojlist = ['PhantomNet', 'PortalProfiles', 'testproject'];
var sysprojlist = ['emulab-ops', 'PortalProfiles'];
var psysprojlist = ['PhantomNet', 'PortalProfiles'];
var profilelist = null;
var recentcount = 5;
var amdefault = null;
......@@ -129,6 +129,7 @@ $(function ()
cancopy: window.CANCOPY,
clustername: window.PORTAL_NAME,
admin: isadmin,
maxduration: window.MAXDURATION,
});
$('#main-body').html(html);
if (projlist)
......
......@@ -232,16 +232,16 @@
<table class='table table-condensed nospaceafter border-none'
style="font-size: 14px; font-family: Arial,sans-serif;">
<tr>
<td style="padding: 0px;">
<td style="padding: 0px; border: 0;">
<span style="font-weight: bolder;">Profile:</span>
<span id='finalize_profile_name'><%= profilename %></span>
</td>
<td style="padding: 0px;">
<td style="padding: 0px; border: 0;">
<span style="font-weight: bolder;">Version:</span>
<span id='finalize_profile_version'><%= profilevers %>
</span>
</td>
<td style="padding: 0px;">
<td style="padding: 0px; border: 0;">
<button class='btn btn-primary btn-xs'
type='button'
id="show_xml_modal_button">
......@@ -356,22 +356,60 @@
</div>
<% } %>
<% if (1) { %>
<div class='form-horizontal experiment_option'>
<div class='form-group format-me'>
<div class="row">
<h5>
<a href="#advanced_options_dropdown" data-toggle="collapse">
<span class="glyphicon glyphicon-plus-sign pull-left"
style="font-weight: bold;"></span>
<span style="font-weight: bold; margin-left: 12px">Advanced Options</span>
</a>
</h5>
<div id="advanced_options_dropdown"
class="panel-collapse collapse">
<div class='form-horizontal experiment_option'>
<div class='form-group format-me'>
<label class='col-sm-4 control-label'
style='text-align: right;'>Ignore Failures:</label>
<div class='col-sm-2'>
<input id='failure_okay' type="checkbox"
value="checked"
class=''
data-key='failure_okay'
name='failure_okay'
<%= formfields.failure_okay %>>
style='text-align: right;'>Experiment Duration:</label>
<div class="col-sm-6"
data-toggle='popover'
data-delay='{hide:1500, show:500}'
data-html='true'
data-content="Sets the intial amount of time that the
experiment will run. Limit: <%- maxduration %> hours. If more time is needed, the duration can be extended after the
experiment has been created.">
<input id='experiment_duration'
class='form-control'
data-key='duration'
name='duration'
value='<%- maxduration %>'>
<label style='position: absolute;
top: 6px;
right: 22px;
font-weight: normal;
color: #aaa'>
hours
</label>
<label class='control-label control-error hidden'
for='duration'></label>
</div>
</div>
<label class='control-label control-error hidden'
for='failure_okay'></label>
</div>
<div class='form-horizontal experiment_option'>
<div class='form-group format-me'>
<div class="row">
<label class='col-sm-4 control-label'
style='text-align: right;'>Ignore Failures:</label>
<div class='col-sm-2'>
<input id='failure_okay' type="checkbox"
value="checked"
class=''
data-key='failure_okay'
name='failure_okay'
<%= formfields.failure_okay %>>
</div>
</div>
<label class='control-label control-error hidden'
for='failure_okay'></label>
</div>
</div>
</div>
<% } %>
......
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