maatma: implement associated domains

This commit is contained in:
nemunaire 2019-03-14 08:51:40 +01:00
parent 955e263d39
commit 5f83c5cd2c
3 changed files with 161 additions and 12 deletions

View file

@ -155,5 +155,51 @@ angular.module("AdLinApp")
})
.controller("DomainsController", function($scope, $http, $interval) {
$scope.updateAssociationD = function() {
$http({
method: 'GET',
url: "/api/adomains/",
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
$scope.adomains = [];
response.data.forEach(function(domain) {
$http({
method: 'GET',
url: "/api/adomains/" + domain,
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
response.data.forEach(function(rr) {
$scope.adomains.push(rr);
});
});
}, function(response) {
alert(response.data.errmsg);
});
});
};
$scope.updateAssociationD();
$scope.newAssociationD = function() {
$scope.pleaseWaitNewAssociation = true;
$http({
method: 'POST',
url: "/api/adomains/",
headers: {
'Authorization': "Bearer " + sessionStorage.token
},
}).then(function(response) {
$scope.updateAssociationD();
$scope.pleaseWaitNewAssociation = false;
}, function(response) {
alert(response.data.errmsg);
$scope.pleaseWaitNewAssociation = false;
});
}
})

View file

@ -14,23 +14,17 @@
</tr>
</thead>
<tbody style="font-family: monospace">
<tr>
<td>{{ isLogged.login }}.adlin2020.p0m.fr</td>
<td>900</td>
<td>A</td>
<td>82.64.31.248</td>
</tr>
<tr>
<td>{{ isLogged.login }}.adlin2020.p0m.fr</td>
<td>900</td>
<td>AAAA</td>
<td>2a01:e0a:2b:2252:{{ isLogged.id.toString(16) }}::1</td>
<tr ng-repeat="ad in adomains">
<td>{{ ad.domain }}</td>
<td>{{ ad.ttl }}</td>
<td>{{ ad.rr }}</td>
<td><span ng-repeat="val in ad.values">{{ val }} </span></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<button class="btn btn-primary" ng-click="newAssociation()">
<button class="btn btn-primary" ng-click="newAssociationD()">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="pleaseWaitNewAssociation"></span>
Demander un nouveau nom de domaine
</button>