2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
2021-03-15 05:36:23 +08:00
|
|
|
import Remote from 'Remote/Admin/Fetch';
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2021-02-17 21:40:21 +08:00
|
|
|
export const PluginAdminStore = ko.observableArray();
|
2021-03-15 05:36:23 +08:00
|
|
|
|
|
|
|
PluginAdminStore.loading = ko.observable(false);
|
|
|
|
|
2021-02-17 21:40:21 +08:00
|
|
|
PluginAdminStore.error = ko.observable('');
|
2021-03-15 05:36:23 +08:00
|
|
|
|
|
|
|
PluginAdminStore.fetch = () => {
|
|
|
|
PluginAdminStore.loading(true);
|
2021-03-16 16:46:23 +08:00
|
|
|
Remote.pluginList((iError, data) => {
|
2021-03-15 05:36:23 +08:00
|
|
|
PluginAdminStore.loading(false);
|
2021-03-18 21:48:21 +08:00
|
|
|
if (!iError) {
|
2021-03-15 05:36:23 +08:00
|
|
|
PluginAdminStore(
|
|
|
|
data.Result.map(item => ({
|
|
|
|
name: item.Name,
|
|
|
|
disabled: ko.observable(!item.Enabled),
|
|
|
|
configured: ko.observable(!!item.Configured)
|
|
|
|
}))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|