ahoy_captain 0.9 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -4
  3. data/app/assets/javascript/ahoy_captain/controllers/active_links_controller.js +19 -3
  4. data/app/assets/javascript/ahoy_captain/controllers/application_controller.js +8 -0
  5. data/app/assets/javascript/ahoy_captain/controllers/combobox_controller.js +341 -0
  6. data/app/assets/javascript/ahoy_captain/controllers/filter_modal_controller.js +45 -0
  7. data/app/assets/javascript/ahoy_captain/controllers/funnel_chart_controller.js +58 -16
  8. data/app/assets/javascript/ahoy_captain/controllers/interval_controller.js +5 -0
  9. data/app/assets/javascript/ahoy_captain/controllers/line_chart_controller.js +170 -19
  10. data/app/assets/javascript/ahoy_captain/controllers/predicate_select_controller.js +0 -1
  11. data/app/assets/javascript/ahoy_captain/controllers/properties_controller.js +8 -0
  12. data/app/assets/javascript/ahoy_captain/controllers/property_filter_controller.js +46 -0
  13. data/app/assets/javascript/ahoy_captain/controllers/realtime_controller.js +4 -2
  14. data/app/assets/javascript/ahoy_captain/controllers/tile_controller.js +9 -0
  15. data/app/assets/javascript/ahoy_captain/helpers/chart_utils.js +156 -0
  16. data/app/assets/javascript/ahoy_captain/helpers/number_formatters.js +55 -0
  17. data/app/components/ahoy_captain/combobox_component.html.erb +33 -0
  18. data/app/components/ahoy_captain/combobox_component.rb +13 -0
  19. data/app/components/ahoy_captain/comparison_link_component.rb +40 -0
  20. data/app/components/ahoy_captain/filter/dropdown_component.html.erb +8 -6
  21. data/app/components/ahoy_captain/filter/modal_component.html.erb +7 -5
  22. data/app/components/ahoy_captain/filter/select_component.html.erb +23 -21
  23. data/app/components/ahoy_captain/filter/select_component.rb +2 -1
  24. data/app/components/ahoy_captain/filter/tag_component.html.erb +1 -1
  25. data/app/components/ahoy_captain/stats/comparable_container_component.html.erb +25 -0
  26. data/app/components/ahoy_captain/stats/comparable_container_component.rb +86 -0
  27. data/app/components/ahoy_captain/stats/container_component.html.erb +13 -6
  28. data/app/components/ahoy_captain/stats/container_component.rb +16 -1
  29. data/app/components/ahoy_captain/sticky_nav_component.html.erb +7 -4
  30. data/app/components/ahoy_captain/sticky_nav_component.rb +3 -0
  31. data/app/components/ahoy_captain/table_component.rb +13 -4
  32. data/app/components/ahoy_captain/tables/devices_table_component.rb +11 -0
  33. data/app/components/ahoy_captain/tables/dynamic_table.rb +13 -0
  34. data/app/components/ahoy_captain/tables/dynamic_table_component.rb +204 -0
  35. data/app/components/ahoy_captain/tables/goals_table_component.rb +17 -0
  36. data/app/components/ahoy_captain/tables/header_component.html.erb +5 -0
  37. data/app/components/ahoy_captain/tables/header_component.rb +18 -0
  38. data/app/components/ahoy_captain/tables/headers/header_component.rb +4 -0
  39. data/app/components/ahoy_captain/tables/properties_table_component.rb +27 -0
  40. data/app/components/ahoy_captain/tables/row_component.html.erb +4 -0
  41. data/app/components/ahoy_captain/tables/rows/row_component.rb +0 -1
  42. data/app/components/ahoy_captain/tile_component.html.erb +19 -9
  43. data/app/components/ahoy_captain/tile_component.rb +2 -1
  44. data/app/controllers/ahoy_captain/application_controller.rb +7 -16
  45. data/app/controllers/ahoy_captain/exports_controller.rb +1 -2
  46. data/app/controllers/ahoy_captain/filters/base_controller.rb +1 -3
  47. data/app/controllers/ahoy_captain/filters/goals_controller.rb +9 -0
  48. data/app/controllers/ahoy_captain/filters/pages/actions_controller.rb +1 -1
  49. data/app/controllers/ahoy_captain/filters/pages/entry_pages_controller.rb +1 -1
  50. data/app/controllers/ahoy_captain/filters/pages/exit_pages_controller.rb +1 -1
  51. data/app/controllers/ahoy_captain/filters/properties/values_controller.rb +4 -4
  52. data/app/controllers/ahoy_captain/filters/utms_controller.rb +1 -1
  53. data/app/controllers/ahoy_captain/properties_controller.rb +41 -0
  54. data/app/controllers/ahoy_captain/stats/base_controller.rb +86 -5
  55. data/app/controllers/ahoy_captain/stats/bounce_rates_controller.rb +1 -1
  56. data/app/controllers/ahoy_captain/stats/total_pageviews_controller.rb +1 -1
  57. data/app/controllers/ahoy_captain/stats/total_visits_controller.rb +1 -1
  58. data/app/controllers/ahoy_captain/stats/unique_visitors_controller.rb +2 -1
  59. data/app/controllers/ahoy_captain/stats/views_per_visits_controller.rb +1 -10
  60. data/app/controllers/ahoy_captain/stats/visit_durations_controller.rb +1 -1
  61. data/app/helpers/ahoy_captain/application_helper.rb +35 -9
  62. data/app/models/ahoy_captain/comparison_mode.rb +72 -0
  63. data/app/models/ahoy_captain/filter_parser.rb +33 -18
  64. data/app/models/ahoy_captain/range_from_params.rb +75 -0
  65. data/app/models/ahoy_captain/rangeable.rb +0 -3
  66. data/app/models/concerns/ahoy_captain/compare_mode.rb +19 -0
  67. data/app/models/concerns/ahoy_captain/limitable.rb +17 -0
  68. data/app/models/concerns/ahoy_captain/range_options.rb +1 -14
  69. data/app/presenters/ahoy_captain/dashboard_presenter.rb +18 -54
  70. data/app/queries/ahoy_captain/application_query.rb +74 -10
  71. data/app/queries/ahoy_captain/event_query.rb +7 -2
  72. data/app/queries/ahoy_captain/stats/average_views_per_visit_query.rb +11 -4
  73. data/app/queries/ahoy_captain/stats/average_visit_duration_query.rb +14 -2
  74. data/app/queries/ahoy_captain/stats/base_query.rb +18 -0
  75. data/app/queries/ahoy_captain/stats/bounce_rates_query.rb +15 -1
  76. data/app/queries/ahoy_captain/stats/total_pageviews_query.rb +2 -2
  77. data/app/queries/ahoy_captain/stats/total_visitors_query.rb +1 -1
  78. data/app/queries/ahoy_captain/stats/unique_visitors_query.rb +1 -1
  79. data/app/queries/ahoy_captain/stats/views_per_visit_query.rb +1 -1
  80. data/app/queries/ahoy_captain/stats/visit_duration_query.rb +3 -3
  81. data/app/queries/ahoy_captain/visit_query.rb +1 -2
  82. data/app/queries/concerns/ahoy_captain/comparable_queries.rb +25 -0
  83. data/app/queries/concerns/ahoy_captain/comparable_query.rb +138 -0
  84. data/app/queries/concerns/ahoy_captain/lazy_comparable_query.rb +42 -0
  85. data/app/views/ahoy_captain/devices/_table.html.erb +1 -4
  86. data/app/views/ahoy_captain/goals/index.html.erb +1 -4
  87. data/app/views/ahoy_captain/layouts/application.html.erb +0 -1
  88. data/app/views/ahoy_captain/properties/_form.html.erb +6 -0
  89. data/app/views/ahoy_captain/properties/index.html.erb +3 -0
  90. data/app/views/ahoy_captain/properties/show.html.erb +6 -0
  91. data/app/views/ahoy_captain/roots/_filters.html.erb +47 -1
  92. data/app/views/ahoy_captain/roots/show.html.erb +60 -31
  93. data/app/views/ahoy_captain/stats/base/index.html.erb +36 -8
  94. data/app/views/ahoy_captain/stats/show.html.erb +8 -10
  95. data/config/routes.rb +2 -0
  96. data/lib/ahoy_captain/ahoy/event_methods.rb +13 -15
  97. data/lib/ahoy_captain/configuration.rb +7 -6
  98. data/lib/ahoy_captain/engine.rb +4 -0
  99. data/lib/ahoy_captain/filters_configuration.rb +5 -1
  100. data/lib/ahoy_captain/version.rb +1 -1
  101. data/lib/ahoy_captain.rb +6 -1
  102. data/lib/generators/ahoy_captain/templates/config.rb.tt +7 -0
  103. metadata +35 -12
  104. data/app/assets/javascript/ahoy_captain/controllers/filter_tag_controller.js +0 -20
  105. data/app/assets/javascript/ahoy_captain/controllers/search_select_controller.js +0 -65
  106. data/app/components/ahoy_captain/tables/headers/devices_header_component.html.erb +0 -3
  107. data/app/components/ahoy_captain/tables/headers/devices_header_component.rb +0 -9
  108. data/app/components/ahoy_captain/tables/headers/goals_header_component.html.erb +0 -6
  109. data/app/components/ahoy_captain/tables/headers/goals_header_component.rb +0 -9
  110. data/app/components/ahoy_captain/tables/rows/devices_row_component.html.erb +0 -5
  111. data/app/components/ahoy_captain/tables/rows/devices_row_component.rb +0 -12
  112. data/app/components/ahoy_captain/tables/rows/goals_row_component.html.erb +0 -11
  113. data/app/components/ahoy_captain/tables/rows/goals_row_component.rb +0 -20
