EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
dashlet auto refresh no notify
Yuri Kuznetsov3f0140c71633
diff --git a/client/modules/crm/src/views/dashlets/activities.js b/client/modules/crm/src/views/dashlets/activities.jsindex 9009ae0956..477029abb8 100644--- a/client/modules/crm/src/views/dashlets/activities.js+++ b/client/modules/crm/src/views/dashlets/activities.js@@ -175,8 +175,23 @@ class ActivitiesDashletView extends BaseDashletView {this.collection.fetch();}- async actionRefresh() {- Espo.Ui.notify(' ... ');+ actionRefresh() {+ this.refreshInternal();+ }++ autoRefresh() {+ this.refreshInternal({skipNotify: true});+ }++ /**+ * @private+ * @param {{skipNotify?: boolean}} [options]+ * @return {Promise<void>}+ */+ async refreshInternal(options = {}) {+ if (!options.skipNotify) {+ Espo.Ui.notify(' ... ');+ }await this.collection.fetch({previousTotal: this.collection.total,@@ -185,7 +200,9 @@ class ActivitiesDashletView extends BaseDashletView {}),});- Espo.Ui.notify();+ if (!options.skipNotify) {+ Espo.Ui.notify();+ }}// noinspection JSUnusedGlobalSymbolsdiff --git a/client/src/views/dashlets/abstract/record-list.js b/client/src/views/dashlets/abstract/record-list.jsindex 137bc58747..bab29c3e57 100644--- a/client/src/views/dashlets/abstract/record-list.js+++ b/client/src/views/dashlets/abstract/record-list.js@@ -176,14 +176,29 @@ class RecordListDashletView extends BaseDashletView {}}- async actionRefresh() {+ actionRefresh() {+ this.refreshInternal();+ }++ autoRefresh() {+ this.refreshInternal({skipNotify: true});+ }++ /**+ * @private+ * @param {{skipNotify?: boolean}} [options]+ * @return {Promise<void>}+ */+ async refreshInternal(options = {}) {if (!this.collection) {return;}- this.collection.where = this.searchManager.getWhere();+ if (!options.skipNotify) {+ Espo.Ui.notify(' ... ');+ }- Espo.Ui.notify(' ... ');+ this.collection.where = this.searchManager.getWhere();await this.collection.fetch({previousDataList: this.collection.models.map(model => {@@ -191,7 +206,9 @@ class RecordListDashletView extends BaseDashletView {}),});- Espo.Ui.notify();+ if (!options.skipNotify) {+ Espo.Ui.notify();+ }}// noinspection JSUnusedGlobalSymbolsdiff --git a/client/src/views/dashlets/stream.js b/client/src/views/dashlets/stream.jsindex 1e3ddc1742..a67a7d64c9 100644--- a/client/src/views/dashlets/stream.js+++ b/client/src/views/dashlets/stream.js@@ -34,16 +34,32 @@ class StreamDashletView extends BaseDashletView {templateContent = '<div class="list-container">{{{list}}}</div>'- async actionRefresh() {+ actionRefresh() {+ this.refreshInternal();+ }++ autoRefresh() {+ this.refreshInternal({skipNotify: true});+ }+ /**+ * @private+ * @param {{skipNotify?: boolean}} [options]+ * @return {Promise<void>}+ */+ async refreshInternal(options = {}) {if (!this.getRecordView()) {return;}- Espo.Ui.notify(' ... ');+ if (!options.skipNotify) {+ Espo.Ui.notify(' ... ');+ }await this.getRecordView().showNewRecords();- Espo.Ui.notify();+ if (!options.skipNotify) {+ Espo.Ui.notify();+ }}afterRender() {