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

Commit e42cbd8

Browse files
committed
fix UI settings global
1 parent 04083f3 commit e42cbd8

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/settings/AutomationSection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { FormulaJSFolderHandler } from 'settings/handlers/automation/FormulaJSFo
66

77
class AutomationSetttingsSection extends AbstractChain<SettingHandlerResponse> {
88
protected customHandle(settingHandlerResponse: SettingHandlerResponse): SettingHandlerResponse {
9-
const columns_section = settingHandlerResponse.containerEl.createDiv("configuration-section-container-automations");
9+
const automation_section = settingHandlerResponse.containerEl.createDiv("configuration-section-container-automations");
1010
// title of the section
11-
add_setting_header(columns_section, "Automations related the table", 'h3');
12-
settingHandlerResponse.containerEl = columns_section;
11+
add_setting_header(automation_section, "Automations related the table", 'h3');
12+
settingHandlerResponse.containerEl = automation_section;
1313
return settingHandlerResponse;
1414
}
1515
protected getHandlers(): AbstractHandler<SettingHandlerResponse>[] {

src/settings/handlers/automation/FormulaJSFolderHandler.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@ import { AbstractSettingsHandler, SettingHandlerResponse } from "settings/handle
33
import { FolderSuggest } from "settings/suggesters/FolderSuggester";
44

55
export class FormulaJSFolderHandler extends AbstractSettingsHandler {
6-
settingTitle: string = 'Select the source of database data';
6+
settingTitle: string = 'Select the source of your formula JS files';
77
handle(settingHandlerResponse: SettingHandlerResponse): SettingHandlerResponse {
8-
const { containerEl, view } = settingHandlerResponse;
8+
const { settingsManager, containerEl, view, local } = settingHandlerResponse;
99
const formula_folder_promise = async (value: string): Promise<void> => {
10-
// update settings
11-
view.diskConfig.updateConfig({ formula_folder_path: value });
10+
if (local) {
11+
// update settings
12+
view.diskConfig.updateConfig({ formula_folder_path: value });
13+
} else {
14+
// switch show created on/off
15+
const update_local_settings = settingsManager.plugin.settings.local_settings;
16+
update_local_settings.formula_folder_path = value;
17+
// update settings
18+
await settingsManager.plugin.updateSettings({
19+
local_settings: update_local_settings
20+
});
21+
}
22+
1223
};
24+
console.log('FormulaJSFolderHandler bejore');
1325
// render dropdown inside container
1426
new Setting(containerEl)
1527
.setName('Select the formula JS folder')
@@ -19,9 +31,11 @@ export class FormulaJSFolderHandler extends AbstractSettingsHandler {
1931
cb.inputEl
2032
);
2133
cb.setPlaceholder("Example: path/to/folder")
22-
.setValue(view.diskConfig.yaml.config.formula_folder_path)
34+
.setValue(local ? view.diskConfig.yaml.config.formula_folder_path : settingsManager.plugin.settings.local_settings.formula_folder_path)
2335
.onChange(formula_folder_promise);
2436
});
37+
38+
console.log('FormulaJSFolderHandler after');
2539
return this.goNext(settingHandlerResponse);
2640
}
2741
}

0 commit comments

Comments
 (0)