mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 17:06:01 +00:00
statusbar - show current database
This commit is contained in:
23
packages/web/src/tabs/QueryTab.js
Normal file
23
packages/web/src/tabs/QueryTab.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import engines from '@dbgate/engines';
|
||||
import useTableInfo from '../utility/useTableInfo';
|
||||
import useConnectionInfo from '../utility/useConnectionInfo';
|
||||
import SqlEditor from '../sqleditor/SqlEditor';
|
||||
|
||||
export default function QueryTab({ conid, database, schemaName, pureName, tabVisible }) {
|
||||
const [queryText, setQueryText] = React.useState('');
|
||||
// const tableInfo = useTableInfo({ conid, database, schemaName, pureName });
|
||||
// const connnection = useConnectionInfo(conid);
|
||||
// if (!connnection || !tableInfo) return null;
|
||||
// // console.log(tableInfo);
|
||||
|
||||
// const driver = engines(connnection.engine);
|
||||
// const dmp = driver.createDumper();
|
||||
// if (tableInfo) dmp.createTable(tableInfo);
|
||||
|
||||
const handleChange = text => {
|
||||
setQueryText(text);
|
||||
};
|
||||
|
||||
return <SqlEditor value={queryText} onChange={handleChange} tabVisible={tabVisible} />;
|
||||
}
|
||||
@@ -14,5 +14,5 @@ export default function TableCreateScriptTab({ conid, database, schemaName, pure
|
||||
const dmp = driver.createDumper();
|
||||
if (tableInfo) dmp.createTable(tableInfo);
|
||||
|
||||
return <SqlEditor engine={connnection && connnection.engine} value={dmp.s} />;
|
||||
return <SqlEditor engine={connnection && connnection.engine} value={dmp.s} readOnly />;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import engines from '@dbgate/engines';
|
||||
import getTableInfo from '../utility/getTableInfo';
|
||||
import useUndoReducer from '../utility/useUndoReducer';
|
||||
import usePropsCompare from '../utility/usePropsCompare';
|
||||
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
||||
|
||||
export default function TableDataTab({ conid, database, schemaName, pureName, tabVisible, toolbarPortalRef }) {
|
||||
const tableInfo = useTableInfo({ conid, database, schemaName, pureName });
|
||||
@@ -17,8 +18,7 @@ export default function TableDataTab({ conid, database, schemaName, pureName, ta
|
||||
const [cache, setCache] = React.useState(createGridCache());
|
||||
const [changeSetState, dispatchChangeSet] = useUndoReducer(createChangeSet());
|
||||
|
||||
// console.log('changeSet', changeSet);
|
||||
|
||||
useUpdateDatabaseForTab(tabVisible, conid, database);
|
||||
const connection = useConnectionInfo(conid);
|
||||
|
||||
// usePropsCompare({ tableInfo, connection, config, cache });
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import TableDataTab from './TableDataTab';
|
||||
import TableStructureTab from './TableStructureTab';
|
||||
import TableCreateScriptTab from './TableCreateScriptTab'
|
||||
import TableCreateScriptTab from './TableCreateScriptTab';
|
||||
import QueryTab from './QueryTab';
|
||||
|
||||
export default {
|
||||
TableDataTab,
|
||||
TableStructureTab,
|
||||
TableCreateScriptTab,
|
||||
QueryTab,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user