Skip to content

Commit bb6ec87

Browse files
authored
Merge pull request #154 from KNowledgeOnWebScale/development
v1.1.0
2 parents 350e7ce + 2f0a905 commit bb6ec87

File tree

80 files changed

+4612
-1347
lines changed

Some content is hidden

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

80 files changed

+4612
-1347
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: GitHub Pages CI
2-
on: push
2+
on:
3+
push:
4+
branches:
5+
- main
36

47
jobs:
58
build-test-deploy:
@@ -11,8 +14,9 @@ jobs:
1114
uses: actions/setup-node@v1
1215
with:
1316
node-version: "18.x"
14-
- run: npm ci
17+
- run: npm ci --legacy-peer-deps
1518
- run: npm run build
19+
- run: npm test
1620
- name: Deploy
1721
uses: crazy-max/ghaction-github-pages@v1
1822
with:

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm test -- --watchAll=false

CHANGELOG.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
11
# Changelog
22

3-
Dates are DD-MM-YYYY
3+
All notable changes to this project will be documented in this file.
44

5-
## [0.1.0] - 04-08-2022
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
First ever release. You can make flows from JSON or YAML.
8+
## Unreleased
9+
10+
/
811

9-
## [1.0.0] - 12-08-2022
12+
## [1.1.0] - 2022-09-02
13+
14+
### Added
15+
16+
- Details custom React component
17+
- Support to embed a link to an online JSON file in a permalink.
18+
- Input field to enter a permalink
19+
- You can set spacing for autoLayout, hgroup and vgroups.
20+
- The shape of a node can be anything defined in [react-icons](https://react-icons.github.io/react-icons).
21+
- Added FAQ section to README
22+
- You can make 'simulations' (= flow in multiple steps)
23+
- Navigation bar, so you can quickly navigate a large network of nodes.
24+
- You can use an ellipse as shape for a node.
25+
- You can refer to multiple presets.
26+
- Make fontsize smaller of title and label, if it does not fit its node.
27+
- Undo/redo buttons
28+
29+
### Changed
30+
31+
- Controls and MiniMaps everywhere
32+
- updates schemas and docs via test script
33+
- Clicking on the button to get the permalink, will always return the link where the custom data is encoded. Never a
34+
link with raw data.
35+
36+
### Fixed
37+
38+
- Changelog formatting
39+
- Auto layout with horizontal layout was broken.
40+
- Some shapes showed unexpected behaviour when height and width were not the same.
41+
42+
## [1.0.0] - 2022-08-12
1043

1144
### Added
1245

@@ -45,17 +78,12 @@ First ever release. You can make flows from JSON or YAML.
4578

4679
- Issue #40: If you changed the color of an edge, all the markers with no color specified, changed to that color.
4780
- Issue #69: Title and label in a node that was no parent, did not work.
81+
- Kept [README.md] en [DEVELOPMENT.md] up to date with all the new changes and additions.
4882

49-
Kept [README] en [DEVELOPMENT] up to date with all the new changes and additions.
50-
51-
## Unreleased
83+
## [0.1.0] - 2022-08-04
5284

53-
* /
85+
First ever release. You can make flows from JSON or YAML.
5486

5587
[DEVELOPMENT.md]: DEVELOPMENT.md
5688

57-
[DEVELOPMENT]: DEVELOPMENT.md
58-
5989
[README.md]: README.md
60-
61-
[README]: README.md

DEVELOPMENT.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,71 @@ This document is aimed at developers.
44

55
### How to autogenerate the documentation
66

7-
In [index.js](src/index.js) set the variable `download` to `true`. Rerun the application and set the variable to `false`
8-
again. You will notice there were three JSON files downloaded. Paste the contents of these files in the accompanying
9-
files in the directory [schemas/schemas](schemas/schemas). Open your terminal, `cd` to `/schemas` and
10-
run `node JSONSchemaMarkdown.js`. The new markdowns will be generated, [README.md](README.md) already links to these
7+
Run `npm run build:docs`. This uses the Jest runner to re-create the schemas and their documentation,
8+
and stores them in the accompanying
9+
files in the directory [schemas/schemas](schemas/schemas).
10+
The new markdowns will be generated, [README.md](README.md) already links to these
1111
files.
1212

13-
You might ask why not introduce a command, e.g. `npm build docs` that launches a separate script. The reason is that
14-
React can't write to files and the separate script would need the schemas being built
15-
in [schemaValidation.js](src/lib/schemaValidation.js). In order for that script to import a JavaScript file used in
16-
React, someone should mess with webpack. To the person who will do this, good luck!
13+
Note that there is a pre-commit hook (see [.husky](.husky)) that regenerates the docs.
1714

1815
### How to add shapes/images
1916

2017
As mentioned in the documentation, the value of `image` can be a predefined value or a URL. If you want to add your own
2118
predefined
22-
image, edit the hashmap `SHAPES` in the file [nodeUtil.js](./src/components/node/nodeUtil.js). Pull requests are always
19+
image, edit the hashmap `SHAPES` in the file [nodeUtil.js](./src/components/node/nodeUtil.js). Then add the name of your
20+
shape to the array `shapes` in [configParsing.js](src/lib/configParsing.js). Pull requests are always
2321
welcome.
2422

23+
Note that there are already thousands of shapes supported. In your node config, you can set `shape` to `icon`. Then you
24+
can set the key `iconName` to anything defined in the [react-icons](https://react-icons.github.io/react-icons) library.
25+
26+
### How to add a custom React component as a node
27+
28+
Add your custom React component under the [custom](./src/components/custom/) folder and add an entry
29+
to [index.js](./src/components/custom/index.js).
30+
See the `Details` component for an example.
31+
2532
### How to add examples
2633

34+
#### Single-config flow
35+
2736
When using this application, you'll notice there are buttons to load examples. These buttons load in the
28-
files [exampleData1.js](./src/data/examples/exampleData1.js), [exampleData2.js](./src/data/examples/exampleData2.js) ...
37+
files [exampleData1.js](src/data/single-flow/examples/exampleData1.js)
38+
, [exampleData2.js](src/data/single-flow/examples/exampleData2.js) ...
2939
So if you want to
3040
add
3141
an example, just create another file. In this file, you should have a JSON object for the global defaults, an array of
3242
nodes
3343
and an array of edges. Optionally, you can set a title as well. This will be the text inside the button (so the contents
3444
of the buttons don't have to be `example x`). If your file is ready, import everything
35-
in [examples.js](./src/data/examples.js) and add your imports to the array `examples`. A button to load in
45+
in [examples.js](src/data/single-flow/examples.js) and add your imports to the array `examples`. A button to load in
3646
your example will automatically show up if you restart the application.
3747

48+
#### Multi-config flow
49+
50+
The buttons to load in multi-config flows are shown on the page where you build your simulation.
51+
There is already an example provided. See e.g., [example1/](src/data/simulation-flow/examples). To make your own
52+
example,
53+
make a new folder where you put every step in a different file. As with the single-config examples, you should have a
54+
JSON object for the global defaults, an array for the nodes, and an array for the edges. When you have created your
55+
configs, import them in [examples.js](src/data/simulation-flow/examples.js). Next, add your imports to the
56+
hashmap `examples` the same way
57+
this is done by the other examples. The keys of the hashmap (e.g. `example 1`) will be the text on the buttons (that
58+
once again will show up automatically). However, you can't deviate from the keys `step0`, `step1`, `...` .
59+
3860
### Permalink
3961

40-
There is a button to get a link to your flow. There are two formats for a link.
62+
There is a button to get a link to your flow. There are three formats for a link.
4163

4264
1) `https://knowledgeonwebscale.github.io/dataflow-visualization/#/customdata?globaldefaults=...&nodes=...&edges=...`
4365
* The query parameters are the URI-encoded values of what's inside the editors.
4466
2) `https://knowledgeonwebscale.github.io/dataflow-visualization/#/rawdata?nodes=...&edges=...`
4567
* The query parameters are the URI-encoded values of the raw data of the flow. Remember, there is a button to export
4668
the raw data.
69+
3) `https://knowledgeonwebscale.github.io/dataflow-visualization/#/online?location=...`
70+
* The query parameter is a URL to an online JSON file. The structure of that file should be the same as the
71+
structure when you export your config.
4772

48-
If you press the button to copy the permalink to your clipboard, you get whichever link is shortest.
73+
If you press the button to copy the permalink to your clipboard, you get the first link (`customdata`).
4974

README.md

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- omit in toc -->
2+
13
# Flow Visualization
24

35
This is a [React] application to generate flow graphs from [JSON] or [YAML].
@@ -8,7 +10,8 @@ It is built on top of [ReactFlow].
810
- [Global defaults](#global-defaults)
911
- [Nodes](#nodes)
1012
- [Edges](#edges)
11-
- [Buttons](#buttons)
13+
- [Buttons](#controls)
14+
- [FAQ](#faq)
1215
- [License](#license)
1316

1417
## How to run
@@ -20,13 +23,13 @@ and open http://localhost:3000/.
2023
## Documentation
2124

2225
If you [run the application](#how-to-run), you'll see that there are three editors. One to
23-
set [global defaults](#global-defaults), one to describe the [nodes](#nodes) and one for the [connections](#edges)
26+
set [global defaults](#global-defaults), one to describe the [nodes](#nodes), and one for the [connections](#edges)
2427
between these nodes (edges). The editors you see are the same editors used
25-
by [Visual Studio Code](https://code.visualstudio.com/),
26-
this means that you can use shortcuts like `ctrl+shift+i` for indentation or `ctrl+z` to undo your last change. You can
28+
by [Visual Studio Code](https://code.visualstudio.com/).
29+
This means that you can use shortcuts like `ctrl+shift+i` for indentation or `ctrl+z` to undo your last change. You can
2730
also open the command palette by hitting the `F1`-key.
2831

29-
Note when reading this documentation: this is a [React] application, so all ID's/properties are
32+
Note when reading this documentation: this is a [React] application, so all ID's and properties are
3033
written in [camelCase](https://en.wikipedia.org/wiki/Camel_case).
3134

3235
### Global defaults
@@ -42,6 +45,16 @@ nodes or edges.
4245

4346
* More info: [nodes](schemas/docs/nodes-doc.md)
4447

48+
#### ID
49+
50+
IDs are used by the edges to refer to a node. But IDs are not mandatory. If no ID is specified:
51+
52+
* If the node has a unique `title`, the title becomes the ID.
53+
* If the node has a unique `label`, that label becomes the ID.
54+
* If the node has a unique `shape`, that shape becomes the ID.
55+
* If the node has a unique `image`, that image becomes the ID.
56+
* Otherwise, there is no way (as the end user) to refer to that node.
57+
4558
#### Node positioning
4659

4760
[As seen before](#nodes), you can set the positions of all nodes individually with the `position` key. But it is not
@@ -62,36 +75,25 @@ very efficient to set all nodes manually. There are three mechanisms to make the
6275
- Use the `autoLayout` key:
6376
- If set to `true`, [dagre](https://github.com/dagrejs/dagre) is used to position all the nodes. The keys `position`
6477
, `vgroup` and `hgroup` are ignored. This method works for very simple flows (e.g. example 1). If your flows start
65-
to get a little more complex, this method is not recommended, because dagre does not always work very well in
78+
to get a little more complex, this method is not recommended because dagre does not always work very well in
6679
combination with this project.
6780

6881
### Edges
6982

7083
* More info: [edges](schemas/docs/edges-doc.md)
7184

72-
#### Animations
73-
74-
There is a key `animated`, which you can set to `true`. But if you want custom animations, you should use
75-
the `animation` property. An example of the standard `animated` key can be found
76-
in [example 2](/src/data/examples/exampleData2.js). Custom animations can be
77-
found in [example 6](/src/data/examples/exampleData6.js). For more information about the `animation` property, please
78-
check out
79-
the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/animation). If you use `animated` with
80-
no `strokeDasharray`, `strokeDasharray` is set to a value of `5`. If you use a custom `animation`, the `animated` key
81-
has no effect anymore.
82-
83-
### Buttons
85+
### Controls
8486

8587
When running this application, you'll see that there are a few buttons visible.
8688

8789
#### Example buttons
8890

89-
These buttons on are for loading in examples.
91+
These buttons are for loading examples.
9092

9193
#### Import/export buttons
9294

9395
These buttons are to import and export entire configs (format is JSON). This feature is useful if you want to save
94-
configs for later.
96+
configurations for later.
9597

9698
There is also a button to export the raw data. This is the data needed for [ReactFlow] to draw up a flow.
9799

@@ -125,13 +127,74 @@ See [DEVELOPMENT.md](DEVELOPMENT.md#permalink) for more information about the st
125127

126128
#### Autosync button
127129

128-
If this switch is toggled on, the flow will render automatically if the config has been changed and is valid.
130+
If this switch is toggled on, the flow will render automatically if the configuration has been changed and is valid.
129131

130132
#### Snap to grid button
131133

132134
If this switch is toggled, the nodes will be snapped to the grid. If this switch is not toggled, you can move the nodes
133135
more freely.
134136

137+
#### Enter permalink input field
138+
139+
If you have a link `https://knowledgeonwebscale.github.io/dataflow-visualization/#/customdata?...`, you can enter that
140+
link in the text input field. The configs encoded in that URL will be filled in into the editors, so you can edit and
141+
create a new permalink.
142+
143+
#### Undo/redo buttons
144+
145+
With undo, you can go to a previous (valid) configuration, and with redo, you can move forward.
146+
147+
*Autosync enabled*
148+
The state of the configs is saved if there has been more than two seconds elapsed since the last change in one of
149+
the editors.
150+
151+
If you click on e.g. redo you load in the previous config. That configuration will, of course, not be saved again (
152+
unless you make a change).
153+
154+
*Autsync disabled*
155+
The state of the configs will be saved every time you press 'convert' and your configs are valid.
156+
157+
#### Create simulation button
158+
159+
When clicking on this button, you'll be redirected to a new page. On that page, you can create multiple configs. When
160+
clicking 'convert', you'll be able to animate the flow by visualizing one config after the other.
161+
162+
#### Navigation bar
163+
164+
Next to the window where your flow is shown, you see a gray bar. This is some sort of "jump bar". Depending on where
165+
you click on the bar, you'll jump to the height of a different node. If you click somewhere at the very top of the bar,
166+
you'll jump to the height of the most upper node. The lower you click, the lower the node that will be picked as the
167+
reference height. If you click somewhere at the bottom of the bar, you'll jump to the y position of the lowest node.
168+
169+
This navigation bar is very useful when you want to quickly navigate through a very large network of (vertically
170+
oriented)
171+
nodes.
172+
173+
## FAQ
174+
175+
#### I have an animated edge. How do I change the direction of this animation without messing up my layout?
176+
177+
You could, of course, switch `source` and `target`. But when using `autoLayout`, this may mess up your layout a bit. A
178+
solution could be to use the `animation` key. If you have `animation` set to e.g. `dashdraw .6s linear infinite`, you
179+
can just change this to `dashdraw .6s linear infinite reverse` and your problem is solved. If you're satisfied with the
180+
default animations, there is also an option to set `animation` to `reverse`.
181+
182+
#### The sizing of some nodes doesn't seem to work. Why?
183+
184+
Some shapes are only defined by an aspect ratio. So changing that ratio simply makes it another shape. For example,
185+
setting a
186+
different width and height for the shapes `square`
187+
, `cirle` ... does not make sense.
188+
189+
If you do set, e.g., a `square` to a width of, e.g., 50 and a height of, e.g., 100. Then the largest possible square
190+
will be
191+
drawn inside a box of 50 by 100 (so in this case, you can expect a height of 50).
192+
193+
#### In the simulation creation page, when loading example 1 and clicking convert, I just see a button 'Step 0'. Shouldn't I see more buttons (one per configuration)?
194+
195+
Yes, you should see more buttons (you should see a button for step 0 to step 4). Some people reported this bug, this
196+
is an unresolved issue ([#138](https://github.com/KNowledgeOnWebScale/dataflow-visualization/issues/138)).
197+
135198
## License
136199

137200
This project is licensed under the terms of the MIT License. See [LICENSE.md](LICENSE.md) for details.

0 commit comments

Comments
 (0)