mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Simplify DomainAdminStore, PackageAdminStore and PluginAdminStore
This commit is contained in:
parent
bde4d147bb
commit
0345050344
12 changed files with 96 additions and 94 deletions
|
|
@ -1,5 +1,25 @@
|
|||
import ko from 'ko';
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
|
||||
export const PluginAdminStore = ko.observableArray();
|
||||
PluginAdminStore.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
|
||||
PluginAdminStore.loading = ko.observable(false);
|
||||
|
||||
PluginAdminStore.error = ko.observable('');
|
||||
|
||||
PluginAdminStore.fetch = () => {
|
||||
PluginAdminStore.loading(true);
|
||||
Remote.pluginList((result, data) => {
|
||||
PluginAdminStore.loading(false);
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
PluginAdminStore(
|
||||
data.Result.map(item => ({
|
||||
name: item.Name,
|
||||
disabled: ko.observable(!item.Enabled),
|
||||
configured: ko.observable(!!item.Configured)
|
||||
}))
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue