Merge branch 'main' into fix-add-button-icon

This commit is contained in:
Anton Tranelis 2025-08-26 11:59:15 +02:00 committed by GitHub
commit c2420433d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 71 additions and 45 deletions

View File

@ -3,5 +3,6 @@ VITE_API_URL=http://localhost:8055/
#VITE_API_URL=https://api.utopia-lab.org
VITE_MAP_URL=http://local.development
#VITE_MAP_URL=CURRENT_WINDOW_LOCATION
#VITE_DIRECTUS_ADMIN_ROLE=
VITE_VALIDATE_INVITE_FLOW_ID=01d61db0-25aa-4bfa-bc24-c6a8f208a455
VITE_REDEEM_INVITE_FLOW_ID=cc80ec73-ecf5-4789-bee5-1127fb1a6ed4

11
app/README.md Normal file
View File

@ -0,0 +1,11 @@
# App
## Troubleshooting
Map doesn't load and the Error `You must define the Admin roll in the .env file!` shows in the console.
In order to get the map running you need to define the correct uuid of the admin roll in the `.env` file.
Go to http://localhost:8055 and login with the admin credentials. Navigate to http://localhost:8055/admin/settings/roles and click `Administrator` and copy the UUID from the URL.
Put this UUID in the `.env` as `VITE_DIRECTUS_ADMIN_ROLE=UUID`

View File

