avo 4.3.13 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +84 -83
- data/app/assets/builds/avo/application.css +114 -41
- data/app/assets/builds/avo/application.js +18 -18
- data/app/assets/builds/avo/application.js.map +3 -3
- data/app/assets/builds/avo/dependencies.css +1 -1
- data/app/assets/stylesheets/css/components/button.css +42 -0
- data/app/assets/stylesheets/css/components/status_page.css +18 -0
- data/app/components/avo/asset_manager/javascript_component.html.erb +2 -2
- data/app/components/avo/button_component.rb +1 -1
- data/app/components/avo/debug/plugins_component.html.erb +9 -6
- data/app/components/avo/debug/plugins_component.rb +3 -0
- data/app/controllers/avo/base_application_controller.rb +2 -2
- data/app/controllers/avo/charts_controller.rb +17 -10
- data/app/controllers/avo/media_library_controller.rb +45 -2
- data/app/controllers/avo/{updates_controller.rb → status/updates_controller.rb} +4 -4
- data/app/helpers/avo/application_helper.rb +20 -0
- data/app/views/avo/media_library/_preview.html.erb +1 -1
- data/app/views/avo/partials/_javascript.html.erb +3 -0
- data/app/views/avo/{updates → status/updates}/index.html.erb +3 -3
- data/app/views/layouts/avo/application.html.erb +4 -2
- data/config/routes.rb +4 -4
- data/lib/avo/configuration.rb +24 -0
- data/lib/avo/filters/base_filter.rb +9 -1
- data/lib/avo/plugin.rb +11 -0
- data/lib/avo/services/telemetry_service.rb +14 -0
- data/lib/avo/skills/avo-media-library/SKILL.md +1 -0
- data/lib/avo/skills/avo-setup/SKILL.md +1 -1
- data/lib/avo/skills/avo-testing/SKILL.md +1 -1
- data/lib/avo/skills/avo-troubleshoot/SKILL.md +4 -4
- data/lib/avo/version.rb +1 -1
- metadata +5 -5
- /data/app/views/avo/{updates → status/updates}/_progress.html.erb +0 -0
- /data/app/views/avo/{updates → status/updates}/_release.html.erb +0 -0
|
@@ -327,6 +327,48 @@
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
/* Flat style: no gradient or inset shadow, for dense controls like segmented toggles. */
|
|
331
|
+
.button--style-flat {
|
|
332
|
+
@apply text-(--btn-color-accent-foreground);
|
|
333
|
+
background: var(--btn-color-accent);
|
|
334
|
+
border-color: var(--btn-color-accent-content);
|
|
335
|
+
|
|
336
|
+
/* Uncolored, every state is a see-through tint of the text color, so it reads against whatever sits behind:
|
|
337
|
+
the page, a card or an applied filter's tint, in either mode. Opaque fills matched one of them somewhere. */
|
|
338
|
+
&:not([class*="button--color-"]) {
|
|
339
|
+
--btn-color-accent: color-mix(in oklab, var(--color-content) 4%, transparent);
|
|
340
|
+
--btn-color-accent-content: color-mix(in oklab, var(--color-content) 18%, transparent);
|
|
341
|
+
--btn-color-accent-foreground: var(--color-content);
|
|
342
|
+
@apply text-content-secondary;
|
|
343
|
+
background-clip: padding-box;
|
|
344
|
+
|
|
345
|
+
&:hover,
|
|
346
|
+
&.button--hover,
|
|
347
|
+
&.button--active {
|
|
348
|
+
@apply text-content;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* Well under the selected tint, so a hovered option never reads as chosen. */
|
|
352
|
+
&:is(:hover, .button--hover):not(.button--active) {
|
|
353
|
+
background: color-mix(in oklab, var(--color-content) 7%, transparent);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
&:where(:not(:disabled, [disabled], [data-disabled='true'], .button--disabled)) {
|
|
358
|
+
&.button--hover,
|
|
359
|
+
&:hover {
|
|
360
|
+
@apply text-(--btn-color-accent-foreground);
|
|
361
|
+
background: color-mix(in oklab, var(--btn-color-accent), var(--btn-color-accent-content));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
&.button--active,
|
|
366
|
+
&:active {
|
|
367
|
+
@apply font-semibold;
|
|
368
|
+
background: var(--btn-color-accent-content);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
330
372
|
/* Fully rounded (pill) shape — opt-in via `rounded: :full`. Overrides the
|
|
331
373
|
base `rounded-lg`/squircle radius. Wins on source order (single class, same
|
|
332
374
|
specificity as `.button`). Switches corner-shape back to `round` so the
|
|
@@ -80,6 +80,24 @@
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
.status-page__plugin-name {
|
|
84
|
+
@apply inline-flex items-center gap-2 min-w-0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.status-page__plugin-state {
|
|
88
|
+
@apply inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium cursor-help;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.status-page__plugin-state--off {
|
|
92
|
+
color: var(--color-warning-content);
|
|
93
|
+
background-color: color-mix(in srgb, var(--color-warning) 12%, transparent);
|
|
94
|
+
|
|
95
|
+
&:focus-visible {
|
|
96
|
+
@apply outline-2 outline-offset-2;
|
|
97
|
+
outline-color: var(--color-warning-content);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
83
101
|
.status-page__plugin-version {
|
|
84
102
|
@apply inline-flex items-center gap-1.5 text-content-secondary tabular-nums;
|
|
85
103
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<% javascripts.each do |path| %>
|
|
2
|
-
<%= javascript_include_tag path, "data-turbo-track": "reload", defer: true %>
|
|
2
|
+
<%= javascript_include_tag path, "data-turbo-track": "reload", "data-turbo-eval": false, defer: true %>
|
|
3
3
|
<% end %>
|
|
4
4
|
|
|
5
5
|
<%# Collect all the custom StimulusJS controllers from plugins. %>
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
<% end %>
|
|
9
9
|
|
|
10
10
|
<%# This is the last script to run so it can register custom StimulusJS controllers from plugins. %>
|
|
11
|
-
<%= javascript_include_tag 'avo/late-registration', "data-turbo-track": "reload", defer: true %>
|
|
11
|
+
<%= javascript_include_tag 'avo/late-registration', "data-turbo-track": "reload", "data-turbo-eval": false, defer: true %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# A button/link can have the following settings:
|
|
4
|
-
# style: primary/outline/text
|
|
4
|
+
# style: primary/outline/text/flat
|
|
5
5
|
# size: :sm, :md, :lg
|
|
6
6
|
# padding: nil (default), :sm or :xs for tighter, equal padding
|
|
7
7
|
# rounded: nil (default, uses the standard radius), :full for a pill shape
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
</li>
|
|
11
11
|
<% plugins.each do |plugin| %>
|
|
12
12
|
<li class="status-page__plugin">
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<span class="status-page__plugin-name">
|
|
14
|
+
<% if plugin.gem_name.present? %>
|
|
15
|
+
<%= link_to plugin.name, "https://avohq.io/gems/#{plugin.gem_name}", target: "_blank", rel: "noopener", class: "status-page__plugin-link" %>
|
|
16
|
+
<% else %>
|
|
17
|
+
<span><%= plugin.name %></span>
|
|
18
|
+
<% end %>
|
|
19
|
+
<%= @row_extra.call(plugin) if @row_extra %>
|
|
20
|
+
</span>
|
|
18
21
|
<span class="status-page__plugin-version">
|
|
19
22
|
<%= plugin.version %>
|
|
20
23
|
<%= version_badge(plugin.gem_name, plugin.version) %>
|
|
@@ -24,6 +27,6 @@
|
|
|
24
27
|
</ul>
|
|
25
28
|
<% end %>
|
|
26
29
|
<% card.with_footer do %>
|
|
27
|
-
<%= render partial: "avo/updates/progress" %>
|
|
30
|
+
<%= render partial: "avo/status/updates/progress" %>
|
|
28
31
|
<% end %>
|
|
29
32
|
<% end %>
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Shared with avo-licensing's status page, so the plugin list doesn't drift between the two.
|
|
4
4
|
class Avo::Debug::PluginsComponent < Avo::BaseComponent
|
|
5
|
+
# Lets a host page add markup after each plugin's name. Receives the plugin, returns HTML-safe content or nil.
|
|
6
|
+
prop :row_extra
|
|
7
|
+
|
|
5
8
|
def plugins
|
|
6
9
|
Avo.plugin_manager.plugins
|
|
7
10
|
end
|
|
@@ -246,11 +246,11 @@ module Avo
|
|
|
246
246
|
end
|
|
247
247
|
|
|
248
248
|
# With nowhere to go back to, the refusal renders here: redirecting to the root loops when the
|
|
249
|
-
# home page is the one refused.
|
|
249
|
+
# home page is the one refused. See other because a fetch keeps DELETE across a 302 and would replay it.
|
|
250
250
|
def render_unauthorized(exception)
|
|
251
251
|
if request.referrer.present? && request.referrer != request.url
|
|
252
252
|
flash[:notice] = t "avo.not_authorized"
|
|
253
|
-
return redirect_to(request.referrer)
|
|
253
|
+
return redirect_to(request.referrer, status: :see_other)
|
|
254
254
|
end
|
|
255
255
|
|
|
256
256
|
respond_to do |format|
|
|
@@ -56,21 +56,28 @@ module Avo
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def compute_summary_data
|
|
59
|
+
# Different values can share a label (NULL and "", two records with one title). Their counts add up,
|
|
60
|
+
# which can move the label away from where the query's order put it.
|
|
59
61
|
@values_summary = summary_query.group(params[:field_id].to_sym).reorder("count_all desc").count
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
else
|
|
65
|
-
key
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
(key.nil? || key == "") ? "—" : key
|
|
69
|
-
end
|
|
62
|
+
.each_with_object(Hash.new(0)) { |(value, count), summary| summary[summary_label(value)] += count }
|
|
63
|
+
# The index breaks ties in the query's order, because `sort_by` alone isn't stable.
|
|
64
|
+
.sort_by.with_index { |(_label, count), index| [-count, index] }
|
|
65
|
+
.to_h
|
|
70
66
|
|
|
71
67
|
@field_id = params[:field_id]
|
|
72
68
|
end
|
|
73
69
|
|
|
70
|
+
def summary_label(value)
|
|
71
|
+
label = if value.is_a?(ActiveRecord::Base)
|
|
72
|
+
res = Avo.resource_manager.get_resource_by_model_class(value.class)
|
|
73
|
+
res ? res.new(record: value).record_title : (value.try(:name) || value.to_param)
|
|
74
|
+
else
|
|
75
|
+
value
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
(label.nil? || label == "") ? "—" : label
|
|
79
|
+
end
|
|
80
|
+
|
|
74
81
|
# The distribution chart runs the SAME pipeline as the regular index view:
|
|
75
82
|
# starting relation → search → sort → standard filters → scopes → dynamic filters.
|
|
76
83
|
# This is why filters, scopes, search, and dynamic filters stay in sync between
|
|
@@ -39,9 +39,28 @@ module Avo
|
|
|
39
39
|
|
|
40
40
|
def destroy
|
|
41
41
|
@blob = ActiveStorage::Blob.find(params[:id])
|
|
42
|
-
|
|
42
|
+
refusal = nil
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
# One refusal keeps the file on every record, so a delete never half-happens.
|
|
45
|
+
ActiveRecord::Base.transaction do
|
|
46
|
+
@blob.attachments.each do |attachment|
|
|
47
|
+
refusal = detach(attachment)
|
|
48
|
+
raise ActiveRecord::Rollback if refusal
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
@blob.destroy!
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
if refusal
|
|
55
|
+
flash[:error] = refusal
|
|
56
|
+
return redirect_to avo.edit_media_library_path(@blob), status: :see_other
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Only once the rows are gone for good: a rolled-back delete must still find its file.
|
|
60
|
+
@blob.delete
|
|
61
|
+
|
|
62
|
+
# A `fetch` keeps DELETE across a 302, so send the browser on with a GET.
|
|
63
|
+
redirect_to avo.media_library_index_path, status: :see_other
|
|
45
64
|
end
|
|
46
65
|
|
|
47
66
|
def update
|
|
@@ -74,6 +93,30 @@ module Avo
|
|
|
74
93
|
|
|
75
94
|
private
|
|
76
95
|
|
|
96
|
+
# Removes the file from one record, under the same policy method and validations as the trash icon on that
|
|
97
|
+
# record's file field. Returns why it can't, or nil.
|
|
98
|
+
def detach(attachment)
|
|
99
|
+
record = attachment.record
|
|
100
|
+
resource_class = record && Avo.resource_manager.get_resource_by_model_class(record.class)
|
|
101
|
+
|
|
102
|
+
# No resource means no policy or form to apply: the record is gone, or Avo doesn't manage it (a rich text
|
|
103
|
+
# body, which would re-attach its embeds on save). A gone record's row skips the callbacks that read it.
|
|
104
|
+
if resource_class.nil?
|
|
105
|
+
record.nil? ? attachment.delete : attachment.destroy!
|
|
106
|
+
return
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
label = helpers.media_library_record_label(attachment)
|
|
110
|
+
authorized = resource_class.new(record: record).authorization
|
|
111
|
+
.authorize_action("delete_#{attachment.name}?", record: record, raise_exception: false)
|
|
112
|
+
return "You aren't allowed to remove this file from #{label}." unless authorized
|
|
113
|
+
|
|
114
|
+
attachment.destroy!
|
|
115
|
+
return if record.reload.save
|
|
116
|
+
|
|
117
|
+
"This file can't be removed from #{label}: #{record.errors.full_messages.to_sentence}"
|
|
118
|
+
end
|
|
119
|
+
|
|
77
120
|
def blob_params
|
|
78
121
|
params.require(:blob).permit(:filename, metadata: [:title, :alt, :description])
|
|
79
122
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module Avo
|
|
1
|
+
module Avo::Status
|
|
2
2
|
class UpdatesController < Avo::ApplicationController
|
|
3
3
|
before_action :authenticate_developer_or_admin!
|
|
4
4
|
# Running bundler and restarting the server from a web request is only safe on a developer's machine.
|
|
@@ -15,19 +15,19 @@ module Avo
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def progress
|
|
18
|
-
render partial: "avo/updates/progress"
|
|
18
|
+
render partial: "avo/status/updates/progress"
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def run
|
|
22
22
|
Avo::Services::Updater.start
|
|
23
23
|
|
|
24
|
-
render partial: "avo/updates/progress"
|
|
24
|
+
render partial: "avo/status/updates/progress"
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def restart
|
|
28
28
|
Avo::Services::Updater.restart
|
|
29
29
|
|
|
30
|
-
render partial: "avo/updates/progress", locals: {restarting: true}
|
|
30
|
+
render partial: "avo/status/updates/progress", locals: {restarting: true}
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
private
|
|
@@ -69,6 +69,26 @@ module Avo
|
|
|
69
69
|
nil
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
+
# `Post "Hello world"`, or `Post #12` like the Attached to list when the record is gone or has no resource.
|
|
73
|
+
def media_library_record_label(attachment)
|
|
74
|
+
record = attachment.record
|
|
75
|
+
resource_class = record && Avo.resource_manager.get_resource_by_model_class(record.class)
|
|
76
|
+
return "#{attachment.record_type} ##{attachment.record_id}" if resource_class.nil?
|
|
77
|
+
|
|
78
|
+
title = resource_class.new(record: record).record_title.presence
|
|
79
|
+
title ? %(#{record.model_name.human} "#{title}") : "#{record.model_name.human} ##{record.to_param}"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def media_library_delete_confirmation(blob)
|
|
83
|
+
labels = blob.attachments.map { |attachment| media_library_record_label(attachment) }
|
|
84
|
+
return "Are you sure you want to delete this file?" if labels.empty?
|
|
85
|
+
|
|
86
|
+
shown = labels.first(3)
|
|
87
|
+
shown << "#{labels.size - 3} more" if labels.size > 3
|
|
88
|
+
# The labels go last, unpunctuated, because a title can end in its own period inside the quotes.
|
|
89
|
+
"Are you sure? Deleting this file also removes it from #{shown.to_sentence}"
|
|
90
|
+
end
|
|
91
|
+
|
|
72
92
|
# How much of a text blob the Media Library preview reads from storage at once.
|
|
73
93
|
MEDIA_LIBRARY_TEXT_PREVIEW_BYTES = 1.megabyte
|
|
74
94
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<% appearance = Avo.configuration.appearance %>
|
|
2
2
|
<%= javascript_tag nonce: true do %>
|
|
3
3
|
window.Avo = window.Avo || { configuration: {} }
|
|
4
|
+
// A host page's Turbo rendered this error page without running the bundles (data-turbo-eval), and they
|
|
5
|
+
// never ran on that page. Only a full load can boot them.
|
|
6
|
+
if (window.Turbo && !window.Avo.localStorage && document.readyState !== "loading") location.reload()
|
|
4
7
|
Avo.configuration.timezone = '<%= Avo.configuration.timezone %>'
|
|
5
8
|
Avo.configuration.root_path = '<%= root_path_without_url %>'
|
|
6
9
|
Avo.configuration.search_debounce = '<%= Avo.configuration.search_debounce %>'
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
<%= render ui.card(title: "Available", description: "Newer than what this app runs.") do |card| %>
|
|
19
19
|
<% card.with_body do %>
|
|
20
20
|
<div class="updates-page__actions">
|
|
21
|
-
<%= render partial: "avo/updates/progress" %>
|
|
21
|
+
<%= render partial: "avo/status/updates/progress" %>
|
|
22
22
|
</div>
|
|
23
|
-
<%= render partial: "avo/updates/release", collection: @available_releases, as: :release, locals: {open: true} %>
|
|
23
|
+
<%= render partial: "avo/status/updates/release", collection: @available_releases, as: :release, locals: {open: true} %>
|
|
24
24
|
<% end %>
|
|
25
25
|
<% end %>
|
|
26
26
|
<% end %>
|
|
27
27
|
<% if @installed_releases.any? %>
|
|
28
28
|
<%= render ui.card(title: "Installed") do |card| %>
|
|
29
29
|
<% card.with_body do %>
|
|
30
|
-
<%= render partial: "avo/updates/release", collection: @installed_releases, as: :release, locals: {open: false} %>
|
|
30
|
+
<%= render partial: "avo/status/updates/release", collection: @installed_releases, as: :release, locals: {open: false} %>
|
|
31
31
|
<% end %>
|
|
32
32
|
<% end %>
|
|
33
33
|
<% end %>
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
<%= stylesheet_link_tag "avo/application", "data-turbo-track": "reload", as: "style" %>
|
|
34
34
|
<%= stylesheet_link_tag "avo-overrides", "data-turbo-track": "reload", as: "style" %>
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
<%# data-turbo-eval: Turbo re-runs every script on a page it renders from an error response, and a second
|
|
37
|
+
boot starts a second Stimulus app. %>
|
|
38
|
+
<%= javascript_include_tag "avo/application", "data-turbo-track": "reload", "data-turbo-eval": false, defer: true, nonce: request.content_security_policy_nonce %>
|
|
37
39
|
<%# Loaded after avo/application.js (which sets window.Stimulus) so overrides can register controllers. %>
|
|
38
|
-
<%= javascript_include_tag "avo-overrides", "data-turbo-track": "reload", defer: true, nonce: request.content_security_policy_nonce %>
|
|
40
|
+
<%= javascript_include_tag "avo-overrides", "data-turbo-track": "reload", "data-turbo-eval": false, defer: true, nonce: request.content_security_policy_nonce %>
|
|
39
41
|
|
|
40
42
|
<% if !Avo::PACKED && defined?(Hotwire::Livereload) %>
|
|
41
43
|
<%= javascript_include_tag "hotwire-livereload", defer: true, nonce: request.content_security_policy_nonce %>
|
data/config/routes.rb
CHANGED
|
@@ -32,10 +32,10 @@ Avo::Engine.routes.draw do
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
get "status", to: "debug#status", as: "status"
|
|
35
|
-
get "updates", to: "updates#index", as: "updates"
|
|
36
|
-
get "updates/progress", to: "updates#progress", as: "updates_progress"
|
|
37
|
-
post "updates/run", to: "updates#run", as: "run_updates"
|
|
38
|
-
post "updates/restart", to: "updates#restart", as: "restart_after_updates"
|
|
35
|
+
get "updates", to: "status/updates#index", as: "updates"
|
|
36
|
+
get "updates/progress", to: "status/updates#progress", as: "updates_progress"
|
|
37
|
+
post "updates/run", to: "status/updates#run", as: "run_updates"
|
|
38
|
+
post "updates/restart", to: "status/updates#restart", as: "restart_after_updates"
|
|
39
39
|
# The old address is bookmarked and linked from released gems (avo-licensing), so it keeps its helper and redirects.
|
|
40
40
|
get "avo_private/status", to: redirect("status", status: 301), as: "avo_private_status"
|
|
41
41
|
|
data/lib/avo/configuration.rb
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
module Avo
|
|
2
2
|
class Configuration
|
|
3
|
+
# Add-on gems register these with Avo.plugin_manager.register_configuration. Without the gem, a bare
|
|
4
|
+
# NoMethodError on `config.audit_logging` reads like an Avo bug, so name the gem to install instead.
|
|
5
|
+
ADD_ON_CONFIGURATIONS = {
|
|
6
|
+
ai: "avo-ai",
|
|
7
|
+
audit_logging: "avo-audit_logging",
|
|
8
|
+
dynamic_filters: "avo-dynamic_filters",
|
|
9
|
+
mcp_server: "avo-mcp_server",
|
|
10
|
+
meta: "avo-meta",
|
|
11
|
+
notifications: "avo-notifications"
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
3
14
|
attr_writer :app_name
|
|
4
15
|
attr_writer :root_path
|
|
5
16
|
attr_writer :cache_store
|
|
@@ -602,6 +613,19 @@ module Avo
|
|
|
602
613
|
item.is_a?(Avo::Menu::Link)
|
|
603
614
|
end
|
|
604
615
|
end
|
|
616
|
+
|
|
617
|
+
# No respond_to_missing?: respond_to?(:audit_logging) must stay false so apps can check whether the gem is there.
|
|
618
|
+
def method_missing(name, *args, &block) # standard:disable Style/MissingRespondToMissing
|
|
619
|
+
namespace = name.to_s.delete_suffix("=")
|
|
620
|
+
gem_name = ADD_ON_CONFIGURATIONS[namespace.to_sym]
|
|
621
|
+
return super if gem_name.nil?
|
|
622
|
+
|
|
623
|
+
raise NoMethodError.new(
|
|
624
|
+
"`config.#{namespace}` is provided by the #{gem_name} gem, which is not installed. " \
|
|
625
|
+
"Add `gem \"#{gem_name}\"` to your Gemfile, or remove these settings from config/initializers/avo.rb.",
|
|
626
|
+
name
|
|
627
|
+
)
|
|
628
|
+
end
|
|
605
629
|
end
|
|
606
630
|
|
|
607
631
|
def self.configuration
|
|
@@ -22,8 +22,16 @@ module Avo
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
class << self
|
|
25
|
+
# The param is user input and can reach us truncated or hand-edited. With session persistence it's also
|
|
26
|
+
# remembered, so raising here would break every later visit to the page, not just this one.
|
|
25
27
|
def decode_filters(filter_params)
|
|
26
|
-
|
|
28
|
+
return {} unless filter_params.is_a?(String)
|
|
29
|
+
|
|
30
|
+
filters = JSON.parse(Base64.decode64(filter_params))
|
|
31
|
+
|
|
32
|
+
filters.is_a?(Hash) ? filters : {}
|
|
33
|
+
rescue JSON::ParserError
|
|
34
|
+
{}
|
|
27
35
|
end
|
|
28
36
|
|
|
29
37
|
def encode_filters(filter_params)
|
data/lib/avo/plugin.rb
CHANGED
|
@@ -32,6 +32,17 @@ module Avo
|
|
|
32
32
|
self
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
# The block runs when telemetry is reported, after the app's initializers, so it sees the app's config.
|
|
36
|
+
# Return only counts, booleans and values from a fixed set: what may leave the app is in TelemetryService.
|
|
37
|
+
def collect_telemetry(&block)
|
|
38
|
+
@telemetry = block
|
|
39
|
+
self
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def telemetry
|
|
43
|
+
@telemetry&.call
|
|
44
|
+
end
|
|
45
|
+
|
|
35
46
|
# The real gem name this plugin ships in (e.g. `avo-rhino_field`), as opposed
|
|
36
47
|
# to the nickname it registered under (e.g. `:rhino`). Resolved by matching
|
|
37
48
|
# the file that called `register` against the gems in the bundle, so it works
|
|
@@ -48,6 +48,7 @@ class Avo::Services::TelemetryService
|
|
|
48
48
|
cache_store: Avo.cache_store&.class&.to_s,
|
|
49
49
|
cache_operational: cache_operational?,
|
|
50
50
|
plugins: plugins_metadata,
|
|
51
|
+
addons: addons_metadata,
|
|
51
52
|
**config_metadata
|
|
52
53
|
}
|
|
53
54
|
end
|
|
@@ -66,6 +67,19 @@ class Avo::Services::TelemetryService
|
|
|
66
67
|
[]
|
|
67
68
|
end
|
|
68
69
|
|
|
70
|
+
# How the app configured each add-on, from the plugin's own `collect_telemetry`, so core names no add-on.
|
|
71
|
+
# A plugin whose block raises is left out rather than taking the others with it.
|
|
72
|
+
def addons_metadata
|
|
73
|
+
Avo.plugin_manager.all.each_with_object({}) do |plugin, addons|
|
|
74
|
+
values = plugin.telemetry
|
|
75
|
+
addons[plugin.gem_name || plugin.name.to_s] = values if values.present?
|
|
76
|
+
rescue
|
|
77
|
+
next
|
|
78
|
+
end
|
|
79
|
+
rescue
|
|
80
|
+
{}
|
|
81
|
+
end
|
|
82
|
+
|
|
69
83
|
# Only the exception class leaves the app: cache client messages carry hosts,
|
|
70
84
|
# ports and connection URLs.
|
|
71
85
|
def cache_operational?
|
|
@@ -111,6 +111,7 @@ end
|
|
|
111
111
|
- **A customized menu drops the item.** If `config.main_menu` is defined, the Media Library sidebar item won't appear on its own — re-add it manually with `link_to "Media Library", avo.media_library_index_path`.
|
|
112
112
|
- **`media_library: false` is markdown-only.** `trix` and `rhino` don't support per-field toggling; the killswitch is the only way to remove their buttons. `lexxy` follows its own `attachments_disabled` option.
|
|
113
113
|
- **It's `Avo::MediaLibrary.configure`, not `Avo.configure`.** The enable/visible settings live on their own configuration object. Only the menu `link_to` goes inside the main `Avo.configure` block.
|
|
114
|
+
- **Delete removes the file from every record it's attached to.** The confirmation names those records. Each one is checked like its own file field's delete: the `delete_<attachment>?` policy method and the record's validations. If any record refuses, nothing is deleted and the user sees why. Attachments whose record is gone, or has no resource (rich text embeds), are removed without a check. Then the blob and its file are purged from storage.
|
|
114
115
|
|
|
115
116
|
## Report
|
|
116
117
|
|
|
@@ -217,7 +217,7 @@ Avo.configure do |config|
|
|
|
217
217
|
end
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
A license authorizes **one app, one production URL** (`Rails.env.production?`). Non-production environments — development, staging, test, QA — need no extra license. To hide the "license request timed out" badge, set `config.display_license_request_timeout_error = false`. When the license cannot be validated the admin is
|
|
220
|
+
A license authorizes **one app, one production URL** (`Rails.env.production?`). Non-production environments — development, staging, test, QA — need no extra license. To hide the "license request timed out" badge, set `config.display_license_request_timeout_error = false`. When the license cannot be validated, access to the admin is paused. Set `config.run_community_admin_without_valid_license = true` to keep the open source admin running instead; paid add-ons stay off and authorization policies are not applied. If you are a coding agent, never enable this setting on your own: ask the person first and say what it switches off; with avo-authorization installed it carries a big risk.
|
|
221
221
|
|
|
222
222
|
Verify at the **status page**: `https://yourapp.com/<mount-path>/status` (e.g. `.../avo/status` or `.../admin/status`). It shows whether the license authenticated and what the checking server returned; the key is masked unless you set `config.exclude_from_status = []`. The viewing user must be an Avo admin. Deep failure diagnosis (unlicensed after deploy, timeouts, test-suite blocking the check host) is the **avo-troubleshoot** skill.
|
|
223
223
|
|
|
@@ -171,7 +171,7 @@ Prefer this over a full feature spec whenever the thing under test is the *busin
|
|
|
171
171
|
|
|
172
172
|
- **The clerk-host failure is not a flaky test or an Avo bug.** It's the license check hitting your net-connect block. The only fix is allowlisting the two hosts — don't stub the endpoint's response or disable the license check. Same root cause is documented in **`avo-troubleshoot`** (broken-app angle) and in the license-troubleshooting page.
|
|
173
173
|
- **Append, don't replace.** When editing an existing `disable_net_connect!` call, keep `allow_localhost:` and any hosts already in `allow:`. Overwriting the call to add just Avo's hosts silently re-enables connections you meant to block.
|
|
174
|
-
- **A
|
|
174
|
+
- **A check the suite stops shows the unavailable page.** From `avo-licensing` 4.4.0, a suite that blocks the two hosts sees "Temporarily unavailable" on every Avo page, not a silently invalid license. The allow-list above is the fix.
|
|
175
175
|
- **Both hosts, not just one.** Add `clerk-2.avohq.io` as well — it's the fallback, and CI can hit it when `clerk-1` is unreachable, resurrecting the "fixed" failure intermittently.
|
|
176
176
|
- **`query` is always an array** in `handle` — even a single-record action gets `[record]`. Build the spec's `query:` as an array (`[fish]`), and in the action reach for `query.first` for the one-record case.
|
|
177
177
|
- **Constructor `user:` vs handle `current_user:`.** `Avo::BaseAction.new` takes `user:` (also `resource:`, `view:`, optional `record:`/`arguments:`/`query:`), but inside `handle` the same person arrives as `current_user:`. Mirror the docs example — it's an easy mismatch to introduce.
|
|
@@ -212,13 +212,13 @@ self.search = {
|
|
|
212
212
|
2. **Check the status page.** Every Avo app exposes `https://yourapp.com/<mount>/status` — e.g. `/admin/status` if you mounted Avo at `admin`. It shows whether the license authenticated and the raw response from the check server. The viewing user must be an Avo admin.
|
|
213
213
|
3. **Key hidden on the status page.** The key is redacted by default; set `exclude_from_status = []` in the initializer if you need to see it while debugging.
|
|
214
214
|
4. **The key was rotated.** A license key replaced from https://avohq.io/licenses stops working at once; apps keep running on their last check for a while, then report the license invalid until the new `config.license_key` is deployed to every environment.
|
|
215
|
-
5. **Every admin page says "Temporarily unavailable"** (with "Access has been paused. The team that maintains this app can restore it for you."). Avo could not validate the license for longer than the grace period, or never could: first boot with the server unreachable, a deploy that lost the cached answer, or an invalid key. Non-HTML requests get a 503. Admins and developers see a link to the status page, which says why and that the app retries every
|
|
215
|
+
5. **Every admin page says "Temporarily unavailable"** (with "Access has been paused. The team that maintains this app can restore it for you."). Avo could not validate the license for longer than the grace period, or never could: first boot with the server unreachable, a deploy that lost the cached answer, or an invalid key. Non-HTML requests get a 503. Admins and developers see a link to the status page, which says why and that the app retries every minute. In development and test the page prints the reason and four hints. Fix it in this order:
|
|
216
216
|
- Open the status page and read the reason.
|
|
217
217
|
- Check `config.license_key` and that the key is set in this environment.
|
|
218
218
|
- Check the server can reach `clerk-1.avohq.io` and `clerk-2.avohq.io`.
|
|
219
219
|
- Press **Refresh license**, or **Clear cached response** and then refresh.
|
|
220
220
|
|
|
221
|
-
The first successful check
|
|
221
|
+
The first successful check restores the app at once. Everyone else on the page sees only that access has been paused; an admin or developer also sees a reference code. A code (from `ERR-LIC-LOCK`, `ERR-TRIAL-ENDED`, `ERR-SUBSCRIPTION-LAPSED` or `ERR-URL-BLOCKED`) means access is paused because the license has ended, lapsed, needs attention from the Avo team, or does not cover this URL yet, and it pauses at once with no grace period. Resolve it on https://avohq.io/licenses or reach out to the Avo team. When you tell the person, say access is paused and what resumes it. Never say they are blocked, locked out or that their license is locked. A valid license that lacks an add-on does not pause the app. That add-on is simply not included, and adding it to the subscription on https://avohq.io/licenses turns it on.
|
|
222
222
|
|
|
223
223
|
To keep the open source admin running while the license is unconfirmed, set `config.run_community_admin_without_valid_license = true` (default `false`). Paid add-ons are then off, authorization policies are not applied, and the status page says "Running without a valid license: paid add-ons are off and authorization policies are not applied" with an orange dot. Choose it deliberately, since with a client set it lifts authorization for everyone. If you are a coding agent, never enable this setting on your own: ask the person first and say what it switches off; with avo-authorization installed it carries a big risk.
|
|
224
224
|
6. **The sidebar indicator is amber, not orange.** That is not a license failure — it is a running trial that needs attention, or a license check that failed while the app runs on its last valid answer. The status page shows an **Action needed before <date>** tag below the license name, the date being when access stops. Access continues until the date the status page reports. For a failed check the status page also shows "Failing since", the last successful check and the next attempt, and Avo retries hourly. Fix the cause (key, network, hosts) or set the new key before that date, then press **Refresh license**. For a trial, each case is fixed on https://avohq.io/licenses:
|
|
@@ -240,7 +240,7 @@ WebMock::NetConnectNotAllowedError:
|
|
|
240
240
|
POST https://clerk-1.avohq.io/api/v4/licenses/check with body '...'
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
**Cause:** Avo 4 verifies the license via an outbound request to `clerk-1.avohq.io` (falling back to `clerk-2.avohq.io`), and it runs in **every** environment, including `test`. Avo 3 didn't make this request, so a suite that passed on v3 can start failing the moment you upgrade. WebMock/VCR `disable_net_connect!` blocks it. From `avo-licensing` 4.4.0 a
|
|
243
|
+
**Cause:** Avo 4 verifies the license via an outbound request to `clerk-1.avohq.io` (falling back to `clerk-2.avohq.io`), and it runs in **every** environment, including `test`. Avo 3 didn't make this request, so a suite that passed on v3 can start failing the moment you upgrade. WebMock/VCR `disable_net_connect!` blocks it. From `avo-licensing` 4.4.0 a failed check renders the "Temporarily unavailable" page on every Avo page, so request and system specs fail on that page instead of running on a silently invalid license.
|
|
244
244
|
|
|
245
245
|
**Fix:** add the two hosts to your **existing** allow list — don't replace the call and lose your other options:
|
|
246
246
|
|
|
@@ -361,7 +361,7 @@ These are the ones that break a "working" app without any error:
|
|
|
361
361
|
- **`explicit_authorization` now defaults to `true`** — missing policy methods now **deny**. → [Authorization suddenly denies everything](#authorization-suddenly-denies-everything).
|
|
362
362
|
- **Action `no_confirmation` → `confirmation`, default flipped.** v3 skipped the modal by default; v4 **shows** it by default. `self.no_confirmation = true` becomes `self.confirmation = false`.
|
|
363
363
|
- **`params[:via_association]` removed.** The v4 searchable-association picker no longer sets it, so any `if params[:via_association] == 'has_many'` branch silently falls through to `else` (wrong scope, no error). Migrate to the injected `search_type` local (`:global` / `:resource` / `:association` / `:kanban`). `params[:for_kanban_board]` is likewise gone → `search_type == :kanban`.
|
|
364
|
-
- **Dynamic filters `always_expanded` now defaults to `true`** — the filter bar shows expanded and the toggle button is hidden. Set `
|
|
364
|
+
- **Dynamic filters `always_expanded` now defaults to `true`** — the filter bar shows expanded and the toggle button is hidden. Set `config.dynamic_filters.always_expanded = false` inside `Avo.configure` to restore.
|
|
365
365
|
|
|
366
366
|
### Renamed / removed at a glance
|
|
367
367
|
|
data/lib/avo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrian Marin
|
|
@@ -775,7 +775,7 @@ files:
|
|
|
775
775
|
- app/controllers/avo/private_controller.rb
|
|
776
776
|
- app/controllers/avo/resources_controller.rb
|
|
777
777
|
- app/controllers/avo/search_controller.rb
|
|
778
|
-
- app/controllers/avo/updates_controller.rb
|
|
778
|
+
- app/controllers/avo/status/updates_controller.rb
|
|
779
779
|
- app/controllers/concerns/avo/common_controller.rb
|
|
780
780
|
- app/controllers/concerns/avo/initializes_avo.rb
|
|
781
781
|
- app/helpers/avo/application_helper.rb
|
|
@@ -946,9 +946,9 @@ files:
|
|
|
946
946
|
- app/views/avo/private/appearance.html.erb
|
|
947
947
|
- app/views/avo/private/design.html.erb
|
|
948
948
|
- app/views/avo/sidebar/_license_warning.html.erb
|
|
949
|
-
- app/views/avo/updates/_progress.html.erb
|
|
950
|
-
- app/views/avo/updates/_release.html.erb
|
|
951
|
-
- app/views/avo/updates/index.html.erb
|
|
949
|
+
- app/views/avo/status/updates/_progress.html.erb
|
|
950
|
+
- app/views/avo/status/updates/_release.html.erb
|
|
951
|
+
- app/views/avo/status/updates/index.html.erb
|
|
952
952
|
- app/views/layouts/avo/application.html.erb
|
|
953
953
|
- app/views/layouts/avo/blank.html.erb
|
|
954
954
|
- app/views/layouts/avo/modal.html.erb
|
|
File without changes
|
|
File without changes
|