diff --git a/apps/client/src/common/components/view-params-editor/viewParams.utils.ts b/apps/client/src/common/components/view-params-editor/viewParams.utils.ts index 746e93f9c..483d5057c 100644 --- a/apps/client/src/common/components/view-params-editor/viewParams.utils.ts +++ b/apps/client/src/common/components/view-params-editor/viewParams.utils.ts @@ -56,13 +56,18 @@ export function makeCustomFieldSelectOptions(customFields: CustomFields, filterI /** * Creates data for a select element that displays project custom data */ -export function makeProjectDataOptions(projectData: ProjectData): SelectOption[] { - return projectData.custom.map((entry, index) => { +export function makeProjectDataOptions( + projectData: ProjectData, + additionalOptions: SelectOption[] = [], +): SelectOption[] { + const generatedOptions = projectData.custom.map((entry, index) => { return { value: `${index}-${entry.title}`, label: entry.title, }; }); + + return [...additionalOptions, ...generatedOptions]; } type ViewParamsObj = { [key: string]: string | FormDataEntryValue }; diff --git a/apps/client/src/features/operator/operator.options.tsx b/apps/client/src/features/operator/operator.options.tsx index bf4a5eda1..3c18e1705 100644 --- a/apps/client/src/features/operator/operator.options.tsx +++ b/apps/client/src/features/operator/operator.options.tsx @@ -13,6 +13,7 @@ import { isStringBoolean } from '../viewers/common/viewUtils'; export const getOperatorOptions = (customFields: CustomFields, timeFormat: string): ViewOption[] => { const fieldOptions = makeOptionsFromCustomFields(customFields, [ + { value: 'none', label: 'None' }, { value: 'title', label: 'Title' }, { value: 'note', label: 'Note' }, ]); @@ -38,7 +39,7 @@ export const getOperatorOptions = (customFields: CustomFields, timeFormat: strin description: 'Field to be shown in the second line of text', type: 'option', values: fieldOptions, - defaultValue: '', + defaultValue: 'none', }, { id: 'subscribe', diff --git a/apps/client/src/views/backstage/backstage.options.ts b/apps/client/src/views/backstage/backstage.options.ts index 7fd2a708a..d591577c0 100644 --- a/apps/client/src/views/backstage/backstage.options.ts +++ b/apps/client/src/views/backstage/backstage.options.ts @@ -17,8 +17,11 @@ export const getBackstageOptions = ( customFields: CustomFields, projectData: ProjectData, ): ViewOption[] => { - const secondaryOptions = makeOptionsFromCustomFields(customFields, [{ value: 'note', label: 'Note' }]); - const projectDataOptions = makeProjectDataOptions(projectData); + const secondaryOptions = makeOptionsFromCustomFields(customFields, [ + { value: 'none', label: 'None' }, + { value: 'note', label: 'Note' }, + ]); + const projectDataOptions = makeProjectDataOptions(projectData, [{ value: 'none', label: 'None' }]); return [ { title: OptionTitle.ClockOptions, collapsible: true, options: [getTimeOption(timeFormat)] }, @@ -32,7 +35,7 @@ export const getBackstageOptions = ( description: 'Select the data source for auxiliary text shown in now and next cards', type: 'option', values: secondaryOptions, - defaultValue: '', + defaultValue: 'none', }, ], }, @@ -47,7 +50,7 @@ export const getBackstageOptions = ( description: 'Select a project data source to show in the view', type: 'option', values: projectDataOptions, - defaultValue: '', + defaultValue: 'none', }, ], }, diff --git a/apps/client/src/views/countdown/countdown.options.ts b/apps/client/src/views/countdown/countdown.options.ts index 7cd1bf26d..1cb11c33e 100644 --- a/apps/client/src/views/countdown/countdown.options.ts +++ b/apps/client/src/views/countdown/countdown.options.ts @@ -14,7 +14,10 @@ export const getCountdownOptions = ( customFields: CustomFields, persistedSubscriptions: EntryId[], ): ViewOption[] => { - const secondaryOptions = makeOptionsFromCustomFields(customFields, [{ value: 'note', label: 'Note' }]); + const secondaryOptions = makeOptionsFromCustomFields(customFields, [ + { value: 'none', label: 'None' }, + { value: 'note', label: 'Note' }, + ]); return [ { title: OptionTitle.ClockOptions, collapsible: true, options: [getTimeOption(timeFormat)] }, @@ -28,7 +31,7 @@ export const getCountdownOptions = ( description: 'Select the data source for auxiliary text shown in the card', type: 'option', values: secondaryOptions, - defaultValue: '', + defaultValue: 'none', }, ], },