From 3e469105a0df5427b19d19805d73688c36b48bf3 Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Fri, 1 Nov 2024 13:11:46 -0400 Subject: [PATCH 1/7] clean up views with partials. --- .../app/controllers/projects_controller.rb | 4 +- .../app/views/projects/show.html.erb | 50 ++----------------- 2 files changed, 5 insertions(+), 49 deletions(-) diff --git a/apps/dashboard/app/controllers/projects_controller.rb b/apps/dashboard/app/controllers/projects_controller.rb index 0e65d7446c..344cecb7d5 100644 --- a/apps/dashboard/app/controllers/projects_controller.rb +++ b/apps/dashboard/app/controllers/projects_controller.rb @@ -15,11 +15,11 @@ def show else @scripts = Launcher.all(@project.directory) @valid_project = Launcher.clusters? - @valid_scripts = Launcher.scripts?(@project.directory) + valid_scripts = Launcher.scripts?(@project.directory) alert_messages = [] alert_messages << I18n.t('dashboard.jobs_project_invalid_configuration_clusters') unless @valid_project - alert_messages << I18n.t('dashboard.jobs_project_invalid_configuration_scripts') if @scripts.any? && !@valid_scripts + alert_messages << I18n.t('dashboard.jobs_project_invalid_configuration_scripts') if @scripts.any? && !valid_scripts flash.now[:alert] = alert_messages.join(' ') if alert_messages.any? respond_to do |format| format.html diff --git a/apps/dashboard/app/views/projects/show.html.erb b/apps/dashboard/app/views/projects/show.html.erb index b394d7703e..2bad0088c9 100644 --- a/apps/dashboard/app/views/projects/show.html.erb +++ b/apps/dashboard/app/views/projects/show.html.erb @@ -32,56 +32,12 @@
-
- - <%= t('dashboard.jobs_launchers') %> - - -
- <%- @scripts.each do |launcher| -%> -
-
- <%= launcher.title %> -
- <%= render(partial: 'launcher_buttons', locals: { launcher: launcher }) %> -
- <%- end -%> -
- - - <%= t('dashboard.jobs_new_launcher') %> - -
+ <%= render(partial: 'launchers', locals: { launchers: @scripts, project: @project }) %>
-
-

Active Jobs

- <%= render(partial: 'job_details', collection: @project.active_jobs, as: :job) %> -
- -
-

Completed Jobs

