mirror of
https://github.com/ansible/awx.git
synced 2026-07-05 13:28:04 -02:30
AC-369 Latest inventory changes.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryGroupsForm,
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, Prompt,
|
||||
TreeInit, GetBasePath, GroupsList, GroupsAdd, GroupsEdit, LoadInventory,
|
||||
GroupsDelete, RefreshGroupName, EditInventory)
|
||||
GroupsDelete, RefreshGroupName, EditInventory, SetShowGroupHelp)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@@ -18,6 +18,7 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
var generator = GenerateForm;
|
||||
var form = InventoryGroupsForm;
|
||||
var defaultUrl=GetBasePath('inventory');
|
||||
$('#tree-view').empty();
|
||||
var scope = generator.inject(form, { mode: 'edit', related: true, buildTree: true });
|
||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||
var id = $routeParams.inventory_id;
|
||||
@@ -31,6 +32,7 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
scope.inventoryLoadedRemove = scope.$on('inventoryLoaded', function() {
|
||||
LoadBreadCrumbs({ path: '/inventories/' + id, title: scope.inventory_name });
|
||||
TreeInit(scope.TreeParams);
|
||||
SetShowGroupHelp({ scope: scope });
|
||||
if (!scope.$$phase) {
|
||||
scope.$digest();
|
||||
}
|
||||
@@ -179,12 +181,15 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
scope.deleteGroup = function() {
|
||||
GroupsDelete({ scope: scope, "inventory_id": id, group_id: scope.group_id });
|
||||
}
|
||||
|
||||
|
||||
scope.editHosts = function() {
|
||||
$location.path('/inventories/' + scope.inventory_id + '/hosts');
|
||||
}
|
||||
}
|
||||
|
||||
InventoryGroups.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryGroupsForm',
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'Prompt',
|
||||
'TreeInit', 'GetBasePath', 'GroupsList', 'GroupsAdd', 'GroupsEdit', 'LoadInventory',
|
||||
'GroupsDelete', 'RefreshGroupName', 'EditInventory'
|
||||
'GroupsDelete', 'RefreshGroupName', 'EditInventory', 'SetShowGroupHelp'
|
||||
];
|
||||
|
||||
@@ -13,7 +13,7 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit,
|
||||
RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt,
|
||||
GetBasePath, HostsList, HostsAdd, HostsEdit, HostsDelete,
|
||||
HostsReload, LoadSearchTree, EditHostGroups)
|
||||
HostsReload, LoadSearchTree, EditHostGroups, SetShowGroupHelp)
|
||||
{
|
||||
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
|
||||
//scope.
|
||||
@@ -35,6 +35,7 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
}
|
||||
scope.loadBreadCrumbsRemove = scope.$on('buildAllGroups', function(e, inventory_name) {
|
||||
LoadBreadCrumbs({ path: '/inventories/' + id, title: inventory_name });
|
||||
SetShowGroupHelp({ scope: scope });
|
||||
});
|
||||
|
||||
// Sets up the search tree and loads All Hosts for the inventory
|
||||
@@ -66,6 +67,10 @@ function InventoryHosts ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
scope.editHost = function(host_id, host_name) {
|
||||
HostsEdit({ scope: scope, "inventory_id": id, group_id: scope.group_id, host_id: host_id, host_name: host_name });
|
||||
}
|
||||
|
||||
scope.editGroups = function() {
|
||||
$location.path('/inventories/' + scope.inventory_id + '/groups');
|
||||
}
|
||||
|
||||
scope.editHostGroups = function(host_id) {
|
||||
EditHostGroups({ inventory_id: id, host_id: host_id });
|
||||
@@ -120,6 +125,6 @@ InventoryHosts.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$lo
|
||||
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit',
|
||||
'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'Prompt',
|
||||
'GetBasePath', 'HostsList', 'HostsAdd', 'HostsEdit', 'HostsDelete',
|
||||
'HostsReload', 'LoadSearchTree', 'EditHostGroups'
|
||||
'HostsReload', 'LoadSearchTree', 'EditHostGroups', 'SetShowGroupHelp'
|
||||
];
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
Rest.setUrl(data.related.variable_data);
|
||||
Rest.put(json_data)
|
||||
.success( function(data, status, headers, config) {
|
||||
$location.path('/inventories/' + inventory_id);
|
||||
$location.path('/inventories/' + inventory_id + '/groups');
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, form,
|
||||
@@ -173,7 +173,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
});
|
||||
}
|
||||
else {
|
||||
$location.path('/inventories/' + inventory_id);
|
||||
$location.path('/inventories/' + inventory_id + '/groups');
|
||||
}
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
|
||||
@@ -122,6 +122,9 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
|
||||
for (var fld in form.fields) {
|
||||
data[fld] = scope[fld];
|
||||
}
|
||||
if (scope.scm_type) {
|
||||
data.scm_type = scope.scm_type.value;
|
||||
}
|
||||
var url = (base == 'teams') ? GetBasePath('teams') + $routeParams.team_id + '/projects/' : defaultUrl;
|
||||
Rest.setUrl(url);
|
||||
Rest.post(data)
|
||||
|
||||
Reference in New Issue
Block a user