diff --git a/.eslintignore b/.eslintignore index a6796e04..6e7798f5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ # Task 512388: Fix eslint warnings and errors in tests /node_modules/* -demo/* /**/*.js dist/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index 10454d6f..d8bec088 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ npm-debug.log* dist/powerbi.js.map *.js.map package-lock.json -demo/package-lock.json .vscode owners.txt +test/util.spec.ts +.config/tsaoptions.json \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0b39a81..3e7f6be3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,24 +55,6 @@ node node_modules/karma/bin/karma start --browsers=Firefox --single-run=false -- The build and tests use webpack to compile all the source modules into one bundled module that can execute in the browser. -## Running the demo -Navigate to `/demo` directory - -Install npm dependencies: -``` -npm install -``` - -Serve the demo directory: -``` -npm start -``` - -Open the address to view in the browser: -``` -http://127.0.0.1:8080/ -``` - ## Updating the documentation (For those with push permissions only) First run the command to build the docs and open it to verify the changes are as expected. @@ -80,16 +62,3 @@ First run the command to build the docs and open it to verify the changes are as npm run gulp -- build:docs ``` > There are errors during the TypeDoc compilation step due to some complication with modules however the documentation should still be generated. It's not clear if these are fixable by including more src files in the gulp task or if it's just the nature of TypeDoc lacking capabilities for this project structure. - -If the docs are correct then you may publish them to gh-pages using this command -``` -npm run gulp -- ghpages -``` - -## Known issues -Running demo fails with an error ERR_INVALID_REDIRECT -This happens due to version 10 of http-server. To solve the problem, please install http-server@0.9.0 globally using: - -``` -npm install -g http-server@0.9.0 -``` diff --git a/README.md b/README.md index 4460a688..9fecd37e 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,14 @@ A client side library for embedding Power BI using JavaScript or TypeScript into ## Documentation See the [Power BI embedded analytics Client APIs documentation](https://docs.microsoft.com/javascript/api/overview/powerbi/) to learn how to embed a Power BI report in your application and how to use the client APIs. -## Reference -See the [library reference](https://docs.microsoft.com/en-us/javascript/api/powerbi/powerbi-client/) for detailed information about classes, interfaces, types, etc. +## Code Docs +See the [code docs](https://learn.microsoft.com/en-us/javascript/api/powerbi/powerbi-client) for detailed information about classes, interfaces, types, etc. + +## Sample Application +For examples of applications utilizing the `powerbi-client` library, please refer to the available samples in the [PowerBI-Developer-Samples repository](https://github.com/microsoft/PowerBI-Developer-Samples). ## Playground -The [playground](https://aka.ms/pbieplayground) is the home for Power BI embedded analytics, where you can get hands-on coding experience, embed your own reports, and interact with our client APIs to see instant results. In addition, you’ll find there our interactive showcases to get inspiration regarding how you can apply these features in your applications. Lastly, we’ve created a new learning center to help you find all the relevant samples, tutorials, and documentation you’ll need for a successful integration. +To explore and understand the capabilities of embedded analytics in your applications, please visit the [Power BI Embedded Analytics Playground](https://playground.powerbi.com). ## Installation @@ -55,4 +58,4 @@ This project welcomes contributions and suggestions. Most contributions require When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments \ No newline at end of file diff --git a/demo/LICENSE.txt b/demo/LICENSE.txt deleted file mode 100644 index 736dfd1e..00000000 --- a/demo/LICENSE.txt +++ /dev/null @@ -1,13 +0,0 @@ -Microsoft.PowerBI.JavaScript - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/demo/NOTICE.txt b/demo/NOTICE.txt deleted file mode 100644 index 93917b59..00000000 --- a/demo/NOTICE.txt +++ /dev/null @@ -1,16 +0,0 @@ -Microsoft.PowerBI.JavaScript - -THIRD-PARTY SOFTWARE NOTICES AND INFORMATION -Do Not Translate or Localize - -This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise. - - 1. SyntaxHighlighter (https://github.com/syntaxhighlighter/syntaxhighlighter) - - Copyright (c) 2004-2013, Alex Gorbatchev - - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/demo/app/dataselection.js b/demo/app/dataselection.js deleted file mode 100644 index bd30f240..00000000 --- a/demo/app/dataselection.js +++ /dev/null @@ -1,39 +0,0 @@ -$(function () { - var models = window['powerbi-client'].models; - - console.log('Scenario 7: Data Selection'); - - var reportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad'; - var $reportContainer = $('#reportContainer'); - var report; - var $dataSelectedContainer = $("#dataSelectedContainer"); - - // Init - fetch(reportUrl) - .then(function (response) { - if (response.ok) { - return response.json() - .then(function (embedConfig) { - report = powerbi.embed($reportContainer.get(0), embedConfig); - initializeDataSelection(report, $dataSelectedContainer); - return report; - }); - } - else { - return response.json() - .then(function (error) { - throw new Error(error); - }); - } - }); -}); - -function initializeDataSelection(report, $dataSelectedContainer) { - report.on('dataSelected', function (event) { - console.log('dataSelected: ', event); - - var data = event.detail; - - $dataSelectedContainer.text(JSON.stringify(data, null, ' ')); - }); -} diff --git a/demo/app/defaults.js b/demo/app/defaults.js deleted file mode 100644 index c6ecf136..00000000 --- a/demo/app/defaults.js +++ /dev/null @@ -1,52 +0,0 @@ -$(function () { - var models = window['powerbi-client'].models; - - console.log('Scenario 5: Default Page and/or Filter'); - - var staticReportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad'; - var $defaultPageReportContainer = $('#reportdefaults'); - var defaultPageReport; - var defaultPageName = 'ReportSection2'; - var defaultFilter = new models.AdvancedFilter({ - table: "Store", - column: "Name" - }, "Or", [ - { - operator: "Contains", - value: "Wash" - }, - { - operator: "Contains", - value: "Park" - } - ]); - - var defaultFilters = [defaultFilter]; - - // Init - fetch(staticReportUrl) - .then(function (response) { - if (response.ok) { - return response.json() - .then(function (embedConfig) { - var defaultsEmbedConfig = $.extend({}, embedConfig, { - pageName: defaultPageName, - filter: defaultFilters, - settings: { - filterPaneEnabled: true, - navContentPaneEnabled: true - } - }); - - defaultPageReport = powerbi.embed($defaultPageReportContainer.get(0), defaultsEmbedConfig); - return defaultPageReport; - }); - } - else { - return response.json() - .then(function (error) { - throw new Error(error); - }); - } - }); -}); diff --git a/demo/app/dynamic.js b/demo/app/dynamic.js deleted file mode 100644 index 8812768d..00000000 --- a/demo/app/dynamic.js +++ /dev/null @@ -1,75 +0,0 @@ -$(function () { - var models = window['powerbi-client'].models; - - console.log('Scenario 2: Dynamic Embed'); - - // Declare Variables - var allReportsUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports'; - var $reportsList = $('#reportslist'); - var $resetButton = $('#resetButton'); - var $dynamicReportContainer = $('#reportdynamic'); - - // When report button is clicked embed the report - $reportsList.on('click', 'button', function (event) { - var button = event.target; - var report = $(button).data('report'); - var url = allReportsUrl + '/' + report.id; - - fetch(url) - .then(function (response) { - if (response.ok) { - return response.json() - .then(function (embedConfig) { - return powerbi.embed($dynamicReportContainer.get(0), embedConfig); - }); - } - else { - return response.json() - .then(function (error) { - throw new Error(error); - }); - } - }); - }); - - // When reset button is clicked reset container - $resetButton.on('click', function (event) { - powerbi.reset($dynamicReportContainer.get(0)); - }); - - // Helper function to generate HTML for each report - function generateReportListItem(report) { - var button = $(' - - - - - \ No newline at end of file diff --git a/demo/code-demo/code_area.html b/demo/code-demo/code_area.html deleted file mode 100644 index b4d52067..00000000 --- a/demo/code-demo/code_area.html +++ /dev/null @@ -1,13 +0,0 @@ - -
Code
-
- - -
- -
-
\ No newline at end of file diff --git a/demo/code-demo/docs.html b/demo/code-demo/docs.html deleted file mode 100644 index 96cc05b6..00000000 --- a/demo/code-demo/docs.html +++ /dev/null @@ -1,26 +0,0 @@ -
-
-

Getting Started

-
-
- Please visit our - documentation - to start using Power BI Embedded. -
-
- -

Videos

- -
-
- 1. Learn how to Embed and Interact with Power BI Reports. -
- -
- -
-
- 2. Learn how to Create, Edit and Save Power BI reports in Embedded view. -
- -
diff --git a/demo/code-demo/images/arrow.png b/demo/code-demo/images/arrow.png deleted file mode 100644 index e1acaefe..00000000 Binary files a/demo/code-demo/images/arrow.png and /dev/null differ diff --git a/demo/code-demo/images/arrow_flipped.png b/demo/code-demo/images/arrow_flipped.png deleted file mode 100644 index 76c76eeb..00000000 Binary files a/demo/code-demo/images/arrow_flipped.png and /dev/null differ diff --git a/demo/code-demo/images/clear.png b/demo/code-demo/images/clear.png deleted file mode 100644 index d2d65ca3..00000000 Binary files a/demo/code-demo/images/clear.png and /dev/null differ diff --git a/demo/code-demo/images/copy.png b/demo/code-demo/images/copy.png deleted file mode 100644 index 37d7203f..00000000 Binary files a/demo/code-demo/images/copy.png and /dev/null differ diff --git a/demo/code-demo/images/run.png b/demo/code-demo/images/run.png deleted file mode 100644 index ebd98604..00000000 Binary files a/demo/code-demo/images/run.png and /dev/null differ diff --git a/demo/code-demo/index.html b/demo/code-demo/index.html deleted file mode 100644 index 20f53c13..00000000 --- a/demo/code-demo/index.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
- -
-
-
- -
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - diff --git a/demo/code-demo/log_window.html b/demo/code-demo/log_window.html deleted file mode 100644 index 76e3b643..00000000 --- a/demo/code-demo/log_window.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
Log Viewer
-
- - -
- -
\ No newline at end of file diff --git a/demo/code-demo/report.html b/demo/code-demo/report.html deleted file mode 100644 index dcb527b9..00000000 --- a/demo/code-demo/report.html +++ /dev/null @@ -1,42 +0,0 @@ - -
-
-
-
-
-
-
-
- -
-
-
-
Embedded report
-
-
-
-
-
- - \ No newline at end of file diff --git a/demo/code-demo/sample.html b/demo/code-demo/sample.html deleted file mode 100644 index 9f064e68..00000000 --- a/demo/code-demo/sample.html +++ /dev/null @@ -1,24 +0,0 @@ -
-
- -
-
- -
-
\ No newline at end of file diff --git a/demo/code-demo/scripts/codesamples.js b/demo/code-demo/scripts/codesamples.js deleted file mode 100644 index c340d526..00000000 --- a/demo/code-demo/scripts/codesamples.js +++ /dev/null @@ -1,765 +0,0 @@ -/* - This file contains the code samples which will appear live in the web-page. - Each sample method name starts with _Report_ or _Page or _Embed depends on which section it appears. - Please keep this. -*/ - -// ---- Embed Code ---------------------------------------------------- - -function _Embed_BasicEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // We give All permissions to demonstrate switching between View and Edit mode and saving report. - var permissions = models.Permissions.All; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config= { - type: 'report', - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: true, - navContentPaneEnabled: true - } - }; - - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(reportContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function() { - Log.logText("Loaded"); - }); - - report.on("error", function(event) { - Log.log(event.detail); - - report.off("error"); - }); - - report.off("saved"); - report.on("saved", function(event) { - Log.log(event.detail); - if(event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -function _Mock_Embed_BasicEmbed(isEdit) { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - var permissions = models.Permissions.Copy | models.Permissions.Read; - var viewMode = isEdit ? models.ViewMode.Edit : models.ViewMode.View; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config= { - type: 'report', - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, - viewMode: viewMode, - settings: { - filterPaneEnabled: true, - navContentPaneEnabled: true, - useCustomSaveAsDialog: true - } - }; - - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(reportContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function() { - Log.logText("Loaded"); - }); - - report.on("saveAsTriggered", function() { - Log.logText("Cannot save sample report"); - }); - - report.off("error"); - report.on("error", function(event) { - Log.log(event.detail); - }); - - report.off("saved"); - report.on("saved", function(event) { - Log.log(event.detail); - if(event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -function _Mock_Embed_BasicEmbed_EditMode() { - _Mock_Embed_BasicEmbed(true); -} - -function _Mock_Embed_BasicEmbed_ViewMode() { - _Mock_Embed_BasicEmbed(false); -} - -function _Embed_BasicEmbed_EditMode() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config= { - type: 'report', - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: models.Permissions.All /*gives maximum permissions*/, - viewMode: models.ViewMode.Edit, - settings: { - filterPaneEnabled: true, - navContentPaneEnabled: true - } - }; - - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(reportContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function() { - Log.logText("Loaded"); - }); - - report.off("error"); - report.on("error", function(event) { - Log.log(event.detail); - }); - - report.off("saved"); - report.on("saved", function(event) { - Log.log(event.detail); - if(event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -function _Embed_EmbedWithDefaultFilter() { - var txtAccessToken = $('#txtAccessToken').val(); - var txtEmbedUrl = $('#txtReportEmbed').val(); - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Store", - column: "Chain" - }, - operator: "In", - values: ["Lindseys"] - }; - - var embedConfiguration = { - type: 'report', - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - settings: { - filterPaneEnabled: false, - navContentPaneEnabled: false - }, - filters: [filter] - }; - - var reportContainer = document.getElementById('reportContainer'); - powerbi.embed(reportContainer, embedConfiguration); -} - -function _Embed_Create() { - // Read embed application token from textbox - var txtAccessToken = $('#txtCreateAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtCreateReportEmbed').val(); - - // Read dataset Id from textbox - var txtEmbedDatasetId = $('#txtEmbedDatasetId').val(); - - // Embed create configuration used to describe the what and how to create report. - // This object is used when calling powerbi.createReport. - var embedCreateConfiguration = { - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - datasetId: txtEmbedDatasetId, - }; - - // Grab the reference to the div HTML element that will host the report - var reportContainer = $('#reportContainer')[0]; - - // Create report - var report = powerbi.createReport(reportContainer, embedCreateConfiguration); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function() { - Log.logText("Loaded"); - }); - - report.off("error"); - report.on("error", function(event) { - Log.log(event.detail); - }); - - // report.off removes a given event handler if it exists. - report.off("saved"); - report.on("saved", function(event) { - Log.log(event.detail); - Log.logText('In order to interact with the new report, create a new token and load the new report'); - }); -} - -function _Mock_Embed_Create() { - // Read embed application token from textbox - var txtAccessToken = $('#txtCreateAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtCreateReportEmbed').val(); - - // Read dataset Id from textbox - var txtEmbedDatasetId = $('#txtEmbedDatasetId').val(); - - // Embed create configuration used to describe the what and how to create report. - // This object is used when calling powerbi.createReport. - var embedCreateConfiguration = { - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - datasetId: txtEmbedDatasetId, - settings: { - useCustomSaveAsDialog: true - } - }; - - // Grab the reference to the div HTML element that will host the report - var reportContainer = $('#reportContainer')[0]; - - // Create report - var report = powerbi.createReport(reportContainer, embedCreateConfiguration); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function() { - Log.logText("Loaded"); - }); - report.on("saveAsTriggered", function() { - Log.logText("Cannot save sample report"); - }); - - report.off("error"); - report.on("error", function(event) { - Log.log(event.detail); - }); -} - -// ---- Report Operations ---------------------------------------------------- - -function _Report_GetId() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Retrieve the report id. - var reportId = report.getId(); - - Log.logText(reportId); -} - -function _Report_UpdateSettings() { - // The new settings that you want to apply to the report. - const newSettings = { - navContentPaneEnabled: true, - filterPaneEnabled: false - }; - - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .then(function (result) { - $("#result").html(result); - }) - .catch(function (error) { - $("#result").html(error); - }); -} - -function _Report_GetPages() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Retrieve the page collection and loop through to collect the - // page name and display name of each page and display the value. - report.getPages() - .then(function (pages) { - pages.forEach(function(page) { - var log = page.name + " - " + page.displayName; - Log.logText(log); - }); - }) - .catch(function (error) { - Log.log(error); - }); -} - -function _Report_SetPage() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // setPage will change the selected view to the page you indicate. - // This is the actual page name not the display name. - report.setPage("ReportSection2") - .then(function (result) { - Log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); - - // Report.off removes a given event handler if it exists. - report.off("pageChanged"); - - // Report.on will add an event handler which prints page - // name and display name to Log window. - report.on("pageChanged", function(event) { - var page = event.detail.newPage; - Log.logText(page.name + " - " + page.displayName); - }); -} - -function _Report_GetFilters() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Get the filters applied to the report. - report.getFilters() - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Report_SetFilters() { - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Store", - column: "Chain" - }, - operator: "In", - values: ["Lindseys"] - }; - - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Set the filter for the report. - // Pay attention that setFilters receives an array. - report.setFilters([filter]) - .then(function (result) { - Log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Report_RemoveFilters() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Remove the filters currently applied to the report. - report.removeFilters() - .then(function (result) { - Log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Report_PrintCurrentReport() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Trigger the print dialog for your browser. - report.print() - .then(function (result) { - Log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Report_Reload() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Reload the displayed report - report.reload() - .then(function (result) { - Log.logText("Reloaded"); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Report_Refresh() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Refresh the displayed report - report.refresh() - .then(function (result) { - Log.logText("Refreshed"); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Report_FullScreen() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Displays the report in full screen mode. - report.fullscreen(); -} - -function _Report_ExitFullScreen() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Exits full screen mode. - report.exitFullscreen(); -} - -function _Report_switchModeEdit() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Switch to edit mode. - report.switchMode("edit"); -} - -function _Report_switchModeView() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Switch to view mode. - report.switchMode("view"); -} - -function _Report_save() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Save report - report.save(); -} - -function _Mock_Report_save() { - Log.logText('Cannot save sample report'); -} - -function _Report_saveAs() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - var saveAsParameters = { - name: "newReport" - }; - - // SaveAs report - report.saveAs(saveAsParameters); -} - -// ---- Page Operations ---------------------------------------------------- - -function _Page_SetActive() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Retrieve the page collection, and then set the second page to be active. - report.getPages() - .then(function (pages) { - pages[1].setActive().then(function (result) { - Log.log(result); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Page_GetFilters() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Retrieve the page collection and get the filters for the first page. - report.getPages() - .then(function (pages) { - pages[0].getFilters() - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Page_SetFilters() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Build the filter you want to use. For more information, see Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Store", - column: "Chain" - }, - operator: "In", - values: ["Lindseys"] - }; - - // Retrieve the page collection and then set the filters for the first page. - // Pay attention that setFilters receives an array. - report.getPages() - .then(function (pages) { - pages[0].setFilters([filter]) - .then(function (result) { - Log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -function _Page_RemoveFilters() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Retrieve the page collection and remove the filters for the first page. - report.getPages() - .then(function (pages) { - pages[0].removeFilters() - .then(function (result) { - Log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); -} - -// ---- Event Listener ---------------------------------------------------- - -function _Events_PageChanged() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Report.off removes a given event listener if it exists. - report.off("pageChanged"); - - // Report.on will add an event listener. - report.on("pageChanged", function(event) { - var page = event.detail.newPage; - Log.logText("Page changed to: " + page.name + " - " + page.displayName); - }); - - // Select Run and change to a different page. - // You should see an entry in the Log window. - - Log.logText("Select different page to see events in Log window."); -} - -function _Events_DataSelected() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Report.off removes a given event listener if it exists. - report.off("dataSelected"); - - // Report.on will add an event listener. - report.on("dataSelected", function(event) { - var data = event.detail; - Log.log(data); - }); - - // Select Run and select an element of a visualization. - // For example, a bar in a bar chart. You should see an entry in the Log window. - - Log.logText("Select data to see events in Log window."); -} - -function _Events_SaveAsTriggered() { - // Get a reference to the embedded report HTML element - var reportContainer = $('#reportContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(reportContainer); - - // Report.off removes a given event listener if it exists. - report.off("saveAsTriggered"); - - // Report.on will add an event listener. - report.on("saveAsTriggered", function(event) { - Log.log(event); - }); - - // Select Run and then select SaveAs. - // You should see an entry in the Log window. - - Log.logText("Select SaveAs to see events in Log window."); -} diff --git a/demo/code-demo/scripts/function_mapping.js b/demo/code-demo/scripts/function_mapping.js deleted file mode 100644 index bb2cf2eb..00000000 --- a/demo/code-demo/scripts/function_mapping.js +++ /dev/null @@ -1,75 +0,0 @@ -const mockDict = { - _Report_GetPages: datasetNotSupported, - _Report_SetPage: datasetNotSupported, - _Report_SetFilters: datasetNotSupported, - _Report_GetFilters: datasetNotSupported, - _Report_RemoveFilters: datasetNotSupported, - _Report_PrintCurrentReport: datasetNotSupported, - _Report_UpdateSettings: datasetNotSupported, - _Report_Reload: datasetNotSupported, - _Page_SetActive: datasetNotSupported, - _Page_SetFilters: datasetNotSupported, - _Page_GetFilters: datasetNotSupported, - _Page_RemoveFilters: datasetNotSupported, - _Report_switchModeEdit: datasetNotSupported, - _Report_switchModeView: datasetNotSupported, - _Embed_BasicEmbed: _Mock_Embed_BasicEmbed_ViewMode, - _Embed_BasicEmbed_EditMode: _Mock_Embed_BasicEmbed_EditMode, - _Report_save: _Mock_Report_save, - _Report_saveAs: _Mock_Report_save, - _Embed_Create: _Mock_Embed_Create -}; - -function datasetNotSupported() { - Log.logText('Operation not supported for dataset') -} - -function IsSaveMock(funcName) { - return ((funcName === '_Report_save' || funcName === '_Report_saveAs') && ( - _session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad' /*Sample Report*/ || - _session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78' /*Sample dataset*/ )); -} - -function IsBasicMock(funcName) { - return ((funcName === '_Embed_BasicEmbed' || funcName === '_Embed_BasicEmbed_EditMode') && _session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad'); -} - -function IsCreateMock(funcName) { - return (funcName === '_Embed_Create' && _session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78'); -} - -function IsNotSupported(funcName) { - if (powerbi.embeds.length === 0) { - return false - } - - // Get a reference to the embedded element - var embed = powerbi.get($('#reportContainer')[0]); - if (embed.config.type !== 'create') { - return false; - } - - var runFunc = mockDict[funcName]; - return (runFunc && runFunc === datasetNotSupported) ? true : false; -} - -function IsMock(funcName) { - return (IsBasicMock(funcName) || IsSaveMock(funcName) || IsCreateMock(funcName) || IsNotSupported(funcName)); -} - -function mapFunc(func) { - var funcName = getFuncName(func); - return IsMock(funcName) ? mockDict[funcName] : func; -} - -function getFuncName(func) { - var funcName = func.name; - - if (!funcName) - { - // in IE, func.name is invalid method. so, function name should be extracted manually. - funcName = func.toString().match(/^function\s*([^\s(]+)/)[1]; - } - - return funcName; -} \ No newline at end of file diff --git a/demo/code-demo/scripts/index.js b/demo/code-demo/scripts/index.js deleted file mode 100644 index cb4115d0..00000000 --- a/demo/code-demo/scripts/index.js +++ /dev/null @@ -1,54 +0,0 @@ -var sampleContentLoaded = false; -var documentationContentLoaded = false; -var anyReportSectionLoaded = false; - -$(function() { - OpenSampleSection(); -}); - -function OpenSampleSection() { - OpenEmbedWorkspace("#top-sample", "step_authorize.html"); -} - -function OpenAnyReportSection() { - OpenEmbedWorkspace("#top-anyReport", "anyReport.html"); -} - -function OpenEmbedWorkspace(activeTabSelector, authStepHtml) -{ - // Any report, uses the same settings as sample report. ony changes the auth step. - if (!sampleContentLoaded) - { - // Open Report Sample. - $("#sampleContent").load("sample.html", function() { - $("#mainContent").load("report.html"); - sampleContentLoaded = true; - }); - } - - $("#authorize-step-wrapper").load(authStepHtml); - SetActiveStyle(activeTabSelector); - - $(".content").hide(); - $("#sampleContent").show(); - OpenAuthStep(); -} - -function OpenDocumentationSection() { - if (!documentationContentLoaded) - { - $("#documentationContent").load("docs.html"); - documentationContentLoaded = true; - } - - SetActiveStyle("#top-docs"); - - $(".content").hide(); - $("#documentationContent").show(); -} - -function SetActiveStyle(id) -{ - $("#top-ul li").removeClass("top-li-active"); - $(id).addClass("top-li-active"); -} \ No newline at end of file diff --git a/demo/code-demo/scripts/logger.js b/demo/code-demo/scripts/logger.js deleted file mode 100644 index 52b9e454..00000000 --- a/demo/code-demo/scripts/logger.js +++ /dev/null @@ -1,23 +0,0 @@ -function InitLogger(divId) { - - var Logger = {}; - - Logger.log = function name(event) { - this.logText("Json Object\n" + JSON.stringify(event, null, " ")); - }; - - Logger.logText = function name(text) { - var textbox = document.getElementById(divId); - - if (!textbox.value) - { - textbox.value = ""; - } - - textbox.value += "> " + text + "\n"; - - textbox.scrollTop = textbox.scrollHeight; - }; - - return Logger; -} diff --git a/demo/code-demo/scripts/report.js b/demo/code-demo/scripts/report.js deleted file mode 100644 index ff0f1819..00000000 --- a/demo/code-demo/scripts/report.js +++ /dev/null @@ -1,132 +0,0 @@ -const active_class = 'active'; -const active_li = 'steps-li-active'; - -const EmbedViewMode = "view"; -const EmbedEditMode = "edit"; -const EmbedCreateMode = "create"; - -function OpenAuthStep() { - $('#steps-ul a').removeClass(active_class); - $(".steps-li-active").removeClass(active_li); - - $("#steps-auth a").addClass(active_class); - $("#steps-auth").addClass(active_li); - - // Hide Embed view in authorization step. - $("#authorize-step-wrapper").show(); - $("#embed-and-interact-steps-wrapper").hide(); -} - -function OpenEmbedStep(mode) { - $('#steps-ul a').removeClass(active_class); - $(".steps-li-active").removeClass(active_li); - - $('#steps-embed a').addClass(active_class); - $('#steps-embed').addClass(active_li); - - // Hide Embed view in authorization step. - $("#authorize-step-wrapper").hide(); - $("#embed-and-interact-steps-wrapper").show(); - - $("#settings").load("settings_embed.html", function() { - OpenEmbedMode(mode); - - // Fix report size ratio - var reportContainer = $("#reportContainer"); - reportContainer.height(reportContainer.width() * 0.59); - }); -} - -function OpenInteractStep() { - $('#steps-ul a').removeClass(active_class); - $(".steps-li-active").removeClass(active_li); - - $('#steps-interact a').addClass(active_class); - $('#steps-interact').addClass(active_li); - - // Hide Embed view in authorization step. - $("#authorize-step-wrapper").hide(); - $("#embed-and-interact-steps-wrapper").show(); - - $("#settings").load("settings_interact.html", function() { - SetToggleHandler("report-operations-div"); - SetToggleHandler("page-operations-div"); - SetToggleHandler("events-operations-div"); - SetToggleHandler("editandsave-operations-div"); - LoadCodeArea("#embedCodeDiv", _Report_GetId); - }); -} - -function setCodeArea(mode) -{ - if (mode === EmbedViewMode) - { - LoadCodeArea("#embedCodeDiv", _Embed_BasicEmbed); - } - else if (mode === EmbedEditMode) - { - LoadCodeArea("#embedCodeDiv", _Embed_BasicEmbed_EditMode); - } - else if (mode === EmbedCreateMode) - { - LoadCodeArea("#embedCodeDiv", _Embed_Create); - } -} - -function showEmbedSettings(mode) -{ - var inputDivToShow = "#embedModeInput"; - var inputDivToHide = "#createModeInput"; - - if (mode === EmbedCreateMode) - { - inputDivToShow = "#createModeInput"; - inputDivToHide = "#embedModeInput"; - } - - $(inputDivToShow).show(); - $(inputDivToHide).hide(); - - var embedModeRadios = $('input:radio[name=embedMode]'); - embedModeRadios.filter('[value='+ mode + ']').prop('checked', true); -} - -function OpenEmbedMode(mode) -{ - if (mode == EmbedCreateMode) - { - if (IsEmbeddingSampleReport()) - { - LoadSampleDatasetIntoSession(); - } - - SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId"); - } - else { - if (IsEmbeddingSampleReport()) - { - LoadSampleReportIntoSession(); - } - - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - } - - setCodeArea(mode); - showEmbedSettings(mode); -} - -function OpenViewMode() { - OpenEmbedMode(EmbedViewMode); -} - -function OpenEditMode() { - OpenEmbedMode(EmbedEditMode); -} - -function OpenCreateMode() { - OpenEmbedMode(EmbedCreateMode); -} - -function IsEmbeddingSampleReport() { - return GetSession(SessionKeys.IsSampleReport) == true; -} diff --git a/demo/code-demo/scripts/session_utils.js b/demo/code-demo/scripts/session_utils.js deleted file mode 100644 index d95adc4b..00000000 --- a/demo/code-demo/scripts/session_utils.js +++ /dev/null @@ -1,76 +0,0 @@ -var _session = {}; - -const SessionKeys = { - AccessToken : "accessToken", - EmbedUrl : "embedUrl", - EmbedId : "embedId", - GroupId : "groupId", - IsSampleReport: "isSampleReport", - QnaQuestion: "qnaQuestion", - EntityIsAlreadyEmbedded: "EntityIsAlreadyEmbedded", -}; - -function GetParameterByName(name, url) { - if (!url) { - url = window.location.href; - } - name = name.replace(/[\[\]]/g, "\\$&"); - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), - results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, " ")); -} - -function SetSession(key, value) { - // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session. - _session[key] = value; -} - -function GetSession(key) { - // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session. - return _session[key]; -} - -function UpdateSession(button, sessionKey) { - var value = $(button).val(); - if (value) - { - SetSession(sessionKey, value); - } -} - -function SetTextBoxesFromSessionOrUrlParam(accessTokenSelector, embedUrlSelector, embedIdSelector) { - var accessToken = GetParameterByName(SessionKeys.AccessToken); - if (!accessToken) - { - accessToken = GetSession(SessionKeys.AccessToken); - } - - var embedUrl = GetParameterByName(SessionKeys.EmbedUrl); - if (!embedUrl) - { - embedUrl = GetSession(SessionKeys.EmbedUrl); - } else { - var groupId = GetParameterByName(SessionKeys.GroupId); - if(groupId) - { - if (embedUrl.indexOf("?") != -1) - { - embedUrl += "&groupId=" + groupId; - } else { - embedUrl += "?groupId=" + groupId; - } - } - } - - var embedId = GetParameterByName(SessionKeys.EmbedId); - if (!embedId) - { - embedId = GetSession(SessionKeys.EmbedId); - } - - $(accessTokenSelector).val(accessToken); - $(embedUrlSelector).val(embedUrl); - $(embedIdSelector).val(embedId); -} diff --git a/demo/code-demo/scripts/step_authorize.js b/demo/code-demo/scripts/step_authorize.js deleted file mode 100644 index 43e793f5..00000000 --- a/demo/code-demo/scripts/step_authorize.js +++ /dev/null @@ -1,41 +0,0 @@ -const SampleReport = { - AccessToken : "", - EmbedUrl : "https://embedded.powerbi.com/appTokenReportEmbed?reportId=c52af8ab-0468-4165-92af-dc39858d66ad", - EmbedId : "c52af8ab-0468-4165-92af-dc39858d66ad" -}; - -const SampleDataset = { - AccessToken : "", - EmbedUrl : "https://embedded.powerbi.com/appTokenReportEmbed", - EmbedId : "1ee0b264-b280-43f1-bbb7-9d8bd2d03a78" -}; - -function LoadSampleReportIntoSession() { - setSession(SampleReport.AccessToken, SampleReport.EmbedUrl, SampleReport.EmbedId); -} - -function LoadSampleDatasetIntoSession() { - setSession(SampleDataset.AccessToken, SampleDataset.EmbedUrl, SampleDataset.EmbedId); -} - -function OpenEmbedStepWithSample() { - SetSession(SessionKeys.IsSampleReport, true); - OpenEmbedStep(EmbedViewMode); -} - -function OpenEmbedStepCreateWithSample() { - SetSession(SessionKeys.IsSampleReport, true); - OpenEmbedStep(EmbedCreateMode); -} - -function OpenEmbedStepFromUserSettings() { - SetSession(SessionKeys.IsSampleReport, false); - OpenEmbedStep(EmbedViewMode); -} - -function setSession(accessToken, embedUrl, embedId) -{ - SetSession(SessionKeys.AccessToken, accessToken); - SetSession(SessionKeys.EmbedUrl, embedUrl); - SetSession(SessionKeys.EmbedId, embedId); -} \ No newline at end of file diff --git a/demo/code-demo/scripts/step_embed.js b/demo/code-demo/scripts/step_embed.js deleted file mode 100644 index af4cacef..00000000 --- a/demo/code-demo/scripts/step_embed.js +++ /dev/null @@ -1,98 +0,0 @@ -// ---- Report Operations ---------------------------------------------------- -function Report_GetId() { - SetCode(_Report_GetId); -} - -function Report_UpdateSettings() { - SetCode(_Report_UpdateSettings); -} - -function Report_GetPages() { - SetCode(_Report_GetPages); -} - -function Report_SetPage() { - SetCode(_Report_SetPage); -} - -function Report_GetFilters() { - SetCode(_Report_GetFilters); -} - -function Report_SetFilters() { - SetCode(_Report_SetFilters); -} - -function Report_RemoveFilters() { - SetCode(_Report_RemoveFilters); -} - -function Report_PrintCurrentReport() { - SetCode(_Report_PrintCurrentReport); -} - -function Report_Reload() { - SetCode(_Report_Reload); -} - -function Report_Refresh() { - SetCode(_Report_Refresh); -} - -function Report_FullScreen() { - SetCode(_Report_FullScreen); -} - -function Report_ExitFullScreen() { - SetCode(_Report_ExitFullScreen); -} - -// ---- Page Operations ---------------------------------------------------- - -function Page_SetActive() { - SetCode(_Page_SetActive); -} - -function Page_GetFilters() { - SetCode(_Page_GetFilters); -} - -function Page_SetFilters() { - SetCode(_Page_SetFilters); -} - -function Page_RemoveFilters() { - SetCode(_Page_RemoveFilters); -} - -// ---- Event Listener ---------------------------------------------------- - -function Events_PageChanged() { - SetCode(_Events_PageChanged); -} - -function Events_DataSelected() { - SetCode(_Events_DataSelected); -} - -function Events_SaveAsTriggered() { - SetCode(_Events_SaveAsTriggered); -} - -// ---- Edit and Save Operations ---------------------------------------------------- - -function Report_switchModeEdit() { - SetCode(_Report_switchModeEdit); -} - -function Report_switchModeView() { - SetCode(_Report_switchModeView); -} - -function Report_save() { - SetCode(_Report_save); -} - -function Report_saveAs() { - SetCode(_Report_saveAs); -} \ No newline at end of file diff --git a/demo/code-demo/scripts/step_interact.js b/demo/code-demo/scripts/step_interact.js deleted file mode 100644 index ea15a6fd..00000000 --- a/demo/code-demo/scripts/step_interact.js +++ /dev/null @@ -1,73 +0,0 @@ -function OpenReportOperations() { - $("#report-operations-div").show(); - $("#page-operations-div").hide(); - $("#events-operations-div").hide(); - $("#editandsave-operations-div").hide(); - - $("#report-operations-li").addClass('active'); - $('#page-operations-li').removeClass('active'); - $('#events-operations-li').removeClass('active'); - $('#editandsave-operations-li').removeClass('active'); - - $("#report-operations-div .function-ul li.active").click() - - $("#selected-catogory-button").html("Report operations"); -} - -function OpenPageOperations() { - $("#page-operations-div").show(); - $("#report-operations-div").hide(); - $("#events-operations-div").hide(); - $("#editandsave-operations-div").hide(); - - $("#page-operations-li").addClass('active'); - $('#report-operations-li').removeClass('active'); - $('#events-operations-li').removeClass('active'); - $('#editandsave-operations-li').removeClass('active'); - - $("#page-operations-div .function-ul li.active").click(); - - $("#selected-catogory-button").html("Page operations"); -} - -function OpenEventOperations() { - $("#page-operations-div").hide(); - $("#report-operations-div").hide(); - $("#events-operations-div").show(); - $("#editandsave-operations-div").hide(); - - $("#page-operations-li").removeClass('active'); - $('#report-operations-li').removeClass('active'); - $('#events-operations-li').addClass('active'); - $('#editandsave-operations-li').removeClass('active'); - - $("#events-operations-div .function-ul li.active").click(); - - $("#selected-catogory-button").html("Events Listener"); -} - -function OpenEditAndSaveOperations() { - $("#page-operations-div").hide(); - $("#report-operations-div").hide(); - $("#events-operations-div").hide(); - $("#editandsave-operations-div").show(); - - $("#page-operations-li").removeClass('active'); - $('#report-operations-li').removeClass('active'); - $('#events-operations-li').removeClass('active'); - $('#editandsave-operations-li').addClass('active'); - - $("#editandsave-operations-div .function-ul li.active").click(); - - $("#selected-catogory-button").html("Edit and save operations"); -} - -function SetToggleHandler(devId) { - var selector = "#" + devId + " .function-ul li"; - $(selector).each(function(index, li) { - $(li).click(function() { - $(selector).removeClass('active'); - $(li).addClass('active'); - }); - }); -} diff --git a/demo/code-demo/scripts/utils.js b/demo/code-demo/scripts/utils.js deleted file mode 100644 index 9a4c7bd6..00000000 --- a/demo/code-demo/scripts/utils.js +++ /dev/null @@ -1,82 +0,0 @@ -function ValidateEmbedUrl(embedUrl) { - var embedUrl = $('#txtReportEmbed').val(); - - if (!embedUrl) - { - alert("You must specify an embed url."); - return false; - } - var id = null; - var parts = embedUrl.split("reportId="); - if (parts && parts.length > 0) - { - var guidParts = parts[parts.length -1].split("&"); - if (guidParts && guidParts.length > 0) - { - id = guidParts[0]; - } - } - - if (!id) - { - alert("Could not find report ID in url"); - return false; - } - - return true; -} - -function BodyCodeOfFunction(func) { - var lines = func.toString().split('\n'); - lines = lines.slice(1, lines.length-1); - - for (var i = 0; i < lines.length; ++i) - { - // remove trailing spaces. - lines[i] = lines[i].substring(4); - } - - return lines.join('\n'); -} - -function LoadCodeArea(divSelector, initialFunctionCode) { - $(divSelector).load("code_area.html", function() { - SetCode(initialFunctionCode); - }); -} - -function LoadLogWindow(divSelector) { - $(divSelector).load("log_window.html"); -} - -function SetCode(func) { - var codeHtml = '
';
-	codeHtml = codeHtml + BodyCodeOfFunction(func) + '
'; - $("#highlighter").html(codeHtml); - - var runFunc = mapFunc(func); - - $('#btnRunCode').off('click'); - $('#btnRunCode').click(runFunc); -} - -function CopyCode() { - CopyTextArea("#txtCode", "#btnRunCopyCode"); -} - -function CopyResponseWindow() { - CopyTextArea("#txtResponse", "#btnCopyResponse"); -} - -function CopyTextArea(textAreaSelector, buttonSelector) { - $(textAreaSelector).select(); - document.execCommand('copy'); - window.getSelection().removeAllRanges(); - - // Set focus on copy button - this will deselect text in copied area. - $(buttonSelector).focus(); -} - -function ClearTextArea(textAreaSelector) { - $(textAreaSelector).val(""); -} diff --git a/demo/code-demo/settings_embed.html b/demo/code-demo/settings_embed.html deleted file mode 100644 index c850640a..00000000 --- a/demo/code-demo/settings_embed.html +++ /dev/null @@ -1,50 +0,0 @@ -
-
-

Embed Report

-
- - Select mode to embed your report in: -
-
-
View mode
-
Edit mode
-
Create mode
-
- -
- Fill in the fields below to get the code to embed your report. -
- -
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Report Id
- -
-
- -
- Fill in the fields below to get the code to embed your report. -
- -
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Dataset Id
- -
-
- -
\ No newline at end of file diff --git a/demo/code-demo/settings_interact.html b/demo/code-demo/settings_interact.html deleted file mode 100644 index 1e37e084..00000000 --- a/demo/code-demo/settings_interact.html +++ /dev/null @@ -1,65 +0,0 @@ -
-
-
-
- -
-
-
-
-
-
    -
  • Get Id
  • -
  • Get pages
  • -
  • Set page
  • -
  • Set filters
  • -
  • Get filters
  • -
  • Remove filters
  • -
  • Print
  • -
  • Update settings
  • -
  • Reload
  • -
  • Refresh
  • -
  • Full screen
  • -
  • Exit full screen
  • -
-
- - - -
-
-
-
\ No newline at end of file diff --git a/demo/code-demo/step_authorize.html b/demo/code-demo/step_authorize.html deleted file mode 100644 index 5bdceab1..00000000 --- a/demo/code-demo/step_authorize.html +++ /dev/null @@ -1,32 +0,0 @@ - -
-
-
-
-

Deprecation Note

-
- This sample is deprecated. please use the new sample available - here. - -
- - The new sample accommodates the changes announced in the embedded offering described in - Power BI Documentation page. -
- -
-

Sample Report

- You can embed a sample report and interact with Power BI Embedded firsthand by clicking below. -
-
- -
-
-
- - \ No newline at end of file diff --git a/demo/code-demo/style/layout.css b/demo/code-demo/style/layout.css deleted file mode 100644 index 279231e7..00000000 --- a/demo/code-demo/style/layout.css +++ /dev/null @@ -1,359 +0,0 @@ -body { - min-width: 300px; -} - -header -{ - padding: 20px 40px; -} - -.logo-text-span { - color: rgb(0, 174, 239); - font-family: 'Segoe UI Web Light', 'Segoe UI Light', 'Segoe WP Light', 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; - font-weight: normal; - font-size: 28px; -} - -#mainContent { - position: relative; - color: #404040; - /* margin: 15px 30px; */ - float: left; - width: 100%; -} - -.content { - position: relative; - color: #404040; - margin: 15px 30px; - height: 100%; -} - -#settings { - width: 270px; - margin-right: 20px; -} - -#embedCodeDiv { - width: 400px; - margin-right: 20px; - max-height: 300px; - float: left; -} - -#embedArea { - clear: both; - width: 100%; - padding-left: 290px; -} - -#reportContainer { - width: 100%; - height: 450px; - background-color: white; - padding: 0px; - clear: both; -} - -#logWindow { - width: 400px; - float: left; -} - -.topPanel { - margin-bottom: 10px; -} - -.bottomPanel { - width: 100%; - margin-bottom: 10px; - max-width: 100%; -} - -#steps-nav-bar { - width: 100%; - font-size: 90%; - border-bottom: 1px solid #E5E5E5; - margin-bottom: 20px; - padding-right: 0; - margin-right: 0; -} - -#steps-ul li { - width: 32%; - display: inline-block; -} - -@media screen and (max-width: 320px) { - header - { - padding: 15px 30px; - } - - .logo-text-span { - font-size: 90%; - line-height: 42px; - min-width: 295px; - } - - .topPanel { - height: 430px; - width: 100%; - } - - #embedCodeDiv { - width: 100%; - margin-bottom: 30px; - margin-right: 0px; - } - - #logWindow { - width: 100%; - } - - #settings { - width: 100%; - float: left; - margin-right: 0px; - } - - #reportContainer { - width: 100%; - height: 360px; - } - - #embedArea { - padding-left: 0px; - } -} - -@media screen and (max-width: 500px) { - .top-ul li { - float: left; - margin-right: 15px; - text-align: center; - line-height: 22px; - font-size: 13px; - } -} - -@media screen and (min-width: 321px) { - header - { - padding: 15px 30px; - } - - .logo-text-span { - font-size: 110%; - line-height: 42px; - min-width: 295px; - } - - .topPanel { - height: 430px; - width: 100%; - } - - #embedCodeDiv { - width: 100%; - margin-bottom: 30px; - margin-right: 0px; - } - - #logWindow { - width: 100%; - } - - #settings { - width: 100%; - float: left; - margin-right: 0px; - } - - #reportContainer { - width: 100%; - height: 360px; - } - - #embedArea { - padding-left: 0px; - } -} - -@media screen and (min-width: 551px) { - header - { - padding: 15px 10px; - } - - .logo-text-span { - font-size: 90%; - line-height: 42px; - min-width: 295px; - } - - .topPanel { - height: 330px; - width: 100%; - } - - #embedCodeDiv { - width: 100%; - margin-bottom: 30px; - margin-right: 0px; - } - - #logWindow { - width: 100%; - } - - #settings { - width: 100%; - float: left; - margin-right: 0px; - } - - #reportContainer { - width: 100%; - height: 360px; - } - - #embedArea { - padding-left: 0px; - } -} - -@media screen and (min-width: 861px) and (max-width: 1023px) { - header - { - padding: 20px 40px; - } - - .logo-text-span { - font-size: 28px; - } - - #embedCodeDiv { - width: 49%; - font-size: 90%; - margin-right: 2%; - } - - #logWindow { - width: 49%; - } - - #settings { - float: none; - width: 380px; - } - - #reportContainer { - width: 100%; - height: 360px; - } - - #embedArea { - padding-left: 0px; - } -} - -@media screen and (min-width: 1024px) { - header - { - padding: 20px 40px; - } - - .logo-text-span { - font-size: 28px; - } - - #mainContent { - width: 86.7%; - margin-left: 0.8%; - } - - #embedCodeDiv { - width: 34%; - font-size: 90%; - margin-right: 1%; - } - - #logWindow { - width: 34%; - } - - #settings { - float: left; - width: 30%; - margin-right: 1%; - } - - #operations-ul li { - margin: 0px 2px; - } - - #reportContainer { - width: 100%; - height: 380px; - } - - .bottomPanel { - margin-left: 0; - width: 100%; - } - - #steps-nav-bar { - width: 13.3%; - font-size: 90%; - padding-right: 0.8%; - border-right: 1px solid #E5E5E5; - border-bottom: none; - margin-bottom: 0px; - } - - #steps-ul li { - width: 100%; - display: block; - } -} - -@media screen and (min-width: 1280px) { - .logo-text-span { - font-size: 28px; - } - - .content { - margin: 15px 20px; - } - - .bottomPanel { - max-width: 100%; - margin-left: 0px; - } - - .steps-ul li { - font-size: 17px; - } -} - - -@media screen and (min-width: 1600px) { - .logo-text-span { - font-size: 28px; - } - - .content { - margin: 15px 40px; - } -} - -@media screen and (min-width: 1800px) { - .logo-text-span { - font-size: 28px; - } - - #reportContainer { - height: 450px; - } -} \ No newline at end of file diff --git a/demo/code-demo/style/style.css b/demo/code-demo/style/style.css deleted file mode 100644 index 09ffbe1b..00000000 --- a/demo/code-demo/style/style.css +++ /dev/null @@ -1,628 +0,0 @@ -html { - margin:0; - padding:0; - height:100%; -} - -body { - background-color: rgb(241, 241, 241); - font-family: 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; - margin:0; - padding:0; - height:100%; -} - -h3 { - margin: 0; -} - -hr { - border-color: #DDDDDD; -} - -header { - display: block; - width: 100%; - top: 0px; - z-index: 1030; - color: rgb(8, 122, 165); - background-color: rgb(24, 24, 25); - height: 100px; -} - -a:hover, a:visited, a:link, a:active -{ - text-decoration: none; -} - -#nextStep { - float: right; -} - -#result-wrap { - margin-top: 10px; -} - -#user-embed-details { - width: 100%; -} - -#user-embed-details tr { - width: 100%; -} - -#user-embed-details input[type="text"] { - width: 100%; - border: none; - margin-bottom: 5px; -} - -#report-embed-table { - width: 100%; -} - -#report-embed-table tr { - width: 100%; -} - -.inputLine > span { - width: 30%; -} - -#report-embed-table input[type="text"] { - width: 73%; - border: none; - margin-bottom: 5px; -} - -#report-embed-checkbox input { - width: auto; - border: none; - margin-bottom: 5px; -} - -#oldSample { - display: block; - float: right; - margin-right: 30px; -} - -#deprecationNote { - margin-bottom: 30px; -} - -#deprecationNote .pageTitle { - margin-bottom: 15px; - font-weight: normal; - color: red; -} - -#sampleReportImgDiv img { - width: 265px; - height: 180px; -} - -#sampleReportImgDiv { - margin-top: 17px; - margin-right: 32px; - float: left; -} - -#sampleReportDescription { - float: left; - margin-top: 17px; - max-width: 400px; -} - -a { - text-decoration: none; -} - -.btn.btn-margin { - margin-bottom: 5px; -} - -.halfWidth.right { - width: 750px; - min-height: 100px; - float: left; - padding-top: 10px; - padding-bottom: 10px; -} - -.halfWidth.left { - width: 750px; - min-height: 100px; - float: left; - padding-top: 10px; - padding-bottom: 10px; - margin-right: 40px; -} - -.break-float { - clear: both; - width: 100%; -} - -.pbi-line { - display: inline-block; - width: 100%; -} - -#top-nav-bar { - margin-top: 10px; -} - -#top-nav-bar a { - color: white; - display: inline-block; -} - -#top-nav-bar a:hover { - color: rgb(8, 122, 165); -} - -#top-nav-bar .active { - color: rgb(0, 174, 239); -} - -#steps-nav-bar a { - color: black; - display: inline-block; -} - -#steps-nav-bar a:hover { - font-weight: bold; -} - -#steps-nav-bar .active { - color: white; -} - -.main-ul { - list-style-type: none; - margin: 0px 30px; - padding: 0; - overflow: hidden; - float: right; -} - -.main-ul .active { - background-color: rgb(245, 211, 65); -} - -.main-li { - float: left; -} - -.main-li a { - display: block; - color: black; - text-align: center; - padding: 0px 16px; - text-decoration: none; -} - -.main-li a:visited { - display: block; - color: black; - text-align: center; - padding: 0px 16px; - text-decoration: none; - background-color: rgb(245, 211, 65); -} - -.main-li a:hover { - display: block; - color: black; - text-align: center; - padding: 0px 16px; - text-decoration: none; - background-color: rgb(245, 211, 65); -} - -.main-li a:active { - display: block; - color: black; - text-align: center; - padding: 0px 16px; - text-decoration: none; - background-color: rgb(245, 211, 65); -} - -.main-title { - font-family: 'Segoe UI Web Light', 'Segoe UI Light', 'Segoe WP Light', 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; - font-size: 28px; - font-weight: bold; -} - -#navbar { - float: left; - width: 100%; -} - -#top-ul-dev { - float: left; -} - -.top-ul { - list-style-type: none; - margin: 0px; - overflow: hidden; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - line-height: 30px; -} - -.top-ul li { - float: left; - margin-right: 40px; - text-align: center; - line-height: 22px; - font-size: 17px; -} - -#top-docs { - margin-right: 0px; -} - -.top-li-active { - color: white; - border-bottom: 1px solid white; - padding-bottom: 3px; -} - -#steps-ul-dev { - float: left; - width: 100%; -} - -.steps-ul { - list-style-type: none; - margin: 0px; - overflow: hidden; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - line-height: 30px; - width: 100%; -} - -.steps-ul li { - float: none; - text-align: left; - line-height: 22px; - font-weight: 400; - height: 40px; - width: 100%; - margin-bottom: 10px; - vertical-align: middle; -} - -#steps-interact { - margin-right: 0px; -} - -.steps-li-active { - color: white; - text-decoration: none; - background-color: #666666; -} - -.operations-div { - height: 100%; - width: 95%; - background-color: rgb(231, 232, 233); - text-align: center; - overflow-y: scroll; - position: relative; -} - -#operations-ul a { - text-decoration: none; - color: rgb(27, 27, 27); - width: 100%; - text-align: center; -} - -#operations-ul li:hover { - border-bottom: 3px solid #444444; -} - -#operations-ul { - -webkit-margin-before: 0; - -webkit-margin-after: 0; - -webkit-padding-start: 0; -} - -#operations-ul li { - margin: 0px 30px 0px 0px; - display: inline-block; - /* font-size: 14px; */ - color: #444444; -} - -#operations-ul > .active { - border-bottom: 3px #444444 solid; -} - -#wrapper-operations-div { - padding: 10px 20px 15px 20px; - background-color: rgb(231, 232, 233); - width: 100%; - height: 300px; - overflow: hidden; - display: inline-block; -} - -#report-operations-div::-webkit-scrollbar-track, #page-operations-div::-webkit-scrollbar-track, #events-operations-div::-webkit-scrollbar-track -{ - border-radius: 10px; - background-color: transparent; -} - -#report-operations-div::-webkit-scrollbar, #page-operations-div::-webkit-scrollbar, #events-operations-div::-webkit-scrollbar -{ - width:10px; - height:10px; - background-color: transparent; -} - -#report-operations-div::-webkit-scrollbar-thumb, page-operations-div::-webkit-scrollbar-thumb, #events-operations-div::-webkit-scrollbar-thumb -{ - border-radius: 10px; - background-color: #888888; -} - -#operations-ul-wrapper img { - width: 20px; - position: relative; - top: 3px; -} - -#operation-categories { - margin-bottom: 0px; -} - -#selected-catogory-button { - background-color: transparent; - border: none; - color: rgb(27, 27, 27); - min-width: 120px; - text-align: left; -} - -.function-ul { - width: 100%; - clear: both; - margin: 0; - padding: 0px 20px 0px 0px; -} - -.function-ul li { - width: 100%; - clear: both; - cursor: default; -} - -.function-ul a { - text-decoration: none; - color: rgb(27, 27, 27); -} - -.function-ul .active { - background-color: rgb(88, 88, 90); - color: white; -} - -.function-ul a:hover { - background-color: #888888; -} - -.function-ul li { - list-style-type: none; - margin: 0px; - overflow: hidden; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - margin: 5px 0px; - text-align: left; - padding: 3px; -} - -.td-field-name { - width: 130px; - text-align: right; - color: #888888; - padding-right: 5px; -} - -.pageTitle { - margin-bottom: 10px; -} - -.pageTitle h3 { - margin-bottom: 15px; - font-weight: normal; -} - -.editorTitle { - margin-bottom: 5px; -} - -#GoToInteractStep { - display: inline-block; - position: relative; -} - -.textAreaControls { - text-align: right; - position: relative; - z-index: 1; - height: 30px; - padding: 10px 20px; - font-size: 14px; -} - -.textAreaControl { - color: rgb(127, 127, 127); - background-color: transparent; - border: none; - margin-right: 5px; -} - -.textAreaControl img { - width: 16px; - height: 16px; - position: relative; - top: -2px; -} - -.responseTextArea { - width: 100%; - height: 300px; - border: none; - padding-top: 40px; - position: relative; - top: -30px; - padding-left: 10px; - margin-bottom: -30px; -} - -.responseDiv { - width: 100%; - float: left; -} - -.blueButton { - background-color: rgb(36, 169, 225); - border: none; - color: white; - padding: 5px 30px; -} - -.spacer { - height: 10px; -} - -.scrollbar -{ - margin-left: 30px; - float: left; - height: 300px; - width: 65px; - background: #F5F5F5; - overflow-y: scroll; - margin-bottom: 25px; -} - -#txtCode { - width: 100%; - height: 300px; - border: none; - padding: 20px; - position: relative; - top: -30px; - background: #FFFFFF; - overflow: auto; - white-space: pre-wrap; -} - -#GoToEmbedStepButton { - margin-top: 12px; -} - -#authStepDiv { - max-width: 500px; -} - -#report-embed-table .inputLine { - margin: 5px 0px; -} - -.pageTitle h4 { - font-size: 18px; - font-weight: normal; - margin: 0px 0px 5px 0px; -} - -.top-div { - border-radius: 50%; - width: 10px; - height: 10px; - display: inline-block; - background-color: white; - border: solid black 1px; -} - -.active-top { - background-color: rgb(36, 169, 225); -} - -.step-div { - border-radius: 50%; - width: 10px; - height: 10px; - display: inline-block; - background-color: white; - border: solid black 1px; -} - -.active-step { - background-color: rgb(36, 169, 225); -} - -.editorTitleText { - display: inline-block; -} - -#selected-catogory-button-wrapper img { - width: 20px; - position: relative; - top: -1px; -} - -.checkbox.input { - width: auto; -} - -.stepsButton { - -height: 100%; - -padding: 10px 0px 0px 10px; - -line-height: 20px; -} - -.video { - width: 90%; - height: 500px; - max-width: 800px; -} - -.title { - font-size: 17px; - font-weight: 400px; -} - -#embedModeInput { - -} - -#createModeInput { - display: none; -} - -.inputLineTitle { - width: 25%; - display: inline-block; -} - -#modeSelector { - margin-bottom: 20px; - cursor: default; -} - -#reportContainer iframe { - border: none; -} \ No newline at end of file diff --git a/demo/code-demo/style/syntaxHighlighterOverride.css b/demo/code-demo/style/syntaxHighlighterOverride.css deleted file mode 100644 index 1f789f8b..00000000 --- a/demo/code-demo/style/syntaxHighlighterOverride.css +++ /dev/null @@ -1,10 +0,0 @@ -.syntaxhighlighter { - overflow: hidden !important; - margin: 0em !important; - padding: 0em !important; - top: -85px !important; -} - -.syntaxhighlighter .line { - white-space: pre-wrap !important; -} \ No newline at end of file diff --git a/demo/code-demo/syntaxHighlighter/syntaxhighlighter.js b/demo/code-demo/syntaxHighlighter/syntaxhighlighter.js deleted file mode 100644 index 7d773ec8..00000000 --- a/demo/code-demo/syntaxHighlighter/syntaxhighlighter.js +++ /dev/null @@ -1,3768 +0,0 @@ -/*! - * SyntaxHighlighter - * https://github.com/syntaxhighlighter/syntaxhighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 4.0.1 (Tue, 07 Mar 2017 15:42:46 GMT) - * - * @copyright - * Copyright (C) 2004-2016 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _core = __webpack_require__(1); - - Object.keys(_core).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _core[key]; - } - }); - }); - - var _domready = __webpack_require__(24); - - var _domready2 = _interopRequireDefault(_domready); - - var _core2 = _interopRequireDefault(_core); - - var _dasherize = __webpack_require__(25); - - var dasherize = _interopRequireWildcard(_dasherize); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - // configured through the `--compat` parameter. - if (false) { - require('./compatibility_layer_v3'); - } - - (0, _domready2.default)(function () { - return _core2.default.highlight(dasherize.object(window.syntaxhighlighterConfig || {})); - }); - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var optsParser = __webpack_require__(2), - match = __webpack_require__(5), - Renderer = __webpack_require__(9).default, - utils = __webpack_require__(10), - transformers = __webpack_require__(11), - dom = __webpack_require__(17), - config = __webpack_require__(18), - defaults = __webpack_require__(19), - HtmlScript = __webpack_require__(20); - - var sh = { - Match: match.Match, - Highlighter: __webpack_require__(22), - - config: __webpack_require__(18), - regexLib: __webpack_require__(3).commonRegExp, - - /** Internal 'global' variables. */ - vars: { - discoveredBrushes: null, - highlighters: {} - }, - - /** This object is populated by user included external brush files. */ - brushes: {}, - - /** - * Finds all elements on the page which should be processes by SyntaxHighlighter. - * - * @param {Object} globalParams Optional parameters which override element's - * parameters. Only used if element is specified. - * - * @param {Object} element Optional element to highlight. If none is - * provided, all elements in the current document - * are returned which qualify. - * - * @return {Array} Returns list of { target: DOMElement, params: Object } objects. - */ - findElements: function findElements(globalParams, element) { - var elements = element ? [element] : utils.toArray(document.getElementsByTagName(sh.config.tagName)), - conf = sh.config, - result = []; - - // support for - - - - - - - - \ No newline at end of file diff --git a/demo/defaults.html b/demo/defaults.html deleted file mode 100644 index aa511b2a..00000000 --- a/demo/defaults.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - Power BI - Sample - Client - JavaScript - - - - - - -
-

Power BI - Sample - Client - Javascript

-

Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript

- -

Scenarios:

- - -

Default Page and/or Default Filter

-

Load a report at a specified page and/or report level filter.

- -
- -
- - - - - - - - - - \ No newline at end of file diff --git a/demo/dynamic.html b/demo/dynamic.html deleted file mode 100644 index b24c61a2..00000000 --- a/demo/dynamic.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - Power BI - Sample - Client - JavaScript - - - - - - -
-

Power BI - Sample - Client - Javascript

-

Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript

- -

Scenarios:

- - -

Dynamic Embed

-

Report to embed is chosen by the user.

-
    -
-

- -

- -
- -
- - - - - - - - - - \ No newline at end of file diff --git a/demo/filters.html b/demo/filters.html deleted file mode 100644 index dc036fb0..00000000 --- a/demo/filters.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - Power BI - Sample - Client - JavaScript - - - - - - -
-

Power BI - Sample - Client - Javascript

-

Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript

- -

Scenarios:

- - -

Custom Filter Pane

-

Filter pane is hidden in the embedded report and recreated by developer to allow custom branding or focused experience on filters specialized for the report.

- -
-
-
-
-
-
-
-
-
-

Report

-
-
-

Page

-
-
-

Visual

-
-
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
- Not Implemented -
-
-
-
-
-
-
-
-
- -

Store > Name Contains 'Direct'

- -

Store > Name contains 'Wash' or contains 'Park'

-
-
- -

Store > Name contains 'Wash' or contains 'Park'
(Page: District Monthly Sales)

-
-
- Not Implemented -
-
-
-
- -
-
-
-
-
-

Custom Filter Pane

- -
- Target Type: -
- -
- -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- Operator Type: -
- -
-
- -
- -
-
Basic Operators
-
- -
- -
Values
-
-
- -
-
- -
-
-
- -
-
Advanced Operators
- -

Logical Operator

-
- -
- -
-
-

Value

-
- -
-

Condition Operator

- -
- -
-

Value

-
- -
-

Condition Operator

- -
-
-
-
- -
- Filter Target: -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- -
- -
-
- -
-

Applied Filters

-

- -

- -

Report Level

-
-
- -

Page Level

-
-
-
- -
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/demo/index.html b/demo/index.html deleted file mode 100644 index 33939d94..00000000 --- a/demo/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/demo/package.json b/demo/package.json deleted file mode 100644 index 8ad74a40..00000000 --- a/demo/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "powerbi-client-demo", - "version": "1.0.0", - "description": "Demonstration of embedding Power BI using JavaScript library.", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "http-server ." - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Microsoft/PowerBI-JavaScript.git" - }, - "keywords": [ - "microsoft", - "powerbi", - "embedded" - ], - "author": "Microsoft", - "license": "MIT", - "bugs": { - "url": "https://github.com/Microsoft/PowerBI-JavaScript/issues" - }, - "homepage": "https://github.com/Microsoft/PowerBI-JavaScript/demo", - "ignore": [ - "**/.*", - "node_modules", - "test", - "tests" - ], - "dependencies": { - "bootstrap": "^4.1.2", - "ecstatic": "^3.3.1", - "es6-promise": "^3.2.2", - "fetch": "^1.0.0", - "http-server": "^0.9.0", - "jquery": "^3.1.0", - "powerbi-client": "file:..", - "powerbi-report-authoring": "^1.1", - "syntaxhighlighter": "4.0.1" - }, - "devDependencies": {} -} diff --git a/demo/pagenavigation.html b/demo/pagenavigation.html deleted file mode 100644 index af277a2c..00000000 --- a/demo/pagenavigation.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - Power BI - Sample - Client - JavaScript - - - - - - -
-

Power BI - Sample - Client - Javascript

-

Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript

- -

Scenarios:

- - -

Custom Page Navigation

-

Page navigation is hidden in the embedded report and recreated by developer to allow custom branding or even automation to tell stories and navigate user.

- -
- -
- -
-
- - -
-
- - - - - - - - - - \ No newline at end of file diff --git a/demo/settings.html b/demo/settings.html deleted file mode 100644 index 8657c6b9..00000000 --- a/demo/settings.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - Power BI - Sample - Client - JavaScript - - - - - - -
-

Power BI - Sample - Client - Javascript

-

Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript

- -

Scenarios:

- - -

Update Settings

-

Change visibility of filter pane or page navigation dynamically

- -
- -
-
- - -
-
- - - - - - - - - - \ No newline at end of file diff --git a/demo/static.html b/demo/static.html deleted file mode 100644 index e007ad56..00000000 --- a/demo/static.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - Power BI - Sample - Client - JavaScript - - - - - - -
-

Power BI - Sample - Client - Javascript

-

Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript

- -

Scenarios:

- - -

Static Embed

-

Report to embed is known by the developer.

- -
- -
-

- - - - -

-
- - - - - - - - - \ No newline at end of file diff --git a/demo/styles/app.css b/demo/styles/app.css deleted file mode 100644 index 30b0e98d..00000000 --- a/demo/styles/app.css +++ /dev/null @@ -1,68 +0,0 @@ -body { - padding: 2em 0; -} - -.powerbi-container { - height: 600px; -} -.powerbi-container iframe { - border: none; -} - -#reportslist { - margin: 0 0 1em 0; -} -#reportslist li { - margin: 1em 0; -} -.reportslistdescription { - margin: 1em 0 0 0; - font-weight: bold; -} -.report-name { - display: inline-block; - margin: 0 1em; - font-weight: bold; -} -.checkbox { - margin-left: 1em; -} - -.reportpageslist { - display: flex; - margin-top: 2em; -} -.reportpageslist__pages { - flex: 1; -} - -.reportpageslist__pages button { - margin-left: 1em; -} -.reportpageslist__pages button.btn-success.active { - background-color: red; -} -.reportpageslist__cycle { - margin-right: 1em; -} -.reportpageslist__cycle.btn-warning.active { - background-color: red; -} - -.filters > * + * { - margin-top: 1em; -} -.filter { - padding: 0.5em; - border: 1px solid #ddd; - border-radius: 4px; -} -.filter__remove { - float: right; -} -.filter__text { - margin-right: 3em; - word-break: break-all; - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - font-size: 90%; -} \ No newline at end of file diff --git a/demo/v2-demo/code_area.html b/demo/v2-demo/code_area.html deleted file mode 100644 index 1e181566..00000000 --- a/demo/v2-demo/code_area.html +++ /dev/null @@ -1,13 +0,0 @@ - -
Code
-
- - -
- -
-
\ No newline at end of file diff --git a/demo/v2-demo/docs.html b/demo/v2-demo/docs.html deleted file mode 100644 index 1307a7cc..00000000 --- a/demo/v2-demo/docs.html +++ /dev/null @@ -1,57 +0,0 @@ -
-
- -
-

Videos

-
- What is Power BI Embedded
- -
-
- Microsoft Power BI Embedded update
- -
-
- Get an embed token & embed your analytics
- -
-
- Setting up and getting started
- -
-
- Power BI Embedded JavaScript SDK
- -
-
- Extend context menu feature
- -
-
-
-
diff --git a/demo/v2-demo/images/AlignCenter.svg b/demo/v2-demo/images/AlignCenter.svg deleted file mode 100644 index bc78cb5e..00000000 --- a/demo/v2-demo/images/AlignCenter.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/AlignCenterGrey.svg b/demo/v2-demo/images/AlignCenterGrey.svg deleted file mode 100644 index 76f28641..00000000 --- a/demo/v2-demo/images/AlignCenterGrey.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/AlignLeft.svg b/demo/v2-demo/images/AlignLeft.svg deleted file mode 100644 index f47b6149..00000000 --- a/demo/v2-demo/images/AlignLeft.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/AlignLeftGrey.svg b/demo/v2-demo/images/AlignLeftGrey.svg deleted file mode 100644 index 26f7fc84..00000000 --- a/demo/v2-demo/images/AlignLeftGrey.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/AlignRight.svg b/demo/v2-demo/images/AlignRight.svg deleted file mode 100644 index f0d163e6..00000000 --- a/demo/v2-demo/images/AlignRight.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/AlignRightGrey.svg b/demo/v2-demo/images/AlignRightGrey.svg deleted file mode 100644 index 80f8ee60..00000000 --- a/demo/v2-demo/images/AlignRightGrey.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/EraseTool.svg b/demo/v2-demo/images/EraseTool.svg deleted file mode 100644 index d2d89534..00000000 --- a/demo/v2-demo/images/EraseTool.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/EraseToolGrey.svg b/demo/v2-demo/images/EraseToolGrey.svg deleted file mode 100644 index 2e1d3827..00000000 --- a/demo/v2-demo/images/EraseToolGrey.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/add.svg b/demo/v2-demo/images/add.svg deleted file mode 100644 index 6481c174..00000000 --- a/demo/v2-demo/images/add.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/demo/v2-demo/images/ajax-loader.gif b/demo/v2-demo/images/ajax-loader.gif deleted file mode 100644 index f40db398..00000000 Binary files a/demo/v2-demo/images/ajax-loader.gif and /dev/null differ diff --git a/demo/v2-demo/images/bookmarkIcon.svg b/demo/v2-demo/images/bookmarkIcon.svg deleted file mode 100644 index e9ae9764..00000000 --- a/demo/v2-demo/images/bookmarkIcon.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/clear.svg b/demo/v2-demo/images/clear.svg deleted file mode 100644 index 86f2bcf4..00000000 --- a/demo/v2-demo/images/clear.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/close.png b/demo/v2-demo/images/close.png deleted file mode 100644 index 0a1520af..00000000 Binary files a/demo/v2-demo/images/close.png and /dev/null differ diff --git a/demo/v2-demo/images/closeWhite.png b/demo/v2-demo/images/closeWhite.png deleted file mode 100644 index aa9cb92f..00000000 Binary files a/demo/v2-demo/images/closeWhite.png and /dev/null differ diff --git a/demo/v2-demo/images/collapse.svg b/demo/v2-demo/images/collapse.svg deleted file mode 100644 index 6e6d9d71..00000000 --- a/demo/v2-demo/images/collapse.svg +++ /dev/null @@ -1,45 +0,0 @@ - -collapse -Created using Figma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/copy.svg b/demo/v2-demo/images/copy.svg deleted file mode 100644 index 3d38c462..00000000 --- a/demo/v2-demo/images/copy.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/expand.svg b/demo/v2-demo/images/expand.svg deleted file mode 100644 index 62e1debf..00000000 --- a/demo/v2-demo/images/expand.svg +++ /dev/null @@ -1,57 +0,0 @@ - -expand -Created using Figma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/ic_1column.svg b/demo/v2-demo/images/ic_1column.svg deleted file mode 100644 index 12ffa519..00000000 --- a/demo/v2-demo/images/ic_1column.svg +++ /dev/null @@ -1 +0,0 @@ -ic_1column \ No newline at end of file diff --git a/demo/v2-demo/images/ic_2columns.svg b/demo/v2-demo/images/ic_2columns.svg deleted file mode 100644 index ffe6b2bd..00000000 --- a/demo/v2-demo/images/ic_2columns.svg +++ /dev/null @@ -1 +0,0 @@ -ic_2columns \ No newline at end of file diff --git a/demo/v2-demo/images/ic_3columns.svg b/demo/v2-demo/images/ic_3columns.svg deleted file mode 100644 index dd4e737c..00000000 --- a/demo/v2-demo/images/ic_3columns.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/info.svg b/demo/v2-demo/images/info.svg deleted file mode 100644 index b663a35f..00000000 --- a/demo/v2-demo/images/info.svg +++ /dev/null @@ -1,29 +0,0 @@ - -ic_info -Created using Figma - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/insightToActionIcon.svg b/demo/v2-demo/images/insightToActionIcon.svg deleted file mode 100644 index c678c87b..00000000 --- a/demo/v2-demo/images/insightToActionIcon.svg +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/layoutIcon.svg b/demo/v2-demo/images/layoutIcon.svg deleted file mode 100644 index 1e647cbe..00000000 --- a/demo/v2-demo/images/layoutIcon.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/new.svg b/demo/v2-demo/images/new.svg deleted file mode 100644 index 19e1f464..00000000 --- a/demo/v2-demo/images/new.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/demo/v2-demo/images/pc.svg b/demo/v2-demo/images/pc.svg deleted file mode 100644 index f7d3bc8d..00000000 --- a/demo/v2-demo/images/pc.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/phone.svg b/demo/v2-demo/images/phone.svg deleted file mode 100644 index 3fe20ed6..00000000 --- a/demo/v2-demo/images/phone.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/print.svg b/demo/v2-demo/images/print.svg deleted file mode 100644 index 362dc528..00000000 --- a/demo/v2-demo/images/print.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/quickVisualCreatorIcon.svg b/demo/v2-demo/images/quickVisualCreatorIcon.svg deleted file mode 100644 index a1600a87..00000000 --- a/demo/v2-demo/images/quickVisualCreatorIcon.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/images/reset.svg b/demo/v2-demo/images/reset.svg deleted file mode 100644 index 1987b5d8..00000000 --- a/demo/v2-demo/images/reset.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/run.svg b/demo/v2-demo/images/run.svg deleted file mode 100644 index 7a68c85b..00000000 --- a/demo/v2-demo/images/run.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/demo/v2-demo/images/sampledashboard.png b/demo/v2-demo/images/sampledashboard.png deleted file mode 100644 index f9539c7c..00000000 Binary files a/demo/v2-demo/images/sampledashboard.png and /dev/null differ diff --git a/demo/v2-demo/images/sampleqna.png b/demo/v2-demo/images/sampleqna.png deleted file mode 100644 index 3bfbfe22..00000000 Binary files a/demo/v2-demo/images/sampleqna.png and /dev/null differ diff --git a/demo/v2-demo/images/samplerdlreport.png b/demo/v2-demo/images/samplerdlreport.png deleted file mode 100644 index a4ff0af9..00000000 Binary files a/demo/v2-demo/images/samplerdlreport.png and /dev/null differ diff --git a/demo/v2-demo/images/samplereport.png b/demo/v2-demo/images/samplereport.png deleted file mode 100644 index 63e5239c..00000000 Binary files a/demo/v2-demo/images/samplereport.png and /dev/null differ diff --git a/demo/v2-demo/images/sampletile.png b/demo/v2-demo/images/sampletile.png deleted file mode 100644 index 40e53215..00000000 Binary files a/demo/v2-demo/images/sampletile.png and /dev/null differ diff --git a/demo/v2-demo/images/samplevisual.png b/demo/v2-demo/images/samplevisual.png deleted file mode 100644 index 9248945e..00000000 Binary files a/demo/v2-demo/images/samplevisual.png and /dev/null differ diff --git a/demo/v2-demo/images/share.png b/demo/v2-demo/images/share.png deleted file mode 100644 index e536f7f3..00000000 Binary files a/demo/v2-demo/images/share.png and /dev/null differ diff --git a/demo/v2-demo/images/tab_out.svg b/demo/v2-demo/images/tab_out.svg deleted file mode 100644 index 33de730c..00000000 --- a/demo/v2-demo/images/tab_out.svg +++ /dev/null @@ -1 +0,0 @@ -TAB OUT \ No newline at end of file diff --git a/demo/v2-demo/images/themesIcon.svg b/demo/v2-demo/images/themesIcon.svg deleted file mode 100644 index ba3532ad..00000000 --- a/demo/v2-demo/images/themesIcon.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/index.html b/demo/v2-demo/index.html deleted file mode 100644 index 5f51cadb..00000000 --- a/demo/v2-demo/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - -
-
-
Microsoft Power BI Embedded Playground
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.html b/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.html deleted file mode 100644 index 4bdfa4c9..00000000 --- a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.html +++ /dev/null @@ -1,67 +0,0 @@ -
-

Capture & share bookmarks

-
-
- By using bookmarks in Power BI, you can capture the current configured view of a report page, including filtering and the state of visuals.
- Use this showcase to experience the capabilities of the bookmarks API, so your users can create and share their own bookmarks.

-  1. Choose and Apply pre-defined bookmarks
-
- The menu on the left displays the report's existing bookmarks. You can switch between available bookmarks by clicking on the desired bookmark's name

-
-  2. Capture new bookmarks
-
- After interacting with the report (filtering, clicking on visuals etc), click on 'Capture bookmark', the captured bookmark will be added to the menu.

