mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 00:08:44 -03:30
Use expandable section when description is longer than 512 characters to avoid making the wizard unusably long
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Wizard } from '@patternfly/react-core';
|
||||
import React, { useState } from 'react';
|
||||
import { ExpandableSection, Wizard } from '@patternfly/react-core';
|
||||
import { t } from '@lingui/macro';
|
||||
import { Formik, useFormikContext } from 'formik';
|
||||
import ContentError from '../ContentError';
|
||||
@@ -19,6 +19,7 @@ function PromptModalForm({
|
||||
resourceDefaultCredentials,
|
||||
}) {
|
||||
const { setFieldTouched, values } = useFormikContext();
|
||||
const [showDescription, setShowDescription] = useState(false);
|
||||
|
||||
const {
|
||||
steps,
|
||||
@@ -102,7 +103,23 @@ function PromptModalForm({
|
||||
}
|
||||
}}
|
||||
title={t`Launch | ${resource.name}`}
|
||||
description={resource.description}
|
||||
description={
|
||||
resource.description.length > 512 ? (
|
||||
<ExpandableSection
|
||||
toggleText={
|
||||
showDescription ? t`Hide description` : 'Show description'
|
||||
}
|
||||
onToggle={() => {
|
||||
setShowDescription(!showDescription);
|
||||
}}
|
||||
isExpanded={showDescription}
|
||||
>
|
||||
{resource.description}
|
||||
</ExpandableSection>
|
||||
) : (
|
||||
resource.description
|
||||
)
|
||||
}
|
||||
steps={
|
||||
isReady
|
||||
? steps
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Wizard } from '@patternfly/react-core';
|
||||
import React, { useState } from 'react';
|
||||
import { ExpandableSection, Wizard } from '@patternfly/react-core';
|
||||
import { t } from '@lingui/macro';
|
||||
import { useFormikContext } from 'formik';
|
||||
import AlertModal from '../../AlertModal';
|
||||
@@ -39,7 +39,7 @@ function SchedulePromptableFields({
|
||||
credentials,
|
||||
resourceDefaultCredentials
|
||||
);
|
||||
|
||||
const [showDescription, setShowDescription] = useState(false);
|
||||
const { error, dismissError } = useDismissableError(contentError);
|
||||
const cancelPromptableValues = async () => {
|
||||
resetForm({
|
||||
@@ -106,7 +106,23 @@ function SchedulePromptableFields({
|
||||
}
|
||||
}}
|
||||
title={t`Prompt | ${resource.name}`}
|
||||
description={resource.description}
|
||||
description={
|
||||
resource.description.length > 512 ? (
|
||||
<ExpandableSection
|
||||
toggleText={
|
||||
showDescription ? t`Hide description` : t`Show description`
|
||||
}
|
||||
onToggle={() => {
|
||||
setShowDescription(!showDescription);
|
||||
}}
|
||||
isExpanded={showDescription}
|
||||
>
|
||||
{resource.description}
|
||||
</ExpandableSection>
|
||||
) : (
|
||||
resource.description
|
||||
)
|
||||
}
|
||||
steps={
|
||||
isReady
|
||||
? steps
|
||||
|
||||
Reference in New Issue
Block a user