mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-24 17:08:28 +00:00
UI: Remove debounce and timeout in add service forms (#4795)
This commit is contained in:
parent
fd521763d4
commit
16c7a3e097
@ -14,9 +14,9 @@
|
|||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import Form, { FormProps } from '@rjsf/core';
|
import Form, { FormProps } from '@rjsf/core';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { debounce, isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import { LoadingState } from 'Models';
|
import { LoadingState } from 'Models';
|
||||||
import React, { FunctionComponent, useCallback, useState } from 'react';
|
import React, { FunctionComponent, useState } from 'react';
|
||||||
import { ConfigData } from '../../../interface/service.interface';
|
import { ConfigData } from '../../../interface/service.interface';
|
||||||
import { formatFormDataForRender } from '../../../utils/JSONSchemaFormUtils';
|
import { formatFormDataForRender } from '../../../utils/JSONSchemaFormUtils';
|
||||||
import SVGIcons, { Icons } from '../../../utils/SvgUtils';
|
import SVGIcons, { Icons } from '../../../utils/SvgUtils';
|
||||||
@ -74,34 +74,19 @@ const FormBuilder: FunctionComponent<Props> = ({
|
|||||||
setConnectionTestingState('waiting');
|
setConnectionTestingState('waiting');
|
||||||
onTestConnection(localFormData)
|
onTestConnection(localFormData)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setTimeout(() => {
|
|
||||||
setConnectionTestingState('success');
|
setConnectionTestingState('success');
|
||||||
}, 500);
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setTimeout(() => {
|
|
||||||
setConnectionTestingState('initial');
|
setConnectionTestingState('initial');
|
||||||
}, 500);
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setTimeout(() => {
|
|
||||||
setConnectionTesting(false);
|
setConnectionTesting(false);
|
||||||
}, 500);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const debouncedOnChange = useCallback(
|
|
||||||
(updatedData: ConfigData): void => {
|
|
||||||
setLocalFormData(updatedData);
|
|
||||||
},
|
|
||||||
[setLocalFormData]
|
|
||||||
);
|
|
||||||
|
|
||||||
const debounceOnSearch = useCallback(debounce(debouncedOnChange, 400), [
|
|
||||||
debouncedOnChange,
|
|
||||||
]);
|
|
||||||
const handleChange = (updatedData: ConfigData) => {
|
const handleChange = (updatedData: ConfigData) => {
|
||||||
debounceOnSearch(updatedData);
|
setLocalFormData(updatedData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConnectionTestingMessage = () => {
|
const getConnectionTestingMessage = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user