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