Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into official-release
Browse files Browse the repository at this point in the history
# Conflicts:
#	doc/compodoc_sources/summary.json
#	src/app/child-dev-project/children/children-list/children-list.component.spec.ts
#	src/app/core/admin/admin.module.ts
#	src/app/core/admin/services/backup.service.spec.ts
#	src/app/core/config/config-fix.ts
#	src/app/core/entity-components/entity-form/entity-form/entity-form.component.html
#	src/app/core/entity-components/entity-form/entity-form/entity-form.component.scss
#	src/app/core/entity-components/entity-list/entity-list.component.spec.ts
#	src/app/core/export/export-data-button/export-data-button.component.spec.ts
#	src/app/core/export/export-data-button/export-data-button.component.ts
#	src/app/core/export/export-service/export-column-config.ts
#	src/app/core/export/export-service/export.service.spec.ts
#	src/app/core/export/export-service/export.service.ts
#	src/app/core/session/session-service/remote-session.spec.ts
#	src/app/core/session/session-service/remote-session.ts
#	src/app/core/session/session-service/synced-session.service.spec.ts
#	src/app/core/session/session-service/synced-session.service.ts
#	src/app/core/session/session.service.provider.ts
#	src/app/features/reporting/query.service.ts
  • Loading branch information
TheSlimvReal committed Sep 3, 2021
2 parents 1f925ff + 3af75b2 commit f55b20e
Show file tree
Hide file tree
Showing 215 changed files with 4,415 additions and 4,835 deletions.
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# To use it only Docker needs to be installed locally
# Run the following commands from the root folder to build, run and kill the application
# >> docker build -f build/Dockerfile -t aam/digital:latest .
# >> docker run -p=80:80 aam/digital:latest aam-digital
# >> docker run -p=80:80 aam/digital:latest
# >> docker kill aam-digital
FROM node:15.11.0-alpine3.13 as builder
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion doc/compodoc_sources/concepts/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Example:
```
"filters": [
{
"id": "medium"
"id": "language"
},
{
"id": "privateSchool",
Expand Down
42 changes: 42 additions & 0 deletions doc/compodoc_sources/concepts/infrastructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Infrastructure
Aam Digital is an Angular application and can be deployed on a simple webserver.
To do so we are using Docker and some other tools.

The following diagram show the actions that are performed when new code changes are published.

![CI/CD Flow](../../images/CICD-Flow.svg)

## Dockerfile
The Dockerfile can be found in [/build/Dockerfile](https://github.com/Aam-Digital/ndb-core/blob/master/build/Dockerfile).
It provides a stable environment where the application is build, tested and packaged.
It consists of two stages.
The first stage is build on top of a `node` image and builds the application for production usage and optionally runs tests and uploads the test coverage.
The second stage is build on top of a `nginx` image and only copies the files from the previous stage, which are necessary for deploying the application.
This process makes the final image as small as possible.
`nginx` is used to run a lightweight webserver.
The configuration for `nginx` can be found in [/build/default.conf](https://github.com/Aam-Digital/ndb-core/blob/master/build/default.conf).

## Pull Requests
Whenever a new pull request is created, GitHub creates a new app on Heroku and posts the link to this app in the PR.
For each new commit of a PR, GitHub then builds the Docker image for this branch.
This includes building the application in production mode, linting the sourcecode and running the tests.
If all these stages pass, GitHub will upload the newly created image to Heroku.
Once this is done, a version of Aam Digital with the new changes included can be visited through the posted link.

## Master Updates
After approving a PR and merging it into the master, semantic release automatically creates a new tag for this change.
For each new tag a tagged Docker image is uploaded to [DockerHub](https://hub.docker.com/r/aamdigital/ndb-server).

## Deploying Aam Digital
The Docker image from DockerHub can then be downloaded and run via Docker using the following command:
> docker pull aamdigital/ndb-server && docker run -p=80:80 aamdigital/ndb-server
However, this will only run Aam Digital in demo-mode.
To run Aam Digital with a real database, a new `config.json` file has to be mounted into the image.
This should have a structure equal to `config.default.json` ([/src/assets/config.default.json](https://github.com/Aam-Digital/ndb-core/blob/master/src/assets/config.default.json)).
It holds the information about where to find the remote database, what the name of the app is and in which mode the app is being run.

The [ndb-setup](https://github.com/Aam-Digital/ndb-setup) project provides a clear workflow for how to deploy a new instance of Aam Digital and CouchDB.
It extends the Docker image with a `docker-compose.yml` file which handles all the dependencies.
For further information checkout the [README](https://github.com/Aam-Digital/ndb-setup/blob/master/README.md).

214 changes: 84 additions & 130 deletions doc/compodoc_sources/concepts/session-system.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ To build the app for a specific locale, enter that locale inside
}
}
```
For the German version for example, just add
```json
{

"localize": ["de"]
}
```
at the end of "projects" --> "ndb-core" --> "architect" --> "build" before the "configuration"-section starts.

Since the build process is fairly complex, only one locale is allowed during
development. The locale must be inside the locale-folder and be of type
`messages.<your locale>.xlf`
Expand Down
99 changes: 99 additions & 0 deletions doc/compodoc_sources/how-to-guides/exports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Exports

The list views like `/child`, `/school`, `/note` ,... have a button to export data.
Clicking this button will create a downloadable `.csv` file.
The format of this file can be adjusted through the configuration for the list view.

## Config Format

The configuration of the export format is part of the configuration of the [EntityListComponent](../../interfaces/EntityListConfig.html).

E.g.
```json
"view:child": {
"component": "ChildrenList",
"config": {
"exportConfig": [
{ "label": "Child", "query": ".name" },
{
"query": ":getRelated(ChildSchoolRelation, childId)",
"subQueries": [
{ "label": "School Name", "query": ".schoolId:toEntities(School).name" },
{ "label": "From", "query": ".start" },
{ "label": "To", "query": ".end" }
]

}
],
"title": "Children List",
"columns": [...],
"columnGroups": {...},
"filters": [...]
}
},
```

## Configuring a Export

The structure of the exports is according to the [ExportColumnConfig](../../interfaces/ExportColumnConfig.html).

The `label` property is optional and provides a title for this column.
If nothing is provided the query (without dots) is used (e.g. for `"query": ".name"` the label will be `name`).

The `query` has to be a valid [JSON-Query](https://github.com/auditassistant/json-query#queries).
The query will be run on each entity of the list page that is visited (e.g. on each child).
For further information about the query-syntax read the [Reports Guide](reports.md) which uses the same query language.

The `subQueries` is optional and expects an array of `ExportColumnConfigs`.
The queries of the `subQueries` will be run for each result of the parent query.
In the example above, this would mean that for each `ChildSchoolRelation` the name of the school, the from- and the to-date will be exported.
If `subQueries` is defined, each object of the parent query will lead to one row in the report.
In the example above this would mean if there are `n` children and each of them has `m` child-school-relations then the final report will have `n*m` rows and the columns `Child`, `School Name`, `From`, `To` (`Child` from the first query and the others from the sub-queries).
In case `subQueries` is defined, the result of the parent query will not be visible in the export.
If the results of the parent query is wanted in the report, a simple sub-query can be added that returns all values of the parent query (`query: "[*]"`).

## Example Output

Using the config from above with the following data:

```typescript
const child1 = {
_id: "Child:1",
name: "Peter"
}
const child2 = {
_id: "Child:2",
name: "Anna"
}
const relation1 = {
_id: "ChildSchoolRelation:1",
schoolId: "1",
childId: "1",
start: "01/01/2020",
end: "01/01/2021"
}
const relation2 = {
_id: "ChildSchoolRelation:2",
schoolId: "1",
childId: "1",
start: "01/01/2021",
}
const relation3 = {
_id: "ChildSchoolRelation:3",
schoolId: "1",
childId: "1",
start: "01/01/2021",
}
const school = {
_id: "School:1",
name: "High School"
}
```

Would create a `.csv` file according to the following table:

| Child | School Name | From | To |
| --- | --- | --- | --- |
| Peter | High School | 01/01/2020 | 01/01/2021 |
| Peter | High School | 01/01/2021 | |
| Anna | High School | 01/01/2021 | |
8 changes: 8 additions & 0 deletions doc/compodoc_sources/summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
"title": "Create a Report",
"file": "how-to-guides/reports.md"
},
{
"title": "Format Data Export",
"file": "how-to-guides/exports.md"
},
{
"title": "Build Localizable Components",
"file": "how-to-guides/build-localizable-components.md"
Expand Down Expand Up @@ -122,6 +126,10 @@
{
"title": "Documentation Structure",
"file": "concepts/documentation-structure.md"
},
{
"title": "Infrastructure",
"file": "concepts/infrastructure.md"
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions doc/images/CICD-Flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions doc/images/login-flow-new-user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions doc/images/session-uml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 0 additions & 65 deletions doc/unused/specification_sheet.md

This file was deleted.

Loading

0 comments on commit f55b20e

Please sign in to comment.