dashboard: some improvements

This commit is contained in:
nemunaire 2019-01-19 03:08:07 +01:00
parent 8190bbfdc0
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">

View File

@ -199,6 +199,7 @@ services:
binds:
- /etc/hosts:/etc/hosts:ro
- /var/lib/fic/dashboard:/srv/DASHBOARD
- /var/lib/fic/files:/srv/FILES:ro
- /var/lib/fic/teams:/srv/TEAMS:ro
- /var/lib/fic/settings:/srv/SETTINGS:ro
net: /run/netns/fic-admin

View File

@ -19,6 +19,10 @@
font-style: normal;
}
b, strong {
font-weight: bold;
}
[ng-cloak] {
display:none !important;
}
@ -38,6 +42,11 @@ body {
height: 100vh;
}
.bg-public .carousel h3 {
font-size: 1.5rem;
line-height: 1.1rem;
}
.flag {
font-family: 'FantasqueSansMonoRegular', monospace;
}
@ -272,6 +281,8 @@ blockquote {
margin-left: -1em;
padding-left: 2em;
padding-right: 2em;
}
img {
max-width: 100%;
}
@ -286,6 +297,26 @@ blockquote {
padding-bottom:0;
}
#themesSummary {
margin-bottom: 7px;
}
#themesSummary .card-body {
padding:0;
}
#themesSummary h3 {
background: rgba(64,64,64,0.66);
border-radius: 2px;
padding: 0.5rem;
margin-left: 0.5rem;
margin-right: 0.5rem;
margin-top: -40px;
}
#themesSummary p {
font-size: 90%;
margin: 0.2rem;
text-indent: 0.6em;
}
.card-sm .card-header, .card-sm .card-footer {
padding: 0.2rem 0.75rem;
}