open query command moved

This commit is contained in:
Jan Prochazka 2021-04-08 08:09:54 +02:00
parent c48b058b9d
commit 00aaaad855
3 changed files with 15 additions and 65 deletions

View File

@ -137,47 +137,6 @@
initialValues.sourceList = display.baseTable ? [display.baseTable.pureName] : [];
showModal(ImportExportModal, { initialValues });
}
function openQuery() {
openNewTab(
{
title: 'Query #',
icon: 'img sql-file',
tabComponent: 'QueryTab',
props: {
schemaName: display.baseTable.schemaName,
pureName: display.baseTable.pureName,
conid,
database,
},
},
{
editor: display.getExportQuery(),
}
);
}
function openActiveChart() {
openNewTab(
{
title: 'Chart #',
icon: 'img chart',
tabComponent: 'ChartTab',
props: {
conid,
database,
},
},
{
editor: {
config: { chartType: 'bar' },
sql: display.getExportQuery(select => {
select.orderBy = null;
}),
},
}
);
}
</script>
<LoadingDataGridCore
@ -186,8 +145,6 @@
{dataPageAvailable}
{loadRowCount}
onExportGrid={exportGrid}
onOpenQuery={openQuery}
onOpenActiveChart={openActiveChart}
bind:loadedRows
frameSelection={!!macroPreview}
{grider}

View File

@ -149,14 +149,6 @@
onClick: () => getCurrentDataGrid().clearFilter(),
});
registerCommand({
id: 'dataGrid.openQuery',
category: 'Data grid',
name: 'Open query',
testEnabled: () => getCurrentDataGrid()?.openQueryEnabled(),
onClick: () => getCurrentDataGrid().openQuery(),
});
registerCommand({
id: 'dataGrid.openFreeTable',
category: 'Data grid',
@ -251,7 +243,6 @@
// export let onSelectedCellsPublishedChanged = undefined;
export let focusOnVisible = false;
export let onExportGrid = null;
export let onOpenQuery = null;
export let formViewAvailable = false;
export let jsonViewAvailable = false;
export let errorMessage = undefined;
@ -428,14 +419,6 @@
return display.filterCount > 0;
}
export function openQuery() {
if (onOpenQuery) onOpenQuery();
}
export function openQueryEnabled() {
return onOpenQuery != null;
}
export function openFreeTable() {
openNewTab(
{
@ -1010,7 +993,7 @@
{ command: 'dataGrid.undo' },
{ command: 'dataGrid.redo' },
{ divider: true },
{ command: 'dataGrid.openQuery' },
{ placeTag: 'export' },
{ command: 'dataGrid.openFreeTable' },
{ command: 'dataGrid.openChartFromSelection' },
{ placeTag: 'chart' }

View File

@ -2,13 +2,21 @@
const getCurrentEditor = () => getActiveComponent('SqlDataGridCore');
registerCommand({
id: 'dataGrid.openActiveChart',
id: 'sqlDataGrid.openActiveChart',
category: 'Data grid',
name: 'Open active chart',
testEnabled: () => getCurrentEditor() != null,
onClick: () => getCurrentEditor().openActiveChart(),
});
registerCommand({
id: 'sqlDataGrid.openQuery',
category: 'Data grid',
name: 'Open query',
testEnabled: () => getCurrentEditor() != null,
onClick: () => getCurrentEditor().openQuery(),
});
async function loadDataPage(props, offset, limit) {
const { display, conid, database } = props;
@ -112,7 +120,7 @@
showModal(ImportExportModal, { initialValues });
}
function openQuery() {
export function openQuery() {
openNewTab(
{
title: 'Query #',
@ -153,7 +161,10 @@
);
}
registerMenu({ command: 'dataGrid.openActiveChart', tag: 'chart' });
registerMenu(
{ command: 'sqlDataGrid.openActiveChart', tag: 'chart' },
{ command: 'sqlDataGrid.openQuery', tag: 'export' }
);
</script>
<LoadingDataGridCore
@ -162,7 +173,6 @@
{dataPageAvailable}
{loadRowCount}
onExportGrid={exportGrid}
onOpenQuery={openQuery}
bind:loadedRows
bind:selectedCellsPublished
frameSelection={!!macroPreview}