Commit a95cfbf0 authored by Daniel Smith's avatar Daniel Smith

Prevent multiple presses of submit button; Fix status messages in standalone mode

parent c8c2822e
......@@ -702,6 +702,11 @@ function scheduleJobRequest(req, res){
if (job.custom_benchmark_file){
job.custom_benchmark_file['tempFilePath'] = tempWrite.sync(job.custom_benchmark_file.data, `${job.custom_benchmark_file.name}`);
}
if (!job['master_host']){
// Update self if master_host isn't set. This should only happen with the job is running
// locally on the master host, usually in standalone mode.
job['master_host'] = ip.address();
}
const jobHash = JSum.digest(job, 'SHA256', 'hex'); // Create a unique hash for this job
console.log(`Hash for this job: ${jobHash}`);
job['jobHash'] = jobHash;
......@@ -1089,7 +1094,7 @@ function schedulerPage(req, res) {
<br>
<div id="basicScheduler" style="display:none" align="center">
<form id="basicSchedulerForm" action="/remoteSchedule/" method="post" encType="multipart/form-data">
<form id="basicSchedulerForm" action="/remoteSchedule/" method="post" encType="multipart/form-data" onsubmit="return handle_form_submission()">
<input type="hidden" name="testType" value="bisect"/>
<label for="branch">Qt major branch:</label>
<input id="branch" type="text" name="branch" style="width:50;" required placeholder="5.12"><br>
......@@ -1158,7 +1163,7 @@ function schedulerPage(req, res) {
</div>
<div id="singleCommitScheduler" style="display:none" align="center">
<form id="singleCommitSchedulerForm" action="/remoteSchedule/" method="post" encType="multipart/form-data">
<form id="singleCommitSchedulerForm" action="/remoteSchedule/" method="post" encType="multipart/form-data" onsubmit="return handle_form_submission()">
<input type="hidden" name="testType" value="singleCommit"/>
<label for="branch">Qt major branch:</label>
<input id="branch" type="text" name="branch" style="width:50;" required placeholder="5.12"><br>
......@@ -1217,7 +1222,7 @@ function schedulerPage(req, res) {
</div>
<div id="twoCommitScheduler" style="display:none" align="center">
<form id="twoCommitSchedulerForm" action="/remoteSchedule/" method="post" encType="multipart/form-data">
<form id="twoCommitSchedulerForm" action="/remoteSchedule/" method="post" encType="multipart/form-data" onsubmit="return handle_form_submission()">
<input type="hidden" name="testType" value="twoCommit"/>
<label for="branch">Qt major branch:</label>
<input id="branch" type="text" name="branch" style="width:50;" required placeholder="5.12"><br>
......@@ -1391,6 +1396,15 @@ function schedulerPage(req, res) {
Utils.findChildById(activeElement, "submit", true).disabled = false;
}
}
// Disable the submit button once it's pressed to avoid duplicate submissions.
function handle_form_submission() {
submitbutton = Utils.findChildById(activeElement, "submit", true)
submitbutton.disabled = true;
submitbutton.style.backgroundColor = "#4CAF50";
submitbutton.style.color = "#FFFFFF";
return true; //submit the form
}
function disableSecondCommit(){
var e = Utils.findChildById(activeElement, "simpleRegressionTest", true)
......
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