mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02: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:
@@ -1268,13 +1268,11 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', 'BuildTree', 'Find', 'CreateDialog',
|
'Prompt', 'ProcessErrors', 'GetBasePath', 'Wait', 'BuildTree', 'Find', 'CreateDialog',
|
||||||
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||||
GetBasePath, Wait, BuildTree, Find, CreateDialog) {
|
GetBasePath, Wait, BuildTree, Find, CreateDialog) {
|
||||||
return function (params) {
|
return function (params) {
|
||||||
// Delete the selected group node. Disassociates it from its parent.
|
|
||||||
|
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
tree_id = params.tree_id,
|
tree_id = params.tree_id,
|
||||||
@@ -1284,26 +1282,6 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
childCount = 0,
|
childCount = 0,
|
||||||
buttonSet;
|
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";
|
scope.deleteOption = "preserve-all";
|
||||||
|
|
||||||
buttonSet = [{
|
buttonSet = [{
|
||||||
@@ -1409,15 +1387,82 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
|
|||||||
$('#group-delete-dialog').dialog('close');
|
$('#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() {
|
scope.performDelete = function() {
|
||||||
$('#group-delete-dialog').dialog('close');
|
$('#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',
|
.factory('ShowUpdateStatus', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GenerateForm',
|
||||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventoryStatusForm', 'Wait', 'Empty', 'WatchInventoryWindowResize',
|
'Prompt', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventoryStatusForm', 'Wait', 'Empty', 'WatchInventoryWindowResize',
|
||||||
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
|
function ($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
|
||||||
|
|||||||
@@ -9,16 +9,16 @@
|
|||||||
angular.module('PermissionsHelper', [])
|
angular.module('PermissionsHelper', [])
|
||||||
|
|
||||||
// Handle category change event
|
// Handle category change event
|
||||||
.factory('PermissionCategoryChange', [
|
.factory('PermissionCategoryChange', ['$sce',
|
||||||
function () {
|
function ($sce) {
|
||||||
return function (params) {
|
return function (params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
reset = params.reset;
|
reset = params.reset,
|
||||||
|
html;
|
||||||
|
|
||||||
if (scope.category === 'Inventory') {
|
if (scope.category === 'Inventory') {
|
||||||
scope.projectrequired = false;
|
scope.projectrequired = false;
|
||||||
scope.permissionTypeHelp =
|
html = "<dl>\n" +
|
||||||
"<dl>\n" +
|
|
||||||
"<dt>Read</dt>\n" +
|
"<dt>Read</dt>\n" +
|
||||||
"<dd>Only allow the user or team to view the inventory.</dd>\n" +
|
"<dd>Only allow the user or team to view the inventory.</dd>\n" +
|
||||||
"<dt>Write</dt>\n" +
|
"<dt>Write</dt>\n" +
|
||||||
@@ -26,10 +26,10 @@ angular.module('PermissionsHelper', [])
|
|||||||
"<dt>Admin</dt>\n" +
|
"<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" +
|
"<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";
|
"</dl>\n";
|
||||||
|
scope.permissionTypeHelp = $sce.trustAsHtml(html);
|
||||||
} else {
|
} else {
|
||||||
scope.projectrequired = true;
|
scope.projectrequired = true;
|
||||||
scope.permissionTypeHelp =
|
html = "<dl>\n" +
|
||||||
"<dl>\n" +
|
|
||||||
"<dt>Run</dt>\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 " +
|
"<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" +
|
"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 " +
|
"<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" +
|
"will only be simulated. No changes will occur.</dd>\n" +
|
||||||
"</dl>\n";
|
"</dl>\n";
|
||||||
|
scope.permissionTypeHelp = $sce.trustAsHtml(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
*/
|
*/
|
||||||
scope.search = function (iterator, page, load, calcOnly) {
|
scope.search = function (iterator, page, load, calcOnly) {
|
||||||
page = page || null;
|
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;
|
calcOnly = (calcOnly) ? true : false;
|
||||||
if (load) {
|
if (load) {
|
||||||
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
|
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
|
||||||
|
|||||||
Reference in New Issue
Block a user