Skip to content

Commit

Permalink
Fixes #37185 - webpack 5 adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga authored and adamruzicka committed Mar 11, 2024
1 parent 08c9dae commit c88cf2c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
17 changes: 12 additions & 5 deletions app/views/job_invocations/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<% title @job_invocation.description %>
<% stylesheet 'foreman_remote_execution/foreman_remote_execution' %>
<% javascript 'foreman_remote_execution/template_invocation' %>
<% javascript *webpack_asset_paths('foreman_remote_execution', :extension => 'js') %>
<%= webpacked_plugins_js_for :foreman_remote_execution %>
<% content_for(:javascripts) do -%>
<% javascript 'foreman_remote_execution/template_invocation' %><% end %>
<% content_for(:stylesheets) do %>
<%= webpacked_plugins_css_for :foreman_remote_execution %>
<% stylesheet 'foreman_remote_execution/foreman_remote_execution' %>
<% end %>

<%= breadcrumbs name_field: 'description' %>
Expand Down Expand Up @@ -47,6 +47,13 @@

<script id="job_invocation_refresh" data-refresh-url="<%= job_invocation_path(@job_invocation) %>">
<% if @auto_refresh %>
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), {});
if(window.allJsLoaded){
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), {})
}
else {
$(document).on('loadJS', function() {
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), {})
});
}
<% end %>
</script>
9 changes: 8 additions & 1 deletion app/views/job_invocations/show.js.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
$('div#title_action div.btn-group').html('<%= button_group(job_invocation_task_buttons(@job_invocation.task)).html_safe %>');

<% if @auto_refresh %>
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), job_invocation_refresh_data());
if(window.allJsLoaded){
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), job_invocation_refresh_data())
}
else {
$(document).on('loadJS', function() {
delayed_refresh($('script#job_invocation_refresh').data('refresh-url'), job_invocation_refresh_data())
});
}
<% end %>
14 changes: 10 additions & 4 deletions app/views/template_invocations/_refresh.js.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<% if @auto_refresh %>
$(function() {
delayed_refresh($("div.terminal").data('refresh-url'),
{"since": "<%= @line_sets.last.try(:[], 'timestamp') || @since %>", "line_counter": $("div.terminal div.line").size()});
});
if(window.allJsLoaded){
delayed_refresh($("div.terminal").data('refresh-url'),
{"since": "<%= @line_sets.last.try(:[], 'timestamp') || @since %>", "line_counter": $("div.terminal div.line").size()})
}
else {
$(document).on('loadJS', function() {
delayed_refresh($("div.terminal").data('refresh-url'),
{"since": "<%= @line_sets.last.try(:[], 'timestamp') || @since %>", "line_counter": $("div.terminal div.line").size()})
});
}
<% end %>

0 comments on commit c88cf2c

Please sign in to comment.