Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 288371b

Browse files
authored
batches: add warning message for large batch changes (#42813)
Addresses #42408.
1 parent 2561593 commit 288371b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

client/web/src/enterprise/batches/batch-spec/edit/workspaces-preview/WorkspacesPreview.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ const WAITING_MESSAGES = [
4343
"So, how's your day? (Still looking for matching workspaces...)",
4444
'Are you staying hydrated? (Still looking for matching workspaces...)',
4545
"Hold your horses, we're still not done yet...",
46+
"A Go developer walks into a bar and tries to defer their bill, but they can't start a tab. (Sorry.)",
4647
]
4748

4849
/* The time to wait until we display the next waiting message, in seconds. */
4950
const WAITING_MESSAGE_INTERVAL = 10
5051

52+
/** The minimum number of resolved workspaces at which we'll show a warning
53+
* about Batch Changes performance. */
54+
const WORKSPACE_WARNING_MIN_TOTAL_COUNT = 2000
55+
5156
interface WorkspacesPreviewProps {
5257
isReadOnly?: boolean
5358
}
@@ -288,6 +293,11 @@ const MemoizedWorkspacesPreview: React.FunctionComponent<
288293
{ctaButton}
289294
</div>
290295
)}
296+
{totalCount !== null && totalCount >= WORKSPACE_WARNING_MIN_TOTAL_COUNT && (
297+
<div className="d-flex flex-column align-items-center w-100 mb-3">
298+
<CTASizeWarning totalCount={totalCount} />
299+
</div>
300+
)}
291301
{(hasPreviewed || isReadOnly) && (
292302
<WorkspacePreviewFilterRow onFiltersChange={setFilters} disabled={isWorkspacesPreviewInProgress} />
293303
)}
@@ -334,3 +344,17 @@ const CTAInstruction: React.FunctionComponent<React.PropsWithChildren<{ active:
334344
</animated.div>
335345
)
336346
}
347+
348+
const CTASizeWarning: React.FunctionComponent<React.PropsWithChildren<{ totalCount: number }>> = ({ totalCount }) => (
349+
<Alert variant="warning">
350+
<div className="mb-2">
351+
<strong>
352+
It's over <s>9000</s> {WORKSPACE_WARNING_MIN_TOTAL_COUNT}!
353+
</strong>
354+
</div>
355+
Batch changes with more than {WORKSPACE_WARNING_MIN_TOTAL_COUNT} workspaces may be unwieldy to manage. We're
356+
working on providing more filtering options, and you can continue with this batch change if you want, but you
357+
may want to break it into {Math.ceil(totalCount / WORKSPACE_WARNING_MIN_TOTAL_COUNT)} or more batch changes if
358+
you can.
359+
</Alert>
360+
)

0 commit comments

Comments
 (0)