Skip to content

Commit a836f97

Browse files
[dashboard] Add a notice of Prebuild GC to the prebuilds list (#20317)
1 parent 1a315de commit a836f97

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

components/dashboard/src/prebuilds/list/PrebuildList.tsx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { useCallback, useEffect, useMemo, useState } from "react";
8-
import { useHistory } from "react-router-dom";
8+
import { Link, useHistory } from "react-router-dom";
99
import { useQueryParams } from "../../hooks/use-query-params";
1010
import { PrebuildListEmptyState } from "./PrebuildListEmptyState";
1111
import { PrebuildListErrorState } from "./PrebuildListErrorState";
@@ -175,21 +175,33 @@ export const PrebuildsList = ({ initialFilter, organizationId, hideOrgSpecificCo
175175
{isLoading && <LoadingState />}
176176

177177
{showTable && (
178-
<PrebuildsTable
179-
prebuilds={prebuilds}
180-
// we check isPreviousData too so we don't show spinner if it's a background refresh
181-
isSearching={isFetching && isPreviousData}
182-
isFetchingNextPage={isFetchingNextPage}
183-
hasNextPage={!!hasNextPage}
184-
filter={filter}
185-
sort={sort}
186-
hasMoreThanOnePage={hasMoreThanOnePage}
187-
hideOrgSpecificControls={!!hideOrgSpecificControls}
188-
onLoadNextPage={() => fetchNextPage()}
189-
onFilterChange={handleFilterChange}
190-
onSort={handleSort}
191-
onTriggerPrebuild={() => setShowRunPrebuildModal(true)}
192-
/>
178+
<>
179+
<PrebuildsTable
180+
prebuilds={prebuilds}
181+
// we check isPreviousData too so we don't show spinner if it's a background refresh
182+
isSearching={isFetching && isPreviousData}
183+
isFetchingNextPage={isFetchingNextPage}
184+
hasNextPage={!!hasNextPage}
185+
filter={filter}
186+
sort={sort}
187+
hasMoreThanOnePage={hasMoreThanOnePage}
188+
hideOrgSpecificControls={!!hideOrgSpecificControls}
189+
onLoadNextPage={() => fetchNextPage()}
190+
onFilterChange={handleFilterChange}
191+
onSort={handleSort}
192+
onTriggerPrebuild={() => setShowRunPrebuildModal(true)}
193+
/>
194+
<div className="flex justify-center mt-4">
195+
<span className="text-pk-content-secondary text-xs max-w-md text-center">
196+
Looking for older prebuilds? Prebuilds are garbage-collected if no workspace is started from
197+
them within seven days. To view records of older prebuilds, please refer to the{" "}
198+
<Link to={"/usage"} className="gp-link">
199+
usage report
200+
</Link>
201+
.
202+
</span>
203+
</div>
204+
</>
193205
)}
194206

195207
{showRunPrebuildModal && (

components/dashboard/src/prebuilds/list/PrebuildTable.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,17 @@ export const PrebuildsTable: FC<Props> = ({
132132
<Subheading className="max-w-md">No results found. Try adjusting your search terms.</Subheading>
133133
</div>
134134
)}
135-
136-
<div className="mt-4 mb-8 flex flex-row justify-center">
137-
{hasNextPage ? (
138-
<LoadingButton variant="secondary" onClick={onLoadNextPage} loading={isFetchingNextPage}>
139-
Load more
140-
</LoadingButton>
141-
) : (
142-
hasMoreThanOnePage && <TextMuted>All prebuilds are loaded</TextMuted>
143-
)}
144-
</div>
135+
{prebuilds.length > 1 && (
136+
<div className="mt-4 mb-8 flex flex-row justify-center">
137+
{hasNextPage ? (
138+
<LoadingButton variant="secondary" onClick={onLoadNextPage} loading={isFetchingNextPage}>
139+
Load more
140+
</LoadingButton>
141+
) : (
142+
hasMoreThanOnePage && <TextMuted>All prebuilds are loaded</TextMuted>
143+
)}
144+
</div>
145+
)}
145146
</div>
146147
</>
147148
);

0 commit comments

Comments
 (0)