diff --git a/Dockerfile b/Dockerfile index 713b3c4f..39a5232a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,18 +6,23 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ WORKDIR /app + RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libpq-dev \ curl \ openssh-client \ git \ - nodejs \ - npm \ + ca-certificates \ && rm -rf /var/lib/apt/lists/* -# Install pnpm -RUN npm install -g pnpm +# Install Node 22 + pnpm +RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get update \ + && apt-get install -y --no-install-recommends nodejs \ + && corepack enable \ + && corepack prepare pnpm@latest --activate \ + && rm -rf /var/lib/apt/lists/* RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.local/bin:${PATH}" diff --git a/bayer/models.py b/bayer/models.py index b4ac7632..0ee478c4 100644 --- a/bayer/models.py +++ b/bayer/models.py @@ -232,5 +232,6 @@ class PESStructure(CompoundStructure): "is_pes": True, "pes_link": self.pes_link, # Will overwrite image from Node - "image": f"{reverse("depict_pes")}?pesLink={urllib.parse.quote(self.pes_link)}" + "image": f"{reverse('depict_pes')}?pesLink={urllib.parse.quote(self.pes_link)}", + "image_type": "png", } diff --git a/bayer/views.py b/bayer/views.py index 0f1d5671..82df528b 100644 --- a/bayer/views.py +++ b/bayer/views.py @@ -75,6 +75,10 @@ def create_pes_node(request, package_uuid, pathway_uuid): classification = pes_data.get("classificationLevel", "") if "secret" == classification.lower(): + + if current_package.classification_level != Package.Classification.SECRET: + return BadRequest("Cannot create PESs for non-secret packages.") + data_pools = pes_data.get("dataPools") if data_pools: if s.DATA_POOL_MAPPING[current_package.data_pool.name] not in data_pools: @@ -83,6 +87,10 @@ def create_pes_node(request, package_uuid, pathway_uuid): pes = PESCompound.create(current_package, pes_data, compound_name, compound_description) + node_qs = Node.objects.filter(pathway=current_pathway, default_node_label=pes.default_structure) + if node_qs.exists(): + return redirect(current_pathway.url) + n = Node() n.stereo_removed = False n.pathway = current_pathway diff --git a/envipath/settings.py b/envipath/settings.py index 318686f6..ce4e615e 100644 --- a/envipath/settings.py +++ b/envipath/settings.py @@ -491,3 +491,5 @@ BB4G_TENANT_ID = os.environ.get("BB4G_TENANT_ID") BB4G_CLIENT_ID = os.environ.get("BB4G_CLIENT_ID") BB4G_CLIENT_SECRET = os.environ.get("BB4G_CLIENT_SECRET") BB4G_SCOPE = os.environ.get("BB4G_SCOPE") + +os.environ["NO_PROXY"] = "localhost,127.0.0.1,epbiotransformer3" \ No newline at end of file diff --git a/epdb/legacy_api.py b/epdb/legacy_api.py index b074fca0..93eac653 100644 --- a/epdb/legacy_api.py +++ b/epdb/legacy_api.py @@ -1980,30 +1980,42 @@ class CreateNode(Schema): @router.post( "/package/{uuid:package_uuid}/pathway/{uuid:pathway_uuid}/node", - response={200: str | Any, 403: Error}, + response={200: str | Any, 400: Error, 403: Error}, ) def add_pathway_node(request, package_uuid, pathway_uuid, n: Form[CreateNode]): try: p = get_package_for_write(request.user, package_uuid) pw = Pathway.objects.get(package=p, uuid=pathway_uuid) + # TODO Code Dup from bayer.views + if n.pesLink: from bayer.views import fetch_pes from bayer.models import PESCompound try: - pes_data = fetch_pes(request, c.pesLink) + pes_data = fetch_pes(request, n.pesLink) except ValueError as e: - return 400, {"message": f"Could not fetch PES data for {c.pesLink}"} + return 400, {"message": f"Could not fetch PES data for {n.pesLink}"} classification = pes_data.get("classificationLevel", "") if "secret" == classification.lower(): + + if p.classification_level != Package.Classification.SECRET: + return 400, "Cannot create PESs for non-secret packages." + data_pools = pes_data.get("dataPools") if data_pools: if s.DATA_POOL_MAPPING[p.data_pool.name] not in data_pools: - return 400, { "messsage": f"PES data pool {s.DATA_POOL_MAPPING[p.data_pool.name]} not found in PES data"} + return 400, { + "messsage": f"PES data pool {s.DATA_POOL_MAPPING[p.data_pool.name]} not found in PES data" + } - c = PESCompound.create(p, pes_data, c.compoundName, c.compoundDescription) + c = PESCompound.create(p, pes_data, n.nodeName, n.nodeReason) + + node_qs = Node.objects.filter(pathway=pw, default_node_label=c.default_structure) + if node_qs.exists(): + return redirect(pw.url) node = Node() node.stereo_removed = False diff --git a/package.json b/package.json index bf4f1516..d2606698 100644 --- a/package.json +++ b/package.json @@ -21,5 +21,11 @@ "django", "tailwindcss", "daisyui" - ] + ], + "pnpm": { + "onlyBuiltDependencies": [ + "@parcel/watcher", + "@tailwindcss/oxide" + ] + } } diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index bff00c56..00d2a6d2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,5 @@ +allowBuilds: + '@parcel/watcher': true onlyBuiltDependencies: - '@parcel/watcher' - - '@tailwindcss/oxide' + - '@tailwindcss/oxide' \ No newline at end of file diff --git a/templates/objects/group.html b/templates/objects/group.html index c689ce7f..d425193a 100644 --- a/templates/objects/group.html +++ b/templates/objects/group.html @@ -56,8 +56,8 @@