maatma: interface for domain delegation (mostly)

This commit is contained in:
nemunaire 2019-03-14 11:21:45 +01:00
commit 7ebbf79bda
5 changed files with 406 additions and 23 deletions

View file

@ -154,7 +154,7 @@ angular.module("AdLinApp")
}
})
.controller("DomainsController", function($scope, $http, $interval) {
.controller("DomainsController", function($scope, $http, $interval, $location) {
$scope.updateAssociationD = function() {
$http({
method: 'GET',
@ -182,9 +182,25 @@ angular.module("AdLinApp")
});
});
};
$scope.updateAssociationD();
$scope.updateDelegatedD = function() {
$http({
method: 'GET',
url: "/api/ddomains/",
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
response.data.forEach(function(domain) {
$scope.ddomains = response.data;
}, function(response) {
alert(response.data.errmsg);
});
});
};
$scope.updateDelegatedD();
$scope.newAssociationD = function() {
$scope.pleaseWaitNewAssociation = true;
$http({
@ -202,4 +218,104 @@ angular.module("AdLinApp")
});
}
$scope.updateNS = function(domain) {
$scope.nsrr = {
"domain": domain,
"ttl": 900,
"rr": "NS",
"value": "",
}
$('#NSModal').modal('show');
}
$scope.updateGLUE = function(domain) {
$scope.nsrr = {
"domain": domain,
"ttl": 900,
"rr": "AAAA",
"value": "",
}
$('#NSModal').modal('show');
}
$scope.updateDS = function(domain) {
$scope.nsrr = {
"domain": domain,
"ttl": 900,
"rr": "DS",
"labels": ["Key Tag", "Flag", "Algorithme", "Clef publique (base64)"],
"values": ["", "", "", ""],
}
$('#NSModal').modal('show');
}
$scope.saveNSRR = function(nsrr) {
if (nsrr.values === undefined)
nsrr.values = [nsrr.value];
$http({
method: 'POST',
url: "/api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
data: nsrr,
}).then(function(response) {
$('#NSModal').modal('hide');
$location.url("./domains");
}, function(response) {
alert(response.data.errmsg);
});
}
$scope.delNSRR = function(nsrr) {
$http({
method: 'DELETE',
url: "/api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
$('#NSModal').modal('hide');
$location.url("./domains");
}, function(response) {
alert(response.data.errmsg);
});
}
})
.controller("NSDomainsController", function($scope, $http) {
$http({
method: 'GET',
url: "/api/ddomains/" + $scope.domain + "/NS",
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
$scope.domainNS = response.data;
});
})
.controller("GLUEDomainsController", function($scope, $http) {
$http({
method: 'GET',
url: "/api/ddomains/" + $scope.domain + "/GLUE",
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
$scope.domainGLUE = response.data;
});
})
.controller("DSDomainsController", function($scope, $http) {
$http({
method: 'GET',
url: "/api/ddomains/" + $scope.domain + "/DS",
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
$scope.domainDS = response.data;
});
})

File diff suppressed because one or more lines are too long