|
156 | 156 | Object.entries(versionFilterKeyMap).map(([key, value]) => [value, key])
|
157 | 157 | );
|
158 | 158 |
|
159 |
| - const APPLICABILITIES_DEFAULT = { |
160 |
| - unspecified: true, |
161 |
| - unresolved: true, |
162 |
| - machineApplicable: true, |
163 |
| - maybeIncorrect: true, |
164 |
| - hasPlaceholders: true |
| 159 | + const APPLICABILITIES_FILTER_DEFAULT = { |
| 160 | + Unspecified: true, |
| 161 | + Unresolved: true, |
| 162 | + MachineApplicable: true, |
| 163 | + MaybeIncorrect: true, |
| 164 | + HasPlaceholders: true |
165 | 165 | };
|
166 | 166 |
|
167 |
| - $scope.applicabilities = APPLICABILITIES_DEFAULT; |
| 167 | + $scope.applicabilities = { |
| 168 | + ...APPLICABILITIES_FILTER_DEFAULT |
| 169 | + } |
168 | 170 |
|
169 | 171 | // loadFromURLParameters retrieves filter settings from the URL parameters and assigns them
|
170 | 172 | // to corresponding $scope variables.
|
|
192 | 194 |
|
193 | 195 | handleParameter('levels', $scope.levels, LEVEL_FILTERS_DEFAULT);
|
194 | 196 | handleParameter('groups', $scope.groups, GROUPS_FILTER_DEFAULT);
|
| 197 | + handleParameter('applicabilities', $scope.applicabilities, APPLICABILITIES_FILTER_DEFAULT); |
195 | 198 |
|
196 | 199 | // Handle 'versions' parameter separately because it needs additional processing
|
197 | 200 | if (urlParameters.versions) {
|
|
259 | 262 | updateURLParameter($scope.levels, 'levels', LEVEL_FILTERS_DEFAULT);
|
260 | 263 | updateURLParameter($scope.groups, 'groups', GROUPS_FILTER_DEFAULT);
|
261 | 264 | updateVersionURLParameter($scope.versionFilters);
|
| 265 | + updateURLParameter($scope.applicabilities, 'applicabilities', APPLICABILITIES_FILTER_DEFAULT); |
262 | 266 | }
|
263 | 267 |
|
264 | 268 | // Add $watches to automatically update URL parameters when the data changes
|
|
280 | 284 | }
|
281 | 285 | }, true);
|
282 | 286 |
|
| 287 | + $scope.$watch('applicabilities', function (newVal, oldVal) { |
| 288 | + console.log("Test"); |
| 289 | + if (newVal !== oldVal) { |
| 290 | + updateURLParameter(newVal, 'applicabilities', APPLICABILITIES_FILTER_DEFAULT) |
| 291 | + } |
| 292 | + }, true); |
| 293 | + |
283 | 294 | // Watch for changes in the URL path and update the search and lint display
|
284 | 295 | $scope.$watch(function () { return $location.path(); }, function (newPath) {
|
285 | 296 | const searchParameter = newPath.substring(1);
|
|
337 | 348 | }
|
338 | 349 | };
|
339 | 350 |
|
| 351 | + $scope.toggleApplicabilities = function (value) { |
| 352 | + const applicabilities = $scope.applicabilities; |
| 353 | + for (const key in applicabilities) { |
| 354 | + if (applicabilities.hasOwnProperty(key)) { |
| 355 | + applicabilities[key] = value; |
| 356 | + } |
| 357 | + } |
| 358 | + } |
| 359 | + |
340 | 360 | $scope.resetGroupsToDefault = function () {
|
341 | 361 | $scope.groups = {
|
342 | 362 | ...GROUPS_FILTER_DEFAULT
|
|
440 | 460 | return true;
|
441 | 461 | }
|
442 | 462 |
|
| 463 | + $scope.byApplicabilities = function (lint) { |
| 464 | + return $scope.applicabilities[lint.applicability.applicability]; |
| 465 | + }; |
| 466 | + |
443 | 467 | // Show details for one lint
|
444 | 468 | $scope.openLint = function (lint) {
|
445 | 469 | $scope.open[lint.id] = true;
|
|
0 commit comments