Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
DataView,
DataViewState,
DataViewTable,
DataViewTextFilter,
DataViewToolbar,
} from '@patternfly/react-data-view';
import DataViewFilters from '@patternfly/react-data-view/dist/cjs/DataViewFilters';
Expand All @@ -22,6 +21,7 @@ import { TableColumn } from '@console/internal/module/k8s';
import { EmptyBox } from '@console/shared/src/components/empty-state/EmptyBox';
import { StatusBox } from '@console/shared/src/components/status/StatusBox';
import { DataViewLabelFilter } from './DataViewLabelFilter';
import { DataViewTextFilter } from './DataViewTextFilter';
import { ResourceFilters, ResourceMetadata, GetDataViewRows } from './types';
import { useConsoleDataViewData } from './useConsoleDataViewData';
import { useConsoleDataViewFilters } from './useConsoleDataViewFilters';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const DataViewLabelFilter = <TData,>({
applyLabelFilters([]);
}}
>
<div className="pf-v6-c-input-group co-filter-group">
<div className="pf-v6-c-input-group">
<AutocompleteInput
color="purple"
onSuggestionSelect={(selected) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import type { FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { ToolbarFilter } from '@patternfly/react-core';
import { useSearchParams } from 'react-router-dom-v5-compat';
import { TextFilter } from '@console/internal/components/factory/text-filter';

type DataViewTextFilterProps = {
title: string;
filterId: string;
placeholder: string;
onChange?: (key: string, selectedValue: string) => void;
showToolbarItem?: boolean;
};

export const DataViewTextFilter = ({
title,
filterId,
placeholder,
onChange,
showToolbarItem,
}: DataViewTextFilterProps) => {
const [searchParams] = useSearchParams();
const [inputText, setInputText] = useState(searchParams.get(filterId) ?? '');

// Sync local state with URL changes
useEffect(() => {
setInputText(searchParams.get(filterId) ?? '');
}, [searchParams, filterId]);

const handleChange = (_event: FormEvent<HTMLInputElement>, value: string) => {
setInputText(value);
onChange?.(filterId, value);
};

const handleDeleteChip = () => {
setInputText('');
onChange?.(filterId, '');
};

return (
<ToolbarFilter
categoryName={title}
showToolbarItem={showToolbarItem}
labels={inputText ? [inputText] : []}
deleteLabel={handleDeleteChip}
>
<TextFilter
label={filterId}
placeholder={placeholder}
value={inputText}
onChange={handleChange}
/>
</ToolbarFilter>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const helmPage = {
search: (name: string) => {
cy.get(helmPO.filters).within(() => cy.get('.pf-v6-c-menu-toggle').first().click());
cy.get('.pf-v6-c-menu__list-item').contains('Name').click();
cy.get('[aria-label="Name filter"]').clear().type(name);
cy.get('[aria-label="Filter by name"]').clear().type(name);
},
verifyHelmReleasesDisplayed: () => cy.get(helmPO.table).should('be.visible'),
clickHelmReleaseName: (name: string) => cy.get(`a[title="${name}"]`).click(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const listPage = {
cy.get('.pf-v6-c-menu-toggle').first().click(),
);
cy.get('.pf-v6-c-menu__list-item').contains('Name').click();
cy.get('[aria-label="Name filter"]').clear().type(name);
cy.get('[aria-label="Filter by name"]').clear().type(name);
},
by: (checkboxLabel: string) => {
cy.get('[data-ouia-component-id="DataViewCheckboxFilter"]').click();
Expand Down
9 changes: 0 additions & 9 deletions frontend/public/components/_autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
position: relative;
width: 100%;
z-index: var(--pf-t--global--z-index--sm);
@media (max-width: $screen-xs-min) {
max-width: calc(100% - 95px);
}
@media (min-width: $screen-xs-min) and (max-width: $screen-sm-min) {
max-width: 200px;
}
}

.co-suggestion-box__suggestions {
Expand All @@ -17,9 +11,6 @@
gap: var(--pf-t--global--spacer--gap--group--vertical);
position: absolute;
width: 100%;
@media (min-width: $screen-xs-min) and (max-width: $screen-sm-min) {
max-width: 200px;
}
}

.co-suggestion-box__suggestions--shadowed {
Expand Down
26 changes: 0 additions & 26 deletions frontend/public/components/_filter-toolbar.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
.co-filter-dropdown__item {
display: inline-flex;
pointer-events: none;
}

.co-filter-dropdown__list-item {
list-style: none;
}

/* No way to reach this ul */
.co-filter-dropdown-group > ul {
margin-left: 0;
padding-left: 0;
}

.co-filter-dropdown-item {
display: inline-flex;
margin: var(--pf-t--global--spacer--xs) 0;
}

.co-filter-dropdown-item__name {
padding: 0 var(--pf-t--global--spacer--xs);
}

@media (min-width: $pf-v6-global--breakpoint--md) {
.co-filter-group {
width: 350px !important; // enable full placeholder text to display
}
}
2 changes: 1 addition & 1 deletion frontend/public/components/filter-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export const FilterToolbar: React.FC<FilterToolbarProps> = ({
}}
categoryName={translatedNameFilterTitle}
>
<div className="pf-v6-c-input-group co-filter-group">
<div className="pf-v6-c-input-group">
{showSearchFiltersDropdown && (
<ConsoleSelect
alwaysShowTitle
Expand Down