Clippy Lints page - Do not show groups in URL parameters if reset to defaults

This commit is contained in:
Brian Hetro 2023-05-27 18:40:20 -04:00
parent a865d8432c
commit f2e6a99a08
1 changed files with 12 additions and 7 deletions

View File

@ -156,6 +156,10 @@
Object.entries(versionFilterKeyMap).map(([key, value]) => [value, key])
);
// An internal URL change occurs when we are modifying the URL parameters in a way
// that should not reload parameters from the URL
let internalURLChange = false;
// loadFromURLParameters retrieves filter settings from the URL parameters and assigns them
// to corresponding $scope variables.
function loadFromURLParameters() {
@ -266,9 +270,7 @@
}, true);
// Watch for changes in the URL path and update the search and lint display
$scope.$watch(function () {
return $location.path();
}, function (newPath) {
$scope.$watch($location.path, function (newPath) {
const searchParameter = newPath.substring(1);
if ($scope.search !== searchParameter) {
$scope.search = searchParameter;
@ -290,10 +292,11 @@
}
});
$scope.$watch(function () {
return $location.search();
}, function (newParameters) {
loadFromURLParameters();
$scope.$watch($location.search, function (newParameters) {
if (!internalURLChange) {
loadFromURLParameters();
}
internalURLChange = false;
});
$scope.updatePath = function () {
@ -331,6 +334,8 @@
for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) {
groups[key] = value;
}
internalURLChange = true;
$location.search('groups', null);
};
$scope.selectedValuesCount = function (obj) {