Remove apply settings button

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

View file

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