mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 05:29:26 -02:30
Link out to docs; use some in place of forEach when looping through results.
This commit is contained in:
@@ -23,6 +23,7 @@ import ErrorDetail from 'components/ErrorDetail';
|
|||||||
import DisassociateButton from 'components/DisassociateButton';
|
import DisassociateButton from 'components/DisassociateButton';
|
||||||
import InstanceToggle from 'components/InstanceToggle';
|
import InstanceToggle from 'components/InstanceToggle';
|
||||||
import { CardBody, CardActionsRow } from 'components/Card';
|
import { CardBody, CardActionsRow } from 'components/Card';
|
||||||
|
import getDocsBaseUrl from 'util/getDocsBaseUrl';
|
||||||
import { formatDateString } from 'util/dates';
|
import { formatDateString } from 'util/dates';
|
||||||
import RoutedTabs from 'components/RoutedTabs';
|
import RoutedTabs from 'components/RoutedTabs';
|
||||||
import ContentError from 'components/ContentError';
|
import ContentError from 'components/ContentError';
|
||||||
@@ -62,7 +63,7 @@ function computeForks(memCapacity, cpuCapacity, selectedCapacityAdjustment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function InstanceDetails({ setBreadcrumb, instanceGroup }) {
|
function InstanceDetails({ setBreadcrumb, instanceGroup }) {
|
||||||
const { me = {} } = useConfig();
|
const config = useConfig();
|
||||||
const { id, instanceId } = useParams();
|
const { id, instanceId } = useParams();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -226,7 +227,21 @@ function InstanceDetails({ setBreadcrumb, instanceGroup }) {
|
|||||||
<Detail label={t`Total Jobs`} value={instance.jobs_total} />
|
<Detail label={t`Total Jobs`} value={instance.jobs_total} />
|
||||||
<Detail
|
<Detail
|
||||||
label={t`Last Health Check`}
|
label={t`Last Health Check`}
|
||||||
helpText={t`Health checks are asynchronous tasks. See the docs for more details.`}
|
helpText={
|
||||||
|
<>
|
||||||
|
{t`Health checks are asynchronous tasks. See the`}{' '}
|
||||||
|
<a
|
||||||
|
href={`${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/administration/instances.html#health-check`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{t`documentation`}
|
||||||
|
</a>{' '}
|
||||||
|
{t`for more info.`}
|
||||||
|
</>
|
||||||
|
}
|
||||||
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
||||||
/>
|
/>
|
||||||
<Detail label={t`Node Type`} value={instance.node_type} />
|
<Detail label={t`Node Type`} value={instance.node_type} />
|
||||||
@@ -246,7 +261,7 @@ function InstanceDetails({ setBreadcrumb, instanceGroup }) {
|
|||||||
step={0.1}
|
step={0.1}
|
||||||
value={instance.capacity_adjustment}
|
value={instance.capacity_adjustment}
|
||||||
onChange={handleChangeValue}
|
onChange={handleChangeValue}
|
||||||
isDisabled={!me?.is_superuser || !instance.enabled}
|
isDisabled={!config?.me?.is_superuser || !instance.enabled}
|
||||||
data-cy="slider"
|
data-cy="slider"
|
||||||
/>
|
/>
|
||||||
</SliderForks>
|
</SliderForks>
|
||||||
@@ -286,7 +301,9 @@ function InstanceDetails({ setBreadcrumb, instanceGroup }) {
|
|||||||
{isExecutionNode && (
|
{isExecutionNode && (
|
||||||
<Tooltip content={t`Run a health check on the instance`}>
|
<Tooltip content={t`Run a health check on the instance`}>
|
||||||
<Button
|
<Button
|
||||||
isDisabled={!me.is_superuser || instance.health_check_pending}
|
isDisabled={
|
||||||
|
!config?.me?.is_superuser || instance.health_check_pending
|
||||||
|
}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
ouiaId="health-check-button"
|
ouiaId="health-check-button"
|
||||||
onClick={fetchHealthCheck}
|
onClick={fetchHealthCheck}
|
||||||
@@ -299,7 +316,7 @@ function InstanceDetails({ setBreadcrumb, instanceGroup }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
{me.is_superuser && instance.node_type !== 'control' && (
|
{config?.me?.is_superuser && instance.node_type !== 'control' && (
|
||||||
<DisassociateButton
|
<DisassociateButton
|
||||||
verifyCannotDisassociate={instanceGroup.name === 'controlplane'}
|
verifyCannotDisassociate={instanceGroup.name === 'controlplane'}
|
||||||
key="disassociate"
|
key="disassociate"
|
||||||
|
|||||||
@@ -58,11 +58,9 @@ function InstanceList({ instanceGroup }) {
|
|||||||
InstanceGroupsAPI.readInstances(instanceGroupId, params),
|
InstanceGroupsAPI.readInstances(instanceGroupId, params),
|
||||||
InstanceGroupsAPI.readInstanceOptions(instanceGroupId),
|
InstanceGroupsAPI.readInstanceOptions(instanceGroupId),
|
||||||
]);
|
]);
|
||||||
response.data.results.forEach((i) => {
|
setPendingHealthCheck(
|
||||||
if (i.health_check_pending === true) {
|
response?.data?.result?.some((i) => i.health_check_pending === true)
|
||||||
setPendingHealthCheck(true);
|
);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
instances: response.data.results,
|
instances: response.data.results,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { OutlinedClockIcon } from '@patternfly/react-icons';
|
import { OutlinedClockIcon } from '@patternfly/react-icons';
|
||||||
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
|
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
|
||||||
|
import getDocsBaseUrl from 'util/getDocsBaseUrl';
|
||||||
import { formatDateString } from 'util/dates';
|
import { formatDateString } from 'util/dates';
|
||||||
import { ActionsTd, ActionItem } from 'components/PaginatedTable';
|
import { ActionsTd, ActionItem } from 'components/PaginatedTable';
|
||||||
import InstanceToggle from 'components/InstanceToggle';
|
import InstanceToggle from 'components/InstanceToggle';
|
||||||
@@ -53,7 +54,7 @@ function InstanceListItem({
|
|||||||
fetchInstances,
|
fetchInstances,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
}) {
|
}) {
|
||||||
const { me = {} } = useConfig();
|
const config = useConfig();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [forks, setForks] = useState(
|
const [forks, setForks] = useState(
|
||||||
computeForks(
|
computeForks(
|
||||||
@@ -167,7 +168,7 @@ function InstanceListItem({
|
|||||||
step={0.1}
|
step={0.1}
|
||||||
value={instance.capacity_adjustment}
|
value={instance.capacity_adjustment}
|
||||||
onChange={handleChangeValue}
|
onChange={handleChangeValue}
|
||||||
isDisabled={!me?.is_superuser || !instance.enabled}
|
isDisabled={!config?.me?.is_superuser || !instance.enabled}
|
||||||
data-cy="slider"
|
data-cy="slider"
|
||||||
/>
|
/>
|
||||||
</SliderForks>
|
</SliderForks>
|
||||||
@@ -219,7 +220,21 @@ function InstanceListItem({
|
|||||||
<Detail
|
<Detail
|
||||||
data-cy="last-health-check"
|
data-cy="last-health-check"
|
||||||
label={t`Last Health Check`}
|
label={t`Last Health Check`}
|
||||||
helpText={t`Health checks are asynchronous tasks. See the docs for more details.`}
|
helpText={
|
||||||
|
<>
|
||||||
|
{t`Health checks are asynchronous tasks. See the`}{' '}
|
||||||
|
<a
|
||||||
|
href={`${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/administration/instances.html#health-check`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{t`documentation`}
|
||||||
|
</a>{' '}
|
||||||
|
{t`for more info.`}
|
||||||
|
</>
|
||||||
|
}
|
||||||
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
||||||
/>
|
/>
|
||||||
</DetailList>
|
</DetailList>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import AlertModal from 'components/AlertModal';
|
|||||||
import ErrorDetail from 'components/ErrorDetail';
|
import ErrorDetail from 'components/ErrorDetail';
|
||||||
import InstanceToggle from 'components/InstanceToggle';
|
import InstanceToggle from 'components/InstanceToggle';
|
||||||
import { CardBody, CardActionsRow } from 'components/Card';
|
import { CardBody, CardActionsRow } from 'components/Card';
|
||||||
|
import getDocsBaseUrl from 'util/getDocsBaseUrl';
|
||||||
import { formatDateString } from 'util/dates';
|
import { formatDateString } from 'util/dates';
|
||||||
import ContentError from 'components/ContentError';
|
import ContentError from 'components/ContentError';
|
||||||
import ContentLoading from 'components/ContentLoading';
|
import ContentLoading from 'components/ContentLoading';
|
||||||
@@ -62,7 +63,8 @@ function computeForks(memCapacity, cpuCapacity, selectedCapacityAdjustment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function InstanceDetail({ setBreadcrumb, isK8s }) {
|
function InstanceDetail({ setBreadcrumb, isK8s }) {
|
||||||
const { me = {} } = useConfig();
|
const config = useConfig();
|
||||||
|
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [forks, setForks] = useState();
|
const [forks, setForks] = useState();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@@ -85,7 +87,6 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
InstancesAPI.readDetail(id),
|
InstancesAPI.readDetail(id),
|
||||||
InstancesAPI.readInstanceGroup(id),
|
InstancesAPI.readInstanceGroup(id),
|
||||||
]);
|
]);
|
||||||
// we probably don't need this extra call
|
|
||||||
if (details.node_type === 'execution') {
|
if (details.node_type === 'execution') {
|
||||||
const { data: healthCheckData } =
|
const { data: healthCheckData } =
|
||||||
await InstancesAPI.readHealthCheckDetail(id);
|
await InstancesAPI.readHealthCheckDetail(id);
|
||||||
@@ -249,7 +250,21 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
<Detail
|
<Detail
|
||||||
label={t`Last Health Check`}
|
label={t`Last Health Check`}
|
||||||
dataCy="last-health-check"
|
dataCy="last-health-check"
|
||||||
helpText={t`Health checks are asynchronous tasks. See the docs for more details.`}
|
helpText={
|
||||||
|
<>
|
||||||
|
{t`Health checks are asynchronous tasks. See the`}{' '}
|
||||||
|
<a
|
||||||
|
href={`${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/administration/instances.html#health-check`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{t`documentation`}
|
||||||
|
</a>{' '}
|
||||||
|
{t`for more info.`}
|
||||||
|
</>
|
||||||
|
}
|
||||||
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
||||||
/>
|
/>
|
||||||
{instance.related?.install_bundle && (
|
{instance.related?.install_bundle && (
|
||||||
@@ -288,7 +303,9 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
step={0.1}
|
step={0.1}
|
||||||
value={instance.capacity_adjustment}
|
value={instance.capacity_adjustment}
|
||||||
onChange={handleChangeValue}
|
onChange={handleChangeValue}
|
||||||
isDisabled={!me?.is_superuser || !instance.enabled}
|
isDisabled={
|
||||||
|
!config?.me?.is_superuser || !instance.enabled
|
||||||
|
}
|
||||||
data-cy="slider"
|
data-cy="slider"
|
||||||
/>
|
/>
|
||||||
</SliderForks>
|
</SliderForks>
|
||||||
@@ -332,7 +349,7 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
</DetailList>
|
</DetailList>
|
||||||
{!isHopNode && (
|
{!isHopNode && (
|
||||||
<CardActionsRow>
|
<CardActionsRow>
|
||||||
{me.is_superuser && isK8s && instance.node_type === 'execution' && (
|
{config?.me?.is_superuser && isK8s && isExecutionNode && (
|
||||||
<RemoveInstanceButton
|
<RemoveInstanceButton
|
||||||
dataCy="remove-instance-button"
|
dataCy="remove-instance-button"
|
||||||
itemsToRemove={[instance]}
|
itemsToRemove={[instance]}
|
||||||
@@ -343,7 +360,9 @@ function InstanceDetail({ setBreadcrumb, isK8s }) {
|
|||||||
{isExecutionNode && (
|
{isExecutionNode && (
|
||||||
<Tooltip content={t`Run a health check on the instance`}>
|
<Tooltip content={t`Run a health check on the instance`}>
|
||||||
<Button
|
<Button
|
||||||
isDisabled={!me.is_superuser || instance.health_check_pending}
|
isDisabled={
|
||||||
|
!config?.me?.is_superuser || instance.health_check_pending
|
||||||
|
}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
ouiaId="health-check-button"
|
ouiaId="health-check-button"
|
||||||
onClick={fetchHealthCheck}
|
onClick={fetchHealthCheck}
|
||||||
|
|||||||
@@ -53,11 +53,9 @@ function InstanceList() {
|
|||||||
InstancesAPI.readOptions(),
|
InstancesAPI.readOptions(),
|
||||||
SettingsAPI.readCategory('system'),
|
SettingsAPI.readCategory('system'),
|
||||||
]);
|
]);
|
||||||
response.data.results.forEach((i) => {
|
setPendingHealthCheck(
|
||||||
if (i.health_check_pending === true) {
|
response?.data?.result?.some((i) => i.health_check_pending === true)
|
||||||
setPendingHealthCheck(true);
|
);
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
return {
|
||||||
instances: response.data.results,
|
instances: response.data.results,
|
||||||
isK8s: sysSettings.data.IS_K8S,
|
isK8s: sysSettings.data.IS_K8S,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { OutlinedClockIcon } from '@patternfly/react-icons';
|
import { OutlinedClockIcon } from '@patternfly/react-icons';
|
||||||
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
|
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
|
||||||
|
import getDocsBaseUrl from 'util/getDocsBaseUrl';
|
||||||
import { formatDateString } from 'util/dates';
|
import { formatDateString } from 'util/dates';
|
||||||
import computeForks from 'util/computeForks';
|
import computeForks from 'util/computeForks';
|
||||||
import { ActionsTd, ActionItem } from 'components/PaginatedTable';
|
import { ActionsTd, ActionItem } from 'components/PaginatedTable';
|
||||||
@@ -53,7 +54,7 @@ function InstanceListItem({
|
|||||||
fetchInstances,
|
fetchInstances,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
}) {
|
}) {
|
||||||
const { me = {} } = useConfig();
|
const config = useConfig();
|
||||||
const [forks, setForks] = useState(
|
const [forks, setForks] = useState(
|
||||||
computeForks(
|
computeForks(
|
||||||
instance.mem_capacity,
|
instance.mem_capacity,
|
||||||
@@ -179,7 +180,7 @@ function InstanceListItem({
|
|||||||
step={0.1}
|
step={0.1}
|
||||||
value={instance.capacity_adjustment}
|
value={instance.capacity_adjustment}
|
||||||
onChange={handleChangeValue}
|
onChange={handleChangeValue}
|
||||||
isDisabled={!me?.is_superuser || !instance.enabled}
|
isDisabled={!config?.me?.is_superuser || !instance.enabled}
|
||||||
data-cy="slider"
|
data-cy="slider"
|
||||||
/>
|
/>
|
||||||
</SliderForks>
|
</SliderForks>
|
||||||
@@ -236,7 +237,21 @@ function InstanceListItem({
|
|||||||
<Detail
|
<Detail
|
||||||
data-cy="last-health-check"
|
data-cy="last-health-check"
|
||||||
label={t`Last Health Check`}
|
label={t`Last Health Check`}
|
||||||
helpText={t`Health checks are asynchronous tasks. See the docs for more details.`}
|
helpText={
|
||||||
|
<>
|
||||||
|
{t`Health checks are asynchronous tasks. See the`}{' '}
|
||||||
|
<a
|
||||||
|
href={`${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/administration/instances.html#health-check`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{t`documentation`}
|
||||||
|
</a>{' '}
|
||||||
|
{t`for more info.`}
|
||||||
|
</>
|
||||||
|
}
|
||||||
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
value={formatHealthCheckTimeStamp(instance.last_health_check)}
|
||||||
/>
|
/>
|
||||||
</DetailList>
|
</DetailList>
|
||||||
|
|||||||
Reference in New Issue
Block a user