Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge seek 1.15.1 into LDH #56

Merged
merged 148 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
d02d54c
Add 'assets/manage_specific_attributes' for assay streams
kdp-cloud May 8, 2024
ddd8a1b
Hide assay design in case of assay stream
kdp-cloud May 8, 2024
5e8b151
new AuthLookupMaintenanceJob to check consistency, runs priority 3 on…
stuzart May 7, 2024
b76db9e
skip users that are already queued when checking, probably a newly re…
stuzart May 7, 2024
beb0de6
skip any types that are present in the queue #1866
stuzart May 7, 2024
106df34
updated schedule test #1866
stuzart May 7, 2024
31fde85
check each type, rather than just taking the first failing type #1866
stuzart May 7, 2024
c7464fa
queue authupdate for user only after person_id is associated #1866
stuzart May 7, 2024
9749e09
updated to to check job is queued after registration #1866
stuzart May 7, 2024
4aa490c
give UserAuthLookupUpdateJob a longer timeout of 30 mins, and do in b…
stuzart May 7, 2024
12717cf
also skip if person is on the queue, and added test to check for anon…
stuzart May 8, 2024
3b5731c
use each instead of find_each, due to an issue when combined with off…
stuzart May 8, 2024
50aea21
Merge pull request #1871 from ELIXIR-Belgium/issue_1868_fix_assay_str…
kdp-cloud May 8, 2024
211896f
upgrade tweaks WIP #1861
stuzart May 9, 2024
4ebf317
finished improving the upgrade tasks for updating samples #1861
stuzart May 13, 2024
d209fa8
removed upgrade tasks from 1.14 #1861
stuzart May 13, 2024
8ab176c
don't queue reindexing items or jobs, or create follow on jobs, if so…
stuzart May 13, 2024
0717937
internationalize the names in the search types
kdp-cloud May 15, 2024
bb7e941
Add test
kdp-cloud May 15, 2024
45f779b
Restore the internalisation settings afterwards
kdp-cloud May 15, 2024
e0d7cc5
Issue 1783 fix add new button (#1872)
kdp-cloud May 15, 2024
932bb6b
Merge pull request #1881 from ELIXIR-Belgium/issue_1879_fix_search_op…
kdp-cloud May 15, 2024
51653bb
Rewrite can_create? function in more clear way.
kdp-cloud May 16, 2024
c3c0485
Filter out administered projects in a very very messy way
kdp-cloud May 16, 2024
42e5890
Make current_person available as helper method and simplify logic.
kdp-cloud May 16, 2024
a768918
Hide 'Add new attribute button' when it's a new form and shows the bu…
kdp-cloud May 16, 2024
7f6f50b
update version numbers for 1.15.0
stuzart May 16, 2024
b6bf4bb
Only lock attribute fields when template is applied on a sample type
kdp-cloud May 16, 2024
2a43900
Make sure template attributes can be removed, even when inherrited an…
kdp-cloud May 16, 2024
8b327a7
Add tests for the `Add new attribute` button
kdp-cloud May 16, 2024
0055e6f
Add authorised_assay_assets function to data_files_helper
AndrewWood94 May 21, 2024
a367ba6
Only show authorised assays when extracting samples
AndrewWood94 May 21, 2024
affb208
add test for project selector
kdp-cloud May 23, 2024
3be5676
Add 'disabled' class instead of disabled prop. This ensures the value…
kdp-cloud May 23, 2024
0fec474
Make `is_title` and `required` attributes read-only if inherited
kdp-cloud May 23, 2024
6469193
Replace 'disabled' prop with bootstrap class
kdp-cloud May 23, 2024
579f5e3
make isa_json_compliant sample_type editable when project member instead
kdp-cloud May 23, 2024
66a9e6a
Add sample type constraint test for `allow_required?` of inherited sa…
kdp-cloud May 23, 2024
52e3061
Remove all logic from the views and transfer to controller
kdp-cloud May 24, 2024
5d552c3
Simplify controller
kdp-cloud May 24, 2024
2d90adb
Better errors when not allowed to edit
kdp-cloud May 24, 2024
9612d42
Remove JS that causes the default policy prompt to show twice
kdp-cloud May 24, 2024
723f642
Remove investigation list partial that conflicts with default policy …
kdp-cloud May 24, 2024
3c32ab0
Prepopulate the investigation ID when assigning `@isa_study`
kdp-cloud May 24, 2024
2bf968a
Simplification + better error messages
kdp-cloud May 24, 2024
b926597
Skip value if ID is blank
kdp-cloud May 24, 2024
a62a0c7
Rename registeredSamplesObjectsInput
kdp-cloud May 24, 2024
e286ad2
Replace drop-down with objects input with limit of 1 for registered s…
kdp-cloud May 24, 2024
1bb74c5
Fix tests
kdp-cloud May 27, 2024
36ba2e3
Remove the data-dismiss attribute and add a function that hides the m…
kdp-cloud May 27, 2024
52c636c
Add functionality for cancel button
kdp-cloud May 27, 2024
60bcd97
Make terms unique within a sample controlled vocab
kdp-cloud May 27, 2024
ec659ad
Add id as a hidden field to also pass the ID to the controller when u…
kdp-cloud May 27, 2024
e1505f1
Revert last two commits
kdp-cloud May 27, 2024
f68896e
Merge pull request #1897 from ELIXIR-Belgium/fix_registered_sample_at…
kdp-cloud May 29, 2024
57819ec
Revert changes
kdp-cloud May 29, 2024
668852c
Add function to stop the propagation of the data-dismiss of the inner…
kdp-cloud May 29, 2024
fdffeb9
Add static backdrop to the batch permissions modal
kdp-cloud May 29, 2024
12935e0
Group all helper methods together
kdp-cloud May 29, 2024
0ca2d43
Merge pull request #1884 from ELIXIR-Belgium/fix_template_creation_pe…
kdp-cloud May 29, 2024
c3f9a08
Merge pull request #1898 from ELIXIR-Belgium/fix_batch_sharing_permis…
kdp-cloud May 30, 2024
580f342
Merge pull request #1896 from ELIXIR-Belgium/issue_1891_fix_isa_json_…
kdp-cloud May 30, 2024
d143bd4
Add hidden id fields to the CV terms form and add a uniqueness clause…
kdp-cloud May 27, 2024
624f8d6
Update data_files_controller.rb
AndrewWood94 May 27, 2024
13e4647
Destroy existing sample_persistence_task if re-extracting
AndrewWood94 May 30, 2024
f35182d
Simplify assay linkage
kdp-cloud May 31, 2024
8e37e73
Make use of `:is_input?` instead
kdp-cloud May 31, 2024
d187873
Simplification + update even when not authorized
kdp-cloud May 31, 2024
77f8bdd
Add unit test for uniqueness clause
kdp-cloud May 31, 2024
feb52ca
Fix current controller tests
kdp-cloud May 31, 2024
94c2964
Add test for duplicated CV terms
kdp-cloud May 31, 2024
fce8e34
Pass errors to partials
kdp-cloud Jun 3, 2024
0c5099f
Merge pull request #1906 from ELIXIR-Belgium/fix_cv_terms
kdp-cloud Jun 3, 2024
acb61bf
Merge pull request #1904 from ELIXIR-Belgium/fix_add_assay_between_as…
kdp-cloud Jun 3, 2024
f666d69
Add test for unauthorized samples [JSON response]
kdp-cloud Jun 3, 2024
2ffba23
typo
kdp-cloud Jun 3, 2024
f1247bb
Set empty cells to nil
kdp-cloud Jun 3, 2024
c371563
Skip id and uuid columns when comparing metadata
kdp-cloud Jun 3, 2024
ace380f
Fix existing tests
kdp-cloud Jun 3, 2024
04a82a4
Add thead and tbody elements
kdp-cloud Jun 3, 2024
b76c1f6
Test the rendered HTML
kdp-cloud Jun 3, 2024
10a321e
Redirect to correct item in SP view
kdp-cloud Jun 3, 2024
e6d7223
Bump actionpack from 6.1.7.7 to 6.1.7.8
dependabot[bot] Jun 4, 2024
3ec31c0
fix nokogiri version mismatch
stuzart Jun 5, 2024
842fc55
Typo fix
fbacall Jun 6, 2024
af0ecb4
fix pid uri validation, and handle gracefully in short_pid for existi…
stuzart Jun 5, 2024
91d0dcf
fix factory pid to conform to fixed validation #1865
stuzart Jun 5, 2024
2475134
replace space with - instead of _ #1865
stuzart Jun 5, 2024
2f122b0
Account for git in `contains_downloadable_items?`. Fixes #1915
fbacall Jun 6, 2024
f288b8b
Merge pull request #1909 from ELIXIR-Belgium/minor_fix_sample_batch_u…
kdp-cloud Jun 6, 2024
6967c99
Merge pull request #1916 from seek4science/fix-contains-downloadable-…
fbacall Jun 7, 2024
69edef8
Bump nf-core rnaseq fixture
fbacall Jun 5, 2024
97f712c
Attempt to get git tags in order of creation
fbacall Jun 5, 2024
12a87af
make sure policy copied when persisting extracted samples #1899
stuzart May 31, 2024
96f8dae
fix tests by removing forced raise of exception #1899
stuzart Jun 4, 2024
085a7e4
enhance test to check for permissions #1899
stuzart Jun 4, 2024
5a370fb
double check policy/permissions are true copies and not referencing e…
stuzart Jun 4, 2024
3357de0
skip validations when saving the Policy #1899
stuzart Jun 4, 2024
3a562b5
Ignore disabled/archived repos
fbacall Jun 10, 2024
b1cd450
test the impact on running time when turning off config caching durin…
stuzart Jun 6, 2024
d06ad90
Revert "test the impact on running time when turning off config cachi…
stuzart Jun 6, 2024
805f00a
always clear the cache when calling with_config_value in tests #1917
stuzart Jun 6, 2024
7fe9748
Merge pull request #1919 from seek4science/git-tag-order-1.15
fbacall Jun 11, 2024
ca441a0
Add publish button error handling.
MasoudAbedi Jun 11, 2024
8efd499
Update publish button error handling.
MasoudAbedi Jun 11, 2024
de2de7f
Update _buttons.html.erb
ReneHaensel Jun 11, 2024
b73731b
Update publish button error handling.
MasoudAbedi Jun 11, 2024
fe9a2fd
Update MDS Code
ReneHaensel Jun 12, 2024
38adb98
when bives fails, correctly catch the exception and report just the S…
stuzart Jun 14, 2024
42dfd29
readd raise exception, commented out during testing #1921
stuzart Jun 14, 2024
6a67035
report the arguments when a job fails #1889
stuzart Jun 14, 2024
7da81ba
Handle `mentions` or `about` being single values
fbacall Jun 18, 2024
b3588f8
Merge pull request #1924 from seek4science/fix-ro-crate-parse
fbacall Jun 18, 2024
4e2d8d5
Make the template extractor job fail
kdp-cloud Jun 19, 2024
569be08
Remove the file after processing
kdp-cloud Jun 19, 2024
03debb6
Fix current test
kdp-cloud Jun 19, 2024
201e97d
Translate to html
kdp-cloud Jun 19, 2024
1f2cf52
linting
kdp-cloud Jun 19, 2024
7f7ae59
Include template count test
kdp-cloud Jun 19, 2024
9e35b45
typo
kdp-cloud Jun 19, 2024
5b9d267
Simplify
kdp-cloud Jun 19, 2024
70a0409
Create template only if no errors occur
kdp-cloud Jun 19, 2024
88a6004
Add a test for an invalid json
kdp-cloud Jun 19, 2024
e10f917
Create ISA tags at setup
kdp-cloud Jun 19, 2024
2de7cbf
Updated the code to disable the publish button when there is no metad…
MasoudAbedi Jun 19, 2024
37e8826
Remove all files in directory after extraction
kdp-cloud Jun 20, 2024
946c707
Rename fixture
kdp-cloud Jun 20, 2024
b98f42b
Add tests when invalid ISA tags are used
kdp-cloud Jun 20, 2024
1ea11b2
Use FileUtils instead of raw shell commands
kdp-cloud Jun 20, 2024
7a01ef8
update version to 1.15.1
stuzart Jun 20, 2024
fc4bfea
rebuilt api examples from a clean test db
stuzart Jun 20, 2024
2d88566
not lose temporary access code in the URL when switching between ver…
whomingbird Jun 21, 2024
52ccfbf
Updated the code to update project on CSH.
MasoudAbedi Jun 24, 2024
f08094e
Fix a bug in the code.
MasoudAbedi Jun 24, 2024
37b6d9a
Merge pull request #1930 from seek4science/issue-1926
whomingbird Jun 24, 2024
4ab68f4
Fix a bug in the code.
MasoudAbedi Jun 24, 2024
250a468
fix bug error handling
ReneHaensel Jun 24, 2024
5cde9a2
Fix typo
kdp-cloud Jun 25, 2024
de3cbcc
Clear cache
kdp-cloud Jun 25, 2024
ee9de7f
Set SampleAttribute title manually
kdp-cloud Jun 26, 2024
7b34bb8
Merge pull request #1931 from ELIXIR-Belgium/fix_populate_templates_job
kdp-cloud Jun 28, 2024
1b8b414
add an alert message to remind users to confirm addin the Remote URL
whomingbird Jul 2, 2024
05183a5
fix typo
whomingbird Jul 3, 2024
71cbb65
Merge pull request #1938 from seek4science/improve-model-creation-UI
whomingbird Jul 4, 2024
37b98fe
update Seeds Resource identifier
ReneHaensel Jul 4, 2024
3356736
remove the double checking and updating of the mime type #1820
stuzart Apr 11, 2024
839c95e
Merge remote-tracking branch 'SEEK/seek-1.15' into merge-seek-1.15.1
ReneHaensel Jul 9, 2024
7208cc5
Merge branch 'main' into merge-seek-1.15.1intoLDH
ReneHaensel Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ gem 'will_paginate', '~> 3.1'
gem 'yaml_db'
gem 'rails_autolink'
gem 'rfc-822'
gem 'nokogiri', '~> 1.16.2'
gem 'nokogiri', '~> 1.16'
#necessary for newer hashie dependency, original api_smith is no longer active
gem 'api_smith', git: 'https://github.com/youroute/api_smith.git', ref: '1fb428cebc17b9afab25ac9f809bde87b0ec315b'
gem 'rdf-virtuoso', '>= 0.2.0'
Expand Down
126 changes: 64 additions & 62 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,40 @@ GEM
remote: https://rubygems.org/
specs:
RedCloth (4.3.3)
actioncable (6.1.7.7)
actionpack (= 6.1.7.7)
activesupport (= 6.1.7.7)
actioncable (6.1.7.8)
actionpack (= 6.1.7.8)
activesupport (= 6.1.7.8)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
actionmailbox (6.1.7.8)
actionpack (= 6.1.7.8)
activejob (= 6.1.7.8)
activerecord (= 6.1.7.8)
activestorage (= 6.1.7.8)
activesupport (= 6.1.7.8)
mail (>= 2.7.1)
actionmailer (6.1.7.7)
actionpack (= 6.1.7.7)
actionview (= 6.1.7.7)
activejob (= 6.1.7.7)
activesupport (= 6.1.7.7)
actionmailer (6.1.7.8)
actionpack (= 6.1.7.8)
actionview (= 6.1.7.8)
activejob (= 6.1.7.8)
activesupport (= 6.1.7.8)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.7.7)
actionview (= 6.1.7.7)
activesupport (= 6.1.7.7)
actionpack (6.1.7.8)
actionview (= 6.1.7.8)
activesupport (= 6.1.7.8)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.7)
actionpack (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
actiontext (6.1.7.8)
actionpack (= 6.1.7.8)
activerecord (= 6.1.7.8)
activestorage (= 6.1.7.8)
activesupport (= 6.1.7.8)
nokogiri (>= 1.8.5)
actionview (6.1.7.7)
activesupport (= 6.1.7.7)
actionview (6.1.7.8)
activesupport (= 6.1.7.8)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -94,14 +94,14 @@ GEM
activemodel (>= 4.1, < 7.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (6.1.7.7)
activesupport (= 6.1.7.7)
activejob (6.1.7.8)
activesupport (= 6.1.7.8)
globalid (>= 0.3.6)
activemodel (6.1.7.7)
activesupport (= 6.1.7.7)
activerecord (6.1.7.7)
activemodel (= 6.1.7.7)
activesupport (= 6.1.7.7)
activemodel (6.1.7.8)
activesupport (= 6.1.7.8)
activerecord (6.1.7.8)
activemodel (= 6.1.7.8)
activesupport (= 6.1.7.8)
activerecord-import (1.3.0)
activerecord (>= 4.2)
activerecord-session_store (2.0.0)
Expand All @@ -110,14 +110,14 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1)
activestorage (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
activerecord (= 6.1.7.7)
activesupport (= 6.1.7.7)
activestorage (6.1.7.8)
actionpack (= 6.1.7.8)
activejob (= 6.1.7.8)
activerecord (= 6.1.7.8)
activesupport (= 6.1.7.8)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.7)
activesupport (6.1.7.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -198,7 +198,7 @@ GEM
execjs
coffee-script-source (1.12.2)
commonmarker (0.23.10)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.1)
connection_pool (2.3.0)
countries (5.2.0)
unaccent (~> 0.3)
Expand Down Expand Up @@ -322,7 +322,7 @@ GEM
httpclient (2.8.3)
httpi (1.1.1)
rack
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
i18n-js (3.9.0)
i18n (>= 0.6.6)
Expand Down Expand Up @@ -460,7 +460,7 @@ GEM
nokogiri (~> 1)
rake
mini_mime (1.1.5)
mini_portile2 (2.8.5)
mini_portile2 (2.8.7)
minitest (5.20.0)
minitest-reporters (1.5.0)
ansi
Expand Down Expand Up @@ -492,7 +492,7 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.7.0)
nokogiri (1.16.2)
nokogiri (1.16.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nori (1.1.5)
Expand Down Expand Up @@ -566,8 +566,8 @@ GEM
puma (5.6.8)
nio4r (~> 2.0)
pyu-ruby-sasl (0.0.3.3)
racc (1.7.3)
rack (2.2.8.1)
racc (1.8.0)
rack (2.2.9)
rack-attack (6.6.0)
rack (>= 1.0, < 3)
rack-cors (1.1.1)
Expand All @@ -584,20 +584,20 @@ GEM
rack
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.7)
actioncable (= 6.1.7.7)
actionmailbox (= 6.1.7.7)
actionmailer (= 6.1.7.7)
actionpack (= 6.1.7.7)
actiontext (= 6.1.7.7)
actionview (= 6.1.7.7)
activejob (= 6.1.7.7)
activemodel (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
rails (6.1.7.8)
actioncable (= 6.1.7.8)
actionmailbox (= 6.1.7.8)
actionmailer (= 6.1.7.8)
actionpack (= 6.1.7.8)
actiontext (= 6.1.7.8)
actionview (= 6.1.7.8)
activejob (= 6.1.7.8)
activemodel (= 6.1.7.8)
activerecord (= 6.1.7.8)
activestorage (= 6.1.7.8)
activesupport (= 6.1.7.8)
bundler (>= 1.15.0)
railties (= 6.1.7.7)
railties (= 6.1.7.8)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
Expand Down Expand Up @@ -625,9 +625,9 @@ GEM
json
require_all (~> 3.0)
ruby-progressbar
railties (6.1.7.7)
actionpack (= 6.1.7.7)
activesupport (= 6.1.7.7)
railties (6.1.7.8)
actionpack (= 6.1.7.8)
activesupport (= 6.1.7.8)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -728,7 +728,8 @@ GEM
netrc (~> 0.8)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.5)
rexml (3.2.8)
strscan (>= 3.0.9)
rfc-822 (0.4.1)
rmagick (5.3.0)
pkg-config (~> 1.4)
Expand Down Expand Up @@ -861,6 +862,7 @@ GEM
sqlite3 (1.4.2)
stackprof (0.2.25)
stringio (3.0.1.1)
strscan (3.1.0)
sunspot (2.6.0)
pr_geohash (~> 1.0)
rsolr (>= 1.1.1, < 3)
Expand Down Expand Up @@ -950,7 +952,7 @@ GEM
rails (>= 3.0)
rake (>= 0.8.7)
yard (0.9.36)
zeitwerk (2.6.13)
zeitwerk (2.6.15)
zip-container (4.0.2)
rubyzip (~> 2.0.0)

