Skip to content

Commit c104aca

Browse files
committed
fix: drop filtering by-resources
1 parent 58ae2ce commit c104aca

8 files changed

Lines changed: 10 additions & 86 deletions

File tree

spec/openapi.dashboard-api.yaml

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/server/api/routers/templates.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ export const templatesRouter = createTRPCRouter({
4141
z.object({
4242
cursor: z.string().optional(),
4343
limit: z.number().int().min(1).max(100).default(50),
44-
cpuCount: z.number().int().positive().optional(),
45-
memoryMB: z.number().int().positive().optional(),
4644
public: z.boolean().optional(),
4745
search: z.string().optional(),
4846
sort: z
@@ -61,8 +59,6 @@ export const templatesRouter = createTRPCRouter({
6159
const result = await ctx.templatesRepository.listTeamTemplates({
6260
cursor: input.cursor,
6361
limit: input.limit,
64-
cpuCount: input.cpuCount,
65-
memoryMB: input.memoryMB,
6662
public: input.public,
6763
search: input.search,
6864
sort: input.sort,

src/core/shared/contracts/dashboard-api.types.ts

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/dashboard/templates/list/header.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ interface TemplatesHeaderProps {
1212
export default function TemplatesHeader({ table }: TemplatesHeaderProps) {
1313
'use no memo'
1414

15-
const { globalFilter, cpuCount, memoryMB, isPublic } = useTemplateTableStore()
16-
const isFiltered =
17-
Boolean(globalFilter) ||
18-
cpuCount !== undefined ||
19-
memoryMB !== undefined ||
20-
isPublic !== undefined
15+
const { globalFilter, isPublic } = useTemplateTableStore()
16+
const isFiltered = Boolean(globalFilter) || isPublic !== undefined
2117

2218
// With server-side pagination we only know how many rows are currently
2319
// loaded, not the grand total.

src/features/dashboard/templates/list/table-body.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export function TemplatesTableBody({
3535
}: TemplatesTableBodyProps) {
3636
'use no memo'
3737

38-
const { resetFilters, globalFilter, cpuCount, memoryMB, isPublic } =
39-
useTemplateTableStore()
38+
const { resetFilters, globalFilter, isPublic } = useTemplateTableStore()
4039

4140
const centerRows = table.getCenterRows()
4241
const {
@@ -57,11 +56,7 @@ export function TemplatesTableBody({
5756

5857
const isEmpty = templates && centerRows.length === 0
5958

60-
const hasFilter =
61-
Boolean(globalFilter) ||
62-
cpuCount !== undefined ||
63-
memoryMB !== undefined ||
64-
isPublic !== undefined
59+
const hasFilter = Boolean(globalFilter) || isPublic !== undefined
6560

6661
if (isEmpty) {
6762
if (hasFilter) {

src/features/dashboard/templates/list/table-config.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export const useColumns = (deps: unknown[]) => {
6161
size: 64,
6262
enableResizing: false,
6363
cell: CpuCell,
64-
filterFn: 'equals',
6564
enableSorting: false,
6665
},
6766
{
@@ -70,7 +69,6 @@ export const useColumns = (deps: unknown[]) => {
7069
size: 80,
7170
enableResizing: false,
7271
cell: MemoryCell,
73-
filterFn: 'equals',
7472
enableSorting: false,
7573
},
7674
{

src/features/dashboard/templates/list/table-filters.tsx

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import { Separator } from '@/ui/primitives/separator'
2323
import { TableFilterButton } from '@/ui/table-filter-button'
2424
import { useTemplateTableStore } from './stores/table-store'
2525

26-
// Components
27-
const ResourcesFilter = () => {
26+
// Currently unused on the templates page (server-side resource filtering was
27+
// dropped from the dropdown); kept exported for reuse on the builds page.
28+
export const ResourcesFilter = () => {
2829
const { cpuCount, setCpuCount, memoryMB, setMemoryMB } =
2930
useTemplateTableStore()
3031

@@ -132,15 +133,9 @@ const TemplatesTableFilters = React.forwardRef<
132133
TemplatesTableFiltersProps
133134
>(({ className, ...props }, ref) => {
134135
const {
135-
globalFilter,
136-
cpuCount,
137-
memoryMB,
138136
isPublic,
139137
createdAfter,
140138
createdBefore,
141-
setGlobalFilter,
142-
setCpuCount,
143-
setMemoryMB,
144139
setIsPublic,
145140
setCreatedAfter,
146141
setCreatedBefore,
@@ -161,14 +156,6 @@ const TemplatesTableFilters = React.forwardRef<
161156
<DropdownMenuContent>
162157
<DropdownMenuGroup>
163158
<DropdownMenuLabel>Filters</DropdownMenuLabel>
164-
<DropdownMenuSub>
165-
<DropdownMenuSubTrigger>Resources</DropdownMenuSubTrigger>
166-
<DropdownMenuPortal>
167-
<DropdownMenuSubContent>
168-
<ResourcesFilter />
169-
</DropdownMenuSubContent>
170-
</DropdownMenuPortal>
171-
</DropdownMenuSub>
172159
<DropdownMenuSub>
173160
<DropdownMenuSubTrigger>Visibility</DropdownMenuSubTrigger>
174161
<DropdownMenuPortal>
@@ -207,20 +194,6 @@ const TemplatesTableFilters = React.forwardRef<
207194
</DropdownMenu>
208195

209196
{/* Filter Pills */}
210-
{cpuCount && (
211-
<TableFilterButton
212-
label="CPU"
213-
value={`${cpuCount} cores`}
214-
onClick={() => setCpuCount(undefined)}
215-
/>
216-
)}
217-
{memoryMB && (
218-
<TableFilterButton
219-
label="Memory"
220-
value={`${memoryMB} MB`}
221-
onClick={() => setMemoryMB(undefined)}
222-
/>
223-
)}
224197
{isPublic !== undefined && (
225198
<TableFilterButton
226199
label="Visibility"

src/features/dashboard/templates/list/table.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function TemplatesTable() {
5555

5656
const { sorting, setSorting, globalFilter, setGlobalFilter } =
5757
useTemplateTableStore()
58-
const { cpuCount, memoryMB, isPublic } = useTemplateTableStore()
58+
const { isPublic } = useTemplateTableStore()
5959

6060
// Persisted state (URL hash) may still reference columns that are no longer sortable.
6161
const activeSorting = useMemo(
@@ -85,8 +85,6 @@ export default function TemplatesTable() {
8585
{
8686
teamSlug,
8787
limit: TEMPLATES_PAGE_SIZE,
88-
cpuCount,
89-
memoryMB,
9088
public: isPublic,
9189
search: globalFilter || undefined,
9290
sort,
@@ -107,8 +105,6 @@ export default function TemplatesTable() {
107105
const { isRefetching, clearRefetching } = useTemplatesRefetchTracking(
108106
sort,
109107
globalFilter,
110-
cpuCount,
111-
memoryMB,
112108
isPublic
113109
)
114110

@@ -155,7 +151,7 @@ export default function TemplatesTable() {
155151
scrollRef.current.scrollTop = 0
156152
scrollRef.current.scrollLeft = 0
157153
}
158-
}, [sort, globalFilter, cpuCount, memoryMB, isPublic])
154+
}, [sort, globalFilter, isPublic])
159155

160156
if (templatesError) {
161157
return (
@@ -243,8 +239,6 @@ export default function TemplatesTable() {
243239
function useTemplatesRefetchTracking(
244240
sort: string,
245241
globalFilter: string,
246-
cpuCount: number | undefined,
247-
memoryMB: number | undefined,
248242
isPublic: boolean | undefined
249243
) {
250244
const [isRefetching, setIsRefetching] = useState(false)
@@ -257,7 +251,7 @@ function useTemplatesRefetchTracking(
257251
return
258252
}
259253
setIsRefetching(true)
260-
}, [sort, globalFilter, cpuCount, memoryMB, isPublic])
254+
}, [sort, globalFilter, isPublic])
261255

262256
const clearRefetching = useCallback(() => setIsRefetching(false), [])
263257

0 commit comments

Comments
 (0)