Skip to content

Commit

Permalink
Allow to configure node label in catalog
Browse files Browse the repository at this point in the history
Fixes #151
  • Loading branch information
sverhoeven committed Oct 9, 2024
1 parent 8fdaf87 commit c687600
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Configure node by clicking in workflow config toml text ([#20](https://github.com/i-VRESSE/workflow-builder/issues/20))
- Allow to configure node label in catalog ([#151](https://github.com/i-VRESSE/workflow-builder/issues/151))

## @i-vresse/wb-core 3.2.1 - 2024-08-26

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ The catalog is a YAML formatted file which tells the app what nodes are availabl
4. examples: Title and link to example workflows
* map with title as key and link as value
5. title: Title of the catalog
6. nodeLabel: Label of the node in the app. Default is 'Node'

### schema

Expand Down
1 change: 1 addition & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function App() {
useEffect(() => {
const catalog = {
title: "Some title",
nodeLabel: "Workflow node",
global: {
schema: {
type: "object",
Expand Down
16 changes: 16 additions & 0 deletions packages/core/src/CatalogPanel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,19 @@ export const WithExample: ComponentStory<typeof CatalogPanel> = () => {
})
return <CatalogPanel />
}

export const WithNodeLabel: ComponentStory<typeof CatalogPanel> = () => {
const setCatalog = useSetCatalog()
setCatalog({
title: 'Some title',
nodeLabel: 'My custom node label',
categories: [],
global: {
schema: {},
uiSchema: {}
},
nodes: [],
examples: {}
})
return <CatalogPanel />
}
2 changes: 1 addition & 1 deletion packages/core/src/CatalogPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const CatalogPanel = ({ children }: PropsWithChildren<{}>): JSX.Element =
<legend>Catalog</legend>
<React.Suspense fallback={<span>Loading catalog...</span>}>
{children}
<h4>Nodes</h4>
<h4>{catalog.nodeLabel ?? 'Node'}s</h4>
<ul style={{ lineHeight: '2.5em' }}>
{catalog.categories.map((category) => (
<CatalogCategory key={category.name} {...category} />
Expand Down
29 changes: 29 additions & 0 deletions packages/core/src/NodePanel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,32 @@ export const NodeSelected: ComponentStory<typeof NodePanel> = () => {
}, [])
return <NodePanel />
}

export const CustomNodeLabel: ComponentStory<typeof NodePanel> = () => {
const setCatalog = useSetCatalog()
// const { setEditingGlobal } = useWorkflow()
useEffect(() => {
const catalog = prepareCatalog({
title: 'Some title',
nodeLabel: 'My custom node label',
categories: [],
global: {
schema: {
type: 'object',
properties: {
parameter1: {
type: 'string'
}
},
additionalProperties: false
},
uiSchema: {}
},
nodes: [],
examples: {}
})
setCatalog(catalog)
// toggleGlobalEdit()
}, [])
return <NodePanel />
}
5 changes: 3 additions & 2 deletions packages/core/src/NodePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import React from 'react'
import { FormProps } from './FormProps'
import { GlobalForm } from './GlobalForm'
import { NodeForm } from './NodeForm'
import { useSelectNodeIndex } from './store'
import { useCatalog, useSelectNodeIndex } from './store'

/**
* Panel which renders the form for the selected node or the global parameters.
*
*/
export const NodePanel = ({ fields, widgets }: FormProps): JSX.Element => {
const selectedNodeIndex = useSelectNodeIndex()
const { nodeLabel } = useCatalog()

const legend = 'Node'
const legend = nodeLabel ?? 'Node'

return (
<fieldset>
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface IGlobal {

export interface ICatalog {
title: string
nodeLabel?: string
global: IGlobal
categories: ICategory[]
nodes: ICatalogNode[]
Expand Down
1 change: 1 addition & 0 deletions packages/haddock3_catalog/generate_haddock3_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ def process_level(level_fn: Path, level: str):

catalog = {
"title": f"Haddock 3 on {level} level",
"nodeLabel": "Module",
"categories": categories,
'global': process_global(level),
"nodes": nodes,
Expand Down
74 changes: 74 additions & 0 deletions packages/haddock3_catalog/public/catalog/haddock3.easy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
title: Haddock 3 on easy level
nodeLabel: Module
categories:
- name: topology
description: HADDOCK3 modules to create topologies.
Expand Down Expand Up @@ -1946,6 +1947,79 @@ nodes:
tomlSchema:
resdic:
indexed: true
- id: sasascore
category: scoring
label: Surface accessibility scoring module.
description: HADDOCK3 module to perform accessibility scoring.
schema:
type: object
properties:
cutoff:
default: 0.4
title: relative side chain surface accessibility cutoff
description: relative side chain surface accessibility cutoff
$comment: relative side chain surface accessibility cutoff. Residues with
a relative side chain surface accessibility below this value are considered
buried.
type: number
maximum: 1.0
minimum: 0.0
resdic_buried:
default: {}
title: List of residues supposed to be buried
description: List of residues supposed to be buried
$comment: resdic_buried_* is an expandable parameter. You can provide resdic_buried_A,
resdic_buried_B, resdic_buried_C, etc, where the last capital letter is
the chain identifier.
type: object
additionalProperties:
type: array
items:
type: number
format: residue
minItems: 0
maxItems: 100
uniqueItems: true
default: []
propertyNames:
pattern: ^[A-Z]$
format: chain
maxPropertiesFrom: molecules
resdic_accessible:
default: {}
title: List of residues supposed to be accessible
description: List of residues supposed to be accessible
$comment: resdic_* is an expandable parameter. You can provide resdic_accessible_A,
resdic_accessible_B, resdic_accessible_C, etc, where the last capital letter
is the chain identifier.
type: object
additionalProperties:
type: array
items:
type: number
format: residue
minItems: 0
maxItems: 100
uniqueItems: true
default: []
propertyNames:
pattern: ^[A-Z]$
format: chain
maxPropertiesFrom: molecules
required: []
additionalProperties: false
uiSchema:
cutoff:
ui:group: scoring
resdic_buried:
ui:group: analysis
resdic_accessible:
ui:group: analysis
tomlSchema:
resdic_buried:
indexed: true
resdic_accessible:
indexed: true
- id: seletop
category: analysis
label: Select a number of models.
Expand Down
85 changes: 85 additions & 0 deletions packages/haddock3_catalog/public/catalog/haddock3.expert.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
title: Haddock 3 on expert level
nodeLabel: Module
categories:
- name: topology
description: HADDOCK3 modules to create topologies.
Expand Down Expand Up @@ -8607,6 +8608,90 @@ nodes:
tomlSchema:
resdic:
indexed: true
- id: sasascore
category: scoring
label: Surface accessibility scoring module.
description: HADDOCK3 module to perform accessibility scoring.
schema:
type: object
properties:
cutoff:
default: 0.4
title: relative side chain surface accessibility cutoff
description: relative side chain surface accessibility cutoff
$comment: relative side chain surface accessibility cutoff. Residues with
a relative side chain surface accessibility below this value are considered
buried.
type: number
maximum: 1.0
minimum: 0.0
resdic_buried:
default: {}
title: List of residues supposed to be buried
description: List of residues supposed to be buried
$comment: resdic_buried_* is an expandable parameter. You can provide resdic_buried_A,
resdic_buried_B, resdic_buried_C, etc, where the last capital letter is
the chain identifier.
type: object
additionalProperties:
type: array
items:
type: number
format: residue
minItems: 0
maxItems: 100
uniqueItems: true
default: []
propertyNames:
pattern: ^[A-Z]$
format: chain
maxPropertiesFrom: molecules
resdic_accessible:
default: {}
title: List of residues supposed to be accessible
description: List of residues supposed to be accessible
$comment: resdic_* is an expandable parameter. You can provide resdic_accessible_A,
resdic_accessible_B, resdic_accessible_C, etc, where the last capital letter
is the chain identifier.
type: object
additionalProperties:
type: array
items:
type: number
format: residue
minItems: 0
maxItems: 100
uniqueItems: true
default: []
propertyNames:
pattern: ^[A-Z]$
format: chain
maxPropertiesFrom: molecules
probe_radius:
default: 1.4
title: Probe radius
description: Probe radius
$comment: Sets the probe radius (in Angstrom) used to compute solvent accessible
surface area.
type: number
maximum: 10.0
minimum: 0.0
required: []
additionalProperties: false
uiSchema:
cutoff:
ui:group: scoring
resdic_buried:
ui:group: analysis
resdic_accessible:
ui:group: analysis
probe_radius:
ui:group: analysis
tomlSchema:
resdic_buried:
indexed: true
resdic_accessible:
indexed: true
- id: seletop
category: analysis
label: Select a number of models.
Expand Down
Loading

0 comments on commit c687600

Please sign in to comment.