haddock3 icon indicating copy to clipboard operation
haddock3 copied to clipboard

title/descriptions for expandable parameters

Open sverhoeven opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Expandable parameters (aka parameters in defaults.yaml files with _1 in their name) in the workflow builder app are rendered as an array of sub forms.

In the builder I generate

mol_shape:
  type: array
  items:
    default: false
    title: Is the molecule a shape?
    description: Defines a molecule as a shape.
    $comment: Defines a molecule as a shape, which is a collection of beads.
    type: boolean

from a defaults.yaml in haddock3

mol_shape_1:
  default: false
  type: boolean
  title: Is the molecule a shape?
  short: Defines a molecule as a shape.
  long: Defines a molecule as a shape, which is a collection of beads. 
  group: 'molecule'
  explevel: easy

So mol_shape.items has a title, but mol_shape itself does not.

I would like to have something like

mol_shape:
  type: array
  title: Which molecules are a shape?
  description: Defines some molecules as a shape.
  $comment: Defines some molecules as a shape.
  items:
    default: false
    title: Is the molecule a shape?
    description: Defines a molecule as a shape.
    $comment: Defines a molecule as a shape, which is a collection of beads.
    type: boolean

Currently there is no place where I can get value of mol_shape.title, mol_shape.description and mol_shape.$comment.

Describe the solution you'd like

Somewhere in the haddock3 code to define title/short/long for the parameter in its collapsed state. This could be done as additional keys in defaults.yaml like

mol_shape_1:
  default: false
  type: boolean
  title: Is the molecule a shape?
  short: Defines a molecule as a shape.
  long: Defines a molecule as a shape, which is a collection of beads. 
  expandedtitle: Which molecules are a shape?
  expandedshort: Defines some molecules as a shape.
  expandedlong: Defines some molecules as a shape.
  group: 'molecule'
  explevel: easy

However this solution only works nicely for type 3 expandable parameters

Describe alternatives you've considered

  • For array of scalars (eg. mol_shape_1): Appending s to title of array item.
  • For array of array of objects (eg. rair_sta_1_1 + rair_end_1_1): Find overlap between titles and use that as title for array.
  • Use number field with replace (eg. nfle1.title.replace('Number of', '')), however these will disappear in fix for #369

Additional context Add any other context or screenshots about the feature request here.

Below is a screenshot of the app. Instead of mol_shape I would like to show a human readable title. localhost_3000_ (5)

sverhoeven avatar Apr 04 '22 15:04 sverhoeven