diff --git a/backend/composer/services/export_services.py b/backend/composer/services/export_services.py index d90c6f9d..f917e0c6 100644 --- a/backend/composer/services/export_services.py +++ b/backend/composer/services/export_services.py @@ -204,8 +204,8 @@ def generate_csv_attributes_mapping() -> Dict[str, Callable]: "Identifier": get_identifier, "Relationship": get_relationship, "Axonal course poset": get_layer, - "Connected From": get_connected_from_names, - "Connected From URIs": get_connected_from_uri, + "connected_from": get_connected_from_names, + "connected_from_uris": get_connected_from_uri, "Predicate": get_predicate, "Observed in species": get_observed_in_species, "Different from existing": get_different_from_existing, diff --git a/backend/composer/views.py b/backend/composer/views.py index 09ffbe3d..aa9d1f22 100644 --- a/backend/composer/views.py +++ b/backend/composer/views.py @@ -1,5 +1,6 @@ import os +from django.utils import timezone from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.template import loader from django.urls import reverse @@ -8,6 +9,7 @@ from composer.models import ConnectivityStatement from composer.services.export_services import export_connectivity_statements +from version import VERSION def index(request): if not hasattr(request, "user") or not request.user.is_authenticated: @@ -47,7 +49,10 @@ def export(request): messages.add_message(request, messages.INFO, f"Exported {export_batch.get_count_connectivity_statements_in_this_export} connectivity statements.") if os.path.exists(file_path): with open(file_path, 'rb') as fh: - response = HttpResponse(fh.read(), content_type="application/text") + composer_version = f'# SCKAN Composer version: {VERSION}\n' + date_exported = f'# Export date: {timezone.now().strftime("%Y-%m-%d")}\n' + content = composer_version + date_exported + fh.read().decode() + response = HttpResponse(content.encode(), content_type="application/text") response['Content-Disposition'] = 'inline; filename=' + os.path.basename(file_path) return response raise Http404 diff --git a/backend/setup.py b/backend/setup.py index c6ddeced..ac70fc5a 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -3,9 +3,9 @@ import sys from setuptools import find_packages, setup +from version import VERSION NAME = "SCKAN Composer" -VERSION = "3.0.0" # To install the library, run the following # diff --git a/backend/version.py b/backend/version.py new file mode 100644 index 00000000..9eaab27b --- /dev/null +++ b/backend/version.py @@ -0,0 +1 @@ +VERSION = "3.2.0" \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index b4a59b93..a86911bc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "3.0.0", + "version": "3.2.0", "private": true, "main": "index.js", "proxy": "https://localhost:8000/", diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index d16ee6e2..5d1da6d5 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -8,11 +8,13 @@ import Typography from "@mui/material/Typography"; import { vars } from "../theme/variables"; import { userProfile } from "../services/UserService"; import { useNavigate, useLocation } from "react-router"; +import { getSckanComposerVersion } from "../services/CommonService"; const Sidebar = () => { const profile = userProfile.getProfile(); const navigate = useNavigate(); const location = useLocation(); + const sckanComposerVersion = getSckanComposerVersion(); const userIsCuratorAndTriageOperator = profile.is_triage_operator && (profile.is_curator || profile.is_reviewer); @@ -40,38 +42,45 @@ const Sidebar = () => { return ( - - - Manage - - - { - setSelectedItem(0); - navigate("/"); - }} - > - - {profile.is_triage_operator - ? "Sentences List" - : "Statements List"} - - - {userIsCuratorAndTriageOperator && ( + + + + Manage + + { - setSelectedItem(1); - navigate("/statement"); + setSelectedItem(0); + navigate("/"); }} > - Statements List + + {profile.is_triage_operator + ? "Sentences List" + : "Statements List"} + - )} - + {userIsCuratorAndTriageOperator && ( + { + setSelectedItem(1); + navigate("/statement"); + }} + > + Statements List + + )} + + + + SCKAN Composer version: {sckanComposerVersion} + ); diff --git a/frontend/src/services/CommonService.ts b/frontend/src/services/CommonService.ts new file mode 100644 index 00000000..c8f340da --- /dev/null +++ b/frontend/src/services/CommonService.ts @@ -0,0 +1,4 @@ + +export const getSckanComposerVersion = () => { + return require('../../package.json').version; +}