FEATURE: displays a notice if report has no data (#6178)
This commit is contained in:
parent
6ee1ea96ef
commit
ad95c24307
|
@ -111,6 +111,8 @@ export default Ember.Component.extend({
|
|||
|
||||
showTimeoutError: Ember.computed.alias("model.timeout"),
|
||||
|
||||
hasData: Ember.computed.notEmpty("model.data"),
|
||||
|
||||
@computed("dataSourceName", "model.type")
|
||||
dasherizedDataSourceName(dataSourceName, type) {
|
||||
return (dataSourceName || type || "undefined").replace(/_/g, "-");
|
||||
|
|
|
@ -67,8 +67,14 @@
|
|||
|
||||
<div class="report-body">
|
||||
{{#unless showTimeoutError}}
|
||||
{{#if currentMode}}
|
||||
{{component modeComponent model=model options=options}}
|
||||
{{#if hasData}}
|
||||
{{#if currentMode}}
|
||||
{{component modeComponent model=model options=options}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<div class="alert alert-info no-data-alert">
|
||||
{{i18n 'admin.dashboard.reports.no_data'}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
.admin-report {
|
||||
.no-data-alert {
|
||||
width: 100%;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.conditional-loading-section {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.report-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
|
|
@ -2811,6 +2811,7 @@ en:
|
|||
disabled: "This report is disabled"
|
||||
totals_for_sample: "Totals for sample"
|
||||
total: "All time total"
|
||||
no_data: "No data to display."
|
||||
trending_search:
|
||||
more: '<a href="/admin/logs/search_logs">Search logs</a>'
|
||||
disabled: 'Trending search report is disabled. Enable <a href="/admin/site_settings/category/all_results?filter=log%20search%20queries">log search queries</a> to collect data.'
|
||||
|
|
|
@ -115,3 +115,11 @@ componentTest("timeout", {
|
|||
assert.ok(exists(".alert-error"), "it displays a timeout error");
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("no data", {
|
||||
template: "{{admin-report dataSourceName='posts'}}",
|
||||
|
||||
test(assert) {
|
||||
assert.ok(exists(".no-data-alert"), "it displays a no data alert");
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue