Feat/df 1068: Add 'offline' filtering option#1445
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an "offline" option to the forms library status filter and surfaces an Offline tag in the form-status component. A new FormFilterStatus enum is introduced (alongside the existing FormStatus) so that the filter type can include offline without altering the runtime status type, and the Joi search schema and SearchOptions type are updated accordingly. Existing tests are migrated from FormStatus to FormFilterStatus.
Changes:
- Introduce
FormFilterStatusenum (draft,live,offline) and use it inSearchOptions.statusand the search Joi validator. - Render an "Offline" tag in the form-status template when
metadata.offlineis set, and sort the status checkboxes alphabetically in the search component. - Update designer test files to import and use
FormFilterStatusinstead ofFormStatus.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| model/src/common/enums.ts | Adds new FormFilterStatus enum including Offline. |
| model/src/common/search/types.ts | Switches SearchOptions.status to FormFilterStatus[]. |
| model/src/common/search/index.ts | Allows 'offline' in the status Joi validator. |
| designer/server/src/common/components/form-status/template.njk | Adds Offline tag and new conditional branches based on metadata.offline. |
| designer/server/src/common/components/search/template.njk | Sorts status checkboxes alphabetically. |
| designer/server/src/lib/forms.test.js | Updates type references to FormFilterStatus. |
| designer/server/src/models/forms/library.test.js | Updates type references to FormFilterStatus. |
| designer/server/src/routes/forms/library.test.js | Updates type references to FormFilterStatus. |
Comments suppressed due to low confidence (1)
designer/server/src/common/components/form-status/template.njk:17
- When
params.metadata.offlineis true and the form has alivestate, only the Offline tag is rendered and the Live tag is dropped, but when offline is combined withdraftthe Draft tag is still shown alongside Offline. This is asymmetric and means a viewer cannot tell that an offline form was previously published live. Additionally, ifofflineis true but neitherdraftnorliveis set, the conditional falls through to the finalelsebranch and renders a "Draft" tag, which is misleading. Consider rendering Offline as an additive tag (similar to Draft) rather than a replacement, and handling the offline-only fallback explicitly.
{% if params.metadata.offline and params.metadata.draft | length %}
{{ tagDraft }} {{ tagOffline }}
{% elseif params.metadata.offline and params.metadata.live | length %}
{{ tagOffline }}
{% elseif params.metadata.draft | length and params.metadata.live | length %}
{{ tagDraft }} {{ tagLive }}
{% elseif params.metadata.live | length %}
{{ tagLive }}
{% else %}
{{ tagDraft }}
{% endif %}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {% if params.metadata.offline and params.metadata.draft | length %} | ||
| {{ tagDraft }} {{ tagOffline }} | ||
| {% elseif params.metadata.offline and params.metadata.live | length %} | ||
| {{ tagOffline }} | ||
| {% elseif params.metadata.draft | length and params.metadata.live | length %} | ||
| {{ tagDraft }} {{ tagLive }} | ||
| {% elseif params.metadata.live | length %} | ||
| {{ tagLive }} |
|



Ticket DF-1068