Skip to content

Commit

Permalink
Merge branch 'release-v0.28.2' into 'master'
Browse files Browse the repository at this point in the history
Release v0.28.2

See merge request Scientific-IT-Systems/SampleDB!1124
  • Loading branch information
danielkaiser committed Jul 9, 2024
2 parents 8981fc8 + 2b3094d commit d5fa895
Show file tree
Hide file tree
Showing 29 changed files with 155 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ test-container-status:
- sleep 5 # allow container to start
- docker ps
- docker logs $CONTAINER_NAME
- docker ps | grep $CONTAINER_NAME | grep '(health. starting)'
- docker ps | grep $CONTAINER_NAME | grep -E '(healthy|starting)'
- sleep 90 # 60s health start period plus 30s buffer
- docker logs $CONTAINER_NAME
- docker ps | grep $CONTAINER_NAME | grep '(healthy)'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ docker run \
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.28.1
sciapp/sampledb:0.28.2
```

### Once it's started
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '3'

services:
web:
image: sciapp/sampledb:0.28.1
image: sciapp/sampledb:0.28.2
restart: always
container_name: sampledb
# Note: this config option works with docker-compose version >1.27
Expand Down
2 changes: 1 addition & 1 deletion docs/administrator_guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Next, start the SampleDB container:
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.28.1
sciapp/sampledb:0.28.2
This will start a minimal SampleDB installation at ``http://localhost:8000`` and allow you to sign in with the username ``admin`` and the password ``password``.

Expand Down
11 changes: 11 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog
=========

Version 0.28.2
--------------

Released on July 9th, 2024.

- Fixed collapse/expand button symbol for ``expandable`` or ``collapsible`` style objects in arrays
- Fixed instrument log performance issues
- Fixed sending of notifications when creating instrument log entries via HTTP API
- Fixed editing of choice style array dropdowns
- Fixed including image files with uppercase file extensions in PDF export

Version 0.28.1
--------------

Expand Down
2 changes: 1 addition & 1 deletion docs/utils/generate_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ def api_token_list(base_url, driver):
driver.get(base_url + f'users/{user.id}/preferences')
resize_for_screenshot(driver, width, min_height)
header1 = driver.find_element(By.ID, 'api_tokens')
header2 = driver.find_element(By.ID, '2fa')
header2 = driver.find_element(By.ID, 'api_access_tokens')
y_offset = scroll_to_element(driver, header1)
save_cropped_screenshot_as_file(driver, 'docs/static/img/generated/api_token_list.png', (0, header1.location['y'] - y_offset, width, header2.location['y'] - y_offset))

Expand Down
4 changes: 2 additions & 2 deletions sampledb/frontend/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ..logic.action_permissions import get_user_action_permissions
from ..logic.components import get_component
from ..logic.instruments import get_instrument, create_instrument, update_instrument, set_instrument_responsible_users, get_instruments, set_instrument_location, get_instrument_object_links, set_instrument_object
from ..logic.instrument_log_entries import get_instrument_log_entries, create_instrument_log_entry, get_instrument_log_file_attachment, create_instrument_log_file_attachment, create_instrument_log_object_attachment, get_instrument_log_object_attachments, get_instrument_log_categories, create_instrument_log_category, update_instrument_log_category, delete_instrument_log_category, update_instrument_log_entry, hide_instrument_log_file_attachment, hide_instrument_log_object_attachment, get_instrument_log_entry, get_instrument_log_object_attachment
from ..logic.instrument_log_entries import get_instrument_log_entries, create_instrument_log_entry, get_instrument_log_file_attachment, create_instrument_log_file_attachment, create_instrument_log_object_attachment, get_instrument_log_categories, create_instrument_log_category, update_instrument_log_category, delete_instrument_log_category, update_instrument_log_entry, hide_instrument_log_file_attachment, hide_instrument_log_object_attachment, get_instrument_log_entry, get_instrument_log_object_attachment
from ..logic.instrument_translations import get_instrument_translations_for_instrument, set_instrument_translation, delete_instrument_translation
from ..logic.languages import get_languages, get_language, Language, get_user_language
from ..logic.actions import get_actions, get_action
Expand Down Expand Up @@ -293,7 +293,7 @@ def instrument(instrument_id: int) -> FlaskResponseT:
instrument_log_entries = get_instrument_log_entries(instrument_id)
attached_object_ids = set()
for log_entry in instrument_log_entries:
for object_attachment in get_instrument_log_object_attachments(log_entry.id):
for object_attachment in log_entry.object_attachments:
attached_object_ids.add(object_attachment.object_id)
attached_object_infos = get_object_info_with_permissions(
user_id=flask_login.current_user.id,
Expand Down
5 changes: 3 additions & 2 deletions sampledb/frontend/pdfexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def custom_url_fetcher(url: str) -> typing.Dict[str, bytes]:
file = exported_files[(object_id, file_id)]
if file.storage == 'database' and not file.is_hidden:
for file_extension, mime_type in IMAGE_FORMATS.items():
if file.original_file_name.endswith(file_extension):
if file.original_file_name.lower().endswith(file_extension):
image_data = file.open(read_only=True).read()
url = 'data:' + mime_type + ';base64,' + base64.b64encode(image_data).decode('utf-8')
break
Expand Down Expand Up @@ -305,7 +305,8 @@ def get_object_type_name(action: Action) -> str:
get_user=get_user_if_exists,
metadata_language=lang_code,
files_by_object_id=files_by_object_id,
eln_import_urls={object[0].object_id: logic.eln_import.get_eln_import_object_url(object[0].object_id) for object in objects}
eln_import_urls={object[0].object_id: logic.eln_import.get_eln_import_object_url(object[0].object_id) for object in objects},
IMAGE_FORMATS=IMAGE_FORMATS
)

# use regular user language again
Expand Down
1 change: 1 addition & 0 deletions sampledb/frontend/templates/instruments/instrument.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ <h2>{{ _('Information') }}</h2>
{% set schema = linked_object.schema %}
{% set data = linked_object.data %}
{% set plot_counter = namespace(value=0) %}
{% set object_reference_counter = namespace(value=0) %}
{% set indent_level = 0 %}
{% set show_indent_border = False %}
{% include "objects/view/object.html" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

{% block message %}
{% set instrument_log_entry = get_instrument_log_entry(data['instrument_log_entry_id']) %}
<p><a href="{{ url_for('.user_profile', user_id=instrument_log_entry.user_id, _external=True) }}" style="color:#337ab7;">{{ get_user(instrument_log_entry.user_id).name }}</a> has created a new <a href="{{ url_for('.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}" style="color:#337ab7;">log entry</a> for the instrument <a href="{{ url_for('.instrument', instrument_id=instrument_log_entry.instrument_id, _external=True) }}" style="color:#337ab7;">{{ get_instrument(instrument_log_entry.instrument_id).name }}</a>.</p>
<p><a href="{{ url_for('frontend.user_profile', user_id=instrument_log_entry.user_id, _external=True) }}" style="color:#337ab7;">{{ get_user(instrument_log_entry.user_id).name }}</a> has created a new <a href="{{ url_for('frontend.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}" style="color:#337ab7;">log entry</a> for the instrument <a href="{{ url_for('frontend.instrument', instrument_id=instrument_log_entry.instrument_id, _external=True) }}" style="color:#337ab7;">{{ get_instrument(instrument_log_entry.instrument_id).name | get_translated_text(default=_('Unnamed Instrument')) }}</a>.</p>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

{% block message %}
{% set instrument_log_entry = get_instrument_log_entry(data['instrument_log_entry_id']) %}
{{ get_user(instrument_log_entry.user_id).name }} has created a new log entry for the instrument {{ get_instrument(instrument_log_entry.instrument_id).name }}:
{{ url_for('.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}
{{ get_user(instrument_log_entry.user_id).name }} has created a new log entry for the instrument {{ get_instrument(instrument_log_entry.instrument_id).name | get_translated_text(default=_('Unnamed Instrument')) }}:
{{ url_for('frontend.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

{% block message %}
{% set instrument_log_entry = get_instrument_log_entry(data['instrument_log_entry_id']) %}
<p><a href="{{ url_for('.user_profile', user_id=instrument_log_entry.user_id, _external=True) }}" style="color:#337ab7;">{{ get_user(instrument_log_entry.user_id).name }}</a> has edited a <a href="{{ url_for('.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}" style="color:#337ab7;">log entry</a> for the instrument <a href="{{ url_for('.instrument', instrument_id=instrument_log_entry.instrument_id, _external=True) }}" style="color:#337ab7;">{{ get_instrument(instrument_log_entry.instrument_id).name }}</a>.</p>
<p><a href="{{ url_for('frontend.user_profile', user_id=instrument_log_entry.user_id, _external=True) }}" style="color:#337ab7;">{{ get_user(instrument_log_entry.user_id).name }}</a> has edited a <a href="{{ url_for('frontend.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}" style="color:#337ab7;">log entry</a> for the instrument <a href="{{ url_for('frontend.instrument', instrument_id=instrument_log_entry.instrument_id, _external=True) }}" style="color:#337ab7;">{{ get_instrument(instrument_log_entry.instrument_id).name | get_translated_text(default=_('Unnamed Instrument')) }}</a>.</p>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

{% block message %}
{% set instrument_log_entry = get_instrument_log_entry(data['instrument_log_entry_id']) %}
{{ get_user(instrument_log_entry.user_id).name }} has edited a log entry for the instrument {{ get_instrument(instrument_log_entry.instrument_id).name }}:
{{ url_for('.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}
{{ get_user(instrument_log_entry.user_id).name }} has edited a log entry for the instrument {{ get_instrument(instrument_log_entry.instrument_id).name | get_translated_text(default=_('Unnamed Instrument')) }}:
{{ url_for('frontend.instrument', instrument_id=instrument_log_entry.instrument_id, _anchor='log_entry-{}'.format(instrument_log_entry.id), _external=True) }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "mails/notifications/base.html" %}

{% block message %}
<p><a href="{{ url_for('.user_profile', user_id=data['inviter_id'], _external=True) }}" style="color:#337ab7;">{{ get_user(data['inviter_id']).name }}</a> has invited you to be a member of the basic group "<a href="{{ url_for('frontend.group', group_id=data['group_id'], _external=True) }}" style="color:#337ab7;">{{ get_group(data['group_id']).name | get_translated_text('en') }}</a>". If you wish to join this basic group, please click the button below:</p>
<p><a href="{{ url_for('frontend.user_profile', user_id=data['inviter_id'], _external=True) }}" style="color:#337ab7;">{{ get_user(data['inviter_id']).name }}</a> has invited you to be a member of the basic group "<a href="{{ url_for('frontend.group', group_id=data['group_id'], _external=True) }}" style="color:#337ab7;">{{ get_group(data['group_id']).name | get_translated_text('en') }}</a>". If you wish to join this basic group, please click the button below:</p>
<p style="text-align: center"><a href="{{ data['confirmation_url'] | safe }}" style="display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: 400; line-height: 1.42857143; text-align: center; white-space: nowrap; vertical-align: middle; -ms-touch-action: manipulation; touch-action: manipulation; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-image: none; border: 1px solid #122b40; border-radius: 4px; text-decoration: none; color: #f8f8f8; background-color: #023d6b;">Join Basic Group</a></p>
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "mails/notifications/base.html" %}

{% block message %}
<p><a href="{{ url_for('.user_profile', user_id=data['inviter_id'], _external=True) }}" style="color:#337ab7;">{{ get_user(data['inviter_id']).name }}</a> has invited you to be a member of the project group "<a href="{{ url_for('frontend.project', project_id=data['project_id'], _external=True) }}" style="color:#337ab7;">{{ get_project(data['project_id']).name | get_translated_text('en') }}</a>". If you wish to join this project group, please click the button below:</p>
<p><a href="{{ url_for('frontend.user_profile', user_id=data['inviter_id'], _external=True) }}" style="color:#337ab7;">{{ get_user(data['inviter_id']).name }}</a> has invited you to be a member of the project group "<a href="{{ url_for('frontend.project', project_id=data['project_id'], _external=True) }}" style="color:#337ab7;">{{ get_project(data['project_id']).name | get_translated_text('en') }}</a>". If you wish to join this project group, please click the button below:</p>
<p style="text-align: center"><a href="{{ data['confirmation_url'] | safe }}" style="display: inline-block; padding: 6px 12px; margin-bottom: 0; font-size: 14px; font-weight: 400; line-height: 1.42857143; text-align: center; white-space: nowrap; vertical-align: middle; -ms-touch-action: manipulation; touch-action: manipulation; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; background-image: none; border: 1px solid #122b40; border-radius: 4px; text-decoration: none; color: #f8f8f8; background-color: #023d6b;">Join Project Group</a></p>
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% if data is none %}
{% set data = [] %}
{% endif %}
<div class="form-group row error-parent" data-template-order-index="{{ template_order_index }}" data-id-prefix="{{ id_prefix }}" data-array-container="list" data-min-items="{{ minItems }}" data-max-items="{{ maxItems }}" data-default-items="{{ defaultItems }}" data-name="{{ id_prefix }}_parent">
<div class="form-group row error-parent" data-template-order-index="{{ template_order_index }}" data-id-prefix="{{ id_prefix }}" data-array-container="list" data-min-items="{{ minItems }}" data-max-items="{{ maxItems }}" data-default-items="{{ defaultItems }}" style="padding-right:0.75em" data-name="{{ id_prefix }}_parent">
<div class="col-md-3 control-label">
{% if schema.title %}<strong><span {% if is_required and schema.minItems %}class="required-label"{% endif %} {% if 'tooltip' in schema %}data-toggle="tooltip" data-placement="top" title="{{ schema.tooltip | get_translated_text }}"{% endif %}>{{ schema.title | get_translated_text }}{% if 'tooltip' in schema %} <i class="fa fa-question-circle" aria-hidden="true"></i>{% endif %}</span></strong>{% endif %}
</div>
Expand Down
1 change: 1 addition & 0 deletions sampledb/frontend/templates/objects/forms/form_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{% block content %}
{{ super() }}
{% set plot_counter = namespace(value=0) %}
{% set object_reference_counter = namespace(value=0) %}
<form class="form-horizontal" method="post" action="{{ url_for('.object', object_id=object_id, mode=mode) }}">
{{ form.csrf_token() }}
<input type="hidden" name="context_id_token" value="{{ context_id_token }}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{% block includes %}
{# counter for plotly_chart_plots #}
{% set plot_counter = namespace(value=0) %}
{% set object_reference_counter = namespace(value=0) %}
{% set indent_level = 0 %}
{% set show_indent_border = False %}
<form class="form-horizontal" action="{{ url_for('.object', object_id=object_id, mode='edit') }}" id="data-form" autocomplete="off">
Expand Down
1 change: 1 addition & 0 deletions sampledb/frontend/templates/objects/objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
{% block content %}
{# counter for plotly_chart_plots #}
{% set plot_counter = namespace(value=0) %}
{% set object_reference_counter = namespace(value=0) %}
{% if search_notes is defined %}
{% for category, note, start, end in search_notes %}
{% if category == "error" %}
Expand Down
4 changes: 3 additions & 1 deletion sampledb/frontend/templates/objects/view/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ <h2 id="information">{{ _('Information') }}</h2>
{% block includes %}
{# counter for plotly_chart_plots #}
{% set plot_counter = namespace(value=0) %}
{% set object_reference_counter = namespace(value=0) %}
{% set indent_level = 0 %}
{% set show_indent_border = False %}
{% if data is not none and schema is not none %}
Expand Down Expand Up @@ -271,7 +272,7 @@ <h2 id="information">{{ _('Information') }}</h2>
</div>
{% endif %}
</div>
{% if schema and 'workflow_view' in schema or 'workflow_views' in schema %}
{% if schema and ('workflow_view' in schema or 'workflow_views' in schema) %}
{% set workflow_views = schema.get('workflow_views', []) %}
{% if 'workflow_view' in schema %}
{% do workflow_views.append(schema.workflow_view) %}
Expand All @@ -283,6 +284,7 @@ <h2 id="information">{{ _('Information') }}</h2>
<h2 id="{{ workflow_id }}">{% if 'title' in workflow_view %}{{ workflow_view.title | get_translated_text }}{% else %}{{ _('Workflow') }} #{{ loop.index }}{% endif %}</h2>
{# counter for plotly_chart_plots #}
{% set plot_counter = namespace(value=0) %}
{% set object_reference_counter = namespace(value=0) %}
{% for elem in workflow %}
<div>
<h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{% set referenced_object = get_object_if_current_user_has_read_permissions(data.object_id) %}
{% if referenced_object and referenced_object.data %}
{% set object_id = referenced_object.object_id %}
{% set id_prefix_root = object_reference ~ "_" ~ referenced_object.object_id %}
{% set object_reference_counter.value = object_reference_counter.value + 1 %}
{% set id_prefix_root = "object_reference_" ~ object_reference_counter.value ~ "_" ~ referenced_object.object_id %}
{% set search_property_path_prefix = property_path[:-1] + ('*' + property_path[-1],) %}
{% set property_path = () %}
{% set id_prefix = id_prefix_for_property_path(property_path, id_prefix_root) %}
Expand Down
4 changes: 2 additions & 2 deletions sampledb/frontend/templates/pdfexport/export.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ <h2>{{ _('Files') }}</h2>

{% for file in files %}
{% if not file.is_hidden and file.storage == 'database' %}
{% for file_extension in ['.png', '.jpg', '.jpeg'] %}
{% if file.original_file_name.endswith(file_extension) %}
{% for file_extension in IMAGE_FORMATS %}
{% if file.original_file_name.lower().endswith(file_extension) %}
<h3>{{ _('File') }} #{{ file.id }}: {{ file.title }}</h3>
<img src="./object_files/{{ object.id }}/{{ file.id }}" class="object-file-image"/>
{% endif %}
Expand Down
Loading

0 comments on commit d5fa895

Please sign in to comment.