@ -156,10 +156,7 @@ function App() {
embedded={embedded}
openCollectiveApiKey={config.openCollectiveApiKey}
>
<Permissions
api={permissionsApiInstance}
adminRole='8ed0b24e-3320-48cd-8444-bc152304e580'
></Permissions>
<Permissions api={permissionsApiInstance} adminRole={config.adminRole} />
{tagsApi && <Tags api={tagsApi}></Tags>}
<Modal>
<ModalContent map={map} />

View File

@ -1,6 +1,7 @@
export const config = {
apiUrl: String(import.meta.env.VITE_API_URL ?? 'http://localhost:8055/'),
mapUrl: String(import.meta.env.VITE_MAP_URL ?? 'http://local.development'),
adminRole: String(import.meta.env.VITE_DIRECTUS_ADMIN_ROLE ?? ''),
validateInviteFlowId: String(
import.meta.env.VITE_VALIDATE_INVITE_FLOW_ID ?? '01d61db0-25aa-4bfa-bc24-c6a8f208a455',
),
@ -10,4 +11,8 @@ export const config = {
openCollectiveApiKey: String(import.meta.env.VITE_OPEN_COLLECTIVE_API_KEY ?? ''),
}
if (config.adminRole === '') {
throw Error('You must define the Admin roll in the .env file!')
}
export type Config = typeof config

View File

@ -12,12 +12,8 @@ npx directus-sync push \
--directus-email admin@it4c.dev \
--directus-password admin123
npx directus-sync seed push \
--directus-url http://localhost:8055 \
--directus-email admin@it4c.dev \
--directus-password admin123
./seed.sh
./directus-config/manual/seed.sh
```
## Pull Data from Docker to Harddrive
@ -44,27 +40,8 @@ npx directus-sync push \
## Seed Data for local development
Seed the development data via:
```
npx directus-sync seed push \
--directus-url http://localhost:8055 \
--directus-email admin@it4c.dev \
--directus-password admin123
```
In order to seed the development data, run the script `backend/seed.sh`.
## Seed Data - find differences
In order so see what changes would appear when seeding, you can execute:
```
npx directus-sync seed diff \
--directus-url http://localhost:8055 \
--directus-email admin@it4c.dev \
--directus-password admin123
```
## Manual Seed
In order to seed files and additional data not covered by `directus-sync` run the script `backend/directus-config/manual/seed.sh`.
## Backup Database

View File

@ -1,7 +0,0 @@
DELETE FROM public.directus_files WHERE id = '412c25dc-a3b7-4114-b64b-cac2d6b46db3';
COPY public.directus_files (id, storage, filename_disk, filename_download, title, type, folder, uploaded_by, created_on, modified_by, modified_on, charset, filesize, width, height, duration, embed, description, location, tags, metadata, focal_point_x, focal_point_y, tus_id, tus_data, uploaded_on) FROM stdin;
412c25dc-a3b7-4114-b64b-cac2d6b46db3 local 412c25dc-a3b7-4114-b64b-cac2d6b46db3.svg utopia-logo.svg utopia-logo image/svg+xml \N \N 2025-08-12 11:26:36.539+00 \N 2025-08-12 11:27:07.646+00 \N 22906 \N \N \N \N \N \N \N \N \N \N \N \N 2025-08-12 11:26:36.555+00
\.
UPDATE public.directus_settings SET project_logo = '412c25dc-a3b7-4114-b64b-cac2d6b46db3';

View File

@ -3,17 +3,9 @@
# base setup
SCRIPT_PATH=$(realpath $0)
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
ROOT_DIR=$SCRIPT_DIR/../../..
DATA_DIR=$ROOT_DIR/data
DATA_UPLOADS_DIR=$DATA_DIR/uploads
SEED_FILES_DIR=$SCRIPT_DIR/files
SEED_SQL_DIR=$SCRIPT_DIR/sql
# copy files
cp $SEED_FILES_DIR/* $DATA_UPLOADS_DIR/
# apply database updates
for filename in $SEED_SQL_DIR/*.sql; do
docker exec -i utopia-map-database-1 /bin/bash -c "PGPASSWORD=directus psql -v ON_ERROR_STOP=1 --username directus directus" < $filename

View File

@ -0,0 +1 @@
UPDATE public.directus_settings SET project_logo = (SELECT id FROM directus_files WHERE filename_download = 'utopia-logo.svg');

View File

@ -0,0 +1,3 @@
*
!development/
!.gitignore

View File

@ -0,0 +1,14 @@
{
"collection": "directus_files",
"data": [
{
"_sync_id": "utopia-logo",
"_file_path": "./files/utopia-logo.svg",
"storage": "local",
"filename_download": "utopia-logo.svg",
"title": "Utopia Logo",
"tags": [],
"description": "Utopia Logo"
}
]
}

View File

@ -0,0 +1 @@
UPDATE public.directus_settings SET project_logo = (SELECT id FROM directus_files WHERE filename_download = 'utopia-logo.svg');

View File

@ -1,6 +1,6 @@
{
"name": "directus-extensions",
"dependencies": {
"directus-extension-sync": "^3.0.3"
"directus-extension-sync": "^3.0.4"
}
}

31
backend/seed.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# base setup
SCRIPT_PATH=$(realpath $0)
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
DIRECTUS_URL="${DIRECTUS_URL:-http://localhost:8055}"
DIRECTUS_EMAIL="${DIRECTUS_EMAIL:-admin@it4c.dev}"
DIRECTUS_PASSWORD="${DIRECTUS_PASSWORD:-admin123}"
PGPASSWORD="${PGPASSWORD:-'directus'}"
PGUSER="${PGUSER:-'directus'}"
PGDATABASE="${PGDATABASE:-'directus'}"
PROJECT_NAME="${PROJECT:-development}"
PROJECT_FOLDER=$SCRIPT_DIR/directus-config/seeds/$PROJECT_NAME
npx directus-sync seed push \
--directus-url $DIRECTUS_URL \
--directus-email $DIRECTUS_EMAIL \
--directus-password $DIRECTUS_PASSWORD \
--seed-path $PROJECT_FOLDER/directus
SEED_SQL_DIR=$PROJECT_FOLDER/manual
# apply database updates
for filename in $SEED_SQL_DIR/*.sql; do
docker exec -i utopia-map-database-1 /bin/bash -c "PGPASSWORD=$PGPASSWORD psql -v ON_ERROR_STOP=1 --username $PGUSER $PGDATABASE" < $filename
done