Skip to content

Commit

Permalink
Merge branch 'master' into feature/3944-add-file-browser-to-projects#…
Browse files Browse the repository at this point in the history
…show
  • Loading branch information
euler-room committed Dec 5, 2024
2 parents 08c28a2 + 9d372e4 commit 807e3fe
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 200 deletions.
38 changes: 37 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]

### Added
- BatchConnect form labels can now be made dynamic with data-label-* in [3498](https://github.com/OSC/ondemand/pull/3498).
- BatchConnect form labels can now be made dynamic with data-label-* in [3598](https://github.com/OSC/ondemand/pull/3598).
- BatchConnect form auto_modules directive can now filter by string or regex in [3574](https://github.com/OSC/ondemand/pull/3574).
- Saved settings widget in [#3545](https://github.com/OSC/ondemand/pull/3545).
- BatchConnect cards can now edit and relaunch the session in [3358](https://github.com/OSC/ondemand/pull/3358).
Expand Down Expand Up @@ -64,6 +64,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- test, package and development gems are no longer installed in production in [3906](https://github.com/OSC/ondemand/pull/3906).
- A single cluster form item is now hidden, not fixed, allowing dynamic directives to work on single clusters in
[3931](https://github.com/OSC/ondemand/pull/3931).
- OnDemand packages no longer relies on scl at runtime in [3952](https://github.com/OSC/ondemand/pull/3952).
- Only root owned ondemand.d files will be loaded in prodution in [3969](https://github.com/OSC/ondemand/pull/3969).
- The files app will now create a spinner on the files table when making new requests in [3973](https://github.com/OSC/ondemand/pull/3973).

### Fixed
- Ensure that the asset directory is clean when building in [3356](https://github.com/OSC/ondemand/pull/3356).
Expand All @@ -88,13 +91,44 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Select all in the files app will only select the visible rows in [3925](https://github.com/OSC/ondemand/pull/3925).
- Batch jobs now specify workdir, fixing issues with submit_host jobs in [3913](https://github.com/OSC/ondemand/pull/3913).
- Javascript that queires for atch connect sessions will create an alert div and stop polling if it fails in [3915](https://github.com/OSC/ondemand/pull/3915).
- auto_qos correctly returns one option for each qos in [3955](https://github.com/OSC/ondemand/pull/3955).

### Security

- Jobs will now be submitted after sanitizing the envionment in
[3627](https://github.com/OSC/ondemand/pull/3627). This prevents
the leaking of sensitive environment variables to the job when `copy_environment`
is used.
- The shell app now has several configurations to stop or extend ssh sessions. This is
a security issue becuase an ssh session can remain open long after the authentication
system has ended that session. I.e., it can go on forever. So, the shell app now
disables ping pong by default and has configurations for how long sessions can
exist with and without activity in [3810](https://github.com/OSC/ondemand/pull/3815)
and [3805](https://github.com/OSC/ondemand/pull/3805).

## [3.1.10] - 11-07-2024

### Fixed

- Fixed Ubuntu 24.04 packaging issue in [3936](https://github.com/OSC/ondemand/pull/3936).
- MOTD in `md.erb` format should also respond to sanitize_html in [3876](https://github.com/OSC/ondemand/pull/3876).

## [3.1.9] - 10-08-2024

### Fixed

- Support for higher versions of httpd in [3779](https://github.com/OSC/ondemand/pull/3779) and [3852](https://github.com/OSC/ondemand/pull/3852).
- `ood_auth_map` now accounts for more than just characters in [3779](https://github.com/OSC/ondemand/pull/3779).
- Uploads always succeed even when the chown operation afterwards fails in [3861](https://github.com/OSC/ondemand/pull/3861).
- The ood_portal.conf now accounts for /dex (dex_uri) when enabling maintenance mode in [3779](https://github.com/OSC/ondemand/pull/3779).

### Security

- The shell app now has several configurations to stop or extend ssh sessions. This is
a security issue becuase an ssh session can remain open long after the authentication
system has ended that session. I.e., it can go on forever. So, the shell app now
disables ping pong by default and has configurations for how long sessions can
exist with and without activity in [3815](https://github.com/OSC/ondemand/pull/3815).

## [3.1.7] - 06-25-2024

Expand Down Expand Up @@ -1442,6 +1476,8 @@ Similar changelog as [3.0.0]. This version was not released to the general publi
- From 1.3.7 - 1.4.2 updated app versions

[Unreleased]: https://github.com/OSC/ondemand/compare/v3.1.0...HEAD
[3.1.10]: https://github.com/OSC/ondemand/compare/v3.1.9...v3.1.10
[3.1.9]: https://github.com/OSC/ondemand/compare/v3.1.7...v3.1.9
[3.1.7]: https://github.com/OSC/ondemand/compare/v3.1.4...v3.1.7
[3.1.4]: https://github.com/OSC/ondemand/compare/v3.1.1...v3.1.4
[3.1.1]: https://github.com/OSC/ondemand/compare/v3.1.0...v3.1.1
Expand Down
8 changes: 4 additions & 4 deletions apps/dashboard/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ GEM
mime-types-data (3.2024.1105)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.25.1)
mocha (2.5.0)
minitest (5.25.2)
mocha (2.6.1)
ruby2_keywords (>= 0.0.5)
multi_json (1.15.0)
mustermann (3.0.3)
Expand Down Expand Up @@ -223,10 +223,10 @@ GEM
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.2.1)
rdoc (6.7.0)
rdoc (6.8.1)
psych (>= 4.0.0)
redcarpet (3.6.0)
regexp_parser (2.9.2)
regexp_parser (2.9.3)
request_store (1.7.0)
rack (>= 1.4)
rest-client (2.1.0)
Expand Down
66 changes: 33 additions & 33 deletions apps/dashboard/app/controllers/launchers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
class LaunchersController < ApplicationController

before_action :find_project
before_action :find_script, only: [:show, :edit, :destroy, :submit, :save]
before_action :find_launcher, only: [:show, :edit, :destroy, :submit, :save]

SAVE_SCRIPT_KEYS = [
SAVE_LAUNCHER_KEYS = [
:cluster, :auto_accounts, :auto_accounts_exclude, :auto_accounts_fixed,
:auto_cores, :auto_cores_fixed, :auto_cores_min, :auto_cores_max,
:auto_scripts, :auto_scripts_exclude, :auto_scripts_fixed,
Expand All @@ -19,21 +19,21 @@ class LaunchersController < ApplicationController
].freeze

def new
@script = Launcher.new(project_dir: @project.directory)
@launcher = Launcher.new(project_dir: @project.directory)
end

# POST /dashboard/projects/:project_id/launchers
def create
opts = { project_dir: @project.directory }.merge(create_script_params[:launcher])
@script = Launcher.new(opts)
default_script_created = @script.create_default_script
opts = { project_dir: @project.directory }.merge(create_launcher_params[:launcher])
@launcher = Launcher.new(opts)
default_script_created = @launcher.create_default_script

if @script.save
notice_messages = [I18n.t('dashboard.jobs_scripts_created')]
notice_messages << I18n.t('dashboard.jobs_scripts_default_created') if default_script_created
if @launcher.save
notice_messages = [I18n.t('dashboard.jobs_launchers_created')]
notice_messages << I18n.t('dashboard.jobs_launchers_default_created') if default_script_created
redirect_to project_path(params[:project_id]), notice: notice_messages.join(' ')
else
redirect_to project_path(params[:project_id]), alert: @script.errors[:save].last
redirect_to project_path(params[:project_id]), alert: @launcher.errors[:save].last
end
end

Expand All @@ -44,69 +44,69 @@ def edit

# DELETE /projects/:project_id/launchers/:id
def destroy
if @script.destroy
redirect_to project_path(params[:project_id]), notice: I18n.t('dashboard.jobs_scripts_deleted')
if @launcher.destroy
redirect_to project_path(params[:project_id]), notice: I18n.t('dashboard.jobs_launchers_deleted')
else
redirect_to project_path(params[:project_id]), alert: @script.errors[:destroy].last
redirect_to project_path(params[:project_id]), alert: @launcher.errors[:destroy].last
end
end

# POST /projects/:project_id/launchers/:id/save
# save the launcher after editing
def save
@script.update(save_script_params[:launcher])
@launcher.update(save_launcher_params[:launcher])

if @script.save
redirect_to project_path(params[:project_id]), notice: I18n.t('dashboard.jobs_scripts_updated')
if @launcher.save
redirect_to project_path(params[:project_id]), notice: I18n.t('dashboard.jobs_launchers_updated')
else
redirect_to project_path(params[:project_id]), alert: @script.errors[:save].last
redirect_to project_path(params[:project_id]), alert: @launcher.errors[:save].last
end
end

# POST /projects/:project_id/launchers/:id/submit
# submit the job
def submit
opts = submit_script_params[:launcher].to_h.symbolize_keys
opts = submit_launcher_params[:launcher].to_h.symbolize_keys

if (job_id = @script.submit(opts))
redirect_to(project_path(params[:project_id]), notice: I18n.t('dashboard.jobs_scripts_submitted', job_id: job_id))
if (job_id = @launcher.submit(opts))
redirect_to(project_path(params[:project_id]), notice: I18n.t('dashboard.jobs_launchers_submitted', job_id: job_id))
else
redirect_to(project_path(params[:project_id]), alert: @script.errors[:submit].last)
redirect_to(project_path(params[:project_id]), alert: @launcher.errors[:submit].last)
end
end

private

def find_script
@script = Launcher.find(show_script_params[:id], @project.directory)
redirect_to(project_path(@project.id), alert: "Cannot find script #{show_script_params[:id]}") if @script.nil?
def find_launcher
@launcher = Launcher.find(show_launcher_params[:id], @project.directory)
redirect_to(project_path(@project.id), alert: "Cannot find launcher #{show_launcher_params[:id]}") if @launcher.nil?
end

def create_script_params
def create_launcher_params
params.permit({ launcher: [:title] }, :project_id)
end

def show_script_params
def show_launcher_params
params.permit(:id, :project_id)
end

def submit_script_params
keys = @script.smart_attributes.map { |sm| sm.id.to_s }
def submit_launcher_params
keys = @launcher.smart_attributes.map { |sm| sm.id.to_s }
params.permit({ launcher: keys }, :project_id, :id)
end

def save_script_params
def save_launcher_params
auto_env_params = params[:launcher].keys.select do |k|
k.match?('auto_environment_variable')
end
allowlist = SAVE_SCRIPT_KEYS + auto_env_params

allowlist = SAVE_LAUNCHER_KEYS + auto_env_params

params.permit({ launcher: allowlist }, :project_id, :id)
end

def find_project
@project = Project.find(show_script_params[:project_id])
redirect_to(projects_path, alert: "Cannot find project: #{show_script_params[:project_id]}") if @project.nil?
@project = Project.find(show_launcher_params[:project_id])
redirect_to(projects_path, alert: "Cannot find project: #{show_launcher_params[:project_id]}") if @project.nil?
end
end
4 changes: 2 additions & 2 deletions apps/dashboard/app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ def show
format.json { render json: { message: message }, status: :not_found }
end
else
@scripts = Launcher.all(@project.directory)
@launchers = Launcher.all(@project.directory)
@valid_project = Launcher.clusters?
@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 @launchers.any? && !@valid_scripts
flash.now[:alert] = alert_messages.join(' ') if alert_messages.any?
respond_to do |format|
format.html
Expand Down
15 changes: 14 additions & 1 deletion apps/dashboard/app/javascript/files/data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const EVENTNAME = {
};

const CONTENTID = '#directory-contents';
const SPINNERID = '#tloading_spinner';

let table = null;

Expand Down Expand Up @@ -269,6 +270,8 @@ class DataTable {
async reloadTable(url) {
var request_url = url || history.state.currentDirectoryUrl;

this.toggleSpinner();

try {
const response = await fetch(request_url, { headers: { 'Accept': 'application/json' }, cache: 'no-store' });
const data = await this.dataFromJsonResponse(response);
Expand Down Expand Up @@ -297,7 +300,10 @@ class DataTable {
table.getTable().row(this.closest('tr')).deselect();
}
}
})
});

this.toggleSpinner();

return result;
} catch (e) {
const eventData = {
Expand All @@ -308,12 +314,19 @@ class DataTable {
$(CONTENTID).trigger(SWAL_EVENTNAME.showError, eventData);

$('#open-in-terminal-btn').addClass('disabled');

this.toggleSpinner()

// Removed this as it was causing a JS Error and there is no reprocution from removing it.
// return await Promise.reject(e);
}
}

toggleSpinner() {
document.querySelector(SPINNERID).classList.toggle('d-none');
document.querySelector(CONTENTID).classList.toggle('d-none');
}

updateDotFileVisibility() {
this.reloadTable();
}
Expand Down
3 changes: 1 addition & 2 deletions apps/dashboard/app/javascript/files/globus.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export function getGlobusLink(directory) {
if (info) {
let origin_path = directory.replace(info.path, info.endpoint_path);
origin_path = origin_path.replace("//", "/");
url = "https://app.globus.org/file-manager?origin_id=" + info.endpoint + "&origin_path=" + origin_path;
return url
return "https://app.globus.org/file-manager?origin_id=" + info.endpoint + "&origin_path=" + origin_path;
}
}

Expand Down
8 changes: 4 additions & 4 deletions apps/dashboard/app/javascript/support_ticket.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jQuery(function (){
}

function showAttachmentsError(message) {
const $attachmentsElement = $("[data-toggle='attachments-error']");
const $attachmentsElement = $("[data-bs-toggle='attachments-error']");
$attachmentsElement.parent().addClass("has-error");
$attachmentsElement.after(`<div class="help-block" id="attachments_error">${message}</div>`);
}
Expand Down Expand Up @@ -76,14 +76,14 @@ jQuery(function (){
`<div class="attachment-input" id="${newAttachmentContainerId}">
<div class="form-control attachment-input-content">
<label class="attachment-file-label" for="${newFileInputId}">No file selected</label>
<span class="attachment-delete" data-toggle="attachment-delete" data-attachment-container="${newAttachmentContainerId}" title="Delete attachment"><i class="fas fa-trash-alt"></i></span>
<span class="attachment-delete" data-bs-toggle="attachment-delete" data-attachment-container="${newAttachmentContainerId}" title="Delete attachment"><i class="fas fa-trash-alt"></i></span>
</div>
<input class="form-control" type="file" name="support_ticket[attachments][]" id="${newFileInputId}">
</div>`;

attachmentPlacementCallback(newAttachment);
$("input[type='file']").on("change", updateAttachmentContent);
$("[data-toggle='attachment-delete']").on("click", deleteAttachment);
$("[data-bs-toggle='attachment-delete']").on("click", deleteAttachment);
return newAttachment;
}

Expand All @@ -100,7 +100,7 @@ jQuery(function (){
}

$(function() {
$("[data-toggle='attachments-add']").on("click", addAttachment);
$("[data-bs-toggle='attachments-add']").on("click", addAttachment);
$("#new_support_ticket").submit(validateForm);
});

Expand Down
Loading

0 comments on commit 807e3fe

Please sign in to comment.