Openstatus www.openstatus.dev

chore: add monitor type filter (#1077)

authored by

Maximilian Kaske and committed by
GitHub
1560099f 06268d86

+22 -2
+9
apps/web/src/components/data-table/monitor/columns.tsx
··· 47 47 accessorFn: (row) => row.monitor.id, 48 48 }, 49 49 { 50 + id: "jobType", 51 + accessorKey: "jobType", 52 + accessorFn: (row) => row.monitor.jobType, 53 + filterFn: (row, _id, value) => { 54 + if (!Array.isArray(value)) return true; 55 + return value.includes(row.original.monitor.jobType); 56 + }, 57 + }, 58 + { 50 59 id: "select", 51 60 header: ({ table }) => ( 52 61 <Checkbox
+10
apps/web/src/components/data-table/monitor/data-table-toolbar.tsx
··· 60 60 ]} 61 61 /> 62 62 )} 63 + {table.getColumn("jobType") && ( 64 + <DataTableFacetedFilter 65 + column={table.getColumn("jobType")} 66 + title="Type" 67 + options={[ 68 + { label: "HTTP", value: "http" }, 69 + { label: "TCP", value: "tcp" }, 70 + ]} 71 + /> 72 + )} 63 73 {isFiltered && ( 64 74 <Button 65 75 variant="ghost"
+3 -2
apps/web/src/components/data-table/monitor/data-table.tsx
··· 56 56 React.useState<ColumnFiltersState>(defaultColumnFilters); 57 57 const [columnVisibility, setColumnVisibility] = 58 58 React.useState<VisibilityState>({ 59 - public: false, // default is true 60 - id: false, // we hide the id column 59 + public: false, 60 + id: false, 61 + jobType: false, 61 62 }); 62 63 63 64 const [pagination, setPagination] =