Remove apply settings button
This commit is contained in:
parent
402a37c6a6
commit
5cd8cd8725
1 changed files with 9 additions and 19 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue