diff --git a/.env b/.env index becd9ff8..7078ea51 100644 --- a/.env +++ b/.env @@ -20,6 +20,8 @@ VITE_SERVER_HOST=0.0.0.0 # and loose the original scheme API_SCHEME=http +FRONTEND_URL=http://ui.taxonomy.localhost:8091 + # This is the PAT (Personal Access Token) # to create PRs on openfoodfacts-server github project (must be able to read-write PRs) # you may leave blank in tests… diff --git a/.github/workflows/container-deploy.yml b/.github/workflows/container-deploy.yml index cf890d0d..2fc944b9 100644 --- a/.github/workflows/container-deploy.yml +++ b/.github/workflows/container-deploy.yml @@ -155,6 +155,7 @@ jobs: # and must have write access to PRs on the target repo (see REPO_URI) echo "GITHUB_PAT=${{ secrets.OFF_SERVER_GITHUB_PAT }}" >> .env echo "REPO_URI=${{ env.REPO_URI }}" >> .env + echo "FRONTEND_URL=https://ui.${{ env.TAXONOMY_EDITOR_DOMAIN }}" >> .env - name: Create external Docker volumes uses: appleboy/ssh-action@master diff --git a/backend/editor/github_functions.py b/backend/editor/github_functions.py index 6c81ba31..dea4fffd 100644 --- a/backend/editor/github_functions.py +++ b/backend/editor/github_functions.py @@ -137,6 +137,8 @@ async def create_pr(self, description) -> PullRequest: ### Description {description} + ### Link to the project in Taxonomy Editor + {settings.frontend_url}/{self.taxonomy_name}/{self.branch_name} """ ) return ( diff --git a/backend/editor/settings.py b/backend/editor/settings.py index 29dcf595..bd41624c 100644 --- a/backend/editor/settings.py +++ b/backend/editor/settings.py @@ -6,6 +6,7 @@ uri = os.environ.get("NEO4J_URI", "bolt://localhost:7687") access_token = os.environ.get("GITHUB_PAT") repo_uri = os.environ.get("REPO_URI", "openfoodfacts/openfoodfacts-server") +frontend_url = os.environ.get("FRONTEND_URL", "PLEASE_PROVIDE_FRONTEND_URL_ENV") EXTERNAL_TAXONOMIES = { "food_ingredients": [ diff --git a/docker-compose.yml b/docker-compose.yml index 2cbbe207..0e2a436f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,7 @@ services: # taken from .env GITHUB_PAT: REPO_URI: + FRONTEND_URL: # make proxy headers be taken into account FORWARDED_ALLOW_IPS: "*" taxonomy_frontend: diff --git a/taxonomy-editor-frontend/src/App.tsx b/taxonomy-editor-frontend/src/App.tsx index d947b0d2..25edfb78 100644 --- a/taxonomy-editor-frontend/src/App.tsx +++ b/taxonomy-editor-frontend/src/App.tsx @@ -1,4 +1,8 @@ -import { createBrowserRouter, RouterProvider } from "react-router-dom"; +import { + createBrowserRouter, + Navigate, + RouterProvider, +} from "react-router-dom"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { createTheme, CssBaseline, ThemeProvider } from "@mui/material"; @@ -44,6 +48,10 @@ const router = createBrowserRouter([ loader: projectLoader(queryClient), errorElement: , children: [ + { + path: "", + element: , + }, { path: "export", element: ,