Commit 186eff94 authored by Leigh Stoller's avatar Leigh Stoller

Changes to handle extremely high load:

So the basic problem is that when you load the instantiate page there is
an ajax call to the profile info. Normally this returns before the user
has a chance to move the mouse the Next button. When there are 40 or so
loads of that profile, its take longer and the test harness 'clicks'
next before its ready for it. The steps package we use does not have a
concept of disabling the next button until some event is ready, so I
have to add that. Turns out the same exact problem happens on Step two;
the parameterize step is not ready before the harness clicks the next
button again. The test harness can look/wait for a button to become
enabled, but only if something disables the button. Every one of the
errors is some form of this problem. Anyway, users will see the same
exact problem on a super loaded boss; they will click next and the page
will break during the tutorial.

Later ... turned out to be easy to disable the buttons, but they are
links and Selenium does not have a way to deal with a disabled link.
So I am doing this by changing the class of the buttons to look
disabled, removing the click event handler, and adding a hidden div
element that we can look for.

Lets see if this works.
parent 950d12fa
......@@ -53,6 +53,29 @@ $(function ()
var mainTemplate = _.template(instantiateString);
var graphTemplate = _.template(templates["reservation-graph"]);
function enableStepsMotion()
{
$('#stepsContainer').steps("enableMotion");
// For Selenium.
$('#stepsContainer').prepend("<div class='hidden' " +
" id='steps-enabled'></div>");
}
function disableStepsMotion()
{
$('#stepsContainer').steps("disableMotion");
// For Selenium
$('#stepsContainer').find("#steps-enabled").remove();
}
function setStepsMotion(enable)
{
if (enable) {
enableStepsMotion();
}
else {
disableStepsMotion();
}
}
function initialize()
{
// Get context for constraints
......@@ -209,6 +232,7 @@ $(function ()
return true;
},
});
setStepsMotion(false);
// Insert datepicker on schedule tab,
$("#start_day").datepicker({
......@@ -529,10 +553,12 @@ $(function ()
var doingformcheck = 0;
var doingrunscript = 0;
// Step is changing
function StepChanging(step, event, currentIndex, newIndex) {
//console.info("StepChanging: ", step, currentIndex, newIndex);
//console.info(new Date());
if (currentIndex == 0 && newIndex == 1) {
// Check step 0 form values. Any errors, we stop here.
if (!registered && !doingformcheck) {
......@@ -568,7 +594,8 @@ $(function ()
prunetypes : prunetypes,
rerun_instance : window.RERUN_INSTANCE,
rerun_paramset : window.RERUN_PARAMSET,
jacksGraphCallback: updateJacksGraph
jacksGraphCallback: updateJacksGraph,
setStepsMotion : setStepsMotion,
});
loaded_uuid = selected_uuid;
ppchanged = true;
......@@ -603,6 +630,11 @@ $(function ()
ppchanged = false;
$('#stepsContainer-t-1').parent().removeClass('error');
$('#stepsContainer').steps('next');
// This is for testing with Selenium.
if (! $('#pp-wizard-done').length) {
$('#pp-container').append("<div class='hidden' " +
" id='pp-wizard-done'></div>");
}
}
else {
$('#stepsContainer-t-1').parent().addClass('error');
......@@ -648,6 +680,8 @@ $(function ()
// Step is done changing.
function StepChanged(step, event, currentIndex, priorIndex) {
//console.info("StepChanged: ", step, currentIndex, priorIndex);
//console.info(new Date());
APT_OPTIONS.updatePage({ 'instantiate-step': currentIndex });
var cIndex = currentIndex;
if (currentIndex == 1) {
......@@ -1657,6 +1691,8 @@ $(function ()
}
console.info("ChangeProfileSelection: " +
$(selectedElement).attr('value'));
setStepsMotion(false);
var profile_name = $(selectedElement).attr('name');
var profile_value = $(selectedElement).attr('value');
......@@ -1693,6 +1729,7 @@ $(function ()
else {
$('#profile_copy_button').removeClass("hidden");
}
setStepsMotion(true);
/*
* Change the project; if the user's project list includes
......
......@@ -19,8 +19,10 @@ $.fn.extend({
_enableAria: function (enable)
{
return (enable == null || enable) ?
this.removeClass("disabled")._aria("disabled", "false") :
this.addClass("disabled")._aria("disabled", "true");
this.removeAttr("disabled")
.removeClass("disabled")._aria("disabled", "false") :
this.attr("disabled", "disabled")
.addClass("disabled")._aria("disabled", "true");
},
_showAria: function (show)
......@@ -517,7 +519,7 @@ function goToStep(wizard, options, state, index)
}
else
{
wizard.find(".steps li").eq(oldIndex).addClass("error");
wizard.find(".steps li").eq(oldIndex).addClass("__error__");
}
return true;
......@@ -1474,6 +1476,26 @@ $.fn.steps.skip = function (count)
throw new Error("Not yet implemented!");
};
$.fn.steps.disableMotion = function ()
{
var wizard = this;
var eventNamespace = getEventNamespace(wizard);
wizard.find(".actions a")
.unbind("click" + eventNamespace, paginationClickHandler);
wizard.find(".actions a[href='#next']").parent()._enableAria(false);
};
$.fn.steps.enableMotion = function ()
{
var wizard = this;
var eventNamespace = getEventNamespace(wizard);
wizard.find(".actions a")
.bind("click" + eventNamespace, paginationClickHandler);
wizard.find(".actions a[href='#next']").parent()._enableAria();
};
/**
* An enum represents the different content types of a step and their loading mechanisms.
*
......@@ -2039,4 +2061,4 @@ var defaults = $.fn.steps.defaults = {
loading: "Loading ..."
}
};
})(jQuery);
\ No newline at end of file
})(jQuery);
......@@ -32,6 +32,7 @@ $(function () {
var debug = true;
var rerun_bindings= null;
var rerun_warnings= null;
var setStepsMotion= null;
// List of form elements (fields,groups), in order of appearance.
var formFields = [];
......@@ -3380,6 +3381,7 @@ $(function () {
}
configuredone_callback = args.config_callback;
modified_callback = args.modified_callback;
setStepsMotion = args.setStepsMotion;
/*
* Need to ask for the profile parameter form fragment and
......@@ -3406,6 +3408,7 @@ $(function () {
}
InitializeForm(paramdefs);
GenerateForm(null);
setStepsMotion(true);
if (args.rspec) {
RSPEC = args.rspec;
......@@ -3414,6 +3417,7 @@ $(function () {
ShowThumbnail(RSPEC, args.jacksGraphCallback);
}
}
setStepsMotion(false);
var blob = {"uuid" : args.uuid};
if (args.rerun_instance !== undefined) {
blob["rerun_instance"] = args.rerun_instance;
......
......@@ -200,7 +200,7 @@ function REQUIRE_JACKS_EDITOR()
function REQUIRE_JQUERY_STEPS()
{
AddLibrary("js/lib/jquery.steps.min.js");
AddLibrary("js/lib/jquery.steps.js");
}
function REQUIRE_LIQUIDFILLGAUGE()
......
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