@@ -24,6 +24,10 @@ module Ransack
24
24
  end
25
25
  end
26
26
 
27
+ Ransack.configure do |config|
28
+ config.add_predicate 'json_cont', arel_predicate: 'contains', formatter: proc { |v| JSON.parse(v) }
29
+ config.add_predicate 'json_eq', arel_predicate: 'eq', formatter: proc { |v| JSON.parse(v) }
30
+ end
27
31
 
28
32
  module AhoyCaptain
29
33
  class Engine < Rails::Engine
@@ -30,13 +30,17 @@ module AhoyCaptain
30
30
  filter column: :os_version, label: "OS Version", url: :filters_versions_path, predicates: [:in, :not_in]
31
31
  end
32
32
 
33
- config.register("UTM Tag") do
33
+ config.register("UTM Tags") do
34
34
  filter column: :utm_medium, label: "UTM Medium", url: :filters_utm_mediums_path, predicates: [:in, :not_in]
35
35
  filter column: :utm_source, label: "UTM Source", url: :filters_utm_sources_path, predicates: [:in, :not_in]
36
36
  filter column: :utm_campaign, label: "UTM Campaign", url: :filters_utm_campaigns_path, predicates: [:in, :not_in]
37
37
  filter column: :utm_term, label: "UTM Term", url: :filters_utm_terms_path, predicates: [:in, :not_in]
