mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 04:47:44 -02:30
Resolves peers list search bug
This commit is contained in:
committed by
Jeff Bradberry
parent
b4edfc24ac
commit
532ad777a3
@@ -18,8 +18,8 @@ class Instances extends Base {
|
|||||||
return this.http.get(`${this.baseUrl}${instanceId}/health_check/`);
|
return this.http.get(`${this.baseUrl}${instanceId}/health_check/`);
|
||||||
}
|
}
|
||||||
|
|
||||||
readPeers(instanceId) {
|
readPeers(instanceId, params) {
|
||||||
return this.http.get(`${this.baseUrl}${instanceId}/peers`);
|
return this.http.get(`${this.baseUrl}${instanceId}/peers/`, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
readInstanceGroup(instanceId) {
|
readInstanceGroup(instanceId) {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import PaginatedTable, {
|
|||||||
HeaderRow,
|
HeaderRow,
|
||||||
} from 'components/PaginatedTable';
|
} from 'components/PaginatedTable';
|
||||||
import useRequest, { useDismissableError } from 'hooks/useRequest';
|
import useRequest, { useDismissableError } from 'hooks/useRequest';
|
||||||
import { getQSConfig } from 'util/qs';
|
import { getQSConfig, parseQueryString } from 'util/qs';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
import DataListToolbar from 'components/DataListToolbar';
|
import DataListToolbar from 'components/DataListToolbar';
|
||||||
import { InstancesAPI } from 'api';
|
import { InstancesAPI } from 'api';
|
||||||
import useExpanded from 'hooks/useExpanded';
|
import useExpanded from 'hooks/useExpanded';
|
||||||
@@ -25,6 +25,7 @@ const QS_CONFIG = getQSConfig('peer', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function InstancePeerList() {
|
function InstancePeerList() {
|
||||||
|
const location = useLocation();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -33,13 +34,14 @@ function InstancePeerList() {
|
|||||||
result: { peers, count, relatedSearchableKeys, searchableKeys },
|
result: { peers, count, relatedSearchableKeys, searchableKeys },
|
||||||
} = useRequest(
|
} = useRequest(
|
||||||
useCallback(async () => {
|
useCallback(async () => {
|
||||||
|
const params = parseQueryString(QS_CONFIG, location.search);
|
||||||
const [
|
const [
|
||||||
{
|
{
|
||||||
data: { results, count: itemNumber },
|
data: { results, count: itemNumber },
|
||||||
},
|
},
|
||||||
actions,
|
actions,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
InstancesAPI.readPeers(id),
|
InstancesAPI.readPeers(id, params),
|
||||||
InstancesAPI.readOptions(),
|
InstancesAPI.readOptions(),
|
||||||
]);
|
]);
|
||||||
return {
|
return {
|
||||||
@@ -50,7 +52,7 @@ function InstancePeerList() {
|
|||||||
),
|
),
|
||||||
searchableKeys: getSearchableKeys(actions.data.actions?.GET),
|
searchableKeys: getSearchableKeys(actions.data.actions?.GET),
|
||||||
};
|
};
|
||||||
}, [id]),
|
}, [id, location]),
|
||||||
{
|
{
|
||||||
peers: [],
|
peers: [],
|
||||||
count: 0,
|
count: 0,
|
||||||
@@ -59,7 +61,9 @@ function InstancePeerList() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => fetchPeers(), [fetchPeers, id]);
|
useEffect(() => {
|
||||||
|
fetchPeers();
|
||||||
|
}, [fetchPeers]);
|
||||||
|
|
||||||
const { selected, isAllSelected, handleSelect, clearSelected, selectAll } =
|
const { selected, isAllSelected, handleSelect, clearSelected, selectAll } =
|
||||||
useSelected(peers.filter((i) => i.node_type !== 'hop'));
|
useSelected(peers.filter((i) => i.node_type !== 'hop'));
|
||||||
|
|||||||
Reference in New Issue
Block a user