Ajout de styles pour le titre global, mise à jour des marges dans le conteneur vidéo, ajout de contrôles pour le nombre total d'images, et refactorisation des appels AJAX pour une meilleure gestion des erreurs.
All checks were successful
SSH Frontend Deploy / ssh-deploy (push) Successful in 6s

This commit is contained in:
arussac
2025-04-26 17:30:00 +02:00
parent 70de3e2f5c
commit 325ccdc330
8 changed files with 46 additions and 31 deletions

View File

@@ -439,3 +439,8 @@ footer {
width: 40vw; width: 40vw;
} }
} }
.global_title_h1 {
color: white;
font-size: 10vh;
}

View File

@@ -19,8 +19,10 @@
} }
.video_placeHolder { .video_placeHolder {
width: 100%; margin-left: 3vw;
margin-top: 10px; margin-top: 10px;
margin-bottom: 5vh;
width: 93%;
} }
.box { .box {

View File

@@ -3,10 +3,10 @@ services:
image: nginx:latest image: nginx:latest
container_name: timelapse-frontend container_name: timelapse-frontend
ports: ports:
- "80:80" - "8093:80"
- "443:443" - "16443:443"
volumes: volumes:
- ./:/usr/share/nginx/html - /home/timelapse/nginx:/usr/share/nginx/html
- nginx-config:/etc/nginx - nginx-config:/etc/nginx
environment: environment:
- NGINX_VERSION=1.27.1 - NGINX_VERSION=1.27.1
@@ -17,6 +17,7 @@ services:
restart: always restart: always
networks: networks:
- bridge - bridge
- timelapse_network
volumes: volumes:
nginx-config: nginx-config:
@@ -25,3 +26,5 @@ volumes:
networks: networks:
bridge: bridge:
driver: bridge driver: bridge
timelapse_network:
driver: bridge

View File

@@ -97,6 +97,12 @@
<input type="number" id="minutes" name="minutes" value="0" min="0" oninput="updateFrequencyText()"> <input type="number" id="minutes" name="minutes" value="0" min="0" oninput="updateFrequencyText()">
<button class="default-access-button" type="button" onclick="increment('minutes')">+</button> <button class="default-access-button" type="button" onclick="increment('minutes')">+</button>
</div> </div>
<div class="frequency-control">
<label for="minutes">Total d'images:</label>
<button class="default-access-button" type="button" onclick="decrementImage('totalImages')">-</button>
<input type="number" id="totalImages" name="totalImages" value="1" min="1">
<button class="default-access-button" type="button" onclick="increment('totalImages')">+</button>
</div>
<span id="frequency-text">une image sera prise toutes les 0 jours 0 heures 0 minutes</span> <span id="frequency-text">une image sera prise toutes les 0 jours 0 heures 0 minutes</span>
<br> <br>
<button id="commencer" class="default-access-button">Lancer</button> <button id="commencer" class="default-access-button">Lancer</button>

View File

@@ -40,7 +40,6 @@
</div> </div>
<div> <div>
<div id="title-global"> <div id="title-global">
<h1 id="h1-title" class="global_title">Caméra Timelapse</h1>
<div id="ball"></div> <div id="ball"></div>
<p id="xyz" style="display: none;">Caméra Timelapse</p> <p id="xyz" style="display: none;">Caméra Timelapse</p>
</div> </div>

View File

@@ -164,7 +164,7 @@ function handleResize() {
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
function isMobileDevice() { function isMobileDevice() {
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera); return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera ) || document.documentElement.clientWidth / document.documentElement.clientHeight < 1;
} }
window.addEventListener('DOMContentLoaded', (event) => { window.addEventListener('DOMContentLoaded', (event) => {
@@ -178,7 +178,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
}); });
const newH1 = document.createElement('h1'); const newH1 = document.createElement('h1');
newH1.textContent = "Caméra Timelapse sur mobile, utilisez l'app !!!"; newH1.textContent = "Caméra Timelapse sur mobile, utilisez l'app !!!";
newH1.classList.add('global_title'); newH1.classList.add('global_title_h1');
body.appendChild(newH1); body.appendChild(newH1);
} }
}); });
@@ -195,7 +195,6 @@ function change_title_style() {
titlePlaceHolder.classList.add('container-title'); titlePlaceHolder.classList.add('container-title');
ball.style.display = 'block'; ball.style.display = 'block';
xyz.style.display = 'block'; xyz.style.display = 'block';
h1_title.style.display = 'none';
} else { } else {
titleIsReadable = true; titleIsReadable = true;
titlePlaceHolder.classList.remove('container-title'); titlePlaceHolder.classList.remove('container-title');

View File

@@ -4889,7 +4889,6 @@
try { try {
(h = !1), c.send(a, l); (h = !1), c.send(a, l);
} catch (e) { } catch (e) {
if (h) throw e;
l(-1, e); l(-1, e);
} }
} else l(-1, "No Transport"); } else l(-1, "No Transport");
@@ -5176,7 +5175,9 @@
try { try {
r.send((i.hasContent && i.data) || null); r.send((i.hasContent && i.data) || null);
} catch (e) { } catch (e) {
if (o) throw e; // Do nothing or handle the error silently
// Remove or comment out the console.log statement
// if (o) console.log('error');
} }
}, },
abort: function () { abort: function () {

View File

@@ -39,16 +39,18 @@ function getSingleProject(id) {
}); });
} }
function getDataMetrics(projectId){ async function getDataMetrics(projectId){
return $.ajax({ try {
const response = await $.ajax({
url: api_url.concat(`/projects/${projectId}/measurements`), url: api_url.concat(`/projects/${projectId}/measurements`),
method: "GET", method: "GET",
dataType: "json", dataType: "json",
}).then((data) => {
// If the request is successful, store the data in the cache and return it
localStorage.setItem("project_list", JSON.stringify(data));
return data;
}); });
return response;
} catch (error) {
console.log("no data for this project")
return error.status;
}
} }
@@ -62,8 +64,7 @@ async function getDataProjectVideosFromApi(id) {
// If the request is successful, store the data in the cache and return it // If the request is successful, store the data in the cache and return it
return response; return response;
} catch (error) { } catch (error) {
alert("Error fetching data:", error); return(error.status)
throw error; // Re-throw the error to handle it outside the function if needed
} }
} }
@@ -181,15 +182,15 @@ async function renderVideo(id){
} }
} }
async function start_timelapse(id,frequency){ async function start_timelapse(id,frequency,nbimages){
try { try {
const mydata = JSON.stringify({ const mydata = JSON.stringify({
projectId: id, projectId: id,
interval: frequency interval: frequency,
nb_images: nbimages
}); });
const response = await $.ajax({ const response = await $.ajax({
url: api_url.concat(`/procedure/start/`), url: api_url.concat(`/procedure/start`),
method: "POST", method: "POST",
dataType: "json", dataType: "json",
contentType: "application/json", contentType: "application/json",
@@ -198,7 +199,6 @@ async function start_timelapse(id,frequency){
alert("data retrieval started:", response); alert("data retrieval started:", response);
} catch (error) { } catch (error) {
alert("Error starting the retrieval:", error);
throw error; throw error;
} }
} }