mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
*.jsx -> *.js
This commit is contained in:
parent
0a2b826f71
commit
e88c193334
98 changed files with 341 additions and 340 deletions
68
dev/Settings/Admin/Domains.js
Normal file
68
dev/Settings/Admin/Domains.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType} from 'Common/Enums';
|
||||
import {showScreenPopup} from 'Knoin/Knoin';
|
||||
|
||||
import DomainStore from 'Stores/Admin/Domain';
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
class DomainsAdminSettings
|
||||
{
|
||||
constructor() {
|
||||
this.domains = DomainStore.domains;
|
||||
|
||||
this.visibility = ko.computed(() => (this.domains.loading() ? 'visible' : 'hidden'));
|
||||
|
||||
this.domainForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.onDomainListChangeRequest = _.bind(this.onDomainListChangeRequest, this);
|
||||
this.onDomainLoadRequest = _.bind(this.onDomainLoadRequest, this);
|
||||
}
|
||||
|
||||
createDomain() {
|
||||
showScreenPopup(require('View/Popup/Domain'));
|
||||
}
|
||||
|
||||
createDomainAlias() {
|
||||
showScreenPopup(require('View/Popup/DomainAlias'));
|
||||
}
|
||||
|
||||
deleteDomain(domain) {
|
||||
this.domains.remove(domain);
|
||||
Remote.domainDelete(this.onDomainListChangeRequest, domain.name);
|
||||
}
|
||||
|
||||
disableDomain(domain) {
|
||||
domain.disabled(!domain.disabled());
|
||||
Remote.domainDisable(this.onDomainListChangeRequest, domain.name, domain.disabled());
|
||||
}
|
||||
|
||||
onBuild(oDom) {
|
||||
const self = this;
|
||||
oDom
|
||||
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() {
|
||||
const domainItem = ko.dataFor(this);
|
||||
if (domainItem)
|
||||
{
|
||||
Remote.domain(self.onDomainLoadRequest, domainItem.name);
|
||||
}
|
||||
});
|
||||
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
}
|
||||
|
||||
onDomainLoadRequest(sResult, oData) {
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
showScreenPopup(require('View/Popup/Domain'), [oData.Result]);
|
||||
}
|
||||
}
|
||||
|
||||
onDomainListChangeRequest() {
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
}
|
||||
}
|
||||
|
||||
export {DomainsAdminSettings, DomainsAdminSettings as default};
|
||||
Loading…
Add table
Add a link
Reference in a new issue