mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
query data refresh
This commit is contained in:
parent
5df0204450
commit
f10f863940
@ -9,7 +9,7 @@
|
|||||||
toolbar: true,
|
toolbar: true,
|
||||||
isRelatedToTab: true,
|
isRelatedToTab: true,
|
||||||
icon: 'icon reload',
|
icon: 'icon reload',
|
||||||
testEnabled: () => getCurrentDataGrid()?.getDisplay()?.supportsReload,
|
testEnabled: () => getCurrentDataGrid()?.canRefresh(),
|
||||||
onClick: () => getCurrentDataGrid().refresh(),
|
onClick: () => getCurrentDataGrid().refresh(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -334,6 +334,7 @@
|
|||||||
export let collapsedLeftColumnStore;
|
export let collapsedLeftColumnStore;
|
||||||
export let multipleGridsOnTab = false;
|
export let multipleGridsOnTab = false;
|
||||||
export let tabControlHiddenTab = false;
|
export let tabControlHiddenTab = false;
|
||||||
|
export let onCustomGridRefresh;
|
||||||
// export let generalAllowSave = false;
|
// export let generalAllowSave = false;
|
||||||
|
|
||||||
export const activator = createActivator('DataGridCore', false);
|
export const activator = createActivator('DataGridCore', false);
|
||||||
@ -362,7 +363,13 @@
|
|||||||
const tabid = getContext('tabid');
|
const tabid = getContext('tabid');
|
||||||
|
|
||||||
export function refresh() {
|
export function refresh() {
|
||||||
display.reload();
|
if (onCustomGridRefresh) onCustomGridRefresh();
|
||||||
|
else display.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function canRefresh() {
|
||||||
|
if (onCustomGridRefresh) return true;
|
||||||
|
return getDisplay()?.supportsReload;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getGrider() {
|
export function getGrider() {
|
||||||
|
@ -21,10 +21,21 @@
|
|||||||
let jslid;
|
let jslid;
|
||||||
|
|
||||||
async function loadData(conid, database, sql) {
|
async function loadData(conid, database, sql) {
|
||||||
const resp = await apiCall('sessions/execute-reader', { conid, database, sql, appFolder: schemaName, queryName: pureName });
|
const resp = await apiCall('sessions/execute-reader', {
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
sql,
|
||||||
|
appFolder: schemaName,
|
||||||
|
queryName: pureName,
|
||||||
|
});
|
||||||
jslid = resp.jslid;
|
jslid = resp.jslid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleRefresh() {
|
||||||
|
jslid = null;
|
||||||
|
loadData(conid, database, sql)
|
||||||
|
}
|
||||||
|
|
||||||
const quickExportHandlerRef = createQuickExportHandlerRef();
|
const quickExportHandlerRef = createQuickExportHandlerRef();
|
||||||
|
|
||||||
$: loadData(conid, database, sql);
|
$: loadData(conid, database, sql);
|
||||||
@ -32,7 +43,7 @@
|
|||||||
|
|
||||||
<ToolStripContainer>
|
<ToolStripContainer>
|
||||||
{#if jslid}
|
{#if jslid}
|
||||||
<JslDataGrid {jslid} listenInitializeFile />
|
<JslDataGrid {jslid} listenInitializeFile onCustomGridRefresh={handleRefresh} focusOnVisible />
|
||||||
{:else}
|
{:else}
|
||||||
<LoadingInfo message="Loading data..." />
|
<LoadingInfo message="Loading data..." />
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user