Skip to content

Commit beeb375

Browse files
committed
Merge remote-tracking branch 'origin/release/3.0.0' into feature/update-infrastructure-for-mono-repo
# Conflicts: # CHANGELOG.md # composer.lock # infrastructure/itkdev/display-api-service/etc/confd/templates/env.local.tmpl # infrastructure/os2display/display-api-service/etc/confd/templates/env.local.tmpl # package-lock.json
2 parents a4e710a + 3bc4899 commit beeb375

143 files changed

Lines changed: 8400 additions & 2192 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,20 @@ REDIS_CACHE_PREFIX=DisplayApiService
6161
REDIS_CACHE_DSN=redis://redis:6379/0
6262
###< redis ###
6363

64+
###> Http Client ###
65+
HTTP_CLIENT_TIMEOUT=5
66+
HTTP_CLIENT_MAX_DURATION=30
67+
HTTP_CLIENT_LOG_LEVEL=error
68+
###< Http Client ###
69+
6470
###> App ###
65-
APP_DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
66-
APP_ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
67-
APP_KEY_VAULT_SOURCE=ENVIRONMENT
68-
APP_KEY_VAULT_JSON="{}"
69-
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
71+
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
72+
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
73+
KEY_VAULT_SOURCE=ENVIRONMENT
74+
KEY_VAULT_JSON="{}"
7075
TRACK_SCREEN_INFO=false
7176
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
77+
RELATIONS_CHECKSUM_ENABLED=true
7278
###< App ###
7379

7480
###> itk-dev/openid-connect-bundle ###
@@ -108,6 +114,10 @@ CALENDAR_API_FEED_SOURCE_DATE_TIMEZONE=
108114
CALENDAR_API_FEED_SOURCE_CACHE_EXPIRE_SECONDS=300
109115
###< Calendar Api Feed Source ###
110116

117+
###> Event Database Api V2 Feed Type ###
118+
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
119+
###< Event Database Api V2 Feed Type ###
120+
111121
###> Admin configuration ###
112122
ADMIN_REJSEPLANEN_APIKEY=
113123
ADMIN_SHOW_SCREEN_STATUS=false

.github/workflows/composer.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,3 @@ jobs:
5656
docker network create frontend
5757
docker compose run --rm phpfpm composer install
5858
docker compose run --rm phpfpm composer normalize --dry-run
59-
60-
composer-audit:
61-
runs-on: ubuntu-latest
62-
strategy:
63-
fail-fast: false
64-
steps:
65-
- uses: actions/checkout@v4
66-
- run: |
67-
docker network create frontend
68-
docker compose run --rm phpfpm composer audit --locked

.github/workflows/vitest.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on: pull_request
2+
3+
name: Unit tests
4+
5+
env:
6+
COMPOSE_USER: runner
7+
8+
jobs:
9+
vitest:
10+
name: Vitest
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup network
17+
run: docker network create frontend
18+
19+
- name: Install dependencies
20+
run: docker compose run --rm node npm install
21+
22+
- name: Run unit tests
23+
run: docker compose run --rm node npm run test:unit

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ phpstan.neon
6464
###> vincentlanglet/twig-cs-fixer ###
6565
/.twig-cs-fixer.cache
6666
###< vincentlanglet/twig-cs-fixer ###
67+
68+
.claude/

CHANGELOG.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,28 @@ All notable changes to this project will be documented in this file.
1414
- Removed propTypes.
1515
- Upgraded redux-toolkit and how api slices are generated.
1616
- Fixed redux-toolkit cache handling.
17-
- Added Taskfile
17+
- Added Taskfile.
1818
- Added update command.
1919
- Added (Client) online-check to public.
2020
- Updated developer documentation.
21-
- Removed admin/access-config.json fetch
21+
- Removed admin/access-config.json fetch.
2222
- Aligned with v. 2.5.2.
2323
- Removed themes.
2424
- Added command to migrate config.json files.
25-
- Fix data fetching bug
25+
- Fix data fetching bug and tests
2626
- Refactored screen layout commands.
27-
- Moved list components (search and checkboxes) around
28-
- Updated infrastructure and image build for mono-repo
27+
- Moved list components (search and checkboxes) around.
28+
- Aligned environment variable names.
29+
- Aligned with v. 2.6.0.
30+
- Added relations checksum feature flag.
31+
- Fixes saving issues described in issue where saving resulted in infinite spinner.
32+
- Fixed loading of routes containing null string values.
33+
- Fixed relations checksum test.
34+
- Optimized release data fetching.
35+
- Optimized list loading.
36+
- Removed fixture length check from test.
37+
- Added vitest for frontend unit tests.
38+
- Updated infrastructure and image build for mono-repo.
2939

3040
### NB! Prior to 3.x the project was split into separate repositories
3141

README.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,26 @@ We use PHPUnit for API tests:
304304
task test:api
305305
```
306306

307+
### Unit tests - Vitest
308+
309+
Use Vitest for unit and component tests (pure functions, utilities, components with jsdom).
310+
311+
Test files are located in `assets/tests/` alongside the Playwright tests.
312+
313+
Vitest picks up `*.test.js` files.
314+
315+
Unit tests for client and admin utility functions use Vitest:
316+
317+
```shell
318+
task test:unit
319+
```
320+
307321
### Frontend tests - Playwright
308322

323+
Use Playwright for end-to-end tests that run against the full application in a real browser.
324+
325+
Playwright picks up `*.spec.js` files.
326+
309327
To test the React apps we use playwright.
310328

311329
#### Updating Playwright
@@ -391,22 +409,23 @@ Configuration of the project should be added to `.env.local`. Default values are
391409

392410
```dotenv
393411
###> App ###
394-
APP_ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
395-
APP_KEY_VAULT_SOURCE=ENVIRONMENT
396-
APP_KEY_VAULT_JSON="{}"
397-
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
412+
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
413+
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
414+
KEY_VAULT_SOURCE=ENVIRONMENT
415+
KEY_VAULT_JSON="{}"
398416
TRACK_SCREEN_INFO=false
399417
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
400418
###< App ###
401419
```
402420

403-
- APP_ACTIVATION_CODE_EXPIRE_INTERVAL: Specifies how long an external user activation code should live.
421+
- DEFAULT_DATE_FORMAT: The default format of serialized dates.
422+
- ACTIVATION_CODE_EXPIRE_INTERVAL: Specifies how long an external user activation code should live.
404423
The format of the interval should follow <https://www.php.net/manual/en/dateinterval.construct.php>.
405424

406425
**Default**: 2 days.
407-
- APP_KEY_VAULT_SOURCE: Source of key-value pair for `src/Service/KeyVaultService`. Atm. "ENVIRONMENT" is the only
426+
- KEY_VAULT_SOURCE: Source of key-value pair for `src/Service/KeyVaultService`. Atm. "ENVIRONMENT" is the only
408427
option.
409-
- APP_KEY_VAULT_JSON: A json object formatted as a string. Contains key-value pairs that can be accessed by through
428+
- KEY_VAULT_JSON: A json object formatted as a string. Contains key-value pairs that can be accessed by through
410429
`src/Service/KeyVaultService`.
411430
- EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS: What should the expire be for cache entries in EventDatabaseApiV2FeedType?
412431
- TRACK_SCREEN_INFO: Should screen info be tracked (true|false)?
@@ -494,9 +513,11 @@ CLIENT_DEBUG=false
494513
waiting for being activated in the administration.
495514

496515
**Default**: 20 s.
497-
- CLIENT_REFRESH_TOKEN_TIMEOUT: How often (milliseconds) should it be checked whether the token needs to be refreshed?
516+
- CLIENT_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT: How often (milliseconds) should it be checked whether a new release is
517+
available?
518+
Value should not be lower than 5 minutes, since release.json is only fetched with a minimum of 5 minutes interval.
498519

499-
**Default**: 30 s.
520+
**Default**: 10 m.
500521
- CLIENT_REFRESH_TOKEN_TIMEOUT: How often (milliseconds) should it be checked whether the token needs to be refreshed?
501522

502523
**Default**: 60 s.
@@ -523,6 +544,17 @@ CLIENT_DEBUG=false
523544
- See `docs/configuration/openid-connect.md` for configuration of OpenID Connect.
524545
- See `docs/configuration/calendar-api-feed.md` for configuration of CalenderApiFeedType.
525546

547+
#### Event Database Api V2 Feed Type
548+
549+
```dotenv
550+
###> Event Database Api V2 Feed Source ###
551+
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
552+
###< Event Database Api V2 Feed Source ###
553+
```
554+
555+
- EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS: What should the expiration be for cache entries in
556+
EventDatabaseApiV2FeedType?
557+
526558
## Rest API & Relationships
527559

528560
To avoid embedding all relations in REST representations but still allow the clients to minimize the amount of API calls

Taskfile.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ tasks:
192192
desc: "Runs API tests (PHPUnit)."
193193
cmds:
194194
- task composer -- test-setup
195-
- task compose -- exec --env SYMFONY_DEPRECATIONS_HELPER=disabled phpfpm composer test
195+
- task compose -- exec --env SYMFONY_DEPRECATIONS_HELPER=disabled phpfpm vendor/bin/phpunit --stop-on-failure {{.CLI_ARGS}}
196196

197197
test:frontend-built:
198198
desc: "Runs frontend tests (Playwright) on the built files. This temporarily stops the node container."
@@ -227,4 +227,14 @@ tasks:
227227
fixtures:copy-assets:
228228
desc: "Copy the folder from fixtures/public/fixtures to public/fixtures. Rerun if fixtures are changed."
229229
cmds:
230-
- task compose -- exec phpfpm cp -r fixtures/public/fixtures public/fixtures
230+
- task compose -- exec phpfpm cp -r fixtures/public/fixtures public/
231+
232+
test:unit:
233+
desc: "Runs client unit tests (Vitest)."
234+
cmds:
235+
- task compose -- run --rm node npm run test:unit {{.CLI_ARGS}}
236+
237+
assets:build:
238+
desc: "Build the assets."
239+
cmds:
240+
- task compose -- run --rm node npm run build

UPGRADE.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ Because of these changes, it will be necessary to adjust the server setup to mat
1717

1818
### Upgrade steps
1919

20-
#### 0 - Convert external templates to custom templates
20+
#### 0.1 - Upgrade the API to the latest version of 2.x
21+
22+
#### 0.2 - Checkout the API to 3.x
23+
24+
#### 1 - Convert external templates to custom templates
2125

2226
Instead of loading javascript for templates from possibly external urls we have made the change to only include
2327
templates that are a part of the code. Standard templates are now located in `assets/shared/templates/`.
@@ -28,8 +32,6 @@ Custom templates are documented in the [README.md#custom-templates](README.md#cu
2832

2933
The important thing is that the `id` of the template should remain the same when converted to a custom template.
3034

31-
#### 1 - Upgrade the API to the latest version of 2.x
32-
3335
#### 2 - Configure the following environment variables in `.env.local`
3436

3537
```dotenv
@@ -62,6 +64,15 @@ docker compose exec phpfpm bin/console app:utils:convert-config-json-to-env --ty
6264
docker compose exec phpfpm bin/console app:utils:convert-config-json-to-env --type=client path/to/client/config.json
6365
```
6466

67+
#### 2.1 - Rename environment variables
68+
69+
Rename the following .env variables in `.env.local`:
70+
71+
- From `APP_DEFAULT_DATE_FORMAT` to `DEFAULT_DATE_FORMAT`
72+
- From `APP_ACTIVATION_CODE_EXPIRE_INTERVAL` to `ACTIVATION_CODE_EXPIRE_INTERVAL`
73+
- From `APP_KEY_VAULT_SOURCE` to `KEY_VAULT_SOURCE`
74+
- From `APP_KEY_VAULT_JSON` to `KEY_VAULT_JSON`
75+
6576
#### 3 - Run doctrine migrate
6677

6778
```shell

assets/admin/components/feed-sources/feed-source-form.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import EventDatabaseApiFeedType from "./templates/event-database-feed-type";
1313
import ColiboFeedType from "./templates/colibo-feed-type";
1414
import StickyFooter from "../util/sticky-footer";
1515
import EventDatabaseApiV2FeedType from "./templates/event-database-v2-feed-type";
16+
import BrndFeedType from "./templates/brnd-feed-type.jsx";
1617

1718
/**
1819
* The feed-source form component.
@@ -124,6 +125,14 @@ function FeedSourceForm({
124125
feedSourceId={feedSource["@id"]}
125126
/>
126127
)}
128+
{feedSource?.feedType === "App\\Feed\\BrndFeedType" && (
129+
<BrndFeedType
130+
handleInput={handleSecretInput}
131+
formStateObject={feedSource.secrets}
132+
mode={mode}
133+
feedSourceId={feedSource["@id"]}
134+
/>
135+
)}
127136
{feedSource?.feedType ===
128137
"App\\Feed\\EventDatabaseApiFeedType" && (
129138
<EventDatabaseApiFeedType
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React from "react";
2+
import { useTranslation } from "react-i18next";
3+
import FormInput from "../../util/forms/form-input";
4+
5+
const BrndFeedType = ({ handleInput, formStateObject, mode }) => {
6+
const { t } = useTranslation("common", {
7+
keyPrefix: "brnd-feed-type",
8+
});
9+
10+
return (
11+
<>
12+
<FormInput
13+
name="api_base_uri"
14+
type="text"
15+
label={t("api-base-uri")}
16+
className="mb-2"
17+
onChange={handleInput}
18+
placeholder={
19+
mode === "PUT" ? t("redacted-value-input-placeholder") : ""
20+
}
21+
value={formStateObject?.api_base_uri}
22+
/>
23+
24+
<FormInput
25+
name="company_id"
26+
type="text"
27+
className="mb-2"
28+
label={t("company-id")}
29+
onChange={handleInput}
30+
placeholder={
31+
mode === "PUT" ? t("redacted-value-input-placeholder") : ""
32+
}
33+
value={formStateObject?.company_id}
34+
/>
35+
36+
<FormInput
37+
name="api_auth_key"
38+
type="text"
39+
label={t("api-auth-key")}
40+
onChange={handleInput}
41+
placeholder={
42+
mode === "PUT" ? t("redacted-value-input-placeholder") : ""
43+
}
44+
value={formStateObject?.api_auth_key}
45+
/>
46+
</>
47+
);
48+
};
49+
50+
export default BrndFeedType;

0 commit comments

Comments
 (0)