diff --git a/apps/dashboard/Gemfile b/apps/dashboard/Gemfile index 65ad4a5b6a..1e9b6cdee2 100644 --- a/apps/dashboard/Gemfile +++ b/apps/dashboard/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '7.0.8.1' +gem 'rails', '7.0.8' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' diff --git a/apps/dashboard/Gemfile.lock b/apps/dashboard/Gemfile.lock index d941a5b720..bedff6ea98 100644 --- a/apps/dashboard/Gemfile.lock +++ b/apps/dashboard/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8.1) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -99,7 +99,8 @@ GEM crass (1.0.6) cssbundling-rails (1.4.0) railties (>= 6.0.0) - dalli (3.2.8) + dalli (3.2.7) + base64 date (3.3.4) domain_name (0.6.20240107) dotenv (2.8.1) @@ -117,7 +118,7 @@ GEM http-accept (1.7.0) http-cookie (1.0.5) domain_name (~> 0.5) - i18n (1.14.4) + i18n (1.14.1) concurrent-ruby (~> 1.0) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -139,15 +140,15 @@ GEM net-imap net-pop net-smtp - marcel (1.0.4) + marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2023.1205) mini_mime (1.1.5) mini_portile2 (2.8.5) - minitest (5.22.3) + minitest (5.22.0) mocha (2.1.0) ruby2_keywords (>= 0.0.5) multi_json (1.15.0) @@ -163,8 +164,8 @@ GEM net-smtp (0.4.0.1) net-protocol netrc (0.11.0) - nio4r (2.7.1) - nokogiri (1.15.6) + nio4r (2.7.0) + nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) ood_appkit (2.1.4) @@ -184,26 +185,26 @@ GEM stringio public_suffix (5.0.4) racc (1.7.3) - rack (2.2.9) + rack (2.2.8.1) rack-protection (3.2.0) base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 7.0.8.1) + railties (= 7.0.8) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -211,15 +212,15 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rake (13.1.0) - rdoc (6.6.3.1) + rdoc (6.6.2) psych (>= 4.0.0) redcarpet (3.6.0) regexp_parser (2.9.0) @@ -261,7 +262,7 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) stringio (3.1.0) - thor (1.3.1) + thor (1.3.0) tilt (2.3.0) timecop (0.9.8) timeout (0.4.1) @@ -275,7 +276,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.6.13) - zip_kit (6.2.1) + zip_kit (6.2.0) PLATFORMS ruby @@ -303,7 +304,7 @@ DEPENDENCIES ood_core (~> 0.24.1) ood_support (~> 0.0.2) pbs (~> 2.2.1) - rails (= 7.0.8.1) + rails (= 7.0.8) redcarpet (~> 3.3) rest-client (~> 2.0) rss (~> 0.2) diff --git a/apps/dashboard/app/javascript/dynamic_forms.js b/apps/dashboard/app/javascript/dynamic_forms.js index cce62fdcb2..6c8d874f0d 100644 --- a/apps/dashboard/app/javascript/dynamic_forms.js +++ b/apps/dashboard/app/javascript/dynamic_forms.js @@ -415,10 +415,10 @@ function updateVisibility(event, changeId) { const val = valueFromEvent(event); const id = event.target['id']; let changeElement = undefined; + $(`#${changeId}`).parents().each(function(_i, parent) { if(parent.classList.contains('form-group')) { changeElement = $(parent); - return false; } }); diff --git a/apps/dashboard/test/system/batch_connect_widgets_test.rb b/apps/dashboard/test/system/batch_connect_widgets_test.rb new file mode 100644 index 0000000000..c4b4ff4b1e --- /dev/null +++ b/apps/dashboard/test/system/batch_connect_widgets_test.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +# TODO: Refactor batch_connect_test.rb to include tests that require slurm +# (testing that things submit) and pull out/write tests for widgets (do not +# require form submission) into this file - perhaps a batch_connect_test/ +# directory + +require 'application_system_test_case' +require 'ood_core/job/adapters/slurm' + +class BatchConnectWidgetsTest < ApplicationSystemTestCase + def setup + stub_sys_apps + stub_user + Configuration.stubs(:bc_dynamic_js).returns(true) + Configuration.stubs(:bc_dynamic_js?).returns(true) #stub the alias too + end + + def stub_git(dir) + Open3.stubs(:capture3) + .with('git', 'describe', '--always', '--tags', chdir: dir) + .returns(['1.2.3', '', exit_success]) + end + + def make_bc_app(dir, form) + SysRouter.stubs(:base_path).returns(Pathname.new(dir)) + app_dir = "#{dir}/app".tap { |d| Dir.mkdir(d) } + stub_scontrol + stub_sacctmgr + stub_git(app_dir) + Pathname.new(app_dir).join('form.yml').write(form) + end + + test 'path_selector can be hidden with data-hide-*' do + Dir.mktmpdir do |dir| + "#{dir}/app".tap { |d| Dir.mkdir(d) } + SysRouter.stubs(:base_path).returns(Pathname.new(dir)) + stub_scontrol + stub_sacctmgr + stub_git("#{dir}/app") + + form = <<~HEREDOC + --- + cluster: + - owens + form: + - path + - hide_path + attributes: + path: + widget: 'path_selector' + directory: "#{Rails.root}" + hide_path: + widget: 'select' + options: + - ['show path', 'show path'] + - ['hide path', 'hide path', data-hide-path: true] + HEREDOC + + Pathname.new("#{dir}/app/").join('form.yml').write(form) + base_id = 'batch_connect_session_context_path' + + visit new_batch_connect_session_context_url('sys/app') + + select('show path', from: 'batch_connect_session_context_hide_path') + assert find('#batch_connect_session_context_path') + assert find("[data-target='#batch_connect_session_context_path_path_selector']") + + select('hide path', from: 'batch_connect_session_context_hide_path') + refute find('#batch_connect_session_context_path', visible: :hidden).visible? + refute find("[data-target='#batch_connect_session_context_path_path_selector']", visible: :hidden).visible? + end + end +end \ No newline at end of file