Skip to content

Commit

Permalink
feat(eventtemplates): support preset event template type (#1497)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores authored Dec 19, 2024
1 parent 8adfc42 commit 4073e65
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/app/Shared/Components/SelectTemplateSelectorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,23 @@ export const SelectTemplateSelectorForm: React.FC<SelectTemplateSelectorFormProp
})),
},
{
groupLabel: 'Custom Templates',
groupLabel: 'Custom templates',
options: templates
.filter((t) => t.type === 'CUSTOM')
.map((t) => ({
value: `${t.name},${t.type}`,
label: t.name,
})),
},
{
groupLabel: 'Preset templates',
options: templates
.filter((t) => t.type === 'PRESET')
.map((t) => ({
value: `${t.name},${t.type}`,
label: t.name,
})),
},
] as TemplateSelectionGroup[],
[templates],
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/Shared/Services/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export interface EventType {
options: { [key: string]: OptionDescriptor }[];
}

export type TemplateType = 'TARGET' | 'CUSTOM';
export type TemplateType = 'TARGET' | 'CUSTOM' | 'PRESET';

export interface EventTemplate {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ exports[`<CustomRecordingForm /> renders correctly 1`] = `
<optgroup
className=""
disabled={false}
label="Custom Templates"
label="Custom templates"
>
<option
className=""
Expand All @@ -393,6 +393,19 @@ exports[`<CustomRecordingForm /> renders correctly 1`] = `
someEventTemplate
</option>
</optgroup>
<optgroup
className=""
disabled={false}
label="Preset templates"
>
<option
className=""
disabled={true}
value=""
>
No templates
</option>
</optgroup>
</select>
<span
className="pf-v5-c-form-control__utilities"
Expand Down

0 comments on commit 4073e65

Please sign in to comment.