0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Added refresh button logic

This commit is contained in:
Sodbileg Gansukh 2024-08-07 12:55:16 +08:00
parent 7b59a91c82
commit 8542d8bfcf
2 changed files with 14 additions and 3 deletions

View file

@ -35,7 +35,7 @@
{{/let}}
</div>
<div style="display: flex; gap: 4px;">
<button class="gh-post-list-cta edit">
<button class="gh-post-list-cta edit" {{on "click" this.fetchPostTask.perform}}>
{{svg-jar "reload" title="Refresh post analytics"}}<span>Refresh</span>
</button>
<button class="gh-post-list-cta edit" {{on "click" this.togglePublishFlowModal}}>
@ -85,7 +85,7 @@
<button
type="button"
class="mr2"
{{on "click" this.deletePosts}}
{{!-- {{on "click" this.deletePosts}} --}}
data-test-button="delete-post"
>
<span class="red">Delete post</span>

View file

@ -32,6 +32,7 @@ export default class Analytics extends Component {
@tracked sortColumn = 'signups';
@tracked showSuccess;
@tracked updateLinkId;
@tracked _post = null;
@tracked showPublishFlowModal = false;
@tracked postCount = null;
displayOptions = DISPLAY_OPTIONS;
@ -50,7 +51,11 @@ export default class Analytics extends Component {
}
get post() {
return this.args.post;
return this._post ?? this.args.post;
}
set post(value) {
this._post = value;
}
get allowedDisplayOptions() {
@ -335,6 +340,12 @@ export default class Analytics extends Component {
}
}
@task
*fetchPostTask() {
const result = yield this.store.query('post', {filter: `id:${this.post.id}`, limit: 1});
this.post = result.toArray()[0];
}
get showLinks() {
return this.post.showEmailClickAnalytics;
}