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

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