mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Fixed host filter tag removal
This commit is contained in:
@@ -324,12 +324,11 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
if (Array.isArray(set[key])){
|
if (Array.isArray(set[key])){
|
||||||
_.remove(set[key], (item) => item === value);
|
_.remove(set[key], (item) => item === value);
|
||||||
// If the array is now empty, remove that key
|
// If the array is now empty, remove that key
|
||||||
if(set[key].length === 0) {
|
if (set[key].length === 0) {
|
||||||
delete set[key];
|
delete set[key];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
if ($scope.singleSearchParam && set[$scope.singleSearchParam] && set[$scope.singleSearchParam].includes("%20and%20")) {
|
||||||
if($scope.singleSearchParam && set[$scope.singleSearchParam] && set[$scope.singleSearchParam].includes("%20and%20")) {
|
|
||||||
let searchParamParts = set[$scope.singleSearchParam].split("%20and%20");
|
let searchParamParts = set[$scope.singleSearchParam].split("%20and%20");
|
||||||
// The value side of each paramPart might have been encoded in SmartSearch.splitFilterIntoTerms
|
// The value side of each paramPart might have been encoded in SmartSearch.splitFilterIntoTerms
|
||||||
_.each(searchParamParts, (paramPart, paramPartIndex) => {
|
_.each(searchParamParts, (paramPart, paramPartIndex) => {
|
||||||
@@ -340,8 +339,7 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
searchParamParts.splice(index, 1);
|
searchParamParts.splice(index, 1);
|
||||||
}
|
}
|
||||||
set[$scope.singleSearchParam] = searchParamParts.join("%20and%20");
|
set[$scope.singleSearchParam] = searchParamParts.join("%20and%20");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
delete set[key];
|
delete set[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,8 +348,7 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
|
|
||||||
if (termParts.length === 1) {
|
if (termParts.length === 1) {
|
||||||
removed = searchWithoutKey(tagToRemove);
|
removed = searchWithoutKey(tagToRemove);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let root = termParts[0].split(".")[0].replace(/^-/, '');
|
let root = termParts[0].split(".")[0].replace(/^-/, '');
|
||||||
let encodeParams = {
|
let encodeParams = {
|
||||||
term: tagToRemove,
|
term: tagToRemove,
|
||||||
@@ -382,11 +379,10 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
removed = searchWithoutKey(termParts[termParts.length-1]);
|
removed = searchWithoutKey(termParts[termParts.length-1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let cleared = _.cloneDeep(queryset);
|
removeFromQuerySet(queryset);
|
||||||
removeFromQuerySet(cleared);
|
if (!$scope.querySet) {
|
||||||
if(!$scope.querySet) {
|
|
||||||
$state.go('.', {
|
$state.go('.', {
|
||||||
[$scope.iterator + '_search']: cleared }).then(function(){
|
[$scope.iterator + '_search']: queryset }).then(function(){
|
||||||
// ISSUE: for some reason deleting a tag from a list in a modal does not
|
// ISSUE: for some reason deleting a tag from a list in a modal does not
|
||||||
// remove the param from $stateParams. Here we'll manually check to make sure
|
// remove the param from $stateParams. Here we'll manually check to make sure
|
||||||
// that that happened and remove it if it didn't.
|
// that that happened and remove it if it didn't.
|
||||||
@@ -398,11 +394,12 @@ export default ['$stateParams', '$scope', '$state', 'GetBasePath', 'QuerySet', '
|
|||||||
if($scope.querySet) {
|
if($scope.querySet) {
|
||||||
$scope.querySet = queryset;
|
$scope.querySet = queryset;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.dataset = res.data;
|
$scope.dataset = res.data;
|
||||||
$scope.collection = res.data.results;
|
$scope.collection = res.data.results;
|
||||||
});
|
|
||||||
|
|
||||||
generateSearchTags();
|
generateSearchTags();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.clearAllTerms = function(){
|
$scope.clearAllTerms = function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user