2019-10-24 01:06:54 +08:00
|
|
|
import Controller from "@ember/controller";
|
2024-11-20 04:45:18 +08:00
|
|
|
import { i18n } from "discourse-i18n";
|
2019-03-29 09:59:08 +08:00
|
|
|
import { DEFAULT_PERIOD } from "admin/controllers/admin-search-logs-index";
|
|
|
|
|
2023-03-15 17:42:12 +08:00
|
|
|
export default class AdminSearchLogsTermController extends Controller {
|
|
|
|
loading = false;
|
|
|
|
term = null;
|
|
|
|
period = DEFAULT_PERIOD;
|
|
|
|
searchType = "all";
|
|
|
|
searchTypeOptions = [
|
|
|
|
{
|
|
|
|
id: "all",
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("admin.logs.search_logs.types.all_search_types"),
|
2023-03-15 17:42:12 +08:00
|
|
|
},
|
2024-11-20 04:45:18 +08:00
|
|
|
{ id: "header", name: i18n("admin.logs.search_logs.types.header") },
|
2023-03-15 17:42:12 +08:00
|
|
|
{
|
|
|
|
id: "full_page",
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("admin.logs.search_logs.types.full_page"),
|
2023-03-15 17:42:12 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "click_through_only",
|
2024-11-20 04:45:18 +08:00
|
|
|
name: i18n("admin.logs.search_logs.types.click_through_only"),
|
2023-03-15 17:42:12 +08:00
|
|
|
},
|
|
|
|
];
|
2024-08-23 20:59:56 +08:00
|
|
|
|
|
|
|
get chartConfig() {
|
|
|
|
return {
|
|
|
|
type: "bar",
|
|
|
|
data: {
|
|
|
|
labels: this.model.data.map((r) => r.x),
|
|
|
|
datasets: [
|
|
|
|
{
|
|
|
|
data: this.model.data.map((r) => r.y),
|
|
|
|
label: this.model.title,
|
|
|
|
backgroundColor: "rgba(200,220,240,1)",
|
|
|
|
borderColor: "#08C",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
responsive: true,
|
|
|
|
plugins: {
|
|
|
|
tooltip: {
|
|
|
|
callbacks: {
|
|
|
|
title: (context) =>
|
|
|
|
moment(context[0].label, "YYYY-MM-DD").format("LL"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
scales: {
|
|
|
|
y: [
|
|
|
|
{
|
|
|
|
display: true,
|
|
|
|
ticks: {
|
|
|
|
stepSize: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2023-03-15 17:42:12 +08:00
|
|
|
}
|