From 49fcc54fa34ac431defbea80c0f223e69dfce35f Mon Sep 17 00:00:00 2001 From: MariaAga Date: Mon, 22 Jul 2024 15:53:49 +0200 Subject: [PATCH] Fixes #37673 - Refactor deprecated jquery functions --- app/assets/javascripts/foreman_openscap/arf_reports.js | 6 +++--- app/assets/javascripts/foreman_openscap/policy_edit.js | 2 +- app/assets/javascripts/foreman_openscap/reports.js | 2 +- lib/foreman_openscap/engine.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/foreman_openscap/arf_reports.js b/app/assets/javascripts/foreman_openscap/arf_reports.js index c5c6533c0..e49b5cf2a 100644 --- a/app/assets/javascripts/foreman_openscap/arf_reports.js +++ b/app/assets/javascripts/foreman_openscap/arf_reports.js @@ -1,8 +1,8 @@ function readFromCookie() { try { - var r = $.cookie(cookieName); + var r = tfm.Cookies.get(cookieName); if (r) { - return $.parseJSON(r); + return JSON.parse(r); } return []; } catch (err) { @@ -12,7 +12,7 @@ function readFromCookie() { } function removeCookie() { - $.removeCookie(cookieName); + tfm.Cookies.remove(cookieName); } var cookieName = '_ForemanSelected' + window.location.pathname.replace(/\//, ''); diff --git a/app/assets/javascripts/foreman_openscap/policy_edit.js b/app/assets/javascripts/foreman_openscap/policy_edit.js index c051eb53a..557e60ea7 100644 --- a/app/assets/javascripts/foreman_openscap/policy_edit.js +++ b/app/assets/javascripts/foreman_openscap/policy_edit.js @@ -30,7 +30,7 @@ function tailoring_file_selected(element) { function previous_step(previous) { $('#policy_current_step').val(previous); - $('#new_policy').submit(); + $('#new_policy').trigger("submit"); } function period_selected(period) { diff --git a/app/assets/javascripts/foreman_openscap/reports.js b/app/assets/javascripts/foreman_openscap/reports.js index ad63be36b..7214f102a 100644 --- a/app/assets/javascripts/foreman_openscap/reports.js +++ b/app/assets/javascripts/foreman_openscap/reports.js @@ -7,5 +7,5 @@ function showReportDetails(log_id, event) { function showRemediationWizard(log_id) { var wizard_button = $('#openscapRemediationWizardButton'); wizard_button.attr('data-log-id', log_id); - wizard_button.click(); + wizard_button.trigger("click"); } diff --git a/lib/foreman_openscap/engine.rb b/lib/foreman_openscap/engine.rb index 318f72d11..1d7cb8ff5 100644 --- a/lib/foreman_openscap/engine.rb +++ b/lib/foreman_openscap/engine.rb @@ -40,7 +40,7 @@ class Engine < ::Rails::Engine initializer 'foreman_openscap.register_plugin', :before => :finisher_hook do |app| app.reloader.to_prepare do Foreman::Plugin.register :foreman_openscap do - requires_foreman '>= 3.13' + requires_foreman '>= 3.14' register_gettext apipie_documented_controllers ["#{ForemanOpenscap::Engine.root}/app/controllers/api/v2/compliance/*.rb"]