Skip to content

Commit

Permalink
#3902 fix-up launcher buttons list (#3938)
Browse files Browse the repository at this point in the history
Refactor launcher buttons so they're a little more visually pleasing.
  • Loading branch information
euler-room authored Nov 14, 2024
1 parent 6aef45c commit 918ae09
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 22 deletions.
11 changes: 11 additions & 0 deletions apps/dashboard/app/assets/stylesheets/projects.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@
font-size: 1.4em;
float: right;
}

.launcher-title {
font-size: 1em;
font-weight: bold;
}

.launcher-button {
color: white;
width: 100%;
margin: 0.25rem;
}
21 changes: 11 additions & 10 deletions apps/dashboard/app/views/projects/_launcher_buttons.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,54 @@
-%>

<div class="row">

<div class="col">
<%= button_to(
submit_project_launcher_path(@project.id, launcher.id),
class: 'btn btn-success',
class: 'btn btn-success launcher-button',
title: 'Launch script with cached or default values',
disabled: disabled,
params: launcher.quick_launch_params,
id: "launch_#{launcher.id}"
) do
%>
<i class="fa fa-play"></i>
<%= I18n.t('dashboard.launch') %>
<%- end %>
</div>

<div class="col">
<%= link_to(
project_launcher_path(@project.id, launcher.id),
class: "btn btn-success #{disabled_class}",
class: "btn btn-info launcher-button #{disabled_class}",
id: "show_#{launcher.id}"
) do
%>
<i class="fa fa-bars"></i>
<%= I18n.t('dashboard.show') %>
<%- end -%>
</div>

</div>
</div>
<div class="row">
<div class="col">
<%= link_to(
edit_project_launcher_path(@project.id, launcher.id),
class: "btn btn-primary #{disabled_class}",
class: "btn btn-primary launcher-button #{disabled_class}",
id: "edit_#{launcher.id}",
title: edit_title) do
%>
<i class="fa fa-pencil"></i>
<%= I18n.t('dashboard.edit') %>
<%- end %>
</div>

<div class="col">
<%= button_to(
project_launcher_path(@project.id, launcher.id),
id: "delete_#{launcher.id}",
class: "btn btn-danger",
class: "btn btn-danger launcher-button",
title: delete_title,
data: { confirm: I18n.t('dashboard.jobs_scripts_delete_script_confirmation') },
method: :delete) do
%>
<i class="fa fa-trash"></i>
<%= I18n.t('dashboard.delete') %>
<%- end -%>
</div>
</div>
11 changes: 8 additions & 3 deletions apps/dashboard/app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@
<div id="launcher_list" class="collapse show">
<%- @scripts.each do |launcher| -%>
<div class="list-group-item list-group-item-action" id="launcher_<%= launcher.id %>">
<div class="row py-2 justify-content-center">
<%= launcher.title %>
<div class="row launcher-item">
<div class="col launcher-title">
<%= launcher.title %>
</div>
</div>

<%= render(partial: 'launcher_buttons', locals: { launcher: launcher }) %>
</div>
<%- end -%>
Expand All @@ -56,9 +59,10 @@
</a>
</div>
</div>

<div class="col-md-8">
<div class="row">
<h2 class="h3 d-flex justify-content-center">Active Jobs</h2>
<h2 class="d-flex justify-content-center">Active Jobs</h2>
<%= render(partial: 'job_details', collection: @project.active_jobs, as: :job) %>
</div>

Expand All @@ -74,6 +78,7 @@
</div>
</div>
</div>

<% unless @project.readme_path.nil? %>
<div class="card">
<div class="card-header">
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/config/locales/ja_JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ja_JP:
delete: "消す"
edit: "編集する"
show: "見せる"
launch: "起動する"
# project: "Project"
# directory: "Directory"
auto_log_location_title: "ログの場所"
6 changes: 4 additions & 2 deletions apps/dashboard/config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ zh-CN:
# all_apps_table_sub_category_column: "Sub Category"

# unknown: "Unknown"
save: "保存"

delete: "删除"
edit: "编辑"
show: "显示"
launch: "启动"
# development_apps_caption: "Sandbox App"
14 changes: 7 additions & 7 deletions apps/dashboard/test/system/project_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
assert_equal(expected_yml, File.read("#{dir}/projects/#{project_id}/.ondemand/launchers/#{launcher_id}/form.yml"))

launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click
assert_selector('h1', text: 'the script title', count: 1)
end
end
Expand Down Expand Up @@ -326,7 +326,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
add_account(project_id, launcher_id)

launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click
assert_selector('h1', text: 'the script title', count: 1)

expected_accounts = ['pas1604', 'pas1754', 'pas1871', 'pas2051', 'pde0006', 'pzs0714', 'pzs0715', 'pzs1010',
Expand Down Expand Up @@ -377,7 +377,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
add_account(project_id, launcher_id)

launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click
assert_selector('h1', text: 'the script title', count: 1)

# assert defaults
Expand Down Expand Up @@ -424,7 +424,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
click_on(I18n.t('dashboard.save'))

launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click
assert_selector('h1', text: 'the script title', count: 1)

# assert defaults
Expand Down Expand Up @@ -466,7 +466,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
add_account(project_id, launcher_id)

launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click
assert_selector('h1', text: 'the script title', count: 1)

# assert defaults
Expand Down Expand Up @@ -794,7 +794,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
find('#save_script_edit').click
assert_current_path(project_path(project_id))
launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click

# now let's check scripts#show to see if they've actually been excluded.
show_account_options = page.all('#launcher_auto_accounts option').map(&:value)
Expand Down Expand Up @@ -822,7 +822,7 @@ def add_auto_environment_variable(project_id, launcher_id, save: true)
find('#save_script_edit').click
assert_current_path(project_path(project_id))
launcher_path = project_launcher_path(project_id, launcher_id)
find("[href='#{launcher_path}'].btn-success").click
find("[href='#{launcher_path}'].btn-info").click

# now let's check scripts#show and they should be back.
show_account_options = page.all('#launcher_auto_accounts option').map(&:value)
Expand Down

0 comments on commit 918ae09

Please sign in to comment.