-
-  3. Share bookmarks with others
-
- Select the bookmark you want to share and then click the 'share' icon. Copy and paste the given URL into a new browser tab to see the embedded report - with the bookmark applied.
-
-
-
- Documentation - Get Code -
-
- -
-
-
Bookmarks
-
-
-
-
-
-
-
Embedded view
-
- -
-
-
-
-
-
- -
-
-
-
- -
-
-
-
Link to '' created
-
Make sure you copy the link below.
- -
Copy
-
-
- - \ No newline at end of file diff --git a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js b/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js deleted file mode 100644 index d69c9199..00000000 --- a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js +++ /dev/null @@ -1,303 +0,0 @@ - - -var BookmarkShowcaseState = { - bookmarksArray: null, - bookmarksReport: null, - - // Next bookmark ID counter - nextBookmarkId: 1 -} - -const dialogTextSelectTimeout = 50; - -// Embed the report and retrieve the existing report bookmarks -function embedBookmarksReport() { - - // Load sample report properties into session - return LoadSampleReportIntoSession().then(function () { - - // Get models. models contains enums that can be used - const models = window['powerbi-client'].models; - - // Get embed application token from session - var accessToken = GetSession(SessionKeys.AccessToken); - - // Get embed URL from session - var embedUrl = GetSession(SessionKeys.EmbedUrl); - - // Get report Id from session - var embedReportId = GetSession(SessionKeys.EmbedId); - - // Use View permissions - var permissions = models.Permissions.View; - - // Embed configuration used to describe the what and how to embed - // This object is used when calling powerbi.embed - // This also includes settings and options such as filters - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details - var config= { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: accessToken, - embedUrl: embedUrl, - id: embedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: true, - navContentPaneEnabled: false, - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container - BookmarkShowcaseState.bookmarksReport = powerbi.embed(embedContainer, config); - - // Report.on will add an event handler for report loaded event. - BookmarkShowcaseState.bookmarksReport.on("loaded", function() { - - // Get report's existing bookmarks - BookmarkShowcaseState.bookmarksReport.bookmarksManager.getBookmarks().then(function (bookmarks) { - - // Create bookmarks list from the existing report bookmarks - createBookmarksList(bookmarks); - }); - }); - }); -} - -// Embed shared report with bookmark on load -function embedSharedBookmark(enableFilterPane, bookmarkState) { - - // Load sample report properties into session - LoadSampleReportIntoSession().then(function () { - - // Get models. models contains enums that can be used - const models = window['powerbi-client'].models; - - // Get embed application token from session - var accessToken = GetSession(SessionKeys.AccessToken); - - // Get embed URL from session - var embedUrl = GetSession(SessionKeys.EmbedUrl); - - // Get report Id from session - var embedReportId = GetSession(SessionKeys.EmbedId); - - // Use View permissions - var permissions = models.Permissions.View; - - // Get the bookmark name from url param - var bookmarkName = GetBookmarkNameFromURL(); - - // Get the bookmark state from local storage - // any type of database can be used - var bookmarkState = localStorage.getItem(bookmarkName); - - // Embed configuration used to describe the what and how to embed - // This object is used when calling powerbi.embed - // This also includes settings and options such as filters - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details - var config= { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: accessToken, - embedUrl: embedUrl, - id: embedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: false, - navContentPaneEnabled: false, - }, - - // Adding bookmark attribute will apply the bookmark on load - bookmark: { - state: bookmarkState - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container - BookmarkShowcaseState.bookmarksReport = powerbi.embed(embedContainer, config); - }); -} - -// Create a bookmarks list from the existing report bookmarks and update the HTML -function createBookmarksList(bookmarks) { - - // Reset next bookmark ID - BookmarkShowcaseState.nextBookmarkId = 1; - - // Set bookmarks array to the report's fetched bookmarks - BookmarkShowcaseState.bookmarksArray = bookmarks; - - // Build the bookmarks list HTML code - var bookmarksList = $('#bookmarksList'); - for (let i = 0; i < BookmarkShowcaseState.bookmarksArray.length; i++) { - bookmarksList.append(buildBookmarkElement(BookmarkShowcaseState.bookmarksArray[i])); - } - - // Set first bookmark active - if (bookmarksList.length) { - let firstBookmark = $('#' + BookmarkShowcaseState.bookmarksArray[0].name); - - // Apply first bookmark state - onBookmarkClicked(firstBookmark[0]); - } -} - -// Capture new bookmark of the current state and update the bookmarks list -function onBookmarkCaptureClicked() { - - // Element clicked animation - elementClicked('#btnCaptureBookmark'); - - // Capture the report's current state - BookmarkShowcaseState.bookmarksReport.bookmarksManager.capture().then(function (capturedBookmark) { - - // Build bookmark element - let bookmark = { - name: "bookmark_" + BookmarkShowcaseState.nextBookmarkId, - displayName: "Bookmark " + BookmarkShowcaseState.nextBookmarkId, - state: capturedBookmark.state - } - - // Add the new bookmark to the HTML list - $('#bookmarksList').append(buildBookmarkElement(bookmark)); - - // Set the captured bookmark as active - setBookmarkActive($('#bookmark_' + BookmarkShowcaseState.nextBookmarkId)); - - // Add the bookmark to the bookmarks array and increase the bookmarks number counter - BookmarkShowcaseState.bookmarksArray.push(bookmark); - BookmarkShowcaseState.nextBookmarkId++; - }); -} - -// Set the bookmark as the active bookmark on the list -function setBookmarkActive(bookmarkSelector) { - - // Remove share boomark icon - $('#bookmarkShare').remove(); - - // Find bookmark parent node - let parentNode = (bookmarkSelector[0]).parentNode; - - // Add share bookmark icon to bookmark's line - $(parentNode).append(buildShareElement()); - - // Set bookmark radio button to checked - bookmarkSelector.attr('checked', true); -} - -// Closes the dialog -function onCloseDialogClicked() { - $('#overlay').hide(); - $('#shareDialog').hide(); -} - -// Copy the dialog's input text -function onDialogCopyClicked() { - CopyTextArea('#dialogInput', '#btnDialogCopy'); - $('#dialogInput').select(); -} - -// Apply clicked bookmark state and set it as the active bookmark on the list -function onBookmarkClicked(element) { - - // Set the clicked bookmark as active - setBookmarkActive($(element)); - - // Get bookmark Id from HTML - const bookmarkId = $(element).attr('id'); - - // Find the bookmark in the bookmarks array - let currentBookmark = getBookmarkByID(bookmarkId); - - // Apply the bookmark state - BookmarkShowcaseState.bookmarksReport.bookmarksManager.applyState(currentBookmark.state); -} - -// Open bookmark share dialog -function shareBookmark(element) { - - // Get bookmark Id from HTML - const bookmarkId = $($(element).siblings('input')).attr('id'); - - // Find the bookmark in the bookmarks array - let currentBookmark = getBookmarkByID(bookmarkId); - - // Build the share bookmark URL - let shareUrl = location.href.substring(0, location.href.lastIndexOf("/")) + '/shareBookmark.html' + '?name=' + currentBookmark.name; - - // Store bookmark state with name as a key on the local storage - // any type of database can be used - localStorage.setItem(currentBookmark.name, currentBookmark.state); - - // Set bookmark display name and share URL on dialog HTML code - $('#dialogBookmarkName').empty(); - var displayNameElement = document.createTextNode(currentBookmark.displayName); - $('#dialogBookmarkName').append(displayNameElement); - $('#dialogInput').val(shareUrl); - - // Show overlay and share dialog - $('#overlay').show(); - $('#shareDialog').show(); - - // Select dialog input after the dialog is shown - setTimeout(function() { - $('#dialogInput').select(); - }, dialogTextSelectTimeout); -} - -// Get the bookmark with bookmarkId name -function getBookmarkByID(bookmarkId) { - return jQuery.grep(BookmarkShowcaseState.bookmarksArray, function (bookmark) { return bookmark.name === bookmarkId })[0]; -} - -// Build bookmark radio button HTML element -function buildBookmarkElement(bookmark) { - var labelElement = document.createElement("label"); - labelElement.setAttribute("class", "showcaseRadioContainer"); - - var inputElement = document.createElement("input"); - inputElement.setAttribute("type", "radio"); - inputElement.setAttribute("name", "bookmark"); - inputElement.setAttribute("id", bookmark.name); - inputElement.setAttribute("onclick", "onBookmarkClicked(this);"); - labelElement.appendChild(inputElement); - - var spanElement = document.createElement("span"); - spanElement.setAttribute("class", "showcaseRadioCheckmark"); - labelElement.appendChild(spanElement); - - var secondSpanElement = document.createElement("span"); - secondSpanElement.setAttribute("class", "radioTitle"); - var radioTitleElement = document.createTextNode(bookmark.displayName); - secondSpanElement.appendChild(radioTitleElement); - labelElement.appendChild(secondSpanElement); - - return labelElement; -} - -// Build share icon HTML element -function buildShareElement() { - var imgElement = document.createElement("img"); - imgElement.setAttribute("src","images/share.png"); - imgElement.setAttribute("id","bookmarkShare"); - imgElement.setAttribute("onclick","shareBookmark(this);"); - return imgElement; -} - -// Get the bookmark name from url 'name' argument -function GetBookmarkNameFromURL() { - url = window.location.href; - let regex = new RegExp("[?&]name(=([^&#]*)|&|#|$)"), - results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2]); -} diff --git a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.html b/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.html deleted file mode 100644 index aa82e8a4..00000000 --- a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.html +++ /dev/null @@ -1,54 +0,0 @@ -
-

Dynamic report layout

-
-
- Use this showcase to learn the custom layout API for dynamic embedding of visuals.

-  1. Select the visuals from the menu on the left
-
- The configuration of each visual changes between 'Hide'/'Show', and the app dynamically calculates the position of each visual (see code) for each layout. Default view has all visuals selected.

-
-  2. Change the layout to fit different screens
-
- By choosing different layouts, the application sets size and position of each visual (see code),
- In this showcase, we show options of 3 columns, 2 columns and 1 column to fit different screen sizes.
-
-
-
- Documentation - Get Code -
-
- -
-
-
Report visuals (Hide/Show)
-
-
-
-
-
-
-
Embedded view
-
- - - -
-
-
-
-
-
- - diff --git a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.js b/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.js deleted file mode 100644 index f9660f83..00000000 --- a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.js +++ /dev/null @@ -1,283 +0,0 @@ - -const ColumnsNumber = { - One: 1, - Two: 2, - Three: 3 -} - -const LayoutShowcaseConsts = { - margin: 15, - minPageWidth: 270 -} - -var LayoutShowcaseState = { - columns: ColumnsNumber.Three, - layoutVisuals: null, - layoutReport: null, - layoutPageName: null -} - -// Embed the report and retrieve all report visuals -function embedCustomLayoutReport() { - // Defualt columns value is three columns - LayoutShowcaseState.columns = ColumnsNumber.Three; - - // Load custom layout report properties into session - LoadLayoutShowcaseReportIntoSession().then(function () { - - // Get models. models contains enums that can be used - const models = window['powerbi-client'].models; - - // Get embed application token from session - var accessToken = GetSession(SessionKeys.AccessToken); - - // Get embed URL from session - var embedUrl = GetSession(SessionKeys.EmbedUrl); - - // Get report Id from session - var embedReportId = GetSession(SessionKeys.EmbedId); - - // Use View permissions - var permissions = models.Permissions.View; - - // Embed configuration used to describe the what and how to embed - // This object is used when calling powerbi.embed - // This also includes settings and options such as filters - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details - var config= { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: accessToken, - embedUrl: embedUrl, - id: embedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: false, - navContentPaneEnabled: false - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container - LayoutShowcaseState.layoutReport = powerbi.embed(embedContainer, config); - - // Report.on will add an event handler for report loaded event - LayoutShowcaseState.layoutReport.on("loaded", function() { - - // After report is loaded, we find the active page and get all the visuals on it - // Retrieve the page collection - LayoutShowcaseState.layoutReport.getPages().then(function (pages) { - - // Retrieve active page - let activePage = jQuery.grep(pages, function (page) { return page.isActive })[0]; - - // Set layoutPageName to active page name - LayoutShowcaseState.layoutPageName = activePage.name; - - // Retrieve active page visuals. - activePage.getVisuals().then(function (visuals) { - var reportVisuals = visuals.map(function (visual) { - return { - name: visual.name, - title: visual.title, - checked: true - }; - }); - - // Create visuals array from the visuals of the active page - createVisualsArray(reportVisuals); - }); - }); - }); - }); -} - -// Create visuals array from the report visuals and update the HTML -function createVisualsArray(reportVisuals) { - - // Remove all visuals without titles (i.e cards) - LayoutShowcaseState.layoutVisuals = reportVisuals.filter(function (visual) { - return visual.title !== undefined; - }); - - // Clear visuals list div - $('#visualsList').empty(); - - // Build checkbox html list and insert the html code to visualsList div - for (let i = 0; i < LayoutShowcaseState.layoutVisuals.length; i++) { - $('#visualsList').append(buildVisualElement(LayoutShowcaseState.layoutVisuals[i])); - } - - // Render all visuals - renderVisuals(); -} - -// Render all visuals with current configuration -function renderVisuals() { - - // render only if report and visuals initialized - if (!LayoutShowcaseState.layoutReport || !LayoutShowcaseState.layoutVisuals) - return; - - // Get models. models contains enums that can be used - const models = window['powerbi-client'].models; - - // Get embedContainer width and height - let pageWidth = $('#embedContainer').width(); - let pageHeight = $('#embedContainer').height(); - - // Calculating the overall width of the visuals in each row - let visualsTotalWidth = pageWidth - (LayoutShowcaseConsts.margin * (LayoutShowcaseState.columns + 1)); - - // Calculate the width of a single visual, according to the number of columns - // For one and three columns visuals width will be a third of visuals total width - let width = (LayoutShowcaseState.columns === ColumnsNumber.Two) ? (visualsTotalWidth / 2) : (visualsTotalWidth / 3); - - // For one column, set page width to visual's width with margins - if (LayoutShowcaseState.columns === ColumnsNumber.One) { - pageWidth = width + 2 * LayoutShowcaseConsts.margin; - - // Check if page width is smaller than minimum width and update accordingly - if (pageWidth < LayoutShowcaseConsts.minPageWidth) { - pageWidth = LayoutShowcaseConsts.minPageWidth; - - // Visuals width is set to fit minimum page width with margins on both sides - width = LayoutShowcaseConsts.minPageWidth - 2 * LayoutShowcaseConsts.margin; - } - } - - // Set visuals height according to width - 9:16 ratio - const height = width * (9 / 16); - - // Visuals starting point - let x = LayoutShowcaseConsts.margin, y = LayoutShowcaseConsts.margin; - - // Filter the visuals list to display only the checked visuals - let checkedVisuals = LayoutShowcaseState.layoutVisuals.filter(function (visual) { return visual.checked; }); - - // Calculate the number of lines - const lines = Math.ceil(checkedVisuals.length / LayoutShowcaseState.columns); - - // Calculate page height with margins - pageHeight = Math.max(pageHeight, ((lines * height) + ((lines + 1) * LayoutShowcaseConsts.margin))); - - // Building visualsLayout object - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Custom-Layout - let visualsLayout = {}; - for (let i = 0; i < checkedVisuals.length; i++) { - visualsLayout[checkedVisuals[i].name] = { - x: x, - y: y, - width: width, - height: height, - displayState: { - - // Change the selected visuals display mode to visible - mode: models.VisualContainerDisplayMode.Visible - } - } - - // Calculating (x,y) position for the next visual - x += width + LayoutShowcaseConsts.margin; - if (x + width > pageWidth) { - x = LayoutShowcaseConsts.margin; - y += height + LayoutShowcaseConsts.margin; - } - } - - // Building pagesLayout object - let pagesLayout = {}; - pagesLayout[LayoutShowcaseState.layoutPageName] = { - defaultLayout: { - displayState: { - - // Default display mode for visuals is hidden - mode: models.VisualContainerDisplayMode.Hidden - } - }, - visualsLayout: visualsLayout - }; - - // Building settings object - let settings = { - layoutType: models.LayoutType.Custom, - customLayout: { - pageSize: { - type: models.PageSizeType.Custom, - width: pageWidth - 10, - height: pageHeight - 20 - }, - displayOption: models.DisplayOption.FitToPage, - pagesLayout: pagesLayout - } - }; - - // If pageWidth or pageHeight is changed, change display option to actual size to add scroll bar - if (pageWidth !== $('#embedContainer').width() || pageHeight !== $('#embedContainer').height()) { - settings.customLayout.displayOption = models.DisplayOption.ActualSize; - } - - // Change page background to transparent on Two / Three columns configuration - settings.background = (LayoutShowcaseState.columns === ColumnsNumber.One) ? models.BackgroundType.Default : models.BackgroundType.Transparent; - - // Call updateSettings with the new settings object - LayoutShowcaseState.layoutReport.updateSettings(settings); -} - -// Update the visuals list with the change and rerender all visuals -function onCheckboxClicked(checkbox) { - let visual = jQuery.grep(LayoutShowcaseState.layoutVisuals, function (visual) { return visual.name === checkbox.value })[0]; - visual.checked = $(checkbox).is(':checked'); - renderVisuals(); -}; - -// Update columns number and rerender the visuals -function onColumnsClicked(num) { - LayoutShowcaseState.columns = num; - setColumnButtonActive(num); - renderVisuals(); -} - -// Build visual checkbox HTML element -function buildVisualElement(visual) { - var labelElement = document.createElement("label"); - labelElement.setAttribute("class", "checkboxContainer checked"); - - var inputElement = document.createElement("input"); - inputElement.setAttribute("type", "checkbox"); - inputElement.setAttribute("id", 'visual_' + visual.name); - inputElement.setAttribute("value", visual.name); - inputElement.setAttribute("onclick", "onCheckboxClicked(this);"); - inputElement.setAttribute("checked", "true"); - labelElement.appendChild(inputElement); - - var spanElement = document.createElement("span"); - spanElement.setAttribute("class", "checkboxCheckmark"); - labelElement.appendChild(spanElement); - - var secondSpanElement = document.createElement("span"); - secondSpanElement.setAttribute("class", "checkboxTitle"); - var checkboxTitleElement = document.createTextNode(visual.title); - secondSpanElement.appendChild(checkboxTitleElement); - labelElement.appendChild(secondSpanElement); - - return labelElement; -} - -// Set clicked columns button active -function setColumnButtonActive(num) { - const active_btn_class = "active-columns-btn"; - $('#btnOneCol').removeClass(active_btn_class); - $('#btnTwoCols').removeClass(active_btn_class); - $('#btnThreeCols').removeClass(active_btn_class); - - if (num === ColumnsNumber.Three) { - $('#btnThreeCols').addClass(active_btn_class); - } else if (num === ColumnsNumber.Two) { - $('#btnTwoCols').addClass(active_btn_class); - } else { - $('#btnOneCol').addClass(active_btn_class); - } -} diff --git a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.html b/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.html deleted file mode 100644 index 9aa9384d..00000000 --- a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.html +++ /dev/null @@ -1,115 +0,0 @@ -
-
- -
-
Start a campaign with these customers
-
Hover over the table, and click on the three dots icon '...' at the upper right corner.
-
-
- Next -
-
- 1 of 2 -
-
-
- -
-

Insight to action

-
-
- This showcase demonstrates one example of how to leverage the ‘menu extensions’ and ‘export data’ APIs to give users the ability to take meaningful actions within seconds from analytics. The sample contains a basic customer relationship management module. The main table shows a list of customers who have not engaged with your service lately, and might not return. You can send these customers an offer to try and retain them.

-  1. Choose a list of customers
-
- The sales report shows a list of possible churning customers. Use the slicers to define the list of customers you want to engage with.

-
-  2. Take actions to get them engaged
-
- Follow the instructions on the tooltips to take actions straight from within the report.
-
-
-
- Documentation - Get Code -
-
- -
-
-
Embedded view
-
-
-
-
-
- Campaign distribution list - - - -
-
-
-
-
-
- Send coupon -
-
- Send discount -
-
- Cancel -
-
-
-
- -
-
Send offer
-
Choose the customers and send them an offering
-
-
- Got it -
-
-
-
-
-
- - - - -
-
-
-
Title
- -
-
-
Body
- -
-
-
-
- Cancel -
-
- Send -
-
-
-
Sent
-
-
-
- - - - \ No newline at end of file diff --git a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.js b/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.js deleted file mode 100644 index 9b43fc5b..00000000 --- a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.js +++ /dev/null @@ -1,342 +0,0 @@ -let InsightToActionShowcaseState = { - report: null, - data: null, - allChecked: false, - tooltipNextPressed: false, -} - -const dialogTooltipTimeout = 1500; -const sentMessageTimeout = 3000; - -// Embed the report and retrieve the existing report bookmarks -function embedInsightsToActionReport() { - InsightToActionShowcaseState.tooltipNextPressed = false; - - // Load sample report properties into session - return LoadInsightToActionShowcaseReportIntoSession().then(function () { - - // Get models. models contains enums that can be used - const models = window['powerbi-client'].models; - - // Get embed application token from session - let accessToken = GetSession(SessionKeys.AccessToken); - - // Get embed URL from session - let embedUrl = GetSession(SessionKeys.EmbedUrl); - - // Get report Id from session - let embedReportId = GetSession(SessionKeys.EmbedId); - - // Use View permissions - let permissions = models.Permissions.View; - - // Icon for the custom extension - const base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMQAAAC2CAMAAAHGleIFAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIHUExURQAAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRcXFxkZGRwcHB0dHSEhISQkJCUlJSYmJikpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkhISE1NTVFRUWlpaWxsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3V1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4GBgYKCgoODg4SEhIWFhYaGhoiIiImJiYqKiouLi4yMjI6OjpCQkJKSkpSUlJaWlpeXl5iYmJqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaOjo6SkpKWlpaampqenp6mpqaqqqqurq6ysrK2tra6urq+vr7CwsLOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+vsDAwMTExMbGxsnJycrKyszMzM7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dvb29zc3N3d3d7e3t/f3+Dg4OHh4eLi4uPj4+Tk5OXl5ebm5ufn5+jo6Onp6erq6uvr6+zs7O3t7e7u7s8u/7wAAAABdFJOUwBA5thmAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAJwklEQVR4Xu2diX8dRR3A329mdvZ4SZO2HCIIaigVTZtCUyAqHsWjglWkiOKFLWpbsVZFsdRbvKtoUSlpmkBBsVX/SH+/2d97b3ffHrNX0vqZbz7Jm2N3jt8xO7s78zLYSi4BB9JsiNDjYJINoeCLg6lTKPlL+LmQzhklI8nCNgDgyxweTAq7IjCdfhmZKOy4FrDBYSTgz5hk5lTTxpkwNPEUnJkubgRlThU34ri+kUOODII/04AHmoMJwFMwgA9ybIRJpU8TGzFKRRIlpexEjEoydqRiOzJwOhL4IhFLWlUq73C2G+M8Zf6miPP8VFkjKC9fJJTHAcfW8jLZyAGOVGCONbaVP24kGR37uIkVDydE+liDkPdzKEPOsYa7c9pkjgXwHuN4muk2PSXjE7B8mcNOmeMAxIn4vOgVjk/wYAeH8sg9T8A/OVRI5rxD5dKdMDlvWNquLOY8i3ZlOZEz7jkc/5fsg99wyIoHALSl2xJLGl1w3tbRqXTQGmce3m85pRRTOqi5weDbNo3i0uMjcWQwn8VMSo8BVdqoVOmG74HkUA7Z0g2YwqEs06XHFEiKSkc5znM0wdm8KkzpRZX7KiupxfGsPzH7TyDhZ3zkmBnOAuHxZSkFwKN8YBJzPPiLHE2hogLh+uas4G0cnbBeYiMFNQF8nkN55NUUFGqQmappveoMJFMTwCMcKiNZkx+UmGKScU2XLZo1Iq4JKZNWFlNTjUoM9c9A/Ic54HA4HI5+WL1nD4d64Oo+cwNdf/i3YXU3lkxXJA0B/IITu4JajmzDa6TAuS12w/LBhQ3jloMI6fOzdJH0ko9iW5BouU/Cf4LT3xmAr3/MkabktHzCaUxW7+dIA4pangCnqQ2tqbTlCZYEVv1rjthi0fIJP8Q+1LEm25YnsLcmbjkRoRvZFG7YC6ramlItn4AuJSSoCvAGIyy3pqNDgGGyYELo6qJHaIVtsXjU9BSXzdBwYMsQsIE3cTmVfJXu6EyPhK8k7Pozp5fzUdRb7r1YMdgjhXaKdZBDRe9Y5fRC5kF7cJEjNajRo1UpPL2dI7Wx69Eh9E75aY40o7JHkpzvHxxpQUmPLlH1N3OkNfk9+hQl1LOqKjI9uuPvQUOrqmLSI6SNVVUxGhlaW1UVpkf9zKPSnPwvBxwOh8PhcDgcju45pV/iUD98He/x+5w2nwBFd9+lD3za8DV6/qho7v8mp3TLqZvjxxl0Q9aHnJ4WWDzVQF2IppZStQbljwUrH8sXWEEI8irndEMsf5RPQAtVYds8SBFyXhdM5E8rBWDhj4ODFP0cZ7dmLH/UAHbglt9RIvYngDWT35aE/JHgzhfj5Mt0S7wzDrciI//bJg9BPkQVtranafkniDxPwOscaUZW/n/gdGYtRMeb4UgTCuSf4BOWz4zzKZZ/Ap8eub7GkXqUyn/C3zQe1WQxeIX8E3xcNhmfquWfQEHt8clK/hMugqw3PlnKP8FBuqJaj09G/gQ2Hzvw1nOcXooQQ9vxieVvqghhuPAnTq/gwgz22GZ8msjfVHH7Xzm9miPUoEp7ysgfUTBHkkKXQqcqx7xcKR+fjoXgCbKcJLG47PBAlz5ofm3JA1ooxmpmFEa5kZVgv+V9XFoRa/SaKt0ND4TilWiV0DuoqqWDyCv3wM648Bha1WgNGbrVW+h/r9AmC+y10UsEj9o+cT1DFrLCkSou3xvbE7ZKDFEZlo+nQeioxn6JSw9iFbFe8O82q/FzES958gWOWEF6UVi+EgIvyDNwhNML+Q45RsGq/kJq6gU74TWYMdfRC70+hV9ypBbWenkOW6KWOVIXS70IurngcANs9LJPKpBTC1jrUKmX52cxZz9HmlKhFxgOIW9HYE3K9LJEg/8ZjrSiUC/fJ33bjlNVFOjF07XGqSry9LKIkXrjVBVZvXzlJC25qDtOVZHWC3WiyThVRUIvMY3GqSoSemkxTlUxuu63G6eqGOvlp5zQC7Fe3suxviC9cLBHztnPth0Oh8PhcDgcDofD4XA4HA6HI8v50+cGg+t3y8ubx/dIAfKTHL3euPL0Xnq6T13QB3K/2O+aZv2bKwBRJCS9BfFCraNOXxf1zdrR+4e0hEQoIbWglxOgfT1r8w7/WsDYPq0loF+gN2oACg1JA9z4QLtVe5sB2r4fhvSyBuVObZeojKEfoC3RizsBN/T6nqgtY9ufC4SI1y7Rq0BP++TQEQZDCWHHG0i7I2P7WtO7Pxmi3D20Jf32Iy8+MwewgzaIyx6/IKMp+bZvFlqoEOSuJ+NV9a++GwT2EQLP7svZNos82w8CkL6k96Nq4ZHkMsSHzHo16tq1YkyFti887YFaPDy1xvOMWUqmUBMrW3+Zq7D9257IX3q5sYA9JYOD7V1/20otLG0/n0PUcVSGql5E1hO1bD+Xs7PG3pSU913ipM2jvu3ncmGPkD6dKOZ/zkmbQkPbzweNCRWIMhCd7deooJXt5/IjtEIaX2Hb3v6Nqb3t57K+hLcQWFzfc6aObD+fj6FV9jtn6tT2c/mB70PQ15ype9vP5eVlUkT3c6aU7ccoWpceRRCgMnYdtty6YMVHAGbib1npyphybD9GmHWZdz38Lz6wM54BPZS0/aKLOVOh7ceoMPQ8s42J1mdinWTDw2Gim00JJA0RbedM5bbPCBVnUSZIhU5tAmRk7UBZUOnN50xXj+1DScSCwJZhV8Y+kI9CZXWPDD3w9zfbqGZYPbq83UhVRMZ1KViEF1b0sRmh2Yh0S+vr3PlTu94iwYtiI8lFRdgDM+HvHoGagAe5LS25fHKZS50GPeLOx/tYRnoooClLiD91vkC5ije+saxix1ZRhP4S+woZEqpBwl1P/oUP7IaX7hZkADhg3PoTTuqM14/txZldMDv2lZDcReMfGp+GN3zh93xga56jB2Ye4JCx0s8m+fPPJnxFR9ps+WdwVLv1yPR/46jPh8maNPlbn3em5Cs0VZbaXEMYs0mT9uzd/tgFPrAZF9+DMzG6NMmben9G0J+vnDaapn2fH2hxsahBL76CBkVzAa2sduV1Rce+sv4uo2Ccus3+ipM2je585bsojSGEqI73XeGkzaUTX3mIJjwaC5Fb+Yqopa+s7SZzwp6LnZ1f8urS3FfOenixoH6rA29w0tbSyFcO0vMTunTLz3DKtUBNX3l1t3kKhL3ufg7VFntf+RbM0D7B/uZQban2lf/QYw9N0/Ke51BtKfMV7J6GOYpvyhyqLfm+Qs2P2cQ5VFumfIXZgjlUW1K+YtiyOVRb0vf2WzqHakvGV/L/U+T1wdhX1POcct1y/tl7d+zv5rvQHA6Hw+FwOBwOh8PhcDgcDisGg/8BZ7ROEYqjzQsAAAAASUVORK5CYII=" - - // Table visual name - const tableVisualName = "1149606f2a101953b4ba"; - - // Embed configuration used to describe the what and how to embed - // This object is used when calling powerbi.embed - // This also includes settings and options such as filters - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details - let config= { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: accessToken, - embedUrl: embedUrl, - id: embedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: false, - navContentPaneEnabled: false, - - // Adding the extension command to the options menu - extensions: [ - { - command: { - name: "campaign", - title: "Start campaign", - icon: base64Icon, - selector: { - $schema: "http://powerbi.com/product/schema#visualSelector", - visualName: tableVisualName - }, - extend: { - visualOptionsMenu: { - title: "Start campaign", - menuLocation: models.MenuLocation.Top, - } - } - } - }, - ], - - // Hiding built-in commands on the options menu - commands: [ - { - spotlight: { - selector: { - visualName: tableVisualName - }, - displayOption: models.CommandDisplayOption.Hidden, - }, - exportData: { - selector: { - visualName: tableVisualName - }, - displayOption: models.CommandDisplayOption.Hidden, - }, - seeData: { - selector: { - visualName: tableVisualName - }, - displayOption: models.CommandDisplayOption.Hidden, - }, - } - ] - }, - }; - - // Get a reference to the embedded report HTML element - let embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container - InsightToActionShowcaseState.report = powerbi.embed(embedContainer, config); - InsightToActionShowcaseState.report.on("rendered", function() { - setTooltipPosition(); - $('#startTooltip').addClass("showTooltip"); - - // Remove event handler, thus, the tooltip will appear only once - InsightToActionShowcaseState.report.off("rendered"); - }); - - // Report.on will add an event handler to commandTriggered event which prints to console window. - InsightToActionShowcaseState.report.on("commandTriggered", function(event) { - if (event.detail.command === "campaign") { - InsightToActionShowcaseState.report.getPages() - .then(function (pages) { - - // Retrieve active page. - let activePage = pages.filter(function(page) { - return page.isActive - })[0]; - - // Get page's visuals - activePage.getVisuals() - .then(function (visuals) { - - // Retrieve the wanted visual. - let visual = visuals.filter(function(visual) { - return visual.name === tableVisualName; - })[0]; - - // Exports visual data - visual.exportData(models.ExportDataType.Underlying).then(handleExportData); - }); - }); - } - }); - }); -} - -// Handles the export data API result -function handleExportData(result) { - - // Parse the recieved data from csv to 2d array - let resultData = parseData(result.data); - - // Filter the unwanted columns - InsightToActionShowcaseState.data = filterTable(["Latest purchase - Category", "Total spend", "Days since last purchase"], resultData); - - // Create a table from the 2d array - let table = createTable(InsightToActionShowcaseState.data) - - // Clear the div - $("#dialogTable").empty(); - - // Add the table to the dialog - $("#dialogTable").append(table) - - // Hide the tooltip - $('#startTooltip').removeClass("showTooltip"); - - // Show the dialog - $('#dialogMask').show(); - $('#distributionDialog').show(); - - // Shows dialog tooltip after a short delay - setTimeout(function() { - $('#dialogTooltip').addClass("showTooltip"); - }, dialogTooltipTimeout); -} - -// Parse the data from the API -function parseData(data) { - let result = []; - data.split("\n").forEach(function(row) { - if (row !== "") { - let rowArray = []; - row.split(",").forEach(function(cell) { - rowArray.push(cell); - }); - - result.push(rowArray); - } - }); - - return result; -} - -// Filter the table's data - removing the 'filterValues' columns -function filterTable(filterValues, table) { - for (let i = 0; i < filterValues.length; i++) { - valueIndex = table[0].indexOf( - table[0].filter(function(value) { return value === filterValues[i] })[0] - ); - - for (let j = 0; j < table.length; j++) { - table[j].splice(valueIndex, 1); - } - } - - return table; -} - -// Handles tooltip click action -function onTootipClicked(tooltipId) { - if ( tooltipId === "closeTooltip"){ - $('#startTooltip').hide(); - } else if (!InsightToActionShowcaseState.tooltipNextPressed && tooltipId === "startTooltip") { - let newText = document.createTextNode("Then, click `Start campaign` menu command."); - let startTooltipSubText = $('#startTooltip .showcaseTooltipSubText'); - const textOldHeight = startTooltipSubText[0].offsetHeight; - startTooltipSubText.empty(); - startTooltipSubText.append(newText); - startTooltipSubText[0].setAttribute("style", "height: " + textOldHeight + "px;"); - - let newTooltipNumber = document.createTextNode("2 of 2"); - $('#startTooltip .tooltipNumber').empty(); - $('#startTooltip .tooltipNumber').append(newTooltipNumber); - - let newBtnText = document.createTextNode("Got it"); - $('#startTooltip .btnShowcaseTooltip').empty(); - $('#startTooltip .btnShowcaseTooltip').append(newBtnText); - - InsightToActionShowcaseState.tooltipNextPressed = true; - } else { - $('#' + tooltipId).hide(); - } -} - -// Closes the dialog -function onCloseDialog(id) { - $('#dialogTooltip').hide(); - $('#dialogMask').hide(); - $('#' + id).hide(); -} - -// Open the send coupon/discount dialog -function onSendClicked(name) { - let headerText = document.createTextNode("Send " + name + " to distribution list"); - $('#sendDialog .dialogHeaderText').empty(); - $('#sendDialog .dialogHeaderText').append(headerText); - - const promotionToSend = name === "coupon" ? "30$ coupon" : "10% discount"; - let bodyText = "Hi , get your " + promotionToSend + " today!"; - $('#sendDialog textarea').val(bodyText); - - $('#dialogTooltip').hide(); - $('#distributionDialog').hide(); - $('#sendDialog').show(); -} - -// Closes the send dialog and shows the 'Sent' message -function onSendDialogSendClicked() { - $('#sendDialog').hide(); - $('#dialogMask').hide(); - $('#messageSent').addClass("show"); - - setTimeout(function() { - $('#messageSent').removeClass("show"); - }, sentMessageTimeout); -} - -// Build the HTML table from the data -function createTable(tableData) { - let table = document.createElement('table'); - let tableBody = document.createElement('tbody'); - let rowIndex = 0; - - // Set all checked to true, for check all table button - InsightToActionShowcaseState.allChecked = true; - - tableData.forEach(function(rowData) { - let row = document.createElement('tr'); - - // Add ✓ or checkbox - if (rowIndex === 0) { - let cell = document.createElement('th'); - cell.setAttribute("onclick","onCheckAllClicked();"); - cell.setAttribute("class", "checkAllBtn"); - cell.appendChild(document.createTextNode('✓')); - row.appendChild(cell); - } else { - let cell = document.createElement('td'); - let checkboxElement = document.createElement("input"); - checkboxElement.setAttribute("type", "checkbox"); - checkboxElement.setAttribute("name", "tableRowCheckbox"); - checkboxElement.setAttribute("id", "row" + rowIndex); - checkboxElement.checked = true; - cell.appendChild(checkboxElement); - row.appendChild(cell); - } - - let isNameCell = true; - rowData.forEach(function(cellData) { - let cell; - if (rowIndex !== 0) { - cell = document.createElement('td'); - if (isNameCell) { - cell.setAttribute("class", "nameCell"); - isNameCell = false; - } - } else { - cell = document.createElement('th'); - } - - cell.appendChild(document.createTextNode(cellData)); - row.appendChild(cell); - }); - - tableBody.appendChild(row); - rowIndex++; - }); - - table.appendChild(tableBody); - - return table; -} - -// Check/Uncheck all the customers on the table -function onCheckAllClicked() { - let checkboxes = document.getElementsByName("tableRowCheckbox"); - for (let i = 0; i < checkboxes.length; i++) { - checkboxes[i].checked = !InsightToActionShowcaseState.allChecked; - } - - InsightToActionShowcaseState.allChecked = !InsightToActionShowcaseState.allChecked; -} - -// Calculate and set the tooltip position -function setTooltipPosition() { - let startTooltip = document.getElementById("startTooltip"); - let embedContainer = document.getElementById('embedContainer'); - let textHeight = document.getElementById('showcases-text').offsetHeight; - let containerHeight = embedContainer.offsetWidth * 0.56; - - // Calculate the tooltip position relatively - const top = textHeight + 64 + ((embedContainer.offsetHeight - containerHeight) / 2) - startTooltip.offsetHeight + (0.05 * embedContainer.offsetHeight); - const left = (embedContainer.offsetWidth - 10) * 0.971 - 125; - startTooltip.setAttribute("style", "top: " + top + "px; left: " + left + "px;"); -} \ No newline at end of file diff --git a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.html b/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.html deleted file mode 100644 index b77b94f4..00000000 --- a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.html +++ /dev/null @@ -1,192 +0,0 @@ -
-

Quick visual creator

-
-
- This showcase demonstrates one example of how you can leverage our visual APIs to quickly generate and personalize a visual.
- This is useful for quickly importing a visual into a presentation or email without having any prior Power BI experience,
- and for quick ad-hock analytics which can then be saved. Additionally, you can implement your own method for sharing or exporting the visual.

-
- 1. Choose the visual type from the dropdown list
-
Note: On this showcase we only provide a subset of the available visual types.

- 2. Select the fields to define the data for displaying in your visual

- 3. Use the 'Properties' to personalize your visual

- 4. You can use the 'Print' button to export the visual to PDF
-
-
- -
- -
-
-
Generator
-
-
-
- Visual Type -
-
- -
-
-
-
- Fields -
-
- Axis: -
- -
-
-
- Legend: -
- -
-
-
- Value: -
- -
-
- -
-
- -
- Properties -
-
- Legend: - -
-
- X Axis: - -
-
- Y Axis: - -
-
- Title: - -
- -
- Personalized Title: -
- - -
- -
-
- -
-
-
-
- -
- Title alignment: -
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
-
-
-
-
-
-
-
Visual view
-
- - -
-
-
- -
- Loading showcase... -
-
-
-
-
-
- - \ No newline at end of file diff --git a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.js b/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.js deleted file mode 100644 index 4348b719..00000000 --- a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.js +++ /dev/null @@ -1,638 +0,0 @@ -let VisualCreatorShowcaseState = { - report: null, - page: null, - visual: null, - visualType: null, - dataRoles: { - Legend: null, - Values: null, - Value: null, - Axis: null, - Tooltips: null, - 'Y Axis': null, - Category: null, - Breakdown: null, - }, - dataFieldsCount: 0, - properties: { - legend: true, - xAxis: true, - yAxis: true, - title: true, - titleText: null, - titleAlign: null - }, -} - -// Define the available data roles for the visual types -const visualTypeToDataRoles = [ - { name: 'pieChart', displayName: 'Pie chart', dataRoles: ['Legend', 'Values', 'Tooltips'] }, - { name: 'columnChart', displayName: 'Column chart', dataRoles: ['Axis', 'Values', 'Tooltips'] }, - { name: 'areaChart', displayName: 'Area chart', dataRoles: ['Axis', 'Legend', 'Values'] }, - { name: 'waterfallChart', displayName: 'Waterfall Chart', dataRoles: ['Category', 'Breakdown', 'Values'] }, -]; - -// Define the available fields for each data role -const dataRolesToFields = [ - { dataRole: 'Legend', Fields: ['State', 'Region', 'Manufacturer'] }, - { dataRole: 'Values', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] }, - { dataRole: 'Axis', Fields: ['State', 'Region', 'Manufacturer'] }, - { dataRole: 'Value', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] }, - { dataRole: 'Y Axis', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] }, - { dataRole: 'Tooltips', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] }, - { dataRole: 'Category', Fields: ['State', 'Region', 'Date'] }, - { dataRole: 'Breakdown', Fields: ['State', 'Region', 'Manufacturer'] }, -]; - -// Define schemas for visuals API -const schemas = { - column: 'http://powerbi.com/product/schema#column', - measure: 'http://powerbi.com/product/schema#measure', - property: 'http://powerbi.com/product/schema#property', -}; - -// Define mapping from fields to target table and column/measure -const dataFieldsTargets = { - State: { column: 'State', table: 'Geo', schema: schemas.column }, - Region: { column: 'Region', table: 'Geo', schema: schemas.column }, - District: { column: 'District', table: 'Geo', schema: schemas.column }, - Manufacturer: { column: 'Manufacturer', table: 'Manufacturer', schema: schemas.column }, - TotalUnits: { measure: 'Total Units', table: 'SalesFact', schema: schemas.measure }, - TotalCategoryVolume: { measure: 'Total Category Volume', table: 'SalesFact', schema: schemas.measure }, - TotalCompeteVolume: { measure: 'Total Compete Volume', table: 'SalesFact', schema: schemas.measure }, - Date: { measure: 'Date', table: 'Date', schema: schemas.measure }, -}; - -// Define the available -const showcaseProperties = ['legend', 'xAxis', 'yAxis']; -const visualTypeProperties = { - pieChart: ['legend'], - columnChart: ['xAxis', 'yAxis'], - areaChart: ['legend', 'xAxis', 'yAxis'], - waterfallChart: ['legend', 'xAxis', 'yAxis'], -}; - -const disabledClass = "generator-disabled"; - -// Embed the report -function embedQuickVisualCreatorReport() { - - // Load sample report properties into session - return LoadQuickVisualCreatorShowcaseReportIntoSession().then(function () { - - // Starting spinner animation - $("#spinner").show(); - - // Get models. models contains enums that can be used - let models = window['powerbi-client'].models; - - // Get embed application token from session - let accessToken = GetSession(SessionKeys.AccessToken); - - // Get embed URL from session - let embedUrl = GetSession(SessionKeys.EmbedUrl); - - // Get report Id from session - let embedReportId = GetSession(SessionKeys.EmbedId); - - // Use View permissions - let permissions = models.Permissions.View; - - // Embed configuration used to describe the what and how to embed - // This object is used when calling powerbi.embed - // This also includes settings and options such as filters - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details - let config = { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: accessToken, - embedUrl: embedUrl, - id: embedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: false, - navContentPaneEnabled: false, - layoutType: models.LayoutType.Custom, - customLayout: { - pageSize: { - type: models.PageSizeType.Custom, - width: $('#embedContainer').width(), - height: $('#embedContainer').height() - }, - displayOption: models.DisplayOption.ActualSize, - } - } - }; - - // Get a reference to the embedded report HTML element - let embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container - VisualCreatorShowcaseState.report = powerbi.embed(embedContainer, config); - - // Report.on will add an event handler for report rendered event - VisualCreatorShowcaseState.report.on("rendered", function () { - - // Setting the first page as active - VisualCreatorShowcaseState.report.getPages().then(function (pages) { - pages[0].setActive(); - VisualCreatorShowcaseState.page = pages[0]; - }); - - // Update html available visual types - updateAvailableVisualTypes(); - - // Enable choosing visual type - $("#generator-type").removeClass(disabledClass); - - // Hiding the spinner animation - $("#spinner").hide(); - - // Covering the embeded view with instruction text - $("#overlay-embed-container").addClass("overlay-text") - $('#overlay-embed-container').text('Start by choosing the visual type'); - $("#overlay-embed-container").show(); - - // Remove the event listener, thus, it will only be called once - VisualCreatorShowcaseState.report.off("rendered"); - }); - }); -} - -// Initialize the custom dropdowns -function initializeDropdowns() { - let x, i, j, selElmnt, a, b, c; - - // Look for any elements with the class "styled-select" - x = document.getElementsByClassName("styled-select"); - for (i = 0; i < x.length; i++) { - selElmnt = x[i].getElementsByTagName("select")[0]; - - // For each element, create a new DIV that will act as the selected item - a = document.createElement("DIV"); - a.setAttribute("class", "select-selected"); - a.setAttribute("id", "selected-value-" + i); - a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML; - x[i].appendChild(a); - - // For each element, create a new DIV that will contain the option list - b = document.createElement("DIV"); - b.setAttribute("class", "select-items select-hide"); - for (j = 1; j < selElmnt.length; j++) { - - // For each option in the original select element, - // create a new DIV that will act as an option item - c = document.createElement("DIV"); - c.innerHTML = selElmnt.options[j].innerHTML; - - // Adding new click event listener - c.addEventListener("click", function (e) { - - // When an item is clicked, update the original select box, and the selected item - let y, i, k, s, h; - s = this.parentNode.parentNode.getElementsByTagName("select")[0]; - h = this.parentNode.previousSibling; - for (i = 0; i < s.length; i++) { - if (s.options[i].innerHTML == this.innerHTML) { - s.selectedIndex = i; - h.innerHTML = this.innerHTML; - y = this.parentNode.getElementsByClassName("same-as-selected"); - for (k = 0; k < y.length; k++) { - y[k].removeAttribute("class"); - } - - this.setAttribute("class", "same-as-selected"); - break; - } - } - - h.click(); - - // Changing the visual type or updating the data role field, according to the dropdown id - if (s.id == 'visual-type') { - changeVisualType(h.innerHTML); - } else { - updateDataRoleField(s.parentNode.parentNode.children[0].id, h.innerHTML); - } - }); - - b.appendChild(c); - } - - x[i].appendChild(b); - - // Adding new click event listener for the select box - a.addEventListener("click", function (e) { - // When the select box is clicked, close any other select boxes, - // and open/close the current select box - e.stopPropagation(); - closeAllSelect(this); - this.nextSibling.classList.toggle("select-hide"); - this.classList.toggle("select-arrow-active"); - }); - } -} - -// Close all select boxes in the document, except the current select box -function closeAllSelect(elmnt) { - - let x, y, i, arrNo = []; - x = document.getElementsByClassName("select-items"); - y = document.getElementsByClassName("select-selected"); - for (i = 0; i < y.length; i++) { - if (elmnt == y[i]) { - arrNo.push(i) - } else { - y[i].classList.remove("select-arrow-active"); - } - } - - for (i = 0; i < x.length; i++) { - if (arrNo.indexOf(i)) { - x[i].classList.add("select-hide"); - } - } -} - -// Changing the visual type -function changeVisualType(visualTypeDisplayName) { - // Get the visual type from the display name - let visualTypeData = visualTypeToDataRoles.filter((function (e) { return e.displayName === visualTypeDisplayName }))[0]; - let visualTypeName = visualTypeData.name; - - // Retrieve the visual's capabilities - VisualCreatorShowcaseState.report.getVisualCapabilities(visualTypeName).then(function (capabilities) { - - // Validating data roles existence on the given visual type - if (!validateDataRoles(capabilities, visualTypeData.dataRoles)) { - resetVisualGenerator(); - handleInvalidDataRoles(); - return; - } - - // Enable the fields section - $('#generator-fields').removeClass(disabledClass); - - // Disable the properties section, and reset all properties - $('#generator-properties').addClass(disabledClass); - resetGeneratorProperties(); - - // Update the overlay text - $('#overlay-embed-container').text('Use the dropdown menus to choose data fields'); - $('#overlay-embed-container').show(); - - // Reset the data fields count - VisualCreatorShowcaseState.dataFieldsCount = 0; - - // If the visual doesn't exist, create new visual, otherwise, delete the old visual and create new visual - if (!VisualCreatorShowcaseState.visual) { - VisualCreatorShowcaseState.page.createVisual(visualTypeName, getVisualLayout()).then(function () { - updateShowCaseVisType(visualTypeName, visualTypeData.dataRoles); - }); - } - else if (visualTypeName != VisualCreatorShowcaseState.visualType) { - VisualCreatorShowcaseState.page.deleteVisual(VisualCreatorShowcaseState.visual.name).then(function () { - VisualCreatorShowcaseState.page.createVisual(visualTypeName, getVisualLayout()).then(function () { - updateShowCaseVisType(visualTypeName, visualTypeData.dataRoles); - }); - }); - } - }); -} - -// Update showcase after visual type change -function updateShowCaseVisType(visualTypeName, dataRoles) { - updateCurrentVisualState(visualTypeName); - resetGeneratorDataRoles(); - updateAvailableDataRoles(dataRoles); - updateDropdownsVisibility(); -} - -// Update the visual state -function updateCurrentVisualState(visualTypeName) { - VisualCreatorShowcaseState.page.getVisuals().then(function (visuals) { - // Update visual and visual type - VisualCreatorShowcaseState.visual = visuals[0] - VisualCreatorShowcaseState.visualType = visualTypeName; - - // Enabling the pie chart legend (disabled by default) - if (visualTypeName === "pieChart") { - VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('legend'), { schema: schemas.property, value: true }); - } - - // Formatting the title to be more accessible - VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleSize'), { schema: schemas.property, value: 14 }); - VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleColor'), { schema: schemas.property, value: '#000000' }); - - // Disabling unavailable properties for specific visual types - $('.toggle-wrapper').removeClass("disabled"); - for (let i = 0; i < showcaseProperties.length; i++) { - if (visualTypeProperties[visualTypeName].indexOf(showcaseProperties[i]) < 0) { - $('#' + showcaseProperties[i] + '.toggle-wrapper').addClass("disabled"); - } - } - }); -} - -// Update the data roles and the data roles fields, on the dropdown menus -function updateAvailableDataRoles(dataRoles) { - let dataRolesNamesElements = document.querySelectorAll('.inline-select-text'); - for (let i = 0; i < dataRoles.length; i++) { - dataRolesNamesElements[i].innerHTML = dataRoles[i] + ':'; - dataRolesNamesElements[i].id = dataRoles[i]; - - let dataFields = dataRolesToFields.filter(function (e) { return e.dataRole === dataRoles[i] })[0].Fields; - updateAvailableDataFields(dataRolesNamesElements[i].parentElement, dataFields); - } -} - -// Update the data fields on the dropdown menus -function updateAvailableDataFields(dataRoleElement, dataFields) { - let fieldDivElements = dataRoleElement.querySelector('.select-items').children; - let fieldOptionElements = dataRoleElement.querySelectorAll('option'); - for (let i = 0; i < dataFields.length; i++) { - fieldDivElements[i].innerHTML = dataFields[i]; - fieldOptionElements[i + 1].innerHTML = dataFields[i]; - } -} - -// Update html visual types -function updateAvailableVisualTypes() { - let typesDivElements = $('.select-items')[0].children; - let typesOptionElements = $('#visual-type')[0].children; - for (let i = 0; i < visualTypeToDataRoles.length; i++) { - typesDivElements[i].innerHTML = visualTypeToDataRoles[i].displayName; - typesOptionElements[i + 1].innerHTML = visualTypeToDataRoles[i].displayName; - } -} - -// Print the report -function printVisual() { - if (!VisualCreatorShowcaseState.visual) - return; - VisualCreatorShowcaseState.report.print(); -} - -// Update data roles field on the visual -function updateDataRoleField(dataRole, field) { - - // Check if the requested field is not the same as the selected field - if (field != VisualCreatorShowcaseState.dataRoles[dataRole]) { - - // Getting the visual capabilites - VisualCreatorShowcaseState.visual.getCapabilities().then(function (capabilities) { - - // Getting the data role name - let dataRoleName = capabilities.dataRoles.filter(function (dr) { return dr.displayName === dataRole })[0].name; - - // Remove whitespaces from field - let dataFieldKey = field.replace(/\s+/g, ''); - - // Check if the data role already has a field - if (VisualCreatorShowcaseState.dataRoles[dataRole]) { - - // If the data role has a field, remove it - VisualCreatorShowcaseState.visual.removeDataField(dataRoleName, 0).then(function (res) { - VisualCreatorShowcaseState.dataFieldsCount--; - - // If there are no more data fields, recreating the visual before adding the data field - if (VisualCreatorShowcaseState.dataFieldsCount === 0) { - VisualCreatorShowcaseState.page.createVisual(VisualCreatorShowcaseState.visualType, getVisualLayout()).then(function () { - VisualCreatorShowcaseState.page.getVisuals().then(function (visuals) { - VisualCreatorShowcaseState.visual = visuals[0]; - VisualCreatorShowcaseState.dataFieldsCount++; - VisualCreatorShowcaseState.visual.addDataField(dataRoleName, dataFieldsTargets[dataFieldKey]).then(function () { disableSelectedDataFields(dataRole, field); }); - }); - }); - } else { - VisualCreatorShowcaseState.dataFieldsCount++; - VisualCreatorShowcaseState.visual.addDataField(dataRoleName, dataFieldsTargets[dataFieldKey]).then(function () { disableSelectedDataFields(dataRole, field); }); - } - }); - } else { - - // Adding a new field - VisualCreatorShowcaseState.visual.addDataField(dataRoleName, dataFieldsTargets[dataFieldKey]).then(function () { - disableSelectedDataFields(dataRole, field); - VisualCreatorShowcaseState.dataFieldsCount++; - - // Showing the visual if there are 2 or more data fields - if (VisualCreatorShowcaseState.dataFieldsCount > 1) { - $("#overlay-embed-container").hide(); - $('#generator-properties').removeClass(disabledClass); - } - }); - } - }); - } -} - -// Hiding the selected data field from the dropdown -function disableSelectedDataFields(dataRole, field) { - VisualCreatorShowcaseState.dataRoles[dataRole] = field; - updateDropdownsVisibility(); -} - -// Update the visibility of the dropdowns -function updateDropdownsVisibility() { - $('.select-items div').show(); - - let selected = $('.select-selected'); - selected.each(function () { - let selectedValue = $(this).text(); - $('.select-items div:contains(' + selectedValue + ')').hide(); - }); -} - -// Return the visual layout -function getVisualLayout() { - // Get models. models contains enums that can be used - let models = window['powerbi-client'].models; - - return { - width: 0.9 * $('#embedContainer').width(), - height: 0.85 * $('#embedContainer').height(), - x: (0.1 * $('#embedContainer').width()) / 2, - y: (0.1 * $('#embedContainer').height()) / 2, - displayState: { - // Change the selected visuals display mode to visible - mode: models.VisualContainerDisplayMode.Visible - } - }; -} - -// Toggle a property value -function toggleProperty(propertyName) { - if (!VisualCreatorShowcaseState.visual) - return; - - let newValue = $('#' + propertyName + '-toggle')[0].checked; - VisualCreatorShowcaseState.properties[propertyName] = newValue; - - // Setting the property on the visual - VisualCreatorShowcaseState.visual.setProperty(propertyToSelector(propertyName), { schema: schemas.property, value: newValue }); -} - -// Update the title alignment -function onAlignClicked(direction) { - if (!VisualCreatorShowcaseState.visual) - return; - - $(".alignment-block").removeClass("selected"); - $("#align-" + direction).addClass("selected"); - VisualCreatorShowcaseState.properties['titleAlign'] = direction; - - // Setting the property on the visual - VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleAlign'), { schema: schemas.property, value: direction }); -} - -// Convert property name to selector -function propertyToSelector(propertyName) { - switch (propertyName) { - case 'title': - return { objectName: "title", propertyName: "visible" }; - case 'xAxis': - return { objectName: "categoryAxis", propertyName: "visible" }; - case 'yAxis': - return { objectName: "valueAxis", propertyName: "visible" }; - case 'legend': - return { objectName: "legend", propertyName: "visible" }; - case 'titleText': - return { objectName: "title", propertyName: "titleText" }; - case 'titleAlign': - return { objectName: "title", propertyName: "alignment" }; - case 'titleSize': - return { objectName: "title", propertyName: "textSize" }; - case 'titleColor': - return { objectName: "title", propertyName: "fontColor" }; - } -} - -// Handles erase tool click -function onEraseToolClicked() { - if (!VisualCreatorShowcaseState.visual) - return; - - document.getElementById("ptitle").value = ""; - - // Reseting the title text to auto generated - VisualCreatorShowcaseState.visual.resetProperty(propertyToSelector('titleText')); -} - -// Update the title's text -function updateTitleText() { - if (!VisualCreatorShowcaseState.visual) - return; - - let text = document.getElementById("ptitle").value; - - // If the title is blank, reseting the title to auto generated - if (text === "") { - onEraseToolClicked(); - return; - } - - VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleText'), { schema: schemas.property, value: text }); -} - -// Reset the data roles section -function resetGeneratorDataRoles() { - if (!VisualCreatorShowcaseState.visual) - return; - - VisualCreatorShowcaseState.dataRoles = { - Legend: null, - Values: null, - Value: null, - Axis: null, - Tooltips: null, - 'Y Axis': null, - Category: null, - Breakdown: null, - }; - - VisualCreatorShowcaseState.dataFieldsCount = 0; - - let nodesToReset = $('.select-selected').slice(1); //all dropdowns except of visual type selection - for (let i = 0; i < nodesToReset.length; i++) { - nodesToReset[i].innerHTML = 'Select an option'; - } - - $('.field ~ .select-items').children().show(); - $('.field ~ .select-items').children().removeClass('same-as-selected'); -} - -// Reset the current visual -function resetGeneratorVisual() { - if (!VisualCreatorShowcaseState.visual) - return; - - VisualCreatorShowcaseState.page.deleteVisual(VisualCreatorShowcaseState.visual.name); - VisualCreatorShowcaseState.visual = null; - VisualCreatorShowcaseState.visualType = null; - $('.select-selected')[0].innerHTML = 'Select an option'; - $('#visual-type ~ .select-items > .same-as-selected').show(); - $('#visual-type ~ .select-items > .same-as-selected')[0].removeAttribute('class'); -} - -// Reset the properties section -function resetGeneratorProperties() { - if (!VisualCreatorShowcaseState.visual) - return; - - VisualCreatorShowcaseState.properties = { - legend: true, - xAxis: true, - yAxis: true, - title: true, - titleText: null, - titleAlign: null - }; - - for (let i = 0; i < 4; i++) { - $('input[type="checkbox"]')[i].checked = true; - } - - $(".alignment-block").removeClass("selected"); - $("#align-left").addClass("selected"); - - document.getElementById("ptitle").value = ""; -} - -// Reset the visual generator (data roles, properties and visual) -function resetVisualGenerator() { - if (!VisualCreatorShowcaseState.visual) - return; - - $('#generator-fields').addClass(disabledClass); - $('#generator-properties').addClass(disabledClass); - - $('#overlay-embed-container').text('Start by choosing the visual type'); - $("#overlay-embed-container").show(); - - resetGeneratorDataRoles(); - resetGeneratorProperties(); - resetGeneratorVisual(); -} - -// Validate the existance of each dataRole on the visual's capabilities -function validateDataRoles(capabilities, dataRolesDisplayNames) { - for (let i = 0; i < dataRolesDisplayNames.length; i++) { - - // Filter the corrsponding dataRole in the visual's capabilities dataRoles - if (capabilities.dataRoles.filter(function (dr) { return dr.displayName === dataRolesDisplayNames[i] }).length === 0) { - return false; - } - } - - return true; -} - -// Show an error message on dataRoles validation failure -function handleInvalidDataRoles() { - - // Update the overlay text - $('#overlay-embed-container').text("Failed to validate the visual's dataRoles. Please select a different visual type to continue."); - $('#overlay-embed-container').show(); -} - diff --git a/demo/v2-demo/live_showcases/themes/showcase_themes.html b/demo/v2-demo/live_showcases/themes/showcase_themes.html deleted file mode 100644 index 941bef94..00000000 --- a/demo/v2-demo/live_showcases/themes/showcase_themes.html +++ /dev/null @@ -1,43 +0,0 @@ -
-

Personalize report design

-
-
- You can personalize the colors and styling of your embedded analytics using the themes API.
- Themes help define styling and colors so you can match them to your application or brand color palette, for example.
- With the themes API, you can apply a custom theme during the report load or during a session.
- In this showcase, we’ve provided a few example color palettes and styles so you can see how themes can be applied to user report views.
-
- -
- -
-
-
Data colors
-
-
-
-
-
Background
-
-
-
-
-
-
-
Embedded view
-
-
-
-
-
- - \ No newline at end of file diff --git a/demo/v2-demo/live_showcases/themes/showcase_themes.js b/demo/v2-demo/live_showcases/themes/showcase_themes.js deleted file mode 100644 index f1c204ce..00000000 --- a/demo/v2-demo/live_showcases/themes/showcase_themes.js +++ /dev/null @@ -1,252 +0,0 @@ - - -let ThemesShowcaseState = { - themesArray: null, - themesReport: null, - dataColorSize: 16, - backgroundSize: 16, -}; - -// For report themes documentation please check https://docs.microsoft.com/en-us/power-bi/desktop-report-themes -const jsonThemes = [ - { - "name": "Apothecary", - "dataColors": ["#93A299", "#CF543F", "#B5AE53", "#848058", "#E8B54D", "#786C71", "#93A2A0", "#CF9A3F", "#8CB553", "#728458", "#D0E84D", "#786D6C"], - "background":"#FFFFFF", - "foreground": "#CF543F", - "tableAccent": "#93A299" - }, - { - "name": "Colorblind Safe", - "dataColors": ["#074650", "#009292", "#fe6db6", "#feb5da", "#480091", "#b66dff", "#b5dafe", "#6db6ff", "#914800", "#23fd23"], - "background":"#FFFFFF", - "foreground": "#074650", - "tableAccent": "#fe6db6" - }, - { - "name": "Valentine's Day", - "dataColors": ["#990011", "#cc1144", "#ee7799", "#eebbcc", "#cc4477", "#cc5555", "#882222", "#A30E33"], - "background":"#FFFFFF", - "foreground": "#ee7799", - "tableAccent": "#990011" - }, - { - "name": "Waveform", - "dataColors": ["#31B6FD", "#4584D3", "#5BD078", "#A5D028", "#F5C040", "#05E0DB", "#3153FD", "#4C45D3", "#5BD0B0", "#54D028", "#D0F540", "#057BE0"], - "background":"#FFFFFF", - "foreground": "#4584D3", - "tableAccent": "#31B6FD" - }, -]; - -const backgrounds = [ - { - "background": "#FFFFFF", - }, - { - "background": "#323130", - "foreground": "#FFFFFF", - "tableAccent": "#FFFFFF", - "visualStyles": { - "*":{ - "*":{ - "*":[{ - "fontFamily":"Segoe UI", - "color":{"solid":{"color":"#323130"}}, - "labelColor":{"solid":{"color":"#FFFFFF"}}, - "titleColor":{"solid":{"color":"#FFFFFF"}}, - }], - "labels":[{ - "color":{"solid":{"color":"#FFFFFF"}} - }], - "categoryLabels":[{ - "color":{"solid":{"color":"#FFFFFF"}} - }] - } - } - } - } -] - -// Embed the report -function embedThemesReport() { - - // Load sample report properties into session - return LoadThemesShowcaseReportIntoSession().then(function () { - - // Get models. models contains enums that can be used - const models = window['powerbi-client'].models; - - // Get embed application token from session - let accessToken = GetSession(SessionKeys.AccessToken); - - // Get embed URL from session - let embedUrl = GetSession(SessionKeys.EmbedUrl); - - // Get report Id from session - let embedReportId = GetSession(SessionKeys.EmbedId); - - // Use View permissions - let permissions = models.Permissions.View; - - // Embed configuration used to describe the what and how to embed - // This object is used when calling powerbi.embed - // This also includes settings and options such as filters - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details - let config= { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: accessToken, - embedUrl: embedUrl, - id: embedReportId, - permissions: permissions, - settings: { - filterPaneEnabled: false, - navContentPaneEnabled: false, - }, - - // Adding theme attribute to the config, will apply the theme on load - theme: {themeJson: jsonThemes[0]}, - }; - - // Get a reference to the embedded report HTML element - let embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container - ThemesShowcaseState.themesReport = powerbi.embed(embedContainer, config); - - // Report.on will add an event handler for report loaded event - ThemesShowcaseState.themesReport.on("loaded", function() { - let themesList = $('#themesList'); - - // Set the first theme on the list as active - themesList.find("#theme0").attr('checked', true); - - // Displaying the themes list and the backgrounds list - themesList.show(); - $('#backgroundsList').show(); - $('#background0', '#backgroundsList').addClass("selected"); - }); - }); -} - -// Apply clicked theme and set it as the active theme on the list -function onThemeClicked(element) { - - // Set the clicked theme as active - $(element).attr('checked', true); - - applyTheme(); -} - -// Apply clicked background and set it as the active background on the list -function setThemeBackgroundActive(id) { - - // Set the clicked background as active - $('.themeBackgroundColor').removeClass("selected"); - $('#background' + id, '#backgroundsList').addClass("selected"); - - applyTheme(); -} - -function applyTheme() { - // Get active theme id - activeThemeId = Number($('input[name=theme]:checked', '#themesList')[0].getAttribute("id").slice(-1)); - activeBackgroundId = Number($('.selected', '#backgroundsList')[0].getAttribute("id").slice(-1)); - theme = {} - $.extend(theme, jsonThemes[activeThemeId], backgrounds[activeBackgroundId]); - - // Apply the theme - let report = ThemesShowcaseState.themesReport; - report.applyTheme({themeJson: theme}); -} - -// Create a themes list -function createThemesList() { - - // Build the themes list HTML code - let themesList = $('#themesList'); - - // Hide the div until the report loads - themesList.hide(); - - // Building the themes list - for (let i = 0; i < jsonThemes.length; i++) { - themesList.append(buildThemeElement(i)); - } -} - -// Create a backgrounds list -function createBackgroundsList() { - - // Build the backgrounds list HTML code - let backgroundsList = $('#backgroundsList'); - - // Hide the div until the report loads - backgroundsList.hide(); - - // Building the themes list - for (let i = 0; i < backgrounds.length; i++) { - backgroundsList.append(buildBackgroundElement(i)); - } -} - -// Build theme radio button HTML element -function buildThemeElement(id) { - let labelElement = document.createElement("label"); - labelElement.setAttribute("class", "showcaseRadioContainer themesRadioContainer"); - - let inputElement = document.createElement("input"); - inputElement.setAttribute("type", "radio"); - inputElement.setAttribute("name", "theme"); - inputElement.setAttribute("id", 'theme' + id); - inputElement.setAttribute("onclick", "onThemeClicked(this);"); - labelElement.appendChild(inputElement); - - let spanElement = document.createElement("span"); - spanElement.setAttribute("class", "showcaseRadioCheckmark"); - labelElement.appendChild(spanElement); - - let secondSpanElement = document.createElement("span"); - secondSpanElement.setAttribute("class", "radioTitle"); - let radioTitleElement = document.createTextNode(jsonThemes[id].name); - secondSpanElement.appendChild(radioTitleElement); - labelElement.appendChild(secondSpanElement); - - let colorsDivElement = document.createElement("div"); - colorsDivElement.setAttribute("class","themeColors"); - - // Calculate the max width for displaying data colors - const maxWidth = document.getElementById('themesDataColorsWrapper').offsetWidth - 48 /*padding*/; - const dataColors = jsonThemes[id].dataColors; - const singleDataColorWidth = ThemesShowcaseState.dataColorSize + 3 /*margin*/; - let currentWidth = 0; - for (let i = 0; i < dataColors.length; i++) { - - // Verify that the data colors will not overflow - if (currentWidth + singleDataColorWidth > maxWidth) - break; - - let dataColorElement = document.createElement("img"); - let url = "https://placehold.it/" + ThemesShowcaseState.dataColorSize + "/" + dataColors[i].substr(1) + "/000000?text=+"; - dataColorElement.setAttribute("src", url); - dataColorElement.setAttribute("class", "themeDataColor"); - colorsDivElement.appendChild(dataColorElement); - currentWidth += singleDataColorWidth; - } - - labelElement.appendChild(colorsDivElement); - - return labelElement; -} - -// Build background HTML element -function buildBackgroundElement(id) { - let backgroundElement = document.createElement("img"); - let url = "https://placehold.it/" + ThemesShowcaseState.backgroundSize + "/" + backgrounds[id].background.substr(1) + "/000000?text=+"; - backgroundElement.setAttribute("src", url); - backgroundElement.setAttribute("class", "themeBackgroundColor"); - backgroundElement.setAttribute("id", 'background' + id); - backgroundElement.setAttribute("onclick", "setThemeBackgroundActive(" + id + ");"); - return backgroundElement; -} diff --git a/demo/v2-demo/log_window.html b/demo/v2-demo/log_window.html deleted file mode 100644 index 47837bc7..00000000 --- a/demo/v2-demo/log_window.html +++ /dev/null @@ -1,14 +0,0 @@ -
-
Log
-
- - -
-
- -
-
\ No newline at end of file diff --git a/demo/v2-demo/report.html b/demo/v2-demo/report.html deleted file mode 100644 index 379792c8..00000000 --- a/demo/v2-demo/report.html +++ /dev/null @@ -1,103 +0,0 @@ - -
-
-
-
-
-
-
    -
  • - -
  • -
  • -
    - - Please click 'Run' before switching to 'Interact' tab -
    -
  • -
-
-
-
-
-
-
- -
-
-
-
Embedded view
-
-
- - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - \ No newline at end of file diff --git a/demo/v2-demo/sample.html b/demo/v2-demo/sample.html deleted file mode 100644 index a1cbd5b8..00000000 --- a/demo/v2-demo/sample.html +++ /dev/null @@ -1,31 +0,0 @@ -
-
- -
-
- -
-

Welcome to the Power BI Embedded Playground

-
-
- While you are here, you can try many of our features without writing any code.
- Explore our APIs and see the results instantly so you know the options for your application.

- To get started, select the sample you want to explore, make any changes to get the results you want, and then click “Run”.

- You can check out our interactive feature showcase to experience embedded features for your application.

- We add the latest features into the Playground, so you can explore them before adding them to your implementation. -
-
- -
-
\ No newline at end of file diff --git a/demo/v2-demo/scripts/aisdk.js b/demo/v2-demo/scripts/aisdk.js deleted file mode 100644 index 9b1ade4a..00000000 --- a/demo/v2-demo/scripts/aisdk.js +++ /dev/null @@ -1,29 +0,0 @@ -const appUrl = 'https://powerbiplaygroundbe.azurewebsites.net/App'; -const appUrlEnabled = false; -const defaultInstrumentationKey = "ffe7093c-af96-4df9-8452-b9f4b35ccded"; - -var appInsightsInstanceDeferred = $.Deferred(); - -if (appUrlEnabled) { - $.getJSON(appUrl, function (appConfig) { - createAppInsightsInstance(appConfig.instrumentationKey); - }); -} -else { - createAppInsightsInstance(defaultInstrumentationKey); -} - -function createAppInsightsInstance(instrumentationKey) { - // Application Insights setup - var sdkInstance="appInsightsSDK";window[sdkInstance]="appInsights";var aiName=window[sdkInstance],aisdk=window[aiName]||function(e){function n(e){t[e]=function(){var n=arguments;t.queue.push(function(){t[e].apply(t,n)})}}var t={config:e};t.initialize=!0;var i=document,a=window;setTimeout(function(){var n=i.createElement("script");n.src=e.url||"https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js",i.getElementsByTagName("script")[0].parentNode.appendChild(n)});try{t.cookie=i.cookie}catch(e){}t.queue=[],t.version=2;for(var r=["Event","PageView","Exception","Trace","DependencyData","Metric","PageViewPerformance"];r.length;)n("track"+r.pop());n("startTrackPage"),n("stopTrackPage");var s="Track"+r[0];if(n("start"+s),n("stop"+s),n("addTelemetryInitializer"),n("setAuthenticatedUserContext"),n("clearAuthenticatedUserContext"),n("flush"),!(!0===e.disableExceptionTracking||e.extensionConfig&&e.extensionConfig.ApplicationInsightsAnalytics&&!0===e.extensionConfig.ApplicationInsightsAnalytics.disableExceptionTracking)){n("_"+(r="onerror"));var o=a[r];a[r]=function(e,n,i,a,s){var c=o&&o(e,n,i,a,s);return!0!==c&&t["_"+r]({message:e,url:n,lineNumber:i,columnNumber:a,error:s}),c},e.autoExceptionInstrumented=!0}return t}( - { - instrumentationKey: instrumentationKey - } - );window[aiName]=aisdk,aisdk.queue&&0===aisdk.queue.length&&aisdk.trackPageView({}); - - appInsightsInstanceDeferred.resolve(appInsights); -} - -function getAppInsightsInstance() { - return appInsightsInstanceDeferred; -} diff --git a/demo/v2-demo/scripts/assert.js b/demo/v2-demo/scripts/assert.js deleted file mode 100644 index 049169e9..00000000 --- a/demo/v2-demo/scripts/assert.js +++ /dev/null @@ -1,5 +0,0 @@ -function assert(exp){ - if(console["assert"]){ - console.assert(exp); - } -} \ No newline at end of file diff --git a/demo/v2-demo/scripts/codesamples.js b/demo/v2-demo/scripts/codesamples.js deleted file mode 100644 index 1838366e..00000000 --- a/demo/v2-demo/scripts/codesamples.js +++ /dev/null @@ -1,3026 +0,0 @@ -/* - This file contains the code samples which will appear live in the web-page. - Each sample method name starts with _Report_ or _Page or _Embed depends on which section it appears. - Please keep this. -*/ - -// ---- Embed Code ---------------------------------------------------- - -function _Embed_BasicEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // We give All permissions to demonstrate switching between View and Edit mode and saving report. - var permissions = models.Permissions.All; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'report', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, - settings: { - panes: { - filters: { - visible: true - }, - pageNavigation: { - visible: true - } - } - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(embedContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.on("error", function (event) { - Log.log(event.detail); - - report.off("error"); - }); - - report.off("saved"); - report.on("saved", function (event) { - Log.log(event.detail); - if (event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -function _Embed_BasicEmbed_Mobile() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // We give All permissions to demonstrate switching between View and Edit mode and saving report. - var permissions = models.Permissions.All; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'report', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, - pageName: "ReportSectioneb8c865100f8508cc533", - settings: { - panes: { - filters: { - visible: false - } - }, - layoutType: models.LayoutType.MobilePortrait - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(embedContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.on("error", function (event) { - Log.log(event.detail); - - report.off("error"); - }); - - report.off("saved"); - report.on("saved", function (event) { - Log.log(event.detail); - if (event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -// ---- Paginated Embed Code ---------------------------------------------------- -function _Embed_PaginatedReportBasicEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read paginated report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Se view permissions. - var permissions = models.Permissions.View; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'report', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, - }; - - // Get a reference to the paginated embedded report HTML element - var paginatedReportContainer = $('#paginatedReportContainer')[0]; - - // Embed the paginated report and display it within the div container. - var report = powerbi.embed(paginatedReportContainer, config); - - Log.logText("Loading Paginated Report."); -} - -function _Embed_VisualEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtReportId = $('#txtEmbedReportId').val(); - - // Read page name from textbox - var txtPageName = $('#txtPageName').val(); - - // Read visual name from textbox - var txtVisualName = $('#txtVisualName').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'visual', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtReportId, - pageName: txtPageName, - visualName: txtVisualName - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(embedContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.on("error", function (event) { - Log.log(event.detail); - - report.off("error"); - }); -} - -function _Embed_DashboardEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtDashboardEmbed').val(); - - // Read dashboard Id from textbox - var txtEmbedDashboardId = $('#txtEmbedDashboardId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'dashboard', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedDashboardId, - pageView: 'fitToWidth' - }; - - // Get a reference to the embedded dashboard HTML element - var dashboardContainer = $('#dashboardContainer')[0]; - - // Embed the dashboard and display it within the div container. - var dashboard = powerbi.embed(dashboardContainer, config); - - // Dashboard.off removes a given event handler if it exists. - dashboard.off("loaded"); - - // Dashboard.on will add an event handler which prints to Log window. - dashboard.on("loaded", function () { - Log.logText("Loaded"); - }); - - dashboard.on("error", function (event) { - Log.log(event.detail); - - dashboard.off("error"); - }); - - dashboard.off("tileClicked"); - dashboard.on("tileClicked", function (event) { - Log.log(event.detail); - }); -} - -function _Embed_DashboardEmbed_Mobile() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtDashboardEmbed').val(); - - // Read dashboard Id from textbox - var txtEmbedDashboardId = $('#txtEmbedDashboardId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'dashboard', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedDashboardId, - pageView: 'oneColumn' - }; - - // Get a reference to the embedded dashboard HTML element - var dashboardContainer = $('#dashboardContainer')[0]; - - // Embed the dashboard and display it within the div container. - var dashboard = powerbi.embed(dashboardContainer, config); - - // Dashboard.off removes a given event handler if it exists. - dashboard.off("loaded"); - - // Dashboard.on will add an event handler which prints to Log window. - dashboard.on("loaded", function () { - Log.logText("Loaded"); - }); - - dashboard.on("error", function (event) { - Log.log(event.detail); - - dashboard.off("error"); - }); - - dashboard.off("tileClicked"); - dashboard.on("tileClicked", function (event) { - Log.log(event.detail); - }); -} - -function _Mock_Embed_BasicEmbed(isEdit) { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - var permissions = models.Permissions.All; - var viewMode = isEdit ? models.ViewMode.Edit : models.ViewMode.View; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'report', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, - viewMode: viewMode, - settings: { - panes: { - filters: { - visible: true - }, - pageNavigation: { - visible: true - } - }, - useCustomSaveAsDialog: true - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(embedContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.off("saveAsTriggered"); - report.on("saveAsTriggered", function () { - Log.logText("Cannot save sample report"); - }); - - report.off("error"); - report.on("error", function (event) { - Log.log(event.detail); - }); - - report.off("saved"); - report.on("saved", function (event) { - Log.log(event.detail); - if (event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -function _Mock_Embed_BasicEmbed_EditMode() { - _Mock_Embed_BasicEmbed(true); -} - -function _Mock_Embed_BasicEmbed_ViewMode() { - _Mock_Embed_BasicEmbed(false); -} - -function _Embed_BasicEmbed_EditMode() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtReportEmbed').val(); - - // Read report Id from textbox - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // This also includes settings and options such as filters. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'report', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: models.Permissions.All /*gives maximum permissions*/, - viewMode: models.ViewMode.Edit, - settings: { - panes: { - filters: { - visible: true - }, - pageNavigation: { - visible: true - } - } - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Embed the report and display it within the div container. - var report = powerbi.embed(embedContainer, config); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.off("error"); - report.on("error", function (event) { - Log.log(event.detail); - }); - - report.off("saved"); - report.on("saved", function (event) { - Log.log(event.detail); - if (event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); -} - -function _Embed_MobileEditNotSupported() { - // Edit mode is not supported on mobile. -} - -function _Embed_MobileCreateNotSupported() { - // Create mode is not supported on mobile. -} - -function _Embed_EmbedWithDefaultFilter() { - var txtAccessToken = $('#txtAccessToken').val(); - var txtEmbedUrl = $('#txtReportEmbed').val(); - var txtEmbedReportId = $('#txtEmbedReportId').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Geo", - column: "Region" - }, - operator: "In", - values: ["West"] - }; - - var embedConfiguration = { - type: 'report', - tokenType: models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - settings: { - panes: { - filters: { - visible: false - }, - pageNavigation: { - visible: false - } - } - }, - filters: [filter] - }; - - var embedContainer = document.getElementById('embedContainer'); - powerbi.embed(embedContainer, embedConfiguration); -} - -function _Embed_TileEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtTileEmbed').val(); - - // Read dashboard Id from textbox - var txtEmbedDashboardId = $('#txtEmbedDashboardId').val(); - - // Read tile Id from textbox - var txtEmbedTileId = $('#txtEmbedTileId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'tile', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedTileId, - dashboardId: txtEmbedDashboardId - }; - - // Get a reference to the embedded tile HTML element - var tileContainer = $('#tileContainer')[0]; - - // Embed the tile and display it within the div container. - var tile = powerbi.embed(tileContainer, config); - - // Tile.off removes a given event handler if it exists. - tile.off("tileLoaded"); - - // Tile.on will add an event handler which prints to Log window. - tile.on("tileLoaded", function (event) { - Log.logText("Tile loaded event"); - }); - - // Tile.off removes a given event handler if it exists. - tile.off("tileClicked"); - - // Tile.on will add an event handler which prints to Log window. - tile.on("tileClicked", function (event) { - Log.logText("Tile clicked event"); - Log.log(event.detail); - }); -} - -function _Embed_Create() { - // Read embed application token from textbox - var txtAccessToken = $('#txtCreateAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtCreateReportEmbed').val(); - - // Read dataset Id from textbox - var txtEmbedDatasetId = $('#txtEmbedDatasetId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed create configuration used to describe the what and how to create report. - // This object is used when calling powerbi.createReport. - var embedCreateConfiguration = { - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - datasetId: txtEmbedDatasetId, - }; - - // Grab the reference to the div HTML element that will host the report - var embedContainer = $('#embedContainer')[0]; - - // Create report - var report = powerbi.createReport(embedContainer, embedCreateConfiguration); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.off("error"); - report.on("error", function (event) { - Log.log(event.detail); - }); - - // report.off removes a given event handler if it exists. - report.off("saved"); - report.on("saved", function (event) { - Log.log(event.detail); - Log.logText('In order to interact with the new report, create a new token and load the new report'); - }); -} - -function _Mock_Embed_Create() { - // Read embed application token from textbox - var txtAccessToken = $('#txtCreateAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtCreateReportEmbed').val(); - - // Read dataset Id from textbox - var txtEmbedDatasetId = $('#txtEmbedDatasetId').val(); - - // Read embed type from radio - var tokenType = $('input:radio[name=tokenType]:checked').val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed create configuration used to describe the what and how to create report. - // This object is used when calling powerbi.createReport. - var embedCreateConfiguration = { - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - datasetId: txtEmbedDatasetId, - settings: { - useCustomSaveAsDialog: true - } - }; - - // Grab the reference to the div HTML element that will host the report - var embedContainer = $('#embedContainer')[0]; - - // Create report - var report = powerbi.createReport(embedContainer, embedCreateConfiguration); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - report.off("saveAsTriggered"); - report.on("saveAsTriggered", function () { - Log.logText("Cannot save sample report"); - }); - - report.off("error"); - report.on("error", function (event) { - Log.log(event.detail); - }); -} - -function _Embed_QnaEmbed() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtQnaEmbed').val(); - - // Read dataset Id from textbox - var txtDatasetId = $('#txtDatasetId').val(); - - // Read question from textbox - var txtQuestion = $('#txtQuestion').val(); - - // Read Q&A mode - var qnaMode = $("input[name='qnaMode']:checked").val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'qna', - tokenType: models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - datasetIds: [txtDatasetId], - viewMode: models.QnaMode[qnaMode], - question: txtQuestion - }; - - // Get a reference to the embedded Q&A HTML element - var qnaContainer = $('#qnaContainer')[0]; - - // Embed the Q&A and display it within the div container. - powerbi.embed(qnaContainer, config); -} - -function _Embed_QnaEmbed_Aad() { - // Read embed application token from textbox - var txtAccessToken = $('#txtAccessToken').val(); - - // Read embed URL from textbox - var txtEmbedUrl = $('#txtQnaEmbed').val(); - - // Read dataset Id from textbox - var txtDatasetId = $('#txtDatasetId').val(); - - // Read question from textbox - var txtQuestion = $('#txtQuestion').val(); - - // Read Q&A mode - var qnaMode = $("input[name='qnaMode']:checked").val(); - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Embed configuration used to describe the what and how to embed. - // This object is used when calling powerbi.embed. - // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. - var config = { - type: 'qna', - tokenType: models.TokenType.Aad, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - datasetIds: [txtDatasetId], - viewMode: models.QnaMode[qnaMode], - question: txtQuestion - }; - - // Get a reference to the embedded Q&A HTML element - var qnaContainer = $('#qnaContainer')[0]; - - // Embed the Q&A and display it within the div container. - powerbi.embed(qnaContainer, config); -} - -// ---- Report Operations ---------------------------------------------------- - -function _Report_GetId() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the report id. - var reportId = report.getId(); - - Log.logText("Report id: \"" + reportId + "\""); -} - -async function _Report_UpdateSettings() { - // The new settings that you want to apply to the report. - const newSettings = { - panes: { - filters: { - visible: false - }, - pageNavigation: { - visible: true - } - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - Log.logText("Filter pane was removed."); - } - catch (error) { - Log.log(error); - } -} - -async function _Report_GetPages() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and loop through to collect the - // page name and display name of each page and display the value. - try { - const pages = await report.getPages(); - var log = "Report pages:"; - pages.forEach(function (page) { - log += "\n" + page.name + " - " + page.displayName; - }); - Log.logText(log); - } - catch (error) { - Log.log(error); - } -} - -async function _Report_SetPage() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // setPage will change the selected view to the page you indicate. - // This is the actual page name not the display name. - try { - await report.setPage("ReportSectiona271643cba2213c935be"); - Log.logText("Page was set to: ReportSectiona271643cba2213c935be"); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_GetFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Get the filters applied to the report. - try { - const filters = await report.getFilters(); - Log.log(filters); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_SetFilters() { - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Geo", - column: "Region" - }, - operator: "In", - values: ["West"] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Set the filter for the report. - // Pay attention that setFilters receives an array. - try { - await report.setFilters([filter]); - Log.logText("Report filter was set."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_RemoveFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Remove the filters currently applied to the report. - try { - await report.removeFilters(); - Log.logText("Report filters were removed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Report_SetFilters() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Date", - column: "Months" - }, - operator: "In", - values: ["Oct", "Nov", "Dec"] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Set the filter for the report. - // Pay attention that setFilters receives an array. - try { - await visual.setFilters([filter], models.FiltersLevel.Report); - Log.logText("Report filter was set."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Report_GetFilters() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Get the filters applied to the report. - try { - const filters = await visual.getFilters(models.FiltersLevel.Report); - Log.log(filters); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Report_RemoveFilters() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Remove the filters currently applied to the report. - try { - await report.removeFilters(models.FiltersLevel.Report); - Log.logText("Report filters were removed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Page_SetFilters() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Date", - column: "Months" - }, - operator: "In", - values: ["Oct", "Nov", "Dec"] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Set the filter for the report. - // Pay attention that setFilters receives an array. - try { - await visual.setFilters([filter], models.FiltersLevel.Page); - Log.logText("Page filter was set."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Page_GetFilters() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Get the filters applied to the report. - try { - const filters = await visual.getFilters(models.FiltersLevel.Page); - Log.log(filters); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Page_RemoveFilters() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Remove the filters currently applied to the report. - try { - await report.removeFilters(models.FiltersLevel.Page); - Log.logText("Page filters were removed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Visual_SetFilters() { - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Date", - column: "Months" - }, - operator: "In", - values: ["Oct", "Nov", "Dec"] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Set the filter for the report. - // Pay attention that setFilters receives an array. - try { - await visual.setFilters([filter]); - Log.logText("Report filter was set."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Visual_GetFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Get the filters applied to the report. - try { - const filters = await visual.getFilters(); - Log.log(filters); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_Visual_RemoveFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Remove the filters currently applied to the report. - try { - await report.removeFilters(); - Log.logText("Report filters were removed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_PrintCurrentReport() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Trigger the print dialog for your browser. - try { - await report.print(); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Reload() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Reload the displayed report - try { - await report.reload(); - Log.logText("Reloaded"); - } - catch (errors) { - Log.log(errors); - } -} - -function _PaginatedReport_Reload() { - // Get a reference to the paginated report HTML element - var paginatedReportContainer = $('#paginatedReportContainer')[0]; - - // Get a reference to the embedded paginated report. - paginatedReport = powerbi.get(paginatedReportContainer); - - // Reload the displayed paginated report - paginatedReport.reload(); - - Log.logText("Reload Paginated Report"); -} - -async function _Report_Refresh() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Refresh the displayed report - try { - await report.refresh(); - Log.logText("Refreshed"); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_ApplyCustomLayout() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Define default visual layout: visible in 400x300. - let defaultLayout = { - width: 400, - height: 250, - displayState: { - mode: models.VisualContainerDisplayMode.Hidden - } - }; - - // Define page size as custom size: 1000x580. - let pageSize = { - type: models.PageSizeType.Custom, - width: 1000, - height: 580 - }; - - // Page layout: two visible visuals in fixed position. - let pageLayout = { - defaultLayout: defaultLayout, - visualsLayout: { - "VisualContainer1": { - x: 70, - y: 100, - displayState: { - mode: models.VisualContainerDisplayMode.Visible - } - }, - "VisualContainer3": { - x: 540, - y: 100, - displayState: { - mode: models.VisualContainerDisplayMode.Visible - } - } - } - }; - - let settings = { - layoutType: models.LayoutType.Custom, - customLayout: { - pageSize: pageSize, - displayOption: models.DisplayOption.FitToPage, - pagesLayout: { - "ReportSection600dd9293d71ade01765": pageLayout - } - }, - panes: { - filters: { - visible: false - }, - pageNavigation: { - visible: false - } - } - } - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(settings); - Log.logText("Custom layout applied, to remove custom layout, reload the report using 'Reload' API."); - } - catch (error) { - Log.log(error); - } -} - -async function _Report_HideAllVisualHeaders() { - - // New settings to hide all the visual headers in the report - const newSettings = { - visualSettings: { - visualHeaders: [ - { - settings: { - visible: false - } - // No selector - Hide visual header for all the visuals in the report - } - ] - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - Log.logText("Visual header was successfully hidden for all the visuals in the report."); - } - catch (error) { - Log.log(error); - } -} - -async function _Report_ShowAllVisualHeaders() { - // New settings to show all the visual headers in the report - const newSettings = { - visualSettings: { - visualHeaders: [ - { - settings: { - visible: true - } - // No selector - Show visual header for all the visuals in the report - } - ] - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - Log.logText("Visual header was successfully shown for all the visuals in the report."); - } - catch (error) { - Log.log(error); - } -} - -async function _Report_HideSingleVisualHeader() { - - // Define settings to hide the header of a single visual - var newSettings = { - visualSettings: { - visualHeaders: [ - { - settings: { - visible: true - } - // No selector - Show visual header for all the visuals in the report - }, - { - settings: { - visible: false - }, - selector: { - $schema: "http://powerbi.com/product/schema#visualSelector", - visualName: "VisualContainer4" - // The visual name can be retrieved using getVisuals() - // Hide visual header for a single visual only - } - } - ] - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - Log.logText("Visual header was successfully hidden for 'Category Breakdown' visual."); - } - catch (error) { - Log.log(error); - } -} - -function _Report_FullScreen() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Displays the report in full screen mode. - report.fullscreen(); -} - -function _Report_ExitFullScreen() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Exits full screen mode. - report.exitFullscreen(); -} - -// ---- PaginatedReport Operations ---------------------------------------------------- - -function _PaginatedReport_GetId() { - // Get a reference to the embedded report HTML element - var paginatedReportContainer = $('#paginatedReportContainer')[0]; - - // Get a reference to the embedded report. - paginatedReport = powerbi.get(paginatedReportContainer); - - // Retrieve the report id. - var reportId = paginatedReport.getId(); - - Log.logText(reportId); -} - -function _PaginatedReport_FullScreen() { - // Get a reference to the paginated embedded report HTML element - var paginatedReportContainer = $('#paginatedReportContainer')[0]; - - // Get a reference to the paginated embedded report. - paginatedReport = powerbi.get(paginatedReportContainer); - - // Displays the paginated report in full screen mode. - paginatedReport.fullscreen(); -} - -function _PaginatedReport_ExitFullScreen() { - // Get a reference to the paginated embedded report HTML element - var paginatedReportContainer = $('#paginatedReportContainer')[0]; - - // Get a reference to the paginated embedded report. - paginatedReport = powerbi.get(paginatedReportContainer); - - // Exits full screen mode. - paginatedReport.exitFullscreen(); -} - -function _Report_switchModeEdit() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Switch to edit mode. - report.switchMode("edit"); -} - -function _Report_switchModeView() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Switch to view mode. - report.switchMode("view"); -} - -function _Report_save() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Save report - report.save(); -} - -function _Mock_Report_save() { - Log.logText('Cannot save sample report'); -} - -function _Report_saveAs() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - var saveAsParameters = { - name: "newReport" - }; - - // SaveAs report - report.saveAs(saveAsParameters); -} - -async function _Report_Extensions_OptionsMenu() { - const base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAu9JREFUeJzt3U9OE2Ech/FnSiKsXbh340pg5Qk8gofAY3gGtBqWXsKNIR5BF0ZkQ9h6A2pC62LAEP5ITdv3R+f7fJJ3QUh4ZzpPmaaZmReGZxf4ABwDE2C24Jhc/K33wE7D/dB/2gIOgCmLH/S7xhQYA5uN9klz2gK+sLoDf30cXsypB+KAdgf/coyb7Jnutctq/+3/63Sw3WD/VmpUvQFL8BroCubtgL2CeXXNMe3f/ZfjqMH+rVTFO2fZJsCjwrnX+sPgEAKYFc+/1q/hED4DaAEGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCDcbQEs+3n7qx7Vqvf/vjH3egctnrfvqB13rnfQ+nn7jtrxd72DDXpj4BVK8RR4DHzq6M/5X1nzZ97qv82A3Q3gDfCidltUoAOmHf0nxGfFG6MaPztqn7evWpOO/lygUH4TGM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQbAb+rN0JlJiPgtHorVOZkRH+NuDIddvS3C33Dy8LTTLm4LPwX8AQvDU/zDvh4+cMm/amg+pYlR5vxmVuuBN+iv0XMm0OHO86Bfa4c/NvO+9vAHvCS/h6yG3eSaq1MgBP6//AHwPervxzCB79Z8fxr/Rr6TWA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQbggBVK53MCmceymGEMBp4dwnhXMvxRACqFzvwLUWHoAdah5wfQ48b7B/msOY9gHsN9kzzaX1ege3Pm9ftVqsd3Djeft6eLbpl0M5As5Y/KCfAT+AtwzwnP8HNwiKJyPkCoYAAAAASUVORK5CYII="; - - // The new settings that you want to apply to the report. - const newSettings = { - extensions: [ - { - command: { - name: "extension command", - title: "Extend commands", - icon: base64Icon, - extend: { - // Define visualOptionsMenu to extend options menu - visualOptionsMenu: { - // Define title to override default title. - // You can override default icon as well. - title: "Extend options menu", - } - } - } - } - ] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - } - catch (error) { - Log.log(error); - } - - // Report.on will add an event handler to commandTriggered event which prints to console window. - report.on("commandTriggered", function (event) { - Log.logText("Event - commandTriggered:"); - var commandDetails = event.detail; - Log.log(commandDetails); - }); - - // Select Run and open options menu to see new added items. - // Click on menu items added and you should see an entry in the Log window. - - Log.logText("Open visual options menu by clicking the three dots icon and click on added items to see events in Log window."); -} - -async function _Report_Extensions_ContextMenu() { - // The new settings that you want to apply to the report. - const newSettings = { - extensions: [ - { - command: { - name: "extension command", - title: "Extend command", - extend: { - // Define visualContextMenu to extend context menu. - visualContextMenu: { - // Define title to override default title. - //You can override default icon as well. - title: "Extend context menu", - } - } - } - } - ] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - } - catch (error) { - Log.log(error); - } - - // Report.on will add an event handler to commandTriggered event which prints to console window. - report.on("commandTriggered", function (event) { - Log.logText("Event - commandTriggered:"); - var commandDetails = event.detail; - Log.log(commandDetails); - }); - - // Select Run and context menu (i.e. by right click on data points) to see new added items. - // Click on menu items added and you should see an entry in the Log window. - - Log.logText("Open visual context menu by right click on data points and click on added items to see events in Log window."); -} - -async function _Visual_Operations_SortVisualBy() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Build the sort request. - // For more information, See https://github.com/Microsoft/PowerBI-JavaScript/wiki/Sort-Visual-By - const sortByRequest = { - orderBy: { - table: "SalesFact", - measure: "Total Category Volume" - }, - direction: models.SortDirection.Descending - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name === "VisualContainer6"; - })[0]; - - // Sort the visual's data by direction and data field. - await visual.sortBy(sortByRequest); - Log.logText("\"Total Category Volume Over Time by Region\" visual was sorted according to the request.") - } - catch (errors) { - Log.log(errors); - } -} - -// ---- Page Operations ---------------------------------------------------- - -async function _Page_SetActive() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve active page. - try { - const pages = await report.getPages(); - await pages[3].setActive(); - Log.logText("Active page was set to: \"" + pages[3].displayName + "\""); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Page_GetFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the filters for the first page. - try { - const pages = await report.getPages(); - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const filters = await activePage.getFilters(); - Log.log(filters); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Page_GetVisuals() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - Log.log( - visuals.map(function (visual) { - return { - name: visual.name, - type: visual.type, - title: visual.title, - layout: visual.layout - }; - })); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Page_SetFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Build the filter you want to use. For more information, see Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#basic", - target: { - table: "Geo", - column: "Region" - }, - operator: "In", - values: ["West"] - }; - - // Retrieve the page collection and then set the filters for the first page. - // Pay attention that setFilters receives an array. - try { - const pages = await report.getPages(); - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - await activePage.setFilters([filter]); - Log.logText("Page filter was set."); - - } - catch (errors) { - Log.log(errors); - } -} - -async function _Page_RemoveFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and remove the filters for the first page. - try { - const pages = await report.getPages(); - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - await activePage.removeFilters(); - Log.logText("Page filters were removed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Page_HasLayout() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and check if the first page has a MobilePortrait layout. - try { - const pages = await report.getPages(); - const hasLayout = await pages[0].hasLayout(models.LayoutType.MobilePortrait); - - var hasLayoutText = hasLayout ? "has" : "doesn't have"; - Log.logText("Page \"" + pages[0].name + "\" " + hasLayoutText + " mobile portrait layout."); - } - catch (errors) { - Log.log(errors); - } -} - -// ---- Event Listener ---------------------------------------------------- - -function _Events_PageChanged() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event listener if it exists. - report.off("pageChanged"); - - // Report.on will add an event listener. - report.on("pageChanged", function (event) { - Log.logText("Event - pageChanged:"); - var page = event.detail.newPage; - Log.logText("Page changed to \"" + page.name + "\" - \"" + page.displayName + "\""); - }); - - // Select Run and change to a different page. - // You should see an entry in the Log window. - - Log.logText("Select different page to see events in Log window."); -} - -function _Events_DataSelected() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event listener if it exists. - report.off("dataSelected"); - - // Report.on will add an event listener. - report.on("dataSelected", function (event) { - Log.logText("Event - dataSelected:"); - var data = event.detail; - Log.log(data); - }); - - // Select Run and select an element of a visualization. - // For example, a bar in a bar chart. You should see an entry in the Log window. - - Log.logText("Select data to see events in Log window."); -} - -function _Events_SaveAsTriggered() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event listener if it exists. - report.off("saveAsTriggered"); - - // Report.on will add an event listener. - report.on("saveAsTriggered", function (event) { - Log.log(event); - }); - - // Select Run and then select SaveAs. - // You should see an entry in the Log window. - - Log.logText("Select SaveAs to see events in Log window."); -} - -function _Events_BookmarkApplied() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event listener if it exists. - report.off("bookmarkApplied"); - - // Report.on will add an event listener. - report.on("bookmarkApplied", function (event) { - Log.logText("Event - bookmarkApplied:"); - Log.log(event.detail); - }); - - // Select Run and then go to bookmarks - // and select 'Apply Bookmark by name'. - // You should see an entry in the Log window. - Log.logText("Apply a bookmark to see events in Log window."); -} - -function _Events_ReportLoaded() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event handler if it exists. - report.off("loaded"); - - // Report.on will add an event handler which prints to Log window. - report.on("loaded", function () { - Log.logText("Loaded"); - }); - - Log.logText("Reload the report to see the loaded event."); -} - -function _Events_ReportRendered() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event handler if it exists. - report.off("rendered"); - - // Report.on will add an event handler which prints to Log window. - report.on("rendered", function () { - Log.logText("Rendered"); - }); - - Log.logText("Reload the report to see the rendered event."); -} - -function _Events_ReportSaved() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event handler if it exists. - report.off("saved"); - - // Report.on will add an event handler which prints to Log window. - report.on("saved", function (event) { - Log.log(event.detail); - if (event.detail.saveAs) { - Log.logText('In order to interact with the new report, create a new token and load the new report'); - } - }); - - Log.logText("Save/SaveAs the report to see the saved event."); -} - -function _Events_TileLoaded() { - // Get a reference to the embedded tile HTML element - var tileContainer = $('#tileContainer')[0]; - - // Get a reference to the embedded tile. - var tile = powerbi.get(tileContainer); - - // Tile.off removes a given event handler if it exists. - tile.off("tileLoaded"); - - // Tile.on will add an event handler which prints to Log window. - tile.on("tileLoaded", function (event) { - Log.logText("Tile loaded event"); - }); -} - -function _Events_TileClicked() { - // Get a reference to the embedded tile HTML element - var tileContainer = $('#tileContainer')[0]; - - // Get a reference to the embedded tile. - var tile = powerbi.get(tileContainer); - - // Tile.off removes a given event handler if it exists. - tile.off("tileClicked"); - - // Tile.on will add an event handler which prints to Log window. - tile.on("tileClicked", function (event) { - Log.logText("Tile clicked event"); - Log.log(event.detail); - }); - - Log.logText("Click on the tile to see the tile clicked event."); -} - -function _Events_ButtonClicked() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Report.off removes a given event listener if it exists. - report.off("buttonClicked"); - - // Report.on will add an event listener. - report.on("buttonClicked", function (event) { - Log.logText("Event - buttonClicked:"); - var data = event.detail; - Log.log(data); - }); - - // Select Run and click on a button in the report - // For example, a Qna button. You should see an entry in the Log window. - Log.logText("Click button to see event in Log window."); -} - -// ---- Dashboard Operations ---------------------------------------------------- - -function _Dashboard_GetId() { - // Get a reference to the embedded dashboard HTML element - var dashboardContainer = $('#dashboardContainer')[0]; - - // Get a reference to the embedded dashboard. - dashboard = powerbi.get(dashboardContainer); - - // Retrieve the dashboard id. - var dashboardId = dashboard.getId(); - - Log.logText("Dashboard id: \"" + dashboardId + "\""); -} - -function _Dashboard_FullScreen() { - // Get a reference to the embedded dashboard HTML element - var dashboardContainer = $('#dashboardContainer')[0]; - - // Get a reference to the embedded dashboard. - dashboard = powerbi.get(dashboardContainer); - - // Displays the dashboard in full screen mode. - dashboard.fullscreen(); -} - -function _Dashboard_ExitFullScreen() { - // Get a reference to the embedded dashboard HTML element - var dashboardContainer = $('#dashboardContainer')[0]; - - // Get a reference to the embedded dashboard. - dashboard = powerbi.get(dashboardContainer); - - // Exits full screen mode. - dashboard.exitFullscreen(); -} - -// ---- Dashboard Events Listener ---------------------------------------------------- - -function _DashboardEvents_TileClicked() { - // Get a reference to the embedded dashboard HTML element - var dashboardContainer = $('#dashboardContainer')[0]; - - // Get a reference to the embedded dashboard. - dashboard = powerbi.get(dashboardContainer); - - // dashboard.off removes a given event listener if it exists. - dashboard.off("tileClicked"); - - // dashboard.on will add an event listener. - dashboard.on("tileClicked", function (event) { - Log.log(event.detail); - }); -} - -// ---- Qna Events Listener ---------------------------------------------------- - -async function _Qna_SetQuestion() { - // Get a reference to the embedded Q&A HTML element - var qnaContainer = $('#qnaContainer')[0]; - - // Get a reference to the embedded Q&A. - qna = powerbi.get(qnaContainer); - - try { - const result = await qna.setQuestion("2014 total units YTD by manufacturer, region as treemap chart"); - Log.log(result); - } - catch (errors) { - Log.log(errors); - } -} - -function _Qna_QuestionChanged() { - // Get a reference to the embedded Q&A HTML element - var qnaContainer = $('#qnaContainer')[0]; - - // Get a reference to the embedded Q&A. - qna = powerbi.get(qnaContainer); - - // qna.off removes a given event listener if it exists. - qna.off("visualRendered"); - - // qna.on will add an event listener. - qna.on("visualRendered", function (event) { - Log.log(event.detail); - }); - - Log.logText("Change the question to see events in Log window."); -} - -// ---- Visual Events Listener ---------------------------------------------------- - -function _Visual_DataSelected() { - // Get a reference to the embedded visual HTML element - var visualContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded visual. - visual = powerbi.get(visualContainer); - - // Visual.off removes a given event listener if it exists. - visual.off("dataSelected"); - - // Visual.on will add an event listener. - visual.on("dataSelected", function (event) { - var data = event.detail; - Log.log(data); - }); - - // Select Run and select an element of a visualization. - // For example, a bar in a bar chart. You should see an entry in the Log window. - - Log.logText("Select data to see events in Log window."); -} - -// ---- Bookmarks Operations ---------------------------------------------------- -async function _Bookmarks_Enable() { - // The new settings that you want to apply to the report. - const newSettings = { - panes: { - bookmarks: { - visible: true - } - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - } - catch (error) { - Log.log(error); - } -} - -async function _Bookmarks_Disable() { - // The new settings that you want to apply to the report. - const newSettings = { - panes: { - bookmarks: { - visible: false - } - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await report.updateSettings(newSettings); - } - catch (error) { - Log.log(error); - } -} - -async function _Bookmarks_Get() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the bookmark collection and loop through to print the - // bookmarks' name and display name. - try { - const bookmarks = await report.bookmarksManager.getBookmarks(); - bookmarks.forEach(function (bookmark) { - var log = bookmark.name + " - " + bookmark.displayName; - Log.logText(log); - }); - } - catch (error) { - Log.log(error); - } -} - -async function _Bookmarks_Apply() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // bookmarksManager.apply will apply the bookmark with the - // given name on the report. - // This is the actual bookmark name not the display name. - try { - await report.bookmarksManager.apply("Bookmarkaf5fe203dc1e280a4822"); - Log.logText("Bookmark \"Q4 2014\" applied."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Bookmarks_Capture() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Capture the current bookmark and prints the bookmark's - // state string to Log window. - try { - const capturedBookmark = await report.bookmarksManager.capture(); - var log = "Captured bookmark state: " + capturedBookmark.state; - Log.logText(log); - } - catch (error) { - Log.log(error); - } -} - -async function _Bookmarks_ApplyState() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // bookmarksManager.applyState will apply the bookmark which - // represented by the given state string. - try { - await report.bookmarksManager.applyState("H4sIAAAAAAAAA+1d62/bOBL/VwIfDvmSXQyfEvvp2qa9La7Z7iW9HIpDP/AxcrRrS4Yspw2K/u9HSbbrxJal+J3USRBEMjUcDofD3zyofOu4eDjo6bvfdR87Lzqv0vSvvs7+OiGkc9ZJ7t8MlNbaEMuIoxGllFMS+VbpII/TZNh58a2T66yL+XU8HOleQdHf/F8HeEggcIZKwQyRwoEQnc/fzzr4ddBLM108fZXrHAsKt5gN/bXvlfwKnri2eXyLV2jz6u4lDtIsH19LAOcUVcwFRDsEEkjhn4niXu7JFOTM3Zuvg8xz8W0ymLflh75Vfjcorl/7jrtpFlvdmz5aPHk9YYSedd5mab+kMZaS8y3fJHmc3/mL84Lz75/POv+9wQzLZq/TxMUVw98678rfBRs4HFaCKpv0Rv0HnxRXV+kos3iJ0Y+LssPvXl5/ZOkAs7LTT6gzf8/3eq17o1LOnuj72DPvx1GwX9z2DSkQ/r5o+fm7/1UJfaa7Vmw8GOpCTs46N+mX1xn6Fq7zgpRdDatZKieied58ozUmbp1h+dG4kc0fjuwKu31M8gWDO3vAFNkGV4uEfZEm+U0LhugOxRQPr3XyMhs67NXowW1pD/yiyHWcjOdXRCQALYghKL0iEGeZKu4P46Tbw8qClPag/OtjNRajh7G9utH+wpsd86fXpoLY96JbVCIMGBNADRBpCSLCWgSp1NxbPIYBD3jIIMRgPYJhGEobSaCWc0IF1Ua7RoI5fs1N+nWemoCA+G9NRejXuCICDFmLvQBQCEIjFxolDA3ACb06e1QoFkZgNIAXoSUMmFmLPW8wmHCRlx+nEoQRwjYrTC17VitqGHcuJBqscIrz5snVpfF6Ncpzv0zmp5c5wyURwmgBjBmtgK9JUkZGBwJsgDSQzijCrF2D5Nlksy+e6aeuaH0TO4dJp1pClHk5MAcSqQ4DqwSDerO8q/3zQ0nuPUZ5ZbL6A53Fw4kBm1z9K078YoKzmYZrbbCXoyTxUj6Zbm+XcfemJLxgkyXFDnuv0UGySSs2twQE5liZ26IOYUeCGUZeuludWHRzXFygHo4ybMvGle7h8K2eZ+RjmuveyX+S2K+/eUZKiLRsJdveaOgnEV0lldc3Ossfrug0c5i9uiuXzXmcTXCyX3RvdjCkYtkutylGUCRWWxOC9bYROZAVd5WmnkJghHoYEXCp0ITInW426Sv1RKmjjCERBJwJnHeINN+/ndyKn/FgUTf7G2SrzkZrG7P1pf33ag2cXHi/GPMTD1oy3K+xWcTRySWhF6uYHqOzgzA3NWJutjshCwWTEeEOVUiMsVywNdEYRetBMTM2pAyFx2MhROs5BA6874uBDiVYiiIAuYZDoELBheSRjDRHMNa7VM2Iu5aaA6o1eHdAIkAowyCiwerUru97gGT/1vKIKo+o8lmiyhaM/Bb7Oczszd17vMXePD/Tz+c/mrBx7RWvCtyOleiRMzxeslMynXsjnDab4aS8efLjRvHxmP/FMUhoqRzPThqLg4Q/p2ac67tteV5VZsLz9udMmHusaBVAenbSnKyzZzi0yaL53Oj9PcAybP9Y5uj5Haqf9SQd0me3to/wYFYa/x75zQyPAjnipc3hpZ7fCY8g6bFIAkISomUoEIAhaENlc2x89fSe0pQLIFZZKqWTwMMWIZ3lIbFIGxABUwGC4iEn1pF1SDaNwCkeKAdaoUXtQPBxgnLlCBy3Aoo8AUehADToQOJaBKVENJ4mOi/gACjTMlyLIPPKYbmIDAFDVUFa0UaCtXE4RgUGTAMBisY4Io2w9fi1XY1LO0AbzwLadx68Wp2nvsctw9p4rqgn1/lo2ArQnl6gi0f9003B2tlR1zDVVNfzYw5mtqR2EzCcnYAZFFkv/9bRxnYQdjonc8P/x1QyQJvDjeedmmDjppD0HDvbDznWq8a7vu4uwvGNW3J/1MvjS/+MztyCXIaxQWikJAGzTFlumMajIagzBO/TL0crcFBWgBytwAasAHdFtZrWwsMVh9y6SDXjqWEvtqUO/iDW6WPWLUXexaSaKq9Gg4r/GIc/LMv9vzYWAXuZlInTduk8urE82dQ1WKaqzjfK4z6eFqXYv4D8BchHgBflz+njMnxsn5wTMs95uQLH6Xid6wXTPsy9V3g+Lu7HckNZTUp+aSXu0YQI/MLIR+qpyBdc/aooGxOrvIullE5fYf4FMTmdmJr6+gfysP5h/YDn+F7VbeRoRDiw4scGRmhlw/rtenchx4knf1JoKnqXuC7suIah2kfRSe24qumg3llkwmnLnHKa01DoJYWyP9feTRrNCtvl3k1a4KmfENH+5udnz5D26cOnB5nAA6gBPcgCoXEd0yGVB7UT/WBW9NOqoHrp76SmbDC3xmaOqS2bhlPP6y0mMfpN55G4cw/MXnh8Vh0NnUGaOz3mV5MA2tZe/Xuazw9kZxt4VVM2hT3XhWCbHYRk1OvVz85m690W8bZK+nIjOjPNYO2Vi9nbe6s7WIq1dsrJ364G2uKCaE0rLl5mcX7T966jnTXim9XhaQHpTPXmdH1dWd/avbnVC5Kg22ej7N1bpdK/+TAobG/qrRw7hBnds14tjQS2AJGD+DbNP2rTw307tnWWtNiWFmbqPfR9hGvS3l59LtEHEcoYQqzz/rQAIsAJWY+hj270HhNhRzf6cDPET9+RDnkUSB4CJ1oHoYaiQqEgsXoeoiYa3Sbqe+6fcOmXmbDvAl9/iZ1a1S4dHf1N1/8+T1etKvS9X3786cOnk9c3Ouk2+2xwvn2PrQWL27di/8R0TomwWzyyVzT5eG/2kPI4T8qxfHalpWsVsm/r7VM77n+1N2msc4xrg2bnGevkRie48g85SCskDRhHamUIDPEgst6P2tyeXO67YXRVBjwIlaFUO+4E0wY4Z7Ak/fWzu4kHkG39uaInzQWEOy1CeLYFhIpFBGkoDePGUUIoZc3nP3bruEMEDFQUKAJcaYWasGOi/mn479vcvxsPyj7BXXvBa5IWhK6Co/b/xNrfNvzwpNS/Pq9VNJTFm/pMcbSPSMuUUs661d2Il91uhl09UeV1yn6XILk0qwb5dpSMhQe78bsfjS538DK5PYq80iChNNcq4NSYgJPQGS2bX4x71KCjBk01iBlwkikRAsiQUsXAHSvGW6e6d3ra65jqPtAzkE/fXV74n1DWcpc3d96uO6uTZRB7u8rYrY2St1DGN3qYz2jj0hNorU56FW9gmI0blF//B2OhSYYdZwAA"); - Log.logText("Bookmark applied from given state."); - } - catch (error) { - Log.log(error); - } -} - -async function _Bookmarks_EnterPresentation() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Enter bookmarks play mode - try { - await report.bookmarksManager.play(models.BookmarksPlayMode.Presentation); - Log.logText("Bookmarks play mode is on, check the play bar at the bottom of the report."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Bookmarks_ExitPresentation() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Exit bookmarks play mode - try { - await report.bookmarksManager.play(models.BookmarksPlayMode.Off); - Log.logText("Bookmarks play mode is off."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_GetSlicer() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive; - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var slicer = visuals.filter(function (visual) { - return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90"; - })[0]; - - // Get the slicer state which contains the slicer filter. - const state = await slicer.getSlicerState(); - Log.log(state); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_SetSlicer() { - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#advanced", - target: { - table: "Date", - column: "Date" - }, - filterType: 0, - logicalOperator: "And", - conditions: [ - { - operator: "GreaterThanOrEqual", - value: "2014-10-12T21:00:00.000Z" - }, - { - operator: "LessThan", - value: "2014-11-28T22:00:00.000Z" - } - ] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive; - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var slicer = visuals.filter(function (visual) { - return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90"; - })[0]; - - // Set the slicer state which contains the slicer filters. - await slicer.setSlicerState({ filters: [filter] }); - Log.logText("Date slicer was set."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_SetFilters() { - // Build the filter you want to use. For more information, See Constructing - // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. - const filter = { - $schema: "http://powerbi.com/product/schema#advanced", - target: { - table: "SalesFact", - measure: "Total Category Volume" - }, - filterType: 0, - logicalOperator: "And", - conditions: [ - { - operator: "LessThan", - value: 500 - } - ] - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - // Set the filter for the visual. - // Pay attention that setFilters receives an array. - await visual.setFilters([filter]); - Log.logText("Filter was set for \"Category Breakdown\" table.") - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_GetFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - const filters = await visual.getFilters(); - Log.log(filters); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_RemoveFilters() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - await visual.removeFilters(); - Log.logText("\"Sentiment by Year and Months\" visual filters were removed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_ExportData_Summarized() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - const result = await visual.exportData(models.ExportDataType.Summarized); - Log.logCsv(result.data); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Visual_ExportData_Underlying() { - // Get models. models contains enums that can be used. - var models = window['powerbi-client'].models; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Retrieve the page collection and get the visuals for the first page. - try { - const pages = await report.getPages(); - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - const visuals = await activePage.getVisuals(); - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - // Exports visual data - const result = await visual.exportData(models.ExportDataType.Underlying); - Log.logCsv(result.data); - } - catch (errors) { - Log.log(errors); - } -} - -async function _ReportVisual_UpdateSettings() { - // The new settings that you want to apply to the report. - const newSettings = { - panes: { - filters: { - visible: true - } - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await visual.updateSettings(newSettings); - Log.logText("Filter pane was added."); - } - catch (error) { - Log.log(error); - } -} - -async function _ReportVisual_HideSingleVisualHeader() { - - // Define settings to hide the header of a single visual - var newSettings = { - visualSettings: { - visualHeaders: [ - { - settings: { - visible: true - } - // No selector - Show visual header for all the visuals in the report - }, - { - settings: { - visible: false - }, - selector: { - $schema: "http://powerbi.com/product/schema#visualSelector", - visualName: "47eb6c0240defd498d4b" - // The visual name can be retrieved using getVisuals() - // Hide visual header for a single visual only - } - } - ] - } - }; - - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - visual = powerbi.get(embedContainer); - - // Update the settings by passing in the new settings you have configured. - try { - await visual.updateSettings(newSettings); - Log.logText("Visual header was successfully hidden for 'Sentiment by Year and Months' visual."); - } - catch (error) { - Log.log(error); - } -} - -async function _Report_Authoring_Create() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - - // Creating new visual - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization - const response = await page.createVisual('clusteredColumnChart'); - - let visual = response.visual; - - // Defining data fields - const regionColumn = { column: 'Region', table: 'Geo', schema: 'http://powerbi.com/product/schema#column' }; - const totalUnitsMeasure = { measure: 'Total Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' }; - const totalVanArsdelUnitsMeasure = { measure: 'Total VanArsdel Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' }; - - // Setting visual data fields - visual.addDataField('Category', regionColumn); - visual.addDataField('Y', totalUnitsMeasure); - visual.addDataField('Y', totalVanArsdelUnitsMeasure); - - // Personalizing the visual - visual.setProperty({ objectName: "title", propertyName: "textSize" }, { schema: 'http://powerbi.com/product/schema#property', value: 8 }); - visual.setProperty({ objectName: "title", propertyName: "fontColor" }, { schema: 'http://powerbi.com/product/schema#property', value: '#000000' }); - - // Visit: https://github.com/microsoft/powerbi-report-authoring/wiki for full documentation - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_ChangeType() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization - await visual.changeType('waterfallChart'); - Log.logText("Last visual type was changed."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_Remove() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization - await page.deleteVisual(visual.name); - Log.logText("Last visual was deleted."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_Capabilities() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Getting visual capabilities - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - const capabilities = await visual.getCapabilities(); - Log.logText("Visual capabilities:"); - Log.log(capabilities); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_AddDataField() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Getting 'Y' role data fields - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - const dataFields = await visual.getDataFields('Y'); - - // Removing the second data field of 'Y' role, in order to add Legend/Breakdown - if (dataFields.length > 1) - visual.removeDataField('Y', 1); - - // Adding Legend/Breakdown data role - if (visual.type === 'clusteredColumnChart') { - const quarterColumn = { column: 'Quarter', table: 'Date', schema: 'http://powerbi.com/product/schema#column' }; - await visual.addDataField('Series', quarterColumn); - Log.logText("Data field was added to last visual."); - } - else { - const categoryColumn = { column: 'Category', table: 'Product', schema: 'http://powerbi.com/product/schema#column' }; - await visual.addDataField('Breakdown', categoryColumn); - Log.logText("Data field was added to last visual."); - } - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_RemoveDataField() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - let dataRole = visual.type === 'clusteredColumnChart' ? 'Series' : 'Breakdown'; - - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - const dataFields = await visual.getDataFields(dataRole); - - // Removing Legend/Breakdown data field - if (dataFields.length > 0) { - await visual.removeDataField(dataRole, 0); - Log.logText("Data field was removed from last visual."); - } - else { - Log.log("Please add additional data field first."); - } - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_GetDataField() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Getting 'Y' role data fields - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - const dataFields = await visual.getDataFields('Y'); - Log.logText("Visual 'Y' fields:"); - Log.log(dataFields); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_GetProperty() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Get legend position property - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties - const property = await visual.getProperty({ objectName: "legend", propertyName: "position" }); - Log.logText("Last visual - legend position property:"); - Log.log(property); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_SetProperty() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Set legend position to bottom center - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties - await visual.setProperty({ objectName: "legend", propertyName: "position" }, { schema: 'http://powerbi.com/product/schema#property', value: 'BottomCenter' }); - Log.logText("Last visual legend position was set to bottom center."); - } - catch (errors) { - Log.log(errors); - } -} - -async function _Report_Authoring_ResetProperty() { - // Get a reference to the embedded report HTML element - var embedContainer = $('#embedContainer')[0]; - - // Get a reference to the embedded report. - report = powerbi.get(embedContainer); - - // Util function - setting authoring page as active - // For implementation please check 'Navigation > Page - Set active' code sample. - try { - const page = await SetAuthoringPageActive(report); - const visuals = await page.getVisuals(); - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } - - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Reset visual legend position - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties - await visual.resetProperty({ objectName: "legend", propertyName: "position" }); - Log.logText("Last visual legend position property was reset to default value."); - } - catch (errors) { - Log.log(errors); - } -} diff --git a/demo/v2-demo/scripts/function_mapping.js b/demo/v2-demo/scripts/function_mapping.js deleted file mode 100644 index c7dec2d4..00000000 --- a/demo/v2-demo/scripts/function_mapping.js +++ /dev/null @@ -1,86 +0,0 @@ -const mockDict = { - _Report_GetPages: datasetNotSupported, - _Report_SetPage: datasetNotSupported, - _Report_SetFilters: datasetNotSupported, - _Report_GetFilters: datasetNotSupported, - _Report_RemoveFilters: datasetNotSupported, - _Report_PrintCurrentReport: datasetNotSupported, - _Report_UpdateSettings: datasetNotSupported, - _Report_Reload: datasetNotSupported, - _Page_SetActive: datasetNotSupported, - _Page_SetFilters: datasetNotSupported, - _Page_GetFilters: datasetNotSupported, - _Page_RemoveFilters: datasetNotSupported, - _Page_GetVisuals: datasetNotSupported, - _Report_switchModeEdit: datasetNotSupported, - _Report_switchModeView: datasetNotSupported, - _Embed_BasicEmbed: _Mock_Embed_BasicEmbed_ViewMode, - _Embed_BasicEmbed_EditMode: _Mock_Embed_BasicEmbed_EditMode, - _Report_save: _Mock_Report_save, - _Report_saveAs: _Mock_Report_save, - _Embed_Create: _Mock_Embed_Create -}; - -function datasetNotSupported() { - Log.logText('Operation not supported for dataset') -} - -function IsSaveMock(funcName) { - const sampleId = GetSession(SessionKeys.SampleId); - const isSample = sampleId && (_session.embedId === sampleId); - return ((funcName === '_Report_save' || funcName === '_Report_saveAs') && isSample); -} - -function IsBasicMock(funcName) { - const sampleId = GetSession(SessionKeys.SampleId); - const isSample = sampleId && (_session.embedId === sampleId); - return ((funcName === '_Embed_BasicEmbed' || funcName === '_Embed_BasicEmbed_EditMode') && isSample); -} - -function IsCreateMock(funcName) { - const sampleId = GetSession(SessionKeys.SampleId); - const isSample = sampleId && (_session.embedId === sampleId); - return (funcName === '_Embed_Create' && isSample); -} - -function IsNotSupported(funcName) { - if (powerbi.embeds.length === 0) { - return false - } - - const notReportMatch = funcName.match(/Dashboard|Tile|Qna|Visual|Mobile|PaginatedReport/); - if (notReportMatch) { - return false; - } - - // Get a reference to the embedded element - const container = '#embedContainer'; - let embed = powerbi.get($(container)[0]); - if (embed.config.type !== 'create') { - return false; - } - - const runFunc = mockDict[funcName]; - return (runFunc && runFunc === datasetNotSupported) ? true : false; -} - -function IsMock(funcName) { - return (IsBasicMock(funcName) || IsSaveMock(funcName) || IsCreateMock(funcName) || IsNotSupported(funcName)); -} - -function mapFunc(func) { - const funcName = getFuncName(func); - return IsMock(funcName) ? mockDict[funcName] : func; -} - -function getFuncName(func) { - let funcName = func.name; - - if (!funcName) - { - // in IE, func.name is invalid method. so, function name should be extracted manually. - funcName = func.toString().match(/^function\s*([^\s(]+)/)[1]; - } - - return funcName; -} \ No newline at end of file diff --git a/demo/v2-demo/scripts/guid.js b/demo/v2-demo/scripts/guid.js deleted file mode 100644 index f259a200..00000000 --- a/demo/v2-demo/scripts/guid.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Generates a 20 character uuid. - */ -function generateNewGuid() { - let d = new Date().getTime(); - if (typeof performance !== 'undefined' && typeof performance.now === 'function') { - d += performance.now(); - } - return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - - // Generate a random number, scaled from 0 to 15. - const r = (getRandomValue() % 16); - - // Shift 4 times to divide by 16 - d >>= 4; - return r.toString(16); - }); -} \ No newline at end of file diff --git a/demo/v2-demo/scripts/index.js b/demo/v2-demo/scripts/index.js deleted file mode 100644 index 1e5b6543..00000000 --- a/demo/v2-demo/scripts/index.js +++ /dev/null @@ -1,91 +0,0 @@ -var sampleContentLoaded = false; -var documentationContentLoaded = false; -var showcasesContentLoaded = false; - -$(function() { - OpenSampleSection(); - WarmStartSampleReportEmbed(); -}); - -function OpenSampleSection() { - OpenEmbedWorkspace("#main-sample", "step_samples.html"); -} - -function OpenEmbedWorkspace(activeTabSelector, samplesStepHtml) -{ - if (!sampleContentLoaded) - { - // Open Report Sample. - $("#sampleContent").load("sample.html", function() { - $("#mainContent").load("report.html"); - sampleContentLoaded = true; - }); - } - - $("#samples-step-wrapper").load(samplesStepHtml); - SetActiveStyle(activeTabSelector); - - $(".content").hide(); - $("#sampleContent").show(); - - LayoutShowcaseState.layoutReport = null; - BookmarkShowcaseState.bookmarksReport = null; -} - -function OpenDocumentationSection() { - if (!documentationContentLoaded) - { - $("#documentationContent").load("docs.html"); - documentationContentLoaded = true; - } - - SetActiveStyle("#main-docs"); - - $(".content").hide(); - $("#documentationContent").show(); - trackEvent(TelemetryEventName.SectionOpen, { section: TelemetrySectionName.Documentation, src: TelemetryEventSource.UserClick }); -} - -function OpenShowcasesSection() { - if (!showcasesContentLoaded) - { - $('#embedContainer').removeAttr('id'); - $("#showcasesContent").load("showcases.html"); - showcasesContentLoaded = true; - } - - SetActiveStyle("#main-showcases"); - - $(".content").hide(); - $("#showcasesContent").show(); - trackEvent(TelemetryEventName.SectionOpen, { section: TelemetrySectionName.Showcase, src: TelemetryEventSource.UserClick }); -} - -function SetActiveStyle(id) -{ - $("#main-ul li").removeClass("main-li-active"); - $(id).addClass("main-li-active"); -} - -const ShowcasesHtmls = { - CustomLayout: "./live_showcases/custom_layout/showcase_custom_layout.html", - Bookmarks: "./live_showcases/bookmarks/showcase_bookmarks.html", - Themes: "./live_showcases/themes/showcase_themes.html", - InsightToAction: "./live_showcases/insight_to_action/showcase_insight_to_action.html", - QuickVisualCreator: "./live_showcases/quick_visual_creator/showcase_quick_visual_creator.html", -}; - -function OpenShowcase(showcaseType) { - $("#showcasesContent").load(ShowcasesHtmls[showcaseType]); - showcasesContentLoaded = false; - trackEvent(TelemetrySectionName.Showcase, { showcaseType: showcaseType, src: TelemetryEventSource.UserClick }); -} - -function OpenShowcaseFromURL(showcase) { - $("#showcasesContent").load(ShowcasesHtmls[showcase]); - SetActiveStyle("#main-showcases"); - - $(".content").hide(); - $("#showcasesContent").show(); - trackEvent(TelemetrySectionName.Showcase, { showcaseType: showcase, src: TelemetryEventSource.Url }); -} \ No newline at end of file diff --git a/demo/v2-demo/scripts/logger.js b/demo/v2-demo/scripts/logger.js deleted file mode 100644 index 2de78f09..00000000 --- a/demo/v2-demo/scripts/logger.js +++ /dev/null @@ -1,99 +0,0 @@ -function InitLogger(divId) { - - var Logger = {}; - - // Normal character takes ~1.5 width more than a space ' '. - Logger.spaceWidthCorrection = 1.3; - - Logger.log = function (event) { - this.logText("Json Object\n" + JSON.stringify(event, null, " ")); - }; - - Logger.logText = function (text) { - let textbox = document.getElementById(divId); - - if (!textbox.value) - { - textbox.value = ""; - } - - textbox.value += "> " + text + "\n"; - - textbox.scrollTop = textbox.scrollHeight; - }; - - Logger.logCsv = function (text) { - let textbox = document.getElementById(divId); - - if (!textbox.value) - { - textbox.value = ""; - } - - let maxLength = 0; - let lines = text.split("\r\n"); - let valuesPerLine = []; - - let log = "> CSV result in table view: \n\n"; - if (!lines || lines.length === 0) { - log += "No data"; - } - else { - // Calcualte values per line, and calculate max length for pretty print. - for (let i = 0; i < lines.length; ++i) { - valuesPerLine[i] = lines[i].split(","); - valuesPerLine[i].forEach(function (val) { - if (val.length > maxLength) { - maxLength = val.length; - } - }); - } - - // Add 2 spaces before and after. - maxLength += 4; - - // Print title line - var title = this.getLineText(valuesPerLine[0], maxLength); - log += title + "\n"; - log += this.repeatChar("-", title.length) + "\n"; - - // Print all lines - for (let i = 1; i < lines.length; ++i) { - log += this.getLineText(valuesPerLine[i], maxLength) + "\n" - } - } - - textbox.value += log; - textbox.scrollTop = textbox.scrollHeight; - }; - - Logger.getLineText = function (values, spacesPerWord) { - var text = ""; - _this = this; - values.forEach(function (val) { - text += _this.getCenteredText(val, spacesPerWord); - }); - return text; - }; - - Logger.getCenteredText = function (value, spaces) { - var text = ""; - - let spacesBefore = (spaces - value.length) / 2; - let spacesAfter = spaces - value.length - spacesBefore; - text += this.repeatChar(" ", spacesBefore * this.spaceWidthCorrection); - text += value; - text += this.repeatChar(" ", spacesAfter * this.spaceWidthCorrection); - return text; - }; - - Logger.repeatChar = function (char, times) { - let text = ""; - for (let i = 0; i < times; ++i) { - text += char; - } - return text; - }; - - return Logger; -} diff --git a/demo/v2-demo/scripts/report.js b/demo/v2-demo/scripts/report.js deleted file mode 100644 index 6eb488a9..00000000 --- a/demo/v2-demo/scripts/report.js +++ /dev/null @@ -1,742 +0,0 @@ -const active_class = 'active'; -const active_steps_li = 'steps-li-active'; -const active_tabs_li = 'tabs-li-active'; -const active_mode = 'active-mode' - -const EmbedViewMode = "view"; -const EmbedEditMode = "edit"; -const EmbedCreateMode = "create"; - -const runEmbedCodeTimeout = 500; -const interactTooltipTimeout = 2000; - -const defaultTokenType = 1; -const defaultQnaQuestion = "2014 total units YTD var % by month, manufacturer as clustered column chart"; -const defaultQnaMode = "Interactive"; -const interactiveNoQuestionMode = "InteractiveNoQuestion"; - -function OpenSamplesStep() { - $('#steps-ul a').removeClass(active_class); - $('.'+ active_steps_li).removeClass(active_steps_li); - - $("#steps-samples a").addClass(active_class); - $("#steps-samples a").addClass(active_steps_li); - - $('#interact-tab').removeClass('enableTransition'); - $('#interact-tab').removeClass('changeColor'); - - // Hide Embed view in samples step. - $("#samples-step-wrapper").show(); - $("#embed-and-interact-steps-wrapper").hide(); - - $("#welcome-text").show(); - - trackEvent(TelemetryEventName.InnerSectionOpen, { section: TelemetryInnerSection.Sample, src: TelemetryEventSource.UserClick }); -} - -function OpenCodeStepFromNavPane() -{ - const mode = GetSession(SessionKeys.EmbedMode); - const entityType = GetSession(SessionKeys.EntityType); - const tokenType = GetSession(SessionKeys.TokenType); - - OpenCodeStep(mode, entityType, tokenType); -} - -function OpenCodeStep(mode, entityType, tokenType) { - $('#steps-ul a').removeClass(active_class); - $('.' + active_steps_li).removeClass(active_steps_li); - - $('#steps-code a').addClass(active_class); - $('#steps-code a').addClass(active_steps_li); - - // Hide Embed view in samples step. - $("#samples-step-wrapper").hide(); - $("#embed-and-interact-steps-wrapper").show(); - - $("#welcome-text").hide(); - $("#playground-banner").hide(); - - $("#highlighter").empty(); - - let containers = $(".iframeContainer"); - containers.removeClass(active_class); - - const containerID = getEmbedContainerID(entityType); - const classPrefix = getEmbedContainerClassPrefix(entityType); - - $(classPrefix + 'Container').removeAttr('id'); - $(classPrefix + 'MobileContainer').removeAttr('id'); - - // remove ID if exists on any container - $("#" + containerID).removeAttr('id'); - - const activeContainer = classPrefix + ($(".desktop-view").hasClass(active_class) ? 'Container' : 'MobileContainer'); - - $(activeContainer).attr('id', containerID); - $(activeContainer).addClass(active_class); - - $('.' + active_tabs_li).removeClass(active_tabs_li); - - $('#embed-tab').addClass(active_tabs_li); - $('#interact-tab').removeClass(active_tabs_li); - - LoadEmbedSettings(mode, entityType, tokenType); - - trackEvent(TelemetryEventName.InnerSectionOpen, { section: TelemetryInnerSection.Code, src: TelemetryEventSource.UserClick }); -} - -function bootstrapIframe(entityType) { - const activeContainer = getActiveEmbedContainer(); - - // To avoid multiple bootstrap when switching between Desktop view and Phone view - // and also when changing the mode (view/edit/create). - if (activeContainer.children.length > 0) { - // entity is already embedded - return; - } - - // Bootstrap iframe - for better performance. - let embedUrl = GetSession(SessionKeys.EmbedUrl); - config = { - type: entityType.toLowerCase(), - embedUrl: embedUrl - }; - - const isMobile = $(".mobile-view").hasClass(active_class); - if (isMobile) { - config.settings = { - layoutType: models.LayoutType.MobilePortrait - }; - } - - // Hide the container in order to hide the spinner. - $(activeContainer).css({"visibility":"hidden"}); - powerbi.bootstrap(activeContainer, config); -} - -function LoadEmbedSettings(mode, entityType, tokenType) { - if (entityType == EntityType.Report) - { - $("#settings").load("settings_embed_report.html", function() { - OpenEmbedMode(mode, entityType, tokenType); - }); - } - else if (entityType == EntityType.Visual) - { - $("#settings").load("settings_embed_visual.html", function() { - OpenEmbedMode(mode, entityType, tokenType); - }); - } - else if (entityType == EntityType.Dashboard) - { - $("#settings").load("settings_embed_dashboard.html", function() { - OpenEmbedMode(mode, entityType, tokenType); - }); - } - else if (entityType == EntityType.Tile) - { - $("#settings").load("settings_embed_tile.html", function() { - OpenEmbedMode(mode, entityType, tokenType); - }); - } - else if (entityType == EntityType.Qna) - { - $("#settings").load("settings_embed_qna.html", function() { - OpenEmbedMode(mode, entityType,tokenType); - }); - } - else if (entityType == EntityType.PaginatedReport) - { - $("#settings").load("settings_embed_paginatedreport.html", function() { - OpenEmbedMode(mode, entityType,tokenType); - }); - } -} - -function OpenEmbedTab() { - if ($('#embed-tab').hasClass(active_tabs_li)) { - return; - } - - $('.' + active_tabs_li).removeClass(active_tabs_li); - - $('#embed-tab').addClass(active_tabs_li); - - const mode = GetSession(SessionKeys.EmbedMode); - const entityType = GetSession(SessionKeys.EntityType); - const tokenType = GetSession(SessionKeys.TokenType); - - LoadEmbedSettings(mode, entityType, tokenType); -} - -function isInteractStepEnabled(entityType) { - const classPrefix = getEmbedContainerClassPrefix(entityType); - const activeContainer = classPrefix + ($(".desktop-view").hasClass(active_class) ? 'Container' : 'MobileContainer'); - - // Check if active container has an iframe - return $(activeContainer + " iframe").length > 0; -} - -function OpenInteractTab() { - const entityType = GetSession(SessionKeys.EntityType); - // Interact step is disabled unless active container has an iframe - if (!isInteractStepEnabled(entityType)) { - $('.interactTooltip .tooltipText').addClass("showTooltip"); - setTimeout(function() { - $('.interactTooltip .tooltipText').removeClass("showTooltip"); - }, interactTooltipTimeout); - return; - } - $('#interact-tab').removeClass('enableTransition'); - $('#interact-tab').removeClass('changeColor'); - - $('.' + active_tabs_li).removeClass(active_tabs_li); - $('#interact-tab').addClass(active_tabs_li); - - if (entityType == EntityType.Tile) - { - $("#settings").load("settings_interact_tile.html", function() { - SetToggleHandler("operation-categories"); - LoadCodeArea("#embedCodeDiv", ""); - }); - } - else if (entityType == EntityType.Dashboard) - { - $("#settings").load("settings_interact_dashboard.html", function() { - SetToggleHandler("operation-categories"); - LoadCodeArea("#embedCodeDiv", ""); - hideFeaturesOnMobile(); - }); - } - else if (entityType == EntityType.Qna) - { - $("#settings").load("settings_interact_qna.html", function() { - const isResultOnlyMode = GetSession(SessionKeys.QnaMode) === "ResultOnly"; - // Hide set question on interactive mode - $('#qna-operations').toggle(isResultOnlyMode); - SetToggleHandler("operation-categories"); - LoadCodeArea("#embedCodeDiv", ""); - }); - } - else if (entityType == EntityType.Visual) - { - $("#settings").load("settings_interact_visual.html", function() { - SetToggleHandler("operation-categories"); - LoadCodeArea("#embedCodeDiv", ""); - }); - } - else if (entityType == EntityType.PaginatedReport) - { - $("#settings").load("settings_interact_paginatedreport.html", function() { - SetToggleHandler("operation-categories"); - LoadCodeArea("#embedCodeDiv", ""); - }); - } - else - { - $("#settings").load("settings_interact_report.html", function() { - SetToggleHandler("operation-categories"); - LoadCodeArea("#embedCodeDiv", ""); - $('.hideOnReportCreate').toggle(GetSession(SessionKeys.EmbedMode) !== EmbedCreateMode); - hideFeaturesOnMobile(); - }); - } -} - -function setCodeArea(mode, entityType) -{ - LoadCodeArea("#embedCodeDiv", getEmbedCode(mode, entityType)); -} - -function getEmbedCode(mode, entityType) -{ - const isDesktop = $(".desktop-view").hasClass(active_class); - let code = ""; - if (entityType == EntityType.Report) - { - if (mode === EmbedViewMode) - { - code = isDesktop ? _Embed_BasicEmbed : _Embed_BasicEmbed_Mobile; - } - else if (mode === EmbedEditMode) - { - code = isDesktop ? _Embed_BasicEmbed_EditMode : _Embed_MobileEditNotSupported; - } - else if (mode === EmbedCreateMode) - { - code = isDesktop ? _Embed_Create : _Embed_MobileCreateNotSupported; - } - } - else if (entityType == EntityType.Visual) { - code = _Embed_VisualEmbed; - } - else if (entityType == EntityType.Dashboard) - { - code = isDesktop ? _Embed_DashboardEmbed : _Embed_DashboardEmbed_Mobile; - } - else if (entityType == EntityType.Tile) - { - code = _Embed_TileEmbed; - } - else if (entityType == EntityType.Qna) - { - code = GetParameterByName(SessionKeys.TokenType) === '0' /* AAD Token */ ? _Embed_QnaEmbed_Aad : _Embed_QnaEmbed; - } - else if (entityType == EntityType.PaginatedReport) - { - code = _Embed_PaginatedReportBasicEmbed - } - return code; -} - -function showEmbedSettings(mode, entityType, tokenType) -{ - if (entityType == EntityType.Report) - { - let inputDivToShow = "#embedModeInput"; - let inputDivToHide = "#createModeInput"; - - if (mode === EmbedCreateMode) - { - inputDivToShow = "#createModeInput"; - inputDivToHide = "#embedModeInput"; - } - - $(inputDivToShow).show(); - $(inputDivToHide).hide(); - - let embedModeRadios = $('input:radio[name=embedMode]'); - embedModeRadios.filter('[value=' + mode + ']').prop('checked', true); - - let embedTypeRadios = $('input:radio[name=tokenType]'); - embedTypeRadios.filter('[value=' + tokenType + ']').prop('checked', true); - } - else if (entityType == EntityType.Visual) { - $("#embedModeInput").show(); - let embedTypeRadios = $('input:radio[name=tokenType]'); - embedTypeRadios.filter('[value=' + tokenType + ']').prop('checked', true); - } - else if (entityType == EntityType.Dashboard) - { - // Do nothing. - } -} - -function OpenEmbedMode(mode, entityType, tokenType) -{ - if (entityType == EntityType.Report) - { - if (mode == EmbedCreateMode) - { - if (IsEmbeddingSampleReport()) - { - LoadSampleDatasetIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - }); - } - else - { - SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - } - } - else - { - if (IsEmbeddingSampleReport()) - { - LoadSampleReportIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - }); - } - else - { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - } - } - } - else if (entityType == EntityType.Visual) - { - LoadSettings = function() { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - SetTextboxFromSessionOrUrlParam(SessionKeys.PageName, "#txtPageName"); - SetTextboxFromSessionOrUrlParam(SessionKeys.VisualName, "#txtVisualName"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - }; - - if (IsEmbeddingSampleReport()) - { - LoadSampleVisualIntoSession().then(function (response) { - LoadSettings(); - }); - } - else - { - LoadSettings(); - } - } - else if (entityType == EntityType.Dashboard) - { - if (IsEmbeddingSampleDashboard()) - { - LoadSampleDashboardIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtDashboardEmbed", "#txtEmbedDashboardId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - }); - } - else - { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtDashboardEmbed", "#txtEmbedDashboardId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - } - } - else if (entityType == EntityType.Tile) - { - if (IsEmbeddingSampleTile()) - { - LoadSampleTileIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtTileEmbed", "#txtEmbedTileId", "#txtEmbedDashboardId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - }); - } - else - { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtTileEmbed", "#txtEmbedTileId", "#txtEmbedDashboardId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - } - } - else if (entityType == EntityType.Qna) - { - LoadSettings = function() { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtQnaEmbed", "#txtDatasetId"); - SetTextboxFromSessionOrUrlParam(SessionKeys.QnaQuestion, "#txtQuestion"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - let qnaMode = GetParameterByName(SessionKeys.QnaMode); - if (qnaMode) { - let modesRadios = $('input:radio[name=qnaMode]'); - modesRadios.filter('[id=' + qnaMode + ']').prop('checked', true); - qnaMode = qnaMode !== interactiveNoQuestionMode ? qnaMode : defaultQnaMode; - SetSession(SessionKeys.QnaMode, qnaMode); - } - }; - - if (IsEmbeddingSampleQna()) - { - LoadSampleQnaIntoSession().then(function (response) { - if (!GetSession(SessionKeys.QnaQuestion)) { - SetSession(SessionKeys.QnaQuestion, defaultQnaQuestion); - } - - LoadSettings(); - }); - } - else - { - LoadSettings(); - } - } - else if (entityType == EntityType.PaginatedReport) { - if (IsEmbeddingSamplePaginatedReport()) { - LoadSamplePaginatedReportIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - }); - } - else { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - setCodeAndShowEmbedSettings(mode, entityType, tokenType); - } - } -} - -function setCodeAndShowEmbedSettings(mode, entityType, tokenType) { - setCodeArea(mode, entityType); - showEmbedSettings(mode, entityType, tokenType); - bootstrapIframe(entityType); -} - -function OpenViewMode() { - SetSession(SessionKeys.EmbedMode, EmbedViewMode); - OpenEmbedMode(EmbedViewMode, EntityType.Report); -} - -function OpenEditMode() { - SetSession(SessionKeys.EmbedMode, EmbedEditMode); - OpenEmbedMode(EmbedEditMode, EntityType.Report); -} - -function OpenCreateMode() { - SetSession(SessionKeys.EmbedMode, EmbedCreateMode); - OpenEmbedMode(EmbedCreateMode, EntityType.Report); -} - -function IsEmbeddingSampleReport() { - return GetSession(SessionKeys.IsSampleReport) == true; -} - -function IsEmbeddingSampleDashboard() { - return GetSession(SessionKeys.IsSampleDashboard) == true; -} - -function IsEmbeddingSampleTile() { - return GetSession(SessionKeys.IsSampleTile) == true; -} - -function IsEmbeddingSampleQna() { - return GetSession(SessionKeys.IsSampleQna) == true; -} - -function IsEmbeddingSamplePaginatedReport() { - return GetSession(SessionKeys.IsSamplePaginatedReport) == true; -} - -function ToggleQuestionBox(enabled) { - UpdateSession("input[name='qnaMode']:checked", SessionKeys.QnaMode); - let txtQuestion = $("#txtQuestion"); - if (enabled === true) { - let question = GetSession(SessionKeys.QnaQuestion); - question = question ? question : defaultQnaQuestion; - txtQuestion.val(question); - txtQuestion.prop('disabled', false); - } - else { - txtQuestion.val(""); - txtQuestion.prop('disabled', true); - } -} - -function OnTokenTypeRadioClicked(tokenType) { - SetSession(SessionKeys.TokenType, tokenType); - const entityType = GetSession(SessionKeys.EntityType); - - if (tokenType == 0 /* AAD Token */) { - $('.inputLine input').each(function () { - $(this).val(""); - let onChangeFunc = $(this).attr("onchange"); - if (onChangeFunc) { - // Change 'this' to button's identifier - onChangeFunc = onChangeFunc.replace("this", "'input#" + $(this).attr('id') + "'"); - eval(onChangeFunc); - } - }); - - } else { - // Moving to embed token will reload the sample - ReloadSample(entityType); - } -} - -function ReloadSample(entityType) { - const mode = GetSession(SessionKeys.EmbedMode); - SetIsSample(true); - - if (entityType == EntityType.Report) - { - if (mode == EmbedCreateMode) - { - LoadSampleDatasetIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId"); - }); - } - else - { - LoadSampleReportIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - }); - } - } - else if (entityType == EntityType.Visual) - { - LoadSampleVisualIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - SetTextboxFromSessionOrUrlParam(SessionKeys.PageName, "#txtPageName"); - SetTextboxFromSessionOrUrlParam(SessionKeys.VisualName, "#txtVisualName"); - }); - } - else if (entityType == EntityType.Dashboard) - { - LoadSampleDashboardIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtDashboardEmbed", "#txtEmbedDashboardId"); - }); - } - else if (entityType == EntityType.Tile) - { - LoadSampleTileIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtTileEmbed", "#txtEmbedTileId", "#txtEmbedDashboardId"); - }); - } - else if (entityType == EntityType.Qna) - { - LoadSampleQnaIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtQnaEmbed", "#txtDatasetId"); - }); - } - else if (entityType == EntityType.PaginatedReport) - { - LoadSamplePaginatedReportIntoSession().then(function (response) { - SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId"); - }); - } -} - -function EmbedAreaDesktopView() { - if ($(".desktop-view").hasClass(active_class)) { - return; - } - - $("#btnPhoneView").removeClass(active_mode); - $("#btnDesktopView").addClass(active_mode); - - const entityType = GetSession(SessionKeys.EntityType); - const mode = GetSession(SessionKeys.EmbedMode); - - $(".desktop-view").show(); - $(".mobile-view").hide(); - - $(".desktop-view").addClass(active_class); - $(".mobile-view").removeClass(active_class); - - const containerID = getEmbedContainerID(entityType); - const classPrefix = getEmbedContainerClassPrefix(entityType); - - $(classPrefix + 'MobileContainer').removeAttr('id'); - $(classPrefix + 'Container').attr('id', containerID); - - $(classPrefix + 'MobileContainer').removeClass(active_class); - $(classPrefix + 'Container').addClass(active_class); - - if($('#embed-tab').hasClass(active_tabs_li)) { - // Update embed code area - setCodeArea(mode, entityType); - } - - $('.hideOnMobile').show(); - - // Check if run button was clicked in the other mode and wasn't clicked on the new mode - if ($(classPrefix + "MobileContainer iframe").length && !$(classPrefix + "Container iframe").length) { - let runFunc = getEmbedCode(mode, entityType); - if ($('#interact-tab').hasClass(active_tabs_li)) { - runFunc = updateRunFuncSessionParameters(runFunc); - eval(runFunc); - } else { - runFunc(); - } - } - trackEvent(TelemetryEventName.DesktopModeOpen, {}); -} - -function EmbedAreaMobileView() { - if ($(".mobile-view").hasClass(active_class)) { - return; - } - - $("#btnDesktopView").removeClass(active_mode); - $("#btnPhoneView").addClass(active_mode); - - const entityType = GetSession(SessionKeys.EntityType); - const mode = GetSession(SessionKeys.EmbedMode); - - $(".desktop-view").hide(); - $(".mobile-view").show(); - - $(".desktop-view").removeClass(active_class); - $(".mobile-view").addClass(active_class); - - const containerID = getEmbedContainerID(entityType); - const classPrefix = getEmbedContainerClassPrefix(entityType); - - $(classPrefix + 'Container').removeAttr('id'); - $(classPrefix + 'MobileContainer').attr('id', containerID); - - $(classPrefix + 'Container').removeClass(active_class); - $(classPrefix + 'MobileContainer').addClass(active_class); - - if($('#embed-tab').hasClass(active_tabs_li)) { - // Update embed code area - setCodeArea(mode, entityType); - } - - $('.hideOnMobile').hide(); - - // Remove active class and code if the feature should be hidden on mobile view - if ($('#interact-tab').hasClass(active_tabs_li)) { - let activeHideOnMobile = $('.function-ul .hideOnMobile.active'); - if (activeHideOnMobile.length) { - activeHideOnMobile.removeClass(active_class); - LoadCodeArea("#embedCodeDiv", ""); - } - } - - // Check if run button was clicked in the other mode and wasn't clicked on the new mode - if ($(classPrefix + "Container iframe").length && !$(classPrefix + "MobileContainer iframe").length) { - // It's not enough to check the number of iframes because of the bootstrap feature. - if (GetSession(SessionKeys.EntityIsAlreadyEmbedded)) { - let runFunc = getEmbedCode(mode, entityType); - if ($('#interact-tab').hasClass(active_tabs_li)) { - runFunc = updateRunFuncSessionParameters(runFunc); - eval(runFunc); - } else { - runFunc(); - } - } - } - trackEvent(TelemetryEventName.MobileModeOpen, {}); -} - -function updateRunFuncSessionParameters(runFunc) { - const entityType = GetSession(SessionKeys.EntityType); - const accessToken = '"' + GetSession(SessionKeys.AccessToken) + '"'; - const embedUrl = '"' + GetSession(SessionKeys.EmbedUrl) + '"'; - const embedId = '"' + GetSession(SessionKeys.EmbedId) + '"'; - const dashboardId = '"' + GetSession(SessionKeys.DashboardId) + '"'; - const pageName = '"' + GetSession(SessionKeys.PageName) + '"'; - const visualName = '"' + GetSession(SessionKeys.VisualName) + '"'; - - let code = BodyCodeOfFunction(runFunc); - let tokenType = GetSession(SessionKeys.TokenType); - tokenType = (tokenType != undefined)? tokenType : defaultTokenType; - code = code.replace("$('#txtAccessToken').val()", accessToken) - .replace("$('input:radio[name=tokenType]:checked').val()", tokenType); - - if (entityType == EntityType.Report) { - code = code.replace("$('#txtReportEmbed').val()", embedUrl) - .replace("$('#txtEmbedReportId').val()", embedId); - } else if (entityType == EntityType.Dashboard) { - code = code.replace("$('#txtDashboardEmbed').val()", embedUrl) - .replace("$('#txtEmbedDashboardId').val()", embedId); - } else if (entityType == EntityType.Tile) { - code = code.replace("$('#txtTileEmbed').val()", embedUrl) - .replace("$('#txtEmbedDashboardId').val()", dashboardId) - .replace("$('#txtEmbedTileId').val()", embedId); - } else if (entityType == EntityType.Visual) { - code = code.replace("$('#txtReportEmbed').val()", embedUrl) - .replace("$('#txtEmbedReportId').val()", embedId) - .replace("$('#txtPageName').val()", pageName) - .replace("$('#txtVisualName').val()", visualName); - } else if (entityType == EntityType.Qna) { - let question = GetSession(SessionKeys.QnaQuestion); - question = question? question : defaultQnaQuestion; - let mode = GetSession(SessionKeys.QnaMode); - mode = mode? mode : defaultQnaMode; - code = code.replace("$('#txtQnaEmbed').val()", embedUrl) - .replace("$('#txtDatasetId').val()", embedId) - .replace("$('#txtQuestion').val()", '"' + question + '"') - .replace('$("input[name=' + "'qnaMode'" + ']:checked").val()', '"' + mode + '"'); - } - - return code; -} - -function hideFeaturesOnMobile(){ - if ($(".mobile-view").hasClass(active_class)) - $('.hideOnMobile').hide(); -} - -function onShowcaseTryMeClicked(showcase) { - let showcaseUrl = location.href.substring(0, location.href.lastIndexOf("/")) + '?showcase=' + showcase; - trackEvent(TelemetrySectionName.Showcase, { showcaseType: showcase, src: TelemetryEventSource.Interact }); - window.open(showcaseUrl, '_blank'); -} diff --git a/demo/v2-demo/scripts/session_utils.js b/demo/v2-demo/scripts/session_utils.js deleted file mode 100644 index 43dbfcb2..00000000 --- a/demo/v2-demo/scripts/session_utils.js +++ /dev/null @@ -1,344 +0,0 @@ -const reportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/SampleReport'; -const datasetUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/SampleCreate'; -const dashboardUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Dashboards/SampleDashboard'; -const tileUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Tiles/SampleTile'; -const qnaUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Datasets/SampleQna'; -const paginatedReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/SampleRdlReport'; -const layoutShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/LayoutDemoReport'; -const insightToActionShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/InsightToActionReport'; -const themesShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/ThemesReport'; -const quickVisualCreatorShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/EmptyReport'; - -var LastReportSampleUrl = null; -var ReportRefreshTokenTimer = 0; -var DashboardRefreshTokenTimer = 0; -var TileRefreshTokenTimer = 0; -var QnaRefreshTokenTimer = 0; - -const EntityType = { - Report : "Report", - Visual : "Visual", - Dashboard : "Dashboard", - Tile : "Tile", - Qna: "Qna", - PaginatedReport: "PaginatedReport" -}; - -const SessionKeys = { - AccessToken : "accessToken", - DashboardId : "dashboardId", - EmbedUrl : "embedUrl", - EmbedId : "embedId", - EmbedMode: "embedMode", - EntityType: "entityType", - GroupId : "groupId", - IsSampleReport: "isSampleReport", - IsSampleDashboard: "IsSampleDashboard", - IsSampleTile: "IsSampleTile", - IsSampleQna: "IsSampleQna", - IsSamplePaginatedReport: "IsSamplePaginatedReport", - IsTelemetryEnabled: "isTelemetryEnabled", - PageName: "PageName", - QnaQuestion: "QnaQuestion", - QnaMode: "QnaMode", - SampleId: "SampleId", - SessionId: "SessionId", - TokenType: "tokenType", - VisualName: "VisualName" -}; - -var _session = {}; - -function initSession() { - SetSession(SessionKeys.SessionId, generateNewGuid()); - if (GetParameterByName(SessionKeys.IsTelemetryEnabled) === "false") { - SetSession(SessionKeys.IsTelemetryEnabled, false); - } else { - SetSession(SessionKeys.IsTelemetryEnabled, true); - } -} - -function GetParameterByName(name, url) { - if (!url) { - url = window.location.href; - } - - name = name.replace(/[\[\]]/g, "\\$&"); - let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), - results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, " ")); -} - -function SetSession(key, value) { - // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session. - _session[key] = value; -} - -function GetSession(key) { - // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session. - return _session[key]; -} - -function UpdateSession(button, sessionKey) { - const value = $(button).val(); - if (value || value === "") - { - SetSession(sessionKey, value); - SetIsSample(false); - } -} - -function SetIsSample(value) { - const entityType = GetSession(SessionKeys.EntityType); - - if (entityType == EntityType.Report) - { - SetSession(SessionKeys.IsSampleReport, value); - } - else if (entityType == EntityType.Visual) - { - SetSession(SessionKeys.IsSampleReport, value); - } - else if (entityType == EntityType.Dashboard) - { - SetSession(SessionKeys.IsSampleDashboard, value); - } - else if (entityType == EntityType.Tile) - { - SetSession(SessionKeys.IsSampleTile, value); - } - else if (entityType == EntityType.Qna) - { - SetSession(SessionKeys.IsSampleQna, value); - } - else if (entityType == EntityType.PaginatedReport) - { - SetSession(SessionKeys.IsSamplePaginatedReport, value); - } -} - -function SetTextboxFromSessionOrUrlParam(sessionKey, textboxSelector) { - let value = GetParameterByName(sessionKey); - if (!value) - { - value = GetSession(sessionKey); - } else { - SetSession(sessionKey, value); - } - $(textboxSelector).val(value); -} - -function SetTextBoxesFromSessionOrUrlParam(accessTokenSelector, embedUrlSelector, embedIdSelector, dashboardIdSelector) { - let accessToken = GetParameterByName(SessionKeys.AccessToken); - if (!accessToken) - { - accessToken = GetSession(SessionKeys.AccessToken); - } else { - SetSession(SessionKeys.AccessToken, accessToken); - } - - let embedUrl = GetParameterByName(SessionKeys.EmbedUrl); - if (!embedUrl) - { - embedUrl = GetSession(SessionKeys.EmbedUrl); - } else { - let groupId = GetParameterByName(SessionKeys.GroupId); - if (groupId) - { - if (embedUrl.indexOf("?") != -1) - { - embedUrl += "&groupId=" + groupId; - } else { - embedUrl += "?groupId=" + groupId; - } - } - SetSession(SessionKeys.EmbedUrl, embedUrl); - } - - let embedId = GetParameterByName(SessionKeys.EmbedId); - if (!embedId) - { - embedId = GetSession(SessionKeys.EmbedId); - } else { - SetSession(SessionKeys.EmbedId, embedId); - } - - let tokenType = GetParameterByName(SessionKeys.TokenType); - if (!tokenType) - { - tokenType = GetSession(SessionKeys.TokenType); - } else { - SetSession(SessionKeys.TokenType, tokenType); - } - - let dashboardId = GetParameterByName(SessionKeys.DashboardId); - if (!dashboardId) { - dashboardId = GetSession(SessionKeys.DashboardId); - } else { - SetSession(SessionKeys.DashboardId, dashboardId); - } - - $(accessTokenSelector).val(accessToken); - $(embedUrlSelector).val(embedUrl); - $(embedIdSelector).val(embedId); - $(dashboardIdSelector).val(dashboardId); - - // - // Set the embed type (Saas or Embed token) - // - let embedTypeRadios = $('input:radio[name=tokenType]'); - embedTypeRadios.filter('[value=' + tokenType + ']').prop('checked', true); -} - -function FetchUrlIntoSession(url, updateCurrentToken) { - return $.getJSON(url, function (embedConfig) { - setSession(embedConfig.EmbedToken.Token, embedConfig.EmbedUrl, embedConfig.Id, embedConfig.DashboardId); - SetSession(SessionKeys.SampleId, embedConfig.Id); - - if (updateCurrentToken) - { - let embedContainerId = getEmbedContainerID(capitalizeFirstLetter(embedConfig.Type)); - - let embedContainer = powerbi.embeds.filter(function(embedElement) { return embedElement.element.id === embedContainerId; })[0]; - if (embedContainer) - { - embedContainer.setAccessToken(embedConfig.EmbedToken.Token); - } - } - - if (embedConfig.Type === "report" || embedConfig.Type === "visual") - { - // Set single visual embed sample details. - SetSession(SessionKeys.PageName, "ReportSectioneb8c865100f8508cc533"); - SetSession(SessionKeys.VisualName, "47eb6c0240defd498d4b"); - - LastReportSampleUrl = url; - } - - TokenExpirationRefreshListener(embedConfig.MinutesToExpiration, capitalizeFirstLetter(embedConfig.Type)); - }); -} - -function capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); -} - -function TokenExpirationRefreshListener(minutesToExpiration, entityType) { - const updateAfterMilliSeconds = (minutesToExpiration - 2) * 60 * 1000; - - if (entityType == EntityType.Report || entityType == EntityType.Visual) { - setTokenRefreshListener(updateAfterMilliSeconds, ReportRefreshTokenTimer, LastReportSampleUrl, entityType); - } else if (entityType == EntityType.Dashboard) { - setTokenRefreshListener(updateAfterMilliSeconds, DashboardRefreshTokenTimer, dashboardUrl, entityType); - } else if (entityType == EntityType.Qna) { - setTokenRefreshListener(updateAfterMilliSeconds, QnaRefreshTokenTimer, qnaUrl, entityType); - } else { - setTokenRefreshListener(updateAfterMilliSeconds, TileRefreshTokenTimer, tileUrl, entityType); - } -} - -function setTokenRefreshListener(updateAfterMilliSeconds, RefreshTokenTimer, url, entityType) { - if (RefreshTokenTimer) - { - console.log("step current " + entityType + " Embed Token update threads."); - clearTimeout(RefreshTokenTimer); - } - - console.log(entityType + " Embed Token will be updated in " + updateAfterMilliSeconds + " milliseconds."); - RefreshTokenTimer = setTimeout(function() { - if (url) - { - FetchUrlIntoSession(url, true /* updateCurrentToken */); - } - }, updateAfterMilliSeconds); -} - -function LoadSampleReportIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Report); - return FetchUrlIntoSession(reportUrl, false /* updateCurrentToken */); -} - -function LoadSampleVisualIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Visual); - return FetchUrlIntoSession(reportUrl, false /* updateCurrentToken */); -} - -function LoadSampleDatasetIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Report); - return FetchUrlIntoSession(datasetUrl, false /* updateCurrentToken */); -} - -function LoadSampleDashboardIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Dashboard); - return FetchUrlIntoSession(dashboardUrl, false /* updateCurrentToken */); -} - -function LoadSampleTileIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Tile); - return FetchUrlIntoSession(tileUrl, false /* updateCurrentToken */); -} - -function LoadSampleQnaIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Qna); - return FetchUrlIntoSession(qnaUrl, false /* updateCurrentToken */); -} - -function LoadSamplePaginatedReportIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.PaginatedReport); - return FetchUrlIntoSession(paginatedReportUrl, false /* updateCurrentToken */); -} - -function LoadLayoutShowcaseReportIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Report); - return FetchUrlIntoSession(layoutShowcaseReportUrl, false /* updateCurrentToken */); -} - -function LoadInsightToActionShowcaseReportIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Report); - return FetchUrlIntoSession(insightToActionShowcaseReportUrl, false /* updateCurrentToken */); -} - -function LoadThemesShowcaseReportIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Report); - return FetchUrlIntoSession(themesShowcaseReportUrl, false /* updateCurrentToken */); -} - -function LoadQuickVisualCreatorShowcaseReportIntoSession() { - SetSession(SessionKeys.EntityType, EntityType.Report); - return FetchUrlIntoSession(quickVisualCreatorShowcaseReportUrl, false /* updateCurrentToken */); -} - -function WarmStartSampleReportEmbed() { - let embedUrl = GetParameterByName(SessionKeys.EmbedUrl); - if (embedUrl) { - preload(embedUrl); - return; - } - - FetchUrlIntoSession(reportUrl, false /* updateCurrentToken */).then(function (response) { - embedUrl = GetSession(SessionKeys.EmbedUrl); - preload(embedUrl); - }); -} - -function preload(embedUrl) { - const config = { - type: 'report', - embedUrl: embedUrl - }; - - // Preload sample report - powerbi.preload(config); -} - -function setSession(accessToken, embedUrl, embedId, dashboardId) -{ - SetSession(SessionKeys.AccessToken, accessToken); - SetSession(SessionKeys.EmbedUrl, embedUrl); - SetSession(SessionKeys.EmbedId, embedId); - SetSession(SessionKeys.DashboardId, dashboardId); -} - -initSession(); \ No newline at end of file diff --git a/demo/v2-demo/scripts/step_embed.js b/demo/v2-demo/scripts/step_embed.js deleted file mode 100644 index 48990476..00000000 --- a/demo/v2-demo/scripts/step_embed.js +++ /dev/null @@ -1,363 +0,0 @@ -// ---- Report Operations ---------------------------------------------------- -function Report_GetId() { - SetCode(_Report_GetId); -} - -function Report_UpdateSettings() { - SetCode(_Report_UpdateSettings); -} - -function Report_GetPages() { - SetCode(_Report_GetPages); -} - -function Report_SetPage() { - SetCode(_Report_SetPage); -} - -function Report_GetFilters() { - SetCode(_Report_GetFilters); -} - -function Report_SetFilters() { - SetCode(_Report_SetFilters); -} - -function Report_RemoveFilters() { - SetCode(_Report_RemoveFilters); -} - -function Report_PrintCurrentReport() { - SetCode(_Report_PrintCurrentReport); -} - -function Report_Reload() { - SetCode(_Report_Reload); -} - -function PaginatedReport_Reload() { - SetCode(_PaginatedReport_Reload); -} - -function PaginatedReport_GetId() { - SetCode(_PaginatedReport_GetId); -} - -function PaginatedReport_FullScreen() { - SetCode(_PaginatedReport_FullScreen); -} - -function PaginatedReport_ExitFullScreen() { - SetCode(_PaginatedReport_ExitFullScreen); -} - -function Report_Refresh() { - SetCode(_Report_Refresh); -} - -function Report_FullScreen() { - SetCode(_Report_FullScreen); -} - -function Report_ExitFullScreen() { - SetCode(_Report_ExitFullScreen); -} - -function Report_Extensions_ContextMenu() { - SetCode(_Report_Extensions_ContextMenu); -} - -function Report_Extensions_OptionsMenu() { - SetCode(_Report_Extensions_OptionsMenu); -} - -function Visual_Operations_SortVisualBy() { - SetCode(_Visual_Operations_SortVisualBy); -} - -function Report_ApplyCustomLayout() { - SetCode(_Report_ApplyCustomLayout); -} - -function Report_HideAllVisualHeaders() { - SetCode(_Report_HideAllVisualHeaders); -} - -function Report_ShowAllVisualHeaders() { - SetCode(_Report_ShowAllVisualHeaders); -} - -function Report_HideSingleVisualHeader() { - SetCode(_Report_HideSingleVisualHeader); -} - -// ---- Page Operations ---------------------------------------------------- - -function Page_SetActive() { - SetCode(_Page_SetActive); -} - -function Page_GetFilters() { - SetCode(_Page_GetFilters); -} - -function Page_GetVisuals() { - SetCode(_Page_GetVisuals); -} - -function Page_SetFilters() { - SetCode(_Page_SetFilters); -} - -function Page_RemoveFilters() { - SetCode(_Page_RemoveFilters); -} - -function Page_HasLayout() { - SetCode(_Page_HasLayout); -} -// ---- Event Listener ---------------------------------------------------- - -function Events_PageChanged() { - SetCode(_Events_PageChanged); -} - -function Events_DataSelected() { - SetCode(_Events_DataSelected); -} - -function Events_SaveAsTriggered() { - SetCode(_Events_SaveAsTriggered); -} - -function Events_BookmarkApplied() { - SetCode(_Events_BookmarkApplied); -} - -function Events_ReportLoaded() { - SetCode(_Events_ReportLoaded); -} - -function Events_ReportRendered() { - SetCode(_Events_ReportRendered); -} - -function Events_ReportSaved() { - SetCode(_Events_ReportSaved); -} - -function Events_TileLoaded() { - SetCode(_Events_TileLoaded); -} - -function Events_TileClicked() { - SetCode(_Events_TileClicked); -} - -function Events_ButtonClicked() { - SetCode(_Events_ButtonClicked) -} - -// ---- Edit and Save Operations ---------------------------------------------------- - -function Report_switchModeEdit() { - SetCode(_Report_switchModeEdit); -} - -function Report_switchModeView() { - SetCode(_Report_switchModeView); -} - -function Report_save() { - SetCode(_Report_save); -} - -function Report_saveAs() { - SetCode(_Report_saveAs); -} - -// ---- Bookmarks Operations ---------------------------------------------------- -function Bookmarks_Enable() { - SetCode(_Bookmarks_Enable); -} - -function Bookmarks_Disable() { - SetCode(_Bookmarks_Disable); -} - -function Bookmarks_Get() { - SetCode(_Bookmarks_Get); -} - -function Bookmarks_Apply() { - SetCode(_Bookmarks_Apply); -} - -function Bookmarks_Capture() { - SetCode(_Bookmarks_Capture); -} - -function Bookmarks_ApplyState() { - SetCode(_Bookmarks_ApplyState); -} - -function Bookmarks_EnterPresentation() { - SetCode(_Bookmarks_EnterPresentation); -} - -function Bookmarks_ExitPresentation() { - SetCode(_Bookmarks_ExitPresentation); -} - -// ---- Dashboard Operations ---------------------------------------------------- - -function Dashboard_GetId() { - SetCode(_Dashboard_GetId); -} - -function Dashboard_FullScreen() { - SetCode(_Dashboard_FullScreen); -} - -function Dashboard_ExitFullScreen() { - SetCode(_Dashboard_ExitFullScreen); -} - - -// ---- Dashboard Events Listener ---------------------------------------------------- - -function DashboardEvents_TileClicked() { - SetCode(_DashboardEvents_TileClicked); -} - -// ---- Q&A Events Listener ---------------------------------------------------- - -function Qna_SetQuestion() { - SetCode(_Qna_SetQuestion); -} - -function Qna_QuestionChanged() { - SetCode(_Qna_QuestionChanged); -} - -// ---- Visual Events Listener ---------------------------------------------------- - -function Visual_DataSelected() { - SetCode(_Visual_DataSelected); -} - -// ---- Visuals ------------------------------------------------------------------- - -function Visual_GetFilters() { - SetCode(_Visual_GetFilters); -} - -function Visual_SetFilters() { - SetCode(_Visual_SetFilters); -} - -function Visual_GetSlicer() { - SetCode(_Visual_GetSlicer); -} - -function Visual_SetSlicer() { - SetCode(_Visual_SetSlicer); -} - -function Visual_RemoveFilters() { - SetCode(_Visual_RemoveFilters); -} - -function Visual_ExportData_Summarized() { - SetCode(_Visual_ExportData_Summarized); -} - -function Visual_ExportData_Underlying() { - SetCode(_Visual_ExportData_Underlying); -} - -function ReportVisual_UpdateSettings() { - SetCode(_ReportVisual_UpdateSettings); -} - -function ReportVisual_Report_SetFilters() { - SetCode(_ReportVisual_Report_SetFilters); -} - -function ReportVisual_Report_GetFilters() { - SetCode(_ReportVisual_Report_GetFilters); -} - -function ReportVisual_Report_RemoveFilters() { - SetCode(_ReportVisual_Report_RemoveFilters); -} - -function ReportVisual_Page_SetFilters() { - SetCode(_ReportVisual_Page_SetFilters); -} - -function ReportVisual_Page_GetFilters() { - SetCode(_ReportVisual_Page_GetFilters); -} - -function ReportVisual_Page_RemoveFilters() { - SetCode(_ReportVisual_Page_RemoveFilters); -} - -function ReportVisual_Visual_SetFilters() { - SetCode(_ReportVisual_Visual_SetFilters); -} - -function ReportVisual_Visual_GetFilters() { - SetCode(_ReportVisual_Visual_GetFilters); -} - -function ReportVisual_Visual_RemoveFilters() { - SetCode(_ReportVisual_Visual_RemoveFilters); -} - -function ReportVisual_HideSingleVisualHeader() { - SetCode(_ReportVisual_HideSingleVisualHeader); -} - -// ---- Report Authoring ---------------------------------------------------- - -function Report_Authoring_Create() { - SetCode(_Report_Authoring_Create); -} - -function Report_Authoring_ChangeType() { - SetCode(_Report_Authoring_ChangeType); -} - -function Report_Authoring_Remove() { - SetCode(_Report_Authoring_Remove); -} - -function Report_Authoring_Capabilities() { - SetCode(_Report_Authoring_Capabilities); -} - -function Report_Authoring_AddDataField() { - SetCode(_Report_Authoring_AddDataField); -} - -function Report_Authoring_RemoveDataField() { - SetCode(_Report_Authoring_RemoveDataField); -} - -function Report_Authoring_GetDataField() { - SetCode(_Report_Authoring_GetDataField); -} - -function Report_Authoring_GetProperty() { - SetCode(_Report_Authoring_GetProperty); -} - -function Report_Authoring_SetProperty() { - SetCode(_Report_Authoring_SetProperty); -} - -function Report_Authoring_ResetProperty() { - SetCode(_Report_Authoring_ResetProperty); -} diff --git a/demo/v2-demo/scripts/step_interact.js b/demo/v2-demo/scripts/step_interact.js deleted file mode 100644 index 2df577f8..00000000 --- a/demo/v2-demo/scripts/step_interact.js +++ /dev/null @@ -1,84 +0,0 @@ -function OpenBookmarksOperations() { - $("#bookmarks-operations-ul").toggle(); - $("#bookmarks-operations").toggleClass("active"); -} - -function OpenEditSaveOperations() { - $("#editsave-operations-ul").toggle(); - $("#editsave-operations").toggleClass("active"); -} - -function OpenDataOperations() { - $("#data-operations-ul").toggle(); - $("#data-operations").toggleClass("active"); -} - -function OpenAuthoringOperations() { - $("#authoring-operations-ul").toggle(); - $("#authoring-operations").toggleClass("active"); -} - -function OpenMenuOperations() { - $("#menu-operations-ul").toggle(); - $("#menu-operations").toggleClass("active"); -} - -function OpenReportPropertiesOperations() { - $("#reportproperties-operations-ul").toggle(); - $("#reportproperties-operations").toggleClass("active"); -} - -function OpenFiltersOperations() { - $("#filters-operations-ul").toggle(); - $("#filters-operations").toggleClass("active"); -} - -function OpenGeneralOperations() { - $("#general-operations-ul").toggle(); - $("#general-operations").toggleClass("active"); -} - -function OpenLayoutOperations() { - $("#layout-operations-ul").toggle(); - $("#layout-operations").toggleClass("active"); -} - -function OpenNavigationOperations() { - $("#navigation-operations-ul").toggle(); - $("#navigation-operations").toggleClass("active"); -} - -function OpenDashboardGeneralOperations() { - $("#dashboard-general-operations-ul").toggle(); - $("#dashboard-general-operations").toggleClass("active"); -} - -function OpenDashboardPropertiesOperations() { - $("#dashboard-properties-operations-ul").toggle(); - $("#dashboard-properties-operations").toggleClass("active"); -} - -function OpenDashboardEventsOperations() { - $("#dashboard-events-operations-ul").toggle(); - $("#dashboard-events-operations").toggleClass("active"); -} - -function OpenQnaOperations() { - $("#qna-operations-ul").toggle(); - $("#qna-operations").toggleClass("active"); -} - -function OpenQnaEventsOperations() { - $("#qna-events-operations-ul").toggle(); - $("#qna-events-operations").toggleClass("active"); -} - -function SetToggleHandler(devId) { - const selector = "#" + devId + " .function-ul li"; - $(selector).each(function(index, li) { - $(li).click(function() { - $(selector).removeClass('active'); - $(li).addClass('active'); - }); - }); -} diff --git a/demo/v2-demo/scripts/step_samples.js b/demo/v2-demo/scripts/step_samples.js deleted file mode 100644 index a2d4dd29..00000000 --- a/demo/v2-demo/scripts/step_samples.js +++ /dev/null @@ -1,46 +0,0 @@ -function OpenCodeStepWithSample(entityType) { - $("html, body").animate({ scrollTop: 0 }, "slow"); - - // Clear the log - ClearTextArea('#txtResponse'); - - SetSession(SessionKeys.EntityType, entityType); - SetSession(SessionKeys.TokenType, defaultTokenType); - - if (entityType == EntityType.Report) - { - SetSession(SessionKeys.IsSampleReport, true); - OpenCodeStep(EmbedViewMode, EntityType.Report); - } - else if (entityType == EntityType.Visual) - { - SetSession(SessionKeys.IsSampleReport, true); - OpenCodeStep(EmbedViewMode, EntityType.Visual); - } - else if (entityType == EntityType.Dashboard) - { - SetSession(SessionKeys.IsSampleDashboard, true); - OpenCodeStep(EmbedViewMode, EntityType.Dashboard); - } - else if (entityType == EntityType.Tile) - { - SetSession(SessionKeys.IsSampleTile, true); - OpenCodeStep(EmbedViewMode, EntityType.Tile) - } - else if (entityType == EntityType.Qna) - { - SetSession(SessionKeys.IsSampleQna, true); - OpenCodeStep(EmbedViewMode, EntityType.Qna) - } - else if (entityType == EntityType.PaginatedReport) - { - SetSession(SessionKeys.IsSamplePaginatedReport, true); - OpenCodeStep(EmbedViewMode, EntityType.PaginatedReport) - } - else { - assert(false); - trackEvent(TelemetryEventName.CodeStepError, {}); - return; - } - trackEvent(TelemetrySectionName.SampleTool, { entityType: entityType, src: TelemetryEventSource.UserClick }); -} diff --git a/demo/v2-demo/scripts/telemetry.js b/demo/v2-demo/scripts/telemetry.js deleted file mode 100644 index 006046c1..00000000 --- a/demo/v2-demo/scripts/telemetry.js +++ /dev/null @@ -1,46 +0,0 @@ -const TelemetryEventName = { - CodeStepError: "CodeStepError", - CopyCode: "CopyCode", - CopyLog: "CopyLog", - DesktopModeOpen: "DesktopModeOpen", - InnerSectionOpen: "InnerSectionOpen", - Interact: "Interact", - MobileModeOpen: "MobileModeOpen", - RunClick: "RunClick", - SectionOpen: "SectionOpen", - SessionStart: "SessionStart" -}; -const TelemetryEventSource = { - Url: "Url", - UserClick: "UserClick" -}; - -const TelemetryInnerSection = { - Code: "Code", - Sample: "Sample" -}; - -const TelemetrySectionName = { - Documentation: "Documentation", - SampleTool: "SampleTool", - Showcase: "Showcase" -}; - -function trackEvent(name, properties, flush) { - if (!_session[SessionKeys.IsTelemetryEnabled]) { - return; - } - assert(name && properties); - properties.sessionId = GetSession(SessionKeys.SessionId); - - getAppInsightsInstance().then(function(ai) { - // Normally, the SDK sends data at fixed intervals (typically 30 secs) or whenever buffer is full (typically 500 items). - // https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#flushing-data - ai.trackEvent({ name: name, properties: properties }); - if (flush) { - ai.flush(); - } - }); -} - -trackEvent(TelemetryEventName.SessionStart, { referrer: document.referrer }, true); \ No newline at end of file diff --git a/demo/v2-demo/scripts/utils.js b/demo/v2-demo/scripts/utils.js deleted file mode 100644 index 663645e3..00000000 --- a/demo/v2-demo/scripts/utils.js +++ /dev/null @@ -1,249 +0,0 @@ -var currentCode = ""; -const interactIndicationTimeout = 5000; -const elementClickedTimeout = 250; -const textCodeTimeout = 100; - -function BodyCodeOfFunction(func) { - let lines = func.toString().split('\n'); - lines = lines.slice(1, lines.length-1); - - for (let i = 0; i < lines.length; ++i) - { - // remove trailing spaces. - lines[i] = lines[i].substring(4); - } - - return lines.join('\n'); -} - -function LoadCodeArea(divSelector, initialFunctionCode) { - $(divSelector).load("code_area.html", function() { - SetCode(initialFunctionCode); - }); -} - -function LoadLogWindow(divSelector) { - $(divSelector).load("log_window.html"); -} - -function SetCode(func) { - currentCode = BodyCodeOfFunction(func); - - $("#highlighter").empty(); - - var txtCodeElement = document.createElement("div"); - txtCodeElement.setAttribute("id", "txtCode"); - txtCodeElement.setAttribute("style", "display: none;"); - - var preElement = document.createElement("pre"); - preElement.setAttribute("class", "brush: js; gutter: false;"); - - var codeElement = document.createTextNode(currentCode); - preElement.appendChild(codeElement); - txtCodeElement.appendChild(preElement); - $("#highlighter").append(txtCodeElement); - - var scriptElement = document.createElement("script"); - scriptElement.setAttribute("type", "text/javascript"); - scriptElement.setAttribute("src", "syntaxHighlighter/syntaxhighlighter.js"); - $("#highlighter").append(scriptElement); - - setTimeout(function() { - $("#txtCode").show(); - }, textCodeTimeout); - - if (func != "") { - let runFunc = mapFunc(func); - let funcName = getFuncName(runFunc); - if (funcName.match(/Embed/)) { - let oldFunc = runFunc; - runFunc = function() { - oldFunc(); - - SetSession(SessionKeys.EntityIsAlreadyEmbedded, true); - - $('#interact-tab').addClass('enableTransition'); - setTimeout(function() { - $('#interact-tab').addClass('changeColor'); - }, interactIndicationTimeout); - } - } - - $('#btnRunCode').off('click'); - $('#btnRunCode').click(function() { - showEmbedContainer(); - removeIframeIfUrlIsChanged(); - elementClicked('#btnRunCode'); - trackEvent(TelemetryEventName.RunClick, { EmbedType: GetSession(SessionKeys.EntityType), TokenType: GetSession(SessionKeys.TokenType), ApiUsed: funcName }); - runFunc(); - }); - // TODO: add indication to click Interact tab on first embedding - } -} - -function CopyCode() { - const id = "clipboard-textarea"; - let textarea = document.getElementById(id); - - if (!textarea) { - textarea = document.createElement("textarea"); - textarea.id = id; - document.querySelector("body").appendChild(textarea); - } - - textarea.value = currentCode; - CopyTextArea('#' + id, "#btnRunCopyCode"); - trackEvent(TelemetryEventName.CopyCode, {}); -} - -function CopyResponseWindow() { - CopyTextArea("#txtResponse", "#btnCopyResponse"); - trackEvent(TelemetryEventName.CopyLog, {}); -} - -function CopyTextArea(textAreaSelector, buttonSelector) { - $(textAreaSelector).select(); - document.execCommand('copy'); - window.getSelection().removeAllRanges(); - - // Set focus on copy button - this will deselect text in copied area. - $(buttonSelector).focus(); -} - -function ClearTextArea(textAreaSelector) { - $(textAreaSelector).val(""); -} - -function getEmbedContainerID(entityType) { - switch (entityType) { - case EntityType.Dashboard: - return "dashboardContainer"; - case EntityType.Tile: - return "tileContainer"; - case EntityType.Qna: - return "qnaContainer"; - case EntityType.PaginatedReport: - return "paginatedReportContainer"; - default: - return "embedContainer"; - } -} - -function getEmbedContainerClassPrefix(entityType) { - switch (entityType) { - case EntityType.Visual: - return ".visual"; - case EntityType.Dashboard: - return ".dashboard"; - case EntityType.Tile: - return ".tile"; - case EntityType.Qna: - return ".qna"; - case EntityType.PaginatedReport: - return ".paginatedReport"; - default: - return ".report"; - } -} - -function getActiveEmbedContainer() { - const entityType = GetSession(SessionKeys.EntityType); - const classPrefix = getEmbedContainerClassPrefix(entityType); - const activeContainer = classPrefix + ($(".desktop-view").hasClass(active_class) ? 'Container' : 'MobileContainer'); - return $(activeContainer)[0]; -} - -function getEntityTypeFromParameter(urlParam) { - switch (urlParam) { - case "visual": - return EntityType.Visual; - case "dashboard": - return EntityType.Dashboard; - case "tile": - return EntityType.Tile; - case "qna": - return EntityType.Qna; - case "rdl": - return EntityType.PaginatedReport; - default: - return EntityType.Report; - } -} - -function elementClicked(element) { - $(element).addClass('elementClicked'); - setTimeout(function() { - $(element).removeClass('elementClicked'); - }, elementClickedTimeout); -} - -function showEmbedContainer() { - const activeContainer = getActiveEmbedContainer(); - $(activeContainer).css({"visibility":"visible"}); -} - -function removeIframeIfUrlIsChanged() { - const activeContainer = getActiveEmbedContainer(); - if (!activeContainer || !activeContainer.powerBiEmbed || !activeContainer.powerBiEmbed.iframe) { - return; - } - - let existingIframeUrl = removeArgFromUrl(activeContainer.powerBiEmbed.iframe.src, "uid"); - existingIframeUrl = removeArgFromUrl(existingIframeUrl, "isMobile"); - - let embedUrl = GetSession(SessionKeys.EmbedUrl); - - if (embedUrl !== existingIframeUrl) { - // textbox has changed, delete the iframe and avoid the bootstrap. - powerbi.reset(activeContainer); - } -} - -function SetAuthoringPageActive(report) { - return new Promise(function(resolve, reject) { - - // Get all report pages - report.getPages().then(function (pages) { - - // Find authoring page - var authoringPage = pages.filter(function (page) { - return page.name === "ReportSection6da8317ad6cbcae5b3bb"; - })[0]; - - // If active page is not authoring page, navigate to authoring page - if (authoringPage.isActive) { - resolve(authoringPage); - } else { - authoringPage.setActive().then(function () { - Log.logText("Page was set to authoring page."); - resolve(authoringPage); - }).catch(function (errors) { - reject(errors); - }); - } - }).catch(function (errors) { - reject(errors); - }); - }); -} - -function removeArgFromUrl(url, arg) { - const argRegEx = new RegExp(arg + '="?([^&]+)"?') - const argMatch = url.match(argRegEx); - - if (argMatch) { - return url.replace("&" + argMatch[0], ""); - } - - return url; -} - -function getRandomValue() { - - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - - return randomValueArray[0]; -} \ No newline at end of file diff --git a/demo/v2-demo/settings_embed_dashboard.html b/demo/v2-demo/settings_embed_dashboard.html deleted file mode 100644 index 223706ee..00000000 --- a/demo/v2-demo/settings_embed_dashboard.html +++ /dev/null @@ -1,34 +0,0 @@ -
-
- Select token type: - -
- - -
-
-
- Fill in the fields below to get the code to embed your dashboard. -
- -
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Dashboard ID
- -
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_embed_paginatedreport.html b/demo/v2-demo/settings_embed_paginatedreport.html deleted file mode 100644 index 87531300..00000000 --- a/demo/v2-demo/settings_embed_paginatedreport.html +++ /dev/null @@ -1,33 +0,0 @@ -
-
- Select token type: - -
- - -
- -
Fill in the fields below to get the code to embed your paginated report
-
-
-
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Report ID
- -
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_embed_qna.html b/demo/v2-demo/settings_embed_qna.html deleted file mode 100644 index 5318ecfa..00000000 --- a/demo/v2-demo/settings_embed_qna.html +++ /dev/null @@ -1,44 +0,0 @@ -
-
- Select mode to embed Q&A in: -
-
- - - -
- -
- Q&A input question -
- -
- -
-
Fill in the fields below to get the code to embed your Q&A.
-
- -
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Dataset ID
- -
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_embed_report.html b/demo/v2-demo/settings_embed_report.html deleted file mode 100644 index be75be21..00000000 --- a/demo/v2-demo/settings_embed_report.html +++ /dev/null @@ -1,77 +0,0 @@ -
-
-
Select mode to embed your report in:
-
- -
- - User can view and interact with the report -
- -
- - User can edit and save the report -
- -
- - User can Create and save a new report -
-
- - Select token type: - -
- - -
- -
Fill in the fields below to get the code to embed your report
-
-
-
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Report ID
- -
-
- -
- -
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Dataset ID
- -
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_embed_tile.html b/demo/v2-demo/settings_embed_tile.html deleted file mode 100644 index baf07ce9..00000000 --- a/demo/v2-demo/settings_embed_tile.html +++ /dev/null @@ -1,38 +0,0 @@ -
-
- Select token type: - -
- - -
-
-
- Fill in the fields below to get the code to embed your tile. -
- -
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Dashboard ID
- -
-
-
Tile ID
- -
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_embed_visual.html b/demo/v2-demo/settings_embed_visual.html deleted file mode 100644 index 658628ce..00000000 --- a/demo/v2-demo/settings_embed_visual.html +++ /dev/null @@ -1,58 +0,0 @@ -
-
- Select token type: - -
- - -
- -
- Fill in the fields below to get the code to embed your visual -
-
-
-
Embed Token
- -
-
-
Embed URL
- -
-
-
Report ID
- -
- - -
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_interact_dashboard.html b/demo/v2-demo/settings_interact_dashboard.html deleted file mode 100644 index 7a4c90fc..00000000 --- a/demo/v2-demo/settings_interact_dashboard.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
- -
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_interact_paginatedreport.html b/demo/v2-demo/settings_interact_paginatedreport.html deleted file mode 100644 index ae51d78d..00000000 --- a/demo/v2-demo/settings_interact_paginatedreport.html +++ /dev/null @@ -1,22 +0,0 @@ -
-
- -
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_interact_qna.html b/demo/v2-demo/settings_interact_qna.html deleted file mode 100644 index 9bf9f227..00000000 --- a/demo/v2-demo/settings_interact_qna.html +++ /dev/null @@ -1,20 +0,0 @@ -
-
-
- -
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_interact_report.html b/demo/v2-demo/settings_interact_report.html deleted file mode 100644 index 0c097ab7..00000000 --- a/demo/v2-demo/settings_interact_report.html +++ /dev/null @@ -1,122 +0,0 @@ -
-
-
-
-
- -
-
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/settings_interact_tile.html b/demo/v2-demo/settings_interact_tile.html deleted file mode 100644 index 36616308..00000000 --- a/demo/v2-demo/settings_interact_tile.html +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/demo/v2-demo/settings_interact_visual.html b/demo/v2-demo/settings_interact_visual.html deleted file mode 100644 index 5fbdb307..00000000 --- a/demo/v2-demo/settings_interact_visual.html +++ /dev/null @@ -1,54 +0,0 @@ - \ No newline at end of file diff --git a/demo/v2-demo/shareBookmark.html b/demo/v2-demo/shareBookmark.html deleted file mode 100644 index 7c307f1d..00000000 --- a/demo/v2-demo/shareBookmark.html +++ /dev/null @@ -1,20 +0,0 @@ - - - -
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/demo/v2-demo/showcases.html b/demo/v2-demo/showcases.html deleted file mode 100644 index 320ec827..00000000 --- a/demo/v2-demo/showcases.html +++ /dev/null @@ -1,90 +0,0 @@ -
-

Interactive feature showcase

-
-
- Experience our new features.
- Select the showcase you want to explore to get started. -
-
- -
-
-
-
- -
-
-
-

Dynamic report layout

- Use this showcase to learn the custom layout API for dynamic embedding of visuals. -
-
- -
-
-
- -
-
- -
-
-
-

Capture & share bookmarks

- Let your users create and share their own bookmarks.

-
-
- -
-
-
- -
-
- -
NEW
-
-
-
-

Personalize report design

- Dynamically control the look & feel of your report with themes API. -
-
- -
-
-
- -
-
- -
NEW
-
-
-
-

Insight to action

- Let your users take actions driven straight from analytics, with minimal clicks! -
-
- -
-
-
- -
-
- -
NEW
-
-
-
-

Quick visual creator

- Leverage the visual APIs to quickly create and personalize a visual. -
-
- -
-
-
-
-
\ No newline at end of file diff --git a/demo/v2-demo/step_samples.html b/demo/v2-demo/step_samples.html deleted file mode 100644 index 698f362f..00000000 --- a/demo/v2-demo/step_samples.html +++ /dev/null @@ -1,87 +0,0 @@ - -
-
-
-
-
-

Sample Report

- Embed a sample report and interact with Power BI Embedded firsthand. -
-
- -
-
-
- -
-
-
-
-

Sample Report Visual

- Embed a sample report visual and interact with Power BI Embedded firsthand. -
-
- -
-
-
- -
-
NEW
-
-
-

Sample Paginated Report

- Embed a sample paginated report and interact with Power BI Embedded firsthand. (Preview) -
-
- -
-
-
- -
-
-
-
-

Sample Q&A

- Embed a sample Q&A and interact with Power BI Embedded firsthand. -
-
- -
-
-
- -
-
-
-
-

Sample Dashboard

- Embed a sample dashboard and interact with Power BI Embedded firsthand. -
-
- -
-
-
- -
-
-
-
-

Sample Tile

- Embed a sample tile and interact with Power BI Embedded firsthand. -
-
- -
-
-
-
- - \ No newline at end of file diff --git a/demo/v2-demo/style/layout.css b/demo/v2-demo/style/layout.css deleted file mode 100644 index dba478f1..00000000 --- a/demo/v2-demo/style/layout.css +++ /dev/null @@ -1,382 +0,0 @@ -html { - overflow-x: hidden; -} - -body { - min-width: 300px; - background-color: #212121; -} - -header -{ - position: relative; - height: 60px; - background: #121212; -} - -label { - display: initial; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - font-weight: normal; -} - -#navbar { - display: table-cell; - width: 160px; - background: #212121; - vertical-align: top; -} - -#main-ul-dev { - position: relative; - padding-top: 24px; - padding-left: 0px; -} - -.main-ul { - position: absolute; - width: 100%; - list-style-type: none; - margin: 0px; - overflow: hidden; - padding-left: 0; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - line-height: 30px; -} - -#mainContent { - padding: 0 8px 8px 8px; - width: 100%; - background: #F1F1F1; -} - -#showcasesContent { - position: relative; -} - -#showcaseContent { - display: table; - padding: 32px 24px 24px 24px; - width: 100%; - background: #F1F1F1; - overflow: hidden; -} - -#samples-step-wrapper { - max-width: 1250px; -} - -#documentationContent { - background: #F1F1F1; - padding-left: 16px; -} - -#contentWrapper { - height: 100%; - width: 100%; - background-color: #F1F1F1; - max-width: 100vw; - width: calc(100% - 160px); - display: table-cell; -} - -.content { - height: 100%; - width: 100%; -} - -#settings-wrapper { - margin-right: 10px; - max-height: 330px; - float: left; -} - -#embedCodeDiv { - margin-right: 10px; - max-height: 330px; - float: left; - overflow: hidden; -} - -#embedArea { - clear: both; - width: 100%; -} - -.iframeContainer { - display: none; - width: 100%; - height: 100%; - background-color: #FFFFFF; - padding: 0px; - clear: both; -} - -.iframeContainer.active { - display: block; -} - -#logWindow { - max-height: 330px; - float: left; - overflow: hidden; -} - -.topFrame { - display: table-cell; - width: 32%; - width: calc((100% - 20.1px)/3); - height: 330px; -} - -.topPanel { - display: table; - table-layout: fixed; - width: 100%; - height: 330px; - margin: 15px 0 15px 0; -} - -.bottomPanel { - width: 100%; - margin-bottom: 10px; - max-width: 100%; -} - -#steps-nav-bar { - height: 48px; - vertical-align: top; - background: #FFFFFF; -} - -#steps-ul { - height: 100%; -} - -#navbar-content { - display: table; - width: 100%; - height: 100%; -} - -#welcome-text, #showcases-text { - margin-top: 2px; - padding: 16px 24px 16px 24px; - background: #FFFFFF; -} - -#sample-tool-header { - margin-bottom: 16px; - font-size: 24px; -} - -#sample-tool-description, #showcases-description { - max-width: 1000px; -} - -#showcase-embedded-view { - background: #FFFFFF; - height: calc(67vw*(9/16)*1.1); - position: relative; -} - -#bookmark-embedded-view { - background: #FFFFFF; - height: calc(61vw*(9/16)*1.1); -} - -#themes-embedded-view { - background: #FFFFFF; - height: calc(64vw*(9/16)*1.1); -} - - -#leftShowcaseWindow { - min-width: 20vw; - max-width: 20vw; - display: table-cell; - padding-right: 16px; -} - -#showcaseItemsWrapper, #bookmarksWrapper, #generatorWrapper { - background: #FFFFFF; - min-height: 350px; -} - -#themesDataColorsWrapper { - background: #FFFFFF; - min-height: 236px; - margin-bottom: 8px; -} - -#themesBackgroundWrapper { - background: #FFFFFF; - min-height: 64px; - padding: 22px 22px; -} - -#bookmarksWrapper { - min-height: 550px; -} - -#showcaseEmbedArea { - display: table-cell; - width: 100%; -} - -#insightToActionShowcaseEmbedArea { - width: calc(100% - 20vw); -} - -#showcasesSelectDiv { - max-width: 1250px; -} - -@media only screen and (max-width: 1280px) { - #distributionDialog { - width: 750px; - height: 450px; - } - - #dialogTable { - height: 303px; - } - - #dialogTooltip { - top: 195px; - } -} - - -@media only screen and (max-width: 1050px) { - .textAreaControl { - margin-right: 20px; - } -} - -@media only screen and (max-width: 950px) { - #navbar-content { - display: block; - } - - .content { - display: block; - } - - #contentWrapper { - display: block; - width: 100%; - } - - #main-ul-dev { - padding-top: 0px; - } - - #navbar { - display: block; - width: 100%; - height: 48px; - } - - .main-ul li { - width: 160px; - float: left; - text-align: center; - } - - #main-nav-bar a { - padding-left: 0px; - } - - #modeSelector { - margin-bottom: 8px; - } - - body { - background-color: #F1F1F1; - } - - .desktop-view { - height: calc(100vw * 0.59); - } -} - -@media only screen and (max-width: 800px) { - .topPanel { - display: block; - } - - .topFrame { - width: 100%; - } - - .customTooltip .tooltipText { - top: -21px; - left: -170px; - } - - .customTooltip .tooltipText::after { - top: 50%; - left: 100%; /* To the right of the tooltip */ - margin-top: -5px; - border-width: 5px; - border-style: solid; - border-color: transparent transparent transparent #000000; - margin-left: 0px; - } -} - -@media only screen and (max-width: 750px) { - #main-showcases { - display: none !important; - } - - .tryShowcase { - display: none !important; - } -} - -@media only screen and (max-width: 500px) { - .main-ul li { - width: 33%; - } - - body { - font-size: 12px; - } - - .interactTooltip .tooltipText { - left: -105px; - top: 35px; - } - - .interactTooltip .tooltipText::after { - display: none; - } -} - -@media only screen and (max-width: 460px) { - .logo-text-span { - font-size: 18px; - text-align: center; - left: 0px; - font-weight: 600; - } - - .logo-text-span { - width: 100%; - } -} - -@media only screen and (max-width: 432px) { - .pbi-line { - width: calc(100% - 24px); - } - - #sampleTileImg { - background-position: left; - } -} diff --git a/demo/v2-demo/style/style.css b/demo/v2-demo/style/style.css deleted file mode 100644 index 48cfd283..00000000 --- a/demo/v2-demo/style/style.css +++ /dev/null @@ -1,1865 +0,0 @@ -html { - margin:0; - padding:0; - height:100%; -} - -body { - background-color: #F1F1F1; - font-family: 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif; - margin:0; - padding:0; - height:100%; - font-size: 14px; - line-height: 1.42857143; - color: #333; -} - -h1 { - margin-bottom: 15px; -} - -h2 { - margin-top: 20px; - margin-bottom: 10px; -} - -h3 { - margin: 0; - font-size: 24px; - font-family: inherit; - font-weight: 500; - line-height: 1.1; - color: inherit; -} - -h8 { - font-weight: 600; -} - -button:focus { - outline: none !important; -} - -a { - color: #337ab7; - text-decoration: none; -} - -a:hover, a:visited, a:link, a:active -{ - text-decoration: none !important; -} - -.logo-text-span { - position: relative; - width: 480px; - left: 24px; - padding-top: 12px; - - font-family: 'Segoe UI', sans-serif; - line-height: normal; - font-size: 24px; - color: #FFFFFF; -} - -.embed-table, #qna-embed-table { - width: 100%; -} - -.embed-table tr, #qna-embed-table tr { - width: 100%; -} - -#dashboard-embed-table { - width: 100%; -} - -#dashboard-embed-table tr { - width: 100%; -} - -#tile-embed-table { - width: 100%; -} - -#tile-embed-table tr { - width: 100%; -} - -.inputLine > span { - width: 30%; -} - -.embed-table input[type="text"], #qna-embed-table input[type="text"], #dashboard-embed-table input[type="text"], #tile-embed-table input[type="text"] { - width: calc(100% - 95px); - border: none; - margin-bottom: 5px; - background: #F1F1F1; - padding-left: 4px; -} - -#visual-embed-table input[type="text"] { - width: calc(100% - 112px); - border: none; - margin-bottom: 5px; - background: #F1F1F1; - padding-left: 4px; -} - -.pbi-line { - float: left; - width: 384px; - margin: 12px; - background: #FFFFFF; - border: solid; - border-color: white; -} - -.pbi-line:hover { - box-shadow: 0px 0px 48px rgba(0, 0, 0, 0.12); -} - -#main-nav-bar a { - color: #FFFFFF; - display: inline-block; - padding-left: 16px; - font-weight: 600; - font-size: 15px; -} - -#steps-nav-bar a { - color: #6E6E6E; - font-family: 'Segoe UI', sans-serif; - line-height: normal; - font-size: 15px; - font-weight: 600; -} - -.main-ul .active { - background-color: #F5D341; -} - -.main-li { - float: left; -} - -.main-li a { - display: block; - color: #000000; - text-align: center; - padding: 0px 16px; - text-decoration: none; -} - -.main-li a:visited { - display: block; - color: #000000; - text-align: center; - padding: 0px 16px; - text-decoration: none; - background-color: #F5D341; -} - -.main-li a:hover { - display: block; - color: #000000; - text-align: center; - padding: 0px 16px; - text-decoration: none; - background-color: #F5D341; -} - -.main-li a:active { - display: block; - color: #000000; - text-align: center; - padding: 0px 16px; - text-decoration: none; - background-color: #F5D341; -} - -.main-ul li { - float: none; - text-align: left; - line-height: 22px; - height: 48px; - width: 100%; - margin-bottom: 10px; - padding-top: 12px; -} - -#main-docs, #main-showcases { - margin-right: 0px; -} - -.main-li-active { - color: #FFFFFF; - text-decoration: none; - background-color: #121212; -} - -#steps-ul-dev { - width: 100%; - height: 100%; -} - -.steps-ul { - list-style-type: none; - margin: 0px; - overflow: hidden; - padding-left: 0; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - line-height: 30px; - width: 100%; -} - -.steps-ul li { - float: left; - width: 100px; - text-align: center; - line-height: 18px; - font-size: 15px; - font-family: 'Segoe UI', sans-serif; -} - -#steps-samples { - margin-left: 6px; -} - -#steps-interact { - margin-right: 0px; -} - -.steps-li-active { - border-bottom: 2px solid #F2C811 !important; - padding: 0 4px 6px; -} - -.operations-div { - height: 100%; - width: 100%; - text-align: center; - overflow-y: scroll; - position: relative; -} - -#wrapper-operations-div { - padding: 8px 8px 8px 12px; - background-color: #FFFFFF; - width: 100%; - height: 298px; - overflow: hidden; - display: inline-block; -} - -#wrapper-settings-div { - padding: 10px 10px 15px 12px; - background-color: #FFFFFF; - width: 100%; - height: 298px; - display: inline-block; -} - -#highlighter { - padding: 10px 20px 15px 20px; - background-color: #FFFFFF; -} - -#operation-categories::-webkit-scrollbar-track -{ - border-radius: 10px; - background-color: transparent; -} - -#operation-categories::-webkit-scrollbar -{ - width: 6px; - height: 10px; - background-color: transparent; -} - -#operation-categories::-webkit-scrollbar-thumb -{ - border-radius: 10px; - background-color: #E1E1E1; -} - -#txtCode::-webkit-scrollbar-track, #txtResponse::-webkit-scrollbar-track { - border-radius: 10px; - background-color: transparent; -} - -#txtCode::-webkit-scrollbar, #txtResponse::-webkit-scrollbar { - width: 6px; - height: 10px; - background: transparent -} - -#txtCode::-webkit-scrollbar-thumb, #txtResponse::-webkit-scrollbar-thumb { - border-radius: 10px; - background-color: #E1E1E1; -} - -.function-ul { - width: 100%; - clear: both; - margin: 0; - padding: 0px 20px 0px 35px; - font-size: 12px; -} - -.operations-ul { - width: 100%; - clear: both; - margin: 0; - padding: 0; -} - -.function-ul li, .operations-ul li { - width: 100%; - clear: both; - cursor: default; - overflow: hidden; - padding-left: 0px; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - margin: 5px 0px; - text-align: left; - padding: 2px 3px 0 0; -} - -.operations-ul > li:before { - content: " "; - background: url('http://github.com/images/expand.svg') center left; - background-repeat: no-repeat; - padding-right: 18px; - cursor: pointer; -} - -.operations-ul > li.active:before { - background: url('http://github.com/images/collapse.svg') center left; - background-repeat: no-repeat; - cursor: pointer; -} - -.operations-ul a { - text-decoration: none; - color: #1B1B1B; -} - -.function-ul .active, .function-ul .active a { - color: #3E65FF; - font-weight: bold; -} - -.td-field-name { - width: 130px; - text-align: right; - color: #888888; - padding-right: 5px; -} - -.pageTitle { - margin-bottom: 10px; -} - -.pageTitle h3 { - margin-bottom: 15px; - font-weight: normal; -} - -.newSample, .newShowcase { - height: 16px; - width: 40px; - background-color: #F2C811; - font-size: 10px; - text-align: center; - color: #000000; - left: 16px; - bottom: 0px; - position: absolute; - font-weight: 600; - padding: 0.5px; -} - -.newSection { - height: 10px; - width: 25px; - background-color: #F2C811; - font-size: 8px; - text-align: center; - color: #000000; - left: 99px; - bottom: 86px; - position: absolute; - font-weight: 600; - line-height: 10px; -} - -.newFeature { - height: 16px; - width: 40px; - background-color: #F2C811; - font-size: 10px; - text-align: center; - color: #000000; - left: 6px; - bottom: 1px; - display: inline-block; - position: relative; - font-weight: 600; - padding: 0.5px; -} - -.highlightSection { - height: 6px; - width: 6px; - border-radius: 50%; - background-color: #F2C811; - left: 12px; - bottom: 1px; - display: inline-block; - position: relative; -} - -.editorTitle { - font-weight: 620; - font-size: 15px; - height: 32px; - padding: 5px 0 0 8px; - color: #000000; -} - -#tabs-wrapper { - height: 32px; -} - -#tabs-ul { - list-style-type: none; - margin: 0px; - padding-left: 0; - -webkit-margin-before: 0; - -webkit-padding-start: 0; - line-height: 30px; - width: 100%; -} - -#tabs-ul a { - color: #6E6E6E; - font-family: 'Segoe UI', sans-serif; - line-height: normal; - font-size: 15px; - font-weight: 620; -} - -#tabs-ul li { - height: 32px; - width: 96px; - background-color: #E1E1E1; - text-align: center; - float: left; -} - -#tabs-ul li.tabs-li-active { - color: #000000; - background-color: #FFFFFF; -} - -#tabs-ul .tabs-li-active a { - color: #000000; -} - -.textAreaControls { - background-color: #FAFAFA; - position: relative; - z-index: 1; - height: 40px; - padding: 0 20px; - font-size: 14px; - font-weight: bold; -} - -.textAreaControl:hover { - background-color: #EAEAEA; - border-top: 2px solid #EAEAEA; - border-bottom: 2px solid #EAEAEA; -} - -.textAreaControl { - background-color: transparent; - border: none; - outline: none; - margin-right: 40px; - height: 40px; - opacity: 1; - min-width: 80px; - font-weight: bold; - cursor: pointer; -} - -.textAreaControl img { - position: relative; - top: -2px; - padding-right: 3px; - right: 2px; -} - -.textAreaControl.regular img { - height: 18px; -} - -.textAreaControl.wide { - min-width: 100px; -} - -.textAreaControl.wide img { - height: 14px; -} - -.textAreaControl.narrow img { - width: 14px; - height: 16px; -} - -.responseTextAreaWrapper { - padding: 10px 20px 15px 20px; - background-color: #FFFFFF; -} - -.responseTextArea { - width: 100%; - height: 240px; - border: none; - position: relative; - overflow-y: auto; - resize: none; -} - -#highlighter { - height: 265px; -} - -.responseDiv { - width: 100%; - float: left; -} - -.selectButton { - border: none; - color: #000000; - background-color: #FFFFFF; - border: solid; - border-width: 1px; - border-color: #6E6E6E; - padding: 5px 30px; - width: 160px; - height: 32px; - text-align: center; - cursor: pointer; -} - -.selectButton:hover { - background-color: #3E65FF; - color: #FFFFFF; - border-color: transparent; -} - -.blueButton { - background-color: #24A9E1; - border: none; - color: #FFFFFF; - padding: 5px 30px; -} - -.spacer { - height: 5px; -} - -.scrollbar -{ - margin-left: 30px; - float: left; - height: 300px; - width: 65px; - background: #F5F5F5; - overflow-y: scroll; - margin-bottom: 25px; -} - -#txtCode { - width: 100%; - height: 240px; - position: relative; - background: #FFFFFF; - overflow-y: auto; -} - -.embed-table .inputLine, #dashboard-embed-table .inputLine, #tile-embed-table .inputLine, #qna-embed-table .inputLine, #visual-embed-table .inputLine { - margin: 2px 0px; -} - -.pageTitle h4 { - font-size: 18px; - font-weight: normal; - margin: 0px 0px 5px 0px; -} - -.main-div { - border-radius: 50%; - width: 10px; - height: 10px; - display: inline-block; - background-color: #FFFFFF; - border: solid black 1px; -} - -.editorTitleText { - display: inline-block; -} - -.stepsButton { - height: 100%; - padding-top: 20px; - line-height: 20px; -} - -#createModeInput { - display: none; -} - -.inputLineTitle { - width: 90px; - display: inline-block; - vertical-align: middle; -} - -#modeSelector { - margin-bottom: 8px; - cursor: default; -} - -.desktop-view iframe, .mobile-view iframe, #showcase-embedded-view iframe, #bookmark-embedded-view iframe, #share-bookmark iframe, #themes-embedded-view iframe { - border: none; -} - -#questionDiv { - margin-bottom: 10px; -} - -.infoImg { - margin-bottom: 3px; -} - -.customTooltip { - position: relative; - display: inline-block; -} - -.customTooltip .tooltipText { - visibility: hidden; - width: 164px; - background-color: #121212; - color: #F1F1F1; - text-align: left; - padding: 4px 12px; - font-size: 12px; - left: -75px; - top: 25px; - position: absolute; - z-index: 1; -} - -.customTooltip:hover .tooltipText { - visibility: visible; -} - -.customTooltip .tooltipText::after { - content: " "; - position: absolute; - bottom: 100%; - left: 50%; - margin-left: -5px; - border-width: 5px; - border-style: solid; - border-color: transparent transparent black transparent; -} - -.interactTooltip { - position: relative; - display: inline-block; -} - -.interactTooltip .tooltipText { - transition: opacity 0.5s ease-in-out; - -webkit-transition: opacity 0.5s ease-in-out; - opacity: 0; - width: 290px; - background-color: #121212; - color: #F1F1F1; - text-align: left; - padding: 4px 12px; - font-size: 12px; - top: -5px; - left: 145%; - position: absolute; - z-index: -1; -} - -.interactTooltip .tooltipText.showTooltip { - opacity: 1; - z-index: 5; -} - -.interactTooltip .tooltipText::after { - content: " "; - position: absolute; - top: 50%; - right: 100%; - margin-top: -5px; - border-width: 5px; - border-style: solid; - border-color: transparent black transparent transparent; -} - -.mobile-view { - display: none; - background: #FFFFFF; - padding: 16px; -} - -.desktop-view { - display: none; - background: #FFFFFF; - height: calc((100vw - 220px) * 0.59); -} - -.mobile-view.active, .desktop-view.active { - display: block; -} - -.phone-frame { - border-radius: 30px; - background: #EAEAEA; - width: 408px; - width: 44vh; - height: 787px; - height: 85vh; - margin: auto; -} - -.phone-top { - position: relative; - width: 100%; - height: 48px; -} - -.phone-bottom { - position: relative; - width: 100%; - height: 72px; -} - - -.phone-speaker{ - position: relative; - width: 48px; - height: 8px; - background: #C4C4C4; - border-radius: 4px; - margin: auto; - top: 21px; -} - -.phone-screen { - position: relative; - width: 375px; - height: 667px; - width: calc(100% - 33px); - height: calc(100% - 120px) !important; - margin: auto; - background: #FFFFFF; - border-width: 1px; - border-color: #C4C4C4; - border-style: solid; -} - -.phone-button { - position: relative; - width: 40px; - height: 40px; - background: #C4C4C4; - border-radius: 50%; - margin: auto; - top: 16px; -} - -.sampleImg, .showcaseImg { - position: relative; - height: 192px; - background: #FFFFFF; - background-repeat: no-repeat; - background-size: 378px auto; - background-position: top left; - box-shadow: inset 0 -7px 35px -7px rgba(0,0,0,0.12); -} - -.sampleTextButton, .showcaseTextButton { - padding: 16px; -} - -#sampleReportImg { - background-image: url('http://github.com/images/samplereport.png'); -} - -#sampleVisualImg { - background-image: url('http://github.com/images/samplevisual.png'); -} - -#sampleTileImg { - background-image: url('http://github.com/images/sampletile.png'); - background-position: bottom; -} - -#sampleQnaImg { - background-image: url('http://github.com/images/sampleqna.png'); - background-position: left; -} - -#sampleDashboardImg { - background-image: url('http://github.com/images/sampledashboard.png'); -} - -#samplePaginatedReportImg { - background-image: url('http://github.com/images/samplerdlreport.png'); - background-position: top; -} - -.showcaseIcon { - position: relative; - left: 50%; - top: 50%; - -webkit-transform: translate(-50%,-50%); - transform: translate(-50%,-50%); -} - -#bookmarksIcon { - top: 56%; -} - -.radioContainer { - display: block; - position: relative; - padding-left: 26px; - margin: 4px 0; - cursor: pointer; - font-weight: normal; -} - -.radioContainer input { - position: absolute; - opacity: 0; - cursor: pointer; -} - -.checkmark { - position: absolute; - top: 2px; - left: 0px; - height: 16px; - width: 16px; - border: none; - border-radius: 50%; - border-color: #6E6E6E; - border-style: solid; - border-width: 1px; -} - -.radioContainer input:checked ~ .checkmark { - border-color: #3E65FF; -} - -.checkmark:after { - content: ""; - position: absolute; - display: none; -} - -.radioContainer input:checked ~ .checkmark:after { - display: block; -} - -.radioContainer .checkmark:after { - top: 3px; - left: 3px; - width: 8px; - height: 8px; - border-radius: 50%; - background: #3E65FF; -} - -#clipboard-textarea { - position: fixed; - top: 0px; - left: 0px; - width: 1px; - height: 1px; - padding: 0px; - border: none; - outline: none; - box-shadow: none; - background: transparent; -} - -#docs-section { - font-size: 16px; - line-height: 2; - background: #F1F1F1; - height: 100%; - width: 100%; - align-items: center; -} - -.docs-links { - margin-right: 30px; - float: left; - width: 330px; - height: 180px; -} - -.docs-video { - margin-right: 30px; - float: left; - font-weight: 600; - line-height: 3; - width: 330px; -} - -.docs-line { - display: block; - clear: both; -} - -#docs-content { - max-width: 1080px; -} - -#interact-tab.enableTransition { - transition: all 1s ease 0s; - -webkit-transition: all 1s ease 0s; -} - -#interact-tab.changeColor { - background-color: #F2C811; -} - -#interact-tab.changeColor a { - color: #000000; -} - -.elementClicked { - opacity: 0.7; -} - -#visualsList, #bookmarksList, #themesList { - padding: 8px 0 8px 0; -} - -#generatorOptions { - padding: 8px 16px; -} - -.checkboxContainer { - display: block; - position: relative; - margin-bottom: 0px; - cursor: pointer; - font-size: 16px; - -webkit-user-select: none; - user-select: none; - height: 40px; - padding: 8px 8px 8px 40px; -} - -.checkboxContainer input { - position: absolute; - opacity: 0; - cursor: pointer; -} - -.checkboxCheckmark { - position: absolute; - top: 11px; - left: 12px; - height: 16px; - width: 16px; - background-color: #FFFFFF; - border-color: #000000; - border-style: solid; - border-width: 1px; - transition: background-color 100ms ease; - -webkit-transition: background-color 100ms ease; -} - -.checkboxContainer input:checked ~ .checkboxCheckmark { - background-color: #3E65FF; - border-color: #3E65FF; -} - -.checkboxContainer input:checked { - background: grey; -} - -.checkboxCheckmark:after { - content: ""; - position: absolute; - display: none; -} - -.checkboxContainer input:checked ~ .checkboxCheckmark:after { - display: block; -} - -.checkboxContainer .checkboxCheckmark:after { - top: 1px; - left: 4px; - width: 6px; - height: 9px; - border: solid white; - border-width: 0 1px 1px 0; - -webkit-transform: rotate(45deg); - transform: rotate(45deg); -} - -.showcaseRadioContainer { - display: block; - position: relative; - padding-left: 26px; - margin: 4px 0; - cursor: pointer; - font-weight: normal; - height: 40px; - padding: 8px 8px 8px 40px; -} - -.themesRadioContainer { - height: 50px; -} - -.showcaseRadioContainer input { - position: absolute; - opacity: 0; - cursor: pointer; -} - -.showcaseRadioCheckmark { - position: absolute; - top: 11px; - left: 12px; - height: 16px; - width: 16px; - border: none; - border-radius: 50%; - border-color: #6E6E6E; - border-style: solid; - border-width: 1px; - transition: all 100ms ease; - -webkit-transition: all 100ms ease; -} - -.showcaseRadioContainer input:checked ~ .showcaseRadioCheckmark { - border-color: #3E65FF; -} - -.showcaseRadioCheckmark:after { - content: ""; - position: absolute; - display: none; -} - -.showcaseRadioContainer input:checked ~ .showcaseRadioCheckmark:after { - display: block; -} - -.showcaseRadioContainer .showcaseRadioCheckmark:after { - top: 3px; - left: 3px; - width: 8px; - height: 8px; - border-radius: 50%; - background: #3E65FF; -} - -#bookmarkShare { - float: right; - position: relative; - top: 5px; -} - -#overlay { - display: none; - background-color: rgba(0, 0, 0, 0.24); - position: absolute; - position: fixed; - bottom: 0; - left: 0; - right: 0; - top: 0; - z-index: 11; -} - -#overlay-embed-container { - background-color:white; - position: absolute; - width: 100%; - height: 100%; - z-index: 11; - text-align: center; - font-family: Segoe UI; - font-size: 20px; -} - -#overlay-embed-container.overlay-text { - padding-top: calc(30% - 20px); -} - -#shareDialog { - display: none; - position: fixed; - top: 50%; - left: 50%; - width: 320px; - margin-left: -160px; - height: 170px; - margin-top: -75px; - background-color: #FFFFFF; - box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.25); - z-index: 12; -} - -#shareDialog .dialogHeader { - height: 40px; -} - -#btnCloseDialog { - float: right; - position: relative; - margin: 15px 15px 0 0; - cursor: pointer; -} - -#btnCloseDialog img { - width: 14px; -} - -#dialogInput { - float: left; - height: 32px; - border: solid; - border-width: 2px 0 2px 2px; - border-color: #3E65FF; - width: calc(100% - 70px); - padding: 8px 0 8px 8px; - outline: none; - margin-bottom: 32px; -} - -#btnDialogCopy { - float: left; - cursor: pointer; - text-align: center; - width: 70px; - height: 32px; - background-color: #3E65FF; - color: #FFFFFF; - padding: 6px; -} - -#btnDialogCopy:hover { - background-color: #213BD1; -} - -#shareDialog .dialogBody { - padding: 8px 24px 0px 24px; - text-align: center; - font-family: Segoe UI; - line-height: 18px; - color: #212121; -} - -.dialogText { - font-size: 18px; - line-height: 24px; -} - -.dialogSubText { - font-size: 12px; - margin-bottom: 16px; -} - -.floatButton { - float: left; - margin-right: 16px; -} - -.showcases-buttons { - height: 32px; - margin-top: 16px; -} - -.text-small-tab { - padding-left: 1em; -} - -.text-tab { - padding-left: 1.4em; -} - -.active-mode { - border-bottom: 2px solid #F2C811 !important; - border-top: 2px solid transparent; -} - -.active-columns-btn { - border-bottom: 2px solid #F2C811 !important; - border-top: 2px solid transparent; -} - -.tryShowcase { - position: relative; - cursor: pointer; - font-weight: 500; - font-size: 8pt; - margin-left: 3px; -} - -.tryMeText { - color: #3E65FF; - margin-left: 1px; -} - -.tryShowcase img { - width: 12px; - height: 9px; - margin: 0 1px; - position: relative; - bottom: 1px; -} - -.modeTooltip { - position: relative; - float: right; - bottom: 24px; -} - -.modeTooltip.view { - right: calc(100% - 115px); -} - -.modeTooltip.edit { - right: calc(100% - 108px); -} - -.modeTooltip.create { - right: calc(100% - 125px); -} - -.modeTooltip .tooltipText { - visibility: hidden; - width: 246px; - background-color: #121212; - color: #F1F1F1; - text-align: left; - padding: 4px 12px; - font-size: 12px; - top: -2px; - left: 145%; - position: absolute; - z-index: 10; -} - -.modeTooltip .tooltipText.edit { - width: 200px; -} - -.modeTooltip .tooltipText.create { - width: 230px; -} - -.modeTooltip:hover .tooltipText { - visibility: visible; -} - -.modeTooltip .tooltipText::after { - content: " "; - position: absolute; - top: 50%; - right: 100%; - margin-top: -5px; - border-width: 5px; - border-style: solid; - border-color: transparent black transparent transparent; -} - -.noOverflow { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.columnsIcon img { - height: 24px; -} - -.columnsIcon { - padding-top: 6px; - min-width: 95px; -} - -.twoColumnsIcon { - min-width: 107px; -} - -.themeDataColor { - margin-right: 3px; -} - -.themeBackgroundColor { - margin-right: 6px; - outline: 1px solid #000000; - cursor: pointer; - vertical-align: sub; -} - -.themeBackgroundColor.selected { - outline: 2px solid #F2C811; -} - -#startTooltip, #dialogTooltip { - opacity: 0; - transition: opacity 0.5s ease-in-out; - -webkit-transition: opacity 0.5s ease-in-out; - position: absolute; - background-color: #3b3a39; - width: 300px; - box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.25); - z-index: -1; - padding: 16px 24px; - top: 0px; - left: 0px -} - -#dialogTooltip { - top: 320px; - left: -12px; -} - -#startTooltip.showTooltip, #dialogTooltip.showTooltip { - opacity: 1; - z-index: 15; -} - -#startTooltip::after, #dialogTooltip::after { - content: " "; - position: absolute; - right: calc(50% - 10px); - top: 100%; - border-width: 10px; - border-style: solid; - border-color: #3b3a39 transparent transparent transparent; -} - -#startTooltip .tooltipNumber { - float: left; - margin-left: 16px; - line-height: 20px; - font-size: 14px; - padding: 6px 0px; - color: #FFFFFF; -} - -.btnCloseTooltip { - position: absolute; - right: 16px; - top: 8px; -} - -.btnCloseTooltip img { - height: 10px; - width: 10px; - cursor: pointer; -} - -.showcaseTooltipText { - font-weight: 600; - line-height: 28px; - font-size: 20px; - color: #FFFFFF; - margin-bottom: 8px; -} - -.showcaseTooltipSubText { - font-style: normal; - font-weight: normal; - line-height: 20px; - font-size: 14px; - color: #FFFFFF; -} - -.tooltipFooter { - margin-top: 52px; - height: 32px; -} - -.btnShowcaseTooltip { - height: 32px; - width: 84px; - text-align: center; - line-height: 30px; - font-weight: 600; - float: left; - cursor: pointer; - transition: background-color .2s; - user-select: none; - color: #000000; -} - -.yellowBtn { - background-color: #F2C811; - border: none !important; - border-radius: 2px; -} - -.yellowBtn:hover { - background-color: #ddb612; -} - -.whiteBtn { - background-color: #FFFFFF; - border-radius: 2px; -} - -.whiteBtn:hover { - background-color: #F4F4F4; -} - -#dialogMask { - position: absolute; - display: none; - top: 0; - bottom: 0; - left: 0; - right: 0; -} - -.insightToActionDialog { - display: none; - position: absolute; - top: 50%; - left: 50%; - background-color: #FFFFFF; - box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.25); - z-index: 12; - padding: 16px 24px; - transform: translate(-50%, -50%); -} - -#distributionDialog { - width: 952px; - height: 572px; -} - -#sendDialog { - width: 600px; - height: 400px; -} - -#distributionDialog .dialogHeader, #sendDialog .dialogHeader { - height: 48px; -} - -#distributionDialog .dialogFooter, #sendDialog .dialogFooter { - position: absolute; - bottom: 0px; - left: 0px; - right: 0px; - height: 64px; - padding: 16px 24px; -} - -#distributionDialog .dialogFooter { - border-top: solid; - border-width: 1px; - border-color: #EAEAEA; -} - -#dialogTable { - height: 425px; - color: #212121; - overflow-y: scroll; - padding-right: 10px; - margin-bottom: 5px; -} - -#dialogTable::-webkit-scrollbar-track -{ - border-radius: 10px; - background-color: transparent; -} - -#dialogTable::-webkit-scrollbar -{ - width: 6px; - height: 10px; - background-color: transparent; -} - -#dialogTable::-webkit-scrollbar-thumb -{ - border-radius: 10px; - background-color: #E1E1E1; -} - -.dialogHeaderText { - font-weight: 600; - line-height: 28px; - font-size: 20px; -} - -#btnCloseDistributionDialog { - float: right; - position: relative; - cursor: pointer; - margin-top: 2px; -} - -.insightToActionDialogBtn { - float: left; - width: 110px; - height: 32px; - text-align: center; - line-height: 30px; - font-weight: 600; - cursor: pointer; - transition: background-color .2s; - user-select: none; - border: solid; - border-width: 1px; - border-color: #6E6E6E; - margin-right: 8px; - color: #000000; -} - -.sendBtn { - float: right; -} - -.cancelBtn { - float: right; - margin-right: 0px; -} - -#dialogTable table { - border-collapse: collapse; - width: 100%; -} - -#dialogTable th, #dialogTable td { - padding: 8px; - text-align: left; - border-bottom: 1px solid #ddd; -} - -#dialogTable td { - font-size: 12px; - color: #666666; -} - -#dialogTable td.nameCell { - font-size: 14px; - color: #000000; -} - -.checkAllBtn { - user-select: none; -} - -.sendDialogField { - color: #000000; - font-weight: 500; - line-height: 20px; - font-size: 16px; - padding: 8px 0px; -} - -#sendDialog input[type=text], #sendDialog textarea { - width: 100%; - padding: 12px; - border: 1px solid #cccccc; - border-radius: 4px; - resize: none; -} - -#sendDialog textarea { - height: 130px; -} - -#messageSent { - transition: opacity 1.5s ease; - -webkit-transition: opacity 1.5s ease; - opacity: 0; - position: absolute; - z-index: -1; - left: calc(50% - 34px); - bottom: 8px; - width: 68px; - padding: 2px 6px; - border: 1px solid #aaaaaa; - background-color: #000000; - text-align: center; - color: #FFFFFF; -} - -#messageSent.show { - opacity: 1; - z-index: 5; -} - -#generator-fields, #generator-properties, .title-wrapper { - margin-top: 8px; -} - -input#ptitle[type="text"] { - margin-top: 8px; - border: 1px solid #A19F9D; - border-radius: 2px; - height: 32px; - width: calc(100% - 30px); - padding-left: 8px; -} - -#btnEraseCustomTitle { - margin-left: 5px; - cursor: pointer; -} - -#alignment-blocks-wrapper { - height: 32px; - margin-top: 8px; -} - -.alignment-block { - height: 25px; - width: 25px; - padding: 1px 4px; - margin-right: 6px; - float: left; - cursor: pointer; - user-select: none; -} - -.alignment-block.selected { - background-color: #F2C811; -} - -.title-wrapper-big { - margin-top: 12px; -} - -/* Select Menu */ - -.styled-select { - position: relative; - font-family: Segoe UI; - font-size: 14px; - line-height: 20px; -} - -.styled-select select { - display: none; /*hide original SELECT element: */ -} - -.inline-select-text, .inline-toggle-text { - line-height: 32px; -} - -.select-wrapper, .toggle-wrapper { - height: 32px; - margin-top: 8px; -} - -.inline-select { - float: right; - width: calc(100% - 80px); -} - -.select-selected { - background-color: #FFFFFF; -} - -/* Style the arrow inside the select element: */ -.select-selected:after { - position: absolute; - top: 9px; - right: 5px; - display: block; - content: " "; - background: url(http://github.com/images/collapse.svg) center left; - background-repeat: no-repeat; - height: 16px; - width: 16px; -} - -/* style the items (options), including the selected item: */ -.select-selected, .select-items div { - color: #000000; - padding: 5px 10px; - border: 1px solid #A19F9D; - cursor: pointer; -} - -.select-selected { - border-radius: 2px; -} - -.select-items div { - border-color: transparent #A19F9D #A19F9D #A19F9D; -} - -.select-items { - position: absolute; - background-color: #FFFFFF; - top: 100%; - left: 0; - right: 0; - z-index: 99; -} - -/* Hide the items when the select box is closed */ -.select-hide { - display: none; -} - -.select-items div:hover, .same-as-selected { - background-color: rgba(0, 0, 0, 0.1); -} - -/* Toggle Button */ - -.inline-toggle-text { - float: left; - width: 54px; -} - -/* The switch - the box around the slider */ -.switch { - position: relative; - float: left; - width: 40px; - height: 20px; - margin: 7px 0 7px 16px; -} - -/* Hide default HTML checkbox */ -.switch input { - opacity: 0; - width: 0; - height: 0; -} - -/* The slider */ -.slider { - position: absolute; - cursor: pointer; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: #FFFFFF; - -webkit-transition: .4s; - transition: .4s; -} - -.slider:before { - position: absolute; - content: ""; - height: 12px; - width: 12px; - left: 4px; - bottom: 3px; - background-color: #605E5C; - -webkit-transition: .4s; - transition: .4s; -} - -input:checked + .slider { - background-color: #F2C811; -} - -input:checked + .slider:before { - -webkit-transform: translateX(18px); - -ms-transform: translateX(18px); - transform: translateX(18px); - background-color: #FFFFFF; -} - -/* Rounded sliders */ -.slider.round { - border-radius: 40px; - border-color: #605E5C; - border: 1px solid; -} - -input:checked + .slider.round { - border-color: #F2C811; -} - -.slider.round:before { - border-radius: 50%; -} - -.generator-disabled { - color: #A19F9D; - pointer-events: none; -} - -.generator-disabled .select-selected { - color: #A19F9D; -} - -.toggle-wrapper.disabled { - pointer-events: none; -} - -.generator-disabled .slider, .generator-disabled input:checked + .slider, .toggle-wrapper.disabled input:checked + .slider { - background-color: #C8C6C4; - border-color: #C8C6C4; -} - -.generator-disabled .alignment-block.selected { - background-color: #F3F2F1; -} - -#aligns-disabled, #erase-tool-disabled { - display: none; -} - -#erase-tool-enabled { - display: inherit; -} - -.generator-disabled #aligns-enabled, .generator-disabled #erase-tool-enabled { - display: none; -} - -.generator-disabled #aligns-disabled, .generator-disabled #erase-tool-disabled { - display: inherit; -} - -#overlay-embed-container #spinner { - top: calc(50% - 20px); - right: calc(50% - 60px); - position: absolute; - font-size: 14px; -} diff --git a/demo/v2-demo/style/syntaxHighlighterOverride.css b/demo/v2-demo/style/syntaxHighlighterOverride.css deleted file mode 100644 index 4964966e..00000000 --- a/demo/v2-demo/style/syntaxHighlighterOverride.css +++ /dev/null @@ -1,7 +0,0 @@ -.syntaxhighlighter { - overflow: hidden !important; -} - -.syntaxhighlighter .line { - white-space: pre-wrap !important; -} \ No newline at end of file diff --git a/demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js b/demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js deleted file mode 100644 index d8f0e63f..00000000 --- a/demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js +++ /dev/null @@ -1,3768 +0,0 @@ -/*! - * SyntaxHighlighter - * https://github.com/syntaxhighlighter/syntaxhighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 4.0.1 (Tue, 07 Mar 2017 15:42:46 GMT) - * - * @copyright - * Copyright (C) 2004-2016 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _core = __webpack_require__(1); - - Object.keys(_core).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _core[key]; - } - }); - }); - - var _domready = __webpack_require__(24); - - var _domready2 = _interopRequireDefault(_domready); - - var _core2 = _interopRequireDefault(_core); - - var _dasherize = __webpack_require__(25); - - var dasherize = _interopRequireWildcard(_dasherize); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - // configured through the `--compat` parameter. - if (false) { - require('./compatibility_layer_v3'); - } - - (0, _domready2.default)(function () { - return _core2.default.highlight(dasherize.object(window.syntaxhighlighterConfig || {})); - }); - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var optsParser = __webpack_require__(2), - match = __webpack_require__(5), - Renderer = __webpack_require__(9).default, - utils = __webpack_require__(10), - transformers = __webpack_require__(11), - dom = __webpack_require__(17), - config = __webpack_require__(18), - defaults = __webpack_require__(19), - HtmlScript = __webpack_require__(20); - - var sh = { - Match: match.Match, - Highlighter: __webpack_require__(22), - - config: __webpack_require__(18), - regexLib: __webpack_require__(3).commonRegExp, - - /** Internal 'global' variables. */ - vars: { - discoveredBrushes: null, - highlighters: {} - }, - - /** This object is populated by user included external brush files. */ - brushes: {}, - - /** - * Finds all elements on the page which should be processes by SyntaxHighlighter. - * - * @param {Object} globalParams Optional parameters which override element's - * parameters. Only used if element is specified. - * - * @param {Object} element Optional element to highlight. If none is - * provided, all elements in the current document - * are returned which qualify. - * - * @return {Array} Returns list of { target: DOMElement, params: Object } objects. - */ - findElements: function findElements(globalParams, element) { - var elements = element ? [element] : utils.toArray(document.getElementsByTagName(sh.config.tagName)), - conf = sh.config, - result = []; - - // support for