mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: makes reports loadable in bulk (#6309)
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/daily_engaged_users": {
|
||||
report: {
|
||||
report_key: "daily_engaged_users"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/dau_by_mau": {
|
||||
report: {
|
||||
report_key: "dau_by_mau"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/flags": {
|
||||
report: {
|
||||
report_key: "flags"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/likes": {
|
||||
report: {
|
||||
report_key: "likes"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/new_contributors": {
|
||||
report: {
|
||||
report_key: "new_contributors"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,90 +0,0 @@
|
||||
const startDate = moment()
|
||||
.locale("en")
|
||||
.utc()
|
||||
.startOf("day")
|
||||
.subtract(1, "month");
|
||||
|
||||
const endDate = moment()
|
||||
.locale("en")
|
||||
.utc()
|
||||
.endOf("day");
|
||||
|
||||
const data = [
|
||||
851,
|
||||
3805,
|
||||
2437,
|
||||
3768,
|
||||
4476,
|
||||
3021,
|
||||
1285,
|
||||
1120,
|
||||
3932,
|
||||
2777,
|
||||
3298,
|
||||
3198,
|
||||
3601,
|
||||
1249,
|
||||
1046,
|
||||
3212,
|
||||
3358,
|
||||
3306,
|
||||
2618,
|
||||
2679,
|
||||
910,
|
||||
875,
|
||||
3877,
|
||||
2342,
|
||||
2305,
|
||||
3534,
|
||||
3713,
|
||||
1133,
|
||||
1350,
|
||||
4048,
|
||||
2523,
|
||||
1062
|
||||
];
|
||||
|
||||
export default {
|
||||
"/admin/reports/page_view_total_reqs": {
|
||||
report: {
|
||||
type: "page_view_total_reqs",
|
||||
title: "Pageviews",
|
||||
xaxis: "Day",
|
||||
yaxis: "Total Pageviews",
|
||||
description: null,
|
||||
data: [...data].map((d, i) => {
|
||||
return {
|
||||
x: moment(startDate)
|
||||
.add(i, "days")
|
||||
.format("YYYY-MM-DD"),
|
||||
y: d
|
||||
};
|
||||
}),
|
||||
start_date: startDate.toISOString(),
|
||||
end_date: endDate.toISOString(),
|
||||
prev_data: null,
|
||||
prev_start_date: "2018-06-20T00:00:00Z",
|
||||
prev_end_date: "2018-07-23T00:00:00Z",
|
||||
category_id: null,
|
||||
group_id: null,
|
||||
prev30Days: 58110,
|
||||
dates_filtering: true,
|
||||
report_key: `reports:page_view_total_reqs:${startDate.format(
|
||||
"YYYYMMDD"
|
||||
)}:${endDate.format("YYYYMMDD")}:[:prev_period]:2`,
|
||||
labels: [
|
||||
{ type: "date", property: "x", title: "Day" },
|
||||
{ type: "number", property: "y", title: "Count" }
|
||||
],
|
||||
processing: false,
|
||||
average: false,
|
||||
percent: false,
|
||||
higher_is_better: true,
|
||||
category_filtering: false,
|
||||
group_filtering: false,
|
||||
modes: ["table", "chart"],
|
||||
icon: "file",
|
||||
total: 921672
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/posts": {
|
||||
report: {
|
||||
report_key: "posts"
|
||||
}
|
||||
}
|
||||
};
|
||||
178
test/javascripts/fixtures/reports_bulk.js.es6
Normal file
178
test/javascripts/fixtures/reports_bulk.js.es6
Normal file
@@ -0,0 +1,178 @@
|
||||
let signups = {
|
||||
type: "signups",
|
||||
title: "Signups",
|
||||
xaxis: "Day",
|
||||
yaxis: "Number of signups",
|
||||
description: "New account registrations for this period",
|
||||
data: [
|
||||
{ x: "2018-06-16", y: 12 },
|
||||
{ x: "2018-06-17", y: 16 },
|
||||
{ x: "2018-06-18", y: 42 },
|
||||
{ x: "2018-06-19", y: 38 },
|
||||
{ x: "2018-06-20", y: 41 },
|
||||
{ x: "2018-06-21", y: 32 },
|
||||
{ x: "2018-06-22", y: 23 },
|
||||
{ x: "2018-06-23", y: 23 },
|
||||
{ x: "2018-06-24", y: 17 },
|
||||
{ x: "2018-06-25", y: 27 },
|
||||
{ x: "2018-06-26", y: 32 },
|
||||
{ x: "2018-06-27", y: 7 }
|
||||
],
|
||||
start_date: "2018-06-16T00:00:00Z",
|
||||
end_date: "2018-07-16T23:59:59Z",
|
||||
prev_data: [
|
||||
{ x: "2018-05-17", y: 32 },
|
||||
{ x: "2018-05-18", y: 30 },
|
||||
{ x: "2018-05-19", y: 12 },
|
||||
{ x: "2018-05-20", y: 23 },
|
||||
{ x: "2018-05-21", y: 50 },
|
||||
{ x: "2018-05-22", y: 39 },
|
||||
{ x: "2018-05-23", y: 51 },
|
||||
{ x: "2018-05-24", y: 48 },
|
||||
{ x: "2018-05-25", y: 37 },
|
||||
{ x: "2018-05-26", y: 17 },
|
||||
{ x: "2018-05-27", y: 6 },
|
||||
{ x: "2018-05-28", y: 20 },
|
||||
{ x: "2018-05-29", y: 37 },
|
||||
{ x: "2018-05-30", y: 37 },
|
||||
{ x: "2018-05-31", y: 37 },
|
||||
{ x: "2018-06-01", y: 38 },
|
||||
{ x: "2018-06-02", y: 23 },
|
||||
{ x: "2018-06-03", y: 18 },
|
||||
{ x: "2018-06-04", y: 39 },
|
||||
{ x: "2018-06-05", y: 26 },
|
||||
{ x: "2018-06-06", y: 39 },
|
||||
{ x: "2018-06-07", y: 52 },
|
||||
{ x: "2018-06-08", y: 35 },
|
||||
{ x: "2018-06-09", y: 19 },
|
||||
{ x: "2018-06-10", y: 15 },
|
||||
{ x: "2018-06-11", y: 31 },
|
||||
{ x: "2018-06-12", y: 38 },
|
||||
{ x: "2018-06-13", y: 30 },
|
||||
{ x: "2018-06-14", y: 45 },
|
||||
{ x: "2018-06-15", y: 37 },
|
||||
{ x: "2018-06-16", y: 12 }
|
||||
],
|
||||
prev_start_date: "2018-05-17T00:00:00Z",
|
||||
prev_end_date: "2018-06-17T00:00:00Z",
|
||||
category_id: null,
|
||||
group_id: null,
|
||||
prev30Days: null,
|
||||
dates_filtering: true,
|
||||
report_key: "reports:signups::20180616:20180716::[:prev_period]:",
|
||||
labels: [
|
||||
{ type: "date", properties: ["x"], title: "Day" },
|
||||
{ type: "number", properties: ["y"], title: "Count" }
|
||||
],
|
||||
processing: false,
|
||||
average: false,
|
||||
percent: false,
|
||||
higher_is_better: true,
|
||||
category_filtering: false,
|
||||
group_filtering: true,
|
||||
modes: ["table", "chart"],
|
||||
prev_period: 961
|
||||
};
|
||||
|
||||
let signups_fixture = JSON.parse(JSON.stringify(signups));
|
||||
signups_fixture.type = "signups_exception";
|
||||
signups_fixture.error = "exception";
|
||||
const signups_exception = signups_fixture;
|
||||
|
||||
signups_fixture = JSON.parse(JSON.stringify(signups));
|
||||
signups_fixture.type = "signups_timeout";
|
||||
signups_fixture.error = "timeout";
|
||||
const signups_timeout = signups_fixture;
|
||||
|
||||
const startDate = moment()
|
||||
.locale("en")
|
||||
.utc()
|
||||
.startOf("day")
|
||||
.subtract(1, "month");
|
||||
|
||||
const endDate = moment()
|
||||
.locale("en")
|
||||
.utc()
|
||||
.endOf("day");
|
||||
|
||||
const data = [
|
||||
851,
|
||||
3805,
|
||||
2437,
|
||||
3768,
|
||||
4476,
|
||||
3021,
|
||||
1285,
|
||||
1120,
|
||||
3932,
|
||||
2777,
|
||||
3298,
|
||||
3198,
|
||||
3601,
|
||||
1249,
|
||||
1046,
|
||||
3212,
|
||||
3358,
|
||||
3306,
|
||||
2618,
|
||||
2679,
|
||||
910,
|
||||
875,
|
||||
3877,
|
||||
2342,
|
||||
2305,
|
||||
3534,
|
||||
3713,
|
||||
1133,
|
||||
1350,
|
||||
4048,
|
||||
2523,
|
||||
1062
|
||||
];
|
||||
|
||||
const page_view_total_reqs = {
|
||||
type: "page_view_total_reqs",
|
||||
title: "Pageviews",
|
||||
xaxis: "Day",
|
||||
yaxis: "Total Pageviews",
|
||||
description: null,
|
||||
data: [...data].map((d, i) => {
|
||||
return {
|
||||
x: moment(startDate)
|
||||
.add(i, "days")
|
||||
.format("YYYY-MM-DD"),
|
||||
y: d
|
||||
};
|
||||
}),
|
||||
start_date: startDate.toISOString(),
|
||||
end_date: endDate.toISOString(),
|
||||
prev_data: null,
|
||||
prev_start_date: "2018-06-20T00:00:00Z",
|
||||
prev_end_date: "2018-07-23T00:00:00Z",
|
||||
category_id: null,
|
||||
group_id: null,
|
||||
prev30Days: 58110,
|
||||
dates_filtering: true,
|
||||
report_key: `reports:page_view_total_reqs:${startDate.format(
|
||||
"YYYYMMDD"
|
||||
)}:${endDate.format("YYYYMMDD")}:[:prev_period]:2`,
|
||||
labels: [
|
||||
{ type: "date", property: "x", title: "Day" },
|
||||
{ type: "number", property: "y", title: "Count" }
|
||||
],
|
||||
processing: false,
|
||||
average: false,
|
||||
percent: false,
|
||||
higher_is_better: true,
|
||||
category_filtering: false,
|
||||
group_filtering: false,
|
||||
modes: ["table", "chart"],
|
||||
icon: "file",
|
||||
total: 921672
|
||||
};
|
||||
|
||||
export default {
|
||||
"/admin/reports/bulk": {
|
||||
reports: [signups, signups_exception, signups_timeout, page_view_total_reqs]
|
||||
}
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/signups": {
|
||||
report: {
|
||||
type: "signups",
|
||||
title: "Signups",
|
||||
xaxis: "Day",
|
||||
yaxis: "Number of signups",
|
||||
description: "New account registrations for this period",
|
||||
data: [
|
||||
{ x: "2018-06-16", y: 12 },
|
||||
{ x: "2018-06-17", y: 16 },
|
||||
{ x: "2018-06-18", y: 42 },
|
||||
{ x: "2018-06-19", y: 38 },
|
||||
{ x: "2018-06-20", y: 41 },
|
||||
{ x: "2018-06-21", y: 32 },
|
||||
{ x: "2018-06-22", y: 23 },
|
||||
{ x: "2018-06-23", y: 23 },
|
||||
{ x: "2018-06-24", y: 17 },
|
||||
{ x: "2018-06-25", y: 27 },
|
||||
{ x: "2018-06-26", y: 32 },
|
||||
{ x: "2018-06-27", y: 7 }
|
||||
],
|
||||
start_date: "2018-06-16T00:00:00Z",
|
||||
end_date: "2018-07-16T23:59:59Z",
|
||||
prev_data: [
|
||||
{ x: "2018-05-17", y: 32 },
|
||||
{ x: "2018-05-18", y: 30 },
|
||||
{ x: "2018-05-19", y: 12 },
|
||||
{ x: "2018-05-20", y: 23 },
|
||||
{ x: "2018-05-21", y: 50 },
|
||||
{ x: "2018-05-22", y: 39 },
|
||||
{ x: "2018-05-23", y: 51 },
|
||||
{ x: "2018-05-24", y: 48 },
|
||||
{ x: "2018-05-25", y: 37 },
|
||||
{ x: "2018-05-26", y: 17 },
|
||||
{ x: "2018-05-27", y: 6 },
|
||||
{ x: "2018-05-28", y: 20 },
|
||||
{ x: "2018-05-29", y: 37 },
|
||||
{ x: "2018-05-30", y: 37 },
|
||||
{ x: "2018-05-31", y: 37 },
|
||||
{ x: "2018-06-01", y: 38 },
|
||||
{ x: "2018-06-02", y: 23 },
|
||||
{ x: "2018-06-03", y: 18 },
|
||||
{ x: "2018-06-04", y: 39 },
|
||||
{ x: "2018-06-05", y: 26 },
|
||||
{ x: "2018-06-06", y: 39 },
|
||||
{ x: "2018-06-07", y: 52 },
|
||||
{ x: "2018-06-08", y: 35 },
|
||||
{ x: "2018-06-09", y: 19 },
|
||||
{ x: "2018-06-10", y: 15 },
|
||||
{ x: "2018-06-11", y: 31 },
|
||||
{ x: "2018-06-12", y: 38 },
|
||||
{ x: "2018-06-13", y: 30 },
|
||||
{ x: "2018-06-14", y: 45 },
|
||||
{ x: "2018-06-15", y: 37 },
|
||||
{ x: "2018-06-16", y: 12 }
|
||||
],
|
||||
prev_start_date: "2018-05-17T00:00:00Z",
|
||||
prev_end_date: "2018-06-17T00:00:00Z",
|
||||
category_id: null,
|
||||
group_id: null,
|
||||
prev30Days: null,
|
||||
dates_filtering: true,
|
||||
report_key: "reports:signups::20180616:20180716::[:prev_period]:",
|
||||
labels: [
|
||||
{ type: "date", properties: ["x"], title: "Day" },
|
||||
{ type: "number", properties: ["y"], title: "Count" }
|
||||
],
|
||||
processing: false,
|
||||
average: false,
|
||||
percent: false,
|
||||
higher_is_better: true,
|
||||
category_filtering: false,
|
||||
group_filtering: true,
|
||||
modes: ["table", "chart"],
|
||||
prev_period: 961
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
import signups from "fixtures/signups";
|
||||
|
||||
const signupsExceptionKey = "/admin/reports/signups_exception";
|
||||
const signupsKey = "/admin/reports/signups";
|
||||
|
||||
let fixture = {};
|
||||
|
||||
fixture[signupsExceptionKey] = JSON.parse(JSON.stringify(signups[signupsKey]));
|
||||
fixture[signupsExceptionKey].report.error = "exception";
|
||||
|
||||
export default fixture;
|
||||
@@ -1,11 +0,0 @@
|
||||
import signups from "fixtures/signups";
|
||||
|
||||
const signupsTimeoutKey = "/admin/reports/signups_timeout";
|
||||
const signupsKey = "/admin/reports/signups";
|
||||
|
||||
let fixture = {};
|
||||
|
||||
fixture[signupsTimeoutKey] = JSON.parse(JSON.stringify(signups[signupsKey]));
|
||||
fixture[signupsTimeoutKey].report.error = "timeout";
|
||||
|
||||
export default fixture;
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/time_to_first_response": {
|
||||
report: {
|
||||
report_key: "time_to_first_response"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/top_referred_topics": {
|
||||
report: {
|
||||
report_key: "top_referred_topics"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/topics": {
|
||||
report: {
|
||||
report_key: "topics"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/trending_search": {
|
||||
report: {
|
||||
report_key: "trending_search"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/user_to_user_private_messages_with_replies": {
|
||||
report: {
|
||||
report_key: "user_to_user_private_messages_with_replies"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/users_by_trust_level": {
|
||||
report: {
|
||||
report_key: "users_by_trust_level"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/users_by_type": {
|
||||
report: {
|
||||
report_key: "users_by_type"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export default {
|
||||
"/admin/reports/visits": {
|
||||
report: {
|
||||
report_key: "posts"
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user