From cbd1ced15bfd88eee6bf72c9b86b680185fb5843 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Tue, 21 Dec 2021 13:36:49 -0500 Subject: [PATCH] backport 1676 to 2.0 release (#1677) --- CHANGELOG.md | 10 +++++++++- .../app/javascript/packs/batchConnect.js | 2 +- .../sys_with_gateway_apps/bc_jupyter/form.yml | 3 +++ .../test/system/batch_connect_test.rb | 19 ++++++++++++++++++- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 523e17a0b2..edb105da7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [2.0.22] - 2021-12-21 + +### Fixed + +- Back-ported [1676](https://github.com/OSC/ondemand/pull/1676) to correctly hide options + with hyphens. + ## [2.0.21] - 2021-12-20 ### Fixed @@ -944,7 +951,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - From 1.3.7 - 1.4.2 updated app versions -[Unreleased]: https://github.com/OSC/ondemand/compare/v2.0.21...release_2.0 +[Unreleased]: https://github.com/OSC/ondemand/compare/v2.0.22...release_2.0 +[2.0.22]: https://github.com/OSC/ondemand/compare/v2.0.21...v2.0.22 [2.0.21]: https://github.com/OSC/ondemand/compare/v2.0.20...v2.0.21 [2.0.20]: https://github.com/OSC/ondemand/compare/v2.0.19...v2.0.20 [2.0.19]: https://github.com/OSC/ondemand/compare/v2.0.18...v2.0.19 diff --git a/apps/dashboard/app/javascript/packs/batchConnect.js b/apps/dashboard/app/javascript/packs/batchConnect.js index aaafb00787..792f3524a7 100644 --- a/apps/dashboard/app/javascript/packs/batchConnect.js +++ b/apps/dashboard/app/javascript/packs/batchConnect.js @@ -26,7 +26,7 @@ const setValueLookup = {}; const hideLookup = {}; // the regular expression for mountain casing -const mcRex = /[[-_]([a-z])|([_-][0-9])/g; +const mcRex = /[-_]([a-z])|([_-][0-9])/g; function bcElement(name) { return `${bcPrefix}_${name.toLowerCase()}`; diff --git a/apps/dashboard/test/fixtures/sys_with_gateway_apps/bc_jupyter/form.yml b/apps/dashboard/test/fixtures/sys_with_gateway_apps/bc_jupyter/form.yml index ccc68b1063..9086ee55ae 100644 --- a/apps/dashboard/test/fixtures/sys_with_gateway_apps/bc_jupyter/form.yml +++ b/apps/dashboard/test/fixtures/sys_with_gateway_apps/bc_jupyter/form.yml @@ -77,16 +77,19 @@ attributes: - [ "2.7", data-option-for-node-type-advanced: false, + data-option-for-node-type-other-40ish-option: false, data-set-bc-account: 'python27' ] - [ "3.1", data-option-for-node-type-advanced: false, + data-option-for-node-type-other-40ish-option: false, data-set-bc-account: 'python31' ] - [ "3.2", data-option-for-node-type-advanced: false, + data-option-for-node-type-other-40ish-option: false, data-set-bc-account: 'python32' ] - [ diff --git a/apps/dashboard/test/system/batch_connect_test.rb b/apps/dashboard/test/system/batch_connect_test.rb index 2568fdd86e..401100ca06 100644 --- a/apps/dashboard/test/system/batch_connect_test.rb +++ b/apps/dashboard/test/system/batch_connect_test.rb @@ -349,7 +349,7 @@ def setup assert find("##{bc_ele_id('advanced_options')}").visible? end - test 'options with hyphens' do + test 'options with hyphens set min & max' do visit new_batch_connect_session_context_url('sys/bc_jupyter') # defaults @@ -365,6 +365,23 @@ def setup assert_equal 48, find_max('bc_num_slots') end + test 'options with hyphens get hidden' do + visit new_batch_connect_session_context_url('sys/bc_jupyter') + + # defaults + assert_equal 'owens', find_value('cluster') + assert_equal 'any', find_value('node_type') + assert_equal '2.7', find_value('python_version') + + # now switch node type and find that 2.7, and more, are hidden and 3.6 is the choice now + # even when the options has hyphens in it + select('other-40ish-option', from: bc_ele_id('node_type')) + assert_equal 'display: none;', find_option_style('python_version', '2.7') + assert_equal 'display: none;', find_option_style('python_version', '3.1') + assert_equal 'display: none;', find_option_style('python_version', '3.2') + assert_equal '3.6', find("##{bc_ele_id('python_version')}").value + end + test 'options with numbers' do visit new_batch_connect_session_context_url('sys/bc_jupyter')