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
7 changes: 3 additions & 4 deletions frontend/e2e/helpers/e2e-helpers.playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,10 +832,9 @@ export class E2EHelpers {
) {
await this.goToFeatureVersions(featureName);
await this.click(byId(`history-item-${versionIndex}-compare`));
if (compareOption === 'LIVE') {
await this.click(byId(`history-item-${versionIndex}-compare-live`));
} else if (compareOption === 'PREVIOUS') {
await this.click(byId(`history-item-${versionIndex}-compare-previous`));
if (compareOption) {
const name = compareOption === 'LIVE' ? 'Live Version' : 'Previous Version';
await this.page.getByRole('button', { exact: true, name }).filter({ visible: true }).click();
}

// Wait for comparison modal to fully load data
Expand Down
6 changes: 5 additions & 1 deletion frontend/e2e/tests/flag-dependencies-test.pw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ test.describe('Flag Dependencies', () => {
await expect(
page.getByRole('button', { name: /0 of 1 prerequisites met/ }),
).toBeVisible()
await page.getByRole('button', { exact: true, name: 'Value' }).click()
// The features list behind the drawer has a Value filter too
await page
.locator('#create-feature-modal')
.getByRole('button', { exact: true, name: 'Value' })
.click()
await expect(servingOff).toBeVisible()
await visualSnapshot(page, 'dependencies-blocked-value', testInfo)
await page
Expand Down
13 changes: 5 additions & 8 deletions frontend/e2e/tests/flag-tests.pw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,11 @@ test.describe('Flag Tests', () => {
})).toHaveCount(0, { timeout: LONG_TIMEOUT })

log('Enable archived filter')
// Click on Tags filter button
await click(byId('table-filter-tags'))

// Click on archived filter option
await clickByText(/^archived/, '.table-filter-item')

// Close the filter dropdown
await click(byId('table-filter-tags'))
// The trigger's name includes the count of selected tags
const tagsFilter = page.getByRole('button', { name: /^Tags/ })
await tagsFilter.click()
await page.getByRole('dialog', { name: 'Tags' }).getByRole('button', { name: 'archived' }).click()
await tagsFilter.click()

log('Verify archived feature is now visible')
// Wait for the features list to update and verify archived feature appears
Expand Down
2 changes: 0 additions & 2 deletions frontend/web/components/FeatureHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ const FeatureHistory: FC<FeatureHistoryPageType> = ({
className='inline-modal table-filter inline-modal--sm right'
>
<TableFilterItem
data-test={`history-item-${i}-compare-live`}
title={'Live Version'}
onClick={() => {
setCompareToLive(true)
Expand All @@ -187,7 +186,6 @@ const FeatureHistory: FC<FeatureHistoryPageType> = ({
}}
/>
<TableFilterItem
data-test={`history-item-${i}-compare-previous`}
title={'Previous Version'}
onClick={() => {
setCompareToLive(false)
Expand Down
32 changes: 9 additions & 23 deletions frontend/web/components/PanelSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import React, {
import { AutoSizer, List } from 'react-virtualized'
import classNames from 'classnames'
import Popover from './base/Popover'
import TableFilterItem from './tables/TableFilterItem'
import BareButton from './base/forms/BareButton'
import Input from './base/forms/Input'
import Icon from './icons/Icon'
import { IonIcon } from '@ionic/react'
import { chevronDown, chevronUp } from 'ionicons/icons'
import Button from './base/forms/Button'
import Paging from './Paging'
import lodashFilter from 'lodash/filter'
Expand Down Expand Up @@ -131,8 +130,7 @@ const PanelSearch = <T,>(props: PanelSearchProps<T>): ReactElement => {
}, [propSearch, internalSearch, exact, filter, filterRow, items, sortItems])

const handleSort = useCallback(
(e: React.MouseEvent<HTMLAnchorElement>, sortOption: SortOption) => {
e.preventDefault()
(sortOption: SortOption) => {
if (sortOption.value === sortBy) {
const newSortOrder =
sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC
Expand Down Expand Up @@ -296,28 +294,16 @@ const PanelSearch = <T,>(props: PanelSearchProps<T>): ReactElement => {
{(close) => (
<div>
{sorting.map((sortOption, i) => (
<a
<TableFilterItem
key={i}
className='table-filter-item'
href='#'
onClick={(e) => {
handleSort(e, sortOption)
title={sortOption.label}
isActive={currentSort?.value === sortOption.value}
sortOrder={sortOrder ?? SortOrder.ASC}
onClick={() => {
handleSort(sortOption)
close()
}}
>
<Row space className='px-3 align-items-center py-2'>
<div>{sortOption.label}</div>
{currentSort?.value === sortOption.value && (
<IonIcon
icon={
sortOrder === SortOrder.ASC
? chevronUp
: chevronDown
}
/>
)}
</Row>
</a>
/>
))}
</div>
)}
Expand Down
75 changes: 0 additions & 75 deletions frontend/web/components/tables/TableFilter.tsx

This file was deleted.

34 changes: 34 additions & 0 deletions frontend/web/components/tables/TableFilter/TableFilter.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@import '../../../styles/variables';
@import '../../../styles/mixins/custom-scrollbar';

// The anchored panel; the phone sheet sizes itself
.table-filter__panel {
min-width: 200px;
max-width: 355px;
}

// The sheet sets these; the rows read them
.table-filter__content {
--table-filter-row: 0;
--table-filter-font: var(--font-size-body-md);

// In a bottom sheet rows are larger, like native action sheets. There is no
// 16px body token, so the size is set here
&--sheet {
--table-filter-row: 48px;
--table-filter-font: 16px;

// The sheet scrolls itself
.table-filter-list {
max-height: none;
}
}
}

.table-filter-list {
overflow-y: auto;
max-height: 350px;
@include customScroll();
text-overflow: ellipsis;
overflow-x: hidden;
}
57 changes: 57 additions & 0 deletions frontend/web/components/tables/TableFilter/TableFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React, { FC, ReactNode } from 'react'
import classNames from 'classnames'
import Popover from 'components/base/Popover'
import BareButton from 'components/base/forms/BareButton'
import Icon from 'components/icons/Icon'
import { useBreakpoint } from 'common/hooks/useBreakpoint'
import './TableFilter.scss'

type TableFilterType = {
title: string | ReactNode
// Names the filter when the title isn't plain text (it has a count)
label?: string
className?: string
children: ReactNode | ((close: () => void) => ReactNode)
}

const TableFilter: FC<TableFilterType> = ({
children,
className,
label,
title,
}) => {
// Popover opens as a sheet on the same breakpoint, where rows get larger
const asSheet = useBreakpoint('isPhone')
return (
<Popover
aria-label={label ?? (typeof title === 'string' ? title : 'Filter')}
placement='bottom-end'
// Width for the anchored panel; the phone sheet is full width
className='table-filter__panel'
renderTrigger={(props) => (
<BareButton
{...props}
className={classNames(
'd-flex align-items-center py-2 py-lg-0 user-select-none',
className,
)}
>
<span>{title} </span>
<Icon name='chevron-down' width={16} />
</BareButton>
)}
>
{(close) => (
<div
className={classNames('table-filter__content', {
'table-filter__content--sheet': asSheet,
})}
>
{typeof children === 'function' ? children(close) : children}
</div>
)}
</Popover>
)
}

export default TableFilter
1 change: 1 addition & 0 deletions frontend/web/components/tables/TableFilter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './TableFilter'
46 changes: 0 additions & 46 deletions frontend/web/components/tables/TableFilterItem.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.table-filter-item {
display: grid;
align-items: center;
width: 100%;
text-align: left;
min-height: var(--table-filter-row);
font-size: var(--table-filter-font);
border-bottom: 1px solid var(--color-border-default);

&:last-of-type {
border-bottom: none;
}
}
Loading
Loading