Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 38444fa

Browse files
committed
Merge branch '628-fr-support-dataviewjs-as-source-of-the-database'
2 parents 8d07782 + 2b5a6c0 commit 38444fa

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

src/components/Table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ export function Table(tableData: TableDataType) {
192192
getFacetedRowModel: getFacetedRowModel(),
193193
getFacetedUniqueValues: getFacetedUniqueValues(),
194194
getFacetedMinMaxValues: getFacetedMinMaxValues(),
195-
debugTable: globalConfig.enable_debug_mode,
196-
debugHeaders: globalConfig.enable_debug_mode,
197-
debugColumns: globalConfig.enable_debug_mode,
195+
debugAll:
196+
globalConfig.enable_debug_mode &&
197+
globalConfig.logger_level_info === "trace",
198198
autoResetPageIndex: false,
199199
});
200200

src/components/cellTypes/FormulaCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const FormulaCell = (mdProps: CellComponentProps) => {
3131
.toString();
3232

3333
// If the formula cell is the same as the rendered formula, do nothing
34-
if (cell.getValue() === formulaRef.current.innerHTML) return;
34+
if (cell.getValue() === formulaResponse) return;
3535

3636
await MarkdownService.renderMarkdown(
3737
defaultCell,
@@ -55,7 +55,7 @@ const FormulaCell = (mdProps: CellComponentProps) => {
5555
columnsInfo.getAllColumns(),
5656
configInfo.getLocalSettings(),
5757
false,
58-
tableColumn.config.persist_formula
58+
tableColumn.config.persist_formula ?? false
5959
);
6060
});
6161
}, [

src/components/cellTypes/RollupCell.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@ const RollupCell = (mdProps: CellComponentProps) => {
4646
5
4747
);
4848

49+
if (rollupCell === rollupResponse) return;
4950
// Save formula response on disk
50-
if (tableColumn.config.persist_rollup && rollupCell !== rollupResponse) {
51-
const newCell = ParseService.parseRowToLiteral(
52-
formulaRow,
53-
tableColumn,
54-
rollupResponse
55-
);
51+
const newCell = ParseService.parseRowToLiteral(
52+
formulaRow,
53+
tableColumn,
54+
rollupResponse
55+
);
5656

57-
dataActions.updateCell(
58-
row.index,
59-
tableColumn,
60-
newCell,
61-
columnsInfo.getAllColumns(),
62-
configInfo.getLocalSettings()
63-
);
64-
}
57+
dataActions.updateCell(
58+
row.index,
59+
tableColumn,
60+
newCell,
61+
columnsInfo.getAllColumns(),
62+
configInfo.getLocalSettings(),
63+
tableColumn.config.persist_rollup ?? false
64+
);
6565
}
6666
}, [relation]);
6767
return (

src/services/Logger.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface LogInterface {
2+
trace(...args: unknown[]): void;
23
debug(...args: unknown[]): void;
34
info(...args: unknown[]): void;
45
warn(...args: unknown[]): void;
@@ -8,6 +9,7 @@ export interface LogInterface {
89
}
910

1011
const LevelInfoRecord: Record<string, number> = {
12+
trace: 4,
1113
debug: 3,
1214
info: 2,
1315
warn: 1,
@@ -18,6 +20,7 @@ class Log implements LogInterface {
1820
private static instance: LogInterface;
1921
private isDebugModeEnabled: boolean;
2022
private levelInfo: number;
23+
public trace: (...args: unknown[]) => void;
2124
public debug: (...args: unknown[]) => void;
2225
public info: (...args: unknown[]) => void;
2326
public warn: (...args: unknown[]) => void;
@@ -42,6 +45,14 @@ class Log implements LogInterface {
4245
}
4346

4447
private configureLogger() {
48+
if (this.levelInfo >= LevelInfoRecord.trace && this.isDebugModeEnabled) {
49+
this.trace = console.log.bind(console, `[TRACE]`);
50+
} else {
51+
this.trace = () => {
52+
// Disable trace mode
53+
};
54+
}
55+
4556
if (this.levelInfo >= LevelInfoRecord.debug && this.isDebugModeEnabled) {
4657
this.debug = console.log.bind(console, `[DEBUG]`);
4758
} else {

src/settings/handlers/developer/LoggerLevelInfoDropDownHandler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class LoggerLevelInfoDropDownHandler extends AbstractSettingsHandler {
2323
t('settings_developer_log_level_desc'),
2424
settingsManager.plugin.settings.global_settings.logger_level_info,
2525
{
26+
trace: 'trace',
2627
debug: 'debug',
2728
info: 'info',
2829
warn: 'warn',

src/stateManagement/automations/handlers/RunFormulaHandlerAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default class RunFormulaHandlerAction extends AbstractTableAction<Automat
1818
private evalInput(input: string, row: RowDataType, config: LocalSettings, db: {
1919
[key: string]: unknown;
2020
}): Literal {
21+
LOGGER.debug(`Evaluating formula from row ${row.__note__.filepath}: `, input);
2122
const dynamicJS = 'return `' + input + '`';
2223
const func = new Function('row', 'ddbbConfig', 'db', dynamicJS);
2324
const result = func(row, config, db);

0 commit comments

Comments
 (0)