Skip to content

Commit

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

See merge request Scientific-IT-Systems/SampleDB!982
  • Loading branch information
danielkaiser committed Dec 20, 2023
2 parents cdf96a0 + aaaab96 commit a28a508
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ docker run \
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.25.2
sciapp/sampledb:0.25.3
```

### 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.25.2
image: sciapp/sampledb:0.25.3
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 @@ -43,7 +43,7 @@ Next, start the SampleDB container:
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.25.2
sciapp/sampledb:0.25.3
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
10 changes: 10 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

Version 0.25.3
--------------

Released on December 20th, 2023.

- Fixed showing plotly plots on instrument page
- Fixed datetime format in HTTP API
- Fixed user interface issues related to admin-only action types
- Fixed handling of defaults during complex schema upgrades

Version 0.25.2
--------------

Expand Down
2 changes: 1 addition & 1 deletion sampledb/api/server/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def comment_to_json(comment: Comment) -> typing.Dict[str, typing.Any]:
'object_id': comment.object_id,
'comment_id': comment.id,
'user_id': comment.user_id,
'utc_datetime': comment.utc_datetime.isoformat() if comment.utc_datetime is not None else None,
'utc_datetime': comment.utc_datetime.replace(tzinfo=None).isoformat() if comment.utc_datetime is not None else None,
'content': comment.content
}
return comment_json
Expand Down
2 changes: 1 addition & 1 deletion sampledb/api/server/instrument_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def instrument_log_entry_version_to_json(version: instrument_log_entries.Instrum
return {
'log_entry_id': version.log_entry_id,
'version_id': version.version_id,
'utc_datetime': version.utc_datetime.isoformat(),
'utc_datetime': version.utc_datetime.replace(tzinfo=None).isoformat(),
'content': version.content,
'categories': [
category_to_json(category)
Expand Down
2 changes: 0 additions & 2 deletions sampledb/frontend/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ def index() -> FlaskResponseT:
continue
if action.admin_only and not flask_login.current_user.is_admin:
continue
if action.type.admin_only and not flask_login.current_user.is_admin:
continue
if action.disable_create_objects:
continue
if action.type.disable_create_objects:
Expand Down
2 changes: 1 addition & 1 deletion sampledb/frontend/templates/actions/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block content %}
<h1>{% if action_type %}{{ _('%(action_type)s Actions', action_type=action_type.name | get_translated_text(default=_('Unnamed Action Type'))) }} {% else %}{{ _('Actions') }}{% endif %}</h1>
<p class="text-muted">{% if action_type and action_type.description %}{{ action_type.description | get_translated_text(default='—') }}{% else %}{{ _('Actions represent processes like creating a sample or performing a measurement.') }}{% endif %} <a href="https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/user_guide/actions.html">{{ _("Read more.") }}</a></p>
{% if (current_user.is_admin or user_is_instrument_scientist) and not current_user.is_readonly %}
{% if (current_user.is_admin or user_is_instrument_scientist) and not current_user.is_readonly and (not action_type or not action_type.admin_only or current_user.is_admin) %}
{% if action_type %}
<a href="{{ url_for('.new_action', action_type_id=action_type.id) }}" class="btn btn-default">{{ _("Create Action") }} </a>
{% else %}
Expand Down
5 changes: 5 additions & 0 deletions sampledb/frontend/templates/instruments/instrument.html
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ <h4 class="modal-title" id="mobileFileLinkModalLabel">{{ _('Mobile File Upload')
toggleShowMore
} from "{{ fingerprinted_static('sampledb/js/view-object-data.js') }}";
window.toggleShowMore = toggleShowMore;

import {
togglePlotlyChartDiv
} from "{{ fingerprinted_static('sampledb/js/sampledb-toggle.js') }}";
window.togglePlotlyChartDiv = togglePlotlyChartDiv;
</script>
<script type="text/javascript" nonce="{{ generate_inline_script_nonce() }}">

Expand Down
6 changes: 3 additions & 3 deletions sampledb/logic/schemas/convert_to_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def convert_to_schema(
if result:
return result
if previous_schema['type'] != new_schema['type']:
return generate_placeholder(new_schema), [_("Unable to convert property '%(title)s' from type '%(type1)s' to type '%(type2)s'.", title=get_translated_text(new_schema['title']), type1=previous_schema['type'], type2=new_schema['type'])]
return copy.deepcopy(generate_placeholder(new_schema)), [_("Unable to convert property '%(title)s' from type '%(type1)s' to type '%(type2)s'.", title=get_translated_text(new_schema['title']), type1=previous_schema['type'], type2=new_schema['type'])]
if new_schema['type'] == 'text' and 'choices' in new_schema and isinstance(data, dict):
result = _try_convert_text_to_choices(data, new_schema)
if result:
Expand All @@ -72,7 +72,7 @@ def convert_to_schema(
result = _try_convert_array_to_array(data, new_schema, previous_schema)
if result:
return result
return generate_placeholder(new_schema), [_("Unable to convert property '%(title)s' of type '%(type)s'.", title=get_translated_text(new_schema['title']), type=new_schema['type'])]
return copy.deepcopy(generate_placeholder(new_schema)), [_("Unable to convert property '%(title)s' of type '%(type)s'.", title=get_translated_text(new_schema['title']), type=new_schema['type'])]


def _try_convert_text_to_tags(
Expand Down Expand Up @@ -111,7 +111,7 @@ def _try_convert_object_to_object(
previous_schema: typing.Dict[str, typing.Any]
) -> typing.Optional[typing.Tuple[typing.Dict[str, typing.Any], typing.Sequence[str]]]:
upgrade_warnings = []
new_data = generate_placeholder(new_schema)
new_data = copy.deepcopy(generate_placeholder(new_schema))
if not isinstance(new_data, dict):
return None
for property_name, property_value in data.items():
Expand Down
2 changes: 1 addition & 1 deletion sampledb/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@

import os

__version__ = os.environ.get('SAMPLEDB_VERSION') or '0.25.2'
__version__ = os.environ.get('SAMPLEDB_VERSION') or '0.25.3'
4 changes: 2 additions & 2 deletions tests/api/server/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
"""
import datetime

import requests
import pytest
Expand Down Expand Up @@ -164,13 +165,12 @@ def test_get_comments(flask_server, object, auth, user):
assert r.status_code == 200
result_json = r.json()
assert len(result_json) == 1
assert 'utc_datetime' in result_json[0]
del result_json[0]['utc_datetime']
assert result_json == [
{
'object_id': object.id,
'comment_id': comment_id,
'user_id': user.id,
'utc_datetime': sampledb.logic.comments.get_comment(comment_id).utc_datetime.strftime('%Y-%m-%dT%H:%M:%S.%f'),
'content': content
}
]
Expand Down
6 changes: 3 additions & 3 deletions tests/api/server/test_instrument_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_get_instrument_log_entries(flask_server, auth, user, app):
{
'version_id': 1,
'log_entry_id': log_entry.id,
'utc_datetime': log_entry.versions[0].utc_datetime.isoformat(),
'utc_datetime': log_entry.versions[0].utc_datetime.strftime('%Y-%m-%dT%H:%M:%S.%f'),
'content': "Example Log Entry",
'categories': []
}
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_get_instrument_log_entries(flask_server, auth, user, app):
{
'version_id': 1,
'log_entry_id': log_entry.id,
'utc_datetime': log_entry.versions[0].utc_datetime.isoformat(),
'utc_datetime': log_entry.versions[0].utc_datetime.strftime('%Y-%m-%dT%H:%M:%S.%f'),
'content': "Example Log Entry 2",
'categories': [
{
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_get_instrument_log_entry(flask_server, auth, user):
{
'version_id': 1,
'log_entry_id': log_entry.id,
'utc_datetime': log_entry.versions[0].utc_datetime.isoformat(),
'utc_datetime': log_entry.versions[0].utc_datetime.strftime('%Y-%m-%dT%H:%M:%S.%f'),
'content': "Example Log Entry",
'categories': []
}
Expand Down

0 comments on commit a28a508

Please sign in to comment.