fostercommerce/tableauconnect

Craft 的 Tableau 集成插件

安装数: 1,506

依赖项: 0

建议者: 0

安全性: 0

星标: 1

关注者: 1

分支: 0

开放问题: 0

类型:craft-plugin

1.0.0-beta.15 2019-10-23 16:01 UTC

README

Craft 的 Tableau 集成插件

要求

此插件需要 Craft CMS 3.x 和 Tableau 2.x 服务器。

安装

从插件商店安装 ShipStation Connect 或使用 Composer

从插件商店

进入项目的控制面板中的插件商店,搜索“Tableau Connect”。在其模态窗口中点击“安装”按钮。

使用 Composer

打开您的终端(命令行)并运行以下命令

# go to the project directory
cd /path/to/my-project

# tell Composer to load the plugin
composer require fostercommerce/tableauconnect

# tell Craft to install the plugin
./craft install/plugin tableauconnect

使用 Composer 安装后,转到 Craft 控制面板插件设置页面以安装和配置插件设置。

配置

Tableau 服务器 URL

这是您的 Tableau 安装 URL,例如:https://tableau.my-org.com

需要授权

如果您需要访问需要用户授权的视图,请启用此设置。

注意: 这使用 Tableau 的“受信任”方案,需要将您的 Web 服务器 IP 地址添加到 Tableau 服务器的受信任地址列表中。请参阅添加受信任 IP 地址

模板使用

渲染可视化

参数

view

要渲染的视图。

{{ craft.tableauconnect.renderVisualization('Workbook/SomeView', {...}) }}

options

支持 Tableau JS API 所支持的所有选项Tableau JS API

onFirstInteractiveonFirstVizSizeKnown 应作为字符串传递给 Tableau Connect。

有关功能回调参数的详细信息,请参阅onFirstInteractiveonFirstVizSizeKnown 事件类。

requiresAuthorization

覆盖此特定视图的系统级授权配置

{{ craft.tableauconnect.renderVisualization('Your/View', {...}, false) }}

示例

{{craft.tableauconnect.renderVisualization('Your/View', {
  hideTabs: true,
  hideToolbar: true,
  width: '600px',
  height: '480px',
  onFirstInteractive: 'myCustomOnFirstInteractive',
  onFirstVizSizeKnown: 'myCustomOnFirstVizSizeKnown',
})}}

{% js %}
/**
 * args: {
 *   key: Key applied to visualization container
 *   container: Element visualization is loaded into
 * }
 */
function myCustomOnFirstInteractive(e, args) {
  // Do something...
}

/**
 * args: {
 *   key: Key applied to visualization container
 *   container: Element visualization is loaded into
 * }
 */
function myCustomOnFirstVizSizeKnown(e, args) {
  // Do something
}
{% endjs %}

Tableau 授权检查

如果启用“需要授权”设置,您可以检查已登录用户是否获得 Tableau 授权查看可视化。如果禁用此设置,则始终返回 true

{% if craft.tableauconnect.token %}
  <!-- Render visualization -->
{% else %}
  Not authorized to view visualization
{% endif %}

嵌入可视化

<iframe
  src="{{craft.tableauconnect.embedUrl('Your/View')}}"
>
</iframe>