Commit f7708f53 authored by 皮倩雯's avatar 皮倩雯

fix: '修改数据库连接配置界面样式'

parent 86489883
Pipeline #42620 skipped with stages
...@@ -60,7 +60,7 @@ const GlobalHeaderRight = props => { ...@@ -60,7 +60,7 @@ const GlobalHeaderRight = props => {
文档说明 文档说明
</a> </a>
</div> </div>
<Colophon /> {/* <Colophon /> */}
<div style={{ margin: '0 10px' }}> <div style={{ margin: '0 10px' }}>
<a <a
target="_blank" target="_blank"
......
...@@ -48,16 +48,16 @@ const DatabaseConnectConfig = props => { ...@@ -48,16 +48,16 @@ const DatabaseConnectConfig = props => {
</TabPane> </TabPane>
))} ))}
</Tabs> */} </Tabs> */}
<Hr />
<SQLServerTable /> <SQLServerTable />
<br /> <br />
<Hr />
<OracleTable /> <OracleTable />
<br /> <br />
<Hr />
<MongDBTable /> <MongDBTable />
<br /> <br />
<Hr />
<MySQLTable /> <MySQLTable />
</Card> </Card>
</PageContainer> </PageContainer>
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
getMongoDBConnectionTest, getMongoDBConnectionTest,
GetConnString, GetConnString,
DeleteConnString, DeleteConnString,
GetConnTest GetConnTest,
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const MongDBTable = props => { const MongDBTable = props => {
...@@ -34,17 +34,18 @@ const MongDBTable = props => { ...@@ -34,17 +34,18 @@ const MongDBTable = props => {
// setTableLoading(false); // setTableLoading(false);
// }); // });
GetConnString({ GetConnString({
Type:"MongoDB" Type: 'MongoDB',
}).then(resnew => {
setTableLoading(false);
if (resnew.code == 0) {
let res = resnew.data
setDataList(res);
}
}) })
.catch(err => { .then(resnew => {
setTableLoading(false); setTableLoading(false);
}); if (resnew.code == 0) {
let res = resnew.data;
setDataList(res);
}
})
.catch(err => {
setTableLoading(false);
});
}, [flag]); }, [flag]);
// 新增 // 新增
const handleAdd = (val, item) => { const handleAdd = (val, item) => {
...@@ -80,29 +81,29 @@ const MongDBTable = props => { ...@@ -80,29 +81,29 @@ const MongDBTable = props => {
// console.error(err); // console.error(err);
// }); // });
GetConnTest({ GetConnTest({
Type:"MongoDB", Type: 'MongoDB',
name:item.name name: item.name,
}).then(res => {
setTableLoading(false);
if (res.code == 0) {
notification.success({
message: '提示',
description: '连接成功',
duration: 3,
});
} else {
notification.error({
message: '提示',
description: res.msg || '连接失败',
duration: 3,
});
}
}) })
.catch(err => { .then(res => {
setTableLoading(false); setTableLoading(false);
console.error(err); if (res.code == 0) {
}); notification.success({
message: '提示',
description: '连接成功',
duration: 3,
});
} else {
notification.error({
message: '提示',
description: res.msg || '连接失败',
duration: 3,
});
}
})
.catch(err => {
setTableLoading(false);
console.error(err);
});
}; };
// 删除 // 删除
const handleDel = (val, item) => { const handleDel = (val, item) => {
...@@ -129,24 +130,24 @@ const MongDBTable = props => { ...@@ -129,24 +130,24 @@ const MongDBTable = props => {
// } // }
// }) // })
// .catch(err => console.error(err)); // .catch(err => console.error(err));
DeleteConnString({ DeleteConnString({
name:name name,
}).then(res => { }).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) });
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
...@@ -222,11 +223,7 @@ const MongDBTable = props => { ...@@ -222,11 +223,7 @@ const MongDBTable = props => {
key: 'options', key: 'options',
width: 300, width: 300,
render: (val, item) => [ render: (val, item) => [
<Button <Button size="small" type="primary" onClick={() => handleCon(val, item)}>
size="small"
type="primary"
onClick={() => handleCon(val, item)}
>
测试连接 测试连接
</Button>, </Button>,
<Button <Button
...@@ -265,7 +262,7 @@ const MongDBTable = props => { ...@@ -265,7 +262,7 @@ const MongDBTable = props => {
bordered bordered
loading={tableLoading} loading={tableLoading}
dataSource={dataList} dataSource={dataList}
options={{ reload: false, fullScreen: false }} options={false}
toolBarRender={() => [ toolBarRender={() => [
<Button <Button
type="primary" type="primary"
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
deleteConnString, deleteConnString,
GetConnString, GetConnString,
DeleteConnString, DeleteConnString,
GetConnTest GetConnTest,
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const MySQLTable = props => { const MySQLTable = props => {
...@@ -33,12 +33,13 @@ const MySQLTable = props => { ...@@ -33,12 +33,13 @@ const MySQLTable = props => {
// .catch(err => { // .catch(err => {
// setTableLoading(false); // setTableLoading(false);
// }); // });
GetConnString({ GetConnString({
Type:"MySQL" Type: 'MySQL',
}).then(resnew => { })
.then(resnew => {
setTableLoading(false); setTableLoading(false);
if (resnew.code == 0) { if (resnew.code == 0) {
let res = resnew.data let res = resnew.data;
setDataList(res); setDataList(res);
} }
}) })
...@@ -79,10 +80,11 @@ const MySQLTable = props => { ...@@ -79,10 +80,11 @@ const MySQLTable = props => {
// setTableLoading(false); // setTableLoading(false);
// console.error(err); // console.error(err);
// }); // });
GetConnTest({ GetConnTest({
Type:"MySQL", Type: 'MySQL',
name:item.name name: item.name,
}).then(res => { })
.then(res => {
setTableLoading(false); setTableLoading(false);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
...@@ -128,24 +130,24 @@ const MySQLTable = props => { ...@@ -128,24 +130,24 @@ const MySQLTable = props => {
// } // }
// }) // })
// .catch(err => console.error(err)); // .catch(err => console.error(err));
DeleteConnString({ DeleteConnString({
name:name name,
}).then(res => { }).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) });
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
...@@ -198,11 +200,7 @@ const MySQLTable = props => { ...@@ -198,11 +200,7 @@ const MySQLTable = props => {
key: 'options', key: 'options',
width: 300, width: 300,
render: (val, item) => [ render: (val, item) => [
<Button <Button size="small" type="primary" onClick={() => handleCon(val, item)}>
size="small"
type="primary"
onClick={() => handleCon(val, item)}
>
测试连接 测试连接
</Button>, </Button>,
<Button <Button
...@@ -241,7 +239,7 @@ const MySQLTable = props => { ...@@ -241,7 +239,7 @@ const MySQLTable = props => {
bordered bordered
loading={tableLoading} loading={tableLoading}
dataSource={dataList} dataSource={dataList}
options={{ reload: false, fullScreen: false }} options={false}
toolBarRender={() => [ toolBarRender={() => [
<Button <Button
type="primary" type="primary"
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
deleteConnString, deleteConnString,
GetConnString, GetConnString,
DeleteConnString, DeleteConnString,
GetConnTest GetConnTest,
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const OracleTable = props => { const OracleTable = props => {
...@@ -33,12 +33,13 @@ const OracleTable = props => { ...@@ -33,12 +33,13 @@ const OracleTable = props => {
// .catch(err => { // .catch(err => {
// setTableLoading(false); // setTableLoading(false);
// }); // });
GetConnString({ GetConnString({
Type:"Oracle" Type: 'Oracle',
}).then(resnew => { })
.then(resnew => {
setTableLoading(false); setTableLoading(false);
if (resnew.code == 0) { if (resnew.code == 0) {
let res = resnew.data let res = resnew.data;
setDataList(res); setDataList(res);
} }
}) })
...@@ -79,10 +80,11 @@ const OracleTable = props => { ...@@ -79,10 +80,11 @@ const OracleTable = props => {
// setTableLoading(false); // setTableLoading(false);
// console.error(err); // console.error(err);
// }); // });
GetConnTest({ GetConnTest({
Type:"Oracle", Type: 'Oracle',
name:item.name name: item.name,
}).then(res => { })
.then(res => {
setTableLoading(false); setTableLoading(false);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
...@@ -128,24 +130,24 @@ const OracleTable = props => { ...@@ -128,24 +130,24 @@ const OracleTable = props => {
// } // }
// }) // })
// .catch(err => console.error(err)); // .catch(err => console.error(err));
DeleteConnString({ DeleteConnString({
name:name name,
}).then(res => { }).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) });
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
...@@ -191,11 +193,7 @@ const OracleTable = props => { ...@@ -191,11 +193,7 @@ const OracleTable = props => {
key: 'options', key: 'options',
width: 300, width: 300,
render: (val, item) => [ render: (val, item) => [
<Button <Button size="small" type="primary" onClick={() => handleCon(val, item)}>
size="small"
type="primary"
onClick={() => handleCon(val, item)}
>
测试连接 测试连接
</Button>, </Button>,
<Button <Button
...@@ -234,7 +232,7 @@ const OracleTable = props => { ...@@ -234,7 +232,7 @@ const OracleTable = props => {
bordered bordered
loading={tableLoading} loading={tableLoading}
dataSource={dataList} dataSource={dataList}
options={{ reload: false, fullScreen: false }} options={false}
toolBarRender={() => [ toolBarRender={() => [
<Button <Button
type="primary" type="primary"
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { Button, Popconfirm, notification } from 'antd'; import { Button, Popconfirm, notification } from 'antd';
import { import { GetConnString, DeleteConnString, GetConnTest } from '@/services/database/api';
getSQLServerConnString,
deleteConnString,
getSQLServerConnectionTest,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const SQLServerTable = props => { const SQLServerTable = props => {
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
...@@ -33,12 +26,13 @@ const SQLServerTable = props => { ...@@ -33,12 +26,13 @@ const SQLServerTable = props => {
// .catch(err => { // .catch(err => {
// setTableLoading(false); // setTableLoading(false);
// }); // });
GetConnString({ GetConnString({
Type:"SQLServer" Type: 'SQLServer',
}).then(resnew => { })
.then(resnew => {
setTableLoading(false); setTableLoading(false);
if (resnew.code == 0) { if (resnew.code == 0) {
let res = resnew.data let res = resnew.data;
setDataList(res); setDataList(res);
} }
}) })
...@@ -79,10 +73,11 @@ const SQLServerTable = props => { ...@@ -79,10 +73,11 @@ const SQLServerTable = props => {
// setTableLoading(false); // setTableLoading(false);
// console.error(err); // console.error(err);
// }); // });
GetConnTest({ GetConnTest({
Type:"SQLServer", Type: 'SQLServer',
name:item.name name: item.name,
}).then(res => { })
.then(res => {
setTableLoading(false); setTableLoading(false);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
...@@ -128,24 +123,24 @@ const SQLServerTable = props => { ...@@ -128,24 +123,24 @@ const SQLServerTable = props => {
// } // }
// }) // })
// .catch(err => console.error(err)); // .catch(err => console.error(err));
DeleteConnString({ DeleteConnString({
name:name name,
}).then(res => { }).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.code == 0) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) });
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
...@@ -199,12 +194,7 @@ const SQLServerTable = props => { ...@@ -199,12 +194,7 @@ const SQLServerTable = props => {
key: 'options', key: 'options',
width: 300, width: 300,
render: (val, item) => [ render: (val, item) => [
<Button <Button size="small" type="primary" onClick={() => handleCon(val, item)} key="testLink">
size="small"
type="primary"
onClick={() => handleCon(val, item)}
key="testLink"
>
测试连接 测试连接
</Button>, </Button>,
<Button <Button
...@@ -245,7 +235,7 @@ const SQLServerTable = props => { ...@@ -245,7 +235,7 @@ const SQLServerTable = props => {
bordered bordered
loading={tableLoading} loading={tableLoading}
dataSource={dataList} dataSource={dataList}
options={{ reload: false, fullScreen: false }} options={false}
toolBarRender={() => [ toolBarRender={() => [
<Button <Button
type="primary" type="primary"
......
...@@ -163,7 +163,10 @@ const IotConfig = () => { ...@@ -163,7 +163,10 @@ const IotConfig = () => {
]} ]}
> >
<div style={{ display: 'flex', justifyContent: 'flex-start' }}> <div style={{ display: 'flex', justifyContent: 'flex-start' }}>
<Input style={{ width: '300px', marginLeft: '15px' }} /> <Input
style={{ width: '300px', marginLeft: '15px' }}
placeholder="请输入服务地址"
/>
<span style={{ display: show1 }}> <span style={{ display: show1 }}>
<img <img
src={Yes} src={Yes}
......
...@@ -152,7 +152,10 @@ const MessageConfig = () => { ...@@ -152,7 +152,10 @@ const MessageConfig = () => {
]} ]}
> >
<div style={{ display: 'flex', justifyContent: 'flex-start' }}> <div style={{ display: 'flex', justifyContent: 'flex-start' }}>
<Input style={{ width: '300px', marginLeft: '15px' }} /> <Input
style={{ width: '300px', marginLeft: '15px' }}
placeholder="请输入服务地址"
/>
<span style={{ display: show1 }}> <span style={{ display: show1 }}>
<img <img
src={Yes} src={Yes}
......
...@@ -192,7 +192,7 @@ const ProxyConfig = () => { ...@@ -192,7 +192,7 @@ const ProxyConfig = () => {
}, },
]} ]}
> >
<Input style={{ marginLeft: '15px', width: '300px' }} /> <Input style={{ marginLeft: '15px', width: '300px' }} placeholder="请输入ngnix端口" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
style={{ marginLeft: '20px' }} style={{ marginLeft: '20px' }}
...@@ -210,7 +210,7 @@ const ProxyConfig = () => { ...@@ -210,7 +210,7 @@ const ProxyConfig = () => {
]} ]}
hasFeedback hasFeedback
> >
<Input style={{ marginLeft: '34px', width: '300px' }} /> <Input style={{ marginLeft: '34px', width: '300px' }} placeholder="请输入IIS地址" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
style={{ marginLeft: '20px' }} style={{ marginLeft: '20px' }}
...@@ -228,7 +228,7 @@ const ProxyConfig = () => { ...@@ -228,7 +228,7 @@ const ProxyConfig = () => {
}, },
]} ]}
> >
<Input style={{ marginLeft: '18px', width: '300px' }} /> <Input style={{ marginLeft: '18px', width: '300px' }} placeholder="请输入EMQ地址" />
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Button type="primary" htmlType="submit" style={{ marginLeft: '130px' }}> <Button type="primary" htmlType="submit" style={{ marginLeft: '130px' }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment