6. UI Toolbars

  • Toolbars are a collection of buttons or icons that represent specific actions or features. These buttons are dynamically generated based on the context and available applications.

6.1. When are we going to need toolbars?

  • When we have a function that we would like to execute from a button rendered in the platform

  • When we have a panel (UI Application) that we would like to open from a button rendered in the platform

6.2. The current available toolbar locations in the platform

  • datasetsDashboard - Currently available in both the Datasets and Project Overview pages. assets/apps/toolbars/img.pngimg.png

  • datasetBrowser - Not available for regular users yet assets/apps/toolbars/img_1.pngimg_1.png

  • datasetMenu - Currently available in the dataset menu in both the Datasets and Project Overview pages. assets/apps/toolbars/img_2.pngimg_2.png

  • taskMenu - Available in the task menu in the Tasks page. assets/apps/toolbars/img_3.pngimg_3.png

  • itemMenu - Available in the right-click item menu in the Dataset Browser. assets/apps/toolbars/img_4.pngimg_4.png

  • projectActions - Available in the Project Actions menu in the Project Overview page. assets/apps/toolbars/img_5.pngimg_5.png

6.3. Toolbar Structure in a DPK/App entity

interface Toolbar {
    displayName: string  // The text that will be rendered in the button - for example: 'Click me!'
    conditions?: {  // DQL filter options
        resources: [
            {
                entityType: string  // Dataloop Entity to run the DQL on - dataset, task, project, etc.
                filter?: Dictionary  // DQL filter
            }
        ]
    }
    invoke: {
        type: 'panel' | 'function'
        namespace: string  // serviceName.moduleName.functionName || panelName
        inputOptions?: Dictionary  // Additional inputs - { key: value }
    }
    location?:  // when not mentioned - shows up everywhere!
        'datasetsDashboard' |
        'datasetBrowser' |
        'datasetMenu' |
        'taskMenu' |
        'itemMenu' |
        'projectActions'
    icon?: string  // the icon that will be rendered in the button - for example: 'icon-dl-add'
}
  • Possible icons: https://dataloop-ai.github.io/icons/

6.4. Toolbar Examples in a DPK/App entity

{
  "toolbars": [
    {
      "displayName": "Open Panel",  // toolbar display name
      "invoke": {  // invoke options
        "type": "panel",
        "namespace": "myPanel"  // name of the panel
      },
      "icon": "icon-dl-add",
      "location": "datasetsDashboard",  // slot location
      "conditions": {  // DQL filter options
        "resources": []
      }
    },
    {
      "displayName": "Run Function", // toolbar display name
      "invoke": {  // invoke options
        "type": "function",
        "namespace": "moduleName.functionName"
      },
      "icon": "icon-dl-edit",
      "location": "datasetMenu",  // slot location
      "conditions": {  // DQL filter options
        "resources": [
          {
            "entityType": "dataset",
            "filter": {
              "$and": [
                {
                  "metadata": {
                    "myField": "helloWorld"
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}