mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 18:16:00 +00:00
scripting engine
This commit is contained in:
@@ -4,11 +4,12 @@ import { JslGridDisplay, createGridConfig, createGridCache } from '@dbgate/datal
|
||||
import useFetch from '../utility/useFetch';
|
||||
|
||||
export default function JslDataGrid({ jslid }) {
|
||||
const columns = useFetch({
|
||||
const info = useFetch({
|
||||
params: { jslid },
|
||||
url: 'jsldata/get-info',
|
||||
defaultValue: [],
|
||||
defaultValue: {},
|
||||
});
|
||||
const columns = (info && info.columns) || [];
|
||||
const [config, setConfig] = React.useState(createGridConfig());
|
||||
const [cache, setCache] = React.useState(createGridCache());
|
||||
const display = React.useMemo(() => new JslGridDisplay(jslid, columns, config, setConfig, cache, setCache), [
|
||||
|
||||
@@ -89,10 +89,13 @@ export default function QueryTab({
|
||||
}
|
||||
}, [sqlFromTemplate]);
|
||||
|
||||
const saveToStorage = React.useCallback(() => localStorage.setItem(localStorageKey, queryTextRef.current), [
|
||||
localStorageKey,
|
||||
queryTextRef,
|
||||
]);
|
||||
const saveToStorage = React.useCallback(() => {
|
||||
try {
|
||||
localStorage.setItem(localStorageKey, queryTextRef.current);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}, [localStorageKey, queryTextRef]);
|
||||
const saveToStorageDebounced = React.useMemo(() => _.debounce(saveToStorage, 5000), [saveToStorage]);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user