38
38
  filter column: :utm_content, label: "UTM Content", url: :filters_utm_contents_path, predicates: [:in, :not_in]
39
39
  end
40
+
41
+ config.register("Goal") do
42
+ filter column: :goal, label: "Goal", url: :filters_goals_path, predicates: [:in]
43
+ end
40
44
  end
41
45
  end
42
46
 
@@ -1,3 +1,3 @@
1
1
  module AhoyCaptain
2
- VERSION = "0.9"
2
+ VERSION = "0.10.0"
3
3
  end
data/lib/ahoy_captain.rb CHANGED
@@ -28,11 +28,12 @@ module AhoyCaptain
28
28
  pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
29
29
  pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
30
30
  pin "application", to: "ahoy_captain/application.js", preload: true
31
- pin "slim-select", to: "https://ga.jspm.io/npm:slim-select@2.6.0/dist/slimselect.es.js", preload: true
32
31
  pin "chartkick", to: "chartkick.js"
33
32
  pin "Chart.bundle", to: "Chart.bundle.js"
34
33
  pin "chartjs-plugin-datalabels", to: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2", preload: true
34
+ pin "classnames", to: "https://cdnjs.cloudflare.com/ajax/libs/classnames/2.3.2/index.min.js", preload: true
35
35
  pin_all_from AhoyCaptain::Engine.root.join("app/assets/javascript/ahoy_captain/controllers"), under: "controllers", to: "ahoy_captain/controllers"
