Skip to content

Commit

Permalink
Merge pull request #53 from i-VRESSE/table-widget
Browse files Browse the repository at this point in the history
Table widget
  • Loading branch information
sverhoeven authored Apr 5, 2022
2 parents 067fb67 + 3cdbea8 commit ee2de9b
Show file tree
Hide file tree
Showing 13 changed files with 727 additions and 22 deletions.
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,7 @@ The catalog is a YAML formatted file which tells the app what nodes are availabl

#### uiSchema

The global and node parameters are edited in a form generated from the JSON schema.
To customize the look and feel of the form the uiSchema can be used. For example rendering a radio group or a text area. The [react-json-schema-form](https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/) docs describes the uiSchema format.

Besides the built-in react-json-schema-form uiSchema fields the workflow builder adds the following:

```json
{
"prop1": {
"ui:group": "<group name>"
}
}
```

Any property with a group uiSchema field will be grouped together with other properties with the same group in the form. The generated toml file will have the props ungrouped.
See [docs/uiSchema.md](docs/uiSchema.md).

### tomlSchema

Expand Down
98 changes: 98 additions & 0 deletions docs/uiSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# UI schema

The global and node parameters are edited in a form generated from the JSON schema.
To customize the look and feel of the form the `uiSchema` can be defined in the catalog.
For example rendering a radio group or a text area can be done by filling the `uiSchema`.

The [react-json-schema-form](https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/) docs describes the uiSchema format and which built-in fields are avaiable.

Besides the built-in react-json-schema-form uiSchema fields, the workflow builder adds the following:

## ui:field: collapsible

An property of type object can be rendered as a collapsible sub-form with

```json
{
"prop1": {
"ui:field": "collapsible"
}
}
```

This will render the children of `prop1` in a initially collapsed sub-form.
To expand press the expand icon button.

### Initially expanded

Render the sub-form initially expanded with

```json
{
"prop1": {
"ui:field": "collapsible",
"ui:collapsed": true
}
}
```

Or alternativly using `ui:options` with

```json
{
"prop1": {
"ui:field": "collapsible",
"ui:options": {
"collapsed": true
}
}
}
```

## ui:group

```json
{
"prop1": {
"ui:group": "<group name>"
}
}
```

Any property with a group uiSchema field will be grouped together with other properties with the same group in the form. The generated toml file will have the props ungrouped.
The group will also be collapsible and collapsed by default.

## ui:field: table

A property which is an array of objects can be rendered as a table with

```json
{
"prop1": {
"ui:field": "table"
}
}
```

Each array item will be a row and each object property will be a column.
The header cells show the title of the property together with a popup for the description.
The other cells show the property without any titles or descriptions.

### Column widths

The column widths can be customized.

For example given an array of objects with properties `prop2` and `prop3`. To make `prop3` column have `40%` of the total table width use:

