Frontend

Frontend

You can access all data fetched from backend by viewing

console.log(window.appGlobalState)

Executing onXError & onXSuccess & onXFinally

Javascript

{
  "type": "javascript",
  "javascript": [ //you can provide javascript as array of strings or string
    "console.log('first line');",
    "console.log('second line');"
  ]
}
{
  "type": "javascript",
  "javascript": "console.log('first line'); console.log('second line');"
}

Notification

{
  "type": "notification",
  "message": "this is sample notification"
}

Query

{
  "type": "query",
  "query": "estate-types",
  //query id that you want to run
  "dataKeyName": "myCustomQueryResponse",
  "params": [
    {
      "name": "name",
      "value": "appGlobalState.inputValue"
    },
    {
      "name": "limit",
      "value": 200
    }
  ],
  "isErrorResponse": "response.statusCode !== 200 || response.data.Data.length > 0", //that way you can start error logic
  "processResponse": "",
  "extractResponseData": [
    "return response.data.Data.map(item => { return {\"name\" : item.code, \"value\" : item.id  }) })"
  ]
}

All data from running that query will be saved here

console.log(window.appGlobalState.myCustomQueryResponseSuccess)
console.log(window.appGlobalState.myCustomQueryResponseError)

Reload

{
  "type": "reload",
  "component": "estate-list-table" //componentId that you would like to reload
}

Example

{
  "id": "pagination-page",
  "name": "Pagination page",
  "components": [
    {
      "type": "pagination",
      "id": "samplePagination",
      "onClick": []
    },
    {
      "type": "input",
      "id": "samplePaginationItemsCount",
      "default": 10,
      "onChange": [
        {
          "type": "reload",
          "component": "samplePagination"
        }
      ]
    },
    {
      "type": "input",
      "id": "samplePaginationItemsPerPage",
      "default": 10,
      "onChange": [
        {
          "type": "reload",
          "component": "samplePagination"
        }
      ]
    }
  ]
}

Static data

{
  "type": "static-data",
  "id": "static-data-page-size",
  "dataKeyName": "staticPaginationData",
  "data": [
    {
      "value": 66,
      "name": 66
    },
    {
      "value": 10,
      "name": 10
    },
    {
      "value": 15,
      "name": 15
    },
    {
      "value": 30,
      "name": 30
    }
  ]
}

Example usage

{
  "type": "select",
  "id": "devicesPaginationItemsPerPage",
  "dataKeyName": "staticPaginationData",
  "valueKeyName": "value",
  "labelKeyName": "name",
  "default": 15,
  "onSelect": [
    {
      "type": "javascript",
      "javascript": [
        "appGlobalState.devicesPaginationCurrentPage = 1"
      ]
    },
    {
      "type": "reload",
      "component": "devicesTable"
    },
    {
      "type": "reload",
      "component": "devicesPagination"
    }
  ],
  "onInit": [
    {
      "type": "static-data",
      "id": "static-data-page-size",
      "dataKeyName": "staticPaginationData",
      "data": [
        {
          "value": 5,
          "name": 5
        },
        {
          "value": 10,
          "name": 10
        },
        {
          "value": 15,
          "name": 15
        },
        {
          "value": 30,
          "name": 30
        }
      ]
    }
  ]
}