-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove computed inventory fields from Host and Group #5448
Merged
softwarefactory-project-zuul
merged 9 commits into
ansible:devel
from
ryanpetrello:remove-computed-group-and-host-fields
Jan 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
568606d
remove computed inventory fields from Host and Group
ryanpetrello 107d2da
Remove status icons from host nested groups
jakemcdermott 2bc6521
Use related hosts and group counts for delete modal
jakemcdermott ec1c2a8
Remove status icons from group nested groups
jakemcdermott 1220847
Remove unused host status service
jakemcdermott 773b976
Remove dead code
jakemcdermott 44c0eb8
Remove group status cols
jakemcdermott be68a19
reorder migrations after a rebase
ryanpetrello 0f0d9ba
send inv computed tasks *after* commit to avoid a race condition
ryanpetrello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use related hosts and group counts for delete modal
- Loading branch information
commit 2bc6521eee158eb3fa2b16179c25f67082540037
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,11 @@ | |
['$scope', '$state', '$stateParams', 'listDefinition', 'InventoryUpdate', | ||
'GroupsService', 'CancelSourceUpdate', | ||
'GetHostsStatusMsg', 'Dataset', 'inventoryData', 'canAdd', | ||
'InventoryHostsStrings', '$transitions', | ||
'InventoryHostsStrings', '$transitions', 'GetBasePath', 'Rest', | ||
function($scope, $state, $stateParams, listDefinition, InventoryUpdate, | ||
GroupsService, CancelSourceUpdate, | ||
GetHostsStatusMsg, Dataset, inventoryData, canAdd, | ||
InventoryHostsStrings, $transitions){ | ||
InventoryHostsStrings, $transitions, GetBasePath, Rest){ | ||
|
||
let list = listDefinition; | ||
|
||
|
@@ -90,35 +90,51 @@ | |
$state.go('inventories.edit.groups.edit.nested_groups', {group_id: id}); | ||
}; | ||
$scope.deleteGroup = function(group){ | ||
$scope.toDelete = {}; | ||
$scope.strings.deleteModal = {}; | ||
angular.extend($scope.toDelete, group); | ||
if($scope.toDelete.total_groups === 0 && $scope.toDelete.total_hosts === 0) { | ||
// This group doesn't have any child groups or hosts - the user is just trying to delete | ||
// the group | ||
$scope.deleteOption = "delete"; | ||
} | ||
else { | ||
$scope.strings.deleteModal.group = InventoryHostsStrings.get('deletegroup.GROUP', $scope.toDelete.total_groups); | ||
$scope.strings.deleteModal.host = InventoryHostsStrings.get('deletegroup.HOST', $scope.toDelete.total_hosts); | ||
|
||
if($scope.toDelete.total_groups === 0 || $scope.toDelete.total_hosts === 0) { | ||
if($scope.toDelete.total_groups === 0) { | ||
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_HOST', $scope.toDelete.total_hosts); | ||
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_HOST', $scope.toDelete.total_hosts); | ||
const promises = []; | ||
|
||
Rest.setUrl(group.related.hosts); | ||
promises.push(Rest.get()); | ||
|
||
Rest.setUrl(group.related.children); | ||
promises.push(Rest.get()); | ||
|
||
jakemcdermott marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Promise.all(promises) | ||
.then(([hostResponse, groupResponse]) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @marshmalien @jlmitch5 |
||
$scope.toDelete = {}; | ||
$scope.strings.deleteModal = {}; | ||
$scope.toDelete.hostCount = _.get(hostResponse, ['data', 'count'], 0); | ||
$scope.toDelete.groupCount = _.get(groupResponse, ['data', 'count'], 0); | ||
angular.extend($scope.toDelete, group); | ||
|
||
if($scope.toDelete.groupCount === 0 && $scope.toDelete.hostCount === 0) { | ||
// This group doesn't have any child groups or hosts - the user is just trying to delete | ||
// the group | ||
$scope.deleteOption = "delete"; | ||
} | ||
else if($scope.toDelete.total_hosts === 0) { | ||
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_GROUP', $scope.toDelete.total_groups); | ||
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_GROUP', $scope.toDelete.total_groups); | ||
else { | ||
$scope.strings.deleteModal.group = InventoryHostsStrings.get('deletegroup.GROUP', $scope.toDelete.groupCount); | ||
$scope.strings.deleteModal.host = InventoryHostsStrings.get('deletegroup.HOST', $scope.toDelete.hostCount); | ||
|
||
if($scope.toDelete.groupCount === 0 || $scope.toDelete.groupCount === 0) { | ||
if($scope.toDelete.groupCount === 0) { | ||
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_HOST', $scope.toDelete.hostCount); | ||
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_HOST', $scope.toDelete.hostCount); | ||
} | ||
else if($scope.toDelete.hostCount === 0) { | ||
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_GROUP', $scope.toDelete.groupCount); | ||
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_GROUP', $scope.toDelete.groupCount); | ||
} | ||
} | ||
else { | ||
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_GROUPS_AND_HOSTS', {groups: $scope.toDelete.groupCount, hosts: $scope.toDelete.hostCount}); | ||
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_GROUPS_AND_HOSTS', {groups: $scope.toDelete.groupCount, hosts: $scope.toDelete.hostCount}); | ||
} | ||
} | ||
} | ||
else { | ||
$scope.strings.deleteModal.deleteGroupsHosts = InventoryHostsStrings.get('deletegroup.DELETE_GROUPS_AND_HOSTS', {groups: $scope.toDelete.total_groups, hosts: $scope.toDelete.total_hosts}); | ||
$scope.strings.deleteModal.promoteGroupsHosts = InventoryHostsStrings.get('deletegroup.PROMOTE_GROUPS_AND_HOSTS', {groups: $scope.toDelete.total_groups, hosts: $scope.toDelete.total_hosts}); | ||
} | ||
} | ||
|
||
$('#group-delete-modal').modal('show'); | ||
$('#group-delete-modal').modal('show'); | ||
}); | ||
|
||
|
||
}; | ||
$scope.confirmDelete = function(){ | ||
let reloadListStateParams = null; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These requests are needed in order to know if a group has any groups or hosts. This info is needed for deciding when to show the delete vs promote prompt on the deletion warning.