Skip to content

Commit 471d219

Browse files
committed
Merge branch 'master' into gh-pages
2 parents 7ce6ef7 + a36b6d5 commit 471d219

File tree

5 files changed

+339
-375
lines changed

5 files changed

+339
-375
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
.DS_Store
12
.idea

README.md

Lines changed: 27 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# bridge-tableau
1+
# Tableau integration for Pryv - Proof of Concept
22

3-
Tableau Web data connector ([WDC](http://tableau.github.io/webdataconnector/docs/)) implementation for Pryv.IO.
3+
Tableau Web data connector ([WDC](http://tableau.github.io/webdataconnector/docs/)) implementation for Pryv.io.
44

55
The connector uses WDC Version 2.2 and targets Tableau 10.0 and later.
66

@@ -14,30 +14,24 @@ _NOTE: Tableau refers either to [Tableau Desktop](https://www.tableau.com/produc
1414

1515
2. A new window opens, paste the following URL and press _Enter_ :
1616

17-
> https://pryv.github.io/bridge-tableau/
17+
> https://pryv.github.io/poc-integration-tableau/
1818
1919
![Login](./screenshots/connector.png)
2020

2121
3. _(Optional)_ You can adapt the previous URL in order to pass custom settings:
2222

23-
* If you already have a valid Pryv.IO access (it skips steps 4 and 5) :
23+
If you want to change the Pryv.IO platform (default is _pryv.me_) :
2424

25-
> https://pryv.github.io/bridge-tableau/?username=YOURUSER&auth=YOURTOKEN
26-
27-
* If you want to change the Pryv.IO domain (default is _pryv.me_) :
28-
29-
> https://pryv.github.io/bridge-tableau/?domain=YOURDOMAIN
30-
31-
* Or both :
32-
33-
> https://pryv.github.io/bridge-tableau/?username=YOURUSER&auth=YOURTOKEN&domain=YOURDOMAIN
25+
`https://pryv.github.io/poc-integration-tableau/?pryvServiceInfoUrl=https://reg.{YOURDOMAIN}/service/info`
3426

3527
4. Connect a Pryv.io account, you have two possibilities here :
3628

3729
* Use the **Sign in** button to login to your Pryv.IO account and authorize Tableau to access it.
3830

39-
* Use Pryv.io sharing(s) by pasting the link(s) in the appropriate input field and click on **Use sharings**.
40-
31+
* Use Pryv.io apiEndpoint(s) by pasting the link(s) in the appropriate input field and click on **Use apiEndpoints**.
32+
33+
* You may want to load credentials contained into events of type: `'credentials/pryv-api-endpoint'` from these accounts with "Look for extra crendentials into these accounts"
34+
4135
![Login](./screenshots/login.png)
4236

4337
5. Some selectors (time range, measurements limit) appear, you can use them to filter the data to be retrieved from Pryv.IO, then click on **Get Data**.
@@ -168,55 +162,19 @@ The exact implementation of the retrieval methods will be covered in the Pryv.IO
168162
For Pryv.IO logic, we import our javascript library in the **index.html** :
169163

170164
```html
171-
<script type="text/javascript" src="https://api.pryv.com/lib-javascript/latest/pryv.js"></script>
165+
<script type="text/javascript" src="https://api.pryv.com/lib-js/latest/pryv.js"></script>
172166
```
173167

174168
It gives access to a pryv.io object that will be used for authentication/connection to Pryv.IO as well as for some utility functions.
175169

176-
We also add a login button that will allow the user to authenticate with a Pryv.IO account, as well as a logout button :
170+
We also add a login button that will allow the user to authenticate with a Pryv.IO account, as well as a resetState button :
177171

178172
```html
179173
<!-- It does not look like a button yet, onclick event will be affected to it later. -->
180174
<span id="pryv-button"></span>
181-
<button id="pryv-logout">Logout</button>
175+
<button id="pryv-resetState">resetState</button>
182176
```
183177

184-
#### Initialization
185-
186-
In a first step, we configure some settings for Pryv.IO authentication (see [Authorize your app in API reference](http://api.pryv.com/getting-started/javascript/#authorize-your-app)):
187-
188-
* **Domain** corresponding to the Pryv.IO platform on which the user is registered.
189-
* **Id** of the application (connector).
190-
* Array of **Permissions** to be granted to the connector, where each **Permission** indicates:
191-
* **streamId**: an ids array of Pryv streams that we want to access from Tableau.
192-
* **level**: the access level we will grant (read/manage/contribute).
193-
* A set of **callbacks** that will be called during the authentication process (see [Pryv.IO authentication](#authentication)).
194-
195-
Finally, the utility function `getSettingsFromURL` loads custom parameters that the user may provide in the connector URL to further configure the Pryv.IO authentication (see [Usage](#usage), step 3).
196-
197-
#### Authentication
198-
199-
As soon as the Tableau connector opens, it will start the Pryv.IO authentication flow by calling `pryvAuthSetup`. Two situations can be observed:
200-
201-
* If the user provided an existing Pryv.IO access through the connector URL or use a sharing link (see [Usage](#usage), step 3), it will bypass Pryv login.
202-
* Otherwise, it will call `pryv.Auth.setup(authSettings)`, which will activate the Pryv.IO login button and start the authentication flow using the settings prepared previously.
203-
204-
##### Phase 1: needSignin
205-
206-
The first callback that will trigger is **needSignin**, which indicates that the user did not authorize the Tableau connector to access the Pryv account yet. In this phase, we simply reset the authentication state (`resetAuthState`, in case a previous session still exists) and tell Tableau to abort its current phase for custom authentication (`tableau.abortForAuth`).
207-
208-
From there, the connector will just wait until the user logs in with a Pryv.IO account. On sucessful login, the user will be asked to accept the permissions requested by Tableau.
209-
210-
##### Phase 2: signedIn
211-
212-
Once the user accepts, an access will be granted and it will trigger **the signedIn** callback, which receives the newly opened Pryv.IO connection and shows the Pryv.IO logout button.
213-
214-
Finally, connection to Pryv.IO is cached using `getPYConnection` function, which serves in fact three roles:
215-
216-
* If a Pryv.IO connection is already open, it stores the corresponding Pryv.IO credentials as Tableau credentials, so that the session persists during phases and navigation in Tableau.
217-
* If Tableau credentials exists but we lost the connection to Pryv:IO, it opens a new Pryv connection using the same credentials.
218-
* Finally, it returns the current Pryv.IO connection.
219-
220178
#### Data gathering
221179

222180
We implemented three functions that define how Tableau will collect data and fill each table we previously declared during [schema definition](#schema-definition).
@@ -244,6 +202,21 @@ var postFilter = function (event) {
244202

245203
While Pryv.IO Filters will perform the filtering on the API side, the post-filtering are applied by the connector, after the Events have been retrieved from Pryv.
246204

205+
## Dev
206+
207+
To develop and debug the app you may want to use the following scheme
208+
Looks at options [Debugging tableau remotely with Chromium](https://tableau.github.io/webdataconnector/docs/wdc_debugging.html#start-tableau-with-remote-debugging-enabled-macos)
209+
210+
1. use [rec.la](https://www.rec.la) - install in local with `npm install rec.la -g` and run `rec.la ./`
211+
212+
2. From tableau or the simulator open the WebData Connector pane
213+
214+
3. Use `https://l.rec.la:4443` as source link
215+
216+
## Support and warranty
217+
218+
Pryv provides this software for educational and demonstration purposes with no support or warranty.
219+
247220
## License
248221

249222
[Revised BSD license](https://github.com/pryv/documents/blob/master/license-bsd-revised.md)

0 commit comments

Comments
 (0)