36
+ pin_all_from AhoyCaptain::Engine.root.join("app/assets/javascript/ahoy_captain/helpers"), under: "helpers", to: "ahoy_captain/helpers"
36
37
  end
37
38
  end
38
39
 
@@ -51,5 +52,9 @@ module AhoyCaptain
51
52
  def visit
52
53
  @visit ||= config.models[:visit].constantize
53
54
  end
55
+
56
+ def none
57
+ @none ||= OpenStruct.new(text: "(none)", value: "!none!")
58
+ end
54
59
  end
55
60
  end
@@ -80,6 +80,8 @@ AhoyCaptain.configure do |config|
80
80
  #
81
81
  # Set to false to disable custom ranges
82
82
  # config.ranges.custom = true
83
+ #
84
+ # For an interval to be considered "realtime" it must not have a secondary item in the range
83
85
 
84
86
  # ==> Filters
85
87
  #
@@ -160,4 +162,9 @@ AhoyCaptain.configure do |config|
160
162
  # goal :appointment_created
161
163
  # goal :appointment_paid
162
164
  # end
165
+ #
166
+ # => Realtime interval
167
+ # config.realtime_interval = 30.seconds
168
+ #
169
+ # How frequently the page should refresh if the interval is realtime
163
170
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahoy_captain
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - joshmn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-08 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -281,20 +281,28 @@ files:
281
281
  - app/assets/javascript/ahoy_captain/controllers/active_links_controller.js
282
282
  - app/assets/javascript/ahoy_captain/controllers/application.js
283
283
  - app/assets/javascript/ahoy_captain/controllers/application_controller.js
284
+ - app/assets/javascript/ahoy_captain/controllers/combobox_controller.js
284
285
  - app/assets/javascript/ahoy_captain/controllers/details_modal_controller.js
285
286
  - app/assets/javascript/ahoy_captain/controllers/dropdown_label_controller.js
286
287
  - app/assets/javascript/ahoy_captain/controllers/filter/item_controller.js
287
288
  - app/assets/javascript/ahoy_captain/controllers/filter_form_controller.js
288
- - app/assets/javascript/ahoy_captain/controllers/filter_tag_controller.js
289
+ - app/assets/javascript/ahoy_captain/controllers/filter_modal_controller.js
289
290
  - app/assets/javascript/ahoy_captain/controllers/funnel_chart_controller.js
290
291
  - app/assets/javascript/ahoy_captain/controllers/index.js
291
292
  - app/assets/javascript/ahoy_captain/controllers/interval_controller.js
292
293
  - app/assets/javascript/ahoy_captain/controllers/line_chart_controller.js
293
294
  - app/assets/javascript/ahoy_captain/controllers/predicate_select_controller.js
295
+ - app/assets/javascript/ahoy_captain/controllers/properties_controller.js
296
+ - app/assets/javascript/ahoy_captain/controllers/property_filter_controller.js
294
297
  - app/assets/javascript/ahoy_captain/controllers/realtime_controller.js
295
- - app/assets/javascript/ahoy_captain/controllers/search_select_controller.js
298
+ - app/assets/javascript/ahoy_captain/controllers/tile_controller.js
296
299
  - app/assets/javascript/ahoy_captain/controllers/toggle_controller.js
300
+ - app/assets/javascript/ahoy_captain/helpers/chart_utils.js
301
+ - app/assets/javascript/ahoy_captain/helpers/number_formatters.js
297
302
  - app/assets/manifest/ahoy_captain/manifest.js
