mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
some ko.computed() to addComputables()/addComputablesTo()
This commit is contained in:
parent
099560ca6a
commit
023c8f603b
9 changed files with 110 additions and 107 deletions
|
|
@ -7,7 +7,8 @@ import {
|
|||
changeTheme,
|
||||
convertThemeName,
|
||||
addObservablesTo,
|
||||
addSubscribablesTo
|
||||
addSubscribablesTo,
|
||||
addComputablesTo
|
||||
} from 'Common/Utils';
|
||||
|
||||
import { Capa, SaveSettingsStep } from 'Common/Enums';
|
||||
|
|
@ -74,12 +75,12 @@ export class GeneralAdminSettings {
|
|||
].join('')
|
||||
: '';
|
||||
|
||||
this.themesOptions = ko.computed(() =>
|
||||
this.themes.map(theme => ({ optValue: theme, optText: convertThemeName(theme) }))
|
||||
);
|
||||
addComputablesTo(this, {
|
||||
themesOptions: () => this.themes.map(theme => ({ optValue: theme, optText: convertThemeName(theme) })),
|
||||
|
||||
this.languageFullName = ko.computed(() => convertLangName(this.language()));
|
||||
this.languageAdminFullName = ko.computed(() => convertLangName(this.languageAdmin()));
|
||||
languageFullName: () => convertLangName(this.language()),
|
||||
languageAdminFullName: () => convertLangName(this.languageAdmin())
|
||||
});
|
||||
|
||||
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import Remote from 'Remote/Admin/Fetch';
|
|||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { PluginPopupView } from 'View/Popup/Plugin';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { addComputablesTo } from 'Common/Utils';
|
||||
|
||||
export class PackagesAdminSettings {
|
||||
constructor() {
|
||||
|
|
@ -16,17 +17,13 @@ export class PackagesAdminSettings {
|
|||
|
||||
this.packages = PackageAdminStore;
|
||||
|
||||
this.packagesCurrent = ko.computed(() =>
|
||||
PackageAdminStore.filter(item => item && item.installed && !item.canBeUpdated)
|
||||
);
|
||||
this.packagesAvailableForUpdate = ko.computed(() =>
|
||||
PackageAdminStore.filter(item => item && item.installed && !!item.canBeUpdated)
|
||||
);
|
||||
this.packagesAvailableForInstallation = ko.computed(() =>
|
||||
PackageAdminStore.filter(item => item && !item.installed)
|
||||
);
|
||||
addComputablesTo(this, {
|
||||
packagesCurrent: () => PackageAdminStore.filter(item => item && item.installed && !item.canBeUpdated),
|
||||
packagesAvailableForUpdate: () => PackageAdminStore.filter(item => item && item.installed && !!item.canBeUpdated),
|
||||
packagesAvailableForInstallation: () => PackageAdminStore.filter(item => item && !item.installed),
|
||||
|
||||
this.visibility = ko.computed(() => (PackageAdminStore.loading() ? 'visible' : 'hidden'));
|
||||
visibility: () => (PackageAdminStore.loading() ? 'visible' : 'hidden')
|
||||
});
|
||||
|
||||
this.enabledPlugins = ko.observable(!!SettingsGet('EnabledPlugins'));
|
||||
this.enabledPlugins.subscribe(value =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue