mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Fix ui-lint error
This commit is contained in:
parent
c394ffdd19
commit
a2fcd2f97a
@ -80,7 +80,7 @@ const NotificationsAPI = new Notifications();
|
||||
const OrganizationsAPI = new Organizations();
|
||||
const ProjectUpdatesAPI = new ProjectUpdates();
|
||||
const ProjectsAPI = new Projects();
|
||||
const ReceptorAPI = new ReceptorAddresses()
|
||||
const ReceptorAPI = new ReceptorAddresses();
|
||||
const RolesAPI = new Roles();
|
||||
const RootAPI = new Root();
|
||||
const SchedulesAPI = new Schedules();
|
||||
|
||||
@ -33,7 +33,10 @@ class Instances extends Base {
|
||||
}
|
||||
|
||||
updateReceptorAddresses(instanceId, data) {
|
||||
return this.http.post(`${this.baseUrl}${instanceId}/receptor_addresses/`, data);
|
||||
return this.http.post(
|
||||
`${this.baseUrl}${instanceId}/receptor_addresses/`,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
deprovisionInstance(instanceId) {
|
||||
|
||||
@ -5,9 +5,7 @@ import { Form, FormGroup, Modal } from '@patternfly/react-core';
|
||||
import { InstancesAPI } from 'api';
|
||||
import { Formik } from 'formik';
|
||||
import { FormColumnLayout } from 'components/FormLayout';
|
||||
import FormField, {
|
||||
CheckboxField,
|
||||
} from 'components/FormField';
|
||||
import FormField, { CheckboxField } from 'components/FormField';
|
||||
import FormActionGroup from '../FormActionGroup/FormActionGroup';
|
||||
|
||||
function AddEndpointModal({
|
||||
@ -17,7 +15,6 @@ function AddEndpointModal({
|
||||
instance,
|
||||
ouiaId,
|
||||
}) {
|
||||
|
||||
const handleClose = () => {
|
||||
onClose();
|
||||
};
|
||||
@ -44,7 +41,7 @@ function AddEndpointModal({
|
||||
>
|
||||
<Formik
|
||||
initialValues={{
|
||||
listener_port: 1001
|
||||
listener_port: 1001,
|
||||
}}
|
||||
onSubmit={handleEndpointAdd}
|
||||
>
|
||||
@ -94,4 +91,4 @@ function AddEndpointModal({
|
||||
);
|
||||
}
|
||||
|
||||
export default AddEndpointModal;
|
||||
export default AddEndpointModal;
|
||||
|
||||
@ -55,7 +55,11 @@ function Instance({ setBreadcrumb }) {
|
||||
}, [request]);
|
||||
|
||||
if (isK8s) {
|
||||
tabsArray.push({ name: t`Endpoints`, link: `${match.url}/endpoints`, id: 1 });
|
||||
tabsArray.push({
|
||||
name: t`Endpoints`,
|
||||
link: `${match.url}/endpoints`,
|
||||
id: 1,
|
||||
});
|
||||
tabsArray.push({ name: t`Peers`, link: `${match.url}/peers`, id: 2 });
|
||||
}
|
||||
if (isLoading) {
|
||||
|
||||
@ -32,7 +32,13 @@ function InstanceEndPointList({ setBreadcrumb }) {
|
||||
isLoading,
|
||||
error: contentError,
|
||||
request: fetchEndpoints,
|
||||
result: { instance, endpoints, count, relatedSearchableKeys, searchableKeys },
|
||||
result: {
|
||||
instance,
|
||||
endpoints,
|
||||
count,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const [
|
||||
@ -47,15 +53,15 @@ function InstanceEndPointList({ setBreadcrumb }) {
|
||||
InstancesAPI.readOptions(),
|
||||
]);
|
||||
|
||||
const endpoint_list = []
|
||||
const endpoint_list = [];
|
||||
|
||||
for(let q = 0; q < results.length; q++) {
|
||||
for (let q = 0; q < results.length; q++) {
|
||||
const receptor = results[q];
|
||||
if(receptor.managed === true) continue;
|
||||
if(id.toString() === receptor.instance.toString()) {
|
||||
if (receptor.managed === true) continue;
|
||||
if (id.toString() === receptor.instance.toString()) {
|
||||
receptor.name = detail.hostname;
|
||||
endpoint_list.push(receptor);
|
||||
console.log(receptor)
|
||||
console.log(receptor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,9 +111,7 @@ function InstanceEndPointList({ setBreadcrumb }) {
|
||||
<CardBody>
|
||||
<PaginatedTable
|
||||
contentError={contentError}
|
||||
hasContentLoading={
|
||||
isLoading
|
||||
}
|
||||
hasContentLoading={isLoading}
|
||||
items={endpoints}
|
||||
itemCount={count}
|
||||
pluralizedItemName={t`Endpoints`}
|
||||
@ -144,24 +148,26 @@ function InstanceEndPointList({ setBreadcrumb }) {
|
||||
isAllExpanded={isAllExpanded}
|
||||
onExpandAll={expandAll}
|
||||
qsConfig={QS_CONFIG}
|
||||
additionalControls={[
|
||||
// (isExecutionNode || isHopNode) && (
|
||||
// <ToolbarAddButton
|
||||
// ouiaId="add-endpoint-button"
|
||||
// key="add-endpoint"
|
||||
// defaultLabel={t`Add`}
|
||||
// onClick={() => setisAddEndpointModalOpen(true)}
|
||||
// />
|
||||
// ),
|
||||
// (isExecutionNode || isHopNode) && (
|
||||
// <ToolbarAddButton
|
||||
// ouiaId="delete-endpoint-button"
|
||||
// key="delete-endpoint"
|
||||
// defaultLabel={t`Delete`}
|
||||
// onClick={() => handleEndpointDelete()}
|
||||
// />
|
||||
// ),
|
||||
]}
|
||||
additionalControls={
|
||||
[
|
||||
// (isExecutionNode || isHopNode) && (
|
||||
// <ToolbarAddButton
|
||||
// ouiaId="add-endpoint-button"
|
||||
// key="add-endpoint"
|
||||
// defaultLabel={t`Add`}
|
||||
// onClick={() => setisAddEndpointModalOpen(true)}
|
||||
// />
|
||||
// ),
|
||||
// (isExecutionNode || isHopNode) && (
|
||||
// <ToolbarAddButton
|
||||
// ouiaId="delete-endpoint-button"
|
||||
// key="delete-endpoint"
|
||||
// defaultLabel={t`Delete`}
|
||||
// onClick={() => handleEndpointDelete()}
|
||||
// />
|
||||
// ),
|
||||
]
|
||||
}
|
||||
/>
|
||||
)}
|
||||
renderRow={(endpoint, index) => (
|
||||
|
||||
@ -35,17 +35,16 @@ function InstanceEndPointListItem({
|
||||
/>
|
||||
|
||||
<Td id={labelId} dataLabel={t`Address`}>
|
||||
{peerEndpoint.address}
|
||||
{peerEndpoint.address}
|
||||
</Td>
|
||||
|
||||
<Td id={labelId} dataLabel={t`Port`}>
|
||||
{peerEndpoint.port}
|
||||
{peerEndpoint.port}
|
||||
</Td>
|
||||
|
||||
<Td id={labelId} dataLabel={t`Canonical`}>
|
||||
{peerEndpoint.canonical.toString()}
|
||||
{peerEndpoint.canonical.toString()}
|
||||
</Td>
|
||||
|
||||
</Tr>
|
||||
);
|
||||
}
|
||||
|
||||
@ -58,12 +58,14 @@ function InstancePeerList({ setBreadcrumb }) {
|
||||
InstancesAPI.read(),
|
||||
]);
|
||||
|
||||
const address_list = []
|
||||
const address_list = [];
|
||||
|
||||
for(let q = 0; q < results.length; q++) {
|
||||
for (let q = 0; q < results.length; q++) {
|
||||
const receptor = results[q];
|
||||
if(receptor.managed === true) continue;
|
||||
const host = instances.data.results.filter((obj) => obj.id === receptor.instance)[0];
|
||||
if (receptor.managed === true) continue;
|
||||
const host = instances.data.results.filter(
|
||||
(obj) => obj.id === receptor.instance
|
||||
)[0];
|
||||
const copy = receptor;
|
||||
copy.hostname = host.hostname;
|
||||
copy.node_type = host.node_type;
|
||||
@ -106,44 +108,47 @@ function InstancePeerList({ setBreadcrumb }) {
|
||||
|
||||
const fetchInstancesToAssociate = useCallback(
|
||||
async (params) => {
|
||||
const address_list = []
|
||||
const address_list = [];
|
||||
|
||||
const instances = await InstancesAPI.read(
|
||||
mergeParams(params, {
|
||||
...{ not__node_type: ['control', 'hybrid'] },
|
||||
}))
|
||||
})
|
||||
);
|
||||
const receptors = (await ReceptorAPI.read()).data.results;
|
||||
|
||||
// get instance ids of the current peered receptor ids
|
||||
const already_peered_instance_ids = []
|
||||
for(let h =0; h < instance.peers.length; h++) {
|
||||
const already_peered_instance_ids = [];
|
||||
for (let h = 0; h < instance.peers.length; h++) {
|
||||
const matched = receptors.filter((obj) => obj.id === instance.peers[h]);
|
||||
matched.forEach(element => {
|
||||
matched.forEach((element) => {
|
||||
already_peered_instance_ids.push(element.instance);
|
||||
});
|
||||
}
|
||||
|
||||
for(let q = 0; q < receptors.length; q++) {
|
||||
for (let q = 0; q < receptors.length; q++) {
|
||||
const receptor = receptors[q];
|
||||
|
||||
if(already_peered_instance_ids.includes(receptor.instance)) {
|
||||
if (already_peered_instance_ids.includes(receptor.instance)) {
|
||||
// ignore reverse peers
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
if(instance.peers.includes(receptor.id)) {
|
||||
if (instance.peers.includes(receptor.id)) {
|
||||
// no links to existing links
|
||||
continue;
|
||||
}
|
||||
|
||||
if(instance.id === receptor.instance) {
|
||||
if (instance.id === receptor.instance) {
|
||||
// no links to thy self
|
||||
continue;
|
||||
}
|
||||
|
||||
const host = instances.data.results.filter((obj) => obj.id === receptor.instance)[0];
|
||||
const host = instances.data.results.filter(
|
||||
(obj) => obj.id === receptor.instance
|
||||
)[0];
|
||||
|
||||
if(host === undefined) {
|
||||
if (host === undefined) {
|
||||
// no hosts
|
||||
continue;
|
||||
}
|
||||
@ -151,7 +156,7 @@ function InstancePeerList({ setBreadcrumb }) {
|
||||
const copy = receptor;
|
||||
copy.hostname = host.hostname;
|
||||
copy.node_type = host.node_type;
|
||||
copy.canonical = copy.canonical.toString()
|
||||
copy.canonical = copy.canonical.toString();
|
||||
address_list.push(copy);
|
||||
}
|
||||
|
||||
@ -169,14 +174,9 @@ function InstancePeerList({ setBreadcrumb }) {
|
||||
} = useRequest(
|
||||
useCallback(
|
||||
async (instancesPeerToAssociate) => {
|
||||
const selected_peers = instancesPeerToAssociate.map((obj) => obj.id);
|
||||
|
||||
const selected_peers = instancesPeerToAssociate.map(
|
||||
(obj) => obj.id
|
||||
);
|
||||
|
||||
const new_peers = [
|
||||
...new Set([...instance.peers, ...selected_peers]),
|
||||
];
|
||||
const new_peers = [...new Set([...instance.peers, ...selected_peers])];
|
||||
await InstancesAPI.update(instance.id, { peers: new_peers });
|
||||
|
||||
fetchPeers();
|
||||
|
||||
@ -61,7 +61,6 @@ function InstancePeerListItem({
|
||||
<Td id={labelId} dataLabel={t`Canonical`}>
|
||||
{peerInstance.canonical.toString()}
|
||||
</Td>
|
||||
|
||||
</Tr>
|
||||
{!isHopNode && (
|
||||
<Tr
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user