Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into update-bootstrap-ui-l…
Browse files Browse the repository at this point in the history
…ibrary
  • Loading branch information
maiwald committed Oct 9, 2024
2 parents fefed4f + cfe6e7e commit 2f43f6c
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 18.20.3
nodejs 18.20.4 18.20.3
ruby 2.7.8
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version: v1.10.2
base_revision: 7e269bb594d29413788f3e5bfa16544981b5d392
current_revision: 7e269bb594d29413788f3e5bfa16544981b5d392
version: v1.10.3
base_revision: dfb34c7ce47fa1c0e62a7bc5772752705b8c6816
current_revision: dfb34c7ce47fa1c0e62a7bc5772752705b8c6816
41 changes: 14 additions & 27 deletions app/api/chemotion/attachment_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion app/models/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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?

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -965,7 +963,7 @@ class Material extends Component {
tabIndex={0}
onClick={() => this.handleMaterialClick(material)}
style={{ cursor: 'pointer' }}
><span className="reaction-material-link">{materialDisplayName}</span></a>
><span>{materialDisplayName}</span></a>
);
} else {
materialName = <span>{materialDisplayName}</span>;
Expand All @@ -981,7 +979,7 @@ class Material extends Component {
tabIndex={0}
onClick={() => this.handleMaterialClick(material)}
style={{ cursor: 'pointer' }}
><span className="reaction-material-link">{materialDisplayName}</span></a>
><span>{materialDisplayName}</span></a>
);

if (material.isNew) { materialName = materialDisplayName; }
Expand Down Expand Up @@ -1011,7 +1009,7 @@ class Material extends Component {
</Button>
</OverlayTrigger>
<OverlayTrigger placement="bottom" overlay={iupacNameTooltip(material)}>
<div>
<div className={'reaction-material-link'}>
{materialName}
</div>
</OverlayTrigger>
Expand Down
2 changes: 1 addition & 1 deletion prepare-nodejs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f43f6c

Please sign in to comment.