This PR makes progress on getodk/central#671, adding a badge to one more nav tab. We will rename the project "Overview" tab to "Forms", then show the form count in a badge on the tab.
What has been done to verify that this works as intended?
Trying it out some locally, new tests.
Why is this the best possible solution? Were any other approaches considered?
One thing I wanted to make sure was the case was that the form count in the badge matches the number of forms in the forms table. I thought that might not be the case, because the FormTable component had logic to filter the form list. Specifically, the component wouldn't show draft forms to Data Collector users and would filter them out. However, it looks like that logic is no longer needed in Frontend. Backend seems to be doing that filtering now, which means that the form count in the badge should match the table without additional effort. Actually, it does look like there is a related Backend issue in this area (getodk/central#687), but we can fix that in Backend, and in general, I don't think we need to do anything extra in Frontend. We just show the forms property from the project response in the badge, and we also update that property if for some reason it differs from the form list.
Another thing this PR does is update the forms property when an action can be expected to have changed it. When a form is created, the property is incremented, and when a form is deleted, it is decremented.
Before submitting this PR, please make sure you have:
[x] run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
[x] verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced
This PR makes progress on getodk/central#671, adding a badge to one more nav tab. We will rename the project "Overview" tab to "Forms", then show the form count in a badge on the tab.
What has been done to verify that this works as intended?
Trying it out some locally, new tests.
Why is this the best possible solution? Were any other approaches considered?
One thing I wanted to make sure was the case was that the form count in the badge matches the number of forms in the forms table. I thought that might not be the case, because the
FormTable
component had logic to filter the form list. Specifically, the component wouldn't show draft forms to Data Collector users and would filter them out. However, it looks like that logic is no longer needed in Frontend. Backend seems to be doing that filtering now, which means that the form count in the badge should match the table without additional effort. Actually, it does look like there is a related Backend issue in this area (getodk/central#687), but we can fix that in Backend, and in general, I don't think we need to do anything extra in Frontend. We just show theforms
property from the project response in the badge, and we also update that property if for some reason it differs from the form list.Another thing this PR does is update the
forms
property when an action can be expected to have changed it. When a form is created, the property is incremented, and when a form is deleted, it is decremented.Before submitting this PR, please make sure you have:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes