mirror of
https://github.com/ansible/awx.git
synced 2026-01-27 08:31:28 -03:30
AC-1185 fixed page rendering issues related to html-unsafe. Fixed search helper. Finished new inventory group delete functionality.
This commit is contained in:
parent
7c43dced0f
commit
284c947347
@ -1268,13 +1268,11 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', 'BuildTree', 'Find', 'CreateDialog',
|
||||
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||
GetBasePath, Wait, BuildTree, Find, CreateDialog) {
|
||||
return function (params) {
|
||||
// Delete the selected group node. Disassociates it from its parent.
|
||||
|
||||
var scope = params.scope,
|
||||
tree_id = params.tree_id,
|
||||
@ -1284,26 +1282,6 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
||||
childCount = 0,
|
||||
buttonSet;
|
||||
|
||||
// action_to_take = function () {
|
||||
// $('#prompt-modal').on('hidden.bs.modal', function () {
|
||||
// Wait('start');
|
||||
// });
|
||||
// $('#prompt-modal').modal('hide');
|
||||
// Rest.setUrl(url);
|
||||
// Rest.post({ id: node.group_id, disassociate: 1 })
|
||||
// .success(function () {
|
||||
// $('#prompt-modal').modal('hide');
|
||||
// scope.$emit('GroupDeleteCompleted'); // Signal a group refresh to start
|
||||
// })
|
||||
// .error(function (data, status) {
|
||||
// Wait('stop');
|
||||
// ProcessErrors(scope, data, status, null, {
|
||||
// hdr: 'Error!',
|
||||
// msg: 'Call to ' + url + ' failed. POST returned status: ' + status
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
|
||||
scope.deleteOption = "preserve-all";
|
||||
|
||||
buttonSet = [{
|
||||
@ -1409,15 +1387,82 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
||||
$('#group-delete-dialog').dialog('close');
|
||||
};
|
||||
|
||||
if (scope.removeChildDeleteFinished) {
|
||||
scope.removeChildDeleteFinished();
|
||||
}
|
||||
scope.removeChildDeleteFinished = scope.$on('ChildDeleteFinished', function() {
|
||||
var url = GetBasePath('inventory') + scope.inventory_id + '/groups/';
|
||||
Rest.setUrl(url);
|
||||
Rest.post({ id: node.group_id, disassociate: 1 })
|
||||
.success(function () {
|
||||
scope.$emit('GroupDeleteCompleted'); // Signal a group refresh to start
|
||||
})
|
||||
.error(function (data, status) {
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||
msg: 'Call to ' + url + ' failed. POST returned: ' + status
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (scope.removeDeleteNextGroup) {
|
||||
scope.removeDeleteNextGroup();
|
||||
}
|
||||
scope.removeDeleteNextGroup = scope.$on('DeleteNextGroup', function() {
|
||||
var group;
|
||||
if (groups && groups.length > 0) {
|
||||
group = groups.pop();
|
||||
Rest.setUrl(GetBasePath('group') + group.group_id + '/');
|
||||
Rest.destroy()
|
||||
.success(function() {
|
||||
scope.$emit('DeleteNextGroup');
|
||||
})
|
||||
.error( function(data, status) {
|
||||
$log.error('Failed to delete group ' + group.group_id + '. Status: ' + status);
|
||||
scope.$emit('DeleteNextGroup');
|
||||
});
|
||||
}
|
||||
else {
|
||||
scope.$emit('ChildDeleteFinished');
|
||||
}
|
||||
});
|
||||
|
||||
if (scope.removeDeleteNextHost) {
|
||||
scope.removeDeleteNextHost();
|
||||
}
|
||||
scope.removeDeleteNextHost = scope.$on('DeleteNextHost', function() {
|
||||
var host;
|
||||
if (hosts && hosts.length > 0) {
|
||||
host = hosts.pop();
|
||||
Rest.setUrl(GetBasePath('hosts') + host.id + '/');
|
||||
Rest.destroy()
|
||||
.success(function() {
|
||||
scope.$emit('DeleteNextHost');
|
||||
})
|
||||
.error( function(data, status) {
|
||||
$log.error('Failed to delete host ' + host.id + '. Status: ' + status);
|
||||
scope.$emit('DeleteNextHost');
|
||||
});
|
||||
}
|
||||
else {
|
||||
scope.$emit('DeleteNextGroup');
|
||||
}
|
||||
});
|
||||
|
||||
scope.performDelete = function() {
|
||||
$('#group-delete-dialog').dialog('close');
|
||||
Wait('start');
|
||||
if (scope.deleteOption === 'delete-all') {
|
||||
scope.$emit('DeleteNextHost');
|
||||
}
|
||||
else {
|
||||
scope.$emit('ChildDeleteFinished');
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
.factory('ShowUpdateStatus', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventoryStatusForm', 'Wait', 'Empty', 'WatchInventoryWindowResize',
|
||||
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
|
||||
|
||||
@ -9,16 +9,16 @@
|
||||
angular.module('PermissionsHelper', [])
|
||||
|
||||
// Handle category change event
|
||||
.factory('PermissionCategoryChange', [
|
||||
function () {
|
||||
.factory('PermissionCategoryChange', ['$sce',
|
||||
function ($sce) {
|
||||
return function (params) {
|
||||
var scope = params.scope,
|
||||
reset = params.reset;
|
||||
reset = params.reset,
|
||||
html;
|
||||
|
||||
if (scope.category === 'Inventory') {
|
||||
scope.projectrequired = false;
|
||||
scope.permissionTypeHelp =
|
||||
"<dl>\n" +
|
||||
html = "<dl>\n" +
|
||||
"<dt>Read</dt>\n" +
|
||||
"<dd>Only allow the user or team to view the inventory.</dd>\n" +
|
||||
"<dt>Write</dt>\n" +
|
||||
@ -26,10 +26,10 @@ angular.module('PermissionsHelper', [])
|
||||
"<dt>Admin</dt>\n" +
|
||||
"<dd>Allow the user or team full access to the inventory. This includes reading, writing, deletion of the inventory and inventory sync operations.</dd>\n" +
|
||||
"</dl>\n";
|
||||
scope.permissionTypeHelp = $sce.trustAsHtml(html);
|
||||
} else {
|
||||
scope.projectrequired = true;
|
||||
scope.permissionTypeHelp =
|
||||
"<dl>\n" +
|
||||
html = "<dl>\n" +
|
||||
"<dt>Run</dt>\n" +
|
||||
"<dd>Allow the user or team to perform a live deployment of the project against the inventory. In Run mode modules will " +
|
||||
"be executed, and changes to the inventory will occur.</dd>\n" +
|
||||
@ -37,6 +37,7 @@ angular.module('PermissionsHelper', [])
|
||||
"<dd>Only allow the user or team to deploy the project against the inventory as a dry-run operation. In Check mode, module operations " +
|
||||
"will only be simulated. No changes will occur.</dd>\n" +
|
||||
"</dl>\n";
|
||||
scope.permissionTypeHelp = $sce.trustAsHtml(html);
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
|
||||
@ -451,7 +451,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
*/
|
||||
scope.search = function (iterator, page, load, calcOnly) {
|
||||
page = page || null;
|
||||
load = (load || !scope.set || scope.set.length === 0) ? true : false;
|
||||
load = (load || !scope[set] || scope[set].length === 0) ? true : false;
|
||||
calcOnly = (calcOnly) ? true : false;
|
||||
if (load) {
|
||||
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user