From 918ae09ffb0e19cce7c8bc2b818ff6336d6d47e9 Mon Sep 17 00:00:00 2001 From: Gregory Buchanan Date: Thu, 14 Nov 2024 11:48:52 -0800 Subject: [PATCH] #3902 fix-up launcher buttons list (#3938) Refactor launcher buttons so they're a little more visually pleasing. --- .../app/assets/stylesheets/projects.scss | 11 ++++++++++ .../views/projects/_launcher_buttons.html.erb | 21 ++++++++++--------- .../app/views/projects/show.html.erb | 11 +++++++--- apps/dashboard/config/locales/ja_JP.yml | 1 + apps/dashboard/config/locales/zh-CN.yml | 6 ++++-- .../test/system/project_manager_test.rb | 14 ++++++------- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/apps/dashboard/app/assets/stylesheets/projects.scss b/apps/dashboard/app/assets/stylesheets/projects.scss index f47270cb14..f1c68188ee 100644 --- a/apps/dashboard/app/assets/stylesheets/projects.scss +++ b/apps/dashboard/app/assets/stylesheets/projects.scss @@ -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; +} \ No newline at end of file diff --git a/apps/dashboard/app/views/projects/_launcher_buttons.html.erb b/apps/dashboard/app/views/projects/_launcher_buttons.html.erb index 52f885820f..380bf89db6 100644 --- a/apps/dashboard/app/views/projects/_launcher_buttons.html.erb +++ b/apps/dashboard/app/views/projects/_launcher_buttons.html.erb @@ -6,40 +6,41 @@ -%>
-
<%= 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 %> - + <%= I18n.t('dashboard.launch') %> <%- end %>
<%= 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 %> - + <%= I18n.t('dashboard.show') %> <%- end -%> -
+
+ +
<%= 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 %> - + <%= I18n.t('dashboard.edit') %> <%- end %>
@@ -47,12 +48,12 @@ <%= 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 %> - + <%= I18n.t('dashboard.delete') %> <%- end -%>
\ No newline at end of file diff --git a/apps/dashboard/app/views/projects/show.html.erb b/apps/dashboard/app/views/projects/show.html.erb index b394d7703e..8c63227dbf 100644 --- a/apps/dashboard/app/views/projects/show.html.erb +++ b/apps/dashboard/app/views/projects/show.html.erb @@ -42,9 +42,12 @@
<%- @scripts.each do |launcher| -%>
-
- <%= launcher.title %> +
+
+ <%= launcher.title %> +
+ <%= render(partial: 'launcher_buttons', locals: { launcher: launcher }) %>
<%- end -%> @@ -56,9 +59,10 @@
+
-

Active Jobs

+

Active Jobs

<%= render(partial: 'job_details', collection: @project.active_jobs, as: :job) %>
@@ -74,6 +78,7 @@
+ <% unless @project.readme_path.nil? %>
diff --git a/apps/dashboard/config/locales/ja_JP.yml b/apps/dashboard/config/locales/ja_JP.yml index 1b69c45e6b..e3b3282fdf 100644 --- a/apps/dashboard/config/locales/ja_JP.yml +++ b/apps/dashboard/config/locales/ja_JP.yml @@ -9,6 +9,7 @@ ja_JP: delete: "消す" edit: "編集する" show: "見せる" + launch: "起動する" # project: "Project" # directory: "Directory" auto_log_location_title: "ログの場所" \ No newline at end of file diff --git a/apps/dashboard/config/locales/zh-CN.yml b/apps/dashboard/config/locales/zh-CN.yml index c8050c1dd4..bb3c798bdb 100644 --- a/apps/dashboard/config/locales/zh-CN.yml +++ b/apps/dashboard/config/locales/zh-CN.yml @@ -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" diff --git a/apps/dashboard/test/system/project_manager_test.rb b/apps/dashboard/test/system/project_manager_test.rb index b4f500e9ee..ed7f29d649 100644 --- a/apps/dashboard/test/system/project_manager_test.rb +++ b/apps/dashboard/test/system/project_manager_test.rb @@ -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 @@ -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', @@ -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 @@ -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 @@ -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 @@ -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) @@ -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)