magopian / laboite-web

A web version of laboite.cc
0 stars 1 forks source link

Experiment with client-side requests #14

Open magopian opened 6 years ago

magopian commented 6 years ago

Instead of going through the "nuage" (backend server) to make the requests to the various services, experiment requesting the values straight from the client.

The slides (tiles) and items (values displayed on a part of a slide/tile) could be stored in kinto.

Brain dump:

magopian commented 6 years ago

First attempt at a JSON schema:

{
  "type": "object",
  "title": "a slide (aka tile)",
  "required": [
    "display_time",
    "items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "title": "a slide/tile",
        "required": [
          "type",
          "x",
          "y"
        ],
        "properties": {
          "x": {
            "type": "integer",
            "title": "position in 'led pixel' along the x axis"
          },
          "y": {
            "type": "integer",
            "title": "position in 'led pixel' along the y axis"
          },
          "url": {
            "type": "string",
            "title": "url for a json or html request"
          },
          "path": {
            "type": "string",
            "title": "path (keys) to get to a value in a json document"
          },
          "text": {
            "type": "string",
            "title": "text of a text item"
          },
          "type": {
            "enum": [
              "clock",
              "icon",
              "text",
              "json",
              "html"
            ],
            "type": "string",
            "title": "type of item"
          },
          "login": {
            "type": "string",
            "title": "login for a json or html request"
          },
          "content": {
            "type": "string",
            "title": "content of an icon item"
          },
          "password": {
            "type": "string",
            "title": "password for a json or html request"
          },
          "selector": {
            "type": "string",
            "title": "path (selectors) to get to a node in an html document"
          },
          "attribute": {
            "type": "string",
            "title": "attribute of a node to get the value in an html document"
          },
          "cors-proxy": {
            "type": "string",
            "title": "CORS proxy for a json or html request"
          }
        }
      },
      "title": "items that will be composed on a slide/tile"
    },
    "display_time": {
      "type": "integer",
      "title": "display time (in seconds)"
    }
  },
  "description": "Composed of at least one item, will be displayed as a slide/tile"
}

And UI schema:

{
  "items": {
    "items": {
      "ui:order": [
        "type",
        "x",
        "y",
        "content",
        "text",
        "url",
        "login",
        "password",
        "cors-proxy",
        "path",
        "selector",
        "attribute"
      ]
    }
  },
  "ui:order": [
    "display_time",
    "items"
  ]
}