stream refresh title

This commit is contained in:
Yuri Kuznetsov
2025-07-04 11:44:12 +03:00
parent 78ea0d7512
commit 1abefcec34
3 changed files with 44 additions and 12 deletions
+4 -1
View File
@@ -2,7 +2,10 @@
<div class="row">
<div class="col-sm-7 col-xs-5">
{{#if displayTitle}}
<h3>{{translate 'Stream'}}</h3>
<h3><span
data-action="fullRefresh"
style="user-select: none; cursor: pointer"
>{{translate 'Stream'}}</span></h3>
{{/if}}
</div>
<div class="col-sm-5 col-xs-7">
+28 -11
View File
@@ -38,7 +38,12 @@ class GlobalStreamView extends View {
<div class="page-header">
<div class="row">
<div class="col-sm-7 col-xs-5">
<h3>{{translate 'GlobalStream' category='scopeNames'}}</h3>
<h3>
<span
data-action="fullRefresh"
style="user-select: none; cursor: pointer"
>{{translate 'GlobalStream' category='scopeNames'}}</span>
</h3>
</div>
<div class="col-sm-5 col-xs-7"></div>
</div>
@@ -51,22 +56,23 @@ class GlobalStreamView extends View {
</div>
`
/** @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;
+12
View File
@@ -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;