Skip to content

Commit e108f77

Browse files
committed
Add hideNameLabelFilters, hideLabelFilter, and hideColumnManagement for Search page
1 parent 9a9bcbc commit e108f77

2 files changed

Lines changed: 35 additions & 20 deletions

File tree

frontend/public/components/data-view-poc/DataViewPodList.tsx

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,9 @@ type DataViewPodListProps = {
655655
showNodes?: boolean;
656656
columnLayout?: ColumnLayout;
657657
showNamespaceOverride?: boolean;
658+
hideNameLabelFilters?: boolean;
659+
hideLabelFilter?: boolean;
660+
hideColumnManagement?: boolean;
658661
};
659662

660663
const DataViewPodList = ({
@@ -663,6 +666,9 @@ const DataViewPodList = ({
663666
loaded,
664667
columnLayout,
665668
showNamespaceOverride,
669+
hideNameLabelFilters,
670+
hideLabelFilter,
671+
hideColumnManagement,
666672
}: DataViewPodListProps) => {
667673
const { t } = useTranslation();
668674

@@ -749,6 +755,7 @@ const DataViewPodList = ({
749755
}, [filteredData.length, loaded]);
750756

751757
const dataViewFiltersNodes = React.useMemo(() => {
758+
const showNameLabelFilters = hideNameLabelFilters !== true;
752759
return [
753760
<DataViewCheckboxFilter
754761
key="status"
@@ -757,8 +764,12 @@ const DataViewPodList = ({
757764
placeholder={t('public~Filter by status')}
758765
options={filterOptions}
759766
/>,
760-
<DataViewTextFilter key="name" filterId="name" title={t('public~Name')} />,
761-
<DataViewLabelFilter key="labels" filterId="label" title={t('public~Label')} data={data} />,
767+
showNameLabelFilters && (
768+
<DataViewTextFilter key="name" filterId="name" title={t('public~Name')} />
769+
),
770+
showNameLabelFilters && hideLabelFilter !== true && (
771+
<DataViewLabelFilter key="labels" filterId="label" title={t('public~Label')} data={data} />
772+
),
762773
];
763774
// can't use data in the deps array is will re-compute the filters and will cause the selected category to reset
764775
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -774,24 +785,26 @@ const DataViewPodList = ({
774785
}
775786
clearAllFilters={clearAllFilters}
776787
actions={
777-
<ResponsiveActions breakpoint="lg">
778-
<ResponsiveAction
779-
isPersistent
780-
variant="plain"
781-
onClick={() =>
782-
createColumnManagementModal({
783-
columnLayout,
784-
noLimit: true,
785-
})
786-
}
787-
aria-label={t('public~Column management')}
788-
data-test="manage-columns"
789-
>
790-
<Tooltip content={t('public~Manage columns')} trigger="mouseenter">
791-
<ColumnsIcon />
792-
</Tooltip>
793-
</ResponsiveAction>
794-
</ResponsiveActions>
788+
!hideColumnManagement && (
789+
<ResponsiveActions breakpoint="lg">
790+
<ResponsiveAction
791+
isPersistent
792+
variant="plain"
793+
onClick={() =>
794+
createColumnManagementModal({
795+
columnLayout,
796+
noLimit: true,
797+
})
798+
}
799+
aria-label={t('public~Column management')}
800+
data-test="manage-columns"
801+
>
802+
<Tooltip content={t('public~Manage columns')} trigger="mouseenter">
803+
<ColumnsIcon />
804+
</Tooltip>
805+
</ResponsiveAction>
806+
</ResponsiveActions>
807+
)
795808
}
796809
pagination={<Pagination itemCount={filteredData.length} {...pagination} />}
797810
/>

frontend/public/components/pod.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,8 @@ export const PodsPage: React.FC<PodPageProps> = ({
11951195
loaded={loaded}
11961196
columnLayout={columnLayout}
11971197
showNamespaceOverride={showNamespaceOverride}
1198+
hideNameLabelFilters={hideNameLabelFilters}
1199+
hideColumnManagement={hideColumnManagement}
11981200
/>
11991201
) : (
12001202
<>

0 commit comments

Comments
 (0)