proophboard / cody-engine

Event Modeling meets prototyping
https://wiki.prooph-board.com/cody_engine/introduction.html
MIT License
10 stars 6 forks source link

Feature/data select #21

Closed codeliner closed 1 year ago

codeliner commented 1 year ago

This PR adds a "DataSelectWidget" that can be used in a json-schema-form to fetch a "queryable state list" from the backend and turn every state item into a select option.

Here is an example usage within a "Add Model" command that fetches a list of "Brands" for a brand selectbox

Add Model Metadata

{
  "newAggregate": true,
  "shorthand": true,
  "schema": {
    "modelId": "string",
    "brandId": "string|title:Brand",
    "name": "string"
  },
  "uiSchema": {
    "brandId": {
      "ui:widget": "DataSelect",
      "ui:options": {
        "data": "FleetManagement.Car.BrandList",
        "label": "data.name",
        "value": "data.brandId",
        "addItemCommand": "FleetManagement.AddBrand"
      }
    }
  }
}

Additionally, an "Add-Item-Command" can be configured to show a command button below the select box. The command should add a new state item that will become available in the select afterwards.