Skip to content

Commit 29c0c9e

Browse files
committed
Merge pull request #23 from appirio-tech/dev
Merging from dev to master
2 parents 61db5b7 + 7fddcdd commit 29c0c9e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/app/submissions/submissions.list.controller.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.controller('SubmissionListCtrl', ['$scope', 'SubmissionService', '$timeou
1010
});
1111
});
1212
$scope.submissions = [];
13+
$scope.progress = [];
1314
var getSubmissions = function(challengeId) {
1415
$scope.isLoading = true;
1516
$submissionService.findSubmissions(challengeId).then(
@@ -42,5 +43,26 @@ module.controller('SubmissionListCtrl', ['$scope', 'SubmissionService', '$timeou
4243
}
4344
})
4445

46+
$scope.reprocess = function(submission) {
47+
$scope.progress[submission.id] = true;
48+
$submissionService.processSubmission(submission).then(function(sub) {
49+
console.log("Reprocessing Submission");
50+
delete $scope.progress[submission.id];
51+
$scope.$broadcast('alert.AlertIssued', {
52+
type: "success",
53+
message: "Submission submitted for reprocessing."
54+
});
55+
submission.status = sub.status;
56+
}, function(error) {
57+
console.log("process reprocessing failed");
58+
console.log(error);
59+
delete $scope.progress[submission.id];
60+
$scope.$broadcast('alert.AlertIssued', {
61+
type: 'danger',
62+
message: error.error
63+
});
64+
});
65+
}
66+
4567
}
4668
]);

src/app/submissions/submissions.list.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ <h2>Submissions for Challenge # {{challengeObj.name}}</h2>
4949
<textarea readonly class="form-control submission-json" rows="10" cols="200">{{submission|prettyJSON}}</textarea>
5050
</td>
5151
<td>{{submission.status}}</td>
52+
<td>
53+
<button class="btn btn-danger" ng-click="reprocess(submission)" ng-disabled="progress[submission.id]" ng-show="submission.status === 'ERROR'"> Re-process
54+
<i class="fa fa-repeat" ng-class="{'fa-spin' : progress[submission.id]}"></i>
55+
</button>
56+
</td>
5257
</tr>
5358
</tbody>
5459
</table>

0 commit comments

Comments
 (0)