Remove apply settings button

This commit is contained in:
Andras Schmelczer 2025-11-18 22:12:16 +00:00
parent 402a37c6a6
commit 5cd8cd8725

View file

@ -194,38 +194,28 @@ export class SyncSettingsTab extends PluginSettingTab {
})
);
new Setting(containerEl)
.addButton((button) =>
button.setButtonText("Apply").onClick(async () => {
new Setting(containerEl).addButton((button) =>
button
.setButtonText("Apply & test connection")
.onClick(async () => {
if (this.areThereUnsavedChanges()) {
await this.syncClient.setSettings({
vaultName: this.editedVaultName,
remoteUri: this.editedServerUri,
token: this.editedToken
});
new Notice("Checking connection to the server...");
new Notice(
"The changes have been applied successfully!"
(
await this.syncClient.checkConnection()
).serverMessage
);
await this.statusDescription.updateConnectionState();
} else {
new Notice("No changes to apply");
}
})
)
.addButton((button) =>
button.setButtonText("Test connection").onClick(async () => {
if (this.areThereUnsavedChanges()) {
new Notice(
"There are unsaved changes, testing with the currently saved settings"
);
}
new Notice(
(await this.syncClient.checkConnection()).serverMessage
);
await this.statusDescription.updateConnectionState();
})
);
);
}
private areThereUnsavedChanges(): boolean {