dashboard: refactor interface

This commit is contained in:
nemunaire 2018-12-04 05:34:34 +01:00
parent b9f1822a65
commit 3056a19d09
3 changed files with 35 additions and 18 deletions

View File

@ -304,7 +304,7 @@
<div class="carousel-inner"> <div class="carousel-inner">
<div class="carousel-item"> <div class="carousel-item">
<div class="carousel-caption"> <div class="carousel-caption">
<a href="http://www.epita.fr/"><img src="/img/epita.png" alt="Epita" style="max-height:14vh"></a> <a href="http://www.epita.fr/" class="mr-3"><img src="/img/epita.png" alt="Epita" style="max-height:14vh"></a>
<img src="/img/comcyber.png" alt="Réserves de cyberdéfense" style="height:14vh"> <img src="/img/comcyber.png" alt="Réserves de cyberdéfense" style="height:14vh">
</div> </div>
</div> </div>
@ -330,23 +330,23 @@
</div> </div>
</div> </div>
<div class="carousel-item"> <div class="carousel-item">
<div class="carousel-caption row" style="padding: 10px"> <div class="carousel-caption row" style="padding: 5px">
<div class="col-4"> <div class="col-4" style="padding-top: 4px;">
<a href="https://srs.epita.fr/"><img src="/img/srs.png" alt="Laboratoire SRS" style="height:12vh"></a> <a href="https://srs.epita.fr/"><img src="/img/srs.png" alt="Laboratoire SRS" style="max-width:100%; max-height:12vh"></a>
</div> </div>
<p class="col-8 text-bold" style="font-size: 111%"> <p class="col-8 text-bold" style="font-size: 110%">
Les challenges ont été réalisés par les étudiants de la Les challenges ont été réalisés par les étudiants de la
spécialisation SRS de l'Épita. spécialisation SRS de l'Épita.
</p> </p>
</div> </div>
</div> </div>
<div class="carousel-item"> <div class="carousel-item">
<div class="carousel-caption row" style="padding: 12px"> <div class="carousel-caption row" style="padding: 14px">
<div class="col-4"> <div class="col-4">
<img src="/img/rcc.png" alt="Réserves de cyberdéfense" style="max-width:100%; max-height: 11vh"> <img src="/img/comcyber.png" alt="Réserves de cyberdéfense" style="max-width:100%; max-height: 11vh">
</div> </div>
<p class="col-8 text-bold" style="padding: 10px 10px 10px 0; font-size: 111%"> <p class="col-8 text-bold" style="padding: 3px 5px 10px 0; font-size: 111%">
Avec le parrainage des réserves de cyberdéfense Avec le parrainage du commandement de la cyberdéfense française
</p> </p>
</div> </div>
</div> </div>

View File

@ -69,9 +69,11 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
.controller("DataController", function($scope, $http, $rootScope, $interval) { .controller("DataController", function($scope, $http, $rootScope, $interval) {
var pathname = window.location.pathname; var pathname = window.location.pathname;
if (pathname == "/") if (pathname == "/")
pathname = "/public0.html" pathname = "/public0.html";
pathname = pathname.replace(".html", ".json");
var refreshScene = function() { var refreshScene = function() {
$http.get(pathname.replace(".html", ".json")).then(function(response) { $http.get(pathname).then(function(response) {
if ($scope.lastpublicetag != undefined && $scope.lastpublicetag == response.headers()["last-modified"]) if ($scope.lastpublicetag != undefined && $scope.lastpublicetag == response.headers()["last-modified"])
return; return;
$scope.lastpublicetag = response.headers()["last-modified"]; $scope.lastpublicetag = response.headers()["last-modified"];
@ -79,7 +81,24 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.scene = response.data; $scope.scene = response.data;
}); });
} }
var refreshData = function() { refreshScene();
var refreshSceneInterval = $interval(refreshScene, 900);
var refreshSettings = function() {
$http.get("/settings.json").then(function(response) {
$rootScope.recvTime(response);
response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end);
response.data.generation = new Date(response.data.generation);
response.data.awards = new Date("2019-01-23T15:00:00Z");
$rootScope.settings = response.data;
});
}
refreshSettings();
var refreshSettingsInterval = $interval(refreshSettings, 4200);
$rootScope.refresh = function() {
$http.get("/my.json").then(function(response) { $http.get("/my.json").then(function(response) {
if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"]) if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"])
return; return;
@ -138,10 +157,8 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.pagesrank = Array(Math.ceil($scope.rank.length / 7)).fill(0).map(function(v, i){ return i; }); $scope.pagesrank = Array(Math.ceil($scope.rank.length / 7)).fill(0).map(function(v, i){ return i; });
}); });
} }
refreshData(); $rootScope.refresh();
refreshScene(); $interval($rootScope.refresh, 4200);
$interval(refreshData, 4200);
$interval(refreshScene, 900);
}) })
.controller("TeamController", function($scope, $http, $interval) { .controller("TeamController", function($scope, $http, $interval) {
$scope.mystats = null; $scope.mystats = null;

View File

@ -149,10 +149,10 @@ angular.module("FICApp")
$scope.time = {}; $scope.time = {};
return return
} else if ($rootScope.settings.start > srv_cur) { } else if ($rootScope.settings.start > srv_cur) {
$rootScope.startIn = Math.floor(($rootScope.settings.start - srv_cur) / 1000); $scope.startIn = Math.floor(($rootScope.settings.start - srv_cur) / 1000);
remain = $rootScope.settings.end - $rootScope.settings.start; remain = $rootScope.settings.end - $rootScope.settings.start;
} else if ($rootScope.settings.end > srv_cur) { } else if ($rootScope.settings.end > srv_cur) {
$rootScope.startIn = 0; $scope.startIn = 0;
remain = $rootScope.settings.end - srv_cur; remain = $rootScope.settings.end - srv_cur;
} }