mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Bugfix: conflicting File object with native JS
Cleanup: Stores and tooltips
This commit is contained in:
parent
1df2e00862
commit
db0d03db83
43 changed files with 204 additions and 295 deletions
|
|
@ -2,13 +2,11 @@ import ko from 'ko';
|
|||
|
||||
import {
|
||||
doc,
|
||||
$htmlCL,
|
||||
elementById,
|
||||
leftPanelDisabled,
|
||||
Settings
|
||||
} from 'Common/Globals';
|
||||
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { logoutLink } from 'Common/Links';
|
||||
import { i18nToNodes, initOnStartOrLangChange } from 'Common/Translator';
|
||||
|
||||
|
|
@ -27,17 +25,6 @@ export class AbstractApp {
|
|||
*/
|
||||
constructor(Remote) {
|
||||
this.Remote = Remote;
|
||||
|
||||
const refresh = (()=>dispatchEvent(new CustomEvent('rl.auto-logout-refresh'))).debounce(5000),
|
||||
fn = (ev=>{
|
||||
$htmlCL.toggle('rl-ctrl-key-pressed', ev.ctrlKey);
|
||||
refresh();
|
||||
}).debounce(500);
|
||||
|
||||
// doc.addEventListener('touchstart', fn, {passive:true});
|
||||
['mousedown','keydown','keyup'/*,'mousemove'*/].forEach(t => doc.addEventListener(t, fn));
|
||||
|
||||
shortcuts.add('escape,enter', '', KeyState.All, () => rl.Dropdowns.detectVisibility());
|
||||
}
|
||||
|
||||
remote() {
|
||||
|
|
@ -110,7 +97,7 @@ export class AbstractApp {
|
|||
register('Select', SelectComponent);
|
||||
register('TextArea', TextAreaComponent);
|
||||
register('CheckboxSimple', CheckboxComponent, 'CheckboxComponent');
|
||||
if (/*ThemeStore.isMobile() || */!Settings.app('materialDesign')) {
|
||||
if (!Settings.app('materialDesign')) {
|
||||
register('Checkbox', CheckboxComponent);
|
||||
} else {
|
||||
register('Checkbox', CheckboxMaterialDesignComponent, 'CheckboxMaterialDesignComponent');
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ import ko from 'ko';
|
|||
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
import CapaStore from 'Stores/Admin/Capa';
|
||||
import DomainStore from 'Stores/Admin/Domain';
|
||||
import PluginStore from 'Stores/Admin/Plugin';
|
||||
import PackageStore from 'Stores/Admin/Package';
|
||||
import { AppAdminStore } from 'Stores/Admin/App';
|
||||
import { CapaAdminStore } from 'Stores/Admin/Capa';
|
||||
import { DomainAdminStore } from 'Stores/Admin/Domain';
|
||||
import { PluginAdminStore } from 'Stores/Admin/Plugin';
|
||||
import { PackageAdminStore } from 'Stores/Admin/Package';
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
||||
import { SettingsAdminScreen } from 'Screen/Admin/Settings';
|
||||
|
|
@ -26,11 +26,11 @@ class AdminApp extends AbstractApp {
|
|||
}
|
||||
|
||||
reloadDomainList() {
|
||||
DomainStore.domains.loading(true);
|
||||
DomainAdminStore.loading(true);
|
||||
Remote.domainList((result, data) => {
|
||||
DomainStore.domains.loading(false);
|
||||
DomainAdminStore.loading(false);
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
DomainStore.domains(
|
||||
DomainAdminStore(
|
||||
Object.entries(data.Result).map(([name, [enabled, alias]]) => ({
|
||||
name: name,
|
||||
disabled: ko.observable(!enabled),
|
||||
|
|
@ -43,11 +43,11 @@ class AdminApp extends AbstractApp {
|
|||
}
|
||||
|
||||
reloadPluginList() {
|
||||
PluginStore.plugins.loading(true);
|
||||
PluginAdminStore.loading(true);
|
||||
Remote.pluginList((result, data) => {
|
||||
PluginStore.plugins.loading(false);
|
||||
PluginAdminStore.loading(false);
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
PluginStore.plugins(
|
||||
PluginAdminStore(
|
||||
data.Result.map(item => ({
|
||||
name: item.Name,
|
||||
disabled: ko.observable(!item.Enabled),
|
||||
|
|
@ -59,18 +59,16 @@ class AdminApp extends AbstractApp {
|
|||
}
|
||||
|
||||
reloadPackagesList() {
|
||||
PackageStore.packages.loading(true);
|
||||
PackageStore.packagesReal(true);
|
||||
PackageAdminStore.loading(true);
|
||||
Remote.packagesList((result, data) => {
|
||||
PackageStore.packages.loading(false);
|
||||
PackageAdminStore.loading(false);
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
PackageStore.packagesReal(!!data.Result.Real);
|
||||
PackageStore.packagesMainUpdatable(!!data.Result.MainUpdatable);
|
||||
PackageAdminStore.real(!!data.Result.Real);
|
||||
|
||||
let list = [];
|
||||
const loading = {};
|
||||
|
||||
PackageStore.packages.forEach(item => {
|
||||
PackageAdminStore.forEach(item => {
|
||||
if (item && item.loading()) {
|
||||
loading[item.file] = item;
|
||||
}
|
||||
|
|
@ -86,9 +84,9 @@ class AdminApp extends AbstractApp {
|
|||
}).filter(v => v);
|
||||
}
|
||||
|
||||
PackageStore.packages(list);
|
||||
PackageAdminStore(list);
|
||||
} else {
|
||||
PackageStore.packagesReal(false);
|
||||
PackageAdminStore.real(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -100,8 +98,8 @@ class AdminApp extends AbstractApp {
|
|||
bootstart() {
|
||||
super.bootstart();
|
||||
|
||||
AppStore.populate();
|
||||
CapaStore.populate();
|
||||
AppAdminStore.populate();
|
||||
CapaAdminStore.populate();
|
||||
|
||||
this.hideLoading();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import { isPosNumeric, delegateRunOnDestroy, mailToHelper } from 'Common/UtilsUs
|
|||
import {
|
||||
Capa,
|
||||
StorageResultType,
|
||||
Notification
|
||||
Notification,
|
||||
KeyState
|
||||
} from 'Common/Enums';
|
||||
|
||||
import {
|
||||
|
|
@ -51,7 +52,7 @@ import SettingsStore from 'Stores/User/Settings';
|
|||
import NotificationStore from 'Stores/User/Notification';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
import ContactStore from 'Stores/User/Contact';
|
||||
import IdentityStore from 'Stores/User/Identity';
|
||||
import { IdentityUserStore } from 'Stores/User/Identity';
|
||||
import TemplateStore from 'Stores/User/Template';
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
|
|
@ -124,6 +125,17 @@ class AppUser extends AbstractApp {
|
|||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
const refresh = (()=>dispatchEvent(new CustomEvent('rl.auto-logout-refresh'))).debounce(5000),
|
||||
fn = (ev=>{
|
||||
$htmlCL.toggle('rl-ctrl-key-pressed', ev.ctrlKey);
|
||||
refresh();
|
||||
}).debounce(500);
|
||||
|
||||
// doc.addEventListener('touchstart', fn, {passive:true});
|
||||
['mousedown','keydown','keyup'/*,'mousemove'*/].forEach(t => doc.addEventListener(t, fn));
|
||||
|
||||
shortcuts.add('escape,enter', '', KeyState.All, () => rl.Dropdowns.detectVisibility());
|
||||
}
|
||||
|
||||
remote() {
|
||||
|
|
@ -480,11 +492,11 @@ class AppUser extends AbstractApp {
|
|||
|
||||
accountsAndIdentities() {
|
||||
AccountStore.accounts.loading(true);
|
||||
IdentityStore.identities.loading(true);
|
||||
IdentityUserStore.loading(true);
|
||||
|
||||
Remote.accountsAndIdentities((sResult, oData) => {
|
||||
AccountStore.accounts.loading(false);
|
||||
IdentityStore.identities.loading(false);
|
||||
IdentityUserStore.loading(false);
|
||||
|
||||
if (StorageResultType.Success === sResult && oData.Result) {
|
||||
const counts = {},
|
||||
|
|
@ -506,9 +518,9 @@ class AppUser extends AbstractApp {
|
|||
}
|
||||
|
||||
if (Array.isArray(oData.Result.Identities)) {
|
||||
delegateRunOnDestroy(IdentityStore.identities());
|
||||
delegateRunOnDestroy(IdentityUserStore());
|
||||
|
||||
IdentityStore.identities(
|
||||
IdentityUserStore(
|
||||
oData.Result.Identities.map(identityData => {
|
||||
const id = pString(identityData.Id),
|
||||
email = pString(identityData.Email),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue