dashboard: some improvements

This commit is contained in:
nemunaire 2019-01-19 03:08:07 +01:00
commit 196f10dc9f
5 changed files with 43 additions and 4 deletions

View file

@ -68,6 +68,7 @@ func main() {
var bind = flag.String("bind", "127.0.0.1:8082", "Bind port/socket")
var baseURL = flag.String("baseurl", "/", "URL prepended to each URL")
flag.StringVar(&StaticDir, "static", "./htdocs-dashboard/", "Directory containing static files")
flag.StringVar(&fic.FilesDir, "files", fic.FilesDir, "Base directory where found challenges files, local part")
flag.StringVar(&DashboardDir, "dashbord", "./DASHBOARD", "Base directory where save public JSON files")
flag.StringVar(&TeamsDir, "teams", "./TEAMS", "Base directory where save teams JSON files")
flag.StringVar(&settings.SettingsDir, "settings", settings.SettingsDir, "Base directory where load and save settings")

View file

@ -4,9 +4,11 @@ import (
"fmt"
"net/http"
"path"
"strings"
"time"
"srs.epita.fr/fic-server/dashboard/api"
"srs.epita.fr/fic-server/libfic"
"srs.epita.fr/fic-server/settings"
"github.com/julienschmidt/httprouter"
@ -33,6 +35,10 @@ func init() {
http.ServeFile(w, r, path.Join(StaticDir, r.URL.Path))
})
api.Router().GET("/files/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(fic.FilesDir, strings.TrimPrefix(r.URL.Path, "/files")))
})
api.Router().GET("/events.json", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
w.Header().Set("Cache-Control", "no-cache")
http.ServeFile(w, r, path.Join(TeamsDir, "events.json"))

View file

@ -140,7 +140,7 @@
</tbody>
<tfoot ng-if="s.params.total" ng-init="team={id:0}">
<tr ng-controller="TeamController">
<td class="text-right text-dark">
<td class="text-right text-light">
<span ng-if="s.params.kind == 'levels'">Résolus</span>
<span ng-if="s.params.kind == 'teams'">Total résolus</span><br>
Tentatives
@ -180,7 +180,7 @@
</div>
<div class="card-body bg-dark">
<div class="carousel slide" data-interval="30000" style="height: 270px" autocarousel ng-if="s.params.kind == 'themes'">
<div class="carousel slide" data-interval="30000" style="min-height: 270px" autocarousel ng-if="s.params.kind == 'themes'">
<ol class="carousel-indicators">
<li data-slide-to="{{k}}" ng-repeat="(k, theme) in themes" ng-class="{active: $first}"></li>
</ol>
@ -195,7 +195,7 @@
</div>
</div>
<div class="carousel slide" data-interval="7000" style="height: 100px" autocarousel ng-if="s.params.kind == 'teams'">
<div class="carousel slide" data-interval="7000" style="min-height: 100px" autocarousel ng-if="s.params.kind == 'teams'">
<ol class="carousel-indicators">
<li data-slide-to="{{k}}" ng-repeat="(k, team) in teams" ng-class="{active: $first}" ng-if="team.rank"></li>
</ol>
@ -212,7 +212,7 @@
</div>
</div>
<div class="carousel slide" data-interval="10000" style="height: 260px" autocarousel ng-if="s.params.kind == 'ranking'">
<div class="carousel slide" data-interval="10000" style="margin: -1rem; height: 260px" autocarousel ng-if="s.params.kind == 'ranking'">
<div class="carousel-inner">
<div class="carousel-item" ng-repeat="(i,t) in pagesrank" ng-class="{active: $first}">
<div class="carousel-caption">