Commit 7ad899a4 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor improvements:

1. Return REFUSED for an admission control violation.

2. Treat REFUSED errors as a user error instead of a fatal error.

3. Fix up confirmation modal to make it more clear that the reservation
   needs to be submitted.
parent 5e7e613b
......@@ -277,8 +277,11 @@ sub DoReserve()
APT_Geni::PortalRPC($authority, $context, "Reserve", \%rpcargs);
if (GeniResponse::IsError($response)) {
#
# All errors are fatal.
# Watch for a refused error, we want to tell the user that.
#
if ($response->code() == GENIRESPONSE_REFUSED) {
UserError($response->output());
}
fatal($response->output());
}
print Dumper($response);
......
......@@ -750,8 +750,8 @@ sub Reserve($)
return GeniResponse->Create(GENIRESPONSE_ERROR);
}
if ($count > $maximum) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN, undef,
"Admission Control says limited "/
return GeniResponse->Create(GENIRESPONSE_REFUSED, undef,
"Admission Control says limited ".
"to $maximum nodes");
}
}
......
......@@ -266,7 +266,9 @@ $(function () {
var submit_callback = function(json) {
console.info("SubmitForm", json);
sup.HideWaitWait();
DisableUnsavedWarning(form);
if (!json.code) {
DisableUnsavedWarning(form);
}
callback(json);
};
sup.ShowWaitWait(message);
......
......@@ -288,6 +288,10 @@ $(function ()
if (json.code != 2) {
sup.SpitOops("oops", json.value);
}
aptforms.GenerateFormErrors('#reserve-request-form',
json.value);
// Make sure we still warn about an unsaved form.
aptforms.MarkFormUnsaved();
return;
}
// User can submit.
......
......@@ -19,7 +19,7 @@
</h3>
</div>
<div class='panel-body'>
<div>
<div style="margin-bottom: 10px;">
<center><span id="general_error" style="color:red;"></span></center>
</div>
<form id='reserve-request-form'
......@@ -292,8 +292,8 @@
NOTE: This reservation request can be accomodated, but the
size and/or duration means that the reservation needs to
be approved by an administrator before it is fully active.
The administrator has been been notified and will be acting
on this request shortly.</div>
The administrator will be notified when you submit this
request, and will act on this request as soon as possible.</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