Bugfix: conflicting File object with native JS

Cleanup: Stores and tooltips
This commit is contained in:
djmaze 2021-02-17 14:40:21 +01:00
parent 1df2e00862
commit db0d03db83
43 changed files with 204 additions and 295 deletions

View file

@ -1,20 +1,14 @@
import ko from 'ko';
class AppAdminStore {
constructor() {
this.weakPassword = ko.observable(false);
export const AppAdminStore = {
weakPassword: ko.observable(false),
dataFolderAccess: ko.observable(false),
this.dataFolderAccess = ko.observable(false);
}
populate() {
populate: function() {
this.weakPassword(!!rl.settings.get('WeakPassword'));
/*
if (settingsGet('Auth')) {
fetch('./data/VERSION?' + Math.random()).then(() => this.dataFolderAccess(true));
}
rl.settings.get('WeakPassword')
&& fetch('./data/VERSION?' + Math.random()).then(() => this.dataFolderAccess(true));
*/
}
}
export default new AppAdminStore();
};

View file

@ -1,24 +1,8 @@
import ko from 'ko';
import { Capa } from 'Common/Enums';
class CapaAdminStore {
constructor() {
ko.addObservablesTo(this, {
additionalAccounts: false,
identities: false,
attachmentThumbnails: false,
sieve: false,
filters: false,
themes: true,
userBackground: false,
openPGP: false,
twoFactorAuth: false,
twoFactorAuthForce: false,
templates: false
});
}
populate() {
export const CapaAdminStore = {
populate: function() {
let capa = rl.settings.capa;
this.additionalAccounts(capa(Capa.AdditionalAccounts));
this.identities(capa(Capa.Identities));
@ -32,6 +16,18 @@ class CapaAdminStore {
this.twoFactorAuthForce(capa(Capa.TwoFactorForce));
this.templates(capa(Capa.Templates));
}
}
};
export default new CapaAdminStore();
ko.addObservablesTo(CapaAdminStore, {
additionalAccounts: false,
identities: false,
attachmentThumbnails: false,
sieve: false,
filters: false,
themes: true,
userBackground: false,
openPGP: false,
twoFactorAuth: false,
twoFactorAuthForce: false,
templates: false
});

View file

@ -1,11 +1,5 @@
import ko from 'ko';
class DomainAdminStore {
constructor() {
this.domains = ko.observableArray();
this.domains.loading = ko.observable(false).extend({ 'throttle': 100 });
this.domainsWithoutAliases = ko.computed(() => this.domains.filter(item => item && !item.alias));
}
}
export const DomainAdminStore = ko.observableArray();
export default new DomainAdminStore();
DomainAdminStore.loading = ko.observable(false).extend({ 'throttle': 100 });

View file

@ -1,15 +1,7 @@
import ko from 'ko';
class PackageAdminStore {
constructor() {
this.packages = ko.observableArray();
this.packages.loading = ko.observable(false).extend({ debounce: 100 });
export const PackageAdminStore = ko.observableArray();
ko.addObservablesTo(this, {
packagesReal: true,
packagesMainUpdatable: true
});
}
}
PackageAdminStore.real = ko.observable(true);
export default new PackageAdminStore();
PackageAdminStore.loading = ko.observable(false).extend({ debounce: 100 });

View file

@ -1,11 +1,5 @@
import ko from 'ko';
class PluginAdminStore {
constructor() {
this.plugins = ko.observableArray();
this.plugins.loading = ko.observable(false).extend({ debounce: 100 });
this.plugins.error = ko.observable('');
}
}
export default new PluginAdminStore();
export const PluginAdminStore = ko.observableArray();
PluginAdminStore.loading = ko.observable(false).extend({ debounce: 100 });
PluginAdminStore.error = ko.observable('');

View file

@ -14,4 +14,4 @@ export const LanguageStore = {
}
LanguageStore.language = ko.observable('')
.extend({ limitedList: LanguageStore.languages, reversible: true });
.extend({ limitedList: LanguageStore.languages });

View file

@ -3,8 +3,9 @@ import { $htmlCL } from 'Common/Globals';
export const ThemeStore = {
themes: ko.observableArray(),
themeBackgroundName: ko.observable(''),
themeBackgroundHash: ko.observable(''),
userBackgroundName: ko.observable(''),
userBackgroundHash: ko.observable(''),
isMobile: ko.observable($htmlCL.contains('rl-mobile')),
populate: function(){
const Settings = rl.settings,
@ -13,13 +14,12 @@ export const ThemeStore = {
this.themes(Array.isArray(themes) ? themes : []);
this.theme(Settings.get('Theme'));
if (!this.isMobile()) {
this.themeBackgroundName(Settings.get('UserBackgroundName'));
this.themeBackgroundHash(Settings.get('UserBackgroundHash'));
this.userBackgroundName(Settings.get('UserBackgroundName'));
this.userBackgroundHash(Settings.get('UserBackgroundHash'));
}
}
};
ThemeStore.theme = ko.observable('').extend({ limitedList: ThemeStore.themes });
ThemeStore.isMobile = ko.observable($htmlCL.contains('rl-mobile'));
ThemeStore.isMobile.subscribe(value => $htmlCL.toggle('rl-mobile', value));

View file

@ -30,13 +30,6 @@ class AccountUserStore {
this.email(rl.settings.get('Email'));
this.parentEmail(rl.settings.get('ParentEmail'));
}
/**
* @returns {boolean}
*/
isRootAccount() {
return !this.parentEmail();
}
}
export default new AccountUserStore();

View file

@ -1,12 +1,7 @@
import ko from 'ko';
class IdentityUserStore {
constructor() {
this.identities = ko.observableArray();
this.identities.loading = ko.observable(false).extend({ debounce: 100 });
export const IdentityUserStore = ko.observableArray();
this.getIDS = () => this.identities.map(item => (item ? item.id() : null)).filter(value => null !== value);
}
}
export default new IdentityUserStore();
IdentityUserStore.getIDS = () => IdentityUserStore.map(item => (item ? item.id() : null))
.filter(value => null !== value);
IdentityUserStore.loading = ko.observable(false).extend({ debounce: 100 });

View file

@ -1,12 +1,8 @@
import ko from 'ko';
class SieveUserStore {
constructor() {
// capabilities
this.capa = ko.observableArray();
// Sieve scripts SieveScriptModel
this.scripts = ko.observableArray();
}
export const SieveUserStore = {
// capabilities
capa: ko.observableArray(),
// Sieve scripts SieveScriptModel
scripts: ko.observableArray()
}
export default new SieveUserStore();