Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions public/app/percona/pmm-dump/SendToSupportModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@emotion/css';
import React, { FC } from 'react';
import React, { FC, useCallback } from 'react';

import { Modal, Button, Form, Field, Input, useStyles2 } from '@grafana/ui';
import { Messages } from 'app/percona/pmm-dump/PMMDump.messages';
Expand Down Expand Up @@ -27,19 +27,26 @@ export const SendToSupportModal: FC<ModalProps> = ({ onClose, dumpIds }) => {
directory: '',
};

const onSubmit = (values: SendToSupportForm) => {
dispatch(
sendToSupportAction({
sftp_parameters: {
user: values.user,
address: values.address,
password: values.password,
directory: values.directory || undefined,
},
dump_ids: dumpIds,
})
);
};
const onSubmit = useCallback(
(values: SendToSupportForm) => {
dispatch(
sendToSupportAction({
sftp_parameters: {
user: values.user,
address: values.address,
password: values.password,
directory: values.directory || undefined,
},
dump_ids: dumpIds,
})
);

if (!isLoading) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible ot hit the submit button when loading? If so, I think it would make sense to have submit disabled till the loading is completed.

onClose();
}
},
[isLoading, dumpIds, onClose, dispatch]
);

return (
<Modal
Expand Down