mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 02:59:21 -02:30
Add timeout detail to node view modal
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shape } from 'prop-types';
|
import { shape } from 'prop-types';
|
||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t, Trans } from '@lingui/macro';
|
||||||
import { Chip, ChipGroup } from '@patternfly/react-core';
|
import { Chip, ChipGroup } from '@patternfly/react-core';
|
||||||
import { VariablesDetail } from '@components/CodeMirrorInput';
|
import { VariablesDetail } from '@components/CodeMirrorInput';
|
||||||
import { DetailList, Detail } from '@components/DetailList';
|
import { DetailList, Detail } from '@components/DetailList';
|
||||||
@@ -27,6 +27,15 @@ function hasPromptData(launchData) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatTimeout(timeout) {
|
||||||
|
if (typeof timeout === "undefined" || timeout === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const minutes = Math.floor(timeout / 60);
|
||||||
|
const seconds = timeout - Math.floor(timeout / 60) * 60;
|
||||||
|
return <>{minutes} <Trans>min</Trans> {seconds} <Trans>sec</Trans></>;
|
||||||
|
}
|
||||||
|
|
||||||
function PromptDetail({ i18n, resource, launchConfig = {} }) {
|
function PromptDetail({ i18n, resource, launchConfig = {} }) {
|
||||||
const { defaults = {} } = launchConfig;
|
const { defaults = {} } = launchConfig;
|
||||||
const VERBOSITY = {
|
const VERBOSITY = {
|
||||||
@@ -46,6 +55,10 @@ function PromptDetail({ i18n, resource, launchConfig = {} }) {
|
|||||||
label={i18n._(t`Type`)}
|
label={i18n._(t`Type`)}
|
||||||
value={resource.unified_job_type || resource.type}
|
value={resource.unified_job_type || resource.type}
|
||||||
/>
|
/>
|
||||||
|
<Detail
|
||||||
|
label={i18n._(t`Timeout`)}
|
||||||
|
value={formatTimeout(resource?.timeout)}
|
||||||
|
/>
|
||||||
</DetailList>
|
</DetailList>
|
||||||
|
|
||||||
{hasPromptData(launchConfig) && (
|
{hasPromptData(launchConfig) && (
|
||||||
|
|||||||
Reference in New Issue
Block a user