Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack5 #10735

Merged
merged 1 commit into from
Jan 26, 2024
Merged

webpack5 #10735

merged 1 commit into from
Jan 26, 2024

Conversation

MariaAga
Copy link
Contributor

<% if File.exist?("#{Bastion::Engine.root}/vendor/assets/javascripts/#{Bastion.localization_path(I18n.locale)}") %>
<%= javascript_include_tag(Bastion.localization_path(I18n.locale)) %>
<% end %>
<script type="text/javascript">
<script type="module">
Copy link
Member

Choose a reason for hiding this comment

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

What defines this type? Is it webpack itself or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looked more correct to use module than text/javascript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

@ianballou
Copy link
Member

Foreman PR: theforeman/foreman#9834

@MariaAga MariaAga marked this pull request as ready for review November 29, 2023 11:41
engines/bastion/app/views/bastion/layouts/assets.html.erb Outdated Show resolved Hide resolved
@@ -10,11 +10,13 @@
<% end %>

<% content_for(:javascripts) do %>
<%= javascript_include_tag 'bastion/bastion' %>

<%= javascript_tag("window.tfm.tools.loadPluginModule('/webpack/katello','katello','./common_index');".html_safe) %>
Copy link
Member

Choose a reason for hiding this comment

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

This looks very similar to what js_tags_for(requested_plugins) already does for katello, except that this calls it for common_index and the other does it for index.

I'm trying to understand what common_index.js even does. I don't see anything that includes it and it only requires ngreact. If you don't have this, what happens? If it's needed, can it just be moved into katello's index.js?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It loads angular, and since angular is not needed in all of Katello I think we shouldn't move it to index.
Without angular pages are just empty.

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense. Thanks for explaining.

@jeremylenz
Copy link
Member

See theforeman/foreman#9834 (comment)

If this is ready to go, please create a Redmine. thanks!

@jeremylenz
Copy link
Member

looks like angular is failing on eslint

@ekohl
Copy link
Member

ekohl commented Jan 26, 2024

Core PR was merged, so this should be merged.

@jeremylenz jeremylenz merged commit 7091b11 into Katello:master Jan 26, 2024
6 checks passed
@@ -14,12 +14,6 @@ class Engine < ::Rails::Engine

Bastion.register_plugin(
:name => 'bastion_katello',
:javascript => proc do
[
javascript_include_tag(*webpack_asset_paths('katello:common', :extension => 'js'), "data-turbolinks-track" => true),
Copy link
Member

Choose a reason for hiding this comment

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

This broke the "Sync Status" (/katello/sync_management) page, as the console now contains the following error:

63:2 Uncaught ReferenceError: localize is not defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking into that

Copy link
Member

Choose a reason for hiding this comment

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

That's an ERB page, I wonder why we're even loading Katello JS here 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created #10873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants