Skip to content

Commit ab7d2ee

Browse files
committed
Adding missing files
1 parent efc6946 commit ab7d2ee

File tree

165 files changed

+59090
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+59090
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Dependency directories
2+
Examples/
3+
node_modules/
4+
_site/
5+
node_modules/
6+
npm-debug.log
7+
package-lock.json

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
gem 'github-pages', group: :jekyll_plugins
3+
4+

Gemfile.lock

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
activesupport (4.2.9)
5+
i18n (~> 0.7)
6+
minitest (~> 5.1)
7+
thread_safe (~> 0.3, >= 0.3.4)
8+
tzinfo (~> 1.1)
9+
addressable (2.4.0)
10+
coffee-script (2.4.1)
11+
coffee-script-source
12+
execjs
13+
coffee-script-source (1.11.1)
14+
colorator (0.1)
15+
ethon (0.10.1)
16+
ffi (>= 1.3.0)
17+
execjs (2.7.0)
18+
faraday (0.9.2)
19+
multipart-post (>= 1.2, < 3)
20+
ffi (1.9.18)
21+
gemoji (2.1.0)
22+
github-pages (80)
23+
github-pages-health-check (= 1.1.0)
24+
jekyll (= 3.1.6)
25+
jekyll-coffeescript (= 1.0.1)
26+
jekyll-feed (= 0.5.1)
27+
jekyll-gist (= 1.4.0)
28+
jekyll-github-metadata (= 1.11.1)
29+
jekyll-mentions (= 1.1.2)
30+
jekyll-paginate (= 1.1.0)
31+
jekyll-redirect-from (= 0.10.0)
32+
jekyll-sass-converter (= 1.3.0)
33+
jekyll-seo-tag (= 1.4.0)
34+
jekyll-sitemap (= 0.10.0)
35+
jemoji (= 0.6.2)
36+
kramdown (= 1.10.0)
37+
liquid (= 3.0.6)
38+
listen (= 3.0.6)
39+
mercenary (~> 0.3)
40+
rouge (= 1.10.1)
41+
terminal-table (~> 1.4)
42+
github-pages-health-check (1.1.0)
43+
addressable (~> 2.3)
44+
net-dns (~> 0.8)
45+
octokit (~> 4.0)
46+
public_suffix (~> 1.4)
47+
typhoeus (~> 0.7)
48+
html-pipeline (2.4.1)
49+
activesupport (>= 2, < 5)
50+
nokogiri (>= 1.4)
51+
i18n (0.8.6)
52+
jekyll (3.1.6)
53+
colorator (~> 0.1)
54+
jekyll-sass-converter (~> 1.0)
55+
jekyll-watch (~> 1.1)
56+
kramdown (~> 1.3)
57+
liquid (~> 3.0)
58+
mercenary (~> 0.3.3)
59+
rouge (~> 1.7)
60+
safe_yaml (~> 1.0)
61+
jekyll-coffeescript (1.0.1)
62+
coffee-script (~> 2.2)
63+
jekyll-feed (0.5.1)
64+
jekyll-gist (1.4.0)
65+
octokit (~> 4.2)
66+
jekyll-github-metadata (1.11.1)
67+
octokit (~> 4.0)
68+
jekyll-mentions (1.1.2)
69+
html-pipeline (~> 2.3)
70+
jekyll (~> 3.0)
71+
jekyll-paginate (1.1.0)
72+
jekyll-redirect-from (0.10.0)
73+
jekyll (>= 2.0)
74+
jekyll-sass-converter (1.3.0)
75+
sass (~> 3.2)
76+
jekyll-seo-tag (1.4.0)
77+
jekyll (~> 3.0)
78+
jekyll-sitemap (0.10.0)
79+
jekyll-watch (1.4.0)
80+
listen (~> 3.0, < 3.1)
81+
jemoji (0.6.2)
82+
gemoji (~> 2.0)
83+
html-pipeline (~> 2.2)
84+
jekyll (>= 3.0)
85+
kramdown (1.10.0)
86+
liquid (3.0.6)
87+
listen (3.0.6)
88+
rb-fsevent (>= 0.9.3)
89+
rb-inotify (>= 0.9.7)
90+
mercenary (0.3.6)
91+
mini_portile2 (2.0.0)
92+
minitest (5.10.3)
93+
multipart-post (2.0.0)
94+
net-dns (0.8.0)
95+
nokogiri (1.6.7.2)
96+
mini_portile2 (~> 2.0.0.rc2)
97+
octokit (4.3.0)
98+
sawyer (~> 0.7.0, >= 0.5.3)
99+
public_suffix (1.5.3)
100+
rb-fsevent (0.10.2)
101+
rb-inotify (0.9.10)
102+
ffi (>= 0.5.0, < 2)
103+
rouge (1.10.1)
104+
safe_yaml (1.0.4)
105+
sass (3.4.22)
106+
sawyer (0.7.0)
107+
addressable (>= 2.3.5, < 2.5)
108+
faraday (~> 0.8, < 0.10)
109+
terminal-table (1.8.0)
110+
unicode-display_width (~> 1.1, >= 1.1.1)
111+
thread_safe (0.3.6)
112+
typhoeus (0.8.0)
113+
ethon (>= 0.8.0)
114+
tzinfo (1.2.3)
115+
thread_safe (~> 0.1)
116+
unicode-display_width (1.3.0)
117+
118+
PLATFORMS
119+
ruby
120+
121+
DEPENDENCIES
122+
github-pages
123+
124+
BUNDLED WITH
125+
1.12.5

Samples/DataSources/DataSources.trex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest manifest-version="0.1" xmlns="http://wwww.tableau.com/xml/extension_manifest">
3+
<dashboard-extension id="com.tableau.extensions.samples.datasources" extension-version="0.6.0">
4+
<default-locale>en_US</default-locale>
5+
<name resource-id="name"/>
6+
<description>DataSources Sample</description>
7+
<author name="tableau" email="[email protected]" organization="tableau" website="www.tableau.com"/>
8+
<min-api-version>1.1</min-api-version>
9+
<source-location>
10+
<url>http://localhost:8765/Samples/DataSources/datasources.html</url>
11+
</source-location>
12+
<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>
13+
</dashboard-extension>
14+
<resources>
15+
<resource id="name">
16+
<text locale="en_US">DataSources Sample</text>
17+
</resource>
18+
</resources>
19+
</manifest>

Samples/DataSources/datasources.html

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<title>Datasources Sample</title>
9+
10+
<!-- jQuery -->
11+
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
12+
13+
<!-- Bootstrap -->
14+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
15+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>
16+
17+
<!-- Extensions Library (this will be hosted on a CDN eventually) -->
18+
<script src="../../lib/tableau-extensions-0.7.0.js"></script>
19+
20+
<!-- Our extension's code -->
21+
<script src="./dataSources.js"></script>
22+
</head>
23+
<body>
24+
<div class="container">
25+
<!-- DataSources Table -->
26+
<div id="dataSources">
27+
<h4>All DataSources</h4>
28+
<div class="table-responsive">
29+
<table id="loading" class="table">
30+
<tbody><tr><td>Loading...</td></tr></tbody>
31+
</table>
32+
<table id="dataSourcesTable" class="table table-striped hidden">
33+
<thead>
34+
<tr>
35+
<th>DataSource Name</th>
36+
<th>Auto Refresh</th>
37+
<th style="width: 100%">Info</th>
38+
</tr>
39+
</thead>
40+
<tbody>
41+
</tbody>
42+
</table>
43+
</div>
44+
</div>
45+
46+
<!-- More dataSource info modal -->
47+
<div class="modal fade" id="infoModal" role="dialog">
48+
<div class="modal-dialog">
49+
<!-- Modal content-->
50+
<div class="modal-content">
51+
<div class="modal-header">
52+
<button type="button" class="close" data-dismiss="modal">&times;</button>
53+
<h4 class="modal-title">DataSource Details</h4>
54+
</div>
55+
<div id="dataSourceDetails" class="modal-body">
56+
<div class="table-responsive">
57+
<table id="detailsTable" class="table">
58+
<tbody>
59+
<tr>
60+
<td>DataSource Name</td>
61+
<td id="nameDetail"></td>
62+
</tr>
63+
<tr>
64+
<td>DataSource Id</td>
65+
<td id="idDetail"></td>
66+
</tr>
67+
<tr>
68+
<td>Type</td>
69+
<td id="typeDetail"></td>
70+
</tr>
71+
<tr>
72+
<td>Fields</td>
73+
<td id="fieldsDetail"></td>
74+
</tr>
75+
<tr>
76+
<td>Connections</td>
77+
<td id="connectionsDetail"></td>
78+
</tr>
79+
<tr>
80+
<td>Active Tables</td>
81+
<td id="activeTablesDetail"></td>
82+
</tr>
83+
</tbody>
84+
</table>
85+
</div>
86+
<div class="modal-footer">
87+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
88+
</div>
89+
</div>
90+
</div>
91+
</div>
92+
93+
</div>
94+
</div>
95+
</div>
96+
</body>
97+
</html>

Samples/DataSources/datasources.js

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
'use strict';
2+
3+
// Wrap everything in an anonymous function to avoid polluting the global namespace
4+
(function () {
5+
$(document).ready(function () {
6+
tableau.extensions.initializeAsync().then(function () {
7+
// Since dataSource info is attached to the worksheet, we will perform
8+
// one async call per worksheet to get every dataSource used in this
9+
// dashboard. This demonstrates the use of Promise.all to combine
10+
// promises together and wait for each of them to resolve.
11+
let dataSourceFetchPromises = [];
12+
13+
// Maps dataSource id to dataSource so we can keep track of unique dataSources.
14+
let dashboardDataSources = {};
15+
16+
// To get dataSource info, first get the dashboard.
17+
const dashboard = tableau.extensions.dashboardContent.dashboard;
18+
19+
// Then loop through each worksheet and get its dataSources, save promise for later.
20+
dashboard.worksheets.forEach(function (worksheet) {
21+
dataSourceFetchPromises.push(worksheet.getDataSourcesAsync());
22+
});
23+
24+
Promise.all(dataSourceFetchPromises).then(function (fetchResults) {
25+
fetchResults.forEach(function (dataSourcesForWorksheet) {
26+
dataSourcesForWorksheet.forEach(function (dataSource) {
27+
if (!dashboardDataSources[dataSource.id]) { // We've already seen it, skip it.
28+
dashboardDataSources[dataSource.id] = dataSource;
29+
}
30+
});
31+
});
32+
33+
buildDataSourcesTable(dashboardDataSources);
34+
35+
// This just modifies the UI by removing the loading banner and showing the dataSources table.
36+
$('#loading').addClass('hidden');
37+
$('#dataSourcesTable').removeClass('hidden').addClass('show');
38+
});
39+
}, function (err) {
40+
// Something went wrong in initialization.
41+
console.log('Error while Initializing: ' + err.toString());
42+
});
43+
});
44+
45+
// Refreshes the given dataSource.
46+
function refreshDataSource (dataSource) {
47+
dataSource.refreshAsync().then(function () {
48+
console.log(dataSource.name + ': Refreshed Successfully');
49+
});
50+
}
51+
52+
// Displays a modal dialog with more details about the given dataSource.
53+
function showModal (dataSource) {
54+
var modal = $('#infoModal');
55+
56+
$('#nameDetail').text(dataSource.name);
57+
$('#idDetail').text(dataSource.id);
58+
$('#typeDetail').text((dataSource.isExtract) ? 'Extract' : 'Live');
59+
60+
// Loop through every field in the dataSource and concat it to a string.
61+
var fieldNamesStr = '';
62+
dataSource.fields.forEach(function (field) {
63+
fieldNamesStr += field.name + ', ';
64+
});
65+
66+
// Slice off the last ", " for formatting.
67+
$('#fieldsDetail').text(fieldNamesStr.slice(0, -2));
68+
69+
dataSource.getConnectionSummariesAsync().then(function (connectionSummaries) {
70+
// Loop through each connection summary and list the connection's
71+
// name and type in the info field
72+
var connectionsStr = '';
73+
connectionSummaries.forEach(function (summary) {
74+
connectionsStr += summary.name + ': ' + summary.type + ', ';
75+
});
76+
77+
// Slice of the last ", " for formatting.
78+
$('#connectionsDetail').text(connectionsStr.slice(0, -2));
79+
});
80+
81+
dataSource.getActiveTablesAsync().then(function (activeTables) {
82+
// Loop through each table that was used in creating this datasource
83+
var tableStr = '';
84+
activeTables.forEach(function (table) {
85+
tableStr += table.name + ', ';
86+
});
87+
88+
// Slice of the last ", " for formatting.
89+
$('#activeTablesDetail').text(tableStr.slice(0, -2));
90+
});
91+
92+
modal.modal('show');
93+
}
94+
95+
// Constructs UI that displays all the dataSources in this dashboard
96+
// given a mapping from dataSourceId to dataSource objects.
97+
function buildDataSourcesTable (dataSources) {
98+
// Clear the table first.
99+
$('#dataSourcesTable > tbody tr').remove();
100+
const dataSourcesTable = $('#dataSourcesTable > tbody')[0];
101+
102+
// Add an entry to the dataSources table for each dataSource.
103+
for (let dataSourceId in dataSources) {
104+
const dataSource = dataSources[dataSourceId];
105+
106+
let newRow = dataSourcesTable.insertRow(dataSourcesTable.rows.length);
107+
let nameCell = newRow.insertCell(0);
108+
let refreshCell = newRow.insertCell(1);
109+
let infoCell = newRow.insertCell(2);
110+
111+
let refreshButton = document.createElement('button');
112+
refreshButton.innerHTML = ('Refresh Now');
113+
refreshButton.type = 'button';
114+
refreshButton.className = 'btn btn-primary';
115+
refreshButton.addEventListener('click', function () { refreshDataSource(dataSource); });
116+
117+
let infoSpan = document.createElement('span');
118+
infoSpan.className = 'glyphicon glyphicon-info-sign';
119+
infoSpan.addEventListener('click', function () { showModal(dataSource); });
120+
121+
nameCell.innerHTML = dataSource.name;
122+
refreshCell.appendChild(refreshButton);
123+
infoCell.appendChild(infoSpan);
124+
}
125+
}
126+
})();

0 commit comments

Comments
 (0)