-
- <%- @project.completed_jobs.each do |job| -%> -
"> - <%= render(partial: 'job_details_content', locals: { job: job }) %> -
- <%- end -%> -
-
+ <%= render(partial: 'jobs', locals: { project: @project }) %>
<% unless @project.readme_path.nil? %> -
-
- - <%= File.basename(@project.readme_path) %> -
-
- <%= render_readme(@project.readme_path) %> -
-
+ <%= render(partial: 'readme', locals: { project: @project }) %> <% end %> \ No newline at end of file From 064651f5dc46ee338fa13da7648765a808896c7f Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Wed, 6 Nov 2024 15:10:48 -0500 Subject: [PATCH 2/7] Add css styling for launcher buttons. --- .../app/assets/stylesheets/projects.scss | 6 ++ .../app/controllers/projects_controller.rb | 4 +- .../views/projects/_launcher_buttons.html.erb | 21 +++---- .../app/views/projects/show.html.erb | 59 +++++++++++++++++-- 4 files changed, 73 insertions(+), 17 deletions(-) diff --git a/apps/dashboard/app/assets/stylesheets/projects.scss b/apps/dashboard/app/assets/stylesheets/projects.scss index f47270cb14..fb045daa9d 100644 --- a/apps/dashboard/app/assets/stylesheets/projects.scss +++ b/apps/dashboard/app/assets/stylesheets/projects.scss @@ -38,3 +38,9 @@ font-size: 1.4em; float: right; } + +.launcher-button { + color: white; + width: 100%; + margin: 0.25rem; +} \ No newline at end of file diff --git a/apps/dashboard/app/controllers/projects_controller.rb b/apps/dashboard/app/controllers/projects_controller.rb index 344cecb7d5..0e65d7446c 100644 --- a/apps/dashboard/app/controllers/projects_controller.rb +++ b/apps/dashboard/app/controllers/projects_controller.rb @@ -15,11 +15,11 @@ def show else @scripts = Launcher.all(@project.directory) @valid_project = Launcher.clusters? - valid_scripts = Launcher.scripts?(@project.directory) + @valid_scripts = Launcher.scripts?(@project.directory) alert_messages = [] alert_messages << I18n.t('dashboard.jobs_project_invalid_configuration_clusters') unless @valid_project - alert_messages << I18n.t('dashboard.jobs_project_invalid_configuration_scripts') if @scripts.any? && !valid_scripts + alert_messages << I18n.t('dashboard.jobs_project_invalid_configuration_scripts') if @scripts.any? && !@valid_scripts flash.now[:alert] = alert_messages.join(' ') if alert_messages.any? respond_to do |format| format.html diff --git a/apps/dashboard/app/views/projects/_launcher_buttons.html.erb b/apps/dashboard/app/views/projects/_launcher_buttons.html.erb index 52f885820f..ddf9df30cd 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 %> - + 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 %> - + Options <%- 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 %> - + 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 %> - + 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 2bad0088c9..e0a113b6dc 100644 --- a/apps/dashboard/app/views/projects/show.html.erb +++ b/apps/dashboard/app/views/projects/show.html.erb @@ -31,13 +31,62 @@
-
- <%= render(partial: 'launchers', locals: { launchers: @scripts, project: @project }) %> +
+
+ + <%= t('dashboard.jobs_launchers') %> + + +
+ <%- @scripts.each do |launcher| -%> +
+
+
+ <%= launcher.title %> +
+
+ + <%= render(partial: 'launcher_buttons', locals: { launcher: launcher }) %> +
+ <%- end -%> +
+ + + <%= t('dashboard.jobs_new_launcher') %> + +
-
- <%= render(partial: 'jobs', locals: { project: @project }) %> + +
+
+

Active Jobs

+ <%= render(partial: 'job_details', collection: @project.active_jobs, as: :job) %> +
+ +
+

Completed Jobs

