mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-22 10:10:12 +00:00
Wait for zone and record set promises in portal before displaying record sets (#359)
* Add wait for promise. * Replace event.preventDefault with button type in HTML since buttons default to submit type.
This commit is contained in:
parent
6047b0a904
commit
26e8a77e46
@ -150,16 +150,16 @@
|
|||||||
{{batchError}}
|
{{batchError}}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td><button class="btn btn-danger batch-change-delete" ng-click="deleteSingleChange($index)">Delete</button></td>
|
<td><button type="button" class="btn btn-danger batch-change-delete" ng-click="deleteSingleChange($index)">Delete</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<button id="addChange" class="btn btn-default" ng-click="addSingleChange()" ng-disabled="newBatch.changes.length == batchChangeLimit"><span class="fa fa-plus"></span> Add a Change</button>
|
<button type="button" id="addChange" class="btn btn-default" ng-click="addSingleChange()" ng-disabled="newBatch.changes.length == batchChangeLimit"><span class="fa fa-plus"></span> Add a Change</button>
|
||||||
<span ng-if="newBatch.changes.length == batchChangeLimit">Limit reached. Cannot add more than {{batchChangeLimit}} records per batch change.</span>
|
<span ng-if="newBatch.changes.length == batchChangeLimit">Limit reached. Cannot add more than {{batchChangeLimit}} records per batch change.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer clearfix">
|
<div class="panel-footer clearfix">
|
||||||
<div ng-if="formStatus=='pendingSubmit'" class="pull-right">
|
<div ng-if="formStatus=='pendingSubmit'" class="pull-right">
|
||||||
<button id="create-batch-changes-button" class="btn btn-primary" ng-click="submitChange()">Submit</button>
|
<button type="button" id="create-batch-changes-button" class="btn btn-primary" ng-click="submitChange()">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="formStatus=='pendingConfirm'" class="pull-right">
|
<div ng-if="formStatus=='pendingConfirm'" class="pull-right">
|
||||||
<span>Are you sure you want to submit this batch change request?</span>
|
<span>Are you sure you want to submit this batch change request?</span>
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
$scope.formStatus = "pendingSubmit";
|
$scope.formStatus = "pendingSubmit";
|
||||||
|
|
||||||
$scope.addSingleChange = function() {
|
$scope.addSingleChange = function() {
|
||||||
event.preventDefault();
|
|
||||||
$scope.newBatch.changes.push({changeType: "Add", type: "A", ttl: 200});
|
$scope.newBatch.changes.push({changeType: "Add", type: "A", ttl: 200});
|
||||||
var changesLength =$scope.newBatch.changes.length;
|
var changesLength =$scope.newBatch.changes.length;
|
||||||
$timeout(function() {document.getElementsByClassName("changeType")[changesLength - 1].focus()});
|
$timeout(function() {document.getElementsByClassName("changeType")[changesLength - 1].focus()});
|
||||||
@ -75,13 +74,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteSingleChange = function(changeNumber) {
|
$scope.deleteSingleChange = function(changeNumber) {
|
||||||
event.preventDefault();
|
|
||||||
$('.batch-change-delete').blur();
|
$('.batch-change-delete').blur();
|
||||||
$scope.newBatch.changes.splice(changeNumber, 1);
|
$scope.newBatch.changes.splice(changeNumber, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitChange = function() {
|
$scope.submitChange = function() {
|
||||||
event.preventDefault();
|
|
||||||
$scope.formStatus = "pendingConfirm";
|
$scope.formStatus = "pendingConfirm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
angular.module('controller.records', [])
|
angular.module('controller.records', [])
|
||||||
.controller('RecordsController', function ($scope, $timeout, $log, recordsService, groupsService, pagingService, utilityService) {
|
.controller('RecordsController', function ($scope, $timeout, $log, recordsService, groupsService, pagingService, utilityService, $q) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scope data initial setup
|
* Scope data initial setup
|
||||||
@ -35,6 +35,9 @@ angular.module('controller.records', [])
|
|||||||
$scope.currentRecord = {};
|
$scope.currentRecord = {};
|
||||||
$scope.zoneInfo = {};
|
$scope.zoneInfo = {};
|
||||||
|
|
||||||
|
var loadZonesPromise;
|
||||||
|
var loadRecordsPromise;
|
||||||
|
|
||||||
$scope.recordModalState = {
|
$scope.recordModalState = {
|
||||||
CREATE: 0,
|
CREATE: 0,
|
||||||
UPDATE: 1,
|
UPDATE: 1,
|
||||||
@ -391,6 +394,8 @@ angular.module('controller.records', [])
|
|||||||
};
|
};
|
||||||
|
|
||||||
function updateRecordDisplay(records) {
|
function updateRecordDisplay(records) {
|
||||||
|
$q.all([loadZonesPromise, loadRecordsPromise])
|
||||||
|
.then(function(){
|
||||||
var newRecords = [];
|
var newRecords = [];
|
||||||
angular.forEach(records, function(record) {
|
angular.forEach(records, function(record) {
|
||||||
newRecords.push(recordsService.toDisplayRecord(record, $scope.zoneInfo.name));
|
newRecords.push(recordsService.toDisplayRecord(record, $scope.zoneInfo.name));
|
||||||
@ -401,7 +406,8 @@ angular.module('controller.records', [])
|
|||||||
} else {
|
} else {
|
||||||
$("td.dataTables_empty").show();
|
$("td.dataTables_empty").show();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recordset paging
|
* Recordset paging
|
||||||
@ -447,7 +453,6 @@ angular.module('controller.records', [])
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record change paging
|
* Record change paging
|
||||||
*/
|
*/
|
||||||
@ -492,8 +497,8 @@ angular.module('controller.records', [])
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$timeout($scope.refreshZone, 0);
|
loadZonesPromise = $timeout($scope.refreshZone, 0);
|
||||||
$timeout($scope.refreshRecords, 0);
|
loadRecordsPromise = $timeout($scope.refreshRecords, 0);
|
||||||
$timeout($scope.refreshRecordChangesPreview, 0);
|
$timeout($scope.refreshRecordChangesPreview, 0);
|
||||||
$timeout($scope.refreshRecordChanges, 0);
|
$timeout($scope.refreshRecordChanges, 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user