Skip to content

Commit

Permalink
Merge branch 'master' into js-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom committed Jul 23, 2024
2 parents 9f49e74 + 3354094 commit adf7a03
Show file tree
Hide file tree
Showing 385 changed files with 425 additions and 493 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- os: ubuntu-latest
ruby: "3.1.2"
bundler: "2.3.7"
# Test versions from Amazon Linux 2023
# Test versions from Amazon Linux 2023 and Ubuntu 24.04
- os: ubuntu-latest
ruby: "3.2.2"
bundler: "2.4.10"
Expand Down Expand Up @@ -121,6 +121,7 @@ jobs:
- amzn2023
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- debian-12
arch:
- x86_64
Expand Down
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ build-nightly:
- OOD_PACKAGING_DIST: [el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, debian-12]
- OOD_PACKAGING_DIST: [el9, debian-12, ubuntu-24.04]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
# Ubuntu doesn't have way to get NodeJS 14+ on ppc64le
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
# Amazon 2023 on aarch64 is slow and will time out
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64]
timeout: 3h
timeout: 4h
artifacts:
paths:
- dist
Expand All @@ -54,15 +54,15 @@ build:
- OOD_PACKAGING_DIST: [el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, debian-12]
- OOD_PACKAGING_DIST: [el9, debian-12, ubuntu-24.04]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
# Ubuntu doesn't have way to get NodeJS 14+ on ppc64le
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
# Amazon 2023 on aarch64 is slow and will time out
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64]
timeout: 3h
timeout: 4h
artifacts:
paths:
- dist
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- The project manager can now define default launcher fields in [3488](https://github.com/OSC/ondemand/pull/3488).
- The feature to show the project size is now configurable in [3531](https://github.com/OSC/ondemand/pull/3531).
- The dashboard now has a system status page in [3549](https://github.com/OSC/ondemand/pull/3549).
- Support for Ubuntu 24.04 in [3676](https://github.com/OSC/ondemand/pull/3676).
- Added configurable default number of apps to show in the apps table in [3672](https://github.com/OSC/ondemand/pull/3672).

### Changed
- Script models have been renamed to Launcher in [3397](https://github.com/OSC/ondemand/pull/3397).
Expand All @@ -33,6 +35,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- The http to https redirect host is now configurable in [3515](https://github.com/OSC/ondemand/pull/3515).
- Passenger and NGINX have been updated 6.0.20 and 1.24.0 respectively in [3535](https://github.com/OSC/ondemand/pull/3535).
- The dashboard now uses Bootstrap 5 in [3541](https://github.com/OSC/ondemand/pull/3541).
- The file editor now uses the default layout in [3646](https://github.com/OSC/ondemand/pull/3646).
- Announcemnts are now dismissible with the option to make them required in [3667](https://github.com/OSC/ondemand/pull/3667).
- Ace is now a yarn dependency in [3629](https://github.com/OSC/ondemand/pull/3629).

### Fixed
- Ensure that the asset directory is clean when building in [3356](https://github.com/OSC/ondemand/pull/3356).
Expand All @@ -42,6 +47,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Dynamic bc now supports fields with numbers in them in [3507](https://github.com/OSC/ondemand/pull/3507).
- File and shell buttons will no longer appear when apps are unavailable in [3655](https://github.com/OSC/ondemand/pull/3655).
- Downloads can once again be estimated in [3653](https://github.com/OSC/ondemand/pull/3653).
- Download buttons will now be hidden for certain files like pipes in [3654](https://github.com/OSC/ondemand/pull/3654).
- Favorite file paths now consult the Allowlist in [3526](https://github.com/OSC/ondemand/pull/3526).

### Security

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gem 'rake'
gem 'dotenv', '~> 2.1'

group :package do
gem 'ood_packaging', '~> 0.14.0'
gem 'ood_packaging', '~> 0.15.1'
end

group :test do
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ GEM
oga (3.3)
ast
ruby-ll (~> 2.1)
ood_packaging (0.14.1)
ood_packaging (0.15.1)
rake (~> 13.0.1)
open_uri_redirections (0.2.1)
parallel (1.21.0)
Expand Down Expand Up @@ -179,7 +179,7 @@ DEPENDENCIES
beaker-docker (~> 1.4.0)
beaker-rspec
dotenv (~> 2.1)
ood_packaging (~> 0.14.0)
ood_packaging (~> 0.15.1)
rake
rspec
rubocop
Expand Down
7 changes: 7 additions & 0 deletions apps/dashboard/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ class ApplicationController < ActionController::Base
before_action :set_user, :set_user_configuration, :set_pinned_apps, :set_nav_groups, :set_announcements
before_action :set_my_balances, only: [:index, :new, :featured]
before_action :set_featured_group, :set_custom_navigation
before_action :check_required_announcements

def check_required_announcements
return if instance_of?(SettingsController)

render inline: '', layout: :default if @announcements.select(&:required?).reject(&:completed?).any?
end

def set_user
@user = CurrentUser
Expand Down
6 changes: 5 additions & 1 deletion apps/dashboard/app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ def show
project_id = show_project_params[:id]
@project = Project.find(project_id)
if @project.nil?
redirect_to(projects_path, alert: I18n.t('dashboard.jobs_project_not_found', project_id: project_id))
respond_to do |format|
message = I18n.t('dashboard.jobs_project_not_found', project_id: project_id)
format.html { redirect_to(projects_path, alert: message) }
format.json { render json: { message: message }, status: :not_found }
end
else
@scripts = Launcher.all(@project.directory)
@valid_project = Launcher.clusters?
Expand Down
7 changes: 3 additions & 4 deletions apps/dashboard/app/controllers/settings_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

# The Controller for user level settings /dashboard/settings.
# Current supported settings: profile, announcement
class SettingsController < ApplicationController
include UserSettingStore
ALLOWED_SETTINGS = [:profile].freeze
ALLOWED_SETTINGS = [:profile, { announcements: {} }].freeze

def update
new_settings = read_settings(settings_param)
Expand All @@ -23,8 +24,6 @@ def settings_param
end

def read_settings(params)
{}.tap do |settings|
params&.each { |key, value| settings[key] = value }
end
params.to_h
end
end
6 changes: 5 additions & 1 deletion apps/dashboard/app/javascript/apps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
'use strict';

import { appsDatatablePageLength } from './config.js';

jQuery(function() {
const pageLength = appsDatatablePageLength();
$('#all-apps-table').DataTable({
stateSave: true
stateSave: false,
pageLength: pageLength
});
});
5 changes: 5 additions & 0 deletions apps/dashboard/app/javascript/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ export function statusPollDelay() {
export function statusIndexUrl() {
const cfgData = configData();
return cfgData['statusIndexUrl'];
}

export function appsDatatablePageLength() {
const cfgData = configData();
return parseInt(cfgData['appsDatatablePageLength']);
}
2 changes: 2 additions & 0 deletions apps/dashboard/app/javascript/editor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

import ace from 'ace-code/esm-resolver';

const KEY_PREFIX = "ood_editor_store_";

function normalizeKey(key) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/models/active_jobs/jobstatusdata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def extended_data_slurm(info)
attributes.push Attribute.new "Node List", self.nodes.join(", ") unless self.nodes.blank?
attributes.push Attribute.new "Total CPUs", info.native[:cpus]
attributes.push Attribute.new "Time Limit", info.native[:time_limit]
attributes.push Attribute.new "Time Used", info.native[:time_used]
attributes.push Attribute.new "Time Used", self.walltime_used
attributes.push Attribute.new "Start Time", safe_parse_time(info.native[:start_time])
attributes.push Attribute.new "End Time", safe_parse_time(info.native[:end_time])
attributes.push Attribute.new "Memory", info.native[:min_memory]
Expand Down
41 changes: 40 additions & 1 deletion apps/dashboard/app/models/announcement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Announcements show up on the dashboard to convey a message to users.
class Announcement
include UserSettingStore
# List of valid announcement types
TYPES = [:warning, :info, :success, :danger].freeze

Expand Down Expand Up @@ -31,10 +32,48 @@ def msg
msg.blank? ? nil : msg
end

# The announcement's id. Used when storing that it has been dismissed.
# @return [String] the id
def id
@id ||= begin
default_id = Digest::SHA1.hexdigest(msg) if msg
opts.fetch(:id, default_id)
end
end

# The announcement's button text displayed for required or dismissible announcements
# @return [String] the button text
def button_text
default_text = required? ? I18n.t('dashboard.announcements_required_button') : I18n.t('dashboard.announcements_dismissible_button')
opts.fetch(:button_text, default_text).to_s
end

# Whether this is a valid announcement
# @return [Boolean] whether it is valid
def valid?
!!msg
return false unless msg

return false if dismissible? && !id

true
end

# Whether this announcement has been dismissed.
# @return [Boolean] whether it has been dismissed
def completed?
dismissible? && user_settings.dig(:announcements, id.to_s.to_sym).present?
end

# Whether this is a dismissible announcement.
# @return [Boolean] whether it is dismissible
def dismissible?
required? || opts.fetch(:dismissible, true)
end

# Whether this is a required announcement.
# @return [Boolean] whether it is required
def required?
opts.fetch(:required, false)
end

private
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/models/batch_connect/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def stage(root, context: nil)
staged_root.tap { |p| FileUtils.mkdir_p(p.to_s, mode: 0o0700) unless p.exist? }

# Sync the template files over
oe, s = Open3.capture2e('rsync', '-rlpv', '--exclude', '*.erb', "#{root}/", staged_root.to_s)
oe, s = Open3.capture2e('rsync', '-rlpv', '--exclude', '.*.swp', '--exclude', '*.erb', "#{root}/", staged_root.to_s)
raise oe unless s.success?

# Output user submitted context attributes for debugging purposes
Expand Down
5 changes: 4 additions & 1 deletion apps/dashboard/app/models/user_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ class UserConfiguration
# Custom pages configuration property
ConfigurationProperty.property(name: :custom_pages, default_value: {}),
# Support ticket configuration property
ConfigurationProperty.property(name: :support_ticket, default_value: {})
ConfigurationProperty.property(name: :support_ticket, default_value: {}),

# Datatables configuration for the apps pages
ConfigurationProperty.property(name: :apps_datatable, default_value: { page_length: 10 })
].freeze

def initialize(request_hostname: nil)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
json.html_extended_panel render partial: 'active_jobs/extended_panel', :locals => {:data => jobstatusdata}
json.html_extended_panel render(partial: 'active_jobs/extended_panel', :locals => {:data => jobstatusdata}, :formats => [:html])
json.status jobstatusdata.status
json.html_ganglia_graphs_table render partial: 'active_jobs/ganglia_graphs_table', :locals => {:d => jobstatusdata}
json.html_ganglia_graphs_table render(partial: 'active_jobs/ganglia_graphs_table', :locals => {:d => jobstatusdata}, :formats => [:html])
3 changes: 0 additions & 3 deletions apps/dashboard/app/views/files/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,3 @@
</div>
<pre class="flex-grow-1" id="editor" data-path="<%= @path %>" data-api="<%= OodAppkit.files.api(path: @path, fs: @filesystem) %>"><%= @content %></pre>
</div>

<script src="<%= "#{ENV['RAILS_RELATIVE_URL_ROOT']}/ace/1.2.6/ace.js" %>" type="text/javascript" charset="utf-8"></script>
<script src="<%= "#{ENV['RAILS_RELATIVE_URL_ROOT']}/ace/1.2.6/ext-modelist.js" %>" type="text/javascript" charset="utf-8"></script>
20 changes: 20 additions & 0 deletions apps/dashboard/app/views/layouts/_announcements.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<% @announcements.select(&:valid?).reject(&:completed?).each do |announcement| %>
<div id="announcement-<%=announcement.id%>" class="alert alert-<%= announcement.type %> announcement" role="alert">
<div class="announcement-body"><%= raw OodAppkit.markdown.render(announcement.msg) %></div>
<% if announcement.dismissible? %>
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<%=
button_to(
settings_path,
method: :post,
form_class: 'announcement-form',
class: "btn btn-#{announcement.type} me-md-2 announcement-button",
params: { settings: { announcements: { announcement.id => Time.now.localtime.strftime('%Y-%m-%d %H:%M:%S') } } }
) do
announcement.button_text
end
%>
</div>
<% end %>
</div>
<% end %>
1 change: 1 addition & 0 deletions apps/dashboard/app/views/layouts/_config.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
data-bc-index-url="<%= batch_connect_sessions_path %>"
data-status-poll-delay="<%= Configuration.status_poll_delay %>"
data-status-index-url="<%= system_status_path if respond_to?(:system_status_path) %>"
data-apps-datatable-page-length="<%= @user_configuration.apps_datatable[:page_length] %>"
></div>
6 changes: 1 addition & 5 deletions apps/dashboard/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@

<div class="<%= local_assigns[:layout_container_class] || 'container-md' %> content mt-4" role="main">

<% @announcements.select(&:valid?).each do |announcement| %>
<div class="alert alert-<%= announcement.type %> announcement" role="alert">
<%= raw OodAppkit.markdown.render(announcement.msg) %>
</div>
<% end %>
<%= render "layouts/announcements" %>

<%= render "layouts/browser_warning" %>

Expand Down
4 changes: 4 additions & 0 deletions apps/dashboard/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ en:
jobs_scripts_fixed_field: "Fixed Value"

settings_updated: "Settings updated"
settings_invalid_request: "Invalid settings submitted"

announcements_required_button: "Accept"
announcements_dismissible_button: "OK"

bc_saved_settings:
title: "Saved Settings"
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"oboe": "^2.1.5",
"sass": "^1.50.0",
"sweetalert2": "10.16.9",
"ace-code": "^1.35.0",
"uppy": "^3.27.0"
},
"scripts": {
Expand Down
14 changes: 0 additions & 14 deletions apps/dashboard/public/ace/1.2.6/ace.js

This file was deleted.

5 changes: 0 additions & 5 deletions apps/dashboard/public/ace/1.2.6/ext-beautify.js

This file was deleted.

Loading

0 comments on commit adf7a03

Please sign in to comment.