fix: show no provisioners warning (#17835)

<img width="1510" alt="Screenshot 2025-05-14 at 14 53 02"
src="https://github.com/user-attachments/assets/f9c0fbb9-ea39-4fbc-a550-00d9f609a01e"
/>

Fix https://github.com/coder/coder/issues/17421
This commit is contained in:
Bruno Quaresma
2025-05-15 11:37:20 -03:00
committed by GitHub
parent 1bacd82e80
commit ba6690f2ee
2 changed files with 9 additions and 5 deletions
@@ -78,6 +78,10 @@ export const Logs: Story = {
...MockTemplateVersion.job,
status: "running",
},
matched_provisioners: {
count: 1,
available: 1,
},
},
},
decorators: [withWebSocket],
@@ -29,10 +29,6 @@ export const BuildLogsDrawer: FC<BuildLogsDrawerProps> = ({
variablesSectionRef,
...drawerProps
}) => {
const matchingProvisioners = templateVersion?.matched_provisioners?.count;
const availableProvisioners =
templateVersion?.matched_provisioners?.available;
const logs = useWatchVersionLogs(templateVersion);
const logsContainer = useRef<HTMLDivElement>(null);
@@ -60,6 +56,10 @@ export const BuildLogsDrawer: FC<BuildLogsDrawerProps> = ({
error instanceof JobError &&
error.job.error_code === "REQUIRED_TEMPLATE_VARIABLES";
const matchingProvisioners = templateVersion?.matched_provisioners?.count;
const availableProvisioners =
templateVersion?.matched_provisioners?.available;
return (
<Drawer anchor="right" {...drawerProps}>
<div css={styles.root}>
@@ -85,7 +85,7 @@ export const BuildLogsDrawer: FC<BuildLogsDrawerProps> = ({
drawerProps.onClose();
}}
/>
) : logs ? (
) : availableProvisioners && availableProvisioners > 0 && logs ? (
<section ref={logsContainer} css={styles.logs}>
<WorkspaceBuildLogs logs={logs} css={{ border: 0 }} />
</section>