Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ website/build
website/.docusaurus
website/.cache-loader

# Working/scratch files for in-progress docs
website/docs/workspaceext/working/

# Misc
**/.DS_Store
.env.local
Expand Down
6 changes: 4 additions & 2 deletions website/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Tableau Extensions API

The Tableau Extensions API allows developers to create dashboard extensions and viz extensions for Tableau. Tableau extensions are web applications that can interact and communicate with Tableau. A dashboard extension can be placed in the dashboard like any other dashboard object. A Tableau viz extension creates new viz types that Tableau users can access through the worksheet Marks card.
The Tableau Extensions API allows developers to create dashboard extensions, viz extensions, and workspace extensions for Tableau. Tableau extensions are web applications that can interact and communicate with Tableau. A dashboard extension can be placed in the dashboard like any other dashboard object. A Tableau viz extension creates new viz types that Tableau users can access through the worksheet Marks card. A workspace extension runs at the workspace level and stays available as you open, close, and switch between workbooks.

:::note

If you are looking for information about how to extend Tableau calculations to include popular data science programming languages and external tools, see the [Tableau Analytics Extensions API](https://tableau.github.io/analytics-extensions-api/).

:::

The Tableau Extensions API is a JavaScript library that is organized into namespaces that contain the classes and methods for communicating with Tableau components. The Tableau Extensions API library supports both dashboard extensions and viz extensions, although not all interfaces and methods apply to both extensions. For an overview of how the API is organized, see [Tableau Extensions API Basics](./trex_api_about.md).
The Tableau Extensions API is a JavaScript library that is organized into namespaces that contain the classes and methods for communicating with Tableau components. The Tableau Extensions API library supports dashboard extensions, viz extensions, and workspace extensions, although not all interfaces and methods apply to every extension type. For an overview of how the API is organized, see [Tableau Extensions API Basics](./trex_api_about.md).

Details on the supported platforms and hardware requirements can be found in the [Installation instructions](installation.md).

Expand All @@ -19,3 +19,5 @@ Details on the supported platforms and hardware requirements can be found in the
* [Get Started with Viz Extensions](./vizext/trex_viz_getstarted.md)

* [Get Started with Dashboard Extensions](./dashext/trex_getstarted.md)

* [Get Started with Workspace Extensions](./workspaceext/trex_workspace_getstarted.md)
8 changes: 8 additions & 0 deletions website/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ For viz extensions:
* Tableau Server 2024.1 and later
* Tableau Cloud

For workspace extensions:

:::warning[TODO: REVIEW]
<mark>Add the Tableau version requirements for workspace extensions (Tableau Desktop, Server, and Cloud).</mark>

Flagged because: supported environments and minimum versions for workspace extensions are release information and are not yet confirmed.
:::



### Security requirements
Expand Down
37 changes: 37 additions & 0 deletions website/docs/trex_api_about.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The Tableau Extensions API is organized by namespaces. The type of extension you
| ----- | ------- |
| Dashboard extensions | For example, if you create and register a dashboard extension, the extension will have access to the `dashboardContent` namespace, which provides access to the dashboard object. When you have the dashboard object, you have access to all elements in the dashboard, including the worksheets, marks, filters, parameters, and data sources. |
| Viz extensions | If you create and register a viz extension, the extension will have access to the `worksheetContent` namespace, which provides access to the worksheet object. When you have the worksheet object, you have access to all elements in the worksheet, including the marks, filters, parameters, and data sources.|
| Workspace extensions | If you create and register a workspace extension, the extension runs at the workspace level rather than inside a single workbook. It can access information about the currently active workbook (which can be empty when no workbook is open) and is notified when the active workbook changes. |

## Navigating the top-level `tableau` and `extensions` namespaces

Expand All @@ -19,6 +20,14 @@ The `extensions` namespace is the namespace for Tableau extensions. A dashboard

A viz extension is another type of extension. When a extension is registered as a viz extension, it has access to the `worksheetContent` namespace, and all of the objects and classes of the worksheet. A viz extension does not have access to the `dashboardContent`.

A workspace extension is another type of extension. A workspace extension runs at the workspace level instead of inside a single workbook, so it is not bound to a specific dashboard or worksheet. It can access information about the currently active workbook and is notified when the active workbook changes.

:::warning[TODO: REVIEW]
<mark>Confirm the namespace a workspace extension uses to access workspace and workbook content (for example, <code>tableau.extensions.workspace</code>).</mark>

Flagged because: the source material is inconsistent about the workspace namespace name and notes it may not be finalized. The canonical namespace needs to be confirmed.
:::

The type of extension you have registered determines what namespaces will be available. Some namespaces, like the `settings`, `environment`, and `ui` are available to all extensions.

The `extensions` namespace has one method `initializeAsync()` that is used to initialize the extension. When this method is called, it also triggers Tableau to configure the Extensions API. Like the Tableau JavaScript API, the Extensions API follows the [CommonJS Promises/A standard](http://wiki.commonjs.org/wiki/Promises/A) for asynchronous method calls.
Expand All @@ -33,6 +42,7 @@ classDiagram
class extensions
class dashboardContent
class worksheetContent
class workspace
class environment
class settings
class ui
Expand All @@ -41,13 +51,20 @@ classDiagram
class extensions
extensions ..> dashboardContent
extensions ..> worksheetContent
extensions ..> workspace
extensions ..> environment
extensions ..> settings
extensions ..> ui
extensions: initializeAsync()

```

:::warning[TODO: REVIEW]
<mark>Confirm the workspace namespace name shown in the diagram above (currently <code>workspace</code>).</mark>

Flagged because: the source material is inconsistent about the workspace namespace name. Update the diagram once the canonical name is confirmed.
:::

## Registering and accessing dashboard extensions

The dashboard extension is one type of extension in the Tableau extensions namespace (and it is accessed using `tableau.extensions`). To register the extension, you declare the type of extension in the manifest file (`.trex`). For more information about what goes in the file, see [Tableau Manifest File](./dashext/trex_manifest.md).
Expand Down Expand Up @@ -101,6 +118,24 @@ window.onload = tableau.extensions.initializeAsync().then(async () => {

```

## Registering and accessing workspace extensions

The workspace extension is another type of extension in the Tableau extensions namespace (and it is accessed using `tableau.extensions`). To register the workspace extension, you specify the extension as a `workspace-extension` in the manifest file (`.trex`). For more information about what goes in the file, see [Tableau Workspace Extension Manifest File](./workspaceext/trex_workspace_manifest.md).

```xml

<workspace-extension id="com.example.extensions.name" extension-version="0.1.0">

```

Unlike dashboard and viz extensions, a workspace extension runs at the workspace level and is not bound to a single workbook. After it is initialized, it has access to the namespaces that are common to all extensions, such as `tableau.extensions.environment` and `tableau.extensions.settings`. It can also access information about the currently active workbook, which can be empty when no workbook is open, and is notified when the active workbook changes.

:::warning[TODO: REVIEW]
<mark>Confirm the workspace extension initialization call and the namespace used to access workspace and workbook content.</mark>

Flagged because: the source material shows initialization with a `context: 'workspace'` option and is inconsistent about the workspace namespace name, and notes both may not be finalized. These need to be confirmed before adding a code sample here.
:::

## Using properties and methods in the `dashboard` and `worksheet` namespace

The Tableau Extensions API is similar to the Tableau Embedding API. The `dashboard` and `worksheet` class or namespace inherit from an abstract `sheet` class. You can use the [Extensions API Reference](pathname:///api/) to find the properties and methods that are available for dashboard and worksheet objects.
Expand All @@ -126,6 +161,7 @@ classDiagram
class extensions
class dashboardContent
class worksheetContent
class workspace
class worksheet
class dashboard
class environment
Expand All @@ -137,6 +173,7 @@ classDiagram
class extensions
extensions ..> dashboardContent
extensions ..> worksheetContent
extensions ..> workspace
extensions ..> environment
extensions ..> settings
extensions ..> ui
Expand Down
7 changes: 7 additions & 0 deletions website/docs/workspaceext/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Workspace Extensions

```mdx-code-block
import DocCardList from '@theme/DocCardList';

<DocCardList />
```
97 changes: 97 additions & 0 deletions website/docs/workspaceext/trex_workspace_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: Create a "Hello World" Workspace Extension
description: Build a simple workspace extension
---

This walkthrough shows the basic shape of a workspace extension: an HTML page that loads the Tableau Extensions API library, initializes as a workspace extension, and reads information about the active workbook.

## The web page

Like other Tableau extensions, a workspace extension is a web page that links to the Tableau Extensions API library.

```html
<!DOCTYPE html>
<html>
<head>
<!-- Tableau Extensions API library -->
<script src="https://tableau.github.io/extensions-api/lib/tableau.extensions.1.latest.js"></script>
<script src="workspace-extension.js"></script>
Comment on lines +16 to +18
</head>
<body>
<h1>Workspace Extension Example</h1>
<div id="status">Initializing...</div>
<div id="workbook-info"></div>
</body>
</html>
```

## Initialize the extension

A workspace extension initializes through the same `initializeAsync()` entry point used by other extensions, identifying itself as a workspace extension.

```javascript
(async () => {
await tableau.extensions.initializeAsync({ context: 'workspace' });
document.getElementById('status').textContent = 'Ready!';
})();
```

:::warning[TODO: REVIEW]
<mark>Confirm how a workspace extension is initialized, including the exact <code>initializeAsync()</code> argument (for example, <code>{'{'} context: 'workspace' {'}'}</code>) and whether any argument is required.</mark>

Flagged because: the source material shows initialization with a `context: 'workspace'` option, but it also notes this entry point is still being finalized. The exact call signature needs to be confirmed.
:::

## Access the active workbook

After initialization, a workspace extension can read information about the currently active workbook. Because a workspace extension is not tied to a single workbook, the current workbook can be `null` when no workbook is open.

```javascript
const workspace = tableau.extensions.workspace;

const updateWorkbookInfo = () => {
const workbook = workspace.getWorkbook();
const infoDiv = document.getElementById('workbook-info');

if (workbook) {
infoDiv.textContent = `Current workbook: ${workbook.name}`;
} else {
infoDiv.textContent = 'No workbook open';
}
};

updateWorkbookInfo();
```

:::warning[TODO: REVIEW]
<mark>Confirm the workspace namespace name (for example, <code>tableau.extensions.workspace</code> versus <code>tableau.workspace</code>) and the members it exposes.</mark>

Flagged because: the source material is inconsistent about the namespace name and notes that the namespace may not be finalized. The canonical namespace and its API surface need to be confirmed.
:::

## Respond to workbook changes

A workspace extension can listen for changes to the active workbook so it can update as the user opens, closes, or switches workbooks.

```javascript
workspace.addEventListener('workbook-opened', (event) => {
console.log('Opened:', event.workbook.name);
updateWorkbookInfo();
});

workspace.addEventListener('workbook-closed', () => {
console.log('Workbook closed');
updateWorkbookInfo();
});

workspace.addEventListener('workbook-switched', (event) => {
console.log('Switched to:', event.workbook.name);
updateWorkbookInfo();
});
```

:::warning[TODO: REVIEW]
<mark>Confirm the workbook lifecycle event names and their event payloads.</mark>

Flagged because: the source material uses two different naming styles for these events (for example, <code>workbook-opened</code> versus <code>workbookOpened</code>). The canonical event names and payload shapes need to be confirmed.
:::
18 changes: 18 additions & 0 deletions website/docs/workspaceext/trex_workspace_examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Workspace Extension Examples
description: Examples of workspace extensions
---

Workspace extensions are well suited to tools and utilities that need to stay available throughout a Tableau session, independent of any single workbook. The following are illustrative scenarios:

* A utility that displays information about the active workbook and updates as you switch workbooks.

* A persistent tool that tracks workbook activity across a session by responding to workbook opened, closed, and switched events.

For a minimal, end-to-end starting point, see [Create a "Hello World" Workspace Extension](./trex_workspace_create.md).

:::warning[TODO: REVIEW]
<mark>Add concrete, runnable workspace extension samples and links once they are available.</mark>

Flagged because: a public sample set for workspace extensions is not yet available, so this page currently describes scenarios rather than linking to working samples.
:::
44 changes: 44 additions & 0 deletions website/docs/workspaceext/trex_workspace_getstarted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: Get Started with Workspace Extensions
description: Get started with Workspace Extensions
tags: [Getting started]
---

The Tableau Extensions API allows developers to create workspace extensions, web applications that run at the workspace level of Tableau and stay available as you open, close, and switch between workbooks.

This section takes you through setting up your environment and adding a workspace extension so you can start developing your own.

:::info

**What's in a Tableau extension?**
A Tableau extension consists of an XML manifest file (`.trex`), a web page (`.html`) that uses a Tableau-provided JavaScript library, and the JavaScript file (`.js`) (or files) that contain your extension logic.

:::

### What you need to get started

If you want to create an extension or work with sample code, make sure you have followed the instructions for [installation](../installation.md).

:::warning[TODO: REVIEW]
<mark>Confirm the Tableau version requirements for workspace extensions.</mark>

Flagged because: minimum supported versions for Tableau Desktop, Server, and Cloud are release information and are not yet confirmed.
:::

### Add a workspace extension

Every Tableau extension has a manifest file (`.trex`) that describes the extension and identifies the location of the web application. To use a workspace extension, you register it for your Tableau environment and then open it when you want to use it. Once registered, a workspace extension remains available across workbooks.

:::warning[TODO: REVIEW]
<mark>Confirm the exact steps and Tableau UI entry points for registering and opening a workspace extension, and how the running extension is presented.</mark>

Flagged because: the available source material describes adding the extension and opening it from a menu, but the specific UI navigation and the way the extension is surfaced are not yet confirmed for public documentation, and depend on the open UI-model question (see the overview).
:::

## What's next?

* For information about creating a simple workspace extension, see [Create a "Hello World" Workspace Extension](./trex_workspace_create.md).

* For details on the workspace extension manifest, see [Tableau Workspace Extension Manifest File](./trex_workspace_manifest.md).

* To get familiar with the programming interface for the Extensions API, see the [API Reference](pathname:///api/).
54 changes: 54 additions & 0 deletions website/docs/workspaceext/trex_workspace_manifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Tableau Workspace Extension Manifest File
description: Components of the workspace extension manifest file
---

The extension manifest file (`.trex`) contains metadata for the extension and is used for registration. A workspace extension uses the same manifest format as dashboard and viz extensions, but declares the extension with the `<workspace-extension>` element.

## Registering a workspace extension

To register an extension as a workspace extension, you specify the `<workspace-extension>` element in the manifest file (`.trex`).

```xml
<workspace-extension id="com.example.extensions.name" extension-version="0.1.0">
```

Unlike dashboard and viz extensions, a workspace extension is not placed inside a dashboard zone or a worksheet, so its manifest does not include layout or encoding information.

:::warning[TODO: REVIEW]
<mark>Confirm the manifest wrapper element and manifest version for workspace extensions.</mark>

Flagged because: the existing dashboard and viz manifests use a `<manifest manifest-version="0.1">` root wrapper, while the workspace source material shows an `<extension-manifest manifest-version="1.0">` wrapper. The correct wrapper element and version value need to be confirmed before publishing.
:::

## Sample manifest file

```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest manifest-version="0.1" xmlns="http://www.tableau.com/xml/extension_manifest">
<workspace-extension id="com.example.extensions.name" extension-version="0.1.0">
<default-locale>en_US</default-locale>
<name resource-id="name"/>
<description>Extension Description</description>
<author name="USERNAME" email="USER@example.com" organization="My Company" website="https://www.example.com"/>
<min-api-version>1.0</min-api-version>
<source-location>
<url>SCHEME://SERVER[:PORT][/PATH]</url>
</source-location>
<icon>Base64-Encoded ICON</icon>
</workspace-extension>
<resources>
<resource id="name">
<text locale="en_US">name in English</text>
</resource>
</resources>
</manifest>
```

The manifest fields shared with other extension types (such as `id`, `extension-version`, `name`, `description`, `author`, `source-location`, `icon`, and `min-api-version`) behave the same way as they do for dashboard extensions. For details on these shared elements, see the [Tableau Extension Manifest File](../dashext/trex_manifest.md) reference for dashboard extensions.

:::warning[TODO: REVIEW]
<mark>Confirm whether workspace extensions support any manifest elements that dashboard and viz extensions do not, or omit any that the others use.</mark>

Flagged because: only the core shared elements are confirmed from the source material; any workspace-specific manifest elements still need to be verified.
:::
Loading
Loading