Skip to content

Commit

Permalink
feat: add link to the Taxonomy Editor project in PR description (#472)
Browse files Browse the repository at this point in the history
* feat: add link to the Taxonomy Editor project in PR description

* add env variable to .env, add redirection to root nodes page

* fix redirection
  • Loading branch information
perierc authored Apr 10, 2024
1 parent 7170d84 commit b2a7b43
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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…
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/container-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions backend/editor/github_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions backend/editor/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 9 additions & 1 deletion taxonomy-editor-frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -44,6 +48,10 @@ const router = createBrowserRouter([
loader: projectLoader(queryClient),
errorElement: <ProjectNotFound />,
children: [
{
path: "",
element: <Navigate to="search" />,
},
{
path: "export",
element: <ExportTaxonomyWrapper />,
Expand Down

0 comments on commit b2a7b43

Please sign in to comment.