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

Fix flash button after upgrade to Bootstrap 5 #3592

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dashboard/app/javascript/products_show.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const id = 'product_cli_modal';
const spinnerId = `${id}_spinner`;
const headerId = `${id}_header`;
const buttonId = `${id}_button`;
const closeButton = `<button id="${buttonId}" class="close float-end" data-bs-dismiss="modal">&times;</button>`;
const closeButton = `<button id="${buttonId}" class="btn-close float-end" data-bs-dismiss="modal"></button>`;

jQuery(function(){
$('[data-toggle="cli"]').on('click', (event) => updateModal(event));
Expand Down Expand Up @@ -43,7 +43,7 @@ function updateModal(event){

xhr.onloadend = function() {
$(`#${spinnerId}`).replaceWith(`
<button class="close float-end" data-dismiss="modal">&times;</button>
<button class="btn-close float-end" data-bs-dismiss="modal">&times;</button>
`);
if (this.status != 200) {
$(`#${id} .product-cli-body`).html(`${header}A fatal error has occurred`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
<div class="modal-content">
<div class="modal-header">
<div class="modal-title h5" id="formPrefillErrorLabel"><%= t('dashboard.batch_connect_form_prefill_error') %></div>
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('dashboard.close') %>">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="<%= t('dashboard.close') %>"></button>
</div>
<div class="modal-body" id="batch_connect_session_template_form_error_modal_body"></div>
</div>
Expand All @@ -29,9 +27,7 @@
<div class="modal-content">
<div class="modal-header">
<div class="modal-title h5" id="chooseTemplateNameLabel"><%= t('dashboard.batch_connect_form_choose_template_name') %></div>
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('dashboard.close') %>">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="<%= t('dashboard.close') %>"></button>
</div>
<div class="modal-body">
<select class="form-control selectpicker" id="modal_input_template_name">
Expand All @@ -44,7 +40,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="batch_connect_session_template_choose_name_button"><%= t('dashboard.save') %></button>
<button type="button" class="btn btn-danger" data-dismiss="modal"><%= t('dashboard.close') %></button>
<button type="button" class="btn btn-danger" data-bs-dismiss="modal"><%= t('dashboard.close') %></button>
</div>
</div>
</div>
Expand All @@ -55,9 +51,7 @@
<div class="modal-content">
<div class="modal-header">
<div class="modal-title h5"><%= t('dashboard.batch_connect_form_type_new_name_error') %></div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ locals: {

<%- if @session && @session.errors.any? -%>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>

<% @session.errors.each do |error| %>
<% if error.attribute == :submit %>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/views/files/_copy_move_popup.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#if files}}
<div class="card mb-3">
<div class="card-body">
<button id="clipboard-clear" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<button id="clipboard-clear" type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
<p class="mt-4">Copy or move the files below from <code>{{from}}</code> to the current directory:</p>
</div>
<ul class="list-group list-group-flush">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<pre class="card-body">{{error_message}}</pre>
</div>
</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{{else}}
{{> defaultLabel}}
Expand Down
3 changes: 1 addition & 2 deletions apps/dashboard/app/views/layouts/_browser_warning.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<% if !browser.modern? %>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<button type="button" class="btn-close" data-bs-dismiss="alert">
<span class="sr-only">Close</span>
</button>
OnDemand requires a newer version of the browser you are using.
Expand Down
11 changes: 4 additions & 7 deletions apps/dashboard/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@

<div id="js-alert-danger-template" class="d-none" aria-hidden="true">
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<button type="button" class="btn-close" data-bs-dismiss="alert">
<span class="sr-only">Close</span>
</button>
ALERT_MSG
Expand All @@ -87,18 +86,16 @@

<% if alert %>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<button type="button" class="btn-close" data-bs-dismiss="alert">
<span class="sr-only">Close</span>
</button>
<%= alert %>
</div>
<% end %>

<% if notice %>
<div class="alert alert-success" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert">
<span class="sr-only">Close</span>
</button>
<%= notice %>
Expand Down
8 changes: 3 additions & 5 deletions apps/dashboard/app/views/layouts/editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,16 @@

<% if alert %>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<button type="button" class="btn-close" data-bs-dismiss="alert">
<span class="sr-only">Close</span>
</button>
<%= alert %>
</div>
<% end %>

<% if notice %>
<div class="alert alert-success" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<div class="alert alert-success alert-dismissible role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert">
<span class="sr-only">Close</span>
</button>
<%= notice %>
Expand Down
6 changes: 2 additions & 4 deletions apps/dashboard/app/views/shared/_path_selector_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-path-selector-title">Select Your Working Directory</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">

Expand Down Expand Up @@ -67,7 +65,7 @@
</div>
</div>
<div class="modal-footer sticky-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="<%= button_id %>">Select Path</button>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions apps/dashboard/test/system/project_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def add_auto_environment_variable(project_id, script_id, save: true)
HEREDOC

success_message = I18n.t('dashboard.jobs_scripts_created')
assert_selector('.alert-success', text: "×\nClose\n#{success_message}")
assert_selector('.alert-success', text: "Close\n#{success_message}")
assert_equal(expected_yml, File.read("#{dir}/projects/#{project_id}/.ondemand/scripts/#{script_id}/form.yml"))

launcher_path = project_launcher_path(project_id, script_id)
Expand Down Expand Up @@ -304,7 +304,7 @@ def add_auto_environment_variable(project_id, script_id, save: true)
HEREDOC

success_message = I18n.t('dashboard.jobs_scripts_created')
assert_selector('.alert-success', text: "×\nClose\n#{success_message}")
assert_selector('.alert-success', text: "Close\n#{success_message}")
assert_equal(expected_yml, File.read("#{dir}/projects/#{project_id}/.ondemand/scripts/#{script_id}/form.yml"))
end
end
Expand Down Expand Up @@ -475,7 +475,7 @@ def add_auto_environment_variable(project_id, script_id, save: true)
.returns(['', 'some error message', exit_failure])

click_on 'Launch'
assert_selector('.alert-danger', text: "×\nClose\nsome error message")
assert_selector('.alert-danger', text: "Close\nsome error message")
assert_nil YAML.safe_load(File.read("#{script_dir}/job_history.log"))
end
end
Expand Down Expand Up @@ -552,7 +552,7 @@ def add_auto_environment_variable(project_id, script_id, save: true)
# correctly saves
click_on(I18n.t('dashboard.save'))
success_message = I18n.t('dashboard.jobs_scripts_updated')
assert_selector('.alert-success', text: "×\nClose\n#{success_message}")
assert_selector('.alert-success', text: "Close\n#{success_message}")
assert_current_path project_path(project_id)

# note that bc_num_hours has default, min & max
Expand Down Expand Up @@ -639,7 +639,7 @@ def add_auto_environment_variable(project_id, script_id, save: true)
# correctly saves
click_on(I18n.t('dashboard.save'))
success_message = I18n.t('dashboard.jobs_scripts_updated')
assert_selector('.alert-success', text: "×\nClose\n#{success_message}")
assert_selector('.alert-success', text: "Close\n#{success_message}")
assert_current_path project_path(project_id)

expected_yml = <<~HEREDOC
Expand Down Expand Up @@ -708,27 +708,27 @@ def add_auto_environment_variable(project_id, script_id, save: true)
test 'cant create script when project is invalid' do
visit edit_project_launcher_path('1', '1')
assert_current_path('/projects')
assert_selector('.alert-danger', text: "×\nClose\nCannot find project: 1")
assert_selector('.alert-danger', text: "Close\nCannot find project: 1")
end

test 'cant show script when project is invalid' do
visit project_launcher_path('1', '1')
assert_current_path('/projects')
assert_selector('.alert-danger', text: "×\nClose\nCannot find project: 1")
assert_selector('.alert-danger', text: "Close\nCannot find project: 1")
end

test 'cant edit script when project is invalid' do
visit edit_project_launcher_path('1', '1')
assert_current_path('/projects')
assert_selector('.alert-danger', text: "×\nClose\nCannot find project: 1")
assert_selector('.alert-danger', text: "Close\nCannot find project: 1")
end

test 'cant show invalid script' do
Dir.mktmpdir do |dir|
project_id = setup_project(dir)
visit project_launcher_path(project_id, '1')
assert_current_path("/projects/#{project_id}")
assert_selector('.alert-danger', text: "×\nClose\nCannot find script 1")
assert_selector('.alert-danger', text: "Close\nCannot find script 1")
end
end

Expand All @@ -737,7 +737,7 @@ def add_auto_environment_variable(project_id, script_id, save: true)
project_id = setup_project(dir)
visit edit_project_launcher_path(project_id, '1')
assert_current_path("/projects/#{project_id}")
assert_selector('.alert-danger', text: "×\nClose\nCannot find script 1")
assert_selector('.alert-danger', text: "Close\nCannot find script 1")
end
end

Expand Down
Loading