This PR converts the format of filters in the topcoat core frontend from an object in the form of
{ filterName1: filterValue1, filterName2: filterValue2, ... }
into an array in the format of:
[ { name: filterName1, value: filterValue1, defaultValue: <optional default value>, skipOnReset: <default to false, but can be set to true as appropriate> }, ... ]
This update allows the code to reset "all" filters while leaving things like modify columns, sorting, "Issues buy" option etc. alone even though under the hood they work like filters.
Additionally it allows default values to be set on a filter, for example issue status, so that resetting the filters does not simply remove them but rather reverts the state back to the what it was before the user interacted with the page.
It does not change the format of the filters on the backend. There is no point sending default values or whether or not a filter should be skipped on reset to the back end since all of that logic is on the front end, instead filters are sent in the original format to the back end.
Additional changes
Note that the addition of ...mapGetters("page", ["getFilterState"]), in common_mixin is so that topcoat developers don't have to manually find the filter before testing its value.
Notes for the reviewer
To test, this requires updates in both topcoat-public and topcoat-reports so check out the 'feat/resetable_filters' topcoat-reports branch and run a build and sync modules.
What this does
This PR converts the format of filters in the topcoat core frontend from an object in the form of
{ filterName1: filterValue1, filterName2: filterValue2, ... }
into an array in the format of:
[ { name: filterName1, value: filterValue1, defaultValue: <optional default value>, skipOnReset: <default to false, but can be set to true as appropriate> }, ... ]
This update allows the code to reset "all" filters while leaving things like modify columns, sorting, "Issues buy" option etc. alone even though under the hood they work like filters.
Additionally it allows default values to be set on a filter, for example issue status, so that resetting the filters does not simply remove them but rather reverts the state back to the what it was before the user interacted with the page.
It does not change the format of the filters on the backend. There is no point sending default values or whether or not a filter should be skipped on reset to the back end since all of that logic is on the front end, instead filters are sent in the original format to the back end.
Additional changes
Note that the addition of
...mapGetters("page", ["getFilterState"]),
in common_mixin is so that topcoat developers don't have to manually find the filter before testing its value.Notes for the reviewer
To test, this requires updates in both topcoat-public and topcoat-reports so check out the 'feat/resetable_filters' topcoat-reports branch and run a build and sync modules.