Skip to content

Commit dbca22a

Browse files
committed
fix: rename misleading prop
1 parent 8f9ce72 commit dbca22a

File tree

2 files changed

+13
-43
lines changed

2 files changed

+13
-43
lines changed

site/src/pages/WorkspacesPage/BatchUpdateModalForm.tsx

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,16 @@ const ReviewForm: FC<ReviewFormProps> = ({
176176
? templateVersionQueries.map((q) => q.data)
177177
: undefined;
178178

179-
const [running, notRunning] = _.partition(
180-
readyToUpdate,
181-
(ws) => ws.latest_build.status === "running",
179+
const runningIds = new Set<string>(
180+
readyToUpdate
181+
.filter((ws) => ws.latest_build.status === "running")
182+
.map((ws) => ws.id),
182183
);
183184

184185
const workspacesChangedWhileOpen = workspacesToUpdate !== cachedWorkspaces;
185-
const consequencesResolved = running.length === 0 || acceptedConsequences;
186+
const consequencesResolved = runningIds.size === 0 || acceptedConsequences;
186187
const canSubmit =
187-
consequencesResolved &&
188-
error === undefined &&
189-
(running.length > 0 || notRunning.length > 0);
188+
consequencesResolved && error === undefined && readyToUpdate.length > 0;
190189

191190
return (
192191
<form
@@ -232,37 +231,7 @@ const ReviewForm: FC<ReviewFormProps> = ({
232231
</div>
233232

234233
<ul className="list-none p-0 flex flex-col rounded-md border border-solid border-border">
235-
{running.map((ws) => {
236-
const matchedQuery = templateVersionQueries.find(
237-
(q) => q.data?.id === ws.template_active_version_id,
238-
);
239-
const newTemplateName = matchedQuery?.data?.name;
240-
241-
return (
242-
<li
243-
key={ws.id}
244-
className="[&:not(:last-child)]:border-b-border [&:not(:last-child)]:border-b [&:not(:last-child)]:border-solid border-0"
245-
>
246-
<ReviewPanel
247-
running
248-
className="border-none"
249-
workspaceName={ws.name}
250-
workspaceIconUrl={ws.template_icon}
251-
label={
252-
newTemplateName !== undefined && (
253-
<TemplateNameChange
254-
newTemplateName={newTemplateName}
255-
oldTemplateName={
256-
ws.latest_build.template_version_name
257-
}
258-
/>
259-
)
260-
}
261-
/>
262-
</li>
263-
);
264-
})}
265-
{notRunning.map((ws) => {
234+
{readyToUpdate.map((ws) => {
266235
const matchedQuery = templateVersionQueries.find(
267236
(q) => q.data?.id === ws.template_active_version_id,
268237
);
@@ -275,6 +244,7 @@ const ReviewForm: FC<ReviewFormProps> = ({
275244
>
276245
<ReviewPanel
277246
className="border-none"
247+
running={runningIds.has(ws.id)}
278248
workspaceName={ws.name}
279249
workspaceIconUrl={ws.template_icon}
280250
label={
@@ -367,14 +337,14 @@ const ReviewForm: FC<ReviewFormProps> = ({
367337
type BatchUpdateModalFormProps = Readonly<{
368338
workspacesToUpdate: readonly Workspace[];
369339
open: boolean;
370-
loading: boolean;
340+
isProcessing: boolean;
371341
onClose: () => void;
372342
onSubmit: () => void;
373343
}>;
374344

375345
export const BatchUpdateModalForm: FC<BatchUpdateModalFormProps> = ({
376346
open,
377-
loading,
347+
isProcessing,
378348
workspacesToUpdate,
379349
onClose,
380350
onSubmit,
@@ -389,7 +359,7 @@ export const BatchUpdateModalForm: FC<BatchUpdateModalFormProps> = ({
389359
}}
390360
>
391361
<DialogContent className="max-w-screen-md">
392-
{loading ? (
362+
{isProcessing ? (
393363
<>
394364
<DialogTitle>Loading&hellip;</DialogTitle>
395365
<Loader />

site/src/pages/WorkspacesPage/WorkspacesPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ const WorkspacesPage: FC = () => {
162162

163163
<BatchUpdateModalForm
164164
open={activeBatchAction === "update"}
165-
loading={batchActions.isProcessing}
165+
isProcessing={batchActions.isProcessing}
166166
workspacesToUpdate={checkedWorkspaces}
167167
onClose={() => setActiveBatchAction(undefined)}
168168
onSubmit={async () => {
169-
console.log("Hooray!");
169+
window.alert("Hooray!");
170170
/**
171171
* @todo Make sure this gets added back in once more of the
172172
* component has been fleshed out

0 commit comments

Comments
 (0)