Skip to content

Commit b2a7b43

Browse files
authored
feat: add link to the Taxonomy Editor project in PR description (#472)
* feat: add link to the Taxonomy Editor project in PR description * add env variable to .env, add redirection to root nodes page * fix redirection
1 parent 7170d84 commit b2a7b43

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

.env

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ VITE_SERVER_HOST=0.0.0.0
2020
# and loose the original scheme
2121
API_SCHEME=http
2222

23+
FRONTEND_URL=http://ui.taxonomy.localhost:8091
24+
2325
# This is the PAT (Personal Access Token)
2426
# to create PRs on openfoodfacts-server github project (must be able to read-write PRs)
2527
# you may leave blank in tests…

.github/workflows/container-deploy.yml

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ jobs:
155155
# and must have write access to PRs on the target repo (see REPO_URI)
156156
echo "GITHUB_PAT=${{ secrets.OFF_SERVER_GITHUB_PAT }}" >> .env
157157
echo "REPO_URI=${{ env.REPO_URI }}" >> .env
158+
echo "FRONTEND_URL=https://ui.${{ env.TAXONOMY_EDITOR_DOMAIN }}" >> .env
158159
159160
- name: Create external Docker volumes
160161
uses: appleboy/ssh-action@master

backend/editor/github_functions.py

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ async def create_pr(self, description) -> PullRequest:
137137
### Description
138138
{description}
139139
140+
### Link to the project in Taxonomy Editor
141+
{settings.frontend_url}/{self.taxonomy_name}/{self.branch_name}
140142
"""
141143
)
142144
return (

backend/editor/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
uri = os.environ.get("NEO4J_URI", "bolt://localhost:7687")
77
access_token = os.environ.get("GITHUB_PAT")
88
repo_uri = os.environ.get("REPO_URI", "openfoodfacts/openfoodfacts-server")
9+
frontend_url = os.environ.get("FRONTEND_URL", "PLEASE_PROVIDE_FRONTEND_URL_ENV")
910

1011
EXTERNAL_TAXONOMIES = {
1112
"food_ingredients": [

docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ services:
3535
# taken from .env
3636
GITHUB_PAT:
3737
REPO_URI:
38+
FRONTEND_URL:
3839
# make proxy headers be taken into account
3940
FORWARDED_ALLOW_IPS: "*"
4041
taxonomy_frontend:

taxonomy-editor-frontend/src/App.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { createBrowserRouter, RouterProvider } from "react-router-dom";
1+
import {
2+
createBrowserRouter,
3+
Navigate,
4+
RouterProvider,
5+
} from "react-router-dom";
26
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
37

48
import { createTheme, CssBaseline, ThemeProvider } from "@mui/material";
@@ -44,6 +48,10 @@ const router = createBrowserRouter([
4448
loader: projectLoader(queryClient),
4549
errorElement: <ProjectNotFound />,
4650
children: [
51+
{
52+
path: "",
53+
element: <Navigate to="search" />,
54+
},
4755
{
4856
path: "export",
4957
element: <ExportTaxonomyWrapper />,

0 commit comments

Comments
 (0)