admin: Add a button to permit deleting strange submissions
This commit is contained in:
parent
0b04185933
commit
632eb62f1f
@ -35,6 +35,15 @@ func declareHealthRoutes(router *gin.RouterGroup) {
|
||||
router.GET("/health.json", GetHealth)
|
||||
router.GET("/submissions-stats.json", GetSubmissionsStats)
|
||||
router.GET("/validations-stats.json", GetValidationsStats)
|
||||
|
||||
router.DELETE("/submissions/*path", func(c *gin.Context) {
|
||||
err := os.Remove(path.Join(TimestampCheck, c.Params.ByName("path")))
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": err.Error()})
|
||||
return
|
||||
}
|
||||
c.Status(http.StatusOK)
|
||||
})
|
||||
}
|
||||
|
||||
type healthFileReport struct {
|
||||
|
@ -529,12 +529,23 @@ angular.module("FICApp")
|
||||
$scope.$on('$destroy', function () { $interval.cancel(myinterval); });
|
||||
})
|
||||
|
||||
.controller("HealthController", function($scope, $interval, Health) {
|
||||
.controller("HealthController", function($scope, $interval, Health, $http) {
|
||||
var refresh = function() {
|
||||
$scope.health = Health.query();
|
||||
}
|
||||
refresh();
|
||||
var myinterval = $interval(refresh, 2500);
|
||||
$scope.drop_submission = function(path) {
|
||||
$scope.addToast('info', 'Delete submission', 'Ensure this submission is not interesting. Continue?',
|
||||
function() {
|
||||
$http.delete("api/submissions" + path).then(function(response) {
|
||||
refresh();
|
||||
}, function(response) {
|
||||
$scope.addToast('danger', 'An error occurs when deleting submission:', response.data.errmsg);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
$scope.$on('$destroy', function () { $interval.cancel(myinterval); });
|
||||
})
|
||||
|
||||
|
@ -33,6 +33,9 @@
|
||||
<a ng-href="teams/{{ heal.id_team }}" ng-if="heal.id_team" class="text-warning">/{{ heal.path.split("/")[1] }}</a><a target="_blank" ng-href="submissions{{ heal.path }}" ng-if="heal.id_team">/{{ heal.path.split("/")[2] }}</a>
|
||||
<a ng-href="submissions{{ heal.path }}" ng-if="!heal.id_team">{{ heal.path }}</a>
|
||||
: {{ heal.error }}
|
||||
<button type="button" class="btn btn-sm btn-link" ng-click="drop_submission(heal.path)">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user