Adding a Google Drive Data Source
Currently, the Reveal SDK is in the process of decoupling the data sources from the Reveal SDK core package. In order to ensure the project's continued functionality, you might be required to install additional packages into your project. Please see the Supported Data Sources topic for more information.
Step 1 - Add an event handler for the RevealView.onDataSourcesRequested
event.
var revealView = new $.ig.RevealView("#revealView");
revealView.onDataSourcesRequested = (callback) => {
//add code here
callback(new $.ig.RevealDataSources([], [], false));
};
Step 2 - In the RevealView.onDataSourcesRequested
event handler, create a new instance of the RVGoogleDriveDataSource object. Set the Title
and Subtitle
properties to values that correspond to your Google Drive. After you have created the RVGoogleDriveDataSource
object, add it to the data sources collection.
revealView.onDataSourcesRequested = (callback) => {
var googleDrive = new $.ig.RVGoogleDriveDataSource();
googleDrive.title = "My Google Drive";
googleDrive.subtitle = "Google Drive";
callback(new $.ig.RevealDataSources([googleDrive], [], false));
};
When the application runs, create a new Visualization and you will see the newly created Google Drive data source listed in the "Select a Data Source" dialog.
The RVGoogleDriveDataSource
loads folders and files based on the authentication provider registered with the Reveal SDK. Google Drive authenticates using a RVBearerTokenDataSourceCredential
. See the Authentication topic for more information.
The source code to this sample can be found on GitHub