mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 04:05:59 +00:00
fixes
This commit is contained in:
@@ -28,7 +28,8 @@ module.exports = {
|
|||||||
test(req, res) {
|
test(req, res) {
|
||||||
const subprocess = fork(process.argv[1], ['connectProcess']);
|
const subprocess = fork(process.argv[1], ['connectProcess']);
|
||||||
subprocess.on('message', (resp) => {
|
subprocess.on('message', (resp) => {
|
||||||
const { msgtype } = res;
|
// @ts-ignore
|
||||||
|
const { msgtype } = resp;
|
||||||
if (msgtype == 'connected' || msgtype == 'error') {
|
if (msgtype == 'connected' || msgtype == 'error') {
|
||||||
res.json(resp);
|
res.json(resp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function start() {
|
|||||||
const res = await driver.getVersion(conn);
|
const res = await driver.getVersion(conn);
|
||||||
process.send({ msgtype: 'connected', ...res });
|
process.send({ msgtype: 'connected', ...res });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.error(e);
|
||||||
process.send({ msgtype: 'error', error: e.message });
|
process.send({ msgtype: 'error', error: e.message });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,13 +6,20 @@ import showModal from '../modals/showModal';
|
|||||||
import ConnectionModal from '../modals/ConnectionModal';
|
import ConnectionModal from '../modals/ConnectionModal';
|
||||||
import axios from '../utility/axios';
|
import axios from '../utility/axios';
|
||||||
import { filterName } from '@dbgate/datalib';
|
import { filterName } from '@dbgate/datalib';
|
||||||
|
import ConfirmModal from '../modals/ConfirmModal';
|
||||||
|
|
||||||
function Menu({ data, setOpenedConnections, openedConnections }) {
|
function Menu({ data, setOpenedConnections, openedConnections }) {
|
||||||
const handleEdit = () => {
|
const handleEdit = () => {
|
||||||
showModal((modalState) => <ConnectionModal modalState={modalState} connection={data} />);
|
showModal((modalState) => <ConnectionModal modalState={modalState} connection={data} />);
|
||||||
};
|
};
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
axios.post('connections/delete', data);
|
showModal((modalState) => (
|
||||||
|
<ConfirmModal
|
||||||
|
modalState={modalState}
|
||||||
|
message={`Really delete connection ${data.displayName || data.server}?`}
|
||||||
|
onConfirm={() => axios.post('connections/delete', data)}
|
||||||
|
/>
|
||||||
|
));
|
||||||
};
|
};
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
axios.post('server-connections/refresh', { conid: data._id });
|
axios.post('server-connections/refresh', { conid: data._id });
|
||||||
|
|||||||
28
packages/web/src/modals/ConfirmModal.js
Normal file
28
packages/web/src/modals/ConfirmModal.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ModalBase from './ModalBase';
|
||||||
|
import { FormButtonRow } from '../utility/forms';
|
||||||
|
import FormStyledButton from '../widgets/FormStyledButton';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const MessageWrapper = styled.div`
|
||||||
|
margin: 20px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default function ConfirmModal({ message, modalState, onConfirm }) {
|
||||||
|
return (
|
||||||
|
<ModalBase modalState={modalState}>
|
||||||
|
<MessageWrapper>{message}</MessageWrapper>
|
||||||
|
|
||||||
|
<FormButtonRow>
|
||||||
|
<FormStyledButton
|
||||||
|
value="OK"
|
||||||
|
onClick={() => {
|
||||||
|
modalState.close();
|
||||||
|
onConfirm();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormStyledButton type="button" value="Close" onClick={modalState.close} />
|
||||||
|
</FormButtonRow>
|
||||||
|
</ModalBase>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import axios from '../utility/axios';
|
|
||||||
import ModalBase from './ModalBase';
|
import ModalBase from './ModalBase';
|
||||||
import { FormRow, FormButtonRow, FormTextField, FormSelectField, FormSubmit } from '../utility/forms';
|
import { FormButtonRow } from '../utility/forms';
|
||||||
import FormStyledButton from '../widgets/FormStyledButton';
|
import FormStyledButton from '../widgets/FormStyledButton';
|
||||||
import { TextField } from '../utility/inputs';
|
|
||||||
import { Formik, Form } from 'formik';
|
|
||||||
import SqlEditor from '../sqleditor/SqlEditor';
|
import SqlEditor from '../sqleditor/SqlEditor';
|
||||||
// import FormikForm from '../utility/FormikForm';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user