2014-08-25 21:41:05 +02:00
|
|
|
define([
|
|
|
|
'services/hostgroups',
|
|
|
|
'factories/hostgroup',
|
|
|
|
'factories/host'
|
2016-03-18 23:03:28 +01:00
|
|
|
], function () {
|
2015-03-17 01:21:16 +01:00
|
|
|
app.registerController('PlaybookHostsCtrl', ['$scope', '$state', 'hostgroups', 'Host', function($scope, $state, hostgroups, Host) {
|
|
|
|
|
2014-08-25 21:41:05 +02:00
|
|
|
$scope.hostgroups = hostgroups;
|
2015-03-17 01:21:16 +01:00
|
|
|
|
2014-08-25 21:41:05 +02:00
|
|
|
hostgroups.get($scope.playbook, function () {
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.add = function () {
|
|
|
|
$('#addHostGroup').modal('show');
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.showAddHost = function (hostgroup) {
|
|
|
|
if (hostgroup.showingAdd) {
|
|
|
|
hostgroup.showingAdd = false;
|
|
|
|
} else {
|
|
|
|
hostgroup.showingAdd = true;
|
|
|
|
hostgroup.newHost = new Host();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.deleteHostGroup = function (hostgroup) {
|
|
|
|
hostgroup.delete($scope.playbook);
|
|
|
|
|
|
|
|
hostgroups.get($scope.playbook, function () {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.deleteHost = function (hostgroup, host) {
|
|
|
|
host.delete($scope.playbook, hostgroup);
|
|
|
|
hostgroup.getHosts($scope.playbook);
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.addHost = function (hostgroup) {
|
|
|
|
hostgroup.newHost.add($scope.playbook, hostgroup);
|
|
|
|
hostgroup.getHosts($scope.playbook);
|
|
|
|
|
|
|
|
$scope.showAddHost(hostgroup);
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
|
|
|
|
app.registerController('AddHostGroupCtrl', ['$scope', 'HostGroup', 'hostgroups', function($scope, HostGroup, hostgroups) {
|
|
|
|
$scope.hostgroup = new HostGroup();
|
|
|
|
|
|
|
|
$scope.add = function () {
|
|
|
|
$('#addHostGroup').modal('hide');
|
|
|
|
|
|
|
|
$scope.hostgroup.add($scope.playbook);
|
|
|
|
|
|
|
|
hostgroups.get($scope.playbook, function () {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
});
|