You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Static, production build](#static-production-build)
@@ -19,29 +20,48 @@ Table of contents:
19
20
*[Query icons](#query-icons)
20
21
*[Custom queries](#custom-queries)
21
22
*[Representation Mapper](#representation-mapper)
22
-
*[Using the local pods](#using-the-local-pods)
23
23
*[Advanced topics](#advanced-topics)
24
-
*[Adapting this project to your needs](#adapting-this-project-to-your-needs)
25
24
*[Converting custom queries into common queries](#converting-custom-queries-into-common-queries)
26
-
*[Testing](#testing)
27
-
*[Testing the production version](#testing-the-production-version)
28
-
*[Testing the development version](#testing-the-development-version)
25
+
*[For developers](#for-developers)
26
+
*[Adding your own configuration](#adding-your-own-configuration)
27
+
*[Testing](#testing)
28
+
*[Testing the production version](#testing-the-production-version)
29
+
*[Testing the development version](#testing-the-development-version)
29
30
30
31
## Preface
31
32
32
-
This repository defines a Web application in the directory `main` and some auxiliary tools for testing and supporting a demo in the directory `test`.
33
+
This repository defines a Web application in the directory `main` and some supporting resources in the directory `test`.
34
+
35
+
The Web application is configured by the following configuration resources:
36
+
37
+
* file `main/src/config.json`;
38
+
* directory `main/public`.
39
+
40
+
In order to be able to maintain several different configurations (or *flavours*) in this repository, these configuration resources are *git-ignored*.
41
+
Before launching or building the application, their contents need to be copied from the appropriate subdirectory of `main/configs`.
42
+
The instructions below explain when and how to use the `select-config.cjs` script for this purpose.
43
+
44
+
## Prerequistes
45
+
46
+
* Node >= 18 with npm
33
47
34
48
## Getting started
35
49
36
-
The application is located in directory `main`.
50
+
The Web application is located in directory `main`.
37
51
Go to that directory.
38
52
39
-
To install the application:
53
+
To install:
40
54
41
55
```bash
42
56
npm install
43
57
```
44
58
59
+
To select the appropriate configuration (here shown for `demo`):
60
+
61
+
```bash
62
+
node scripts/select-config.cjs demo
63
+
```
64
+
45
65
To run the Web application in development mode:
46
66
47
67
```bash
@@ -50,12 +70,20 @@ npm run dev
50
70
51
71
Now you can browse the displayed URL.
52
72
53
-
If you want to test the queries provided in the default configuration `main/src/config.json`,
54
-
continue in section [The supporting resources](#the-supporting-resources).
73
+
In case of the `demo` configuration:
74
+
75
+
* you'll need to spin up the supporting resources as explained in section [The supporting resources](#the-supporting-resources);
76
+
* some queries require you to be logged in; log in at IDP `http://localhost:8080` as user `hello@example.com` with password `abc123`.
55
77
56
78
## The supporting resources
57
79
58
-
The supporting resources, including a local pod containing example data, are located in directory `test`.
80
+
The supporting resources are located in directory `test`.
81
+
82
+
These include:
83
+
84
+
* a local pod containing data used in the `demo` and `test` configurations;
85
+
* proxies used int the `demo` and `test` configurations;
86
+
* scripts to support automated testing.
59
87
60
88
To install, go to directory `test` and execute:
61
89
@@ -84,14 +112,19 @@ in a new terminal window, also in directory `test`:
84
112
npm run start:badCors
85
113
```
86
114
87
-
Some queries require a log in.
88
-
Log in with the IDP `http://localhost:8080` and the credentials for the user owning the pod named `example` in the file `test/seeded-pod-config.json`.
89
-
90
115
## Static, production build
91
116
92
117
To make a standalone version of the result of this project, you can make a static build and serve it using any webserver.
93
118
94
-
In directory `main`, execute:
119
+
Go to directory `main`.
120
+
121
+
To select the appropriate configuration (here shown for `demo`):
122
+
123
+
```bash
124
+
node scripts/select-config.cjs demo
125
+
```
126
+
127
+
To build:
95
128
96
129
```bash
97
130
npm run build
@@ -110,7 +143,7 @@ If you provide a WebID, the first Identity Provider found in the given WebID is
110
143
111
144
## Configuration file
112
145
113
-
The configuration file `main/src/config.json` follows a simple structure.
146
+
The configuration file must follow the structure shown below.
114
147
115
148
```json
116
149
{
@@ -314,46 +347,40 @@ They've already got styling matching that of `react-admin` and are easy to use.
314
347
315
348
`Warning` if you change the record object, the changed will still be present in the next render.
316
349
317
-
## Using the local pods
318
-
319
-
To support the provided example configuration `main/src/config.json` and the tests, this repo integrates some local pods.
320
-
You can make use of these for your own tests. Follow these steps:
321
-
322
-
* Add your data and `.acl` files in the `test/initial-pod-data` folder.
323
-
These files will be available in the pod relative to `http://localhost:8080/example/`.
324
-
* Prepare the pods by executing `npm run reset:pods` in directory `test`.
325
-
326
350
## Advanced topics
327
351
328
-
### Adapting this project to your needs
329
-
330
-
The easiest way to adapt this project to your needs is:
331
-
332
-
1. Make your own fork on github.
333
-
2. Concentrate on the files in the `main` subdirectory.
334
-
3. Add your own queries in the `main/public/queries` directory and in general, your own resources in the `main/public` directory.
335
-
4. Write your own `main/src/config.json` file, following the [configuration file documentation above](#configuration-file).
336
-
5. Run or build as documented above.
337
-
338
352
### Converting custom queries into common queries
339
353
340
354
Once you have your basic configuration working, you may extend it with custom queries interactively with the query editor
341
355
and save these to a file in a pod.
342
-
You can convert such custom queries into common queries, by adding them to `main/src/config.json`.
356
+
You can convert such custom queries into common queries, by adding them to `main/configs/<your-config>/config.json`.
343
357
Follow these steps to get started:
344
358
345
359
1.**Open and view the file with custom queries** using a tool, such as [Penny](https://penny.vincenttunru.com/). The file has JSON syntax and contains an array of query objects.
346
-
2.**Copy the query objects of interest** to the `"queries"` array in `main/src/config.json`.
360
+
2.**Copy the query objects of interest** to the `"queries"` array in `main/configs/<your-config>/config.json`.
347
361
Note that the various queries that were documented in the [configuration file documentation above](#configuration-file) in `"queryLocation"` properties,
348
362
appear here as `"queryString"` variants, with inline contents rather than references to query files (`*.rq`).
349
363
Leave as is or convert to query files as you like.
350
364
Inline queries may be hard to read due to the difficult newline coding in JSON syntax.
351
365
3.**Update the `"queryGroupId"` property** in all these queries, to separate them from the custom queries. Ensure the group exists in the `"queryGroups"` array, or create a new group if you prefer.
352
366
4.**Update the `"id"` property**, to avoid conflicts with remaining custom queries: the id must be unique and it also defines the position in the query group.
353
367
5.**Adapt any other properties** according to your preferences.
354
-
6.**Save `main/src/config.json`**, rerun or rebuild and refresh your browser to test.
368
+
6.**Save `main/configs/<your-config>/config.json`**, rerun or rebuild and refresh your browser to test.
369
+
370
+
## For developers
371
+
372
+
### Adding your own configuration
373
+
374
+
The easiest way to add your own configuration is:
375
+
376
+
1. Get inspired by the configuration in `main/configs/demo`.
377
+
2. Choose your `<your-config>`: a string obeying regex `[a-z0-9-]+`; directory `main/configs/<your-config>` should not yet be in use.
378
+
3. Add your own queries in the `main/configs/<your-config>/public/queries` directory and in general, your own resources in the `main/configs/<your-config>/public` directory.
379
+
4. Write your own `main/configs/<your-config>/config.json` file, following the [configuration file documentation above](#configuration-file).
380
+
5. Run or build as documented above for the `demo` configuration, of course now using `<your-config>`.
381
+
6. Consider a pull request to add your configuration to this repo.
355
382
356
-
## Testing
383
+
###Testing
357
384
358
385
For testing with the provided configuration file, we use [Cypress](https://www.cypress.io/).
359
386
@@ -363,7 +390,7 @@ The development version might be tested repeatedly during development.
363
390
364
391
Both the production version and the development version are tested from a non-empty path in the base URL.
365
392
366
-
### Testing the production version
393
+
####Testing the production version
367
394
368
395
1. Build the production version of the Web application and serve it:
369
396
@@ -374,6 +401,8 @@ Both the production version and the development version are tested from a non-em
374
401
rm -rf node_modules/
375
402
rm -rf dist/
376
403
npm install
404
+
# select the test configuration
405
+
node scripts/select-config.cjs test
377
406
# build
378
407
npm run build
379
408
```
@@ -400,7 +429,7 @@ Both the production version and the development version are tested from a non-em
400
429
npm run test:interactive
401
430
```
402
431
403
-
### Testing the development version
432
+
####Testing the development version
404
433
405
434
The procedure is the same as for testing the production version, except for step 1, which is now:
0 commit comments