mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-05 06:22:52 +08:00
8be4c384bb
Improved settings screens Views: * sDefaultScope & sCurrentScope to sub-class keyScope * drop viewModelVisible * rename viewModelTemplateID to templateID * rename viewModelPosition to viewType
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import ko from 'ko';
|
|
|
|
import { showScreenPopup } from 'Knoin/Knoin';
|
|
|
|
import { DomainAdminStore } from 'Stores/Admin/Domain';
|
|
import Remote from 'Remote/Admin/Fetch';
|
|
|
|
import { DomainPopupView } from 'View/Popup/Domain';
|
|
import { DomainAliasPopupView } from 'View/Popup/DomainAlias';
|
|
|
|
export class DomainsAdminSettings /*extends AbstractViewSettings*/ {
|
|
constructor() {
|
|
this.domains = DomainAdminStore;
|
|
|
|
this.domainForDeletion = ko.observable(null).deleteAccessHelper();
|
|
}
|
|
|
|
createDomain() {
|
|
showScreenPopup(DomainPopupView);
|
|
}
|
|
|
|
createDomainAlias() {
|
|
showScreenPopup(DomainAliasPopupView);
|
|
}
|
|
|
|
deleteDomain(domain) {
|
|
DomainAdminStore.remove(domain);
|
|
Remote.domainDelete(DomainAdminStore.fetch, domain.name);
|
|
}
|
|
|
|
disableDomain(domain) {
|
|
domain.disabled(!domain.disabled());
|
|
Remote.domainDisable(DomainAdminStore.fetch, domain.name, domain.disabled());
|
|
}
|
|
|
|
onBuild(oDom) {
|
|
oDom.addEventListener('click', event => {
|
|
let el = event.target.closestWithin('.b-admin-domains-list-table .e-action', oDom);
|
|
el && ko.dataFor(el) && Remote.domain(
|
|
(iError, oData) => iError || showScreenPopup(DomainPopupView, [oData.Result]), ko.dataFor(el).name
|
|
);
|
|
});
|
|
|
|
DomainAdminStore.fetch();
|
|
}
|
|
}
|