Skip to content

Fixes #32848 - Support linking to docs.theforeman.org#9756

Merged
adamruzicka merged 1 commit intotheforeman:developfrom
ekohl:32848-doc-url
Nov 9, 2023
Merged

Fixes #32848 - Support linking to docs.theforeman.org#9756
adamruzicka merged 1 commit intotheforeman:developfrom
ekohl:32848-doc-url

Conversation

@ekohl
Copy link
Copy Markdown
Member

@ekohl ekohl commented Jun 27, 2023

An effort is under way to use docs.theforeman.org as the primary documentation source. It is already the official documentation source for Katello, but until now it wasn't easily possible to (correctly) link to it.

The documentation is built in 3 flavors:

  • Katello (index-katello.html)
  • Debian/Ubuntu (index-deb.html)
  • Enterprise Linux (index-el.html)

This is currently untested, but is based on #8613.

@theforeman-bot
Copy link
Copy Markdown
Member

Issues: #32848

Comment thread app/controllers/links_controller.rb Outdated
Comment thread app/helpers/application_helper.rb Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be safe, but I'm not 100% sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine!

Comment thread app/controllers/links_controller.rb Outdated
Comment thread app/helpers/application_helper.rb Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

external_link_url should receive only two parameters: type and options. I think splitting the section out of the options will cause a different output

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? The route is includes the section:

get 'links/:type(/:section)' => 'links#show', :as => 'external_link', :constraints => { section: %r{.*} }

Now I'll immediately admit my knowledge of Rails routing may be lacking, but I don't see a difference between type and section there, other than that section is optional.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you are correct:

[9] pry(main)> external_link_path(type: 'foo', section: 'bar', zzz: 'qqq')
=> "/links/foo/bar?zzz=qqq"

As long as it works - I'm good :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check if passing it without a section also works, but I'm assuming it does.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does. When no section is passed, the final url does not contain a fragment.
So, as expected.

@ekohl ekohl marked this pull request as ready for review October 26, 2023 11:23
Comment thread app/controllers/links_controller.rb Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think generally you don't want to link to other flavors, but this is here so you can do something like "this requires Katello, see katello-flavor".

@ekohl ekohl force-pushed the 32848-doc-url branch 3 times, most recently from edcc0ce to 545d262 Compare October 26, 2023 15:09
@ekohl
Copy link
Copy Markdown
Member Author

ekohl commented Oct 30, 2023

I think this was during the NodeJS 14 migration:

[2023-10-26T15:14:52.894Z] ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.

[test unit]

@ekohl ekohl force-pushed the 32848-doc-url branch 2 times, most recently from 8674e69 to f26bb3e Compare October 31, 2023 15:07
@ekohl
Copy link
Copy Markdown
Member Author

ekohl commented Oct 31, 2023

Now with more tests. I think this is ready now.

Copy link
Copy Markdown
Contributor

@Thorben-D Thorben-D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me...
Thanks, @ekohl

Comment thread app/helpers/application_helper.rb Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine!

Comment thread app/helpers/application_helper.rb Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does. When no section is passed, the final url does not contain a fragment.
So, as expected.

Copy link
Copy Markdown
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nitpicks, but apart from that it works nicely.

Comment thread app/services/foreman/version.rb Outdated
Comment thread app/controllers/links_controller.rb Outdated
adamruzicka
adamruzicka previously approved these changes Nov 7, 2023
Copy link
Copy Markdown
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's get this in

An effort is under way to use docs.theforeman.org as the primary
documentation source. It is already the official documentation source
for Katello, but until now it wasn't easily possible to (correctly) link
to it.

The documentation is built in 3 flavors:

* Katello (index-katello.html)
* Debian/Ubuntu (index-deb.html)
* Enterprise Linux (index-el.html)
@ekohl
Copy link
Copy Markdown
Member Author

ekohl commented Nov 8, 2023

Updated tests to stub installed? so tests should be green now.

@adamruzicka adamruzicka merged commit b566ea8 into theforeman:develop Nov 9, 2023
@adamruzicka
Copy link
Copy Markdown
Contributor

Thank you @ekohl, @Thorben-D & @ShimShtein !

@ekohl ekohl deleted the 32848-doc-url branch November 9, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants