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] : []; initialValues.sourceList = display.baseTable ? [display.baseTable.pureName] : [];
showModal(ImportExportModal, { initialValues }); 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> </script>
<LoadingDataGridCore <LoadingDataGridCore
@ -186,8 +145,6 @@
{dataPageAvailable} {dataPageAvailable}
{loadRowCount} {loadRowCount}
onExportGrid={exportGrid} onExportGrid={exportGrid}
onOpenQuery={openQuery}
onOpenActiveChart={openActiveChart}
bind:loadedRows bind:loadedRows
frameSelection={!!macroPreview} frameSelection={!!macroPreview}
{grider} {grider}

View File

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

View File

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