-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving js to a separate file, refactoring templates to use a common l…
…ayout
- Loading branch information
Showing
4 changed files
with
25 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,52 +17,14 @@ | |
<!-- Bootstrap --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script> | ||
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha384-1H217gwSVyLSIfaLxHbE7dRb3v4mYCKbpQvzx0cegeju1MVsGrX5xXxAvs/HgeFs" crossorigin="anonymous"></script> | ||
<script> | ||
const WAIVERS_URL = "{{ url_for('api_v1.waivers_resource') }}"; | ||
|
||
$(document).ready(function () { | ||
$("form").on("submit", function(ev) { | ||
ev.preventDefault(); | ||
let testcaseName = $("#testcase").val(); | ||
$.ajax({ | ||
url: WAIVERS_URL, | ||
method: "POST", | ||
contentType: "application/json", | ||
data: JSON.stringify({ | ||
subject_type: $("#subject_type").val(), | ||
subject_identifier: $("#subject_identifier").val(), | ||
testcase: testcaseName, | ||
product_version: $("#product_version").val(), | ||
comment: $("#comment").val(), | ||
scenario: $("#scenario").val() | ||
}), | ||
success: function (data, status, jqXHR) { | ||
$("#result-text-error").addClass("d-none"); | ||
$("#result-text-success").removeClass("d-none"); | ||
$("#result-link").attr("href", `${WAIVERS_URL}${data.id}`); | ||
$("#waiver-result").removeClass("alert-danger d-none").addClass("alert-success"); | ||
}, | ||
error: function (jqXHR, textStatus) { | ||
$("#result-text-success").addClass("d-none"); | ||
$("#result-text-error").removeClass("d-none"); | ||
let addition = ""; | ||
if(jqXHR.status === 401) { | ||
addition = `<a href="/api/v1.0/permissions?testcase=${testcaseName}&html=1" target="_blank">See who has permissions to waive ${testcaseName}</a>`; | ||
} | ||
$("#error-desc").html(`Creation failed, status: ${jqXHR.status} ${jqXHR.statusText} ${addition}`); | ||
$("#waiver-result").removeClass("alert-success d-none").addClass("alert-danger"); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
{% block scripts %} | ||
{% endblock %} | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1> | ||
<img src="{{ url_for('favicon') }}" style="height: 64px" alt="Waiver DB" /> | ||
<img src="{{ url_for('favicon') }}" style="height: 64px" alt="" /> | ||
{{ self.title() }} | ||
</h1> | ||
{% for message in get_flashed_messages() %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="description" content="Web view on review-rot output."> | ||
{% extends "layout.html" %} | ||
|
||
<link rel="icon" href="{{ url_for('favicon') }}" /> | ||
{% block title %} | ||
WaiverDB: Permissions | ||
{% endblock %} | ||
|
||
<title> | ||
{% block title %} | ||
WaiverDB Permissions | ||
{% endblock %} | ||
</title> | ||
{% block scripts %} | ||
{% endblock %} | ||
|
||
<!-- Bootstrap --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous"> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h1> | ||
<img src="{{ url_for('favicon') }}" style="height: 64px" alt="Waiver DB" /> | ||
{{ self.title() }} | ||
</h1> | ||
{% block body %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
|
@@ -57,6 +40,4 @@ <h1> | |
{%- endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</body> | ||
</html> | ||
{% endblock %} |