Expand Down Expand Up @@ -1028,7 +1030,7 @@ DEPENDENCIES
my_responds_to_parent!
mysql2
net-ftp
nokogiri (~> 1.16.2)
nokogiri (~> 1.16)
omniauth (~> 2.1.0)
omniauth-github
omniauth-rails_csrf_protection
Expand Down
16 changes: 8 additions & 8 deletions app/assets/javascripts/single_page/dynamic_table.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function sanitizeData(data) {

const objectInputTemp = '<input type="hidden" name="_NAME_[]" id="inpt-_NAME_" value="" autocomplete="off" />' +
'<select name="_NAME_[]" id="select-_NAME_" class="form-control _EXTRACLASS_" title="_TITLE_" data-role="seek-objectsinput" ' +
'data-tags-limit="100" _MULTIPLE?_ style="background-color: coral;" data-typeahead-template="_TYPEHEAD_"' +
'data-tags-limit="_LIMIT?_" multiple style="background-color: coral;" data-typeahead-template="_TYPEHEAD_"' +
'data-typeahead-query-url="_URL_" data-allow-new-items=_ALLOW_FREE_TEXT_>_OPTIONS_</select>';

const typeaheadSamplesUrl = "<%= typeahead_samples_path(linked_sample_type_id: '_LINKED_') %>";
Expand Down Expand Up @@ -86,11 +86,12 @@ const handleSelect = (e) => {
}

c["render"] = function(data_, type, full, meta) {
sanitizedData = sanitizeData(data_);
let sanitizedData = sanitizeData(data_);
let data;
if(c.linked_sample_type){
data = sanitizedData && Array.isArray(sanitizedData) ? sanitizedData : [sanitizedData];
data = data[0]?.id ? data : [];
return inputObjectsInput(c, data, options, linkedSamplesUrl);
return registeredSamplesObjectsInput(c, data, options, linkedSamplesUrl);
} else if(c.is_cv_list && sanitizedData !== "#HIDDEN"){
data = sanitizedData && Array.isArray(sanitizedData) ? sanitizedData : [sanitizedData];
data = data.map((e) => {
Expand Down Expand Up @@ -569,7 +570,7 @@ function retrieveLinkedSamples(url){
return linkedSamples;
}

function inputObjectsInput(column, data, options, url){
function registeredSamplesObjectsInput(column, data, options, url){
const existingOptions = data.map((e) => {
isHiddenInput = (e.title == '#HIDDEN');
if (isHiddenInput) {
Expand All @@ -584,7 +585,6 @@ function inputObjectsInput(column, data, options, url){
const typeaheadTemplate = 'typeahead/single_pages_samples'
const objectInputName = data.map((e) => e.id).join('-') + '-' + crypto.randomUUID();


const unLinkedSamples = data.reduce(function(filtered, sample) {
if(!column.linkedSampleIds.includes(parseInt(sample.id)) && sample.title != '#HIDDEN'){
filtered.push(sample);
Expand All @@ -593,7 +593,7 @@ function inputObjectsInput(column, data, options, url){
}, []);
const hasUnlinkedSamples = unLinkedSamples.length > 0 ? true : false;

const hasMultipleInputs = column.multi_link ? 'multiple="multiple"' : ''
const hasMultipleInputs = column.multi_link ? '100' : '1'
const extraClass = hasUnlinkedSamples ? 'select2__error' : '';
const titleText = hasUnlinkedSamples ? `Sample(s) '${unLinkedSamples.map(uls => uls.title).join(', ')}' not recognised as input. Please correct this issue!` : '';
setTimeout(ObjectsInput.init);
Expand All @@ -605,7 +605,7 @@ function inputObjectsInput(column, data, options, url){
.replace('_OPTIONS_', existingOptions)
.replace('_EXTRACLASS_', extraClass)
.replace('_TITLE_', titleText)
.replace('_MULTIPLE?_', hasMultipleInputs)
.replace('_LIMIT?_', hasMultipleInputs)
.replace('_ALLOW_FREE_TEXT_', false);
}
}
Expand All @@ -629,7 +629,7 @@ function cvListObjectsInput(column, data, options, url){
.replace('_OPTIONS_', existingOptions)
.replace('_EXTRACLASS_', extraClass)
.replace('_TITLE_', titleText)
.replace('_MULTIPLE?_', 'multiple="multiple"')
.replace('_LIMIT?_', '')
.replace('_ALLOW_FREE_TEXT_', allowNewItems);
}
}
Expand Down
30 changes: 19 additions & 11 deletions app/assets/javascripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ const applyTemplate = () => {
$j('#template_level').val(data.level);
$j('#template_parent_id').val(data.template_id);

const appliedToSampleType = $j('#template_level')[0] === undefined || $j('#template_level')[0] === null;
// Make sure default sorted attributes are added to the table
Templates.table.order([9, "asc"]).draw();
$j.each(Templates.table.rows().data(), (i, row) => {
Expand All @@ -239,24 +240,25 @@ const applyTemplate = () => {
row[7] === "Registered Sample List" &&
row[1].includes("Input") &&
row[11] === null;
const isInherited = row[14] !== "undefined" || row[14] !== null;
const isRequired = row[0] ? "checked" : "";
newRow = $j(newRow.replace(/replace-me/g, index));
$j(newRow).find('[data-attr="required"]').prop("checked", row[0]);
if (appliedToSampleType) $j(newRow).find('[data-attr="required"]').addClass("disabled");
$j(newRow).find(".sample-type-is-title").prop("checked", row[8]);
if (appliedToSampleType) $j(newRow).find('.sample-type-is-title').addClass("disabled");
$j(newRow).find('[data-attr="title"]').val(row[1]);
$j(newRow).find('[data-attr="title"]').addClass("disabled");
if (appliedToSampleType) $j(newRow).find('[data-attr="title"]').addClass("disabled");
$j(newRow).find('[data-attr="description"]').val(row[2]);
$j(newRow).find('[data-attr="type"]').val(row[3]);
$j(newRow).find('[data-attr="type"]').addClass("disabled");
if (appliedToSampleType) $j(newRow).find('[data-attr="type"]').addClass("disabled");
$j(newRow).find('[data-attr="cv_id"]').val(row[4]);
$j(newRow).find('[data-attr="cv_id"]').parent().addClass("disabled");
if (appliedToSampleType) $j(newRow).find('[data-attr="cv_id"]').parent().addClass("disabled");
$j(newRow).find('[data-attr="allow_cv_free_text"]').prop("checked", row[5]);
$j(newRow)
.find('[data-attr="allow_cv_free_text"]')
.addClass("disabled");
if (appliedToSampleType) $j(newRow)
.find('[data-attr="allow_cv_free_text"]')
.addClass("disabled");
$j(newRow).find('[data-attr="unit"]').val(row[6]);
$j(newRow).find('[data-attr="unit"]').addClass("disabled");
$j(newRow).find(".sample-type-is-title").prop("checked", row[8]);
if (appliedToSampleType) $j(newRow).find('[data-attr="unit"]').addClass("disabled");
$j(newRow).find('[data-attr="pid"]').val(row[9]);
$j(newRow).find('[data-attr="isa_tag_id"]').val(row[11]);
$j(newRow).find('[data-attr="isa_tag_title"]').val(row[11]);
Expand All @@ -265,7 +267,10 @@ const applyTemplate = () => {
.addClass("disabled");
$j(newRow).find('[data-attr="template_attribute_id"]').val(row[14]); // In case of a sample type
$j(newRow).find('[data-attr="parent_attribute_id"]').val(row[14]); // In case of a template
if (isRequired) {

// Hide the remove button if the attribute is required and it is applied to a sample type.
// Template attributes should always be removeable
if (isRequired && appliedToSampleType) {
$j(newRow).find('label.btn.btn-danger').addClass("hidden");
}

Expand Down Expand Up @@ -293,9 +298,12 @@ const applyTemplate = () => {
const template_id_tag = $j(`#isa_study${suffix}template_parent_id`);
if (template_id_tag) $j(template_id_tag).val(id);

// Removes the hidden from the new attribute button
$j(`${attribute_table} ${addAttributeRow}`).find('#add-attribute').removeClass("hidden");

SampleTypes.recalculatePositions();
SampleTypes.bindSortable();
$j(".sample-type-attribute-type").trigger("change", [false]);
$j(".sample-type-attribute-type").trigger("change", [false]);
};

// Shows the modal form
Expand Down
Loading