forked from HyperCable/hypercable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
189 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the browsers controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: https://sass-lang.com/ |
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,3 @@ | ||
// Place all the styles related to the device_types controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: https://sass-lang.com/ |
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,3 @@ | ||
// Place all the styles related to the oses controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: https://sass-lang.com/ |
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class BrowsersController < ApplicationController | ||
layout "detail" | ||
|
||
def index | ||
@site = current_user.sites.find_by!(uuid: params[:site_id]) | ||
|
||
base = QueryBuilder.call(Hyper::Event, @site, params).result | ||
current_scope = QueryBuilder.call(Hyper::Event, @site, period: "realtime").result | ||
@current_visitors_count = current_scope.distinct.count(:client_id) | ||
@top_browsers = base | ||
.where(event_name: "page_view") | ||
.select("browser, count(distinct client_id) as visitors_count, count(*) as count, count(distinct session_id) as sessions_count") | ||
.group("site_id, browser").order("2 desc").limit(100) | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class DeviceTypesController < ApplicationController | ||
layout "detail" | ||
|
||
def index | ||
@site = current_user.sites.find_by!(uuid: params[:site_id]) | ||
|
||
base = QueryBuilder.call(Hyper::Event, @site, params).result | ||
current_scope = QueryBuilder.call(Hyper::Event, @site, period: "realtime").result | ||
@current_visitors_count = current_scope.distinct.count(:client_id) | ||
@top_device_types = base | ||
.where(event_name: "page_view") | ||
.select("device_type, count(distinct client_id) as visitors_count, count(*) as count, count(distinct session_id) as sessions_count") | ||
.group("site_id, device_type").order("2 desc").limit(100) | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class OsesController < ApplicationController | ||
layout "detail" | ||
|
||
def index | ||
@site = current_user.sites.find_by!(uuid: params[:site_id]) | ||
|
||
base = QueryBuilder.call(Hyper::Event, @site, params).result | ||
current_scope = QueryBuilder.call(Hyper::Event, @site, period: "realtime").result | ||
@current_visitors_count = current_scope.distinct.count(:client_id) | ||
@top_oses = base | ||
.where(event_name: "page_view") | ||
.select("os, count(distinct client_id) as visitors_count, count(*) as count, count(distinct session_id) as sessions_count") | ||
.group("site_id, os").order("2 desc").limit(100) | ||
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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module BrowsersHelper | ||
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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module DeviceTypesHelper | ||
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,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module OsesHelper | ||
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,28 @@ | ||
<div class="dark:bg-gray-800"> | ||
<h1 class="text-xl font-bold dark:text-gray-100">Top Browsers</h1> | ||
<div class="my-4 border-b border-gray-300"> | ||
|
||
</div> | ||
<main class="modal__content"> | ||
<table class="w-full table-striped table-fixed"> | ||
<thead> | ||
<tr> | ||
<th class="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Browser</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Visitors</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Pageviews</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Sessions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @top_browsers.each do |agg| %> | ||
<tr class="text-sm dark:text-gray-200"> | ||
<td class="p-2"><%= agg.browser %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.visitors_count %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.count %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.sessions_count %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</main> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div class="dark:bg-gray-800"> | ||
<h1 class="text-xl font-bold dark:text-gray-100">Top Device Types</h1> | ||
<div class="my-4 border-b border-gray-300"> | ||
|
||
</div> | ||
<main class="modal__content"> | ||
<table class="w-full table-striped table-fixed"> | ||
<thead> | ||
<tr> | ||
<th class="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">Device Type</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Visitors</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Pageviews</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Sessions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @top_device_types.each do |agg| %> | ||
<tr class="text-sm dark:text-gray-200"> | ||
<td class="p-2"><%= agg.device_type %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.visitors_count %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.count %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.sessions_count %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</main> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div class="dark:bg-gray-800"> | ||
<h1 class="text-xl font-bold dark:text-gray-100">Top Operating Systems</h1> | ||
<div class="my-4 border-b border-gray-300"> | ||
|
||
</div> | ||
<main class="modal__content"> | ||
<table class="w-full table-striped table-fixed"> | ||
<thead> | ||
<tr> | ||
<th class="p-2 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="left">OS</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Visitors</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Pageviews</th> | ||
<th class="p-2 w-32 text-xs tracking-wide font-bold text-gray-500 dark:text-gray-400" align="right">Sessions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @top_oses.each do |agg| %> | ||
<tr class="text-sm dark:text-gray-200"> | ||
<td class="p-2"><%= agg.os %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.visitors_count %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.count %></td> | ||
<td class="p-2 w-32 font-medium" align="right"><%= pretty_num agg.sessions_count %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</main> | ||
</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
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class BrowsersControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# 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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class DeviceTypesControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# 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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class OsesControllerTest < ActionDispatch::IntegrationTest | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |