Tagfalter Monitoring Desktop Landingpage
Initialize Repository
Clone repository:
git clone https://git.ufz.de/rdm/biome/tmd/frontend.git
Initialize Submodules:
git submodule init
git submodule update --init
Local configuration
To set up local configuration rename .env.sample to .env.local
Change configuration as needed.
Env-Variables:
Create an .env file containing the required environment variables for the project to run. A sample is given in "env.sample" or just rename the env.sample to ".env".
Variable | Description | Example |
---|---|---|
VUE_APP_KEYCLOAK_URL |
Key cloak auth url | http://keycloak:9090/auth |
VUE_APP_KEYCLOAK_REALM |
Realm name | dev |
VUE_APP_KEYCLOAK_CLIENT_ID |
Client-ID for oauth | testclient |
VUE_APP_GRAPHQL_API_URL |
API Url | http://localhost:8009/tmd/api/graphql |
VUE_APP_PUBLIC_BUCKET_API_URL |
Media Bucket | http://localhost:8009/tmd/api/media_items |
VUE_APP_KEYCLOAK_LOGOUT_REDIRECT_URL |
Redirect Url | http://localhost:8080 |
VUE_APP_GRAPHQL_TAX_API_URL |
Taxonomy GraphQL API | http://localhost:8007/tax/api/graphql |
VUE_APP_FAMILY_TREE_TAX_API_URL |
Taxonomy REST API | http://localhost:8007/tax/api/family_tree |
VUE_APP_GEO_API |
GEO API | http://localhost:8008/geo/api/graphql |
VUE_APP_TAXONOMY_PROJECT_ID |
Taxonomy Project ID | 407 |
PROD AND STAGE Systems
Please configure the .env files according the above example for the desired systems.
How Vue handles .env files is described here: https://cli.vuejs.org/guide/mode-and-env.html#modes
LOCAL DEV Dockerized
To apply the latest docker configuration, (re-)build the required docker image (if Dockerfile-dev
has been changed).
docker-compose -f docker-compose-dev.yml build --no-cache
Afterwards spin up the docker environment. This might take some time, since the serve script is triggered on startup.
docker-compose -f docker-compose-dev.yml up -d
LOCAL DEV not inside Docker
- access app folder before using npm
- this structure is needed for the build process of the application
cd app/
See package.json for scripts like serve, build, test:unit, lint You can run everything with "npm run" also.
Run app in browser
After starting up the frontend locally on either way visit:
http://localhost:8080
Licences
File that contains the licences: Licences.vue URL to show the licences: URL
Create Graphql files
It used the tool https://www.graphql-code-generator.com/ and use config in graphql-codegen.yml
Update Schema
Backend
This task must be done in Backend to update the models:
- Change line 586 in file
GenericFieldBasedFilter.php
fromfalse
totrue
. The line should look like so:if (!$this->security->getUser() instanceof MachineUser && !$this->security->getUser() instanceof HumanUser) { return false; } if (!$this->security->getUser() instanceof MachineUser && !$this->security->getUser() instanceof HumanUser) { return true; }
- Export Graphql schema from backend Container with
php bin/console api:graphql:export -o /repo/schema.graphql
- Fix collection typing with
sed -i -E 's/collection: \[([^!]+)\]!{0}$/collection: [\1!]!/' /repo/schema.graphql
- If not done, all collection will optional. This is a bug in api-platform, its ignore not null by collections.
- Redo action one. Change line 586 in file
GenericFieldBasedFilter.php
fromtrue
tofalse
.
Frontend
This task must be done in Frontend to update the models:
- Copy and replace file
/app/schema.graphql
- Update ts types file with
npm run generate
- Result will be in types.ts
Update Operations
- Create or append graphql file in (
src/
) (not the schema) with your personal query. - Run
npm run generate
, this will update theoperations.ts
file.- Result will be in operations.ts
- Import your query and types form this file.
Coding conventions and format
Conventions
There are coding conventions which are recommended for Typescript (https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). Many of these conventions are checked and corrected by ESLint.
Format
To have a unique code format when using different IDE's, a .editorconfig-File is located the root of the project. This file is telling the IDE how to format the code of the project.
editorconfig-Plugin - Visual Studio Code
- (go to) "Preferences" -> "Extensions" -> (search for) "editorconfig" -> install "EditorConfig for VS Code " plugin
- to format an opened file press:(MacOS) cmd + s (save file)
editorconfig-Plugin - PHPStorm
- (go to) "Preferences" -> "Plugins" -> (search for) "editorconfig" -> install plugin
- to format an opened file press:(MacOS) alt + cmd + l
editorconfig-Plugin - WebStorm, IntelliJIDEA
- the plugin is already installed
- to format an opened file press:(MacOS) alt + cmd + l
Views & Router
- router is already created for this example.
GraphQL
The GraphQL server URL. There, you can directly go to GraphiQL, GraphQL's official playground and make a sample requests
Customize configuration
Vulnerabilities and Known Issues
CHANGELOG
TODOs && Example Queries
GIT Usage and workflow
Localization
The files holding the localized text elements are located in app/src/i18n
(de.json
for German, en.json
for English).
Release
The CI pipeline is set up to create both the corresponding release images and the gitlab release page automatically on each git-tag creation.