mirror of
https://github.com/uw935/vatsimfox.git
synced 2026-09-17 03:38:54 +00:00
add: notification in viewer when error appears && api requests exception && new map-style (preparing for new update) && buttons color change
This commit is contained in:
@@ -14,7 +14,7 @@ Project based on [Virtual Air Traffic Simulation Network (VATSIM) API](https://v
|
|||||||
Written in Python 3.8.18 + JS (JQuery framework) + Boostrap
|
Written in Python 3.8.18 + JS (JQuery framework) + Boostrap
|
||||||
|
|
||||||
## Startup
|
## Startup
|
||||||
For run application on your own machine, you must install docker. Then just one command in the "src" folder with the project source code:
|
To run application on your own machine, you must install docker. Then just one command in the "src" folder with the project source code:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose up
|
docker compose up
|
||||||
|
|||||||
+2
-2
@@ -22,9 +22,9 @@ def request_handler():
|
|||||||
try:
|
try:
|
||||||
return requests.get(f"{VATSIM_API_URL}{request_string}").json()
|
return requests.get(f"{VATSIM_API_URL}{request_string}").json()
|
||||||
except requests.exceptions.JSONDecodeError:
|
except requests.exceptions.JSONDecodeError:
|
||||||
return jsonify({"result": "not found"})
|
return jsonify({"result": "error", "message": "Something went wrong. Report that error please"})
|
||||||
|
|
||||||
return jsonify({"result": "not found"})
|
return jsonify({"result": "not found", "message": "Not found"})
|
||||||
|
|
||||||
|
|
||||||
@app.route("/<int:cid>/")
|
@app.route("/<int:cid>/")
|
||||||
|
|||||||
@@ -6,3 +6,7 @@
|
|||||||
.fox_active, .fox_atc_active {
|
.fox_active, .fox_atc_active {
|
||||||
background-color: #dee2e6 !important;
|
background-color: #dee2e6 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#notification_wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|||||||
+11
-3
@@ -2,8 +2,10 @@
|
|||||||
let userSession = {};
|
let userSession = {};
|
||||||
|
|
||||||
fetch(ATC_API_URL, {}).then(response => response.json()).then(result => {
|
fetch(ATC_API_URL, {}).then(response => response.json()).then(result => {
|
||||||
if (result && result["result"] == "not found")
|
if (result && (result["result"] == "not found" || result["result"] == "error")) {
|
||||||
return
|
showAlert("Error while getting ATC information", result["message"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (let session of result["items"]) {
|
for (let session of result["items"]) {
|
||||||
// Separate each session by it's connection ID
|
// Separate each session by it's connection ID
|
||||||
@@ -143,7 +145,7 @@ function showFlight(flight) {
|
|||||||
// Function to show ATC session
|
// Function to show ATC session
|
||||||
function showSession(session) {
|
function showSession(session) {
|
||||||
if (!session) return;
|
if (!session) return;
|
||||||
console.log(session);
|
|
||||||
$(".atc_callsign").text(session["connection_id"]["callsign"]);
|
$(".atc_callsign").text(session["connection_id"]["callsign"]);
|
||||||
$(".atc_start_time").text(session["connection_id"]["start"].replace("T", " "));
|
$(".atc_start_time").text(session["connection_id"]["start"].replace("T", " "));
|
||||||
$(".atc_end_time").text(session["connection_id"]["end"].replace("T", " "));
|
$(".atc_end_time").text(session["connection_id"]["end"].replace("T", " "));
|
||||||
@@ -153,3 +155,9 @@ function showSession(session) {
|
|||||||
$(".atc_transfers").text(session["handoffsinitiated"]);
|
$(".atc_transfers").text(session["handoffsinitiated"]);
|
||||||
$(".atc_received").text(session["handoffsreceived"]);
|
$(".atc_received").text(session["handoffsreceived"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showAlert(title, message) {
|
||||||
|
$("#notification_wrapper").css("display", "block");
|
||||||
|
$("#notification_title").text(title);
|
||||||
|
$("#notification_message").text(message);
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,7 +18,19 @@
|
|||||||
{% block header_css %}{% endblock %}
|
{% block header_css %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<style>
|
<style>
|
||||||
|
.btn-outline-primary:hover, .btn-outline-primary:active {
|
||||||
|
color: white !important;
|
||||||
|
background-color: var(--main-rgb) !important;
|
||||||
|
border-color: var(--main-rgb) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-outline-primary {
|
||||||
|
border-color: var(--main-rgb);
|
||||||
|
color: var(--main-rgb);
|
||||||
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
--main-rgb: #FA8232;
|
||||||
--bs-primary-rgb: 250, 130, 50
|
--bs-primary-rgb: 250, 130, 50
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<p class="col-md-8 fs-4">See your detailed profile statistic</p>
|
<p class="col-md-8 fs-4">See your detailed profile statistic</p>
|
||||||
<div class="d-flex" role="search">
|
<div class="d-flex" role="search">
|
||||||
<input class="fox_input form-control me-2" type="number" placeholder="100000" aria-label="CID">
|
<input class="fox_input form-control me-2" type="number" placeholder="100000" aria-label="CID">
|
||||||
<button class="fox_submit btn btn-outline-success" type="submit">Search</button>
|
<button class="fox_submit btn btn-outline-primary" type="submit">Search</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="fox_message text-primary col-md-8 fs-4"></p>
|
<p class="fox_message text-primary col-md-8 fs-4"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
|
<div id="notification_wrapper">
|
||||||
|
<div class="mb-4 alert alert-warning" role="alert">
|
||||||
|
<h4 id="notification_title"></h4>
|
||||||
|
<span id="notification_message"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2 class="text-center text-primary mb-4">{{user["id"]}}</h2>
|
<h2 class="text-center text-primary mb-4">{{user["id"]}}</h2>
|
||||||
<p class="fs-4 text-secondary">Date of registration: <span class="date_registration"></span></p>
|
<p class="fs-4 text-secondary">Date of registration: <span class="date_registration"></span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user