diff --git a/assets/data_source.gif b/assets/data_source.gif index d59c10a6..dc7807a1 100644 Binary files a/assets/data_source.gif and b/assets/data_source.gif differ diff --git a/assets/frelard_objects_extension.png b/assets/frelard_objects_extension.png index bcc056ad..3986862c 100644 Binary files a/assets/frelard_objects_extension.png and b/assets/frelard_objects_extension.png differ diff --git a/docs/trex_debugging.md b/docs/trex_debugging.md index 3551b879..f016a0a1 100644 --- a/docs/trex_debugging.md +++ b/docs/trex_debugging.md @@ -14,16 +14,21 @@ A dashboard extension embeds a web page and runs a Chromium-based browser inside ## Set up Tableau for debugging (Windows) -1. Start Tableau and drag an extension onto the dashboard. -2. Select the extension in the dashboard. -3. Click the **More Options** button in the upper-left or upper-right corner of the extension. Click **Debug Options** > **Enable Debugging**. -4. After enabling debugging, select **Debug Options** > **Reload** to reinitialize the browser. You might need to stop and restart Tableau for the settings to take effect. -![Enable and reload]({{site.baseurl}}/assets/TcNTYA9566.gif) +If you are using Tableau Desktop on Windows, you need to open a Command Prompt window and run a command to start Tableau with debugging enabled. +1. Open a Command Prompt window. +2. Start Tableau using the following command: + +``` +"C:\Program Files\Tableau\Tableau\bin\tableau.exe" --remote-debugging-port=8696 +``` + +This command enables remote debugging for all extensions. -After you've done these steps, debugging will be enabled for all extensions until you turn it off. +For convenience, you could also create a shortcut for Tableau and add the remote debugging option to Properties dialog box. Select Tableau from the **Start** menu, and then right-click and select **Properties** or select **Open file location**. If you open the file location, you can create a new shortcut to `Tableau.exe` (call it something like *Tableau - Debug* ). Open the Properties for the new shortcut and append `-remote-debugging-port=8696` at the end of the command in the **Target** text box. The debugging option goes after the closing quotation mark for `"Tableau.exe"`. +![Debug Shortcut]({{site.baseurl}}/assets/Tableau_shortcut_debug.png){:height="40%" width="40%"} ## Set up Tableau for debugging (macOS) @@ -62,11 +67,16 @@ It can be difficult to hit breakpoints which occur during the loading of your pa 4. To attach to the browser instance, click the first item listed (it will be completely blank, but it is really there. The cursor changes so you can select it). 4. Click the **Sources** tab in Chromium, under **Event Listener Breakpoints**, click **Script** and enable the **Script First Statement** breakpoint. 5. Back in Tableau, click the extension zone to load your page. -6. The debugger will pause each time the first statement of a script runs allowing you to debug the startup process +6. The debugger will pause each time the first statement of a script runs allowing you to debug the startup process. ![Startup Debugging]({{site.baseurl}}/assets/foucUWBiUJ.gif) ## Known Issues + +#### Enabling debugging from the Debug Options menu + +Due to changes in the start-up sequence, you can no longer enable remote debugging by selecting **Debugging Enabled** from the **Debug Options** menu in the dashboard. To enable debugging, you must add the `--remote-debugging-port=8696` option to the command used to start Tableau. You can still select the **Pause before Loading** option and set breakpoints to debug initialization and loading issues. + #### Refreshed Page Fails Unfortunately, due to a bug with our embedded browser, refreshing a loaded page doesn't properly setup the communication between Tableau and the extension. This means that trigger a page reload will cause your extension to stop working. It's important to note that the **Reload** menu option actually tears down and re-creates the browser control, which means you'll need to establish a new debugging sessions whenever you click **Reload**. diff --git a/docs/trex_getstarted.md b/docs/trex_getstarted.md index 0dd1a863..d8697876 100644 --- a/docs/trex_getstarted.md +++ b/docs/trex_getstarted.md @@ -83,7 +83,7 @@ To use the dashboard extension samples, you need to start up a web server on you 1. Start Tableau and open a workbook that has a dashboard, or open a workbook and create a new dashboard. 2. In the dashboard, under **Objects**, select **Extension** and drag it on to the dashboard. - ![]({{site.baseurl}}/assets/frelard_objects_extension.png) + ![]({{site.baseurl}}/assets/frelard_objects_extension.png){:height="25%" width="25%"} 3. In the **Select an Extension** dialog box, click **Choose an Extension**. Every Tableau extension has a manifest file (`.trex`) that describes the extension and identifies the location of the web application. @@ -92,7 +92,7 @@ To use the dashboard extension samples, you need to start up a web server on you The sample extension (web application) appears in the dashboard frame. The DataSources sample finds and displays the data source for each worksheet in the dashboard. 6. In the DataSources extension, click the **Info** (**i**) button. This action opens a dialog box that displays more details about the selected data source. - ![]({{site.baseurl}}/assets/data_source.gif) + ![]({{site.baseurl}}/assets/data_source.gif) diff --git a/docs/trex_manifest.md b/docs/trex_manifest.md index 23aa1231..42bd80fb 100644 --- a/docs/trex_manifest.md +++ b/docs/trex_manifest.md @@ -42,6 +42,9 @@ If a workbook is saved with an extension and then later opened on another comput SCHEME://SERVER[:PORT][/PATH] Base64-Encoded ICON + + full data + @@ -114,10 +117,14 @@ The exception is for localhost. In this case, HTTP is allowed. For If specified, the icon is what appears under Extensions on a dashboard sheet. The icon must be a 64x64 pixel PNG file that is Base64 encoded. If you need an encoder, see https://www.base64-image.de/ +permissions +Declares the types of permissions that this extension requires. The only option is full data. If your extension can access the underlying data or information about the data sources, you must declare full data permission in the manifest. Full data permissions are required if you use any one of the following APIs: Worksheet.getUnderlyingDataAsync(), Datasource.getUnderlyingDataAsync(), Datasource.getActiveTablesAsync(), Datasource.getConnectionSummariesAsync(). If your extension does not use one of these APIs, you do not need include permissions element. + + resources Specifies the resources that can be localized. - + min-api-version Specifies the minimum API version required to run the extension. This field is not used in this Developer Preview. Versioning support is still in progress. diff --git a/docs/trex_release-notes.md b/docs/trex_release-notes.md index 87982f4e..b3aacff5 100644 --- a/docs/trex_release-notes.md +++ b/docs/trex_release-notes.md @@ -8,10 +8,101 @@ layout: docs * TOC {:toc} + +--- + +### Developer Preview (0.9.0) +*February 14, 2018* + +- Update of the Tableau Extensions API +- Tableau Extensions API library: `tableau-extensions-0.9.0.js` +- Tableau Desktop, Tableau Server (from [Extensions API Developer Preview](https://prerelease.tableau.com){:target="_blank"}) + +Updates in this release: +- [Updates to the UI namespace](#updates-to-the-ui-namespace) +- [Permissions added to access full data](#permissions-added-to-access-full-data) +- [Error codes for extensions](#error-codes-for-extensions) + + + +#### Updates to the UI namespace + + This preview release introduces more options for the UI namespace. You can now control the initial sizing (height, width) of a modal dialog box (or *popup*). The modal dialog itself is an extension. Using the `displayDialogAsync()` and `closeDialog()` methods you can pass payloads between the calling extension and the extension running in the modal dialog box. For an example of how you can use the UI namespace to create a configuration dialog box, see the [UINamepace](https://github.com/tableau/extensions-api/tree/master/Samples/UINamepace?=target="_blank") sample. The sample also shows how to use the settings event to capture the new configuration. The sample source code has extensive comments that describe how to use these new features in the Extensions API. + +- New sample: [UINamepace](https://github.com/tableau/extensions-api/tree/master/Samples/UINamepace?=target="_blank") + + +#### Permissions added to access full data + +To access the underlying data along with information about the data source, the extension must declare that it requires full data access in the extension manifest file (`.trex`). + + +An extension requires full data access, if the extension uses any of the following four APIs: + +`Worksheet.getUnderlyingDataAsync()` + +`Datasource.getUnderlyingDataAsync()` + +`Datasource.getActiveTablesAsync()` + +`Datasource.getConnectionSummariesAsync()` + + +If you use any of these APIs, you need to add a `` element to the manifest file (`.trex`) and specify full data permission. The XML looks like the following: + +```xml + + + full data + + +``` + +The `` element must be added under `` in the manifest file. For a complete description of the manifest, see the [Tableau Extensions Manifest File]({{site.baseurl}}/docs/trex_manifest.html). + +If full data is not declared in the manifest file, and the extensions calls one of the APIs that accesses any underlying data or data source information, the API call fails. In addition, an error is written to the Tableau log file (`log.txt`). If you are debugging the extension with the Chromium web browser, an error is reported the console pane. The error message would look similar to the following: + +``` +PermissionValidation.ts:26 Extension (name = DataSources Sample, ID = com.tableau.extensions.demo.local) is missing required permission: full-data +Error: internal-error: permission-denied: Missing required permission to run get-underlying-data(...) + +``` + + +#### Error codes for extensions + +Errors that are returned from the Extensions API are custom Tableau Error objects that extends the standard JavaScript error object. + + +The Extensions API wraps the standard error object with an `errorCode` property. Any time you encounter an error when you are developing your extension, you can look at this `errorCode` to determine the cause. See [Error Codes]({{site.baseurl}}/docs/enums/errorcodes.html). + +For an example of how to handle error conditions, see the [UINamepace](https://github.com/tableau/extensions-api/tree/master/Samples/UINamepace?=target="_blank") sample. The sample shows how you could handle the error condition that occurs if a user dismisses a modal dialog box (`DialogClosedByUser`). The following snippet illustrates this pattern: + +```javascript +tableau.extensions.ui.displayDialogAsync(args... ).then((args... ) => { + // + // code that sets up the extension in the modal dialog box + // + }).catch((error) => { + // One expected error condition is when the popup is closed by the user + // (meaning the user clicks the 'X' in the top right of the dialog). + // This can be checked for with: + switch(error.errorCode) { + case tableau.ErrorCodes.DialogClosedByUser: + console.log("Dialog was closed by user"); + break; + default: + console.error(error.message); + } + }); + +``` + --- + ### Developer Preview (0.8.0) -*December 21, 2017* +*January 10, 2017* - Update of the Tableau Extensions API. - Tableau Extensions API library: `tableau-extensions-0.8.0.js`