+
+ <%- @project.completed_jobs.each do |job| -%> +
"> + <%= render(partial: 'job_details_content', locals: { job: job }) %> +
+ <%- end -%> +
+
+ <% unless @project.readme_path.nil? %> - <%= render(partial: 'readme', locals: { project: @project }) %> +
+
+ + <%= File.basename(@project.readme_path) %> +
+
+ <%= render_readme(@project.readme_path) %> +
+
<% end %> \ No newline at end of file From f3770af666962b652daf16f916d16bc175cd8494 Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Wed, 6 Nov 2024 15:43:24 -0500 Subject: [PATCH 3/7] update tests. --- apps/dashboard/test/system/project_manager_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dashboard/test/system/project_manager_test.rb b/apps/dashboard/test/system/project_manager_test.rb index e4d151f93f..0b9a8aba28 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 From ed08c1825978a535ffa6a7ff5e3177fe99dbe127 Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Wed, 6 Nov 2024 15:55:50 -0500 Subject: [PATCH 4/7] update tests. --- apps/dashboard/test/system/project_manager_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/dashboard/test/system/project_manager_test.rb b/apps/dashboard/test/system/project_manager_test.rb index 0b9a8aba28..ff65a33ecd 100644 --- a/apps/dashboard/test/system/project_manager_test.rb +++ b/apps/dashboard/test/system/project_manager_test.rb @@ -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 @@ -793,7 +793,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) From 715c62a1f0963bb1d467587a3e8365fd365ae510 Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Wed, 6 Nov 2024 16:30:31 -0500 Subject: [PATCH 5/7] update tests. --- apps/dashboard/test/system/project_manager_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dashboard/test/system/project_manager_test.rb b/apps/dashboard/test/system/project_manager_test.rb index ff65a33ecd..7ade942b04 100644 --- a/apps/dashboard/test/system/project_manager_test.rb +++ b/apps/dashboard/test/system/project_manager_test.rb @@ -821,7 +821,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) From 22a49338c41720d47452de601c3da5a966ead541 Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Wed, 6 Nov 2024 17:05:04 -0500 Subject: [PATCH 6/7] Localization updates. --- apps/dashboard/app/assets/stylesheets/projects.scss | 5 +++++ .../app/views/projects/_launcher_buttons.html.erb | 8 ++++---- apps/dashboard/app/views/projects/show.html.erb | 2 +- apps/dashboard/config/locales/ja_JP.yml | 1 + apps/dashboard/config/locales/zh-CN.yml | 6 ++++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/dashboard/app/assets/stylesheets/projects.scss b/apps/dashboard/app/assets/stylesheets/projects.scss index fb045daa9d..f1c68188ee 100644 --- a/apps/dashboard/app/assets/stylesheets/projects.scss +++ b/apps/dashboard/app/assets/stylesheets/projects.scss @@ -39,6 +39,11 @@ float: right; } +.launcher-title { + font-size: 1em; + font-weight: bold; +} + .launcher-button { color: white; width: 100%; diff --git a/apps/dashboard/app/views/projects/_launcher_buttons.html.erb b/apps/dashboard/app/views/projects/_launcher_buttons.html.erb index ddf9df30cd..380bf89db6 100644 --- a/apps/dashboard/app/views/projects/_launcher_buttons.html.erb +++ b/apps/dashboard/app/views/projects/_launcher_buttons.html.erb @@ -16,7 +16,7 @@ id: "launch_#{launcher.id}" ) do %> - Launch + <%= I18n.t('dashboard.launch') %> <%- end %>
@@ -27,7 +27,7 @@ id: "show_#{launcher.id}" ) do %> - Options + <%= I18n.t('dashboard.show') %> <%- end -%>
@@ -40,7 +40,7 @@ id: "edit_#{launcher.id}", title: edit_title) do %> - Edit + <%= I18n.t('dashboard.edit') %> <%- end %> @@ -53,7 +53,7 @@ data: { confirm: I18n.t('dashboard.jobs_scripts_delete_script_confirmation') }, method: :delete) do %> - Delete + <%= 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 e0a113b6dc..b82b1a81e3 100644 --- a/apps/dashboard/app/views/projects/show.html.erb +++ b/apps/dashboard/app/views/projects/show.html.erb @@ -43,7 +43,7 @@ <%- @scripts.each do |launcher| -%>
-
+
<%= launcher.title %>
diff --git a/apps/dashboard/config/locales/ja_JP.yml b/apps/dashboard/config/locales/ja_JP.yml index 65b42fe4bb..24626a51b5 100644 --- a/apps/dashboard/config/locales/ja_JP.yml +++ b/apps/dashboard/config/locales/ja_JP.yml @@ -9,5 +9,6 @@ ja_JP: delete: "消す" edit: "編集する" show: "見せる" + launch: "起動する" # project: "Project" # directory: "Directory" diff --git a/apps/dashboard/config/locales/zh-CN.yml b/apps/dashboard/config/locales/zh-CN.yml index 59e305c35d..0dd8aac02e 100644 --- a/apps/dashboard/config/locales/zh-CN.yml +++ b/apps/dashboard/config/locales/zh-CN.yml @@ -145,6 +145,8 @@ zh-CN: # all_apps_table_sub_category_column: "Sub Category" # unknown: "Unknown" - save: "保存" - + delete: "删除" + edit: "编辑" + show: "显示" + launch: "启动" # development_apps_caption: "Sandbox App" From 42a74ed9aa772cf8276a997693a167efd6f781ea Mon Sep 17 00:00:00 2001 From: Greg Buchanan Date: Thu, 14 Nov 2024 12:56:10 -0500 Subject: [PATCH 7/7] Change launchers column width to 2 --- apps/dashboard/app/views/projects/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/app/views/projects/show.html.erb b/apps/dashboard/app/views/projects/show.html.erb index b82b1a81e3..8c63227dbf 100644 --- a/apps/dashboard/app/views/projects/show.html.erb +++ b/apps/dashboard/app/views/projects/show.html.erb @@ -31,7 +31,7 @@