import validation

This commit is contained in:
Kyle Spearrin 2016-10-17 23:18:19 -04:00
parent e7a9699226
commit 517ea65bc9
3 changed files with 14 additions and 3 deletions

View File

@ -5,6 +5,11 @@
var _service = {};
_service.import = function (source, file, success, error) {
if (!file) {
error();
return;
}
switch (source) {
case 'local':
importLocal(file, success, error);

View File

@ -25,9 +25,15 @@
}, importError);
}
function importError() {
function importError(errorMessage) {
$analytics.eventTrack('Import Data Failed', { label: $scope.model.source });
$uibModalInstance.dismiss('cancel');
toastr.error('Something went wrong. Try again.', 'Oh No!');
if (errorMessage) {
toastr.error(errorMessage);
}
else {
toastr.error('Something went wrong. Try again.', 'Oh No!');
}
}
$scope.close = function () {

View File

@ -18,7 +18,7 @@
</div>
<div class="form-group">
<label for="file">File</label>
<input type="file" id="file" name="file" />
<input type="file" id="file" name="file" required />
</div>
</div>
<div class="modal-footer">