mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
show generated query
This commit is contained in:
parent
3819bf9bd7
commit
474d3962e2
@ -10,6 +10,7 @@ export default function DataGridContextMenu({
|
||||
reload,
|
||||
exportGrid,
|
||||
filterSelectedValue,
|
||||
openQuery,
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
@ -33,12 +34,11 @@ export default function DataGridContextMenu({
|
||||
<DropDownMenuItem onClick={setNull} keyText="Ctrl+0">
|
||||
Set NULL
|
||||
</DropDownMenuItem>
|
||||
<DropDownMenuItem onClick={exportGrid} >
|
||||
Export
|
||||
</DropDownMenuItem>
|
||||
<DropDownMenuItem onClick={exportGrid}>Export</DropDownMenuItem>
|
||||
<DropDownMenuItem onClick={filterSelectedValue} keyText="Ctrl+F">
|
||||
Filter selected value
|
||||
</DropDownMenuItem>
|
||||
{openQuery && <DropDownMenuItem onClick={openQuery}>Open query</DropDownMenuItem>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ import ErrorInfo from '../widgets/ErrorInfo';
|
||||
import useShowModal from '../modals/showModal';
|
||||
import ErrorMessageModal from '../modals/ErrorMessageModal';
|
||||
import ImportExportModal from '../modals/ImportExportModal';
|
||||
import { openNewTab } from '../utility/common';
|
||||
import { useSetOpenedTabs } from '../utility/globalState';
|
||||
|
||||
const GridContainer = styled.div`
|
||||
position: absolute;
|
||||
@ -239,6 +241,7 @@ export default function DataGridCore(props) {
|
||||
|
||||
const changeSet = changeSetState && changeSetState.value;
|
||||
const setChangeSet = React.useCallback((value) => dispatchChangeSet({ type: 'set', value }), [dispatchChangeSet]);
|
||||
const setOpenedTabs = useSetOpenedTabs();
|
||||
|
||||
const changeSetRef = React.useRef(changeSet);
|
||||
|
||||
@ -560,6 +563,7 @@ export default function DataGridCore(props) {
|
||||
setNull={setNull}
|
||||
exportGrid={exportGrid}
|
||||
filterSelectedValue={filterSelectedValue}
|
||||
openQuery={display.baseTable ? openQuery : null}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -845,6 +849,21 @@ export default function DataGridCore(props) {
|
||||
display.setFilters(flts);
|
||||
}
|
||||
|
||||
function openQuery() {
|
||||
openNewTab(setOpenedTabs, {
|
||||
title: 'Query',
|
||||
icon: 'sql.svg',
|
||||
tabComponent: 'QueryTab',
|
||||
props: {
|
||||
initialScript: display.getExportQuery(),
|
||||
schemaName: display.baseTable.schemaName,
|
||||
pureName: display.baseTable.pureName,
|
||||
conid,
|
||||
database,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function revertAllChanges() {
|
||||
setChangeSet(createChangeSet());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user