Skip to content

feat: add provisioner tags field on template creation #16656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 25, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Only display provisioner tags when having provisioners
  • Loading branch information
BrunoQuaresma committed Feb 25, 2025
commit 8a35d294ccd8dd6d3f629f4638398dc2aa5eb9fc
53 changes: 27 additions & 26 deletions site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,11 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
});
const getFieldHelpers = getFormHelpers<CreateTemplateFormData>(form, error);

const provisionerDaemonsQuery = useQuery(
const { data: provisioners } = useQuery(
selectedOrg
? {
...provisionerDaemons(selectedOrg.id),
enabled: showOrganizationPicker,
select: (provisioners) => provisioners.length < 1,
}
: { enabled: false },
);
Expand All @@ -237,7 +236,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
// form submission**!! A user could easily see this warning, connect a
// provisioner, and then not refresh the page. Even if they submit without
// a provisioner, it'll just sit in the job queue until they connect one.
const showProvisionerWarning = provisionerDaemonsQuery.data;
const showProvisionerWarning = provisioners ? provisioners.length < 1 : false;

return (
<HorizontalForm onSubmit={form.handleSubmit}>
Expand Down Expand Up @@ -330,29 +329,31 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
</FormFields>
</FormSection>

<FormSection
title="Provisioner tags"
description={
<>
Tags are a way to control which provisioner daemons complete which
build jobs.&nbsp;
<Link
href={docs("/admin/provisioners")}
target="_blank"
rel="noreferrer"
>
Learn more...
</Link>
</>
}
>
<FormFields>
<ProvisionerTagsField
value={form.values.tags}
onChange={(tags) => form.setFieldValue("tags", tags)}
/>
</FormFields>
</FormSection>
{provisioners && provisioners.length > 0 && (
<FormSection
title="Provisioner tags"
description={
<>
Tags are a way to control which provisioner daemons complete which
build jobs.&nbsp;
<Link
href={docs("/admin/provisioners")}
target="_blank"
rel="noreferrer"
>
Learn more...
</Link>
</>
}
>
<FormFields>
<ProvisionerTagsField
value={form.values.tags}
onChange={(tags) => form.setFieldValue("tags", tags)}
/>
</FormFields>
</FormSection>
)}

{/* Variables */}
{variables && variables.length > 0 && (
Expand Down
Loading