qol changes
parent
b6156ae81d
commit
dea50dc3b6
|
|
@ -0,0 +1,2 @@
|
|||
Заготовки под финал умного города 2023/2024
|
||||
===========================================
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[
|
||||
{
|
||||
"username": "1",
|
||||
"password": "6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mashinka Control</title>
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<!-- Google Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">
|
||||
<!-- MDB -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/7.1.0/mdb.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">Seal Team: Авторизация</a>
|
||||
<span class="navbar-buttons">
|
||||
<div class="d-flex align-items-center">
|
||||
<button data-mdb-ripple-init type="button" class="btn btn-primary me-3">
|
||||
Авторизация
|
||||
</button>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="d-flex justify-content-center mt-5">
|
||||
<form class="mr-3" action="login" method="post">
|
||||
<div class="form-outline" data-mdb-input-init>
|
||||
<input required id="login" name="login" type="text" id="formControlLg" class="form-control form-control-lg" />
|
||||
<label class="form-label" for="formControlLg">Имя пользователя</label>
|
||||
</div>
|
||||
<p></p>
|
||||
<div class="form-outline" data-mdb-input-init>
|
||||
<input required id="password" name="password" type="password" id="formControlLg" class="form-control form-control-lg" />
|
||||
<label class="form-label" for="formControlLg">Пароль</label>
|
||||
</div>
|
||||
<p></p>
|
||||
<button type="submit" class="btn btn-primary btn-lg ml-3">Авторизация</button>
|
||||
</form>
|
||||
{% if err != '' %}
|
||||
<p><h3>{{err}}</h3></p>
|
||||
{% endif%}
|
||||
</div>
|
||||
|
||||
<!-- MDB -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/7.1.0/mdb.umd.min.js"></script>
|
||||
<!--Script-->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mashinka Control</title>
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<!-- Google Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">
|
||||
<!-- MDB -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/7.1.0/mdb.min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">Seal Team: Регистрация</a>
|
||||
<span class="navbar-buttons">
|
||||
<div class="d-flex align-items-center">
|
||||
<button data-mdb-ripple-init type="button" class="btn btn-primary me-3">
|
||||
Авторизация
|
||||
</button>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="d-flex justify-content-center mt-5">
|
||||
<form class="mr-3" action="register" method="post">
|
||||
<div class="form-outline" data-mdb-input-init>
|
||||
<input required id="login" name="login" type="text" id="formControlLg" class="form-control form-control-lg" />
|
||||
<label class="form-label" for="formControlLg">Имя пользователя</label>
|
||||
</div>
|
||||
<p></p>
|
||||
<div class="form-outline" data-mdb-input-init>
|
||||
<input required id="password" name="password" type="password" id="formControlLg" class="form-control form-control-lg" />
|
||||
<label class="form-label" for="formControlLg">Пароль</label>
|
||||
</div>
|
||||
<p></p>
|
||||
<button type="submit" class="btn btn-primary btn-lg ml-3">Регистрация</button>
|
||||
</form>
|
||||
{% if err != '' %}
|
||||
<p><h3>{{err}}</h3></p>
|
||||
{% endif%}
|
||||
</div>
|
||||
|
||||
<!-- MDB -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/7.1.0/mdb.umd.min.js"></script>
|
||||
<!--Script-->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mashinka Control</title>
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<!-- Google Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">
|
||||
<!-- MDB -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">Seal Team</a>
|
||||
<span class="navbar-text">
|
||||
Недостаточно прав
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class=alertContainer id="alertcontainer"></div>
|
||||
<center><h1>Вы не авторизированы</h1></center>
|
||||
<div class="d-flex justify-content-center mt-5">
|
||||
<button class="btn btn-primary btn-lg mr-3" class="update_form" type="button" onclick="document.location.href = '/login'">Авторизация</button>
|
||||
|
||||
<button class="btn btn-primary btn-lg ml-3" class="update_form" type="button" onclick="document.location.href = '/register'">Регистрация</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- MDB -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
||||
<!--Script-->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
<script>
|
||||
function callSOSCheckEndpoint() {
|
||||
setInterval(function() {
|
||||
$.ajax({
|
||||
url: '/sos_check',
|
||||
method: 'POST',
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
console.log(data);
|
||||
var alertHTML = '<div class="alert alert-success alert-dismissible fade show" role="alert">'
|
||||
var alertMessages = [];
|
||||
|
||||
// Iterate over the returned data
|
||||
data.forEach(function(alertt) {
|
||||
var statname = alertt["stationName"];
|
||||
var sosAlertType = alertt["alertType"];
|
||||
var alertMessage = 'SOS ALERT ON THIS STATIONS: ' + statname + ':' + sosAlertType;
|
||||
alertMessages.push(alertMessage);
|
||||
});
|
||||
alertMessages.forEach(function(alertMessage) {
|
||||
alertHTML += '<div class="alert alert-warning">' + alertMessage + '</div>';
|
||||
});
|
||||
alertHTML += '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'
|
||||
var x = document.getElementById("alertcontainer");
|
||||
x.innerHTML = alertHTML;
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 10000);
|
||||
}
|
||||
callSOSCheckEndpoint();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// this is the id of the submit button
|
||||
$(".update_form").click(function() {
|
||||
var myform = $(this).closest("form"); //parent form
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "approve_test.php",
|
||||
data: myform.serialize(), // serializes the form's elements.
|
||||
success: function(data)
|
||||
{
|
||||
alert(data); // show response from the php script.
|
||||
}
|
||||
});
|
||||
|
||||
return false; // avoid to execute the actual submit of the form.
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<div class="container">
|
||||
<a class="navbar-brand" href="#">Seal Team</a>
|
||||
<span class="navbar-text">
|
||||
Управление машинкой
|
||||
Недостаточно прав
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
|||
81
test.py
81
test.py
|
|
@ -1,81 +0,0 @@
|
|||
from flask import Flask, request, redirect, url_for, render_template, json, render_template_string, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/', methods=['GET', 'POST'])
|
||||
def control_panel():
|
||||
print('request.form:', request.form)
|
||||
|
||||
if request.method == 'POST':
|
||||
if request.form.get('button') == 'button-play':
|
||||
print("play button pressed")
|
||||
|
||||
elif request.form.get('button') == 'button-exit':
|
||||
print("exit button pressed")
|
||||
|
||||
elif request.form.get('slide'):
|
||||
volume = request.form.get('slide')
|
||||
print('volume:', volume)
|
||||
#return jsonify({'volume': volume})
|
||||
return json.dumps({'volume': volume})
|
||||
|
||||
print('render')
|
||||
return render_template_string('''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
|
||||
|
||||
<title>Slider</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" id="control_panel_1">
|
||||
<form action="/" method ="post" enctype="multipart/form-data" id="form">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-primary" button type="submit" name="button" value="button-play">PLAY</button>
|
||||
|
||||
<button class="btn btn-primary" button type="submit" name="button" value="button-exit">EXIT</button>
|
||||
|
||||
<input id="slide" type="range" min="1" max="100" step="1" value="10" name="slide">
|
||||
<div id="sliderAmount"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!--- SCRIPTS --->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
<script>
|
||||
var slide = document.getElementById('slide'),
|
||||
sliderDiv = document.getElementById("sliderAmount");
|
||||
|
||||
slide.onchange = function() {
|
||||
sliderDiv.innerHTML = this.value;
|
||||
$.post({
|
||||
url: '/',
|
||||
data: $('form').serialize(),
|
||||
success: function(response){
|
||||
alert(response);
|
||||
alert(response.volume); // works with jsonify()
|
||||
alert(JSON.parse(response).volume); // works with json.dumps()
|
||||
console.log(response);
|
||||
},
|
||||
error: function(error){
|
||||
alert(response);
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</html>''')
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, use_reloader=False)
|
||||
Loading…
Reference in New Issue