303
+ - app/components/ahoy_captain/combobox_component.html.erb
304
+ - app/components/ahoy_captain/combobox_component.rb
305
+ - app/components/ahoy_captain/comparison_link_component.rb
298
306
  - app/components/ahoy_captain/dropdown_button_component.html.erb
299
307
  - app/components/ahoy_captain/dropdown_button_component.rb
300
308
  - app/components/ahoy_captain/dropdown_link_component.html.erb
@@ -309,22 +317,24 @@ files:
309
317
  - app/components/ahoy_captain/filter/tag_component.rb
310
318
  - app/components/ahoy_captain/filter/tag_container_component.html.erb
311
319
  - app/components/ahoy_captain/filter/tag_container_component.rb
320
+ - app/components/ahoy_captain/stats/comparable_container_component.html.erb
321
+ - app/components/ahoy_captain/stats/comparable_container_component.rb
312
322
  - app/components/ahoy_captain/stats/container_component.html.erb
313
323
  - app/components/ahoy_captain/stats/container_component.rb
314
324
  - app/components/ahoy_captain/sticky_nav_component.html.erb
315
325
  - app/components/ahoy_captain/sticky_nav_component.rb
316
326
  - app/components/ahoy_captain/table_component.html.erb
317
327
  - app/components/ahoy_captain/table_component.rb
318
- - app/components/ahoy_captain/tables/headers/devices_header_component.html.erb
319
- - app/components/ahoy_captain/tables/headers/devices_header_component.rb
320
- - app/components/ahoy_captain/tables/headers/goals_header_component.html.erb
321
- - app/components/ahoy_captain/tables/headers/goals_header_component.rb
328
+ - app/components/ahoy_captain/tables/devices_table_component.rb
329
+ - app/components/ahoy_captain/tables/dynamic_table.rb
330
+ - app/components/ahoy_captain/tables/dynamic_table_component.rb
331
+ - app/components/ahoy_captain/tables/goals_table_component.rb
332
+ - app/components/ahoy_captain/tables/header_component.html.erb
333
+ - app/components/ahoy_captain/tables/header_component.rb
322
334
  - app/components/ahoy_captain/tables/headers/header_component.html.erb
323
335
  - app/components/ahoy_captain/tables/headers/header_component.rb
324
- - app/components/ahoy_captain/tables/rows/devices_row_component.html.erb
325
- - app/components/ahoy_captain/tables/rows/devices_row_component.rb
326
- - app/components/ahoy_captain/tables/rows/goals_row_component.html.erb
327
- - app/components/ahoy_captain/tables/rows/goals_row_component.rb
336
+ - app/components/ahoy_captain/tables/properties_table_component.rb
337
+ - app/components/ahoy_captain/tables/row_component.html.erb
328
338
  - app/components/ahoy_captain/tables/rows/row_component.html.erb
329
339
  - app/components/ahoy_captain/tables/rows/row_component.rb
330
340
  - app/components/ahoy_captain/tile_component.html.erb
@@ -340,6 +350,7 @@ files:
340
350
  - app/controllers/ahoy_captain/exit_pages_controller.rb
341
351
  - app/controllers/ahoy_captain/exports_controller.rb
342
352
  - app/controllers/ahoy_captain/filters/base_controller.rb
353
+ - app/controllers/ahoy_captain/filters/goals_controller.rb
343
354
  - app/controllers/ahoy_captain/filters/locations_controller.rb
344
355
  - app/controllers/ahoy_captain/filters/operating_systems/names_controller.rb
345
356
  - app/controllers/ahoy_captain/filters/operating_systems/versions_controller.rb
@@ -353,6 +364,7 @@ files:
353
364
  - app/controllers/ahoy_captain/filters/utms_controller.rb
354
365
  - app/controllers/ahoy_captain/funnels_controller.rb
355
366
  - app/controllers/ahoy_captain/goals_controller.rb
367
+ - app/controllers/ahoy_captain/properties_controller.rb
356
368
  - app/controllers/ahoy_captain/realtimes_controller.rb
357
369
  - app/controllers/ahoy_captain/regions_controller.rb
358
370
  - app/controllers/ahoy_captain/roots_controller.rb
