diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..6e7798f5 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +# Task 512388: Fix eslint warnings and errors in tests +/node_modules/* +/**/*.js +dist/* \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..4240ccee --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,236 @@ +// TODO: Remove "warn" settings for the rules after resolving them +module.exports = { + "env": { + "browser": true, + "node": true + }, + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "webpack.test.tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "eslint-plugin-jsdoc", + "eslint-plugin-prefer-arrow", + "eslint-plugin-import", + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/adjacent-overload-signatures": "warn", + "@typescript-eslint/array-type": "off", + "@typescript-eslint/await-thenable": "warn", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/ban-types": [ + "warn", + { + "types": { + "Object": { + "message": "Avoid using the `Object` type. Did you mean `object`?" + }, + "Function": false, + "object": false, + "Boolean": { + "message": "Avoid using the `Boolean` type. Did you mean `boolean`?" + }, + "Number": { + "message": "Avoid using the `Number` type. Did you mean `number`?" + }, + "String": { + "message": "Avoid using the `String` type. Did you mean `string`?" + }, + "Symbol": { + "message": "Avoid using the `Symbol` type. Did you mean `symbol`?" + } + } + } + ], + "@typescript-eslint/consistent-type-definitions": "warn", + "@typescript-eslint/dot-notation": "off", + "@typescript-eslint/explicit-member-accessibility": [ + "off", + { + "accessibility": "explicit" + } + ], + "@typescript-eslint/explicit-module-boundary-types": [ + "warn", + { "allowArgumentsExplicitlyTypedAsAny": true } + ], + "@typescript-eslint/indent": [ + "warn", + 2, + { + "SwitchCase": 1, + "FunctionDeclaration": { + "parameters": "first" + }, + "FunctionExpression": { + "parameters": "first" + } + } + ], + "@typescript-eslint/member-delimiter-style": [ + "warn", + { + "multiline": { + "delimiter": "semi", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/explicit-function-return-type": [ + "error", + { + "allowExpressions": true, + "allowDirectConstAssertionInArrowFunctions": true + } + ], + "@typescript-eslint/member-ordering": "off", + "@typescript-eslint/naming-convention": "off", + "@typescript-eslint/no-array-constructor": "warn", + "@typescript-eslint/no-empty-function": "warn", + "@typescript-eslint/no-empty-interface": "warn", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-extra-non-null-assertion": "warn", + "@typescript-eslint/no-extra-semi": "warn", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-for-in-array": "warn", + "@typescript-eslint/no-implied-eval": "warn", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-misused-new": "warn", + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/no-namespace": "warn", + "@typescript-eslint/no-non-null-asserted-optional-chain": "warn", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/no-parameter-properties": "off", + "@typescript-eslint/no-this-alias": "warn", + "@typescript-eslint/no-unnecessary-type-assertion": "warn", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-return": "off", + "@typescript-eslint/no-unused-expressions": "warn", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "args": "after-used", "argsIgnorePattern": "^_" + } + ], + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-var-requires": "warn", + "@typescript-eslint/prefer-as-const": "warn", + "@typescript-eslint/prefer-for-of": "warn", + "@typescript-eslint/prefer-namespace-keyword": "warn", + "@typescript-eslint/prefer-regexp-exec": "off", + "@typescript-eslint/quotes": [ + "off", + { + "avoidEscape": true + } + ], + "@typescript-eslint/require-await": "warn", + "@typescript-eslint/restrict-plus-operands": "warn", + "@typescript-eslint/restrict-template-expressions": "off", + "@typescript-eslint/semi": [ + "error", + ], + "@typescript-eslint/triple-slash-reference": [ + "warn", + { + "path": "always", + "types": "prefer-import", + "lib": "always" + } + ], + "@typescript-eslint/type-annotation-spacing": "warn", + "@typescript-eslint/unbound-method": "off", + "@typescript-eslint/unified-signatures": "warn", + "arrow-parens": "off", + "brace-style": [ + "off", + "1tbs" + ], + "comma-dangle": "off", + "complexity": "off", + "constructor-super": "warn", + "eol-last": "warn", + "eqeqeq": [ + "warn", + "smart" + ], + "guard-for-in": "warn", + "id-blacklist": [ + "warn", + "any", + "Number", + "number", + "String", + "string", + "Boolean", + "boolean", + "Undefined", + ], + "id-match": "warn", + "import/order": "off", + "jsdoc/check-alignment": "warn", + "jsdoc/check-indentation": "warn", + "jsdoc/newline-after-description": "warn", + "max-classes-per-file": [ + "warn", + 1 + ], + "max-len": "off", + "new-parens": "warn", + "no-array-constructor": "off", + "no-caller": "warn", + "no-cond-assign": "warn", + "no-console": "off", + "no-debugger": "warn", + "no-empty": "warn", + "no-empty-function": "off", + "no-eval": "warn", + "no-extra-semi": "off", + "no-fallthrough": "off", + "no-implied-eval": "off", + "no-invalid-this": "off", + "no-multiple-empty-lines": ["error", { "max": 1 }], + "no-new-wrappers": "warn", + "no-shadow": "off", + "no-trailing-spaces": "warn", + "no-undef-init": "warn", + "no-underscore-dangle": "off", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-var": "warn", + "object-shorthand": "off", + "one-var": "off", + "prefer-const": "off", + "prefer-rest-params": "warn", + "quote-props": [ + "warn", + "consistent-as-needed" + ], + "radix": "warn", + "require-await": "off", + "space-before-function-paren": "off", + "spaced-comment": [ + "warn", + "always", + { + "markers": [ + "/" + ] + } + ], + "use-isnan": "warn", + "valid-typeof": "off" + } +}; diff --git a/.gitignore b/.gitignore index 713cbd07..d8bec088 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules/ -bower_components/ coverage/ docs typings/ @@ -9,4 +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/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4479811e..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "editor.tabSize": 2, - "editor.insertSpaces": true, - "editor.detectIndentation": false -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index a7b839de..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "0.1.0", - "command": "npm", - "isShellCommand": true, - "showOutput": "always", - "suppressTaskName": true, - "tasks": [ - { - "taskName": "build", - "args": [ - "run", - "build" - ], - "isBuildCommand": true - }, - { - "taskName": "test", - "args": [ - "run", - "test", - "--", - "--chrome" - ], - "isTestCommand": true - } - ] -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 9e5bfa50..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# 2.0.0-beta.1 (GA candidate) - -## Breaking - -- DOMContentLoaded handler is now opt-in instead of the default behavior - - Reasons: - - The primary use case will be using the core library within another library which may not have the DOM ready even if DOMContentLoaded has fired. - - Most developers using SPA applications will fetch embed data asynchronously and not know report data by the time the DOMContentLoaded has fired. - - How to opt-in to DOMContentLoaded: - - Call `enableAutoEmbed()` on an instance of the PowerBi service to add the event listener. - - Example: - ``` - - - ``` - - Alternately if you are creating an instance of the service you can pass a configuration parameter `autoEmbedOnContentLoaded` - - Example: - ``` - var powerbiService = new Powerbi({ autoEmbedOnContentLoaded: true }); - ``` -- `powerbi.get(element: HTMLElement)` now only returns the instance of powerbi component associated with the element and does not implicitly emebed. Use `powerbi.embed(element: HTMLElement, config: IEmbedOptions = {})`. - - Reasons: - - powerbi.embed performed the same function and is more semantic. - - Now that overwrite: true is the default behavior for .embed having a separate method (get) for only retrieving compnents is good separation of intents. -- Embed urls must be provided by the server and will not be constructed by the components. This implies that the attributes `powerbi-report` will no longer be used. - - Reasons: - - The construction of these urls was unreliable since it dependeded on assumptions about server configuration (target environment, component type, etc). - Since url would be incorrect in some cases it could cause trouble for developers. Also, since the sever is already returning access tokens it's trival for the server to also provide embed urls and this reduces complexity. - - Previously you could supply the embed information in two ways: - - 1. Using report id: - - `
` - - This would implicitly construct the embed url to be something like: `https://embedded.powerbi.com/reports/5dac7a4a-4452-46b3-99f6-a25915e0fe55` - However - - 2. Using embed url: - - `
` - - Now only the latter options (#2) is supported. - -- Embed url attribute changed from `powerbi-embed` to `powerbi-embed-url` -- Component type is specified by attribute `powerbi-type`. Use `powerbi-type="report"` instead of applying the attribute `powerbi-report` -- Configuration settings attributes all start with prefix `powerbi-settings-`. - -## Changes - -- Fix bug to prevent memory leak of holding references to iframe elements which had been removed from the DOM. -- Detect overwriting container with new component and either throw error or properly cleanup and replace old component based on `config.overwrite` setting. -- Fix bug with prematurely attempting to parse post message data until it is known that it originated from embedded iframe. - -# 1.0.0 (Preview) \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f9a082e4..3e7f6be3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,33 +55,10 @@ 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 bower dependencies: -``` -bower install -``` - -Serve the demo directory: -``` -npm start -``` - -Open the address to view in the browser: -``` -http://127.0.0.1:8080/ -``` - -## Updating the documenatation (For those with push permissions only) +## 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. ``` 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 -``` \ No newline at end of file diff --git a/README.md b/README.md index 4718b909..9fecd37e 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,25 @@ # powerbi-client -JavaScript library for embedding Power BI into your apps. +A client side library for embedding Power BI using JavaScript or TypeScript into your apps. [![Build Status](https://img.shields.io/travis/Microsoft/PowerBI-JavaScript/master.svg)](https://travis-ci.org/Microsoft/PowerBI-JavaScript) [![NPM Version](https://img.shields.io/npm/v/powerbi-client.svg)](https://www.npmjs.com/package/powerbi-client) -[![Bower Version](https://img.shields.io/bower/v/powerbi-client.svg)](https://bower.io/search/?q=powerbi-client) [![Nuget Version](https://img.shields.io/nuget/v/Microsoft.PowerBI.JavaScript.svg)](https://www.nuget.org/packages/Microsoft.PowerBI.JavaScript/) [![NPM Total Downloads](https://img.shields.io/npm/dt/powerbi-client.svg)](https://www.npmjs.com/package/powerbi-client) [![NPM Monthly Downloads](https://img.shields.io/npm/dm/powerbi-client.svg)](https://www.npmjs.com/package/powerbi-client) [![GitHub tag](https://img.shields.io/github/tag/microsoft/powerbi-javascript.svg)](https://github.com/Microsoft/PowerBI-JavaScript/tags) [![Gitter](https://img.shields.io/gitter/room/Microsoft/PowerBI-JavaScript.svg)](https://gitter.im/Microsoft/PowerBI-JavaScript) -## Wiki -See the [wiki](https://github.com/Microsoft/PowerBI-JavaScript/wiki) for more details about embedding, service configuration, setting default page, page navigation, dynamically applying filters, and more. +## 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. ## Code Docs -See the [code docs](https://microsoft.github.io/PowerBI-JavaScript) for detailed information about classes, interfaces, types, etc. +See the [code docs](https://learn.microsoft.com/en-us/javascript/api/powerbi/powerbi-client) for detailed information about classes, interfaces, types, etc. -## Demo -New [live demo](https://microsoft.github.io/PowerBI-JavaScript/demo) for sample application using the powerbi-client library in scenarios such as page navigation, applying filters, updating settings, and more. +## 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 +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 @@ -29,29 +31,31 @@ Install from NPM: `npm install --save powerbi-client` -Install from Bower: - -`bower install powerbi-client --save` - Installing beta versions: `npm install --save powerbi-client@beta` ## Include the library via import or manually -Ideally you would use module loader or compilation step to import using ES6 modules as: +Ideally you would use a module loader or a compilation step to import using ES6 modules as: ```javascript import * as pbi from 'powerbi-client'; ``` -However, the library is exported as a Universal Module and the powerbi.js script can be included before your apps closing `` tag as: +However, the library is exported as a Universal Module and the powerbi.js script can be included before your app's closing `` tag as: ```html - + ``` -When included directly the library is exposd as a global named 'powerbi-client'. -There is also another global `powerbi` which is an instance of the service. +When included directly, the library is exposed as a global named `powerbi-client`. +There is also another global named `powerbi` which is an instance of the service. + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . +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 \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..12fbd833 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). + + \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index c6414984..00000000 --- a/bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "powerbi-client", - "description": "", - "main": "./dist/powerbi.js", - "authors": [ - "Microsoft" - ], - "license": "MIT", - "moduleType": [], - "homepage": "https://dev.powerbi.com/", - "private": false, - "ignore": [ - "**/.*", - "*/.js", - "*/.md", - "*/.nuspec", - "demo", - "node_modules", - "bower_components", - "src", - "test", - "tests", - "tsconfig.json", - "typings.json", - "webpack.test.tsconfig.json" - ], - "devDependencies": { - "jquery": "~2.2.0" - } -} 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 37760719..00000000 --- a/demo/code-demo/log_window.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
Log Viewer
-
- - -
-