mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Refined email debug screen error handling
refs https://github.com/TryGhost/Team/issues/2327
This commit is contained in:
parent
6ae9b49e73
commit
e74ba81276
2 changed files with 23 additions and 10 deletions
|
@ -44,8 +44,8 @@
|
||||||
<div class="gh-box gh-box-error gh-box-tip gh-email-debug-error">
|
<div class="gh-box gh-box-error gh-box-tip gh-email-debug-error">
|
||||||
{{svg-jar "warning"}}
|
{{svg-jar "warning"}}
|
||||||
<div class="gh-email-debug-errortext">
|
<div class="gh-email-debug-errortext">
|
||||||
<h4>Something went wrong!</h4>
|
<h4>{{this.emailError.message}}</h4>
|
||||||
<p class="mb0">{{this.emailError.message}}</p>
|
<p class="mb0">{{this.emailError.details}}</p>
|
||||||
</div>
|
</div>
|
||||||
<LinkTo @route="editor.edit" @models={{array this.post.displayName this.post.id}} class="gh-btn gh-btn-primary gh-btn-icon gh-btn-red ember-view self-center">
|
<LinkTo @route="editor.edit" @models={{array this.post.displayName this.post.id}} class="gh-btn gh-btn-primary gh-btn-icon gh-btn-red ember-view self-center">
|
||||||
<span>Retry</span>
|
<span>Retry</span>
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
<Tabs::Tabs class="gh-tabs-analytics" @forceRender={{true}} as |tabs|>
|
<Tabs::Tabs class="gh-tabs-analytics" @forceRender={{true}} as |tabs|>
|
||||||
<tabs.tab>
|
<tabs.tab>
|
||||||
<h3>{{svg-jar "analytics-tab-sent-large"}} {{this.tabTotals.permanentFailures}}</h3>
|
<h3>{{svg-jar "analytics-tab-sent-large"}} {{this.tabTotals.permanentFailures}}</h3>
|
||||||
<p><span class="analytics-tab-label">Permanent failures</span></p>
|
<p><span class="analytics-tab-label">Permanent {{gh-pluralize this.tabTotals.permanentFailures "failure" without-count=true}}</span></p>
|
||||||
</tabs.tab>
|
</tabs.tab>
|
||||||
|
|
||||||
<tabs.tabPanel>
|
<tabs.tabPanel>
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
<tabs.tab>
|
<tabs.tab>
|
||||||
<h3>{{svg-jar "analytics-tab-opened-large"}}{{this.tabTotals.temporaryFailures}}</h3>
|
<h3>{{svg-jar "analytics-tab-opened-large"}}{{this.tabTotals.temporaryFailures}}</h3>
|
||||||
<p><span class="analytics-tab-label">Temporary failures</span></p>
|
<p><span class="analytics-tab-label">Temporary {{gh-pluralize this.tabTotals.temporaryFailures "failure" without-count=true}}</span></p>
|
||||||
</tabs.tab>
|
</tabs.tab>
|
||||||
|
|
||||||
<tabs.tabPanel>
|
<tabs.tabPanel>
|
||||||
|
@ -161,7 +161,7 @@
|
||||||
|
|
||||||
<tabs.tab>
|
<tabs.tab>
|
||||||
<h3>{{svg-jar "analytics-tab-clicked-large"}}{{this.tabTotals.erroredBatches}}</h3>
|
<h3>{{svg-jar "analytics-tab-clicked-large"}}{{this.tabTotals.erroredBatches}}</h3>
|
||||||
<p><span class="analytics-tab-label">Batches errored</span></p>
|
<p><span class="analytics-tab-label">{{gh-pluralize this.tabTotals.erroredBatches "batch" without-count=true}} errored</span></p>
|
||||||
</tabs.tab>
|
</tabs.tab>
|
||||||
|
|
||||||
<tabs.tabPanel>
|
<tabs.tabPanel>
|
||||||
|
|
|
@ -2,6 +2,8 @@ import Component from '@glimmer/component';
|
||||||
import moment from 'moment-timezone';
|
import moment from 'moment-timezone';
|
||||||
import {action} from '@ember/object';
|
import {action} from '@ember/object';
|
||||||
import {didCancel, task} from 'ember-concurrency';
|
import {didCancel, task} from 'ember-concurrency';
|
||||||
|
import {formatNumber} from 'ghost-admin/helpers/format-number';
|
||||||
|
import {ghPluralize} from 'ghost-admin/helpers/gh-pluralize';
|
||||||
import {inject as service} from '@ember/service';
|
import {inject as service} from '@ember/service';
|
||||||
import {tracked} from '@glimmer/tracking';
|
import {tracked} from '@glimmer/tracking';
|
||||||
export default class Debug extends Component {
|
export default class Debug extends Component {
|
||||||
|
@ -14,14 +16,24 @@ export default class Debug extends Component {
|
||||||
|
|
||||||
@tracked emailBatches = null;
|
@tracked emailBatches = null;
|
||||||
@tracked recipientFailures = null;
|
@tracked recipientFailures = null;
|
||||||
|
@tracked loading = true;
|
||||||
|
|
||||||
get post() {
|
get post() {
|
||||||
return this.args.post;
|
return this.args.post;
|
||||||
}
|
}
|
||||||
|
|
||||||
get emailError() {
|
get emailError() {
|
||||||
|
// get failed batches count
|
||||||
|
let failedBatches = this.emailBatchesData?.filter((batch) => {
|
||||||
|
return batch.statusClass === 'failed';
|
||||||
|
}).length || 0;
|
||||||
|
// get total batch count
|
||||||
|
let totalBatches = this.emailBatchesData?.length || 0;
|
||||||
|
|
||||||
|
let details = (this.loading || !totalBatches) ? '' : `${failedBatches} of ${ghPluralize(totalBatches, 'batch')} failed to send, check below for more details.`;
|
||||||
return {
|
return {
|
||||||
message: this.post.email?.error || 'Failed to send email!'
|
message: this.post.email?.error || 'Failed to send email.',
|
||||||
|
details
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +55,11 @@ export default class Debug extends Component {
|
||||||
|
|
||||||
get tabTotals() {
|
get tabTotals() {
|
||||||
return {
|
return {
|
||||||
temporaryFailures: this.temporaryFailureData?.length || 0,
|
temporaryFailures: formatNumber(this.temporaryFailureData?.length || 0),
|
||||||
permanentFailures: this.permanentFailureData?.length || 0,
|
permanentFailures: formatNumber(this.permanentFailureData?.length || 0),
|
||||||
erroredBatches: this.emailBatchesData?.filter((batch) => {
|
erroredBatches: formatNumber(this.emailBatchesData?.filter((batch) => {
|
||||||
return batch.statusClass === 'failed';
|
return batch.statusClass === 'failed';
|
||||||
}).length || 0
|
}).length || 0)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +183,7 @@ export default class Debug extends Component {
|
||||||
let statsUrl = this.ghostPaths.url.api(`emails/${this.post.email.id}/batches`);
|
let statsUrl = this.ghostPaths.url.api(`emails/${this.post.email.id}/batches`);
|
||||||
let result = yield this.ajax.request(statsUrl, {data});
|
let result = yield this.ajax.request(statsUrl, {data});
|
||||||
this.emailBatches = result.batches;
|
this.emailBatches = result.batches;
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchRecipientFailures() {
|
async fetchRecipientFailures() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue