Expose new advanced settings
This commit is contained in:
parent
cb0b04206e
commit
9139b4fa4d
1 changed files with 71 additions and 1 deletions
|
|
@ -322,7 +322,7 @@ export class SyncSettingsTab extends PluginSettingTab {
|
||||||
)
|
)
|
||||||
.addButton((button) =>
|
.addButton((button) =>
|
||||||
button.setButtonText("Reset sync state").onClick(async () => {
|
button.setButtonText("Reset sync state").onClick(async () => {
|
||||||
await this.syncClient.reset();
|
await this.syncClient.applyChangedConnectionSettings();
|
||||||
new Notice(
|
new Notice(
|
||||||
"Sync state has been reset, you will need to resync"
|
"Sync state has been reset, you will need to resync"
|
||||||
);
|
);
|
||||||
|
|
@ -348,6 +348,76 @@ export class SyncSettingsTab extends PluginSettingTab {
|
||||||
this.syncClient.setSetting("enableTelemetry", value)
|
this.syncClient.setSetting("enableTelemetry", value)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
containerEl.createEl("h3", { text: "Advanced" });
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName("Network retry interval (ms)")
|
||||||
|
.setDesc(
|
||||||
|
"The time to wait between retrying failed network requests, in milliseconds."
|
||||||
|
)
|
||||||
|
.addText((input) =>
|
||||||
|
input
|
||||||
|
.setValue(
|
||||||
|
this.syncClient
|
||||||
|
.getSettings()
|
||||||
|
.networkRetryIntervalMs.toString()
|
||||||
|
)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
if (value === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let parsedValue = Number.parseInt(value, 10);
|
||||||
|
if (Number.isNaN(parsedValue) || parsedValue < 0) {
|
||||||
|
parsedValue =
|
||||||
|
this.syncClient.getSettings()
|
||||||
|
.networkRetryIntervalMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== parsedValue.toString()) {
|
||||||
|
input.setValue(parsedValue.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.syncClient.setSetting(
|
||||||
|
"networkRetryIntervalMs",
|
||||||
|
parsedValue
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName("Minimum save interval (ms)")
|
||||||
|
.setDesc(
|
||||||
|
"The minimum time between saving settings and database to disk, in milliseconds. Lower values save more frequently but may impact performance."
|
||||||
|
)
|
||||||
|
.addText((input) =>
|
||||||
|
input
|
||||||
|
.setValue(
|
||||||
|
this.syncClient
|
||||||
|
.getSettings()
|
||||||
|
.minimumSaveIntervalMs.toString()
|
||||||
|
)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
if (value === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let parsedValue = Number.parseInt(value, 10);
|
||||||
|
if (Number.isNaN(parsedValue) || parsedValue < 0) {
|
||||||
|
parsedValue =
|
||||||
|
this.syncClient.getSettings()
|
||||||
|
.minimumSaveIntervalMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value !== parsedValue.toString()) {
|
||||||
|
input.setValue(parsedValue.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.syncClient.setSetting(
|
||||||
|
"minimumSaveIntervalMs",
|
||||||
|
parsedValue
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private setStatusDescriptionSubscription(
|
private setStatusDescriptionSubscription(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue