Cleanup admin code

This commit is contained in:
djmaze 2021-04-22 21:56:01 +02:00
parent 75c879836c
commit 3572d00a10
16 changed files with 178 additions and 244 deletions

View file

@ -105,8 +105,6 @@ export class ContactsAdminSettings {
})
})
this.onTestContactsResponse = this.onTestContactsResponse.bind(this);
decorateKoCommands(this, {
testContactsCommand: self => self.pdoDsn() && self.pdoUser()
});
@ -118,7 +116,24 @@ export class ContactsAdminSettings {
this.testContactsErrorMessage('');
this.testing(true);
Remote.testContacts(this.onTestContactsResponse, {
Remote.testContacts((iError, data) => {
this.testContactsSuccess(false);
this.testContactsError(false);
this.testContactsErrorMessage('');
if (!iError && data.Result.Result) {
this.testContactsSuccess(true);
} else {
this.testContactsError(true);
if (data && data.Result) {
this.testContactsErrorMessage(data.Result.Message || '');
} else {
this.testContactsErrorMessage('');
}
}
this.testing(false);
}, {
ContactsPdoType: this.contactsType(),
ContactsPdoDsn: this.pdoDsn(),
ContactsPdoUser: this.pdoUser(),
@ -126,25 +141,6 @@ export class ContactsAdminSettings {
});
}
onTestContactsResponse(iError, data) {
this.testContactsSuccess(false);
this.testContactsError(false);
this.testContactsErrorMessage('');
if (!iError && data.Result.Result) {
this.testContactsSuccess(true);
} else {
this.testContactsError(true);
if (data && data.Result) {
this.testContactsErrorMessage(data.Result.Message || '');
} else {
this.testContactsErrorMessage('');
}
}
this.testing(false);
}
onShow() {
this.testContactsSuccess(false);
this.testContactsError(false);