Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:fix search on paginated lists #9198

Merged
merged 3 commits into from
Nov 16, 2023
Merged
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
5 changes: 4 additions & 1 deletion datahub-web-react/src/app/identity/group/GroupList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export const GroupList = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

setQuery(q);
}}
entityRegistry={entityRegistry}
hideRecommendations
/>
Expand Down
5 changes: 4 additions & 1 deletion datahub-web-react/src/app/identity/user/UserList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ export const UserList = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry}
hideRecommendations
/>
Expand Down
9 changes: 6 additions & 3 deletions datahub-web-react/src/app/ingest/secret/SecretsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export const SecretsList = () => {
input: {
start,
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;
Expand Down Expand Up @@ -197,7 +197,10 @@ export const SecretsList = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry}
hideRecommendations
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ export const IngestionSourceList = () => {
input: {
start,
count: pageSize,
query,
query: (query?.length && query) || undefined,
},
},
fetchPolicy: 'cache-first',
fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

});
const [createIngestionSource] = useCreateIngestionSourceMutation();
const [updateIngestionSource] = useUpdateIngestionSourceMutation();
Expand Down Expand Up @@ -399,7 +399,10 @@ export const IngestionSourceList = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry}
hideRecommendations
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ export const ManagePolicies = () => {
data: policiesData,
refetch: policiesRefetch,
} = useListPoliciesQuery({
fetchPolicy: 'no-cache',
variables: {
input: {
start,
count: pageSize,
query,
},
},
fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
});

// Any time a policy is removed, edited, or created, refetch the list.
Expand Down Expand Up @@ -476,7 +476,10 @@ export const ManagePolicies = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry}
hideRecommendations
/>
Expand Down
7 changes: 5 additions & 2 deletions datahub-web-react/src/app/permissions/roles/ManageRoles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ export const ManageRoles = () => {
data: rolesData,
refetch: rolesRefetch,
} = useListRolesQuery({
fetchPolicy: 'cache-first',
variables: {
input: {
start,
count: pageSize,
query,
},
},
fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
});

const totalRoles = rolesData?.listRoles?.total || 0;
Expand Down Expand Up @@ -238,7 +238,10 @@ export const ManageRoles = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry}
/>
{isBatchAddRolesModalVisible && (
Expand Down
Loading