Skip to content

Commit bbc690d

Browse files
authored
MGMT-17121: Cluster name show validation message when typing characters (#2516)
* Cluster name show validation message when typing characters * Updating react-core version to avoid problems with Popover focus
1 parent c34b6c7 commit bbc690d

File tree

8 files changed

+186
-99
lines changed

8 files changed

+186
-99
lines changed

apps/assisted-ui/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
"dependencies": {
33
"@openshift-assisted/ui-lib": "workspace:*",
44
"@openshift-console/dynamic-plugin-sdk": "0.0.3",
5-
"@patternfly/patternfly": "5.1.0",
6-
"@patternfly/react-code-editor": "5.1.2",
7-
"@patternfly/react-core": "5.1.2",
8-
"@patternfly/react-icons": "5.1.2",
9-
"@patternfly/react-styles": "5.1.2",
10-
"@patternfly/react-table": "5.1.2",
11-
"@patternfly/react-tokens": "5.1.2",
5+
"@patternfly/patternfly": "5.2.0",
6+
"@patternfly/react-code-editor": "5.2.0",
7+
"@patternfly/react-core": "5.2.0",
8+
"@patternfly/react-icons": "5.2.0",
9+
"@patternfly/react-styles": "5.2.0",
10+
"@patternfly/react-table": "5.2.0",
11+
"@patternfly/react-tokens": "5.2.0",
1212
"@reduxjs/toolkit": "^1.9.1",
1313
"@sentry/browser": "^5.9 || ^6",
1414
"axios": ">=0.22.0 <2.0.0",
1515
"i18next": "^20.4.0",
1616
"i18next-browser-languagedetector": "^6.1.2",
1717
"lodash": "^4",
18-
"monaco-editor": "^0.34.1",
18+
"monaco-editor": "0.45.0",
1919
"react": "^18.2.0",
2020
"react-dom": "^18.2.0",
2121
"react-i18next": "^11.11.4",
22-
"react-monaco-editor": "^0.51.0",
22+
"react-monaco-editor": "^0.55.0",
2323
"react-redux": "^8.0.5",
2424
"react-router-dom": "^5.3.3",
2525
"react-tagsinput": "^3.20",

libs/ui-lib-tests/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"@openshift-assisted/ui-lib": "workspace:*",
88
"@testing-library/cypress": "^9.0.0",
99
"@types/lodash": "^4.14.121",
10-
"cypress": "13.2.0",
11-
"cypress-file-upload": "^5.0.7",
10+
"cypress": "13.6.2",
11+
"cypress-file-upload": "5.0.8",
1212
"cypress-fill-command": "^1.0.2",
1313
"lodash": "^4.17.15",
1414
"start-server-and-test": "^2.0.0"

libs/ui-lib/lib/common/components/clusterConfiguration/DownloadIpxeScript.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { useTranslation } from '../../hooks/use-translation-wrapper';
1818
export type DownloadISOProps = {
1919
isSNO?: boolean;
2020
fileName?: string;
21-
downloadUrl?: string;
21+
downloadUrl: string;
2222
onClose: () => void;
2323
onReset?: () => void;
2424
};

libs/ui-lib/lib/common/components/clusterConfiguration/DownloadIso.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type DownloadISOProps = {
2020
hasDHCP?: boolean;
2121
isSNO?: boolean;
2222
fileName?: string;
23-
downloadUrl?: string;
23+
downloadUrl: string;
2424
onClose: () => void;
2525
onReset?: () => void;
2626
docVersion?: string;

libs/ui-lib/lib/common/components/ui/PrismCode.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const PrismCode: React.FC<PrismCodeProps> = ({
4949
onCopy={(e) => clipboardCopyFunc(e, code)}
5050
style={{ float: 'right', background: 'inherit' }}
5151
>
52-
{}
52+
{''}
5353
</ClipboardCopy>
5454
)}
5555
{tokens.map((line, i) => (

libs/ui-lib/lib/common/components/ui/formik/RichInputField.tsx

+16-1
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
8787
validate,
8888
idPostfix,
8989
richValidationMessages,
90+
noDefaultOnChange,
91+
onChange,
9092
...props
9193
},
9294
ref: React.Ref<HTMLInputElement>,
9395
) => {
9496
const [popoverOpen, setPopoverOpen] = React.useState(false);
95-
const [field, { error, value, touched }] = useField<string>({
97+
const [field, { error, value, touched }, { setTouched }] = useField<string>({
9698
name: props.name,
9799
validate,
98100
});
@@ -118,7 +120,19 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
118120
id={fieldId}
119121
isRequired={isRequired}
120122
aria-describedby={`${fieldId}-helper`}
123+
onChange={(event, val) => {
124+
!popoverOpen && setPopoverOpen(true);
125+
!noDefaultOnChange && field.onChange(event);
126+
onChange && onChange(event);
127+
if (!touched && val?.length) {
128+
setTouched(true);
129+
}
130+
}}
121131
className="rich-input__text"
132+
onBlur={() => {
133+
setPopoverOpen(false);
134+
setTouched(true);
135+
}}
122136
/>
123137
</InputGroupItem>
124138
<InputGroupItem>
@@ -135,6 +149,7 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
135149
richValidationMessages={richValidationMessages as Record<string, string>}
136150
/>
137151
}
152+
withFocusTrap={false}
138153
>
139154
<Button variant="plain" aria-label="Validation">
140155
{!isValid ? (

libs/ui-lib/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"@openshift-assisted/locales": "workspace:*",
44
"@openshift-assisted/types": "workspace:*",
55
"@openshift-console/dynamic-plugin-sdk": "0.0.3",
6-
"@patternfly/patternfly": "5.1.0",
7-
"@patternfly/react-code-editor": "5.1.2",
8-
"@patternfly/react-core": "5.1.2",
9-
"@patternfly/react-icons": "5.1.2",
10-
"@patternfly/react-styles": "5.1.2",
11-
"@patternfly/react-table": "5.1.2",
12-
"@patternfly/react-tokens": "5.1.2",
6+
"@patternfly/patternfly": "5.2.0",
7+
"@patternfly/react-code-editor": "5.2.0",
8+
"@patternfly/react-core": "5.2.0",
9+
"@patternfly/react-icons": "5.2.0",
10+
"@patternfly/react-styles": "5.2.0",
11+
"@patternfly/react-table": "5.2.0",
12+
"@patternfly/react-tokens": "5.2.0",
1313
"axios-case-converter": "^0.11.1",
1414
"camel-case": "^4.1.2",
1515
"cidr-tools": "^4.3.0",
@@ -97,11 +97,11 @@
9797
"@sentry/browser": "^5.9 || ^6",
9898
"axios": ">=0.22.0 <1.0.0",
9999
"i18next": "^20.4 || ^21",
100-
"monaco-editor": "^0.34.1",
100+
"monaco-editor": "0.45.0",
101101
"react": "^17 || ^18",
102102
"react-dom": "^17 || ^18",
103103
"react-i18next": ">11.7.3",
104-
"react-monaco-editor": "^0.51.0",
104+
"react-monaco-editor": "^0.55.0",
105105
"react-redux": "^8.0.5",
106106
"react-router-dom": "^5.3.0",
107107
"react-tagsinput": "^3.20",

0 commit comments

Comments
 (0)