settings: Can disable all submission button for maintenance
This commit is contained in:
parent
329bd246c7
commit
e9dd35f8ac
@ -529,6 +529,7 @@ angular.module("FICApp")
|
||||
$scope.config[k] = ns.values[k];
|
||||
});
|
||||
$scope.config.enableExerciceDepend = $scope.config.unlockedChallengeDepth >= 0;
|
||||
$scope.config.disabledsubmitbutton = $scope.config.disablesubmitbutton && $scope.config.disablesubmitbutton.length > 0;
|
||||
}
|
||||
$scope.deleteNextSettings = function(ns) {
|
||||
ns.$delete().then(function() {
|
||||
@ -542,6 +543,7 @@ angular.module("FICApp")
|
||||
$scope.config.$promise.then(function(response) {
|
||||
$scope.dist_config = Object.assign({}, response);
|
||||
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
|
||||
response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0;
|
||||
$rootScope.settings.start = new Date(response.start);
|
||||
$rootScope.settings.end = new Date(response.end);
|
||||
$rootScope.settings.generation = new Date(response.generation);
|
||||
@ -562,6 +564,13 @@ angular.module("FICApp")
|
||||
$scope.config.unlockedChallengeDepth = -1;
|
||||
};
|
||||
|
||||
$scope.submitButtonStateChange = function() {
|
||||
if ($scope.config.disabledsubmitbutton)
|
||||
$scope.config.disablesubmitbutton = "Mise à jour en cours...";
|
||||
else
|
||||
$scope.config.disablesubmitbutton = "";
|
||||
};
|
||||
|
||||
$scope.saveChallengeInfo = function() {
|
||||
this.challenge.duration = $scope.duration;
|
||||
this.challenge.$update(function(response) {
|
||||
@ -577,6 +586,7 @@ angular.module("FICApp")
|
||||
var nGen = this.config.generation;
|
||||
var state = this.config.enableExerciceDepend;
|
||||
this.config.unlockedChallengeDepth = (this.config.enableExerciceDepend?this.config.unlockedChallengeDepth:-1)
|
||||
this.config.disablesubmitbutton = (this.config.disabledsubmitbutton?this.config.disablesubmitbutton:'')
|
||||
var updateQuery = {};
|
||||
if (this.activateTime && this.activateTime != '0001-01-01T00:00:00Z') {
|
||||
updateQuery['t'] = this.activateTime;
|
||||
@ -590,6 +600,7 @@ angular.module("FICApp")
|
||||
$scope.addToast('success', msg);
|
||||
$scope.nextsettings = NextSettings.query();
|
||||
response.enableExerciceDepend = response.unlockedChallengeDepth >= 0;
|
||||
response.disabledsubmitbutton = response.disablesubmitbutton && response.disablesubmitbutton.length > 0;
|
||||
$rootScope.settings.start = new Date(nStart);
|
||||
$rootScope.settings.end = new Date(nEnd);
|
||||
$rootScope.settings.generation = new Date(nGen);
|
||||
|
@ -158,16 +158,16 @@
|
||||
|
||||
<div class="form-check">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" ng-model="config.partialValidation">
|
||||
<span class="custom-control-label" ng-class="{'text-primary font-weight-bold': !config.partialValidation != !dist_config.partialValidation}">Activer la validation partielle des challenges</span>
|
||||
<input class="custom-control-input" type="checkbox" ng-model="config.enableExerciceDepend" ng-change="exerciceDependChange()">
|
||||
<span class="custom-control-label" ng-class="{'text-primary font-weight-bold': config.unlockedChallengeDepth != dist_config.unlockedChallengeDepth}">Activer les dépendances des exercices</span>
|
||||
<input type="number" class="form-control form-control-sm" ng-model="config.unlockedChallengeDepth" ng-disabled="!config.enableExerciceDepend" title="-1 : Désactivé ; 0: activé ; 1,2,3 : débloque 1,2,3,... exercices supplémentaires après un challenge validé" min="0" integer ng-class="{'border-primary': config.unlockedChallengeDepth != dist_config.unlockedChallengeDepth}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" ng-model="config.enableExerciceDepend" ng-change="exerciceDependChange()">
|
||||
<span class="custom-control-label" ng-class="{'text-primary font-weight-bold': config.unlockedChallengeDepth != dist_config.unlockedChallengeDepth}">Activer les dépendances des exercices</span>
|
||||
<input type="number" class="form-control form-control-sm" ng-model="config.unlockedChallengeDepth" ng-disabled="!config.enableExerciceDepend" title="-1 : Désactivé ; 0: activé ; 1,2,3 : débloque 1,2,3,... exercices supplémentaires après un challenge validé" min="0" integer ng-class="{'border-primary': config.unlockedChallengeDepth != dist_config.unlockedChallengeDepth}">
|
||||
<input class="custom-control-input" type="checkbox" ng-model="config.partialValidation">
|
||||
<span class="custom-control-label" ng-class="{'text-primary font-weight-bold': !config.partialValidation != !dist_config.partialValidation}">Activer la validation partielle des challenges</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -206,6 +206,14 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox"ng-model="config.disabledsubmitbutton" ng-change="submitButtonStateChange()">
|
||||
<span class="custom-control-label" ng-class="{'text-primary font-weight-bold': !config.disablesubmitbutton != !dist_config.disablesubmitbutton}">Désactiver les boutons de soumission (pour indiquer une indisponibilité)</span>
|
||||
<input class="form-control form-control-sm" ng-model="config.disablesubmitbutton" ng-disabled="!config.disabledsubmitbutton" title="Message qui sera indiqué aux participants" ng-class="{'border-primary': !config.disablesubmitbutton != !dist_config.disablesubmitbutton}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -10,11 +10,13 @@
|
||||
ListGroupItem,
|
||||
Progress,
|
||||
Spinner,
|
||||
Tooltip,
|
||||
} from 'sveltestrap';
|
||||
|
||||
import { blake2b } from 'hash-wasm';
|
||||
|
||||
import { my } from '../stores/my.js';
|
||||
import { settings } from '../stores/settings.js';
|
||||
|
||||
import DateFormat from './DateFormat.svelte';
|
||||
import FlagKey from './FlagKey.svelte';
|
||||
@ -224,13 +226,17 @@
|
||||
<Button
|
||||
type="submit"
|
||||
color="danger"
|
||||
disabled={submitInProgress}
|
||||
id="submission-{exercice.id}"
|
||||
disabled={submitInProgress || $settings.disablesubmitbutton}
|
||||
>
|
||||
{#if submitInProgress}
|
||||
<Spinner size="sm" class="me-2" />
|
||||
{/if}
|
||||
Soumettre
|
||||
</Button>
|
||||
{#if $settings.disablesubmitbutton}
|
||||
<span class="text-muted">{$settings.disablesubmitbutton}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</form>
|
||||
</CardBody>
|
||||
|
@ -117,7 +117,7 @@
|
||||
{#if !(hint.content || hint.file) || (!hint.file && hint.hidden)}
|
||||
<div>
|
||||
{#if !(hint.content || hint.file)}
|
||||
<button type="button" on:click={openHint(hint)} class="btn btn-info" class:disabled={hints_submitted[hint.id]}>
|
||||
<button type="button" on:click={openHint(hint)} class="btn btn-info" class:disabled={hints_submitted[hint.id]} disabled={$settings.disablesubmitbutton}>
|
||||
{#if hints_submitted[hint.id]}
|
||||
<Spinner size="sm" class="me-2" />
|
||||
{:else}
|
||||
|
@ -155,7 +155,7 @@
|
||||
color="success"
|
||||
type="button"
|
||||
on:click={wantchoices}
|
||||
disabled={wcsubmitted}
|
||||
disabled={wcsubmitted || $settings.disablesubmitbutton}
|
||||
title="Cliquez pour échanger ce champ de texte par une liste de choix. L'opération vous coûtera {flag.choices_cost * $settings.wchoiceCurrentCoefficient} points."
|
||||
>
|
||||
{#if wcsubmitted}
|
||||
|
@ -5,6 +5,7 @@
|
||||
} from 'sveltestrap';
|
||||
|
||||
import { issues, issues_idx } from '../stores/issues.js';
|
||||
import { settings } from '../stores/settings.js';
|
||||
|
||||
export let exercice = null;
|
||||
export let issue = { };
|
||||
@ -41,7 +42,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button type="submit" color="warning" class="float-end">
|
||||
<Button type="submit" color="warning" class="float-end" disabled={$settings.disablesubmitbutton}>
|
||||
Envoyer le rapport
|
||||
</Button>
|
||||
</form>
|
||||
|
@ -8,6 +8,7 @@
|
||||
} from 'sveltestrap';
|
||||
|
||||
import { my } from '../stores/my.js';
|
||||
import { settings } from '../stores/settings.js';
|
||||
|
||||
export let refresh_my;
|
||||
|
||||
@ -101,7 +102,7 @@
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="newName" bind:value={newTeamName} placeholder="{$my.name}">
|
||||
<Button type="submit" class="btn btn-info">Valider</Button>
|
||||
<Button type="submit" class="btn btn-info" disabled={$settings.disablesubmitbutton}>Valider</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,6 +18,8 @@ function createSettingsStore() {
|
||||
settings.generation = new Date(settings.generation);
|
||||
if (settings.activateTime)
|
||||
settings.activateTime = new Date(settings.activateTime);
|
||||
if (!settings.disablesubmitbutton)
|
||||
settings.disablesubmitbutton = null;
|
||||
|
||||
settings.recvTime = recvTime;
|
||||
const x_fic_time = res_settings.headers.get("x-fic-time");
|
||||
|
@ -77,6 +77,8 @@ type Settings struct {
|
||||
DisplayMCQBadCount bool `json:"displayMCQBadCount,omitempty"`
|
||||
// EventKindness will ask browsers to delay notification interval.
|
||||
EventKindness bool `json:"eventKindness,omitempty"`
|
||||
// DisableSubmitButton replace button by this text (eg. scheduled updates, ...).
|
||||
DisableSubmitButton string `json:"disablesubmitbutton,omitempty"`
|
||||
}
|
||||
|
||||
// ExistsSettings checks if the settings file can by found at the given path.
|
||||
|
Loading…
x
Reference in New Issue
Block a user