-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2603 from ujh/track-user-agents
Keep track of user agents
- Loading branch information
Showing
13 changed files
with
172 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import Highcharts from "highcharts"; | ||
import HighchartsReact from "highcharts-react-official"; | ||
|
||
import { Spinner } from "../components/Spinner"; | ||
import { getRequest } from "../../fetch"; | ||
|
||
export const UserAgents = () => { | ||
const [data, setData] = useState(null); | ||
useEffect(() => { | ||
getRequest("/admins/graphs/user-agents.json") | ||
.then((res) => res.json()) | ||
.then((json) => setData(json)); | ||
}, []); | ||
if (data) { | ||
const options = { | ||
chart: { type: "spline" }, | ||
legend: { enabled: true }, | ||
series: data, | ||
title: { text: "User Agents" }, | ||
xAxis: { | ||
type: "datetime" | ||
}, | ||
yAxis: { title: { text: "" } } | ||
}; | ||
return ( | ||
<div> | ||
<HighchartsReact highcharts={Highcharts} options={options} /> | ||
</div> | ||
); | ||
} else { | ||
return ( | ||
<div> | ||
<Spinner /> | ||
</div> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#graphs { | ||
.row { | ||
box-shadow: none; | ||
.row div { | ||
margin-bottom: 5px; | ||
} | ||
|
||
.loader { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class UserAgent < ApplicationRecord | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class CreateUserAgents < ActiveRecord::Migration[8.0] | ||
def change | ||
create_table :user_agents do |t| | ||
t.string :name | ||
t.string :raw_name | ||
t.date :day | ||
|
||
t.index %i[name day] | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FactoryBot.define do | ||
factory :user_agent do | ||
name { "MyString" } | ||
raw_name { "MyString" } | ||
day { "2025-01-07" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe UserAgent, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |