admin: Add setting to differenciate real challenge from common tests

This commit is contained in:
nemunaire 2022-01-21 09:07:27 +01:00
parent 252ff33b83
commit 15c85c8f59
5 changed files with 23 additions and 6 deletions

View File

@ -45,7 +45,12 @@ func getROSettings(_ httprouter.Params, body []byte) (interface{}, error) {
}
func getSettings(_ httprouter.Params, body []byte) (interface{}, error) {
return settings.ReadSettings(path.Join(settings.SettingsDir, settings.SettingsFile))
if s, err := settings.ReadSettings(path.Join(settings.SettingsDir, settings.SettingsFile)); err != nil {
return nil, err
} else {
s.WorkInProgress = !IsProductionEnv
return s, nil
}
}
func saveSettings(_ httprouter.Params, body []byte) (interface{}, error) {
@ -81,6 +86,7 @@ func ResetSettings() error {
return settings.SaveSettings(path.Join(settings.SettingsDir, settings.SettingsFile), settings.FICSettings{
Title: "Challenge FIC",
Authors: "Laboratoire SRS, ÉPITA",
WorkInProgress: IsProductionEnv,
FirstBlood: fic.FirstBlood,
SubmissionCostBase: fic.SubmissionCostBase,
ExerciceCurCoefficient: 1,

View File

@ -66,7 +66,7 @@ const indextpl = `<!DOCTYPE html>
<script src="js/d3.v3.min.js"></script>
</head>
<body class="bg-light text-dark">
<nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark text-light">
<nav class="navbar sticky-top navbar-expand-lg navbar-dark text-light" ng-class="{'bg-dark': settings.wip, 'bg-danger': !settings.wip}">
<a class="navbar-brand" href=".">
<img alt="FIC" src="img/fic.png" style="height: 30px">
</a>
@ -88,7 +88,16 @@ const indextpl = `<!DOCTYPE html>
<span class="badge badge-{{ "{{ priorities[myClaimsMaxLevel] }}" }}" ng-show="myClaims">{{ "{{ myClaims }}" }}</span>
<span class="badge badge-{{ "{{ priorities[newClaimsMaxLevel] }}" }}" ng-show="newClaims">{{ "{{ newClaims }}" }}</span>
</a></li>
<li class="nav-item"><a class="nav-link" href="settings">Paramètres</a></li>
<li class="nav-item">
<a class="nav-link" href="settings">
Paramètres
</a>
</li>
<span class="d-flex flex-column justify-content-center" ng-show="!settings.wip" ng-cloak>
<span class="badge badge-light p-1">
prod
</span>
</span>
</ul>
</div>

View File

@ -229,7 +229,7 @@
</div>
</form>
<div class="card mb-5" ng-show="timeProgression && !displayDangerousActions">
<div class="card mb-5" ng-show="!config.wip && timeProgression && !displayDangerousActions">
<div class="card-header bg-secondary text-light">
Synchronisation et suppressions de masse
</div>
@ -243,7 +243,7 @@
</div>
</div>
<div class="row mb-5" ng-show="!timeProgression || displayDangerousActions">
<div class="row mb-5" ng-show="config.wip || !timeProgression || displayDangerousActions">
<div class="col-8 card text-light bg-dark">
<div class="card-body">
<dl class="row">

View File

@ -159,7 +159,7 @@ services:
- /var/lib/fic/backups
- name: fic-admin
image: nemunaire/fic-admin:latest
command: ["/srv/admin", "-bind=:8081", "-baseurl=/admin/", "-localimport=/mnt/fic", "-timestampCheck=/srv/submissions"]
command: ["/srv/admin", "-4real", "-bind=:8081", "-baseurl=/admin/", "-localimport=/mnt/fic", "-timestampCheck=/srv/submissions"]
env:
- MYSQL_HOST=db
- FICCA_PASS=jee8AhloAith1aesCeQu5ahgIegaeM4K

View File

@ -28,6 +28,8 @@ type FICSettings struct {
Authors string `json:"authors"`
// VideoLink is the link to explaination videos when the challenge is over.
VideosLink string `json:"videoslink"`
// WorkInProgress indicates if the current challenge is under development or if it is in production.
WorkInProgress bool `json:"wip,omitempty"`
// Start is the departure time (expected or effective).
Start time.Time `json:"start"`