Skip to content

Commit

Permalink
fix:fix search on paginated lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Salman-Apptware committed Nov 6, 2023
1 parent 464cac2 commit fee52ae
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
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

0 comments on commit fee52ae

Please sign in to comment.