Skip to content

Commit

Permalink
Fix submission button doesn't work anymore after a failed submission
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-sgaron committed May 8, 2020
1 parent 9d40632 commit 3354c68
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
4 changes: 4 additions & 0 deletions assemblyline_ui/api/v4/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ def submit(**kwargs):
if data is None:
return make_api_response({}, "Missing data block", 400)

if not Classification.is_accessible(user['classification'], data['ui_params']['classification']):
return make_api_response({}, "You cannot start a scan with higher "
"classification then you're allowed to see", 400)

if not name:
return make_api_response({}, "Filename missing", 400)

Expand Down
30 changes: 26 additions & 4 deletions assemblyline_ui/static/js/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,22 @@ function SubmitBaseCtrl($scope, $http, $timeout) {

$scope.loading = false;

let message = "";
if (data.api_error_message) {
$scope.error = data.api_error_message;
message = data.api_error_message;
}
else {
$scope.error = config.url + " (" + status + ")";
message = config.url + " (" + status + ")";
}
swal({
title: "Submission failed!",
text: message,
type: "error",
showCancelButton: false,
confirmButtonColor: "#D0D0D0",
confirmButtonText: "Close",
closeOnConfirm: true
});
});


Expand Down Expand Up @@ -200,12 +210,22 @@ function SubmitBaseCtrl($scope, $http, $timeout) {
return;
}

let message = "";
if (data.api_error_message) {
$scope.error = data.api_error_message;
message = data.api_error_message;
}
else {
$scope.error = config.url + " (" + status + ")";
message = config.url + " (" + status + ")";
}
swal({
title: "Submission failed!",
text: message,
type: "error",
showCancelButton: false,
confirmButtonColor: "#D0D0D0",
confirmButtonText: "Close",
closeOnConfirm: true
});

$scope.reset_transfer();
uuid = null;
Expand All @@ -218,7 +238,9 @@ function SubmitBaseCtrl($scope, $http, $timeout) {

$scope.reset_transfer = function () {
$scope.transfer_started = false;
$scope.started = false;
$scope.obj.flow.cancel();
$scope.obj.flow.off('complete');
};

//Sliding menu
Expand Down

0 comments on commit 3354c68

Please sign in to comment.