discourse/app/assets/javascripts/admin/addon/components/admin-report.hbs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

246 lines
8.4 KiB
Handlebars
Raw Normal View History

{{#unless this.isHidden}}
{{#if this.isEnabled}}
<ConditionalLoadingSection @isLoading={{this.isLoading}}>
{{#if this.showHeader}}
<div class="header">
{{#if this.showTitle}}
<ul class="breadcrumb">
{{#if this.showAllReportsLink}}
<li class="item all-reports">
FEATURE: Switch to new methods of pageview measurement and reporting (#28729) ### UI changes All of the UI changes described are gated behind the `use_legacy_pageviews` site setting. This commit changes the admin dashboard pageviews report to use the "Consolidated Pageviews with Browser Detection" report introduced in 2f2da7274732cba30d03b6c5c3a4194652cb6783 with the following changes: * The report name is changed to "Site traffic" * The pageview count on the dashboard is counting only using the new method * The old "Consolidated Pageviews" report is renamed as "Consolidated Legacy Pageviews" * By default "known crawlers" and "other" sources of pageviews are hidden on the report When `use_legacy_pageviews` is `true`, we do not show or allow running the "Site traffic" report for admins. When `use_legacy_pageviews` is `false`, we do not show or allow running the following legacy reports: * consolidated_page_views * consolidated_page_views_browser_detection * page_view_anon_reqs * page_view_logged_in_reqs ### Historical data changes Also part of this change is that, since we introduced our new "Consolidated Pageviews with Browser Detection" report, some admins are confused at either: * The lack of data before a certain date , which didn’t exist before we started collecting it * Comparing this and the current "Consolidated Pageviews" report data, which rolls up "Other Pageviews" into "Anonymous Browser" and so it appears inaccurate All pageview data in the new report before the date where the _first_ anon or logged in browser pageview was recorded is now hidden.
2024-09-10 07:51:49 +08:00
<LinkTo @route="adminReports.index" class="report-url">
{{i18n "admin.dashboard.all_reports"}}
</LinkTo>
</li>
{{#unless this.showNotFoundError}}
<li class="item separator">|</li>
{{/unless}}
{{/if}}
{{#unless this.showNotFoundError}}
<li class="item report">
<a href={{this.model.reportUrl}} class="report-url">
{{this.model.title}}
</a>
{{#if this.model.description}}
<DTooltip
@interactive={{this.model.description_link.length}}
>
<:trigger>
{{d-icon "circle-question"}}
</:trigger>
<:content>
{{#if this.model.description_link}}
<a
target="_blank"
rel="noopener noreferrer"
href={{this.model.description_link}}
class="info"
>
{{this.model.description}}
</a>
{{else}}
<span>{{this.model.description}}</span>
{{/if}}
</:content>
</DTooltip>
{{/if}}
</li>
{{/unless}}
</ul>
{{/if}}
{{#if this.shouldDisplayTrend}}
<div class="trend {{this.model.trend}}">
<span class="value" title={{this.model.trendTitle}}>
{{#if this.model.average}}
{{number this.model.currentAverage}}{{#if
this.model.percent
}}%{{/if}}
{{else}}
{{number this.model.currentTotal noTitle="true"}}{{#if
this.model.percent
}}%{{/if}}
{{/if}}
{{#if this.model.trendIcon}}
{{d-icon this.model.trendIcon class="icon"}}
{{/if}}
</span>
</div>
{{/if}}
</div>
{{/if}}
<div class="body">
<div class="main">
{{#if this.showError}}
{{#if this.showTimeoutError}}
<div class="alert alert-error report-alert timeout">
{{d-icon "triangle-exclamation"}}
<span>{{i18n "admin.dashboard.timeout_error"}}</span>
</div>
{{/if}}
{{#if this.showExceptionError}}
<div class="alert alert-error report-alert exception">
{{d-icon "triangle-exclamation"}}
<span>{{i18n "admin.dashboard.exception_error"}}</span>
</div>
{{/if}}
{{#if this.showNotFoundError}}
<div class="alert alert-error report-alert not-found">
{{d-icon "triangle-exclamation"}}
<span>{{i18n "admin.dashboard.not_found_error"}}</span>
</div>
{{/if}}
{{else}}
{{#if this.hasData}}
{{#if this.currentMode}}
{{component
this.modeComponent
model=this.model
options=this.options
}}
{{#if this.model.relatedReport}}
<AdminReport
@showFilteringUI={{false}}
@dataSourceName={{this.model.relatedReport.type}}
/>
{{/if}}
{{/if}}
{{else}}
{{#if this.rateLimitationString}}
<div class="alert alert-error report-alert rate-limited">
{{d-icon "temperature-three-quarters"}}
<span>{{this.rateLimitationString}}</span>
</div>
{{else}}
<div class="alert alert-info report-alert no-data">
{{d-icon "chart-pie"}}
{{#if this.model.reportUrl}}
<a href={{this.model.reportUrl}} class="report-url">
<span>
{{#if this.model.title}}
{{this.model.title}}
{{/if}}
{{i18n "admin.dashboard.reports.no_data"}}
</span>
</a>
{{else}}
<span>{{i18n "admin.dashboard.reports.no_data"}}</span>
{{/if}}
</div>
{{/if}}
{{/if}}
{{/if}}
</div>
{{#if this.showFilteringUI}}
<div class="filters">
{{#if this.showModes}}
<div class="modes">
{{#each this.displayedModes as |displayedMode|}}
<DButton
@action={{fn this.onChangeMode displayedMode.mode}}
@icon={{displayedMode.icon}}
class={{displayedMode.cssClass}}
/>
{{/each}}
</div>
{{/if}}
{{#if this.isChartMode}}
{{#if this.model.average}}
<span class="average-chart">
{{i18n "admin.dashboard.reports.average_chart_label"}}
</span>
{{/if}}
<div class="chart-groupings">
{{#each this.chartGroupings as |chartGrouping|}}
<DButton
@label={{chartGrouping.label}}
@action={{fn this.changeGrouping chartGrouping.id}}
@disabled={{chartGrouping.disabled}}
class={{chartGrouping.class}}
/>
{{/each}}
</div>
{{/if}}
{{#if this.showDatesOptions}}
<div class="control">
<span class="label">
{{i18n "admin.dashboard.reports.dates"}}
</span>
<div class="input">
<DateTimeInputRange
@from={{this.startDate}}
@to={{this.endDate}}
DEV: remove trivial `{{action}}` usages (#24278) This removes all trivial usages of the `{{action}}` keyword (the helper form, not the modifier form), where trivial means: 1. It's a co-located component (`.hbs` next to `.js`) 2. The JS file has a default export that is native class 3. `{{action "foo"}}` or `(action "foo")` with no extra arguments 4. There is a corresponding `foo()` method defined on the class (not inherited, etc) There are more usages that is slightly more involved (with arguments, etc) that we can deal with, but this PR seems big enough so I just included the easiest cases here. To aid review, each file is converted in an individual commit, and the matching method is temporary annotated with `@__action__` instead of the normal `@action`. This forces a git diff when it is already annotated as `@action`. * DEV: {{action}} -> @action admin-penalty-post-action.hbs * DEV: {{action}} -> @action admin-report.hbs * DEV: {{action}} -> @action admin-watched-word.hbs * DEV: {{action}} -> @action emoji-value-list.hbs * DEV: {{action}} -> @action bool.hbs * DEV: {{action}} -> @action category.hbs * DEV: {{action}} -> @action secret-value-list.hbs * DEV: {{action}} -> @action category-list.hbs * DEV: {{action}} -> @action color.hbs * DEV: {{action}} -> @action compact-list.hbs * DEV: {{action}} -> @action group-list.hbs * DEV: {{action}} -> @action host-list.hbs * DEV: {{action}} -> @action named-list.hbs * DEV: {{action}} -> @action simple-list.hbs * DEV: {{action}} -> @action tag-group-list.hbs * DEV: {{action}} -> @action tag-list.hbs * DEV: {{action}} -> @action value-list.hbs * DEV: {{action}} -> @action watched-word-form.hbs * DEV: {{action}} -> @action composer-messages.hbs * DEV: {{action}} -> @action section.hbs * DEV: {{action}} -> @action user-status-picker.hbs * DEV: cleanup @__action__ -> @action
2023-11-08 17:53:06 +08:00
@onChange={{this.onChangeDateRange}}
@showFromTime={{false}}
@showToTime={{false}}
/>
</div>
</div>
{{/if}}
{{#each this.model.available_filters as |filter|}}
<div class="control">
<span class="label">
{{i18n
(concat
"admin.dashboard.reports.filters." filter.id ".label"
2022-12-28 20:28:11 +08:00
)
}}
</span>
<div class="input">
{{component
(concat "report-filters/" filter.type)
model=this.model
filter=filter
DEV: remove trivial `{{action}}` usages (#24278) This removes all trivial usages of the `{{action}}` keyword (the helper form, not the modifier form), where trivial means: 1. It's a co-located component (`.hbs` next to `.js`) 2. The JS file has a default export that is native class 3. `{{action "foo"}}` or `(action "foo")` with no extra arguments 4. There is a corresponding `foo()` method defined on the class (not inherited, etc) There are more usages that is slightly more involved (with arguments, etc) that we can deal with, but this PR seems big enough so I just included the easiest cases here. To aid review, each file is converted in an individual commit, and the matching method is temporary annotated with `@__action__` instead of the normal `@action`. This forces a git diff when it is already annotated as `@action`. * DEV: {{action}} -> @action admin-penalty-post-action.hbs * DEV: {{action}} -> @action admin-report.hbs * DEV: {{action}} -> @action admin-watched-word.hbs * DEV: {{action}} -> @action emoji-value-list.hbs * DEV: {{action}} -> @action bool.hbs * DEV: {{action}} -> @action category.hbs * DEV: {{action}} -> @action secret-value-list.hbs * DEV: {{action}} -> @action category-list.hbs * DEV: {{action}} -> @action color.hbs * DEV: {{action}} -> @action compact-list.hbs * DEV: {{action}} -> @action group-list.hbs * DEV: {{action}} -> @action host-list.hbs * DEV: {{action}} -> @action named-list.hbs * DEV: {{action}} -> @action simple-list.hbs * DEV: {{action}} -> @action tag-group-list.hbs * DEV: {{action}} -> @action tag-list.hbs * DEV: {{action}} -> @action value-list.hbs * DEV: {{action}} -> @action watched-word-form.hbs * DEV: {{action}} -> @action composer-messages.hbs * DEV: {{action}} -> @action section.hbs * DEV: {{action}} -> @action user-status-picker.hbs * DEV: cleanup @__action__ -> @action
2023-11-08 17:53:06 +08:00
applyFilter=this.applyFilter
}}
</div>
</div>
{{/each}}
<div class="control">
<div class="input">
<DButton
@action={{this.exportCsv}}
@label="admin.export_csv.button_text"
@icon="download"
class="btn-default export-csv-btn"
/>
</div>
</div>
{{#if this.showRefresh}}
<div class="control">
<div class="input">
<DButton
@action={{this.refreshReport}}
@label="admin.dashboard.reports.refresh_report"
@icon="arrows-rotate"
class="refresh-report-btn btn-primary"
/>
</div>
</div>
{{/if}}
</div>
{{/if}}
</div>
</ConditionalLoadingSection>
{{else}}
<div class="alert alert-info">
{{html-safe this.disabledLabel}}
</div>
{{/if}}
{{/unless}}