mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 07:16:00 +00:00
loading grid - split into JslDataGridCode and SqlDataGridCore
This commit is contained in:
@@ -19,7 +19,7 @@ class TableWriter {
|
|||||||
this.jslid = uuidv1();
|
this.jslid = uuidv1();
|
||||||
this.currentFile = path.join(jsldir(), `${this.jslid}.jsonl`);
|
this.currentFile = path.join(jsldir(), `${this.jslid}.jsonl`);
|
||||||
this.currentRowCount = 0;
|
this.currentRowCount = 0;
|
||||||
this.currentChangeIndex = 0;
|
this.currentChangeIndex = 1;
|
||||||
fs.writeFileSync(this.currentFile, JSON.stringify({ columns }) + '\n');
|
fs.writeFileSync(this.currentFile, JSON.stringify({ columns }) + '\n');
|
||||||
this.currentStream = fs.createWriteStream(this.currentFile, { flags: 'a' });
|
this.currentStream = fs.createWriteStream(this.currentFile, { flags: 'a' });
|
||||||
this.writeCurrentStats(false, false);
|
this.writeCurrentStats(false, false);
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import { getChangeSetInsertedRows } from '@dbgate/datalib';
|
|
||||||
import React from 'react';
|
|
||||||
import DataGridCore from './DataGridCore';
|
|
||||||
|
|
||||||
export default function ChangeSetDataGrid(props) {
|
|
||||||
const { changeSet, display, dispatchChangeSet } = props;
|
|
||||||
function undo() {
|
|
||||||
dispatchChangeSet({ type: 'undo' });
|
|
||||||
}
|
|
||||||
function redo() {
|
|
||||||
dispatchChangeSet({ type: 'redo' });
|
|
||||||
}
|
|
||||||
|
|
||||||
const insertedRows = getChangeSetInsertedRows(changeSet, display.baseTable);
|
|
||||||
|
|
||||||
return <DataGridCore {...props} insertedRowCount={insertedRows.length} undo={undo} redo={redo} />;
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
} from './ManagerStyles';
|
} from './ManagerStyles';
|
||||||
import ReferenceManager from './ReferenceManager';
|
import ReferenceManager from './ReferenceManager';
|
||||||
import { HorizontalSplitter } from '../widgets/Splitter';
|
import { HorizontalSplitter } from '../widgets/Splitter';
|
||||||
import LoadingDataGrid from './LoadingDataGrid';
|
|
||||||
|
|
||||||
const MainContainer = styled.div`
|
const MainContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -42,8 +41,8 @@ const DataGridContainer = styled.div`
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
/** @param props {import('./types').LoadingDataGridProps} */
|
|
||||||
export default function DataGrid(props) {
|
export default function DataGrid(props) {
|
||||||
|
const { GridCore } = props;
|
||||||
const Container1 = props.showReferences ? ManagerOuterContainer1 : ManagerOuterContainerFull;
|
const Container1 = props.showReferences ? ManagerOuterContainer1 : ManagerOuterContainerFull;
|
||||||
const [managerSize, setManagerSize] = React.useState(0);
|
const [managerSize, setManagerSize] = React.useState(0);
|
||||||
return (
|
return (
|
||||||
@@ -62,7 +61,7 @@ export default function DataGrid(props) {
|
|||||||
</LeftContainer>
|
</LeftContainer>
|
||||||
|
|
||||||
<DataGridContainer>
|
<DataGridContainer>
|
||||||
<LoadingDataGrid {...props} />
|
<GridCore {...props} />
|
||||||
</DataGridContainer>
|
</DataGridContainer>
|
||||||
</HorizontalSplitter>
|
</HorizontalSplitter>
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,6 @@ export default function DataGridCore(props) {
|
|||||||
openQuery,
|
openQuery,
|
||||||
insertedRowCount,
|
insertedRowCount,
|
||||||
isLoading,
|
isLoading,
|
||||||
undo,
|
|
||||||
redo
|
|
||||||
} = props;
|
} = props;
|
||||||
// console.log('RENDER GRID', display.baseTable.pureName);
|
// console.log('RENDER GRID', display.baseTable.pureName);
|
||||||
const columns = React.useMemo(() => display.allColumns, [display]);
|
const columns = React.useMemo(() => display.allColumns, [display]);
|
||||||
@@ -687,6 +685,13 @@ export default function DataGridCore(props) {
|
|||||||
setvScrollValueToSetDate(new Date());
|
setvScrollValueToSetDate(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function undo() {
|
||||||
|
dispatchChangeSet({ type: 'undo' });
|
||||||
|
}
|
||||||
|
function redo() {
|
||||||
|
dispatchChangeSet({ type: 'redo' });
|
||||||
|
}
|
||||||
|
|
||||||
function handleSave() {
|
function handleSave() {
|
||||||
if (inplaceEditorState.cell) {
|
if (inplaceEditorState.cell) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
93
packages/web/src/datagrid/JslDataGridCore.js
Normal file
93
packages/web/src/datagrid/JslDataGridCore.js
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import axios from '../utility/axios';
|
||||||
|
import { useSetOpenedTabs } from '../utility/globalState';
|
||||||
|
import DataGridCore from './DataGridCore';
|
||||||
|
import useSocket from '../utility/SocketProvider';
|
||||||
|
import useShowModal from '../modals/showModal';
|
||||||
|
import ImportExportModal from '../modals/ImportExportModal';
|
||||||
|
import { getChangeSetInsertedRows } from '@dbgate/datalib';
|
||||||
|
import { openNewTab } from '../utility/common';
|
||||||
|
import LoadingDataGridCore from './LoadingDataGridCore';
|
||||||
|
|
||||||
|
async function loadDataPage(props, offset, limit) {
|
||||||
|
const { jslid } = props;
|
||||||
|
|
||||||
|
const response = await axios.request({
|
||||||
|
url: 'jsldata/get-rows',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
jslid,
|
||||||
|
offset,
|
||||||
|
limit,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dataPageAvailable(props) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadRowCount(props) {
|
||||||
|
const { jslid } = props;
|
||||||
|
|
||||||
|
const response = await axios.request({
|
||||||
|
url: 'jsldata/get-stats',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
jslid,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return response.data.rowCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function JslDataGridCore(props) {
|
||||||
|
const { jslid } = props;
|
||||||
|
const [changeIndex, setChangeIndex] = React.useState(0);
|
||||||
|
|
||||||
|
const showModal = useShowModal();
|
||||||
|
|
||||||
|
const setOpenedTabs = useSetOpenedTabs();
|
||||||
|
const socket = useSocket();
|
||||||
|
|
||||||
|
function exportGrid() {
|
||||||
|
const initialValues = {};
|
||||||
|
const archiveMatch = jslid.match(/^archive:\/\/([^/]+)\/(.*)$/);
|
||||||
|
if (archiveMatch) {
|
||||||
|
initialValues.sourceStorageType = 'archive';
|
||||||
|
initialValues.sourceArchiveFolder = archiveMatch[1];
|
||||||
|
initialValues.sourceList = [archiveMatch[2]];
|
||||||
|
} else {
|
||||||
|
initialValues.sourceStorageType = 'jsldata';
|
||||||
|
initialValues.sourceJslId = jslid;
|
||||||
|
initialValues.sourceList = ['query-data'];
|
||||||
|
}
|
||||||
|
showModal((modalState) => <ImportExportModal modalState={modalState} initialValues={initialValues} />);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleJslDataStats = React.useCallback((stats) => {
|
||||||
|
if (stats.changeIndex < changeIndex) return;
|
||||||
|
setChangeIndex(stats.changeIndex);
|
||||||
|
}, [changeIndex]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (jslid && socket) {
|
||||||
|
socket.on(`jsldata-stats-${jslid}`, handleJslDataStats);
|
||||||
|
return () => {
|
||||||
|
socket.off(`jsldata-stats-${jslid}`, handleJslDataStats);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [jslid]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LoadingDataGridCore
|
||||||
|
{...props}
|
||||||
|
exportGrid={exportGrid}
|
||||||
|
loadDataPage={loadDataPage}
|
||||||
|
dataPageAvailable={dataPageAvailable}
|
||||||
|
loadRowCount={loadRowCount}
|
||||||
|
loadNextDataToken={changeIndex}
|
||||||
|
onReload={() => setChangeIndex(0)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ import useSocket from '../utility/SocketProvider';
|
|||||||
import useShowModal from '../modals/showModal';
|
import useShowModal from '../modals/showModal';
|
||||||
import ImportExportModal from '../modals/ImportExportModal';
|
import ImportExportModal from '../modals/ImportExportModal';
|
||||||
import { getChangeSetInsertedRows } from '@dbgate/datalib';
|
import { getChangeSetInsertedRows } from '@dbgate/datalib';
|
||||||
import ChangeSetDataGrid from './ChangeSetDataGrid';
|
|
||||||
import { openNewTab } from '../utility/common';
|
import { openNewTab } from '../utility/common';
|
||||||
|
|
||||||
/** @param props {import('./types').LoadingDataGridProps} */
|
/** @param props {import('./types').LoadingDataGridProps} */
|
||||||
@@ -79,8 +78,20 @@ async function loadRowCount(props) {
|
|||||||
return parseInt(response.data.rows[0].count);
|
return parseInt(response.data.rows[0].count);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function LoadingDataGrid(props) {
|
export default function LoadingDataGridCore(props) {
|
||||||
const { conid, database, display, changeSetState, dispatchChangeSet, tabVisible, jslid } = props;
|
const {
|
||||||
|
display,
|
||||||
|
changeSetState,
|
||||||
|
dispatchChangeSet,
|
||||||
|
tabVisible,
|
||||||
|
loadDataPage,
|
||||||
|
dataPageAvailable,
|
||||||
|
loadRowCount,
|
||||||
|
loadNextDataToken,
|
||||||
|
onReload,
|
||||||
|
exportGrid,
|
||||||
|
openQuery,
|
||||||
|
} = props;
|
||||||
|
|
||||||
const [loadProps, setLoadProps] = React.useState({
|
const [loadProps, setLoadProps] = React.useState({
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@@ -89,8 +100,7 @@ export default function LoadingDataGrid(props) {
|
|||||||
loadedTime: new Date().getTime(),
|
loadedTime: new Date().getTime(),
|
||||||
allRowCount: null,
|
allRowCount: null,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
jslStatsCounter: 0,
|
loadNextDataToken: 0,
|
||||||
jslChangeIndex: 0,
|
|
||||||
});
|
});
|
||||||
const { isLoading, loadedRows, isLoadedAll, loadedTime, allRowCount, errorMessage } = loadProps;
|
const { isLoading, loadedRows, isLoadedAll, loadedTime, allRowCount, errorMessage } = loadProps;
|
||||||
const showModal = useShowModal();
|
const showModal = useShowModal();
|
||||||
@@ -122,34 +132,11 @@ export default function LoadingDataGrid(props) {
|
|||||||
isLoadedAll: false,
|
isLoadedAll: false,
|
||||||
loadedTime: new Date().getTime(),
|
loadedTime: new Date().getTime(),
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
jslStatsCounter: 0,
|
loadNextDataToken: 0,
|
||||||
jslChangeIndex: 0,
|
|
||||||
});
|
});
|
||||||
|
if (onReload) onReload();
|
||||||
};
|
};
|
||||||
|
|
||||||
function exportGrid() {
|
|
||||||
const initialValues = {};
|
|
||||||
if (jslid) {
|
|
||||||
const archiveMatch = jslid.match(/^archive:\/\/([^/]+)\/(.*)$/);
|
|
||||||
if (archiveMatch) {
|
|
||||||
initialValues.sourceStorageType = 'archive';
|
|
||||||
initialValues.sourceArchiveFolder = archiveMatch[1];
|
|
||||||
initialValues.sourceList = [archiveMatch[2]];
|
|
||||||
} else {
|
|
||||||
initialValues.sourceStorageType = 'jsldata';
|
|
||||||
initialValues.sourceJslId = jslid;
|
|
||||||
initialValues.sourceList = ['query-data'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
initialValues.sourceStorageType = 'query';
|
|
||||||
initialValues.sourceConnectionId = conid;
|
|
||||||
initialValues.sourceDatabaseName = database;
|
|
||||||
initialValues.sourceSql = display.getExportQuery();
|
|
||||||
initialValues.sourceList = display.baseTable ? [display.baseTable.pureName] : [];
|
|
||||||
}
|
|
||||||
showModal((modalState) => <ImportExportModal modalState={modalState} initialValues={initialValues} />);
|
|
||||||
}
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (props.masterLoadedTime && props.masterLoadedTime > loadedTime) {
|
if (props.masterLoadedTime && props.masterLoadedTime > loadedTime) {
|
||||||
display.reload();
|
display.reload();
|
||||||
@@ -193,31 +180,19 @@ export default function LoadingDataGrid(props) {
|
|||||||
setLoadProps((oldLoadProps) => ({
|
setLoadProps((oldLoadProps) => ({
|
||||||
...oldLoadProps,
|
...oldLoadProps,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isLoadedAll: oldLoadProps.jslStatsCounter == loadProps.jslStatsCounter && nextRows.length === 0,
|
isLoadedAll: oldLoadProps.loadNextDataToken == loadNextDataToken && nextRows.length === 0,
|
||||||
|
loadNextDataToken,
|
||||||
...loadedInfo,
|
...loadedInfo,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleJslDataStats = React.useCallback((stats) => {
|
React.useEffect(()=>{
|
||||||
if (stats.changeIndex < loadProps.jslChangeIndex) return;
|
|
||||||
setLoadProps((oldProps) => ({
|
setLoadProps((oldProps) => ({
|
||||||
...oldProps,
|
...oldProps,
|
||||||
allRowCount: stats.rowCount,
|
|
||||||
isLoadedAll: false,
|
isLoadedAll: false,
|
||||||
jslStatsCounter: oldProps.jslStatsCounter + 1,
|
|
||||||
jslChangeIndex: stats.changeIndex,
|
|
||||||
}));
|
}));
|
||||||
}, []);
|
},[loadNextDataToken]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (jslid && socket) {
|
|
||||||
socket.on(`jsldata-stats-${jslid}`, handleJslDataStats);
|
|
||||||
return () => {
|
|
||||||
socket.off(`jsldata-stats-${jslid}`, handleJslDataStats);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}, [jslid]);
|
|
||||||
|
|
||||||
const insertedRows = getChangeSetInsertedRows(changeSet, display.baseTable);
|
const insertedRows = getChangeSetInsertedRows(changeSet, display.baseTable);
|
||||||
const rowCountNewIncluded = loadedRows.length + insertedRows.length;
|
const rowCountNewIncluded = loadedRows.length + insertedRows.length;
|
||||||
@@ -231,23 +206,8 @@ export default function LoadingDataGrid(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChangeSetDataGrid
|
<DataGridCore
|
||||||
{...props}
|
{...props}
|
||||||
loadNextData={handleLoadNextData}
|
loadNextData={handleLoadNextData}
|
||||||
errorMessage={errorMessage}
|
errorMessage={errorMessage}
|
||||||
@@ -255,7 +215,7 @@ export default function LoadingDataGrid(props) {
|
|||||||
loadedTime={loadedTime}
|
loadedTime={loadedTime}
|
||||||
exportGrid={exportGrid}
|
exportGrid={exportGrid}
|
||||||
allRowCount={allRowCount}
|
allRowCount={allRowCount}
|
||||||
openQuery={display.baseTable ? openQuery : null}
|
openQuery={openQuery}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
rows={loadedRows}
|
rows={loadedRows}
|
||||||
/>
|
/>
|
||||||
95
packages/web/src/datagrid/SqlDataGridCore.js
Normal file
95
packages/web/src/datagrid/SqlDataGridCore.js
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import axios from '../utility/axios';
|
||||||
|
import { useSetOpenedTabs } from '../utility/globalState';
|
||||||
|
import DataGridCore from './DataGridCore';
|
||||||
|
import useSocket from '../utility/SocketProvider';
|
||||||
|
import useShowModal from '../modals/showModal';
|
||||||
|
import ImportExportModal from '../modals/ImportExportModal';
|
||||||
|
import { getChangeSetInsertedRows } from '@dbgate/datalib';
|
||||||
|
import { openNewTab } from '../utility/common';
|
||||||
|
import LoadingDataGridCore from './LoadingDataGridCore';
|
||||||
|
|
||||||
|
/** @param props {import('./types').LoadingDataGridProps} */
|
||||||
|
async function loadDataPage(props, offset, limit) {
|
||||||
|
const { display, conid, database } = props;
|
||||||
|
|
||||||
|
const sql = display.getPageQuery(offset, limit);
|
||||||
|
|
||||||
|
const response = await axios.request({
|
||||||
|
url: 'database-connections/query-data',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
},
|
||||||
|
data: { sql },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.data.errorMessage) return response.data;
|
||||||
|
return response.data.rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dataPageAvailable(props) {
|
||||||
|
const { display } = props;
|
||||||
|
const sql = display.getPageQuery(0, 1);
|
||||||
|
return !!sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadRowCount(props) {
|
||||||
|
const { display, conid, database } = props;
|
||||||
|
|
||||||
|
const sql = display.getCountQuery();
|
||||||
|
|
||||||
|
const response = await axios.request({
|
||||||
|
url: 'database-connections/query-data',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
},
|
||||||
|
data: { sql },
|
||||||
|
});
|
||||||
|
|
||||||
|
return parseInt(response.data.rows[0].count);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SqlDataGridCore(props) {
|
||||||
|
const { conid, database, display, changeSetState, dispatchChangeSet, tabVisible } = props;
|
||||||
|
const showModal = useShowModal();
|
||||||
|
const setOpenedTabs = useSetOpenedTabs();
|
||||||
|
|
||||||
|
function exportGrid() {
|
||||||
|
const initialValues = {};
|
||||||
|
initialValues.sourceStorageType = 'query';
|
||||||
|
initialValues.sourceConnectionId = conid;
|
||||||
|
initialValues.sourceDatabaseName = database;
|
||||||
|
initialValues.sourceSql = display.getExportQuery();
|
||||||
|
initialValues.sourceList = display.baseTable ? [display.baseTable.pureName] : [];
|
||||||
|
showModal((modalState) => <ImportExportModal modalState={modalState} initialValues={initialValues} />);
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LoadingDataGridCore
|
||||||
|
{...props}
|
||||||
|
exportGrid={exportGrid}
|
||||||
|
openQuery={openQuery}
|
||||||
|
loadDataPage={loadDataPage}
|
||||||
|
dataPageAvailable={dataPageAvailable}
|
||||||
|
loadRowCount={loadRowCount}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import useSocket from '../utility/SocketProvider';
|
|||||||
import { VerticalSplitter } from '../widgets/Splitter';
|
import { VerticalSplitter } from '../widgets/Splitter';
|
||||||
import stableStringify from 'json-stable-stringify';
|
import stableStringify from 'json-stable-stringify';
|
||||||
import ReferenceHeader from './ReferenceHeader';
|
import ReferenceHeader from './ReferenceHeader';
|
||||||
|
import SqlDataGridCore from './SqlDataGridCore';
|
||||||
|
|
||||||
const ReferenceContainer = styled.div`
|
const ReferenceContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -162,6 +163,7 @@ export default function TableDataGrid({
|
|||||||
onReferenceSourceChanged={reference ? handleReferenceSourceChanged : null}
|
onReferenceSourceChanged={reference ? handleReferenceSourceChanged : null}
|
||||||
refReloadToken={refReloadToken.toString()}
|
refReloadToken={refReloadToken.toString()}
|
||||||
masterLoadedTime={masterLoadedTime}
|
masterLoadedTime={masterLoadedTime}
|
||||||
|
GridCore={SqlDataGridCore}
|
||||||
/>
|
/>
|
||||||
{reference && (
|
{reference && (
|
||||||
<ReferenceContainer>
|
<ReferenceContainer>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import DataGrid from '../datagrid/DataGrid';
|
import DataGrid from '../datagrid/DataGrid';
|
||||||
import { JslGridDisplay, createGridConfig, createGridCache } from '@dbgate/datalib';
|
import { JslGridDisplay, createGridConfig, createGridCache } from '@dbgate/datalib';
|
||||||
import useFetch from '../utility/useFetch';
|
import useFetch from '../utility/useFetch';
|
||||||
|
import JslDataGridCore from '../datagrid/JslDataGridCore';
|
||||||
|
|
||||||
export default function JslDataGrid({ jslid }) {
|
export default function JslDataGrid({ jslid }) {
|
||||||
const info = useFetch({
|
const info = useFetch({
|
||||||
@@ -19,5 +20,5 @@ export default function JslDataGrid({ jslid }) {
|
|||||||
cache,
|
cache,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return <DataGrid display={display} jslid={jslid} />;
|
return <DataGrid display={display} jslid={jslid} GridCore={JslDataGridCore} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import useUndoReducer from '../utility/useUndoReducer';
|
|||||||
import usePropsCompare from '../utility/usePropsCompare';
|
import usePropsCompare from '../utility/usePropsCompare';
|
||||||
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
import { useUpdateDatabaseForTab } from '../utility/globalState';
|
||||||
import useGridConfig from '../utility/useGridConfig';
|
import useGridConfig from '../utility/useGridConfig';
|
||||||
|
import SqlDataGridCore from '../datagrid/SqlDataGridCore';
|
||||||
|
|
||||||
export default function ViewDataTab({ conid, database, schemaName, pureName, tabVisible, toolbarPortalRef, tabid }) {
|
export default function ViewDataTab({ conid, database, schemaName, pureName, tabVisible, toolbarPortalRef, tabid }) {
|
||||||
const viewInfo = useViewInfo({ conid, database, schemaName, pureName });
|
const viewInfo = useViewInfo({ conid, database, schemaName, pureName });
|
||||||
@@ -50,6 +51,7 @@ export default function ViewDataTab({ conid, database, schemaName, pureName, tab
|
|||||||
changeSetState={changeSetState}
|
changeSetState={changeSetState}
|
||||||
dispatchChangeSet={dispatchChangeSet}
|
dispatchChangeSet={dispatchChangeSet}
|
||||||
toolbarPortalRef={toolbarPortalRef}
|
toolbarPortalRef={toolbarPortalRef}
|
||||||
/>
|
GridCore={SqlDataGridCore}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user