@@ -378,10 +390,14 @@ files:
378
390
  - app/decorators/ahoy_captain/source_decorator.rb
379
391
  - app/decorators/ahoy_captain/top_page_decorator.rb
380
392
  - app/helpers/ahoy_captain/application_helper.rb
393
+ - app/models/ahoy_captain/comparison_mode.rb
381
394
  - app/models/ahoy_captain/export.rb
382
395
  - app/models/ahoy_captain/filter_parser.rb
396
+ - app/models/ahoy_captain/range_from_params.rb
383
397
  - app/models/ahoy_captain/rangeable.rb
384
398
  - app/models/ahoy_captain/widget.rb
399
+ - app/models/concerns/ahoy_captain/compare_mode.rb
400
+ - app/models/concerns/ahoy_captain/limitable.rb
385
401
  - app/models/concerns/ahoy_captain/range_options.rb
386
402
  - app/presenters/ahoy_captain/dashboard_presenter.rb
387
403
  - app/presenters/ahoy_captain/funnel_presenter.rb
@@ -398,6 +414,7 @@ files:
398
414
  - app/queries/ahoy_captain/source_query.rb
399
415
  - app/queries/ahoy_captain/stats/average_views_per_visit_query.rb
400
416
  - app/queries/ahoy_captain/stats/average_visit_duration_query.rb
417
+ - app/queries/ahoy_captain/stats/base_query.rb
401
418
  - app/queries/ahoy_captain/stats/bounce_rates_query.rb
402
419
  - app/queries/ahoy_captain/stats/total_pageviews_query.rb
403
420
  - app/queries/ahoy_captain/stats/total_visitors_query.rb
@@ -406,6 +423,9 @@ files:
406
423
  - app/queries/ahoy_captain/stats/visit_duration_query.rb
407
424
  - app/queries/ahoy_captain/top_page_query.rb
408
425
  - app/queries/ahoy_captain/visit_query.rb
426
+ - app/queries/concerns/ahoy_captain/comparable_queries.rb
427
+ - app/queries/concerns/ahoy_captain/comparable_query.rb
428
+ - app/queries/concerns/ahoy_captain/lazy_comparable_query.rb
409
429
  - app/views/ahoy_captain/campaigns/index.html+details.erb
410
430
  - app/views/ahoy_captain/campaigns/index.html.erb
411
431
  - app/views/ahoy_captain/cities/index.html+details.erb
@@ -423,6 +443,9 @@ files:
423
443
  - app/views/ahoy_captain/funnels/show.html.erb
424
444
  - app/views/ahoy_captain/goals/index.html.erb
425
445
  - app/views/ahoy_captain/layouts/application.html.erb
446
+ - app/views/ahoy_captain/properties/_form.html.erb
447
+ - app/views/ahoy_captain/properties/index.html.erb
448
+ - app/views/ahoy_captain/properties/show.html.erb
426
449
  - app/views/ahoy_captain/realtimes/show.html.erb
427
450
  - app/views/ahoy_captain/regions/index.html+details.erb
428
451
  - app/views/ahoy_captain/regions/index.html.erb
