diff --git a/apps/dashboard/app/javascript/path_selector/path_selector.js b/apps/dashboard/app/javascript/path_selector/path_selector.js index 9d604deef4..451dc7b1a7 100644 --- a/apps/dashboard/app/javascript/path_selector/path_selector.js +++ b/apps/dashboard/app/javascript/path_selector/path_selector.js @@ -31,6 +31,7 @@ function getPathSelectorOptions(element) { options.inputFieldId = element.dataset['inputFieldId']; options.showFiles = element.dataset['showFiles']; options.showHidden = element.dataset['showHidden']; + options.filePattern = element.dataset['filePattern'] options.modalId = element.id; return options; diff --git a/apps/dashboard/app/javascript/path_selector/path_selector_data_table.js b/apps/dashboard/app/javascript/path_selector/path_selector_data_table.js index cc9d550c44..6e8efccf95 100644 --- a/apps/dashboard/app/javascript/path_selector/path_selector_data_table.js +++ b/apps/dashboard/app/javascript/path_selector/path_selector_data_table.js @@ -12,6 +12,7 @@ export class PathSelectorTable { modalId = undefined; showHidden = undefined; showFiles = undefined; + filePattern = undefined; constructor(options) { this.tableId = options.tableId; @@ -23,6 +24,7 @@ export class PathSelectorTable { this.modalId = options.modalId; this.showHidden = options.showHidden === 'true'; this.showFiles = options.showFiles === 'true'; + this.filePattern = options.filePattern; this.initDataTable(); this.reloadTable(this.initialUrl()); @@ -216,7 +218,16 @@ export class PathSelectorTable { } else if(isHidden) { return this.showHidden; } else if(isFile) { - return this.showFiles; + if (this.filePattern !== "") { + if (file.name.match(RegExp(this.filePattern))) { + return this.showFiles; + } else { + return false; + } + } + else { + return this.showFiles; + } } else { return true; } diff --git a/apps/dashboard/app/views/batch_connect/session_contexts/_path_selector.html.erb b/apps/dashboard/app/views/batch_connect/session_contexts/_path_selector.html.erb index 96598d350a..748fd34ec9 100644 --- a/apps/dashboard/app/views/batch_connect/session_contexts/_path_selector.html.erb +++ b/apps/dashboard/app/views/batch_connect/session_contexts/_path_selector.html.erb @@ -6,6 +6,7 @@ locals = { show_hidden: field_options.fetch(:show_hidden, false), show_files: field_options.fetch(:show_files, true), + file_pattern: field_options.fetch(:file_pattern, ''), initial_directory: field_options.fetch(:directory, CurrentUser.home), favorites: pathselector_favorites(field_options.try(:[], :favorites)), diff --git a/apps/dashboard/app/views/projects/_form.html.erb b/apps/dashboard/app/views/projects/_form.html.erb index e660575b39..1f46d1ea4b 100644 --- a/apps/dashboard/app/views/projects/_form.html.erb +++ b/apps/dashboard/app/views/projects/_form.html.erb @@ -12,7 +12,7 @@ breadcrumb_id: "#{path_selector_id}_breadcrumb", button_id: "#{path_selector_id}_button", input_field_id: 'project_directory', - favorites: false + favorites: false, } %> diff --git a/apps/dashboard/app/views/shared/_path_selector_table.html.erb b/apps/dashboard/app/views/shared/_path_selector_table.html.erb index 127159f2c8..322b70218d 100644 --- a/apps/dashboard/app/views/shared/_path_selector_table.html.erb +++ b/apps/dashboard/app/views/shared/_path_selector_table.html.erb @@ -12,6 +12,7 @@ data-breadcrumb-id="<%= breadcrumb_id %>" data-select-button-id="<%= button_id %>" data-input-field-id="<%= input_field_id %>" + data-file-pattern="<%= file_pattern %>" >