2016-07-16 05:29:42 +08:00
|
|
|
import ko from 'ko';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { showScreenPopup } from 'Knoin/Knoin';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2021-02-17 21:40:21 +08:00
|
|
|
import { DomainAdminStore } from 'Stores/Admin/Domain';
|
2020-09-15 01:40:56 +08:00
|
|
|
import Remote from 'Remote/Admin/Fetch';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2021-01-26 05:00:13 +08:00
|
|
|
import { DomainPopupView } from 'View/Popup/Domain';
|
|
|
|
import { DomainAliasPopupView } from 'View/Popup/DomainAlias';
|
|
|
|
|
2021-09-23 02:17:44 +08:00
|
|
|
export class DomainsAdminSettings /*extends AbstractViewSettings*/ {
|
2016-07-16 05:29:42 +08:00
|
|
|
constructor() {
|
2021-02-17 21:40:21 +08:00
|
|
|
this.domains = DomainAdminStore;
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-07-16 05:29:42 +08:00
|
|
|
this.domainForDeletion = ko.observable(null).deleteAccessHelper();
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-07-16 05:29:42 +08:00
|
|
|
createDomain() {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(DomainPopupView);
|
2016-07-16 05:29:42 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-07-16 05:29:42 +08:00
|
|
|
createDomainAlias() {
|
2021-01-26 05:00:13 +08:00
|
|
|
showScreenPopup(DomainAliasPopupView);
|
2016-07-16 05:29:42 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-07-16 05:29:42 +08:00
|
|
|
deleteDomain(domain) {
|
2021-02-17 21:40:21 +08:00
|
|
|
DomainAdminStore.remove(domain);
|
2021-04-23 03:56:01 +08:00
|
|
|
Remote.domainDelete(DomainAdminStore.fetch, domain.name);
|
2021-12-03 07:11:19 +08:00
|
|
|
Remote.request('AdminDomainDelete', DomainAdminStore.fetch, {
|
|
|
|
Name: domain.name
|
|
|
|
});
|
2016-07-16 05:29:42 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-07-16 05:29:42 +08:00
|
|
|
disableDomain(domain) {
|
|
|
|
domain.disabled(!domain.disabled());
|
2021-12-03 07:11:19 +08:00
|
|
|
Remote.request('AdminDomainDisable', DomainAdminStore.fetch, {
|
|
|
|
Name: domain.name,
|
|
|
|
Disabled: domain.disabled() ? 1 : 0
|
|
|
|
});
|
2016-07-16 05:29:42 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-07-16 05:29:42 +08:00
|
|
|
onBuild(oDom) {
|
2020-08-30 16:30:50 +08:00
|
|
|
oDom.addEventListener('click', event => {
|
2021-04-23 03:56:01 +08:00
|
|
|
let el = event.target.closestWithin('.b-admin-domains-list-table .e-action', oDom);
|
2021-12-03 07:11:19 +08:00
|
|
|
el && ko.dataFor(el) && Remote.request('AdminDomainLoad',
|
|
|
|
(iError, oData) => iError || showScreenPopup(DomainPopupView, [oData.Result]),
|
|
|
|
{
|
|
|
|
Name: ko.dataFor(el).name
|
|
|
|
}
|
2021-04-23 03:56:01 +08:00
|
|
|
);
|
2021-12-03 07:11:19 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
});
|
2016-07-16 05:29:42 +08:00
|
|
|
|
2021-03-15 05:36:23 +08:00
|
|
|
DomainAdminStore.fetch();
|
2014-08-21 23:08:34 +08:00
|
|
|
}
|
2016-07-16 05:29:42 +08:00
|
|
|
}
|