-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efc6946
commit ab7d2ee
Showing
165 changed files
with
59,090 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Dependency directories | ||
Examples/ | ||
node_modules/ | ||
_site/ | ||
node_modules/ | ||
npm-debug.log | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'https://rubygems.org' | ||
gem 'github-pages', group: :jekyll_plugins | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
activesupport (4.2.9) | ||
i18n (~> 0.7) | ||
minitest (~> 5.1) | ||
thread_safe (~> 0.3, >= 0.3.4) | ||
tzinfo (~> 1.1) | ||
addressable (2.4.0) | ||
coffee-script (2.4.1) | ||
coffee-script-source | ||
execjs | ||
coffee-script-source (1.11.1) | ||
colorator (0.1) | ||
ethon (0.10.1) | ||
ffi (>= 1.3.0) | ||
execjs (2.7.0) | ||
faraday (0.9.2) | ||
multipart-post (>= 1.2, < 3) | ||
ffi (1.9.18) | ||
gemoji (2.1.0) | ||
github-pages (80) | ||
github-pages-health-check (= 1.1.0) | ||
jekyll (= 3.1.6) | ||
jekyll-coffeescript (= 1.0.1) | ||
jekyll-feed (= 0.5.1) | ||
jekyll-gist (= 1.4.0) | ||
jekyll-github-metadata (= 1.11.1) | ||
jekyll-mentions (= 1.1.2) | ||
jekyll-paginate (= 1.1.0) | ||
jekyll-redirect-from (= 0.10.0) | ||
jekyll-sass-converter (= 1.3.0) | ||
jekyll-seo-tag (= 1.4.0) | ||
jekyll-sitemap (= 0.10.0) | ||
jemoji (= 0.6.2) | ||
kramdown (= 1.10.0) | ||
liquid (= 3.0.6) | ||
listen (= 3.0.6) | ||
mercenary (~> 0.3) | ||
rouge (= 1.10.1) | ||
terminal-table (~> 1.4) | ||
github-pages-health-check (1.1.0) | ||
addressable (~> 2.3) | ||
net-dns (~> 0.8) | ||
octokit (~> 4.0) | ||
public_suffix (~> 1.4) | ||
typhoeus (~> 0.7) | ||
html-pipeline (2.4.1) | ||
activesupport (>= 2, < 5) | ||
nokogiri (>= 1.4) | ||
i18n (0.8.6) | ||
jekyll (3.1.6) | ||
colorator (~> 0.1) | ||
jekyll-sass-converter (~> 1.0) | ||
jekyll-watch (~> 1.1) | ||
kramdown (~> 1.3) | ||
liquid (~> 3.0) | ||
mercenary (~> 0.3.3) | ||
rouge (~> 1.7) | ||
safe_yaml (~> 1.0) | ||
jekyll-coffeescript (1.0.1) | ||
coffee-script (~> 2.2) | ||
jekyll-feed (0.5.1) | ||
jekyll-gist (1.4.0) | ||
octokit (~> 4.2) | ||
jekyll-github-metadata (1.11.1) | ||
octokit (~> 4.0) | ||
jekyll-mentions (1.1.2) | ||
html-pipeline (~> 2.3) | ||
jekyll (~> 3.0) | ||
jekyll-paginate (1.1.0) | ||
jekyll-redirect-from (0.10.0) | ||
jekyll (>= 2.0) | ||
jekyll-sass-converter (1.3.0) | ||
sass (~> 3.2) | ||
jekyll-seo-tag (1.4.0) | ||
jekyll (~> 3.0) | ||
jekyll-sitemap (0.10.0) | ||
jekyll-watch (1.4.0) | ||
listen (~> 3.0, < 3.1) | ||
jemoji (0.6.2) | ||
gemoji (~> 2.0) | ||
html-pipeline (~> 2.2) | ||
jekyll (>= 3.0) | ||
kramdown (1.10.0) | ||
liquid (3.0.6) | ||
listen (3.0.6) | ||
rb-fsevent (>= 0.9.3) | ||
rb-inotify (>= 0.9.7) | ||
mercenary (0.3.6) | ||
mini_portile2 (2.0.0) | ||
minitest (5.10.3) | ||
multipart-post (2.0.0) | ||
net-dns (0.8.0) | ||
nokogiri (1.6.7.2) | ||
mini_portile2 (~> 2.0.0.rc2) | ||
octokit (4.3.0) | ||
sawyer (~> 0.7.0, >= 0.5.3) | ||
public_suffix (1.5.3) | ||
rb-fsevent (0.10.2) | ||
rb-inotify (0.9.10) | ||
ffi (>= 0.5.0, < 2) | ||
rouge (1.10.1) | ||
safe_yaml (1.0.4) | ||
sass (3.4.22) | ||
sawyer (0.7.0) | ||
addressable (>= 2.3.5, < 2.5) | ||
faraday (~> 0.8, < 0.10) | ||
terminal-table (1.8.0) | ||
unicode-display_width (~> 1.1, >= 1.1.1) | ||
thread_safe (0.3.6) | ||
typhoeus (0.8.0) | ||
ethon (>= 0.8.0) | ||
tzinfo (1.2.3) | ||
thread_safe (~> 0.1) | ||
unicode-display_width (1.3.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
github-pages | ||
|
||
BUNDLED WITH | ||
1.12.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest manifest-version="0.1" xmlns="http://wwww.tableau.com/xml/extension_manifest"> | ||
<dashboard-extension id="com.tableau.extensions.samples.datasources" extension-version="0.6.0"> | ||
<default-locale>en_US</default-locale> | ||
<name resource-id="name"/> | ||
<description>DataSources Sample</description> | ||
<author name="tableau" email="[email protected]" organization="tableau" website="www.tableau.com"/> | ||
<min-api-version>1.1</min-api-version> | ||
<source-location> | ||
<url>http://localhost:8765/Samples/DataSources/datasources.html</url> | ||
</source-location> | ||
<icon>iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAlhJREFUOI2Nkt9vy1EYh5/3bbsvRSySCZbIxI+ZCKsN2TKtSFyIrV2WuRCJuBiJWxfuxCVXbvwFgiEtposgLFJElnbU1SxIZIIRJDKTrdu+53Uhra4mce7Oe57Pcz7JOULFisViwZ+29LAzOSjQYDgz1ZcCvWuXV11MJpN+OS/lm6179teqH0yDqxPTCyKSA8DcDsyOmOprnCaeP7459pdgy969i0LTC3IO/RQMyoHcQN+3cnljW3dNIFC47qDaK3g7BwdTkwBaBELT4ZPOUVWgKl4ZBnjxJPUlMDnTDrp0pmr6RHFeEjjcUUXPDGeSEwDN0Xg8sivxMhJNjGzbHd8PkM3eHRfkrBM5NkcQaY2vUnTlrDIA0NoaX+KLXFFlowr14tvVpqb2MICzmQcKqxvbumv+NAhZGCCIPwEw6QWXKYRL/VUXO0+rAUJiPwAk5MIlgVfwPjjHLCL1APmHN94ZdqeYN+NW/mn6I4BvwQYchcLnwFhJMDiYmlRxAzjpKWZkYkUCcZ2I61wi37tLbYyjiN0fHk5Oz3nGSLSzBbNHCF35R7f6K1/hN9PRhek11FrymfQQQKB4+Gl05P2qNRtmETlXW7e+b2z01dfycGNbfFMAbqNyKp9Jp4rzOT8RYFs0njJkc2iqsCObvTsOsDWWqA5C1uFy+Uz/oXJeKwVT4h0RmPUXhi79vuC0Ku6yOffTK3g9lfxfDQAisY516sg5kfOCiJk7HoLt2cf9b/9LANAc7dznm98PagG1fUOZ9IP5uMB8Q4CPoyNvausapkTt3rNMuvdf3C/o6+czhtdwmwAAAABJRU5ErkJggg==</icon> | ||
</dashboard-extension> | ||
<resources> | ||
<resource id="name"> | ||
<text locale="en_US">DataSources Sample</text> | ||
</resource> | ||
</resources> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Datasources Sample</title> | ||
|
||
<!-- jQuery --> | ||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> | ||
|
||
<!-- Bootstrap --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" > | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script> | ||
|
||
<!-- Extensions Library (this will be hosted on a CDN eventually) --> | ||
<script src="../../lib/tableau-extensions-0.7.0.js"></script> | ||
|
||
<!-- Our extension's code --> | ||
<script src="./dataSources.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<!-- DataSources Table --> | ||
<div id="dataSources"> | ||
<h4>All DataSources</h4> | ||
<div class="table-responsive"> | ||
<table id="loading" class="table"> | ||
<tbody><tr><td>Loading...</td></tr></tbody> | ||
</table> | ||
<table id="dataSourcesTable" class="table table-striped hidden"> | ||
<thead> | ||
<tr> | ||
<th>DataSource Name</th> | ||
<th>Auto Refresh</th> | ||
<th style="width: 100%">Info</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<!-- More dataSource info modal --> | ||
<div class="modal fade" id="infoModal" role="dialog"> | ||
<div class="modal-dialog"> | ||
<!-- Modal content--> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal">×</button> | ||
<h4 class="modal-title">DataSource Details</h4> | ||
</div> | ||
<div id="dataSourceDetails" class="modal-body"> | ||
<div class="table-responsive"> | ||
<table id="detailsTable" class="table"> | ||
<tbody> | ||
<tr> | ||
<td>DataSource Name</td> | ||
<td id="nameDetail"></td> | ||
</tr> | ||
<tr> | ||
<td>DataSource Id</td> | ||
<td id="idDetail"></td> | ||
</tr> | ||
<tr> | ||
<td>Type</td> | ||
<td id="typeDetail"></td> | ||
</tr> | ||
<tr> | ||
<td>Fields</td> | ||
<td id="fieldsDetail"></td> | ||
</tr> | ||
<tr> | ||
<td>Connections</td> | ||
<td id="connectionsDetail"></td> | ||
</tr> | ||
<tr> | ||
<td>Active Tables</td> | ||
<td id="activeTablesDetail"></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
'use strict'; | ||
|
||
// Wrap everything in an anonymous function to avoid polluting the global namespace | ||
(function () { | ||
$(document).ready(function () { | ||
tableau.extensions.initializeAsync().then(function () { | ||
// Since dataSource info is attached to the worksheet, we will perform | ||
// one async call per worksheet to get every dataSource used in this | ||
// dashboard. This demonstrates the use of Promise.all to combine | ||
// promises together and wait for each of them to resolve. | ||
let dataSourceFetchPromises = []; | ||
|
||
// Maps dataSource id to dataSource so we can keep track of unique dataSources. | ||
let dashboardDataSources = {}; | ||
|
||
// To get dataSource info, first get the dashboard. | ||
const dashboard = tableau.extensions.dashboardContent.dashboard; | ||
|
||
// Then loop through each worksheet and get its dataSources, save promise for later. | ||
dashboard.worksheets.forEach(function (worksheet) { | ||
dataSourceFetchPromises.push(worksheet.getDataSourcesAsync()); | ||
}); | ||
|
||
Promise.all(dataSourceFetchPromises).then(function (fetchResults) { | ||
fetchResults.forEach(function (dataSourcesForWorksheet) { | ||
dataSourcesForWorksheet.forEach(function (dataSource) { | ||
if (!dashboardDataSources[dataSource.id]) { // We've already seen it, skip it. | ||
dashboardDataSources[dataSource.id] = dataSource; | ||
} | ||
}); | ||
}); | ||
|
||
buildDataSourcesTable(dashboardDataSources); | ||
|
||
// This just modifies the UI by removing the loading banner and showing the dataSources table. | ||
$('#loading').addClass('hidden'); | ||
$('#dataSourcesTable').removeClass('hidden').addClass('show'); | ||
}); | ||
}, function (err) { | ||
// Something went wrong in initialization. | ||
console.log('Error while Initializing: ' + err.toString()); | ||
}); | ||
}); | ||
|
||
// Refreshes the given dataSource. | ||
function refreshDataSource (dataSource) { | ||
dataSource.refreshAsync().then(function () { | ||
console.log(dataSource.name + ': Refreshed Successfully'); | ||
}); | ||
} | ||
|
||
// Displays a modal dialog with more details about the given dataSource. | ||
function showModal (dataSource) { | ||
var modal = $('#infoModal'); | ||
|
||
$('#nameDetail').text(dataSource.name); | ||
$('#idDetail').text(dataSource.id); | ||
$('#typeDetail').text((dataSource.isExtract) ? 'Extract' : 'Live'); | ||
|
||
// Loop through every field in the dataSource and concat it to a string. | ||
var fieldNamesStr = ''; | ||
dataSource.fields.forEach(function (field) { | ||
fieldNamesStr += field.name + ', '; | ||
}); | ||
|
||
// Slice off the last ", " for formatting. | ||
$('#fieldsDetail').text(fieldNamesStr.slice(0, -2)); | ||
|
||
dataSource.getConnectionSummariesAsync().then(function (connectionSummaries) { | ||
// Loop through each connection summary and list the connection's | ||
// name and type in the info field | ||
var connectionsStr = ''; | ||
connectionSummaries.forEach(function (summary) { | ||
connectionsStr += summary.name + ': ' + summary.type + ', '; | ||
}); | ||
|
||
// Slice of the last ", " for formatting. | ||
$('#connectionsDetail').text(connectionsStr.slice(0, -2)); | ||
}); | ||
|
||
dataSource.getActiveTablesAsync().then(function (activeTables) { | ||
// Loop through each table that was used in creating this datasource | ||
var tableStr = ''; | ||
activeTables.forEach(function (table) { | ||
tableStr += table.name + ', '; | ||
}); | ||
|
||
// Slice of the last ", " for formatting. | ||
$('#activeTablesDetail').text(tableStr.slice(0, -2)); | ||
}); | ||
|
||
modal.modal('show'); | ||
} | ||
|
||
// Constructs UI that displays all the dataSources in this dashboard | ||
// given a mapping from dataSourceId to dataSource objects. | ||
function buildDataSourcesTable (dataSources) { | ||
// Clear the table first. | ||
$('#dataSourcesTable > tbody tr').remove(); | ||
const dataSourcesTable = $('#dataSourcesTable > tbody')[0]; | ||
|
||
// Add an entry to the dataSources table for each dataSource. | ||
for (let dataSourceId in dataSources) { | ||
const dataSource = dataSources[dataSourceId]; | ||
|
||
let newRow = dataSourcesTable.insertRow(dataSourcesTable.rows.length); | ||
let nameCell = newRow.insertCell(0); | ||
let refreshCell = newRow.insertCell(1); | ||
let infoCell = newRow.insertCell(2); | ||
|
||
let refreshButton = document.createElement('button'); | ||
refreshButton.innerHTML = ('Refresh Now'); | ||
refreshButton.type = 'button'; | ||
refreshButton.className = 'btn btn-primary'; | ||
refreshButton.addEventListener('click', function () { refreshDataSource(dataSource); }); | ||
|
||
let infoSpan = document.createElement('span'); | ||
infoSpan.className = 'glyphicon glyphicon-info-sign'; | ||
infoSpan.addEventListener('click', function () { showModal(dataSource); }); | ||
|
||
nameCell.innerHTML = dataSource.name; | ||
refreshCell.appendChild(refreshButton); | ||
infoCell.appendChild(infoSpan); | ||
} | ||
} | ||
})(); |
Oops, something went wrong.