|
156 | 156 | Object.entries(versionFilterKeyMap).map(([key, value]) => [value, key])
|
157 | 157 | );
|
158 | 158 |
|
| 159 | + const APPLICABILITIES_FILTER_DEFAULT = { |
| 160 | + Unspecified: true, |
| 161 | + Unresolved: true, |
| 162 | + MachineApplicable: true, |
| 163 | + MaybeIncorrect: true, |
| 164 | + HasPlaceholders: true |
| 165 | + }; |
| 166 | + |
| 167 | + $scope.applicabilities = { |
| 168 | + ...APPLICABILITIES_FILTER_DEFAULT |
| 169 | + } |
| 170 | + |
159 | 171 | // loadFromURLParameters retrieves filter settings from the URL parameters and assigns them
|
160 | 172 | // to corresponding $scope variables.
|
161 | 173 | function loadFromURLParameters() {
|
|
182 | 194 |
|
183 | 195 | handleParameter('levels', $scope.levels, LEVEL_FILTERS_DEFAULT);
|
184 | 196 | handleParameter('groups', $scope.groups, GROUPS_FILTER_DEFAULT);
|
| 197 | + handleParameter('applicabilities', $scope.applicabilities, APPLICABILITIES_FILTER_DEFAULT); |
185 | 198 |
|
186 | 199 | // Handle 'versions' parameter separately because it needs additional processing
|
187 | 200 | if (urlParameters.versions) {
|
|
249 | 262 | updateURLParameter($scope.levels, 'levels', LEVEL_FILTERS_DEFAULT);
|
250 | 263 | updateURLParameter($scope.groups, 'groups', GROUPS_FILTER_DEFAULT);
|
251 | 264 | updateVersionURLParameter($scope.versionFilters);
|
| 265 | + updateURLParameter($scope.applicabilities, 'applicabilities', APPLICABILITIES_FILTER_DEFAULT); |
252 | 266 | }
|
253 | 267 |
|
254 | 268 | // Add $watches to automatically update URL parameters when the data changes
|
|
270 | 284 | }
|
271 | 285 | }, true);
|
272 | 286 |
|
| 287 | + $scope.$watch('applicabilities', function (newVal, oldVal) { |
| 288 | + if (newVal !== oldVal) { |
| 289 | + updateURLParameter(newVal, 'applicabilities', APPLICABILITIES_FILTER_DEFAULT) |
| 290 | + } |
| 291 | + }, true); |
| 292 | + |
273 | 293 | // Watch for changes in the URL path and update the search and lint display
|
274 | 294 | $scope.$watch(function () { return $location.path(); }, function (newPath) {
|
275 | 295 | const searchParameter = newPath.substring(1);
|
|
327 | 347 | }
|
328 | 348 | };
|
329 | 349 |
|
| 350 | + $scope.toggleApplicabilities = function (value) { |
| 351 | + const applicabilities = $scope.applicabilities; |
| 352 | + for (const key in applicabilities) { |
| 353 | + if (applicabilities.hasOwnProperty(key)) { |
| 354 | + applicabilities[key] = value; |
| 355 | + } |
| 356 | + } |
| 357 | + } |
| 358 | + |
330 | 359 | $scope.resetGroupsToDefault = function () {
|
331 | 360 | $scope.groups = {
|
332 | 361 | ...GROUPS_FILTER_DEFAULT
|
|
430 | 459 | return true;
|
431 | 460 | }
|
432 | 461 |
|
| 462 | + $scope.byApplicabilities = function (lint) { |
| 463 | + return $scope.applicabilities[lint.applicability.applicability]; |
| 464 | + }; |
| 465 | + |
433 | 466 | // Show details for one lint
|
434 | 467 | $scope.openLint = function (lint) {
|
435 | 468 | $scope.open[lint.id] = true;
|
|
0 commit comments