Skip to content

Feat/df 1068: Add 'offline' filtering option#1445

Open
jbarnsley10 wants to merge 6 commits into
mainfrom
feat/df-1068-offline-filtering
Open

Feat/df 1068: Add 'offline' filtering option#1445
jbarnsley10 wants to merge 6 commits into
mainfrom
feat/df-1068-offline-filtering

Conversation

@jbarnsley10
Copy link
Copy Markdown
Contributor

@jbarnsley10 jbarnsley10 commented May 15, 2026

Ticket DF-1068

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FormFilterStatus enum (draft, live, offline) and use it in SearchOptions.status and the search Joi validator.
  • Render an "Offline" tag in the form-status template when metadata.offline is set, and sort the status checkboxes alphabetically in the search component.
  • Update designer test files to import and use FormFilterStatus instead of FormStatus.

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.offline is true and the form has a live state, only the Offline tag is rendered and the Live tag is dropped, but when offline is combined with draft the 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, if offline is true but neither draft nor live is set, the conditional falls through to the final else branch 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.

Comment thread model/src/common/search/index.ts Outdated
Comment on lines +7 to 14
{% 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 }}
@sonarqubecloud
Copy link
Copy Markdown

@alexluckett alexluckett self-requested a review May 19, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants