Skip to content

Commit

Permalink
Add documentation links to error messages
Browse files Browse the repository at this point in the history
Linking to two places in the documentation from the two
connection checks we have for storages.
  • Loading branch information
NobodysNightmare committed Jan 7, 2025
1 parent 2e69e08 commit 5070324
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/open_project/static/links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ def links
@links ||= static_links.merge(dynamic_links)
end

def url_for(item)
links.dig(item, :href)
def url_for(*items, anchor: nil)
url = links.dig(*items, :href)
url += "##{anchor}" if anchor.present?
url
end

def has?(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ See COPYRIGHT and LICENSE files for more details.
formatted_health_reason
end
end

health_status_container.with_row(mt: 2) do
render(Primer::Beta::Link.new(href: OpenProject::Static::Links.url_for(:storage_docs, :health_status, anchor: "file-storage-errors-description"))) do |link|
link.with_trailing_visual_icon(icon: 'link-external')
I18n.t("storages.health.ampf_docs_link")
end
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ See COPYRIGHT and LICENSE files for more details.
end

if @result.description.present?
prefix = @result.error_code? ? "#{@result.error_code.upcase}: " : ""
prefix = if @result.error_code?
link_to(
@result.error_code.upcase,
OpenProject::Static::Links.url_for(:storage_docs, :health_status, anchor: "connection-validation"),
target: "_blank"
) + ": "
else
""
end

container.with_row(mt: 2) do
render(Primer::Beta::Text.new(color: :muted, test_selector: "validation-result--description")) do
Expand Down
1 change: 1 addition & 0 deletions modules/storages/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ en:
redirect_uri: Redirect URI
storage_provider: Storage provider
health:
ampf_docs_link: See error documentation
checked: Last checked %{datetime}
connection_validation:
action: Recheck connection
Expand Down

0 comments on commit 5070324

Please sign in to comment.