mirror of
https://github.com/ansible/awx.git
synced 2026-03-28 22:35:08 -02:30
AC-503 Latest changes. Cleaned up Update button processing steps.
This commit is contained in:
@@ -125,9 +125,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
|
|
||||||
.factory('InventoryStatus', [ '$rootScope', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary',
|
.factory('InventoryStatus', [ '$rootScope', '$routeParams', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary',
|
||||||
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate', 'GroupsEdit',
|
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate', 'GroupsEdit',
|
||||||
function($rootScope, Rest, Alert, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope, SearchInit,
|
function($rootScope, $routeParams, Rest, Alert, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope, SearchInit,
|
||||||
PaginateInit, Refresh, InventoryUpdate, GroupsEdit) {
|
PaginateInit, Refresh, InventoryUpdate, GroupsEdit) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
//Build a summary of a given inventory
|
//Build a summary of a given inventory
|
||||||
@@ -201,11 +201,26 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
scope.groups[i].status_badge_tooltip = status_tip;
|
scope.groups[i].status_badge_tooltip = status_tip;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
||||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||||
|
|
||||||
|
if ($routeParams['status']) {
|
||||||
|
// with status param post update submit
|
||||||
|
scope[list.iterator + 'SearchField'] = 'status';
|
||||||
|
//scope[list.iterator + 'SearchType'] = 'icontains';
|
||||||
|
scope[list.iterator + 'SelectShow'] = true;
|
||||||
|
scope[list.iterator + 'SearchSelectOpts'] = list.fields['status'].searchOptions;
|
||||||
|
for (var opt in list.fields['status'].searchOptions) {
|
||||||
|
if (list.fields['status'].searchOptions[opt].value == $routeParams['status']) {
|
||||||
|
scope[list.iterator + 'SearchSelectValue'] = list.fields['status'].searchOptions[opt];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scope.search(list.iterator);
|
scope.search(list.iterator);
|
||||||
|
|
||||||
|
// Click on group name
|
||||||
scope.GroupsEdit = function(group_id) {
|
scope.GroupsEdit = function(group_id) {
|
||||||
// On the tree, select the first occurrance of the requested group
|
// On the tree, select the first occurrance of the requested group
|
||||||
var node = $('#tree-view').find("li[group_id='" + group_id + "']").first();
|
var node = $('#tree-view').find("li[group_id='" + group_id + "']").first();
|
||||||
@@ -216,6 +231,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
$('#tree-view').jstree('select_node', node);
|
$('#tree-view').jstree('select_node', node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Respond to refresh button
|
||||||
scope.refresh = function() {
|
scope.refresh = function() {
|
||||||
scope['groupSearchSpin'] = true;
|
scope['groupSearchSpin'] = true;
|
||||||
scope['groupLoading'] = true;
|
scope['groupLoading'] = true;
|
||||||
@@ -706,45 +722,33 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
|
|
||||||
// Start the update process
|
// Start the update process
|
||||||
scope.updateGroup = function() {
|
scope.updateGroup = function() {
|
||||||
if (scope['source'] == null || scope['source'] == '') {
|
console.log('working on id: ' + scope.name);
|
||||||
Alert('Missing Configuration', 'The selected group is not configured for updates. You must first edit the group, provide Source settings, ' +
|
console.log('source: ' + scope.source.value);
|
||||||
|
if (scope.source == "" || scope.source == null) {
|
||||||
|
Alert('Missing Configuration', 'The selected group is not configured for updates. You must first edit the group, provide Source settings, ' +
|
||||||
'and then run an update.', 'alert-info');
|
'and then run an update.', 'alert-info');
|
||||||
}
|
}
|
||||||
else {
|
else if (scope.status == 'updating') {
|
||||||
InventoryUpdate({
|
Alert('Update in Progress', 'The inventory update process is currently running for group <em>' +
|
||||||
scope: scope,
|
scope.summary_fields.group.name + '</em>. Use the Refresh button to monitor the status.', 'alert-info');
|
||||||
group_id: group_id,
|
|
||||||
url: scope['group_update_url']
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Start the update process
|
|
||||||
scope.updateGroup = function() {
|
|
||||||
if (scope[source] == "" || scope.groups[i].source == null) {
|
|
||||||
Alert('Missing Configuration', 'The group is not configured for updates. You must provide Source settings before running the update ' +
|
|
||||||
'process.');
|
|
||||||
}
|
|
||||||
else if (scope[status] == 'updating') {
|
|
||||||
Alert('Update in Progress', 'The inventory update process is currently running for this group <em>' +
|
|
||||||
scope.groups[i].summary_fields.group.name + '</em>. Under the Groupmonitor the status.', 'alert-info');
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (scope['source'] == 'Amazon EC2') {
|
if (scope.source == 'Amazon EC2') {
|
||||||
scope['sourceUsernameLabel'] = 'Access Key ID';
|
scope.sourceUsernameLabel = 'Access Key ID';
|
||||||
scope['sourcePasswordLabel'] = 'Secret Access Key';
|
scope.sourcePasswordLabel = 'Secret Access Key';
|
||||||
scope['sourcePasswordConfirmLabel'] = 'Confirm Secret Access Key';
|
scope.sourcePasswordConfirmLabel = 'Confirm Secret Access Key';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope['sourceUsernameLabel'] = 'Username';
|
scope.sourceUsernameLabel = 'Username';
|
||||||
scope['sourcePasswordLabel'] = 'Password';
|
scope.sourcePasswordLabel = 'Password';
|
||||||
scope['sourcePasswordConfirmLabel'] = 'Confirm Password';
|
scope.sourcePasswordConfirmLabel = 'Confirm Password';
|
||||||
}
|
}
|
||||||
InventoryUpdate({
|
InventoryUpdate({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
group_id: id,
|
group_id: group_id,
|
||||||
url: scope.groups[i].related.update,
|
url: scope.group_update_url,
|
||||||
group_name: scope.groups[i].summary_fields.group.name,
|
group_name: scope.name,
|
||||||
group_source: scope.groups[i].source
|
group_source: scope.source.value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,9 +376,8 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
||||||
// Refresh the project list after update request submitted
|
// Refresh the project list after update request submitted
|
||||||
//$location.path(GetBasePath('inventories') + inventory_id + '/groups'
|
//$location.path(GetBasePath('inventories') + inventory_id + '/groups'
|
||||||
InventorySummary({ scope: scope });
|
//InventorySummary({ scope: scope });
|
||||||
$('#tree-form').show();
|
$location.url('/inventories/' + scope['inventory_id'] + '/groups/?status=updating');
|
||||||
//scope.refresh();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removeInventorySubmit) {
|
if (scope.removeInventorySubmit) {
|
||||||
|
|||||||
Reference in New Issue
Block a user