Remove knockout-transformations dependency

This commit is contained in:
RainLoop Team 2019-07-04 22:58:15 +03:00
parent 8a0be3212d
commit 40dc22a317
10 changed files with 69 additions and 78 deletions

View file

@ -47,14 +47,16 @@ class ContactsAdminSettings {
this.contactsSupported = 0 < supportedTypes.length;
this.contactsTypes = ko.observableArray([]);
this.contactsTypesOptions = this.contactsTypes.map((value) => {
const disabled = -1 === inArray(value, supportedTypes);
return {
'id': value,
'name': getTypeName(value) + (disabled ? ' (' + i18n('HINTS/NOT_SUPPORTED') + ')' : ''),
'disabled': disabled
};
});
this.contactsTypesOptions = ko.computed(() =>
_.map(this.contactsTypes(), (value) => {
const disabled = -1 === inArray(value, supportedTypes);
return {
'id': value,
'name': getTypeName(value) + (disabled ? ' (' + i18n('HINTS/NOT_SUPPORTED') + ')' : ''),
'disabled': disabled
};
})
);
this.contactsTypes(types);
this.contactsType = ko.observable('');

View file

@ -18,9 +18,15 @@ class PackagesAdminSettings {
this.packagesReal = PackageStore.packagesReal;
this.packagesMainUpdatable = PackageStore.packagesMainUpdatable;
this.packagesCurrent = this.packages.filter((item) => item && '' !== item.installed && !item.compare);
this.packagesAvailableForUpdate = this.packages.filter((item) => item && '' !== item.installed && !!item.compare);
this.packagesAvailableForInstallation = this.packages.filter((item) => item && '' === item.installed);
this.packagesCurrent = ko.computed(() =>
_.filter(this.packages(), (item) => item && '' !== item.installed && !item.compare)
);
this.packagesAvailableForUpdate = ko.computed(() =>
_.filter(this.packages(), (item) => item && '' !== item.installed && !!item.compare)
);
this.packagesAvailableForInstallation = ko.computed(() =>
_.filter(this.packages(), (item) => item && '' === item.installed)
);
this.visibility = ko.computed(() => (PackageStore.packages.loading() ? 'visible' : 'hidden'));
}