mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Show placeholder for codemirror inputs and expand width of "DN" ldap fields
This commit is contained in:
@@ -6,6 +6,7 @@ import 'codemirror/mode/javascript/javascript';
|
|||||||
import 'codemirror/mode/yaml/yaml';
|
import 'codemirror/mode/yaml/yaml';
|
||||||
import 'codemirror/mode/jinja2/jinja2';
|
import 'codemirror/mode/jinja2/jinja2';
|
||||||
import 'codemirror/lib/codemirror.css';
|
import 'codemirror/lib/codemirror.css';
|
||||||
|
import 'codemirror/addon/display/placeholder';
|
||||||
|
|
||||||
const LINE_HEIGHT = 24;
|
const LINE_HEIGHT = 24;
|
||||||
const PADDING = 12;
|
const PADDING = 12;
|
||||||
@@ -55,6 +56,17 @@ const CodeMirror = styled(ReactCodeMirror)`
|
|||||||
background-color: var(--pf-c-form-control--disabled--BackgroundColor);
|
background-color: var(--pf-c-form-control--disabled--BackgroundColor);
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
|
${props =>
|
||||||
|
props.options &&
|
||||||
|
props.options.placeholder &&
|
||||||
|
`
|
||||||
|
.CodeMirror-empty {
|
||||||
|
pre.CodeMirror-placeholder {
|
||||||
|
color: var(--pf-c-form-control--placeholder--Color);
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function CodeMirrorInput({
|
function CodeMirrorInput({
|
||||||
@@ -66,6 +78,7 @@ function CodeMirrorInput({
|
|||||||
rows,
|
rows,
|
||||||
fullHeight,
|
fullHeight,
|
||||||
className,
|
className,
|
||||||
|
placeholder,
|
||||||
}) {
|
}) {
|
||||||
// Workaround for CodeMirror bug: If CodeMirror renders in a modal on the
|
// Workaround for CodeMirror bug: If CodeMirror renders in a modal on the
|
||||||
// modal's initial render, it appears as an empty box due to mis-calculated
|
// modal's initial render, it appears as an empty box due to mis-calculated
|
||||||
@@ -92,6 +105,7 @@ function CodeMirrorInput({
|
|||||||
smartIndent: false,
|
smartIndent: false,
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
|
placeholder,
|
||||||
readOnly,
|
readOnly,
|
||||||
}}
|
}}
|
||||||
fullHeight={fullHeight}
|
fullHeight={fullHeight}
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import { CardBody } from '../../../../components/Card';
|
|||||||
import ContentError from '../../../../components/ContentError';
|
import ContentError from '../../../../components/ContentError';
|
||||||
import ContentLoading from '../../../../components/ContentLoading';
|
import ContentLoading from '../../../../components/ContentLoading';
|
||||||
import { FormSubmitError } from '../../../../components/FormField';
|
import { FormSubmitError } from '../../../../components/FormField';
|
||||||
import { FormColumnLayout } from '../../../../components/FormLayout';
|
import {
|
||||||
|
FormColumnLayout,
|
||||||
|
FormFullWidthLayout,
|
||||||
|
} from '../../../../components/FormLayout';
|
||||||
import { useSettings } from '../../../../contexts/Settings';
|
import { useSettings } from '../../../../contexts/Settings';
|
||||||
import { RevertAllAlert, RevertFormActionGroup } from '../../shared';
|
import { RevertAllAlert, RevertFormActionGroup } from '../../shared';
|
||||||
import {
|
import {
|
||||||
@@ -165,26 +168,10 @@ function LDAPEdit() {
|
|||||||
name={`${ldapCategory}SERVER_URI`}
|
name={`${ldapCategory}SERVER_URI`}
|
||||||
config={ldap[`${ldapCategory}SERVER_URI`]}
|
config={ldap[`${ldapCategory}SERVER_URI`]}
|
||||||
/>
|
/>
|
||||||
<InputField
|
|
||||||
name={`${ldapCategory}BIND_DN`}
|
|
||||||
config={ldap[`${ldapCategory}BIND_DN`]}
|
|
||||||
/>
|
|
||||||
<EncryptedField
|
<EncryptedField
|
||||||
name={`${ldapCategory}BIND_PASSWORD`}
|
name={`${ldapCategory}BIND_PASSWORD`}
|
||||||
config={ldap[`${ldapCategory}BIND_PASSWORD`]}
|
config={ldap[`${ldapCategory}BIND_PASSWORD`]}
|
||||||
/>
|
/>
|
||||||
<InputField
|
|
||||||
name={`${ldapCategory}USER_DN_TEMPLATE`}
|
|
||||||
config={ldap[`${ldapCategory}USER_DN_TEMPLATE`]}
|
|
||||||
/>
|
|
||||||
<InputField
|
|
||||||
name={`${ldapCategory}REQUIRE_GROUP`}
|
|
||||||
config={ldap[`${ldapCategory}REQUIRE_GROUP`]}
|
|
||||||
/>
|
|
||||||
<InputField
|
|
||||||
name={`${ldapCategory}DENY_GROUP`}
|
|
||||||
config={ldap[`${ldapCategory}DENY_GROUP`]}
|
|
||||||
/>
|
|
||||||
<ChoiceField
|
<ChoiceField
|
||||||
name={`${ldapCategory}GROUP_TYPE`}
|
name={`${ldapCategory}GROUP_TYPE`}
|
||||||
config={ldap[`${ldapCategory}GROUP_TYPE`]}
|
config={ldap[`${ldapCategory}GROUP_TYPE`]}
|
||||||
@@ -193,6 +180,24 @@ function LDAPEdit() {
|
|||||||
name={`${ldapCategory}START_TLS`}
|
name={`${ldapCategory}START_TLS`}
|
||||||
config={ldap[`${ldapCategory}START_TLS`]}
|
config={ldap[`${ldapCategory}START_TLS`]}
|
||||||
/>
|
/>
|
||||||
|
<FormFullWidthLayout>
|
||||||
|
<InputField
|
||||||
|
name={`${ldapCategory}BIND_DN`}
|
||||||
|
config={ldap[`${ldapCategory}BIND_DN`]}
|
||||||
|
/>
|
||||||
|
<InputField
|
||||||
|
name={`${ldapCategory}USER_DN_TEMPLATE`}
|
||||||
|
config={ldap[`${ldapCategory}USER_DN_TEMPLATE`]}
|
||||||
|
/>
|
||||||
|
<InputField
|
||||||
|
name={`${ldapCategory}REQUIRE_GROUP`}
|
||||||
|
config={ldap[`${ldapCategory}REQUIRE_GROUP`]}
|
||||||
|
/>
|
||||||
|
<InputField
|
||||||
|
name={`${ldapCategory}DENY_GROUP`}
|
||||||
|
config={ldap[`${ldapCategory}DENY_GROUP`]}
|
||||||
|
/>
|
||||||
|
</FormFullWidthLayout>
|
||||||
<ObjectField
|
<ObjectField
|
||||||
name={`${ldapCategory}USER_SEARCH`}
|
name={`${ldapCategory}USER_SEARCH`}
|
||||||
config={ldap[`${ldapCategory}USER_SEARCH`]}
|
config={ldap[`${ldapCategory}USER_SEARCH`]}
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ import { FormFullWidthLayout } from '../../../components/FormLayout';
|
|||||||
import Popover from '../../../components/Popover';
|
import Popover from '../../../components/Popover';
|
||||||
import {
|
import {
|
||||||
combine,
|
combine,
|
||||||
required,
|
|
||||||
url,
|
|
||||||
integer,
|
integer,
|
||||||
minMaxValue,
|
minMaxValue,
|
||||||
|
required,
|
||||||
|
url,
|
||||||
} from '../../../util/validators';
|
} from '../../../util/validators';
|
||||||
import RevertButton from './RevertButton';
|
import RevertButton from './RevertButton';
|
||||||
|
|
||||||
@@ -51,6 +51,7 @@ const SettingGroup = withI18n()(
|
|||||||
isRequired={isRequired}
|
isRequired={isRequired}
|
||||||
label={label}
|
label={label}
|
||||||
validated={validated}
|
validated={validated}
|
||||||
|
id={fieldId}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
<>
|
<>
|
||||||
<Popover
|
<Popover
|
||||||
@@ -84,13 +85,13 @@ const BooleanField = withI18n()(
|
|||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
id={name}
|
id={name}
|
||||||
|
ouiaId={name}
|
||||||
isChecked={field.value}
|
isChecked={field.value}
|
||||||
isDisabled={disabled}
|
isDisabled={disabled}
|
||||||
label={i18n._(t`On`)}
|
label={i18n._(t`On`)}
|
||||||
labelOff={i18n._(t`Off`)}
|
labelOff={i18n._(t`Off`)}
|
||||||
onChange={checked => helpers.setValue(checked)}
|
onChange={checked => helpers.setValue(checked)}
|
||||||
aria-label={ariaLabel || config.label}
|
aria-label={ariaLabel || config.label}
|
||||||
ouiaId={ariaLabel || config.label}
|
|
||||||
/>
|
/>
|
||||||
</SettingGroup>
|
</SettingGroup>
|
||||||
) : null;
|
) : null;
|
||||||
@@ -242,11 +243,13 @@ const ObjectField = withI18n()(({ i18n, name, config, isRequired = false }) => {
|
|||||||
>
|
>
|
||||||
<CodeMirrorInput
|
<CodeMirrorInput
|
||||||
{...field}
|
{...field}
|
||||||
|
fullHeight
|
||||||
id={name}
|
id={name}
|
||||||
|
mode="javascript"
|
||||||
onChange={value => {
|
onChange={value => {
|
||||||
helpers.setValue(value);
|
helpers.setValue(value);
|
||||||
}}
|
}}
|
||||||
mode="javascript"
|
placeholder={JSON.stringify(config?.placeholder, null, 2)}
|
||||||
/>
|
/>
|
||||||
</SettingGroup>
|
</SettingGroup>
|
||||||
</FormFullWidthLayout>
|
</FormFullWidthLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user