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 #272

Closed
wants to merge 1 commit into from
Closed
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: 5 additions & 2 deletions datahub-web-react/src/app/identity/group/GroupList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const GroupList = () => {
const { loading, error, data, refetch, client } = useListGroupsQuery({
variables: {
input: {
start,
start: query && start === 0 ? null : start,
count: pageSize,
query: (query?.length && query) || undefined,
},
Expand Down Expand Up @@ -92,7 +92,10 @@ export const GroupList = () => {
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/identity/user/UserList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const UserList = () => {
} = useListUsersQuery({
variables: {
input: {
start,
start: query && start === 0 ? null : start,
count: pageSize,
query: (query?.length && query) || undefined,
},
Expand Down 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
11 changes: 7 additions & 4 deletions datahub-web-react/src/app/ingest/secret/SecretsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export const SecretsList = () => {
const { loading, error, data, client } = useListSecretsQuery({
variables: {
input: {
start,
start: query && start === 0 ? null : 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
12 changes: 7 additions & 5 deletions datahub-web-react/src/app/ingest/source/IngestionSourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ export const IngestionSourceList = () => {
// Set of removed urns used to account for eventual consistency
const [removedUrns, setRemovedUrns] = useState<string[]>([]);
const [sourceFilter, setSourceFilter] = useState(IngestionSourceType.ALL);

// Ingestion Source Queries
const { loading, error, data, client, refetch } = useListIngestionSourcesQuery({
variables: {
input: {
start,
start: query && start === 0 ? null : start,
count: pageSize,
query,
query: (query?.length && query) || undefined,
},
},
fetchPolicy: 'cache-first',
fetchPolicy: (query?.length || 0) > 0 ? 'no-cache' : 'cache-first',
});
const [createIngestionSource] = useCreateIngestionSourceMutation();
const [updateIngestionSource] = useUpdateIngestionSourceMutation();
Expand Down Expand Up @@ -399,7 +398,10 @@ export const IngestionSourceList = () => {
fontSize: 12,
}}
onSearch={() => null}
onQueryChange={(q) => setQuery(q)}
onQueryChange={(q) => {
setPage(1);
setQuery(q);
}}
entityRegistry={entityRegistry}
hideRecommendations
/>
Expand Down
11 changes: 7 additions & 4 deletions datahub-web-react/src/app/permissions/policy/ManagePolicies.tsx
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,
start: query && start === 0 ? null : start,
count: pageSize,
query,
query: (query?.length && query) || undefined,
},
},
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
11 changes: 7 additions & 4 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,
start: query && start === 0 ? null : start,
count: pageSize,
query,
query: (query?.length && query) || undefined,
},
},
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