mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-18 05:55:57 +08:00
chore: added disabled property to the btn (#2775)
Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com>
This commit is contained in:
parent
2f27908434
commit
708f6dd03f
@ -22,7 +22,7 @@ function ApplyLicenseForm({
|
|||||||
licenseRefetch,
|
licenseRefetch,
|
||||||
}: ApplyLicenseFormProps): JSX.Element {
|
}: ApplyLicenseFormProps): JSX.Element {
|
||||||
const { t } = useTranslation(['licenses']);
|
const { t } = useTranslation(['licenses']);
|
||||||
const [loading, setLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [form] = Form.useForm<FormValues>();
|
const [form] = Form.useForm<FormValues>();
|
||||||
const { featureResponse } = useSelector<AppState, AppReducer>(
|
const { featureResponse } = useSelector<AppState, AppReducer>(
|
||||||
(state) => state.app,
|
(state) => state.app,
|
||||||
@ -31,6 +31,8 @@ function ApplyLicenseForm({
|
|||||||
const { notifications } = useNotifications();
|
const { notifications } = useNotifications();
|
||||||
const key = Form.useWatch('key', form);
|
const key = Form.useWatch('key', form);
|
||||||
|
|
||||||
|
const isDisabled = isLoading || !key;
|
||||||
|
|
||||||
const onFinish = async (values: unknown | { key: string }): Promise<void> => {
|
const onFinish = async (values: unknown | { key: string }): Promise<void> => {
|
||||||
const params = values as { key: string };
|
const params = values as { key: string };
|
||||||
if (params.key === '' || !params.key) {
|
if (params.key === '' || !params.key) {
|
||||||
@ -41,7 +43,7 @@ function ApplyLicenseForm({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await apply({
|
const response = await apply({
|
||||||
key: params.key,
|
key: params.key,
|
||||||
@ -66,7 +68,7 @@ function ApplyLicenseForm({
|
|||||||
description: t('unexpected_error'),
|
description: t('unexpected_error'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -85,8 +87,8 @@ function ApplyLicenseForm({
|
|||||||
</LicenseInput>
|
</LicenseInput>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Button
|
<Button
|
||||||
loading={loading}
|
loading={isLoading}
|
||||||
disabled={loading}
|
disabled={isDisabled}
|
||||||
type="primary"
|
type="primary"
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user