Skip to content

Commit 713d98e

Browse files
authored
feat(k8s-ui): GitOpsTableView filtersSide prop (left|right) (#856)
Adds an optional filtersSide?: 'left' | 'right' (default 'left') to GitOpsTableView. Default keeps the OSS layout (filter rail on the left). A host with its own left navigation rail (the Cloud hub) can pass 'right' so the GitOps filters don't stack a second column against that nav and instead match the host's other faceted pages. Implemented with lg:flex-row-reverse on the row container plus a flipped border side on the aside; mobile stacking (filters above the table) is unchanged. Backwards-compatible: the only existing consumer (OSS web) omits the prop and gets 'left'.
1 parent 9754139 commit 713d98e

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

packages/k8s-ui/src/components/gitops/GitOpsTableView.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ export interface GitOpsTableViewProps {
201201
// detected" copy. Hub passes "No GitOps resources across the fleet".
202202
emptyStateTitle?: string
203203
emptyStateBody?: string
204+
/**
205+
* Which side the filter rail sits on. Default 'left' (OSS Radar, which
206+
* has no app sidebar). A host with its own left navigation rail (the
207+
* Cloud hub) passes 'right' so the GitOps filters don't stack a second
208+
* column against that nav and instead match the host's other faceted
209+
* pages. Mobile stacking (filters above the table) is unaffected.
210+
*/
211+
filtersSide?: 'left' | 'right'
204212
/**
205213
* Global namespace pick from the host's NamespaceSwitcher. Used to
206214
* surface "viewing in namespace: X" context and to power the Clear
@@ -249,6 +257,7 @@ export function GitOpsTableView({
249257
onClearNamespaces,
250258
onRowAction,
251259
pendingRowActions,
260+
filtersSide = 'left',
252261
}: GitOpsTableViewProps) {
253262
const searchInputRef = useRef<HTMLInputElement>(null)
254263
const [mode, setMode] = useState<GitOpsMode>('applications')
@@ -492,8 +501,13 @@ export function GitOpsTableView({
492501
]
493502

494503
return (
495-
<div className="flex h-full min-w-0 flex-1 overflow-hidden bg-theme-base max-lg:flex-col">
504+
<div
505+
className={`flex h-full min-w-0 flex-1 overflow-hidden bg-theme-base max-lg:flex-col ${
506+
filtersSide === 'right' ? 'lg:flex-row-reverse' : ''
507+
}`}
508+
>
496509
<GitOpsFilterSidebar
510+
side={filtersSide}
497511
mode={mode}
498512
onModeChange={setMode}
499513
modeCounts={modeCounts}
@@ -707,6 +721,7 @@ export function GitOpsTableView({
707721
// =============================================================================
708722

709723
function GitOpsFilterSidebar({
724+
side,
710725
mode,
711726
onModeChange,
712727
modeCounts,
@@ -729,6 +744,7 @@ function GitOpsFilterSidebar({
729744
onToggleNamespace,
730745
onClear,
731746
}: {
747+
side: 'left' | 'right'
732748
mode: GitOpsMode
733749
onModeChange: (mode: GitOpsMode) => void
734750
modeCounts: Record<GitOpsMode, number>
@@ -752,7 +768,11 @@ function GitOpsFilterSidebar({
752768
onClear: () => void
753769
}) {
754770
return (
755-
<aside className="flex w-72 shrink-0 flex-col overflow-hidden border-r border-theme-border bg-theme-surface/90 max-lg:max-h-72 max-lg:w-full max-lg:border-b max-lg:border-r-0">
771+
<aside
772+
className={`flex w-72 shrink-0 flex-col overflow-hidden border-theme-border bg-theme-surface/90 max-lg:max-h-72 max-lg:w-full max-lg:border-b ${
773+
side === 'right' ? 'border-l max-lg:border-l-0' : 'border-r max-lg:border-r-0'
774+
}`}
775+
>
756776
<div className="flex items-center justify-between border-b border-theme-border px-3 py-2">
757777
<span className="text-sm font-medium text-theme-text-secondary">GitOps Filters</span>
758778
<button type="button" onClick={onClear} className="text-[10px] font-medium text-blue-500 hover:text-blue-400">

0 commit comments

Comments
 (0)