UX: new site setting to define activity metrics displayed on dashboard
This commit is contained in:
parent
2ab02d6642
commit
0402f0f357
|
@ -19,16 +19,9 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
|
|||
logSearchQueriesEnabled: setting("log_search_queries"),
|
||||
basePath: Discourse.BaseUri,
|
||||
|
||||
@computed
|
||||
activityMetrics() {
|
||||
return [
|
||||
"page_view_total_reqs",
|
||||
"visits",
|
||||
"time_to_first_response",
|
||||
"likes",
|
||||
"flags",
|
||||
"user_to_user_private_messages_with_replies"
|
||||
];
|
||||
@computed("siteSettings.dashboard_general_tab_activity_metrics")
|
||||
activityMetrics(metrics) {
|
||||
return (metrics || "").split("|").filter(m => m);
|
||||
},
|
||||
|
||||
@computed
|
||||
|
|
|
@ -112,17 +112,15 @@
|
|||
{{#if showFilteringUI}}
|
||||
<div class="filters">
|
||||
{{#if showModes}}
|
||||
<ul class="modes">
|
||||
<div class="modes">
|
||||
{{#each displayedModes as |displayedMode|}}
|
||||
<li class="mode">
|
||||
{{d-button
|
||||
action="changeMode"
|
||||
actionParam=displayedMode.mode
|
||||
class=displayedMode.cssClass
|
||||
icon=displayedMode.icon}}
|
||||
</li>
|
||||
{{d-button
|
||||
action="changeMode"
|
||||
actionParam=displayedMode.mode
|
||||
class=displayedMode.cssClass
|
||||
icon=displayedMode.icon}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if showDatesOptions}}
|
||||
|
|
|
@ -56,36 +56,38 @@
|
|||
|
||||
<div class="section-columns">
|
||||
<div class="section-column">
|
||||
<div class="admin-report activity-metrics">
|
||||
<div class="header">
|
||||
<ul class="breadcrumb">
|
||||
<li class="item report">
|
||||
{{#link-to "adminReports" class="report-url"}}
|
||||
{{i18n "admin.dashboard.activity_metrics"}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="report-body">
|
||||
<div class="counters-list">
|
||||
<div class="counters-header">
|
||||
<div class="counters-cell"></div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.today'}}</div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.yesterday'}}</div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.last_7_days'}}</div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.last_30_days'}}</div>
|
||||
</div>
|
||||
{{#if activityMetrics.length}}
|
||||
<div class="admin-report activity-metrics">
|
||||
<div class="header">
|
||||
<ul class="breadcrumb">
|
||||
<li class="item report">
|
||||
{{#link-to "adminReports" class="report-url"}}
|
||||
{{i18n "admin.dashboard.activity_metrics"}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="report-body">
|
||||
<div class="counters-list">
|
||||
<div class="counters-header">
|
||||
<div class="counters-cell"></div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.today'}}</div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.yesterday'}}</div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.last_7_days'}}</div>
|
||||
<div class="counters-cell">{{i18n 'admin.dashboard.reports.last_30_days'}}</div>
|
||||
</div>
|
||||
|
||||
{{#each activityMetrics as |metric|}}
|
||||
{{admin-report
|
||||
showHeader=false
|
||||
filters=activityMetricsFilters
|
||||
forcedModes="counters"
|
||||
dataSourceName=metric}}
|
||||
{{/each}}
|
||||
{{#each activityMetrics as |metric|}}
|
||||
{{admin-report
|
||||
showHeader=false
|
||||
filters=activityMetricsFilters
|
||||
forcedModes="counters"
|
||||
dataSourceName=metric}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="user-metrics">
|
||||
{{#conditional-loading-section isLoading=isLoading}}
|
||||
|
|
|
@ -246,6 +246,8 @@ class Report
|
|||
def self.report_signups(report)
|
||||
report.group_filtering = true
|
||||
|
||||
report.icon = 'user-plus'
|
||||
|
||||
if report.group_id
|
||||
basic_report_about report, User.real, :count_by_signup_date, report.start_date, report.end_date, report.group_id
|
||||
add_counts report, User.real, 'users.created_at'
|
||||
|
|
|
@ -3993,6 +3993,7 @@ en:
|
|||
tags: "Tags"
|
||||
search: "Search"
|
||||
groups: "Groups"
|
||||
dashboard: "Dashboard"
|
||||
secret_list:
|
||||
invalid_input: "Input fields cannot be empty or contain vertical bar character."
|
||||
|
||||
|
|
|
@ -1903,6 +1903,8 @@ en:
|
|||
|
||||
short_title: "The short title will be used on the user's home screen, launcher, or other places where space may be limited. A maximum of 12 characters is recommended."
|
||||
|
||||
dashboard_general_tab_activity_metrics: "Choose reports to be displayed as activity metrics on the general tab."
|
||||
|
||||
errors:
|
||||
invalid_email: "Invalid email address."
|
||||
invalid_username: "There's no user with that username."
|
||||
|
|
|
@ -1898,3 +1898,19 @@ tags:
|
|||
force_lowercase_tags:
|
||||
default: true
|
||||
client: true
|
||||
|
||||
dashboard:
|
||||
dashboard_general_tab_activity_metrics:
|
||||
client: true
|
||||
type: list
|
||||
list_type: compact
|
||||
default: "page_view_total_reqs|visits|time_to_first_response|likes|flags|user_to_user_private_messages_with_replies"
|
||||
allow_any: false
|
||||
choices:
|
||||
- page_view_total_reqs
|
||||
- visits
|
||||
- time_to_first_response
|
||||
- likes
|
||||
- flags
|
||||
- user_to_user_private_messages_with_replies
|
||||
- signups
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Dashboard Next", {
|
||||
loggedIn: true
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
dashboard_general_tab_activity_metrics: "page_view_total_reqs"
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("Dashboard", async assert => {
|
||||
|
@ -26,7 +29,6 @@ QUnit.test("tabs", async assert => {
|
|||
|
||||
QUnit.test("general tab", async assert => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.ok(exists(".admin-report.signups"), "signups report");
|
||||
assert.ok(exists(".admin-report.posts"), "posts report");
|
||||
assert.ok(exists(".admin-report.dau-by-mau"), "dau-by-mau report");
|
||||
|
@ -46,6 +48,10 @@ QUnit.test("general tab", async assert => {
|
|||
"Houston...",
|
||||
"displays problems"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("general tab - activity metrics", async assert => {
|
||||
await visit("/admin");
|
||||
|
||||
assert.equal(
|
||||
$(".admin-report.page-view-total-reqs .today-count")
|
||||
|
|
Loading…
Reference in New Issue