1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

chore: add server-side search to archived flags (#10600)

https://linear.app/unleash/issue/2-3842/archived-flag-not-showing

Adds server-side search to archived flags.

In the future we'll probably want to dedicate a project to this page, to
bring it up to speed with the flags overview page. In the meantime, this
bandaid fix at least allows us to search outside the 50 results limit.

Also added a small alert to better explain the current behavior: 

<img width="902" height="275" alt="image"
src="https://github.com/user-attachments/assets/ab3da3ca-3408-471a-a74a-abb65e95e012"
/>
This commit is contained in:
Nuno Góis 2025-09-02 16:44:28 +01:00 committed by GitHub
parent c69634fda0
commit 9a7f2c520a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import {
useTable,
} from 'react-table';
import { SearchHighlightProvider } from 'component/common/Table/SearchHighlightContext/SearchHighlightContext';
import { useMediaQuery } from '@mui/material';
import { Alert, useMediaQuery } from '@mui/material';
import { sortTypes } from 'utils/sortTypes';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { HighlightCell } from 'component/common/Table/cells/HighlightCell/HighlightCell';
@ -240,11 +240,7 @@ export const ArchiveTable = ({
isLoading={loading}
header={
<PageHeader
titleElement={`${title} (${
rows.length < data.length
? `${rows.length} of ${data.length}`
: data.length
})`}
titleElement={`${title} (${rows.length})`}
actions={
<Search
initialValue={searchValue}
@ -256,6 +252,12 @@ export const ArchiveTable = ({
/>
}
>
{rows.length >= 50 && (
<Alert color='info' sx={{ mb: 2 }}>
A maximum of 50 archived flags are displayed. If you
don't see the one you're looking for, try using search.
</Alert>
)}
<SearchHighlightProvider value={getSearchText(searchValue)}>
<VirtualizedTable
rows={rows}

View File

@ -3,6 +3,7 @@ import type { SortingRule } from 'react-table';
import { usePageTitle } from 'hooks/usePageTitle';
import { createLocalStorage } from 'utils/createLocalStorage';
import { useFeatureSearch } from 'hooks/api/getters/useFeatureSearch/useFeatureSearch';
import { useSearchParams } from 'react-router-dom';
const defaultSort: SortingRule<string> = { id: 'createdAt' };
const { value, setValue } = createLocalStorage(
@ -12,12 +13,14 @@ const { value, setValue } = createLocalStorage(
export const FeaturesArchiveTable = () => {
usePageTitle('Archive');
const [searchParams] = useSearchParams();
const {
features: archivedFeatures,
loading,
refetch,
} = useFeatureSearch({
query: searchParams.get('search') || undefined,
archived: 'IS:true',
});