Merge pull request #12 from h-sphere/fix/global-config-in-advanced-mode

Fix: global config in advanced mode
This commit is contained in:
Kacper Kula 2025-08-14 17:14:45 +02:00 committed by GitHub
commit 7c854f22b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 9 deletions

View file

@ -0,0 +1,5 @@
---
"sqlseal-charts": patch
---
fixed issue with configs not being exposed in ADVANCED MODE

View file

@ -91,7 +91,7 @@ export class ChartRenderer implements RendererConfig {
let parsedConfig: Object = {}
if (isAdvancedMode) {
try {
parsedConfig = parseCodeAdvanced({ functions, variables: allVariables }, config.config)
parsedConfig = parseCodeAdvanced({ functions, variables, configs: globalVariables }, config.config)
} catch (e) {
console.error(e)
throw e

View file

@ -82,7 +82,7 @@ export class SQLSealChartsSettingTab extends PluginSettingTab {
const headerRow = thead.createEl('tr');
headerRow.createEl('th', { text: 'Name' });
headerRow.createEl('th', { text: 'Preview' });
headerRow.createEl('th', { text: 'Actions' });
headerRow.createEl('th', { text: '' });
// Table body
const tbody = table.createEl('tbody');

View file

@ -3,14 +3,16 @@ import { uniqBy } from "lodash"
type Params = {
functions: Record<string, any>,
variables: Record<string, any>
configs: Record<string, any>
}
export const parseCodeAdvanced = ({ functions, variables }: Params, code: string) => {
export const parseCodeAdvanced = ({ functions, variables, configs }: Params, code: string) => {
const { keys, values } = uniqBy([
...Object.entries(functions),
...Object.entries({
data: variables.data,
columns: variables.columns
columns: variables.columns,
...configs
})
], 0).reduce(({ keys, values}, [key, value]) => ({
keys: [...keys, key],

View file

@ -134,11 +134,13 @@
.sqlseal-config-actions {
white-space: nowrap;
display: flex;
justify-content: flex-end;
gap: 8px;
}
.sqlseal-action-button {
padding: 4px 12px;
margin-right: 8px;
border: none;
border-radius: var(--radius-s);
cursor: pointer;
@ -146,10 +148,6 @@
transition: background-color 0.2s ease;
}
.sqlseal-action-button:last-child {
margin-right: 0;
}
.sqlseal-empty-state {
text-align: center;
color: var(--text-muted);