Skip to content

Commit 1649950

Browse files
Merge pull request #15065 from rawagner/vsphere418
OCPBUGS-54434: Update vSphere configuration form to support CM YAML f…
2 parents 44f21f8 + 6295596 commit 1649950

File tree

12 files changed

+446
-449
lines changed

12 files changed

+446
-449
lines changed

frontend/packages/vsphere-plugin/__tests__/__snapshots__/utils.spec.ts.snap

Lines changed: 0 additions & 55 deletions
This file was deleted.

frontend/packages/vsphere-plugin/__tests__/utils.spec.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

frontend/packages/vsphere-plugin/locales/en/vsphere-plugin.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
"vSphere configurations": "vSphere configurations",
44
"Loading vSphere connection status": "Loading vSphere connection status",
55
"The vSphere Connection check is failing.": "The vSphere Connection check is failing.",
6-
"No errors are reported. Click the link for details.": "No errors are reported. Click the link for details.",
6+
"No errors reported": "No errors reported",
77
"Missing the vSphere config map.": "Missing the vSphere config map.",
88
"Not configured yet": "Not configured yet",
99
"Prometheus query failed.": "Prometheus query failed.",
1010
"Invalid credentials": "Invalid credentials",
1111
"Failing {{reason}}": "Failing {{reason}}",
12-
"Failed to patch {{secret}}": "Failed to patch {{secret}}",
13-
"Failed to create {{secret}} secret": "Failed to create {{secret}} secret",
1412
"Failed to load kubecontrollermanager": "Failed to load kubecontrollermanager",
15-
"Not found.": "Not found.",
13+
"Failed to parse cloud provider config {{cm}}": "Failed to parse cloud provider config {{cm}}",
14+
"Unknown format": "Unknown format",
15+
"Failed to persist {{secret}}": "Failed to persist {{secret}}",
1616
"Failed to patch kubecontrollermanager": "Failed to patch kubecontrollermanager",
17-
"Failed to patch {{cm}}": "Failed to patch {{cm}}",
18-
"Failed to create {{cm}} ConfigMap": "Failed to create {{cm}} ConfigMap",
19-
"Failed to add taint to node {{node}}": "Failed to add taint to node {{node}}",
17+
"Failed to patch cloud provider config": "Failed to patch cloud provider config",
18+
"Failed to add taint to nodes": "Failed to add taint to nodes",
2019
"Failed to patch infrastructure spec": "Failed to patch infrastructure spec",
2120
"Unexpected error": "Unexpected error",
2221
"vCenter": "vCenter",
@@ -56,7 +55,6 @@
5655
"Kube API Server": "Kube API Server",
5756
"Kube Controller Manager": "Kube Controller Manager",
5857
"Storage": "Storage",
59-
"Failed to fetch infrastructure resource": "Failed to fetch infrastructure resource",
6058
"An error occured": "An error occured",
6159
"Help": "Help"
6260
}

frontend/packages/vsphere-plugin/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"dependencies": {
1010
"@console/dynamic-plugin-sdk": "0.0.0-fixed",
1111
"formik": "^2.4.5",
12-
"ini": "4.1.1",
1312
"yup": "^0.27.0"
1413
},
1514
"consolePlugin": {

frontend/packages/vsphere-plugin/src/components/ClusterOverview/VSphereStatus.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const healthHandler: PrometheusHealthHandler = (responses, t, additionalR
6363
message = health.message;
6464
break;
6565
case HealthState.OK:
66-
message = t('vsphere-plugin~No errors are reported. Click the link for details.');
66+
message = t('vsphere-plugin~No errors reported');
6767
break;
6868
default:
6969
break;

frontend/packages/vsphere-plugin/src/components/VSphereConnectionModal.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '@patternfly/react-core';
1313
import { Modal, ModalVariant } from '@patternfly/react-core/deprecated';
1414
import { Formik, useFormikContext } from 'formik';
15+
import { isEqual } from 'lodash';
1516
import { useTranslation } from 'react-i18next';
1617
import * as Yup from 'yup';
1718
import { HealthState, SubsystemHealth } from '@console/dynamic-plugin-sdk';
@@ -27,21 +28,17 @@ import './VSphereConnectionModal.css';
2728

2829
type VSphereConnectionModalFooterProps = {
2930
onClose: VoidFunction;
30-
mustPatch: boolean;
3131
};
3232

33-
const VSphereConnectionModalFooter: React.FC<VSphereConnectionModalFooterProps> = ({
34-
onClose,
35-
mustPatch,
36-
}) => {
33+
const VSphereConnectionModalFooter: React.FC<VSphereConnectionModalFooterProps> = ({ onClose }) => {
3734
const { t } = useTranslation('vsphere-plugin');
38-
const { isSubmitting, isValid, dirty, submitForm } = useFormikContext();
35+
const { isSubmitting, isValid, submitForm, initialValues, values } = useFormikContext();
3936
return (
4037
<Split hasGutter>
4138
<SplitItem>
4239
<Button
4340
variant="primary"
44-
isDisabled={isSubmitting || !isValid || (mustPatch ? false : !dirty)}
41+
isDisabled={isSubmitting || !isValid || isEqual(initialValues, values)}
4542
onClick={submitForm}
4643
isLoading={isSubmitting}
4744
>
@@ -149,9 +146,7 @@ export const VSphereConnectionModal: React.FC<VSphereConnectionProps> = ({
149146

150147
const models = useConnectionModels();
151148

152-
const { initValues, isLoaded, mustPatch, error: loadError } = useConnectionForm(
153-
cloudProviderConfig,
154-
);
149+
const { initValues, isLoaded, error: loadError } = useConnectionForm();
155150

156151
const onClose = () => {
157152
setModalOpen(false);
@@ -162,7 +157,7 @@ export const VSphereConnectionModal: React.FC<VSphereConnectionProps> = ({
162157
setError(undefined);
163158

164159
try {
165-
await persist(t, models, values, cloudProviderConfig);
160+
await persist(t, models, values, initValues, cloudProviderConfig);
166161
onClose();
167162
} catch (e) {
168163
if (e instanceof PersistError) {
@@ -199,7 +194,7 @@ export const VSphereConnectionModal: React.FC<VSphereConnectionProps> = ({
199194
<VSphereConnectionModalAlert error={error} health={health} />
200195
</StackItem>
201196
<StackItem>
202-
<VSphereConnectionModalFooter onClose={onClose} mustPatch={mustPatch || !!error} />
197+
<VSphereConnectionModalFooter onClose={onClose} />
203198
</StackItem>
204199
</Stack>
205200
</Formik>

0 commit comments

Comments
 (0)