Skip to content

Commit

Permalink
Added a help button and dialog explaining why the MD5 checksum calcul…
Browse files Browse the repository at this point in the history
…ation is needed prior to uploads. Fix #1081.
  • Loading branch information
flekschas committed May 4, 2016
1 parent feff55c commit f332049
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
6 changes: 5 additions & 1 deletion refinery/templates/data_set_manager/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ <h4>Option B. Provide a URL</h4>
</div>
<div class="col-lg-4">
<div class="v-center" ng-if="processing() || loadingFiles">
<span>Calculating MD5:</span>
<span>Calculating MD5</span>
<button class="icon-only" ng-click="openHelpMd5()">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</button>
<span>:</span>
<div class="refinery-spinner refinery-spinner-inline"></div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

var RefineryFileUploadMD5HelpCtrl = function ($uibModalInstance) {
this.ok = function () {
$uibModalInstance.close();
};
};

angular
.module('refineryDataSetImport')
.controller('RefineryFileUploadMD5HelpCtrl', [
'$uibModalInstance', RefineryFileUploadMD5HelpCtrl
]);
12 changes: 11 additions & 1 deletion refinery/ui/source/js/data-set-import/controllers/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function RefineryFileUploadCtrl (
$timeout,
$,
SparkMD5,
dataSetImportSettings
dataSetImportSettings,
$uibModal
) {
var csrf = '';
var formData = [];
Expand Down Expand Up @@ -181,6 +182,14 @@ function RefineryFileUploadCtrl (
return totalNumFilesQueued - totalNumFilesUploaded;
};

$scope.openHelpMd5 = function () {
$uibModal.open({
templateUrl:
'/static/partials/data-set-import/partials/dialog-help-md5.html',
controller: 'RefineryFileUploadMD5HelpCtrl as modal'
});
};

$scope.options = {
always: uploadAlways,
chunkdone: chunkDone,
Expand All @@ -200,5 +209,6 @@ angular
'$',
'SparkMD5',
'dataSetImportSettings',
'$uibModal',
RefineryFileUploadCtrl
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="modal-header">
<h3>Why calculating the MD5 checksum</h3>
</div>
<div class="modal-body">
<p>In order to ensure that the file has been correctly uploaded and is not corrupted we calculate the MD5 checksum locally (i.e. in the browser) before allowing the upload to start.</p>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="modal.ok()">OK</button>
</div>

0 comments on commit f332049

Please sign in to comment.