Skip to content

Commit

Permalink
feat:dont highlight status code 406 or 300
Browse files Browse the repository at this point in the history
  • Loading branch information
micahwoodard committed Apr 3, 2024
1 parent 2c09f59 commit 4a28aa0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/aind_metadata_service/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
&.pending { color: darkorange; }
&.success { color: green; }
&.error { color: red; }
&.partialError { color: black; }
}
.path, pre {
font-family: monospace;
Expand Down Expand Up @@ -128,7 +129,7 @@ <h1>{{ service_name }}</h1>
}
};
displayPendingUI = function () {
$("#user-message").removeClass("success error").addClass("pending");
$("#user-message").removeClass("success error partialError").addClass("pending");
$("#user-message").html("Searching.... Please do not refresh or re-submit.");
for (let id of ["message", "data", "raw"]) {
$(`#response-${id}`).html("");
Expand All @@ -142,7 +143,11 @@ <h1>{{ service_name }}</h1>
"response-data" : JSON.stringify(response?.data, null, 2),
"response-raw" : JSON.stringify(response, null, 2)
}
$("#user-message").removeClass("pending").addClass(isError ? "error" : "success");
if (statusCode === 406 || statusCode === 300){
$("#user-message").removeClass("pending error success").addClass("partialError")
} else{
$("#user-message").removeClass("pending").addClass(isError ? "error" : "success");
}
Object.keys(responseText).forEach((id) => {
$(`#${id}`).html(responseText[id]);
});
Expand All @@ -153,7 +158,7 @@ <h1>{{ service_name }}</h1>
const viewOrHide = $("#response-raw-div").is(":visible") ? "Hide" : "View";
$("#toggle-raw").text(`${viewOrHide} raw response`);
};
queryEndpoint = function (endpoint) {
queryEndpoint = function (endpoint) {
let parameter = $(`#param-id-${endpoint}`).val();
$.ajax({
url: `/${endpoint}/${parameter}`,
Expand Down

0 comments on commit 4a28aa0

Please sign in to comment.