Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12691: PMM-Dump close modal after API response of Send to Support #701

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
Loading