admin: add a button to edit the raw flag value instead of the checksum
This commit is contained in:
parent
b205409679
commit
eee2cd6a2f
4 changed files with 46 additions and 18 deletions
|
|
@ -332,7 +332,15 @@ func updateExerciceFlag(flag fic.FlagKey, exercice fic.Exercice, body []byte) (i
|
|||
|
||||
flag.Help = uk.Help
|
||||
flag.IgnoreCase = uk.IgnoreCase
|
||||
flag.Checksum = uk.Value
|
||||
if len(uk.Flag) > 0 {
|
||||
var err error
|
||||
flag.Checksum, err = flag.ComputeChecksum([]byte(uk.Flag))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
flag.Checksum = uk.Value
|
||||
}
|
||||
flag.ChoicesCost = uk.ChoicesCost
|
||||
|
||||
if uk.ValidatorRe != nil && len(*uk.ValidatorRe) > 0 {
|
||||
|
|
|
|||
|
|
@ -1341,6 +1341,10 @@ angular.module("FICApp")
|
|||
.controller("ExerciceFlagsController", function($scope, ExerciceFlag, $routeParams, $rootScope, $http) {
|
||||
$scope.flags = ExerciceFlag.query({ exerciceId: $routeParams.exerciceId });
|
||||
|
||||
$scope.changeValue = function(flag) {
|
||||
flag.value = undefined;
|
||||
flag.show_raw = true;
|
||||
}
|
||||
$scope.addFlag = function() {
|
||||
$scope.flags.push(new ExerciceFlag());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,8 +126,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<input type="text" id="kvalue{{flag.id}}" ng-model="flag.value" class="col form-control form-control-sm" placeholder="Condensat" ng-if="flag.id" title="Condensat">
|
||||
<input type="text" id="kflag{{flag.id}}" ng-model="flag.flag" class="col form-control form-control-sm" placeholder="Chaîne brute à valider" ng-if="!flag.id" title="Chaîne brute à valider">
|
||||
<div class="col input-group" ng-if="flag.id && !flag.show_raw" style="padding:0">
|
||||
<input type="text" id="kvalue{{flag.id}}" ng-model="flag.value" class="form-control form-control-sm" placeholder="Condensat" title="Condensat">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-outline-secondary" ng-click="changeValue(flag)" title="Cliquez pour éditer la valeur brute du flag, au lieu du checksum" type="button"><span class="glyphicon glyphicon-erase" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" id="kflag{{flag.id}}" ng-model="flag.flag" class="col form-control form-control-sm" placeholder="Chaîne brute à valider" ng-if="!flag.id || flag.show_raw" title="Chaîne brute à valider">
|
||||
<div class="col-auto custom-control custom-checkbox ml-1">
|
||||
<input type="checkbox" class="custom-control-input" id="kicase{{flag.id}}" ng-model="flag.ignorecase">
|
||||
<label class="custom-control-label" for="kicase{{flag.id}}">Ignore case</label>
|
||||
|
|
@ -138,8 +143,8 @@
|
|||
</div>
|
||||
</form>
|
||||
<form ng-submit="testFlag(flag)">
|
||||
<div class="input-group">
|
||||
<input type="text" id="ktest{{flag.id}}" ng-model="flag.test_str" class="col form-control form-control-sm" placeholder="Test the flag">
|
||||
<div class="input-group row">
|
||||
<input type="text" id="ktest{{flag.id}}" ng-model="flag.test_str" class="form-control form-control-sm" placeholder="Test the flag">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-warning" type="submit"><span class="glyphicon glyphicon-play" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
|
|
|
|||
Reference in a new issue