Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 2d32efe

Browse files
author
vikasrohit
committed
Merge pull request #649 from appirio-tech/feature/sup-1159-upload-progress-bar
SUP-1159, Progress bar to show %complete on upload
2 parents 21ac46f + bdb07f2 commit 2d32efe

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

app/submissions/submit-file/submit-file.controller.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
angular.module('tc.submissions').controller('SubmitFileController', SubmitFileController);
55

6-
SubmitFileController.$inject = ['$scope', '$stateParams', 'UserService', 'SubmissionsService', 'challengeToSubmitTo'];
6+
SubmitFileController.$inject = ['$scope', '$stateParams', '$log', 'UserService', 'SubmissionsService', 'challengeToSubmitTo'];
77

8-
function SubmitFileController($scope, $stateParams, UserService, SubmissionsService, challengeToSubmitTo) {
8+
function SubmitFileController($scope, $stateParams, $log, UserService, SubmissionsService, challengeToSubmitTo) {
99
var vm = this;
10+
$log = $log.getInstance("SubmitFileController");
1011
var files = {};
1112
var fileUploadProgress = {};
1213
vm.urlRegEx = new RegExp(/^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,3})+(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/);
@@ -141,6 +142,8 @@
141142
vm.fileUploadProgress = {};
142143
vm.showProgress = true;
143144
vm.preparing = true;
145+
vm.uploading = false;
146+
vm.finishing = false;
144147
vm.submissionsBody.data.submitterComments = vm.comments;
145148
vm.submissionsBody.data.submitterRank = vm.submissionForm.submitterRank;
146149

@@ -173,7 +176,7 @@
173176
});
174177
}
175178

176-
console.log('Body for request: ', vm.submissionsBody);
179+
$log.debug('Body for request: ', vm.submissionsBody);
177180
SubmissionsService.getPresignedURL(vm.submissionsBody, files, updateProgress);
178181
}
179182

@@ -188,7 +191,7 @@
188191
if (args === 100) {
189192
vm.preparing = false;
190193
vm.uploading = true;
191-
console.log('Prapared');
194+
$log.debug('Prepared for upload.');
192195
}
193196
} else if (phase === 'UPLOAD') {
194197
// if args is object, this update is about XHRRequest's upload progress
@@ -212,21 +215,21 @@
212215
}
213216
// start next phase when UPLOAD is done
214217
if (vm.uploadProgress == 100) {
215-
console.log('Uploaded');
218+
$log.debug('Uploaded files.');
216219
vm.uploading = false;
217220
vm.finishing = true;
218221
}
219222
} else if (phase === 'FINISH') {
220223
// we are concerned only for completion of the phase
221224
if (args === 100) {
222-
console.log('Finished');
225+
$log.debug('Finished upload.');
223226
vm.finishing = false;
224227
vm.showProgress = false;
225228

226229
// TODO redirect to submission listing / challenge details page
227230
}
228231
} else { // assume it to be error condition
229-
console.log("Else: " + phase);
232+
$log.debug("Error Condition: " + phase);
230233
vm.errorInUpload = true;
231234
}
232235
}

0 commit comments

Comments
 (0)