mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-30 22:05:21 +00:00
Merge pull request #1393 from Jay07GIT/reset_file_batchchange_upload
Reset the batch file name when re-upload the same file again
This commit is contained in:
@@ -162,16 +162,32 @@
|
||||
$scope.alerts.push(alert);
|
||||
}
|
||||
|
||||
function resetFileInput() {
|
||||
$scope.csvInput = null;
|
||||
var inputElement = document.getElementById('batchChangeCsv');
|
||||
if (inputElement) {
|
||||
inputElement.value = null;
|
||||
}
|
||||
if ($scope.createBatchChangeForm && $scope.createBatchChangeForm.batchChangeCsv) {
|
||||
$scope.createBatchChangeForm.batchChangeCsv.$setViewValue(null);
|
||||
$scope.createBatchChangeForm.batchChangeCsv.$render();
|
||||
}
|
||||
}
|
||||
|
||||
$scope.uploadCSV = function(file, batchChangeLimit) {
|
||||
parseFile(file, batchChangeLimit).then(function(dataLength){
|
||||
$scope.alerts.push({type: 'success', content: 'Successfully imported ' + dataLength + ' DNS changes.' });
|
||||
resetFileInput();
|
||||
}, function(error) {
|
||||
$scope.alerts.push({type: 'danger', content: error});
|
||||
});
|
||||
|
||||
function parseFile(file, batchChangeLimit) {
|
||||
return $q(function(resolve, reject) {
|
||||
if (!file.name.endsWith('.csv')) {
|
||||
if (!file || !file.name) {
|
||||
$log.debug('No file selected or file has no name property');
|
||||
}
|
||||
else if (!file.name.endsWith('.csv')) {
|
||||
reject("Import failed. File should be of ‘.csv’ type.");
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user