Skip to content

Commit

Permalink
Merge branch 'master' into radio-widget-scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom committed Oct 22, 2024
2 parents 16397de + e93525d commit 62f6d5b
Show file tree
Hide file tree
Showing 14 changed files with 250 additions and 192 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
path: ~/vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('apps/*/Gemfile.lock') }}

- name: Setup os dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev
- name: Setup Bundler
run: |
bundle config path ~/vendor/bundle
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
for a certain duration after inactivity and the connections will close altogether after a certian duration regardless
of activity in [3805](https://github.com/OSC/ondemand/pull/3805) and [3810](https://github.com/OSC/ondemand/pull/3810).
- Empty directories can now be downloaded in [3841](https://github.com/OSC/ondemand/pull/3841).
- Batch Connect applications always lowercase ids for normalization for dynamic javascript in [3867](https://github.com/OSC/ondemand/pull/3867).

### Fixed
- Ensure that the asset directory is clean when building in [3356](https://github.com/OSC/ondemand/pull/3356).
Expand All @@ -78,6 +79,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- data_field widgets now initialize their value to today in [3817](https://github.com/OSC/ondemand/pull/3817).
- Batch Connect cache files now correct serialize in [3819](https://github.com/OSC/ondemand/pull/3819).
- Uploads always succeed even when the chown operation afterwards fails in [3856](https://github.com/OSC/ondemand/pull/3856).
- Exceptions in dashboard widgets are correct rescued in [3873](https://github.com/OSC/ondemand/pull/3873).

### Security

Expand Down
3 changes: 2 additions & 1 deletion apps/dashboard/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '7.0.8.4'
gem 'rails', '7.0.8.5'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
Expand Down Expand Up @@ -47,6 +47,7 @@ gem 'nokogiri', '~> 1.15', '< 1.16'
gem 'net-imap', '~> 0.3', '< 0.4'
gem 'public_suffix', '~> 5.0', '< 6.0'
gem 'turbo-rails', '2.0.7'
gem 'zeitwerk', '2.6.18'

# Extra third-party gems
gem 'dotenv-rails', '~> 2.1'
Expand Down
111 changes: 56 additions & 55 deletions apps/dashboard/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
actioncable (7.0.8.5)
actionpack (= 7.0.8.5)
activesupport (= 7.0.8.5)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
actionmailbox (7.0.8.5)
actionpack (= 7.0.8.5)
activejob (= 7.0.8.5)
activerecord (= 7.0.8.5)
activestorage (= 7.0.8.5)
activesupport (= 7.0.8.5)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.4)
actionpack (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activesupport (= 7.0.8.4)
actionmailer (7.0.8.5)
actionpack (= 7.0.8.5)
actionview (= 7.0.8.5)
activejob (= 7.0.8.5)
activesupport (= 7.0.8.5)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.4)
actionview (= 7.0.8.4)
activesupport (= 7.0.8.4)
actionpack (7.0.8.5)
actionview (= 7.0.8.5)
activesupport (= 7.0.8.5)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.4)
actionpack (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
actiontext (7.0.8.5)
actionpack (= 7.0.8.5)
activerecord (= 7.0.8.5)
activestorage (= 7.0.8.5)
activesupport (= 7.0.8.5)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.4)
activesupport (= 7.0.8.4)
actionview (7.0.8.5)
activesupport (= 7.0.8.5)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.4)
activesupport (= 7.0.8.4)
activejob (7.0.8.5)
activesupport (= 7.0.8.5)
globalid (>= 0.3.6)
activemodel (7.0.8.4)
activesupport (= 7.0.8.4)
activerecord (7.0.8.4)
activemodel (= 7.0.8.4)
activesupport (= 7.0.8.4)
activestorage (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activesupport (= 7.0.8.4)
activemodel (7.0.8.5)
activesupport (= 7.0.8.5)
activerecord (7.0.8.5)
activemodel (= 7.0.8.5)
activesupport (= 7.0.8.5)
activestorage (7.0.8.5)
actionpack (= 7.0.8.5)
activejob (= 7.0.8.5)
activerecord (= 7.0.8.5)
activesupport (= 7.0.8.5)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.4)
activesupport (7.0.8.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -188,36 +188,36 @@ GEM
stringio
public_suffix (5.1.1)
racc (1.8.1)
rack (2.2.9)
rack (2.2.10)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8.4)
actioncable (= 7.0.8.4)
actionmailbox (= 7.0.8.4)
actionmailer (= 7.0.8.4)
actionpack (= 7.0.8.4)
actiontext (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activemodel (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
rails (7.0.8.5)
actioncable (= 7.0.8.5)
actionmailbox (= 7.0.8.5)
actionmailer (= 7.0.8.5)
actionpack (= 7.0.8.5)
actiontext (= 7.0.8.5)
actionview (= 7.0.8.5)
activejob (= 7.0.8.5)
activemodel (= 7.0.8.5)
activerecord (= 7.0.8.5)
activestorage (= 7.0.8.5)
activesupport (= 7.0.8.5)
bundler (>= 1.15.0)
railties (= 7.0.8.4)
railties (= 7.0.8.5)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
railties (7.0.8.5)
actionpack (= 7.0.8.5)
activesupport (= 7.0.8.5)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -312,7 +312,7 @@ DEPENDENCIES
ood_support (~> 0.0.2)
pry
public_suffix (~> 5.0, < 6.0)
rails (= 7.0.8.4)
rails (= 7.0.8.5)
redcarpet (~> 3.3)
rest-client (~> 2.0)
rss (~> 0.2)
Expand All @@ -324,6 +324,7 @@ DEPENDENCIES
timecop (~> 0.9)
turbo-rails (= 2.0.7)
webrick
zeitwerk (= 2.6.18)
zip_kit (~> 6.2)

BUNDLED WITH
Expand Down
10 changes: 9 additions & 1 deletion apps/dashboard/app/helpers/dashboard_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ def render_widget(widget)
begin
render partial: "widgets/#{widget}"
rescue SyntaxError, StandardError => e
render partial: 'shared/widget_error', locals: { error: e, widget: widget.to_s }
render_error_widget(e, widget.to_s)
# rubocop:disable Lint/RescueException - because these can throw all sorts of errors.
rescue Exception => e
# rubocop:enable Lint/RescueException
render_error_widget(e, widget.to_s)
end
end

private

def render_error_widget(error, widget_name)
render(partial: 'shared/widget_error', locals: { error: error, widget: widget_name })
end

def default_dashboard_layout
if xdmod?
if pinned_apps? || motd?
Expand Down
26 changes: 6 additions & 20 deletions apps/dashboard/app/javascript/dynamic_forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,13 @@ function mountainCaseWords(str) {
function snakeCaseWords(str) {
if(str === undefined) return undefined;

let snakeCase = "";

str.split('').forEach((c, index) => {
if(c === '-' || c === '_') {
snakeCase += '_';
} else if (index == 0) {
snakeCase += c.toLowerCase();
} else if(c == c.toUpperCase() && isNaN(c)) {
const nextIsUpper = (index + 1 !== str.length) ? str[index + 1] === str[index + 1].toUpperCase() : true;
const nextIsNum = !isNaN(str[index + 1]);
if ((str[index-1] === '_' || nextIsUpper) && !nextIsNum) {
snakeCase += c.toLowerCase();
} else {
snakeCase += `_${c.toLowerCase()}`;
}
} else {
snakeCase += c;
}
});
// find all the captial case words and if none are found, we'll just bascially
// return the same string.
const rex = /([A-Z]{1}[a-z]*[0-9]*)|.+/g;
const words = str.match(rex);

return snakeCase;
// filter out emtpy matches to avoid having a _ at the end.
return words.filter(word => word != '').map(word => word.toLowerCase()).join('_');
}

/**
Expand Down
67 changes: 41 additions & 26 deletions apps/dashboard/app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@
<div class="row">
<% @projects.each do |project| %>
<div id="<%= project.id %>" class="col-md-3 project-icon project-card">
<div class="text-center d-flex justify-content-center">
<%= link_to(project_path(project.id), class: 'text-dark') do %>
<%= icon_tag(URI.parse(project.icon)) %>
<%= content_tag(:p, project.title) %>
<% end %>
</div>

<%= button_to 'Delete', project_path(project.id), class: 'btn btn-danger w-80 mb-1', method: 'delete',
form: { class: 'button_to d-flex justify-content-center' },
data: { confirm: I18n.t('dashboard.jobs_project_delete_project_confirmation') }
%>
<%= button_to 'Edit', edit_project_path(project.id), class: 'btn btn-info w-80', method: 'get',
form: { class: 'd-flex justify-content-center' },
title: 'Edit project directory'
%>
<%= link_to(project_path(project.id), class: 'text-dark') do %>
<div class="text-center d-flex justify-content-center">
<strong>
<%= icon_tag(URI.parse(project.icon)) %>
<%= content_tag(:p, project.title) %>
</strong>
</div>
<div class="row">
<div class="col">
<%= button_to 'Delete', project_path(project.id), class: 'btn btn-danger w-100 mb-1', method: 'delete',
form: { class: 'button_to d-flex justify-content-center' },
data: { confirm: I18n.t('dashboard.jobs_project_delete_project_confirmation') }
%>
</div>
<div class="col">
<%= button_to 'Edit', edit_project_path(project.id), class: 'btn btn-info w-100', method: 'get',
form: { class: 'd-flex justify-content-center' },
title: 'Edit project directory'
%>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
Expand All @@ -34,21 +41,29 @@
title: I18n.t('dashboard.jobs_create_blank_project'),
class: 'text-dark btn btn-link') do
%>
<%= icon_tag(URI.parse("fas://plus")) %><br>
<%= I18n.t('dashboard.jobs_create_blank_project') %>
<div class="text-center d-flex justify-content-center">
<strong>
<%= icon_tag(URI.parse("fas://file-medical")) %><br>
<%= I18n.t('dashboard.jobs_create_blank_project') %>
</strong>
</div>
<% end %>
</div>

<%- if @templates.size.positive? -%>
<div class="mt-5 justify-content-center text-center project-icon">
<%= link_to(new_project_path({template: true}),
title: I18n.t('dashboard.jobs_create_template_project'),
class: 'text-dark btn btn-link') do
%>
<%= icon_tag(URI.parse("fas://plus")) %><br>
<%= I18n.t('dashboard.jobs_create_template_project') %>
<% end %>
</div>
<div class="mt-5 justify-content-center text-center project-icon">
<%= link_to(new_project_path({template: true}),
title: I18n.t('dashboard.jobs_create_template_project'),
class: 'text-dark btn btn-link') do
%>
<div class="text-center d-flex justify-content-center">
<strong>
<%= icon_tag(URI.parse("fas://copy")) %><br>
<%= I18n.t('dashboard.jobs_create_template_project') %>
</strong>
</div>
<% end %>
</div>
<%- end -%>

</div>
Expand Down
22 changes: 12 additions & 10 deletions apps/dashboard/config/initializers/browser.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# frozen_string_literal: true

Browser.modern_rules.clear
Browser.modern_rules.tap do |rules|
# original:
# original:
# rules << -> (b) { b.webkit? }
# rules << -> (b) { b.firefox? && b.version.to_i >= 17 }
# rules << -> (b) { b.ie? && b.version.to_i >= 9 && !b.compatibility_view? }
# rules << -> (b) { b.edge? && !b.compatibility_view? }
# rules << -> (b) { b.opera? && b.version.to_i >= 12 }
# rules << -> (b) { b.firefox? && b.device.tablet? && b.platform.android? && b.version.to_i >= 14 } # rubocop:disable Metrics/LineLength
# rules << -> (b) { b.firefox? && b.device.tablet? && b.platform.android? && b.version.to_i >= 14 }

# for now, explicitly specify chrome and safari versions but allow
# other webkit (i.e. mobile)
rules << -> (b) { b.ie? && b.version.to_i >= 11 && !b.compatibility_view? }
rules << -> (b) { b.chrome? && b.version.to_i >= 34 }
rules << -> (b) { b.safari? && b.version.to_i >= 8 }
rules << -> (b) { b.webkit? && !b.chrome? && !b.safari? }
rules << -> (b) { b.firefox? && b.version.to_i >= 19 }
rules << -> (b) { b.edge? && !b.compatibility_view? }
rules << -> (b) { b.opera? && b.version.to_i >= 12 }
rules << -> (b) { b.firefox? && b.device.tablet? && b.platform.android? && b.version.to_i >= 14 } # rubocop:disable Metrics/LineLength
rules << ->(b) { b.ie? && b.version.to_i >= 11 && !b.compatibility_view? }
rules << ->(b) { b.chrome? && b.version.to_i >= 34 }
rules << ->(b) { b.safari? && b.version.to_i >= 8 }
rules << ->(b) { b.webkit? && !b.chrome? && !b.safari? }
rules << ->(b) { b.firefox? && b.version.to_i >= 19 }
rules << ->(b) { b.edge? && !b.compatibility_view? }
rules << ->(b) { b.opera? && b.version.to_i >= 12 }
rules << ->(b) { b.firefox? && b.device.tablet? && b.platform.android? && b.version.to_i >= 14 }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%- require 'the_missing_gem' -%>
Loading

0 comments on commit 62f6d5b

Please sign in to comment.