SYNC: chart UX

This commit is contained in:
SPRINX0\prochazka
2025-06-18 10:04:09 +02:00
committed by Diflow
parent 68551ae176
commit 69ed9172b8
2 changed files with 17 additions and 4 deletions

View File

@@ -154,7 +154,14 @@ module.exports = {
logger.info({ sesid, sql }, 'Processing query'); logger.info({ sesid, sql }, 'Processing query');
this.dispatchMessage(sesid, 'Query execution started'); this.dispatchMessage(sesid, 'Query execution started');
session.subprocess.send({ msgtype: 'executeQuery', sql, autoCommit, autoDetectCharts, limitRows, frontMatter }); session.subprocess.send({
msgtype: 'executeQuery',
sql,
autoCommit,
autoDetectCharts: autoDetectCharts || !!frontMatter?.['selected-chart'],
limitRows,
frontMatter,
});
return { state: 'ok' }; return { state: 'ok' };
}, },

View File

@@ -91,6 +91,12 @@
props: { props: {
jslid: info.jslid, jslid: info.jslid,
initialCharts: info.charts, initialCharts: info.charts,
onCloseChart: () => {
charts = charts.filter(x => x.resultIndex !== info.resultIndex);
onSetFrontMatterField?.(`chart-${info.resultIndex + 1}`, undefined);
const value = _.findIndex(allTabs, x => x.isResult && x.resultIndex === info.resultIndex);
domTabs.setValue(value >= 0 ? value : 0);
},
onEditDefinition: definition => { onEditDefinition: definition => {
onSetFrontMatterField?.(`chart-${info.resultIndex + 1}`, definition ?? undefined); onSetFrontMatterField?.(`chart-${info.resultIndex + 1}`, definition ?? undefined);
}, },
@@ -148,14 +154,14 @@
export function openCurrentChart() { export function openCurrentChart() {
const currentIndex = domTabs.getValue(); const currentIndex = domTabs.getValue();
console.log('Current index:', currentIndex); // console.log('Current index:', currentIndex);
const currentTab = allTabs[currentIndex]; const currentTab = allTabs[currentIndex];
console.log('Current tab:', currentTab); // console.log('Current tab:', currentTab);
if (currentTab?.isChart) { if (currentTab?.isChart) {
return; return;
} }
const resultIndex = currentTab?.resultIndex; const resultIndex = currentTab?.resultIndex;
console.log('Result index:', resultIndex); // console.log('Result index:', resultIndex);
if (resultIndex != null) { if (resultIndex != null) {
handleOpenChart(resultIndex); handleOpenChart(resultIndex);
} }