SYNC: auto-detect charts is disabled by default #1145

This commit is contained in:
SPRINX0\prochazka
2025-06-18 09:29:44 +02:00
committed by Diflow
parent a10fe6994a
commit 9bff8608c1
6 changed files with 72 additions and 15 deletions

View File

@@ -233,6 +233,8 @@
'icon upload': 'mdi mdi-upload',
'icon limit': 'mdi mdi-car-speed-limiter',
'icon chart': 'mdi mdi-chart-bar',
'img ok': 'mdi mdi-check-circle color-icon-green',
'img ok-inv': 'mdi mdi-check-circle color-icon-inv-green',
'img alert': 'mdi mdi-alert-circle color-icon-blue',

View File

@@ -80,6 +80,7 @@
label: `Result ${index + 1}`,
isResult: true,
component: JslDataGrid,
resultIndex: info.resultIndex,
props: { jslid: info.jslid, driver, onOpenChart: () => handleOpenChart(info.resultIndex) },
}))),
...charts.map((info, index) => ({
@@ -144,6 +145,21 @@
}
onSetFrontMatterField?.('selected-chart', resultIndex + 1);
}
export function openCurrentChart() {
const currentIndex = domTabs.getValue();
console.log('Current index:', currentIndex);
const currentTab = allTabs[currentIndex];
console.log('Current tab:', currentTab);
if (currentTab?.isChart) {
return;
}
const resultIndex = currentTab?.resultIndex;
console.log('Result index:', resultIndex);
if (resultIndex != null) {
handleOpenChart(resultIndex);
}
}
</script>
<TabControl

View File

@@ -156,6 +156,7 @@
import { getIntSettingsValue } from '../settings/settingsTools';
import RowsLimitModal from '../modals/RowsLimitModal.svelte';
import _ from 'lodash';
import FontIcon from '../icons/FontIcon.svelte';
export let tabid;
export let conid;
@@ -209,6 +210,8 @@
let isInTransaction = false;
let isAutocommit = false;
let splitterInitialValue = undefined;
let autoDetectCharts = false;
let domResultTabs;
const queryRowsLimitLocalStorageKey = `tabdata_limitRows_${tabid}`;
function getInitialRowsLimit() {
@@ -393,6 +396,7 @@
autoCommit: driver?.implicitTransactions && isAutocommit,
limitRows: queryRowsLimit ? queryRowsLimit : undefined,
frontMatter,
autoDetectCharts,
});
}
await apiCall('query-history/write', {
@@ -727,6 +731,7 @@
</svelte:fragment>
<svelte:fragment slot="2">
<ResultTabs
bind:this={domResultTabs}
tabs={[{ label: 'Messages', slot: 0 }]}
{sessionId}
{executeNumber}
@@ -846,6 +851,30 @@
data-testid="QueryTab_rollbackTransactionButton"
hideDisabled
/>
{#if isProApp() && visibleResultTabs && !busy}
<ToolStripButton
icon="icon chart"
on:click={() => {
domResultTabs?.openCurrentChart();
}}
>
Open chart</ToolStripButton
>
{/if}
{#if isProApp() && !visibleResultTabs}
<ToolStripButton
icon="icon chart"
on:click={() => {
autoDetectCharts = !autoDetectCharts;
}}
>
Detect chart<FontIcon
icon={autoDetectCharts ? 'icon checkbox-marked' : 'icon checkbox-blank'}
padLeft
/></ToolStripButton
>
{/if}
</svelte:fragment>
</ToolStripContainer>