fix(search): fix search on paginated lists (#9198)

This commit is contained in:
Salman-Apptware 2023-11-16 22:54:47 +05:30 committed by GitHub
parent 5dd09dd62e
commit 8451c758e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 12 deletions

View File

@ -92,7 +92,10 @@ export const GroupList = () => {
fontSize: 12, fontSize: 12,
}} }}
onSearch={() => null} onSearch={() => null}
onQueryChange={(q) => setQuery(q)} onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry} entityRegistry={entityRegistry}
hideRecommendations hideRecommendations
/> />

View File

@ -135,7 +135,10 @@ export const UserList = () => {
fontSize: 12, fontSize: 12,
}} }}
onSearch={() => null} onSearch={() => null}
onQueryChange={(q) => setQuery(q)} onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry} entityRegistry={entityRegistry}
hideRecommendations hideRecommendations
/> />

View File

@ -54,10 +54,10 @@ export const SecretsList = () => {
input: { input: {
start, start,
count: pageSize, count: pageSize,
query: query && query.length > 0 ? query : undefined, query: (query?.length && query) || undefined,
}, },
}, },
fetchPolicy: query && query.length > 0 ? 'no-cache' : 'cache-first', fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
}); });
const totalSecrets = data?.listSecrets?.total || 0; const totalSecrets = data?.listSecrets?.total || 0;
@ -197,7 +197,10 @@ export const SecretsList = () => {
fontSize: 12, fontSize: 12,
}} }}
onSearch={() => null} onSearch={() => null}
onQueryChange={(q) => setQuery(q)} onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry} entityRegistry={entityRegistry}
hideRecommendations hideRecommendations
/> />

View File

@ -107,10 +107,10 @@ export const IngestionSourceList = () => {
input: { input: {
start, start,
count: pageSize, count: pageSize,
query, query: (query?.length && query) || undefined,
}, },
}, },
fetchPolicy: 'cache-first', fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
}); });
const [createIngestionSource] = useCreateIngestionSourceMutation(); const [createIngestionSource] = useCreateIngestionSourceMutation();
const [updateIngestionSource] = useUpdateIngestionSourceMutation(); const [updateIngestionSource] = useUpdateIngestionSourceMutation();
@ -399,7 +399,10 @@ export const IngestionSourceList = () => {
fontSize: 12, fontSize: 12,
}} }}
onSearch={() => null} onSearch={() => null}
onQueryChange={(q) => setQuery(q)} onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry} entityRegistry={entityRegistry}
hideRecommendations hideRecommendations
/> />

View File

@ -166,7 +166,6 @@ export const ManagePolicies = () => {
data: policiesData, data: policiesData,
refetch: policiesRefetch, refetch: policiesRefetch,
} = useListPoliciesQuery({ } = useListPoliciesQuery({
fetchPolicy: 'no-cache',
variables: { variables: {
input: { input: {
start, start,
@ -174,6 +173,7 @@ export const ManagePolicies = () => {
query, query,
}, },
}, },
fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
}); });
// Any time a policy is removed, edited, or created, refetch the list. // Any time a policy is removed, edited, or created, refetch the list.
@ -476,7 +476,10 @@ export const ManagePolicies = () => {
fontSize: 12, fontSize: 12,
}} }}
onSearch={() => null} onSearch={() => null}
onQueryChange={(q) => setQuery(q)} onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry} entityRegistry={entityRegistry}
hideRecommendations hideRecommendations
/> />

View File

@ -72,7 +72,6 @@ export const ManageRoles = () => {
data: rolesData, data: rolesData,
refetch: rolesRefetch, refetch: rolesRefetch,
} = useListRolesQuery({ } = useListRolesQuery({
fetchPolicy: 'cache-first',
variables: { variables: {
input: { input: {
start, start,
@ -80,6 +79,7 @@ export const ManageRoles = () => {
query, query,
}, },
}, },
fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
}); });
const totalRoles = rolesData?.listRoles?.total || 0; const totalRoles = rolesData?.listRoles?.total || 0;
@ -238,7 +238,10 @@ export const ManageRoles = () => {
fontSize: 12, fontSize: 12,
}} }}
onSearch={() => null} onSearch={() => null}
onQueryChange={(q) => setQuery(q)} onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry} entityRegistry={entityRegistry}
/> />
{isBatchAddRolesModalVisible && ( {isBatchAddRolesModalVisible && (