@@ -1,20 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus';
2
-
3
- export default class extends Controller {
4
- static targets = ['delete'];
5
-
6
- static values = {
7
- columnPredicate: String,
8
- category: String,
9
- };
10
-
11
- remove(event) {
12
- event.preventDefault();
13
- this.dispatch('remove', {
14
- detail: {
15
- paramKey: `q[${this.columnPredicateValue}]`,
16
- paramValue: this.categoryValue,
17
- },
18
- });
19
- }
20
- }
@@ -1,65 +0,0 @@
1
- import {Controller} from "@hotwired/stimulus"
2
- import SlimSelect from 'slim-select'
3
-
4
- export default class extends Controller {
5
- static values = {
6
- query: String,
7
- url: String,
8
- selected: Array
9
- }
10
-
11
- connect() {
12
- this.loadedInitialData = false;
13
- this.search = this.search.bind(this)
14
- this.select = new SlimSelect({
15
- select: this.element,
16
- data: [],
17
- settings: {
18
- contentPosition: 'relative',
19
- contentLocation: this.element.closest('fieldset'),
20
- searchText: 'Sorry, no results found',
21
- searchPlaceholder: 'Type to populate results',
22
- placeholderText: `Search`,
23
- searchHighlight: true
24
- },
25
- events: {
26
- beforeOpen: async () => {
27
- if (!this.loadedInitialData) {
28
- const data = await this.search("");
29
- this.select.setData(data);
30
- this.loadedInitialData = true
31
- }
32
- },
33
- search: this.search
34
- }
35
- });
36
-
37
- if(this.selectedValue.length) {
38
- this.select.setData(this.selectedValue.map(item => ({ "text": item, "value": item })))
39
- this.select.setSelected(this.selectedValue)
40
- }
41
- }
42
-
43
- async search(query) {
44
- const searchParams = new URLSearchParams(window.location.search);
45
- const formData = new FormData(this.element.form);
46
-
47
- let deleted = [];
48
- for (const [key, value] of formData) {
49
- if(!deleted.includes(key)) {
50
- searchParams.delete(key)
51
- deleted.push(key)
52
- }
53
-
54
- searchParams.append(key, value)
55
- }
56
-
57
- searchParams.delete(this.element.name);
58
- searchParams.set(this.queryValue, query);
59
-
60
- const response = await fetch(`${this.urlValue}?${searchParams.toString()}`);
61
- const data = await response.json();
62
- return data;
63
- }
64
-
65
- }
@@ -1,3 +0,0 @@
1
- <%= render ::AhoyCaptain::Tables::Headers::HeaderComponent.new(category_name: "Device", unit_name: "Visitors") do %>
2
- <span class="w-8 ml-8 text-right">%</span>
3
- <% end %>
@@ -1,9 +0,0 @@
1
- module AhoyCaptain
2
- module Tables
3
- module Headers
4
- class DevicesHeaderComponent < ViewComponent::Base
5
-
6
- end
7
- end
8
- end
9
- end
@@ -1,6 +0,0 @@
1
- <div class="flex text-sm font-bold mb-4">
2
- <span class="grow">Goal</span>
3
- <span class="w-8 ml-8 text-right">Uniques</span>
4
- <span class="w-8 ml-8 text-right">Total</span>
5
- <span class="w-8 ml-8 text-right">CR</span>
6
- </div>
@@ -1,9 +0,0 @@
1
- module AhoyCaptain
2
- module Tables
3
- module Headers
4
- class GoalsHeaderComponent < ViewComponent::Base
5
-
6
- end
7
- end
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- <%= progress_bar(@item.count, @item.total_count, @item.display_name) %>
2
- <%= item do %>
3
- <%= tooltip(@item.count) %>
4
- <% end %>
5
- <%= item(percent_total(@item)) %>
@@ -1,12 +0,0 @@
1
- module AhoyCaptain
2
- module Tables
3
- module Rows
4
- class DevicesRowComponent < RowComponent
5
-
6
- def total
7
- @item.total_count
8
- end
9
- end
10
- end
11
- end
12
- end
@@ -1,11 +0,0 @@
1
- <%= progress_bar(@item.cr, 100, link_to(@item.name, url, target: :_top)) %>
2
- <%= item do %>
3
- <%= tooltip(@item.unique_visits) %>
4
- <% end %>
5
- <%= item do %>
6
- <%= tooltip(@item.total_events) %>
7
- <% end %>
8
- <%= item do %>
9
- <%= tooltip(@item.cr) %>
10
- <% end %>
11
-
@@ -1,20 +0,0 @@
1
- module AhoyCaptain
2
- module Tables
3
- module Rows
4
- class GoalsRowComponent < RowComponent
5
- def search_params
6
- view_context.search_params
7
- end
8
-
9
- def url
10
- query = search_params.dup.merge(q: { goal_in: @item.goal_id}).to_query
11
- AhoyCaptain::Engine.app.url_helpers.root_path + "?#{query}"
12
- end
13
-
14
- def total
15
- @item.total_count
16
- end
17
- end
18
- end
19
- end
20
- end