Skip to content

Latest commit

 

History

History
184 lines (129 loc) · 4.38 KB

DOC.md

File metadata and controls

184 lines (129 loc) · 4.38 KB

DOC

Table of content

Database connections

key owner token repo path modes
1 db-man ... db dbs
2 db-man ... split-table-db dbs split-table

When a database is set split-table, when update a table record, will only update the table record file, not the whole table file.

Database structure

  • dbs/iam/dbcfg.json All tables in this database, and all columns in each table
  • dbs/iam/users.data.json Table data file
  • dbs/iam/users/*.json Table record files. These files are split from users.data.json file. (Only in split-table mode)

Table definition

Table is defined in dbcfg.json file.

See src/types/DbTable.ts

An example:

{
  "name": "users",
  "columns": [
    { "id": "userId", "name": "User ID", "primary": true },
    { "id": "name", "name": "Name" },
    { "id": "age", "name": "Age", "type": "NUMBER" },
    { "id": "active", "name": "Active", "type": "BOOL" },
    { "id": "tags", "name": "Tags", "type": "STRING_ARRAY" },
    {
      "id": "notes",
      "name": "Notes",
      "type": "STRING",
      "type:createUpdatePage": "TextArea"
    }
  ],
  "large": true
}

Column definition

See src/types/Column.ts

An example:

{
  "id": "userId",
  "name": "User ID",
  "type": "string",
  "primary": true
}

id (Required)

name (Required)

type (Required)

See src/types/Column.ts::DbColumnType

primary

See src/types/Column.ts

filter

TODO add description here

placeholder

See src/types/Column.ts::ColumnPlaceholder

enum

See src/types/Column.ts::RadioGroupUiTypeEnum

ui:presets

See src/types/Column.ts::Column

tableProps

TODO add description here

referenceTable

TODO add description here

isListPageImageViewKey

TODO add description here

type:listPage

Hide this column

Set HIDE will hide this column in table.

{
  "id": "product_id",
  "type:listPage": "HIDE"
}

Custom UI component

On list page, choose the UI component to use for this column.

Below is an example of using ImageLink component. The string after "ImageLink" is a template (Handlebars). It will transform the record which passing from antd Table component, into a props object like {url:'',imgSrc:''}. This props will pass to ImageLink component.

{
  "id": "product_id",
  "type:listPage": [
    "ImageLink",
    "{\"url\":\"https://brickset.com/{{record.product_id}}-1\",\"imgSrc\":\"https://img.brickset.com/{{record.product_id}}-1.jpg\"}"
  ]
}

type:randomPage

On the Random Page, choose the UI component to use for one of the list item.

Below is an example of using ImageLink component. The string after "ImageLink" is a template (Handlebars). It will transform the record which passing from antd Table component, into a props object like {url:'',imgSrc:''}. This props will pass to ImageLink component.

{
  "id": "product_id",
  "type:randomPage": [
    [
      "ImageLink",
      "{\"url\":\"{{record.photos.[0]}}\",\"imgSrc\":\"{{record.photos.[0]}}\"}"
    ]
  ]
}

Split table

Database examples

Glossary

{
  "id": "product_id",
  "type:listPage": [
    "ImageLink",
    "{\"url\":\"https://brickset.com/{{record.product_id}}-1\",\"imgSrc\":\"https://img.brickset.com/{{record.product_id}}-1.jpg\"}"
  ]
}
  • "type:listPage" - render key
  • ["ImageLink","{\"url\":\"http://a.com/{{record.id}}\",\"imgSrc\":\"http://b.com/{{record.name}}.jpg\"}"] - render expression
    • ImageLink - render expression built-in function name
    • "{\"url\":\"http://a.com/{{record.id}}\",\"imgSrc\":\"http://b.com/{{record.name}}.jpg\"}"] - render expression function template