can delete zone

This commit is contained in:
AJ ONeal 2018-01-31 19:19:11 -07:00
parent 16bceb8a8a
commit 0e74e2db18
2 changed files with 13 additions and 4 deletions

View File

@ -244,6 +244,7 @@
).then(function (resp) {
return resp.json().then(function (data) {
var zone;
var records = [];
if (data.error) {
console.error(data);
window.alert(data.error.message);
@ -251,11 +252,15 @@
}
console.log('zone undo data:');
console.log(data);
zone = cache.recordsMap[zoneId];
delete cache.recordsMap[zoneId];
cache.zones.some(function (z, i) {
if (z.id === zoneId) {
zone = cache.zones.splice(i, 1)[0];
return true;
}
});
function removeRecord(r, i) {
if (r.zone === zone.name) {
cache.records.splice(i, 1);
if (r.zone === zone.name || 'SOA' === r.type && r.name === zone.name) {
records.push(cache.records.splice(i, 1)[0]);
return true;
}
}

View File

@ -315,9 +315,12 @@ module.exports.create = function (opts) {
, destroy: function (zoneId, cb) {
var zone;
var records;
var now = Date.now();
db.zones.filter(notDeleted).some(function (z) {
if (zoneId === z.id) {
zone = z;
z.deletedAt = now;
return true;
}
});
@ -332,6 +335,7 @@ module.exports.create = function (opts) {
records = [];
db.records.filter(notDeleted).forEach(function (r) {
if (zone.name === r.zone) {
r.deletedAt = now;
records.push(r);
}
});