```json
{
"prop1": {
"ui:field": "table",
"ui:options": {
"widths": {
"prop3": "40%"
}
}
}
}
```
42 changes: 42 additions & 0 deletions public/catalog/haddock3.expert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,8 @@ nodes:
nrair:
ui:group: ab initio mode
rair:
items:
ui:field: table
ui:group: ab initio mode
surfrest:
ui:group: ab initio mode
Expand Down Expand Up @@ -1612,26 +1614,32 @@ nodes:
numc2sym:
ui:group: symmetry
c2sym:
ui:field: table
ui:group: symmetry
numc3sym:
ui:group: symmetry
c3sym:
ui:field: table
ui:group: symmetry
numc4sym:
ui:group: symmetry
c4sym:
ui:field: table
ui:group: symmetry
numc5sym:
ui:group: symmetry
c5sym:
ui:field: table
ui:group: symmetry
numc6sym:
ui:group: symmetry
c6sym:
ui:field: table
ui:group: symmetry
nums3sym:
ui:group: symmetry
s3sym:
ui:field: table
ui:group: symmetry
ncs_on:
ui:group: symmetry
Expand All @@ -1640,6 +1648,7 @@ nodes:
numncs:
ui:group: symmetry
ncs:
ui:field: table
ui:group: symmetry
w_dist:
ui:group: scoring
Expand Down Expand Up @@ -4399,26 +4408,32 @@ nodes:
numc2sym:
ui:group: symmetry
c2sym:
ui:field: table
ui:group: symmetry
numc3sym:
ui:group: symmetry
c3sym:
ui:field: table
ui:group: symmetry
numc4sym:
ui:group: symmetry
c4sym:
ui:field: table
ui:group: symmetry
numc5sym:
ui:group: symmetry
c5sym:
ui:field: table
ui:group: symmetry
numc6sym:
ui:group: symmetry
c6sym:
ui:field: table
ui:group: symmetry
nums3sym:
ui:group: symmetry
s3sym:
ui:field: table
ui:group: symmetry
ncs_on:
ui:group: symmetry
Expand All @@ -4427,6 +4442,7 @@ nodes:
numncs:
ui:group: symmetry
ncs:
ui:field: table
ui:group: symmetry
w_air:
ui:group: scoring
Expand Down Expand Up @@ -4473,6 +4489,8 @@ nodes:
nseg1:
ui:group: flexibility
seg:
items:
ui:field: table
ui:group: flexibility
nseg2:
ui:group: flexibility
Expand Down Expand Up @@ -4515,6 +4533,8 @@ nodes:
nfle1:
ui:group: flexibility
fle:
items:
ui:field: table
ui:group: flexibility
nfle2:
ui:group: flexibility
Expand Down Expand Up @@ -6358,26 +6378,32 @@ nodes:
numc2sym:
ui:group: symmetry
c2sym:
ui:field: table
ui:group: symmetry
numc3sym:
ui:group: symmetry
c3sym:
ui:field: table
ui:group: symmetry
numc4sym:
ui:group: symmetry
c4sym:
ui:field: table
ui:group: symmetry
numc5sym:
ui:group: symmetry
c5sym:
ui:field: table
ui:group: symmetry
numc6sym:
ui:group: symmetry
c6sym:
ui:field: table
ui:group: symmetry
nums3sym:
ui:group: symmetry
s3sym:
ui:field: table
ui:group: symmetry
ncs_on:
ui:group: symmetry
Expand All @@ -6386,6 +6412,7 @@ nodes:
numncs:
ui:group: symmetry
ncs:
ui:field: table
ui:group: symmetry
w_air:
ui:group: scoring
Expand Down Expand Up @@ -6430,6 +6457,8 @@ nodes:
nseg1:
ui:group: flexibility
seg:
items:
ui:field: table
ui:group: flexibility
nseg2:
ui:group: flexibility
Expand Down Expand Up @@ -6472,6 +6501,8 @@ nodes:
nfle1:
ui:group: flexibility
fle:
items:
ui:field: table
ui:group: flexibility
nfle2:
ui:group: flexibility
Expand Down Expand Up @@ -8231,26 +8262,32 @@ nodes:
numc2sym:
ui:group: symmetry
c2sym:
ui:field: table
ui:group: symmetry
numc3sym:
ui:group: symmetry
c3sym:
ui:field: table
ui:group: symmetry
numc4sym:
ui:group: symmetry
c4sym:
ui:field: table
ui:group: symmetry
numc5sym:
ui:group: symmetry
c5sym:
ui:field: table
ui:group: symmetry
numc6sym:
ui:group: symmetry
c6sym:
ui:field: table
ui:group: symmetry
nums3sym:
ui:group: symmetry
s3sym:
ui:field: table
ui:group: symmetry
ncs_on:
ui:group: symmetry
Expand All @@ -8259,6 +8296,7 @@ nodes:
numncs:
ui:group: symmetry
ncs:
ui:field: table
ui:group: symmetry
w_air:
ui:group: scoring
Expand Down Expand Up @@ -8299,6 +8337,8 @@ nodes:
nseg1:
ui:group: flexibility
seg:
items:
ui:field: table
ui:group: flexibility
nseg2:
ui:group: flexibility
Expand Down Expand Up @@ -8341,6 +8381,8 @@ nodes:
nfle1:
ui:group: flexibility
fle:
items:
ui:field: table
ui:group: flexibility
nfle2:
ui:group: flexibility
Expand Down
Loading

0 comments on commit ee2de9b

Please sign in to comment.