From 1abefcec344e40557ad6f9cd246e37ce4c78abc6 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 4 Jul 2025 11:44:12 +0300 Subject: [PATCH] stream refresh title --- client/res/templates/stream.tpl | 5 +++- client/src/views/global-stream.js | 39 ++++++++++++++++++++++--------- client/src/views/stream.js | 12 ++++++++++ 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/client/res/templates/stream.tpl b/client/res/templates/stream.tpl index 76b29a2332..9261df1512 100644 --- a/client/res/templates/stream.tpl +++ b/client/res/templates/stream.tpl @@ -2,7 +2,10 @@
{{#if displayTitle}} -

{{translate 'Stream'}}

+

{{translate 'Stream'}}

{{/if}}
diff --git a/client/src/views/global-stream.js b/client/src/views/global-stream.js index a1608a3dfa..5ec1293f27 100644 --- a/client/src/views/global-stream.js +++ b/client/src/views/global-stream.js @@ -38,7 +38,12 @@ class GlobalStreamView extends View { ` - /** @type {import('collections/note').default} */ collection setup() { this.wait( - this.getCollectionFactory().create('Note') - .then(/** import('collections/note').default */collection => { - this.collection = collection; - this.collection.url = 'GlobalStream'; - this.collection.maxSize = this.getConfig().get('recordsPerPage'); - this.collection.paginationByNumber = true; + (async () => { + this.collection = await this.getCollectionFactory().create('Note'); - this.setupSearchManager(); - this.createSearchView(); - }) + this.collection.url = 'GlobalStream'; + this.collection.maxSize = this.getConfig().get('recordsPerPage'); + this.collection.paginationByNumber = true; + + this.setupSearchManager(); + await this.createSearchView(); + })() ); + + this.addActionHandler('fullRefresh', () => this.actionFullRefresh()); } setupSearchManager() { @@ -113,6 +119,17 @@ class GlobalStreamView extends View { }); }); } + + /** + * @private + */ + async actionFullRefresh() { + Espo.Ui.notifyWait(); + + await this.collection.fetch(); + + Espo.Ui.notify(); + } } export default GlobalStreamView; diff --git a/client/src/views/stream.js b/client/src/views/stream.js index 66bdf41737..482abbe665 100644 --- a/client/src/views/stream.js +++ b/client/src/views/stream.js @@ -70,6 +70,7 @@ class StreamView extends View { this.addActionHandler('createPost', () => this.actionCreatePost()); this.addHandler('keydown.stream', '', /** KeyboardEvent */event => this.onKeyDown(event)); + this.addActionHandler('fullRefresh', () => this.actionFullRefresh()); } afterRender() { @@ -211,6 +212,17 @@ class StreamView extends View { this.actionCreatePost(); } } + + /** + * @private + */ + async actionFullRefresh() { + Espo.Ui.notifyWait(); + + await this.collection.fetch(); + + Espo.Ui.notify(); + } } export default StreamView;