Cleanup calls to Knockout observableArray

Improved Knockout observableArray
This commit is contained in:
djmaze 2021-01-22 12:23:20 +01:00
parent fa5476e486
commit b6f0b634fb
47 changed files with 251 additions and 276 deletions

View file

@ -67,7 +67,7 @@ class GeneralAdminSettings {
: '';
this.themesOptions = ko.computed(() =>
this.themes().map(theme => ({ optValue: theme, optText: convertThemeName(theme) }))
this.themes.map(theme => ({ optValue: theme, optText: convertThemeName(theme) }))
);
this.languageFullName = ko.computed(() => convertLangName(this.language()));

View file

@ -15,13 +15,13 @@ class PackagesAdminSettings {
this.packagesMainUpdatable = PackageStore.packagesMainUpdatable;
this.packagesCurrent = ko.computed(() =>
this.packages().filter(item => item && item.installed && !item.compare)
this.packages.filter(item => item && item.installed && !item.compare)
);
this.packagesAvailableForUpdate = ko.computed(() =>
this.packages().filter(item => item && item.installed && !!item.compare)
this.packages.filter(item => item && item.installed && !!item.compare)
);
this.packagesAvailableForInstallation = ko.computed(() =>
this.packages().filter(item => item && !item.installed)
this.packages.filter(item => item && !item.installed)
);
this.visibility = ko.computed(() => (PackageStore.packages.loading() ? 'visible' : 'hidden'));
@ -47,7 +47,7 @@ class PackagesAdminSettings {
}
}
this.packages().forEach(item => {
this.packages.forEach(item => {
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file) {
packageToRequest.loading(false);
item.loading(false);