diff --git a/.tool-versions b/.tool-versions index 7f3347129e..a2c2b48d42 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -nodejs 18.20.3 +nodejs 18.20.4 18.20.3 ruby 2.7.8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 97db76b89d..fcc68ede82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,31 @@ # Chemotion_ELN Changelog ## Latest +## [v1.10.3] +> (2024-10-02) + +* Bug fixes + * wellplate template download ([#2115](https://github.com/ComPlat/chemotion_ELN/pull/2115)) + * oidc params issue ([#2190](https://github.com/ComPlat/chemotion_ELN/pull/2190)) + * admin restore account - rm obsolete has_profile calls ([#2181](https://github.com/ComPlat/chemotion_ELN/pull/2181)) + * returning attachment preview when not annotated ([#2192](https://github.com/ComPlat/chemotion_ELN/pull/2192)) + * type error when sample has no collection tag data on saving sample ([#2158](https://github.com/ComPlat/chemotion_ELN/pull/2158)) + + ChemSpectra and NMRIUM + * internal ref for cv layout ([#2104](https://github.com/ComPlat/chemotion_ELN/pull/2104)) + + UX/UI + * reaction scheme - sample names style ([#2193](https://github.com/ComPlat/chemotion_ELN/pull/2193)) + +* Chores + * Bump express from 4.19.2 to 4.21.0 ([#2154](https://github.com/ComPlat/chemotion_ELN/pull/2154)) + * Bump dompurify from 2.4.1 to 2.5.6 ([#2157](https://github.com/ComPlat/chemotion_ELN/pull/2157)) + * bump converter-client 0.11.0 ([#2171](https://github.com/ComPlat/chemotion_ELN/pull/2171)) + * Bump puma from 5.6.8 to 5.6.9 ([#2168](https://github.com/ComPlat/chemotion_ELN/pull/2168)) + +* Ci + * set postgres to latest 16 for testing ([#2191](https://github.com/ComPlat/chemotion_ELN/pull/2191)) + ## [v1.10.2] > (2024-09-13) diff --git a/VERSION b/VERSION index 60655ac9da..2fc6f20a27 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ -version: v1.10.2 -base_revision: 7e269bb594d29413788f3e5bfa16544981b5d392 -current_revision: 7e269bb594d29413788f3e5bfa16544981b5d392 +version: v1.10.3 +base_revision: dfb34c7ce47fa1c0e62a7bc5772752705b8c6816 +current_revision: dfb34c7ce47fa1c0e62a7bc5772752705b8c6816 diff --git a/app/api/chemotion/attachment_api.rb b/app/api/chemotion/attachment_api.rb index c95b1dc3b6..c7c1c4d16a 100644 --- a/app/api/chemotion/attachment_api.rb +++ b/app/api/chemotion/attachment_api.rb @@ -219,31 +219,19 @@ def remove_duplicated(att) desc 'get_annotated_image_of_attachment' get ':attachment_id/annotated_image' do content_type 'application/octet-stream' - env['api.format'] = :binary - store = @attachment.attachment.storage.directory - file_location = store.join( - @attachment.attachment_data['derivatives']['annotation']['annotated_file_location'] || 'not available', - ) - - uploaded_file = if file_location.present? && File.file?(file_location) - extension_of_annotation = File.extname(@attachment.filename) - extension_of_annotation = '.png' if @attachment.attachment.mime_type == 'image/tiff' - filename_of_annotated_image = @attachment.filename.gsub( - File.extname(@attachment.filename), - "_annotated#{extension_of_annotation}", - ) - header['Content-Disposition'] = "attachment; filename=\"#{filename_of_annotated_image}\"" - File.open(file_location) - else - header['Content-Disposition'] = "attachment; filename=\"#{@attachment.filename}\"" - @attachment.attachment_attacher.file - end - data = uploaded_file.read - uploaded_file.close - - data + annotation = @attachment.annotated_file_location.presence + if annotation.present? && File.file?(annotation) + header['Content-Disposition'] = "attachment; filename=\"#{@attachment.annotated_filename}\"" + file = File.open(annotation) + else + header['Content-Disposition'] = "attachment; filename=\"#{@attachment.filename}\"" + file = @attachment.attachment_attacher.file + end + file.read + ensure + file&.close end desc 'update_annotation_of_attachment' @@ -314,13 +302,12 @@ def remove_duplicated(att) next unless att.annotated? begin - annotated_file_name = "#{File.basename(att.filename, '.*')}_annotated#{File.extname(att.filename)}" - zip.put_next_entry annotated_file_name + zip.put_next_entry att.annotated_filename file = File.open(att.annotated_file_location) zip.write file.read - file_text += "#{annotated_file_name} #{file.size}\n" + file_text += "#{att.annotated_filename} #{file.size}\n" ensure - file.close + file&.close end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 19149d22e6..3cf9df1be3 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -237,7 +237,7 @@ def type_image_tiff? def annotated? # attachment['derivatives'].present? && attachment['derivatives']['annotation'].present? - attachment_data&.dig('derivatives', 'annotation', 'annotated_file_location')&.present? || false + attachment_data&.dig('derivatives', 'annotation', 'annotated_file_location').present? || false end def annotated_image? @@ -249,6 +249,7 @@ def type_pdf? attachment['mime_type'].to_s == 'application/pdf' end + # @return [String] the path to the combined image file on disk def annotated_file_location return '' unless annotated? @@ -258,6 +259,15 @@ def annotated_file_location ) end + # @return [String] build annotation file name based on the original file name + def annotated_filename + return '' unless annotated? + + # NB: original tiff file are converted to png for the annotation background layer + extension_of_annotation = content_type == 'image/tiff' ? '.png' : File.extname(filename) + "#{File.basename(filename, '.*')}_annotated#{extension_of_annotation}" + end + def preview "data:image/png;base64,#{Base64.encode64(read_thumbnail)}" if thumb end diff --git a/app/packs/src/apps/mydb/elements/details/reactions/schemeTab/Material.js b/app/packs/src/apps/mydb/elements/details/reactions/schemeTab/Material.js index 9be9e6ea43..5927658297 100644 --- a/app/packs/src/apps/mydb/elements/details/reactions/schemeTab/Material.js +++ b/app/packs/src/apps/mydb/elements/details/reactions/schemeTab/Material.js @@ -942,11 +942,9 @@ class Material extends Component { }; const idCheck = /^\d+$/; - const truncatedSampleName = material.molecule_iupac_name?.length > 20 && materialGroup === 'reactants' - ? material.molecule_iupac_name?.substring(1, 25) : material.molecule_iupac_name; if (skipIupacName) { - let materialDisplayName = truncatedSampleName || material.name; + let materialDisplayName = material.molecule_iupac_name || material.name; if (materialGroup === 'solvents' || materialGroup === 'purification_solvents') { materialDisplayName = material.external_label || materialDisplayName; } @@ -965,7 +963,7 @@ class Material extends Component { tabIndex={0} onClick={() => this.handleMaterialClick(material)} style={{ cursor: 'pointer' }} - >{materialDisplayName} + >{materialDisplayName} ); } else { materialName = {materialDisplayName}; @@ -981,7 +979,7 @@ class Material extends Component { tabIndex={0} onClick={() => this.handleMaterialClick(material)} style={{ cursor: 'pointer' }} - >{materialDisplayName} + >{materialDisplayName} ); if (material.isNew) { materialName = materialDisplayName; } @@ -1011,7 +1009,7 @@ class Material extends Component { -
+
{materialName}
diff --git a/prepare-nodejs.sh b/prepare-nodejs.sh index 1966266f94..85f85087e5 100755 --- a/prepare-nodejs.sh +++ b/prepare-nodejs.sh @@ -30,7 +30,7 @@ if [ -z "$nodeversion" ]; then fi # find the latest version of the required version -REQUIRED_NODE_VERSION=$(asdf list all nodejs | grep -E "$nodeversion" | tail -n1) +REQUIRED_NODE_VERSION=$(asdf list all nodejs | grep -E "^$nodeversion" | tail -n1) # Compare the versions if [[ "$CURRENT_NODE_VERSION" == "$REQUIRED_NODE_VERSION" ]]; then