Applets

    Applets are web-based applications that can be used as tools directly in the DataCogs interface, as well as integrated with nodes on the graph. Most visual components in DataCogs are built using applets.

    The most basic type of applet is an HTML file stored directly in the DataCogs file browser. This file can be opened in a panel in the DataCogs interface, but will not have access to the DataCogs API.

    There is a JSON Schema available that describes the structure of module manifest.json files.

    Built-in Applets🔗

    • Graph: A visual representation of a data workflow.
    • File Browser: Navigate and organize files and folders in the DataCogs file system.
    • Text Editor: Edit text files and code in the DataCogs file system. Built on Microsoft's Monaco Editor.
    • Markdown Viwer: View markdown files in the DataCogs file system.

    Structure🔗

    An Applet is, at a minimum, a zip file with a manifest.json file and an html document (typically named index.html). The manifest file contains metadata about the applet.

    In DataCogs, manifest.json files may have comments and trailing commas.

    {
        "Applet": {     // The type of the package this manifest describes
            "V1": {     // The version of the Applet API this manifest conforms to. Currently this should always be "V1"
                "name": "Markdown Reader",
                "version": "1.0",
                "description": "A simple markdown reader",
                "index": "index.html",
                "views": [
                    {
                        "title": "Markdown",
                        "path": "",
                        "types": [
                            {"FileExtension": "md"},
                            {"FileExtension": "markdown"},
                            {"DataType": "text/markdown"}
                        ]
                    }
                ],
                "panelIcon": {
                    "Url": "markdown.svg"
                }
            }
        }
    }
    

    Applets can register themselves to be the default handler for certain file types. When a file is opened in the DataCogs interface, the applet that is registered for that file type will be opened in a panel. Graph nodes can also open applets matching the file type of the data they are processing.

    Applets can include CSS, JavaScript, images, Web Asssembly, and other resources.

    Panel API🔗

    Applets loaded with a Manifest file can access the DataCogs APIs. Since applets are loaded in an iframe, the DataCogs API is exposed to the applet through the window.parent object using postMessage. Messages are received from the DataCogs API using the message event.

    This API is used for things such as managing the panel state, sending and receiving data from the graph, and opening and communicating with other applets.

    Storage API🔗

    DataCogs provides a storage API that allows applets to read and write files in the DataCogs file system. The storage API is available through a SharedWorker.