Premiers tests d'implementation des APIs

This commit is contained in:
bglacial 2019-04-17 00:09:49 +02:00
parent 0bc2f2ed69
commit 3c0da323f8
2 changed files with 61 additions and 12 deletions

View File

@ -214,7 +214,8 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h4>Relai en cours : <label id="pilot-ock1"> Nicolas</label></h4> <h4>Relay in progress : <label id="pilot-ock1"> Nicolas</label> - <label
id="time-pilot-ock1">37:55</label></h4>
<div class="progress"> <div class="progress">
<div class="progress-bar" role="progressbar" style="width: 79%" aria-valuenow="79" <div class="progress-bar" role="progressbar" style="width: 79%" aria-valuenow="79"
@ -256,8 +257,8 @@
<thead> <thead>
<tr> <tr>
<th>N°.</th> <th>N°.</th>
<th>Temp</th> <th>Chrono time</th>
<th>Heure</th> <th>Time</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -293,7 +294,8 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h4>Relai en cours : <label id="pilot-ock2"> Nicolas</label></h4> <h4>Relay in progress : <label id="pilot-ock2"> Nicolas</label> - <label
id="time-pilot-ock2">37:55</label></h4>
<div class="progress"> <div class="progress">
<div class="progress-bar" role="progressbar" style="width: 79%" aria-valuenow="79" <div class="progress-bar" role="progressbar" style="width: 79%" aria-valuenow="79"
@ -335,8 +337,8 @@
<thead> <thead>
<tr> <tr>
<th>N°.</th> <th>N°.</th>
<th>Temp</th> <th>Chrono time</th>
<th>Heure</th> <th>Time</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -366,13 +368,14 @@
</div> </div>
<div class="card shadow mb-4 dashboard-all"> <div class="card shadow mb-4 dashboard-all">
<div class="card-header py-3"> <div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Race params - OCK 1</h6> <h6 class="m-0 font-weight-bold text-primary">Race params - OCK 3</h6>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h4>Relai en cours : <label id="pilot-ock3"> Nicolas</label></h4> <h4>Relay in progress : <label id="pilot-ock3"> Nicolas</label> - <label
id="time-pilot-ock3">37:55</label></h4>
<div class="progress"> <div class="progress">
<div class="progress-bar" role="progressbar" style="width: 79%" aria-valuenow="79" <div class="progress-bar" role="progressbar" style="width: 79%" aria-valuenow="79"
@ -414,8 +417,8 @@
<thead> <thead>
<tr> <tr>
<th>N°.</th> <th>N°.</th>
<th>Temp</th> <th>Chrono time</th>
<th>Heure</th> <th>Time</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -479,13 +482,15 @@
<!-- Custom scripts for all pages--> <!-- Custom scripts for all pages-->
<script src="js/sb-admin-2.min.js"></script> <script src="js/sb-admin-2.min.js"></script>
<script src="js/timelaps.js?version=1"></script>
<!-- Page level plugins --> <!-- Page level plugins -->
<script src="vendor/chart.js/Chart.min.js"></script> <script src="vendor/chart.js/Chart.min.js"></script>
<!-- Page level custom scripts --> <!-- Page level custom scripts -->
<script src="js/demo/chart-area-demo.js"></script> <script>
<script src="js/demo/chart-pie-demo.js"></script>
</script>
</body> </body>

44
js/timelaps.js Normal file
View File

@ -0,0 +1,44 @@
var api_url = 'http://127.0.0.1:8000/api/v1/';
function getParams() {
}
function getKarts() {
console.log("getKarts");
$.ajax({
type: 'GET',
crossDomain: true,
url: api_url + 'karts/',
dataType: 'json',
success : function(data, status){ // code_html contient le HTML renvoyé
console.log("OK!");
console.log(data);
console.log(status);
},
error : function(data, status){ // code_html contient le HTML renvoyé
console.log("KO!");
console.log(data);
console.log(status);
},
});
/*
$.get(api_url + 'karts', function (data, status) {
console.log("OK!");
console.log(data);
console.log(status);
});
*/
}
function getPilotsByKart() {
}
$(document).ready(function () {
console.log("ready!");
getKarts();
});