mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 15:07:02 +03:00
Replace deprecated Knockout throttle with new debounce extender
Replace admin general mainAttachmentLimit with input type="number"
This commit is contained in:
parent
75b7176ada
commit
8c780ad353
18 changed files with 45 additions and 84 deletions
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
|||
class PackageAdminStore {
|
||||
constructor() {
|
||||
this.packages = ko.observableArray();
|
||||
this.packages.loading = ko.observable(false).extend({ throttle: 100 });
|
||||
this.packages.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
packagesReal: true,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
|||
class PluginAdminStore {
|
||||
constructor() {
|
||||
this.plugins = ko.observableArray();
|
||||
this.plugins.loading = ko.observable(false).extend({ throttle: 100 });
|
||||
this.plugins.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
this.plugins.error = ko.observable('');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class AccountUserStore {
|
|||
});
|
||||
|
||||
this.accounts = ko.observableArray();
|
||||
this.accounts.loading = ko.observable(false).extend({ throttle: 100 });
|
||||
this.accounts.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
|
||||
this.getEmailAddresses = () => this.accounts.map(item => item ? item.email : null).filter(v => v);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ import ko from 'ko';
|
|||
class ContactUserStore {
|
||||
constructor() {
|
||||
this.contacts = ko.observableArray();
|
||||
this.contacts.loading = ko.observable(false).extend({ throttle: 200 });
|
||||
this.contacts.importing = ko.observable(false).extend({ throttle: 200 });
|
||||
this.contacts.syncing = ko.observable(false).extend({ throttle: 200 });
|
||||
this.contacts.exportingVcf = ko.observable(false).extend({ throttle: 200 });
|
||||
this.contacts.exportingCsv = ko.observable(false).extend({ throttle: 200 });
|
||||
this.contacts.loading = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.importing = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.syncing = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.exportingVcf = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.exportingCsv = ko.observable(false).extend({ debounce: 200 });
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
allowContactsSync: false,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import ko from 'ko';
|
|||
class IdentityUserStore {
|
||||
constructor() {
|
||||
this.identities = ko.observableArray();
|
||||
this.identities.loading = ko.observable(false).extend({ throttle: 100 });
|
||||
this.identities.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
|
||||
this.getIDS = () => this.identities.map(item => (item ? item.id() : null)).filter(value => null !== value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class MessageUserStore {
|
|||
constructor() {
|
||||
this.staticMessage = new MessageModel();
|
||||
|
||||
this.messageList = ko.observableArray().extend({ rateLimit: 0 });
|
||||
this.messageList = ko.observableArray().extend({ debounce: 0 });
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
messageListCount: 0,
|
||||
|
|
@ -93,12 +93,12 @@ class MessageUserStore {
|
|||
messageActiveDom: null
|
||||
});
|
||||
|
||||
this.messageListCompleteLoadingThrottle = ko.observable(false).extend({ throttle: 200 });
|
||||
this.messageListCompleteLoadingThrottleForAnimation = ko.observable(false).extend({ specialThrottle: 700 });
|
||||
this.messageListCompleteLoadingThrottle = ko.observable(false).extend({ debounce: 200 });
|
||||
this.messageListCompleteLoadingThrottleForAnimation = ko.observable(false);
|
||||
|
||||
this.messageListDisableAutoSelect = ko.observable(false).extend({ falseTimeout: 500 });
|
||||
|
||||
this.messageLoadingThrottle = ko.observable(false).extend({ throttle: 50 });
|
||||
this.messageLoadingThrottle = ko.observable(false).extend({ debounce: 50 });
|
||||
|
||||
this.messageLoading = ko.computed(() => this.messageCurrentLoading());
|
||||
|
||||
|
|
@ -184,10 +184,22 @@ class MessageUserStore {
|
|||
}
|
||||
|
||||
subscribers() {
|
||||
let timer = 0, fn = this.messageListCompleteLoadingThrottleForAnimation;
|
||||
this.messageListCompleteLoading.subscribe((value) => {
|
||||
value = !!value;
|
||||
this.messageListCompleteLoadingThrottle(value);
|
||||
this.messageListCompleteLoadingThrottleForAnimation(value);
|
||||
|
||||
if (value) {
|
||||
fn(value);
|
||||
} else if (fn()) {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
fn(value);
|
||||
timer = 0;
|
||||
}, 700);
|
||||
} else {
|
||||
fn(value);
|
||||
}
|
||||
});
|
||||
|
||||
this.messageList.subscribe(
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import ko from 'ko';
|
|||
class TemplateUserStore {
|
||||
constructor() {
|
||||
this.templates = ko.observableArray();
|
||||
this.templates.loading = ko.observable(false).extend({ throttle: 100 });
|
||||
this.templates.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
|
||||
this.templatesNames = ko.observableArray().extend({ throttle: 1000 });
|
||||
this.templatesNames = ko.observableArray().extend({ debounce: 1000 });
|
||||
this.templatesNames.skipFirst = true;
|
||||
|
||||
this.subscribers();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue