-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #856 from chat2db/refactor-workspace
Refactor workspace
- Loading branch information
Showing
26 changed files
with
5,573 additions
and
60 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.deleteTableFooter{ | ||
display: flex; | ||
justify-content: center; | ||
button{ | ||
margin: 0px 15px; | ||
} | ||
|
||
} | ||
|
||
.checkContainer{ | ||
margin: 15px 0px 25px; | ||
} | ||
|
||
.deleteModalContent{ | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
font-size: 16px; | ||
font-weight: 500; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// 置顶表格 | ||
import React, { useState } from 'react'; | ||
import mysqlService from '@/service/sql'; | ||
import { Button, Checkbox } from 'antd'; | ||
import { openModal } from '@/store/common/components'; | ||
import styles from './deleteTable.less'; | ||
import i18n from '@/i18n'; | ||
|
||
export const deleteTable = (treeNodeData) => { | ||
openModal({ | ||
width: '450px', | ||
content: <DeleteModalContent treeNodeData={treeNodeData} openModal={openModal} />, | ||
}); | ||
}; | ||
|
||
export const DeleteModalContent = (params: { treeNodeData: any; openModal: any }) => { | ||
const { treeNodeData } = params; | ||
// 禁用确定按钮 | ||
const [userChecked, setUserChecked] = useState<boolean>(false); | ||
|
||
const onOk = () => { | ||
const p: any = { | ||
dataSourceId: treeNodeData.extraParams.dataSourceId, | ||
databaseName: treeNodeData.extraParams.databaseName, | ||
schemaName: treeNodeData.extraParams.schemaName, | ||
tableName: treeNodeData.name, | ||
}; | ||
mysqlService.deleteTable(p).then(() => { | ||
treeNodeData.parentNode.loadData({ | ||
refresh: true, | ||
}); | ||
openModal(false); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className={styles.deleteModalContent}> | ||
<div className={styles.title}>{i18n('workspace.tree.delete.table.tip', `"${treeNodeData.name}"`)}</div> | ||
<div className={styles.checkContainer}> | ||
<Checkbox | ||
value={userChecked} | ||
onChange={(e) => { | ||
setUserChecked(e.target.checked); | ||
}} | ||
> | ||
{i18n('workspace.tree.delete.tip')} | ||
</Checkbox> | ||
</div> | ||
<div className={styles.deleteTableFooter}> | ||
<Button | ||
type="primary" | ||
onClick={() => { | ||
openModal(false); | ||
}} | ||
> | ||
{i18n('common.button.cancel')} | ||
</Button> | ||
<Button disabled={!userChecked} onClick={onOk}> | ||
{i18n('common.button.affirm')} | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.monacoEditorBox{ | ||
border: 1px solid var(--color-border); | ||
border-radius: 4px; | ||
height: 60vh; | ||
overflow: hidden; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,47 @@ | ||
// 置顶表格 | ||
import React from 'react'; | ||
import mysqlService from '@/service/sql'; | ||
import { v4 as uuid } from 'uuid'; | ||
import styles from './viewDDL.less'; | ||
|
||
import { openModal } from '@/store/common/components'; | ||
|
||
import MonacoEditor from '@/components/MonacoEditor'; | ||
|
||
export const viewDDL = (treeNodeData) => { | ||
const getSql = () => { | ||
return new Promise((resolve) => { | ||
mysqlService | ||
.exportCreateTableSql({ | ||
dataSourceId: treeNodeData.extraParams.dataSourceId, | ||
databaseName: treeNodeData.extraParams.databaseName, | ||
schemaName: treeNodeData.extraParams.schemaName, | ||
tableName: treeNodeData.name, | ||
}) | ||
.then((res) => { | ||
resolve(res); | ||
}); | ||
}); | ||
}; | ||
|
||
openModal({ | ||
title: '查看DDL', | ||
title: `DDL-${treeNodeData.name}`, | ||
width: '60%', | ||
height: '60%', | ||
footer: false, | ||
content: <MonacoEditor id="edit-dialog" />, | ||
content: ( | ||
<div className={styles.monacoEditorBox}> | ||
<MonacoEditorAsync getSql={getSql} /> | ||
</div> | ||
), | ||
}); | ||
}; | ||
|
||
export const MonacoEditorAsync = (params: { getSql: any }) => { | ||
const { getSql } = params; | ||
const monacoEditorRef = React.useRef<any>(); | ||
getSql().then((sql) => { | ||
monacoEditorRef.current.setValue(sql); | ||
}); | ||
return <MonacoEditor id={uuid()} ref={monacoEditorRef} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
chat2db-client/src/components/ConsoleEditor/components/SelectBoundInfo/index.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.consoleOptionsRight{ | ||
display: flex; | ||
} |
Oops, something went wrong.