Commit 0393bf07 by Bence Dányi

firewall_gui: reload entity list after delete

parent 10ad5fcd
......@@ -225,11 +225,24 @@ function ListController(url) {
$scope.prevPage = function() {
$scope.page = Math.max($scope.page - 1, 1);
};
$scope.deleteEntity = function(id) {
$.ajax({
url: url.split('/')[2]+'/'+id+'/delete/',
type: 'post',
success: reloadList
});
};
function reloadList() {
$http.get(url).success(function success(data) {
rules = data;
$scope.pages = range(1, Math.ceil(data.length / pageSize));
});
}
reloadList();
}
}
/**
......@@ -275,7 +288,8 @@ function EntityController(url, init) {
console.log(data);
$scope.$apply(function() {
$scope.errors = {};
})
});
window.location.hash = '/' + url.split('/')[2] + '/' + data + '/';
}
}).error(function(data) {
try {
......@@ -293,9 +307,12 @@ function EntityController(url, init) {
}
})
}
function reloadEntity() {
$http.get(url + id + '/').success(function success(data) {
$scope.entity = data;
$('input[type=text], input[type=number], select, textarea, .has-tooltip').tooltip({placement:'right'});
$('input[type=text], input[type=number], select, textarea, .has-tooltip').tooltip({
placement: 'right'
});
['vlan', 'vlangroup', 'host', 'hostgroup', 'firewall', 'owner', 'domain', 'record'].forEach(function(t) {
$('.' + t).typeahead({
/**
......@@ -339,7 +356,7 @@ function EntityController(url, init) {
} catch (ex) {
try {
$scope[self.$element[0].getAttribute('ng-model')] = item;
} catch(ex) {
} catch (ex) {
}
}
......@@ -350,4 +367,6 @@ function EntityController(url, init) {
})
});
}
reloadEntity();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment