From c9b2121d61a75380ddb32b6cfcebd034e07451cd Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 18 Oct 2018 10:45:36 -0300 Subject: [PATCH 1/3] - Adds extended dev info to README.md --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c9d92c3..e4c256a 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,53 @@ To use, do the following: - Set `EPHEMERAL_CLIENT_ID` and `ENDURING_CLIENT_ID` environment variables with the `CLIENT_ID` provided by Spotify app - Set `EPHEMERAL_CLIENT_SECRET` and `ENDURING_CLIENT_SECRET` environment variables with the `CLIENT_SECRET` provided by Spotify app - Make sure the server settings ( on the `./auth_proxy` section ) are correct for your needs. -- Make sure the `output` section of the webpack.config file are correct for your needs. ( see https://webpack.js.org/configuration/output/#output-publicpath ) \ No newline at end of file +- Make sure the `output` section of the webpack.config file are correct for your needs. ( see https://webpack.js.org/configuration/output/#output-publicpath ) + +## Suggested GIT client for intermediate users +[Atlassian SourceTree](https://www.sourcetreeapp.com/) + +## Original Tableau WDC development tools and documentation +Part of this references are included on the repository source code son you can make a code/documentation relationship. In order to run this WDC on the simulator you'll need to follow the SDK and simulator instructions. Once you get confident with the connector's code and documentation, I'd strongly suggest you to dive into the API documentation to acquire a deeper knowledge. +Here some usefull links to get started :P +- [Get Started](http://tableau.github.io/webdataconnector/docs/) +- [SDK / simulator](http://tableau.github.io/webdataconnector/docs/#get-the-wdc-sdk) +- [Run the simulator](http://tableau.github.io/webdataconnector/docs/#run-the-simulator) +- [API reference](http://tableau.github.io/webdataconnector/docs/api_ref) + +## Using Get-Content and Select-String powershell cmdlet to read logs on WIndows +Tableau WDC API for logging will output `TableauShim.log('log content')` as follow: + +- Running connector on the **simulator** will output the content on the **log div** and on the **console dev tool** +- Running on **Tableau desktop** will write the output on `appPath\My Tableau Repository\Logs\tabprotosrv.txt` + +Since Tableau Desktop embedded browser during dataGathering phase runs on a headless instance we need a `tail` Unix like command to debug in real time when running the connector. + +On Windows >= 7 we can use **get-content** cmdlet running on our powershell. +Below there's an example on debugging the `tabprotosrv.txt` filtering for a specific custom pattern. + +Chunk of code with the log instruction + +```javascript + + //log the column names array + TableauShim.log('DEV-LOG names for headersCallback: ' + JSON.stringify(headers.names)); + + //log the column types array + TableauShim.log('DEV-LOG types for headersCallback: ' + JSON.stringify(headers.types)); + + +``` + +Command line on the powershell to read tabprotosrv.txt and filter for *DEV-LOG* pattern + +``` + + PS C:\Users\[my user]\Documents\My Tableau Repository\Logs> Get-Content tabprotosrv.txt -Wait | Select-String DEV-LOG + + +``` + +For more details + +- [Get-Content Cmdlet](https://technet.microsoft.com/en-us/library/hh849787.aspx) +- [Select-String Cmdlet](https://technet.microsoft.com/en-us/library/ee176956.aspx) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 10f2990..1e43752 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "advanced_wdc_step_by_step", - "version": "1.6.1", + "version": "1.7.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 656ded1..77e571a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Javier Valderrama", "name": "advanced_wdc_step_by_step", "description": "Spotify Web Data Connector for Tableau", - "version": "1.6.1", + "version": "1.7.0", "dependencies": { "jquery": "~3.1.0", "q": "~1.5.1" From 03e338b16e51f5650cf1325aaeb1c295ed86c15f Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 18 Oct 2018 10:49:03 -0300 Subject: [PATCH 2/3] - reorder documentation order for better readability --- README.md | 56 +++++++++++++++++++++++++++++++++++++++-------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e4c256a..ba744d9 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,6 @@ To use, do the following: ## Suggested GIT client for intermediate users [Atlassian SourceTree](https://www.sourcetreeapp.com/) -## Original Tableau WDC development tools and documentation -Part of this references are included on the repository source code son you can make a code/documentation relationship. In order to run this WDC on the simulator you'll need to follow the SDK and simulator instructions. Once you get confident with the connector's code and documentation, I'd strongly suggest you to dive into the API documentation to acquire a deeper knowledge. -Here some usefull links to get started :P -- [Get Started](http://tableau.github.io/webdataconnector/docs/) -- [SDK / simulator](http://tableau.github.io/webdataconnector/docs/#get-the-wdc-sdk) -- [Run the simulator](http://tableau.github.io/webdataconnector/docs/#run-the-simulator) -- [API reference](http://tableau.github.io/webdataconnector/docs/api_ref) - ## Using Get-Content and Select-String powershell cmdlet to read logs on WIndows Tableau WDC API for logging will output `TableauShim.log('log content')` as follow: @@ -68,4 +60,50 @@ Command line on the powershell to read tabprotosrv.txt and filter for *DEV-LOG* For more details - [Get-Content Cmdlet](https://technet.microsoft.com/en-us/library/hh849787.aspx) -- [Select-String Cmdlet](https://technet.microsoft.com/en-us/library/ee176956.aspx) \ No newline at end of file +- [Select-String Cmdlet](https://technet.microsoft.com/en-us/library/ee176956.aspx) + +## What if I use this code to build my own connector? +That's the point of all of this!!! Please do it! Any feedback will be welcome. + +Just take this in consideration: + +### CORS +Despite the Tableau Desktop embedded browser implementation, all browsers will apply a security policy regarding [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) and [Same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy), therefore, depending on the API you're consuming, you'll have to workaround that, a developer should be able to test a connector on the Simulator +without the interference of a browser level security blocking access to an API that doesn't support CORS. +In order to achieve that, here you have a hack to disable the Same-Origin security restriction on Chrome. + +### Example for Windows +1. Create a directory where Chrome will save all the session information +1. Create a shortcut with the following target "`[PATH TO CHROME APP]\chrome.exe" --user-data-dir=[PATH TO THE DIRECTORY CREATED ON STEP 1] --disable-web-security` +1. Upon execution Chrome will prompt an alert message, just ignore it. + +``` + + /** + * Create a directory on the C drive. + * e.g. c:\my-session-staff + * + * Then create a shortcut with the following target + */ + + "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=c:\my-session-staff --disable-web-security + +``` + +### Example for Mac +On the terminal type the following: + +``` +/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="/tmp/chrome_dev_session" --disable-web-security +``` + +Replace with your particular path to chrome if necessary. + + +## Official Tableau WDC development tools and documentation +Part of this references are included on the repository source code so you can make a code/documentation relationship. In order to run this WDC on the simulator you'll need to follow the SDK and simulator instructions. Once you get confident with the connector's code and documentation, I'd strongly suggest you to dive into the API documentation to acquire a deeper knowledge. +Here some usefull links to get started :P +- [Get Started](http://tableau.github.io/webdataconnector/docs/) +- [SDK / simulator](http://tableau.github.io/webdataconnector/docs/#get-the-wdc-sdk) +- [Run the simulator](http://tableau.github.io/webdataconnector/docs/#run-the-simulator) +- [API reference](http://tableau.github.io/webdataconnector/docs/api_ref) diff --git a/package-lock.json b/package-lock.json index 1e43752..12d5584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "advanced_wdc_step_by_step", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 77e571a..6334b51 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Javier Valderrama", "name": "advanced_wdc_step_by_step", "description": "Spotify Web Data Connector for Tableau", - "version": "1.7.0", + "version": "1.7.1", "dependencies": { "jquery": "~3.1.0", "q": "~1.5.1" From debb376649021946b8ebc6837a81d51b21b21bf7 Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 18 Oct 2018 11:10:50 -0300 Subject: [PATCH 3/3] - adds "run on simulator" tip --- README.md | 3 +++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba744d9..a2d354f 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,15 @@ To use, do the following: - Create an app on spotify developer platform: https://developer.spotify.com/my-applications/#!/applications + + ## Local development: - Create a .env files from .env.TEMPLATE - Set `EPHEMERAL_CLIENT_ID` and `ENDURING_CLIENT_ID` with the `CLIENT_ID` provided by Spotify app - Set `EPHEMERAL_CLIENT_SECRET` and `ENDURING_CLIENT_SECRET` with the `CLIENT_SECRET` provided by Spotify app - run `npm start` to make a build and start the local server - For more script options check the package.json scripts section +- to run this on the simulator ( see simulator instructions on this file ), start the simulator and type http://localhost:8888/simulator/?src=http://localhost:3000/ on your browser ## Publishing to a server diff --git a/package-lock.json b/package-lock.json index 12d5584..c3777a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "advanced_wdc_step_by_step", - "version": "1.7.1", + "version": "1.7.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6334b51..8f72075 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Javier Valderrama", "name": "advanced_wdc_step_by_step", "description": "Spotify Web Data Connector for Tableau", - "version": "1.7.1", + "version": "1.7.2", "dependencies": { "jquery": "~3.1.0", "q": "~1.5.1"