diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/embedDetails.json b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/embedDetails.json index e7582537..6aa177a4 100644 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/embedDetails.json +++ b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/embedDetails.json @@ -1,22 +1,22 @@ { - "Serverurl": "http://localhost:12345/bi/site/site1", - "RootUrl": "http://localhost:12345/bi", - "SiteIdentifier": "site/site1", + "Serverurl": "please provide the server url here.", + "RootUrl": "please provide the root url here.", + "SiteIdentifier": "please provide the valid site identifier here.", "UserDetails": [ { - "Email": "demouser1@gmail.com", - "DisplayName": "John Doe" + "Email": "ab@gmail.com", + "DisplayName": "AB" }, { - "Email": "demouser2@gmail.com", - "DisplayName": "Brito" + "Email": "abc@gmail.com", + "DisplayName": "ABC" } ], - "AdminEmail": "admin@gmail.com", - "EmbedSecret": "DTJnwRnlQLcWuhV8EIBjlXxWAH93NfBK", - "Environment": "onpremise", - "BaseUrl": "https://localhost:44390", - "DatasourceName": "Test data", + "AdminEmail": "please provide the admin email value here.", + "EmbedSecret": "please provide the valid embed secret value here.", + "Environment": "please provide the environment value here.", + "BaseUrl": "please provide the base url value here.", + "DatasourceName": "please provide the datasource name value here.", "WidgetDetails": [ { "name": "PivotGrid", diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/userDetails.json b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/userDetails.json deleted file mode 100644 index 35130d30..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/default/userDetails.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Users": [ - { - "DisplayName": "Applicant 1", - "Email": "applicant11@gmail.com" - }, - { - "DisplayName": "Applicant 2", - "Email": "applicant22@gmail.com" - } - ] -} diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/Samples.xml b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/Samples.xml deleted file mode 100644 index 770785f5..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/Samples.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - 1021 - Summer Olympics - Rendering Event | Title - This demo sample illustrates event related to dashboard and widget rendering. - /Samples/Default/Dashboard/index.html - /Sports/2016 Summer Olympics Dashboard - 1 - None - - - 1022 - London Olympics - Rendering Event | Title 2 - This demo sample illustrates event related to dashboard and widget rendering. - /Samples/Default/Dashboard/index.html - /Sports/London Olympics 2012 medals analysis - 1 - None - - - 1023 - FIFA World Cup - Rendering Event | Title 3 - This demo sample illustrates event related to dashboard and widget rendering. - /Samples/Default/Dashboard/index.html - /Sports/FIFA World Cup 2014 - Brazil - 1 - None - - - - - - 1 - Dashboard - Embedding dashboards - None - fa-tachometer-alt - /Samples/Default/Dashboard/index.html - /Sales/Tickets Sold Analysis Dashboard - Bold BI | Dashboard - false - - - 2 - Metric - Embedding dashboards - None - fa-chart-line - /Samples/Default/Metric/index.html - /Pharmaceutical/Pharma Sales Performance Dashboard - Bold BI | Metric - - - 3 - About - Embedding dashboards - None - fa-info-circle - /Samples/Default/About/index.html - /Pharmaceutical/Pharma Sales Performance Dashboard - Bold BI | About - - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/embedDetails.json b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/embedDetails.json deleted file mode 100644 index b0071ba6..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/embedDetails.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "EmbedSecret": "v9EKQrXQKR7ToUYwdI4SBuBrftBMOBf", - "Serverurl": "http://localhost/bi/site/site1", - "Email": "mahendranm@syncfusion.com", - "Environment": "on-premise", - "DisplayName": "John Doe", - "BaseUrl": "https://localhost:44390/" -} diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/themes.json b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/themes.json deleted file mode 100644 index 64573fc4..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/themes.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "Header": { - "IsEnabled": true, - "IsFixed": false, - "Theme": "dark" - }, - "SideBar": { - "isEnabled": true, - "isFixed": true, - "Theme": "dark" - }, - "Footer": { - "isEnabled": false, - "isFixed": false - }, - "BrandTitle": "Bold BI Embedded", - "AppLogo": "main_logo.svg" -} diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/userDetails.json b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/userDetails.json deleted file mode 100644 index 35130d30..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/App_Data/test/userDetails.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Users": [ - { - "DisplayName": "Applicant 1", - "Email": "applicant11@gmail.com" - }, - { - "DisplayName": "Applicant 2", - "Email": "applicant22@gmail.com" - } - ] -} diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Properties/PublishProfiles/FolderProfile.pubxml.user b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Properties/PublishProfiles/FolderProfile.pubxml.user deleted file mode 100644 index 96850acd..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Properties/PublishProfiles/FolderProfile.pubxml.user +++ /dev/null @@ -1,12 +0,0 @@ - - - - - <_PublishTargetUrl>D:\SprintTask(Adhoc)\330799(adhoc-poc-widget)\EmbededShell\EmbeddedbiShell\bin\Release\net6.0\publish\ - True|2023-10-19T10:52:16.3926752Z;True|2023-10-19T16:21:53.1432793+05:30;True|2023-10-19T15:37:57.2650103+05:30;True|2023-10-19T15:23:12.0280418+05:30; - - - \ No newline at end of file diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/SampleCoreApp.csproj.user b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/SampleCoreApp.csproj.user deleted file mode 100644 index b6aeb458..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/SampleCoreApp.csproj.user +++ /dev/null @@ -1,10 +0,0 @@ - - - - ProjectDebugger - - - SampleCoreApp - D:\SprintTask%28Adhoc%29\330799%28adhoc-poc-widget%29\EmbededShell\EmbeddedbiShell\Properties\PublishProfiles\FolderProfile.pubxml - - \ No newline at end of file diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/About.cshtml b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/About.cshtml deleted file mode 100644 index 3674e37a..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/About.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@{ - ViewData["Title"] = "About"; -} -

@ViewData["Title"]

-

@ViewData["Message"]

- -

Use this area to provide additional information.

diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/Contact.cshtml b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/Contact.cshtml deleted file mode 100644 index a11a1867..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/Contact.cshtml +++ /dev/null @@ -1,17 +0,0 @@ -@{ - ViewData["Title"] = "Contact"; -} -

@ViewData["Title"]

-

@ViewData["Message"]

- -
- One Microsoft Way
- Redmond, WA 98052-6399
- P: - 425.555.0100 -
- -
- Support: Support@example.com
- Marketing: Marketing@example.com -
diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/Privacy.cshtml b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/Privacy.cshtml deleted file mode 100644 index 7bd38619..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Home/Privacy.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -

@ViewData["Title"]

- -

Use this page to detail your site's privacy policy.

diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_SidebarTreeView.cshtml b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_SidebarTreeView.cshtml index f6b3746d..f1a7a15c 100644 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_SidebarTreeView.cshtml +++ b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_SidebarTreeView.cshtml @@ -161,26 +161,6 @@ } - - } diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_ValidationScriptsPartial.cshtml b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_ValidationScriptsPartial.cshtml deleted file mode 100644 index 2a9241f5..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/Views/Shared/_ValidationScriptsPartial.cshtml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/About/index.html b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/About/index.html deleted file mode 100644 index db65fca8..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/About/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - -
-
-
-
-
-
About this sample
-
- This sample browser illustrates, how to integrate the dashboard and widget into your Sample browser. You could able to load each widgets from the dashboard by selection. -
-
More links
- - -
Samples
-
- Embedded SDK is a JavaScript library that enables you to embed your BoldBI dashboards in your applications which may be ASP.NET MVC application, ASP.NET Core application, Angular, and React application. Fore more please check below links. -
- -
-
-
-
-
- - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/About/properties.css b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/About/properties.css deleted file mode 100644 index f535ff85..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/About/properties.css +++ /dev/null @@ -1,25 +0,0 @@ -.about-heading { - font-weight: 700; - font-size: 16px; - padding: 10px 15px 12px; - color: #485058; - font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; - letter-spacing: .05px; -} - -.about-description { - text-align: justify; - font-size: 13px; - line-height: 24px; - padding-bottom: 15px; - color: #485058; - font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; - letter-spacing: .05px; - padding-left: 15px; -} - -.list-heading { - font-size: 14px; - padding-left: 15px; - font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; -} diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Dashboard/index.html b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Dashboard/index.html deleted file mode 100644 index 5e319073..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Dashboard/index.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - -
-
-
-
-
-
- - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Dashboard/multitab.html b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Dashboard/multitab.html deleted file mode 100644 index bdb0e10f..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Dashboard/multitab.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
- -
- - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/index-multitab.html b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/index-multitab.html deleted file mode 100644 index be298d38..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/index-multitab.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - FilteringDemo - - - - - - - - - - - - - - - - - -
-
- - - -
- -
- -
- - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/index.html b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/index.html deleted file mode 100644 index 5ac0b663..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/index.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - FilteringDemo - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
-
- - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/properties.css b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/properties.css deleted file mode 100644 index 3ea930db..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/properties.css +++ /dev/null @@ -1,194 +0,0 @@ -.e-dashboardviewer .e-prop-header { - width: 100%; - height: 40px; - line-height: 40px; - padding-left: 25px; - padding-top: 15px; -} - -.e-dbrd-control-header { - display:none; -} - -#widget-header { - padding-left: 10px; - font-size: 21px; - padding-top: 5px; -} - -#sample_dashboard_embeddedbi_designSurfaceContainer { - background:#fff !important; -} - -#sample_dashboard_embeddedbi_designAreaContainer{ - border-width: 0px 0px !important; -} - -#parent-list li { - margin: 0px 0px 10px 0px; -} - -#parent-list li a { - color: #aba7a6; - text-decoration: none; - background-color: transparent; -} - -#parent-list li a:hover { - color: #000; - text-decoration: none; - background-color: transparent; -} - -#parent-list li.active a { - color: #000; - text-decoration: none; - background-color: transparent; -} - -.viewer .e-dbrd-control-container { - box-shadow: 0 0px 0px 0 rgba(0,0,0,.07) !important; -} - -/*body #parent-list li a { - color: #000; - text-decoration: none; - background-color: transparent; -} - -body #parent-list li a:hover, #parent-list li.active a { - color: #007bff !important; -}*/ -.e-dashboardviewer .e-prop-header p { - color: #1b1e24; - font-family: 'Roboto'; - font-size: 12px; - font-weight: bold; - font-style: normal; - padding-left: 10px; -} - -.e-dashboardviewer .e-prop-div { - padding-top: 20px; - padding-left: 20px; - font-family: 'Roboto'; - margin: 5px; -} - -.e-dashboardviewer .e-prop-item { - padding: 5px; - font-size:12px; - font-weight:normal; - padding-top:8px; - padding-bottom: 5px; -} -.e-dashboardviewer .e-prop-text { - width: 50%; - height: 25px; - margin-left: 5px; - margin-right: 4px; -} -.e-dashboardviewer .e-prop-textbox { - width: 100%; - height: 30px; - border-radius: 3px; - font-size: 12px; - color: #333; - padding-left: 10px; - text-overflow: ellipsis; - border: 1px solid #c8c8c8; -} -.e-dashboardviewer .eventLog { - color: #807F7F; - height: 150px; - margin: 0 0 10px; - overflow: auto; - padding: 10px 0; - text-align: left; - word-wrap: break-word; -} - -.e-dashboardviewer .e-hidden { - pointer-events : none; - opacity: 0.5; -} - -.e-dashboardviewer .e-show { - pointer-events : auto; - opacity: 1; -} - -.e-dashboardviewer .e-clear-btn { - margin-left: 40%; -} - -.e-dashboardviewer .e-label { - padding-left: 6px; - font-weight:normal; -} - -.e-dashboardviewer .e-event { - margin-top: 25px; -} - -.e-dashboardviewer .e-prop-radio { - float: left; - padding: 15px; -} - -.e-dashboardviewer .e-ddl .e-input, .e-ddl .e-input[readonly] { - font-weight:normal; - font-size: 12px; - font-family: inherit; - font-style: normal; -} - -.e-dashboardviewer .e-prop-div .e-chkbox-wrap .e-icon.e-checkmark:before { - color: #3899fc; - margin-top: 2px; - margin-left: 1px; -} - -.e-dashboardviewer .e-prop-div .e-apply-btn, .e-prop-div .e-apply-btn:hover { - margin-top: 20px; - background-color: rgb(59, 153, 252); - color: rgb(255, 255, 255); - width: 100%!important; -} - -.e-dashboardviewer .e-prop-div .e-prop-item e-label { - user-select: none; -} - - -#widgetCollectionDropDown_popup_wrapper .e-ddl-popup li { - height: 25px; - text-overflow: ellipsis; - white-space: nowrap; - overflow-x: auto; -} -.e-ddl.e-widget .e-in-wrap{ - border-radius: 3px; -} -.e-ddl .e-in-wrap, .e-ddl-popup, .e-ddl .e-options, .e-ddl-popup .e-atc.e-search { - border-color: #c8c8c8; -} -.e-in-wrap { - display: block; - height: 100%; - position: relative; - overflow: hidden; - border: 1px solid; -} -#widgetCollectionDropDown_dropdown.e-select{ - padding-top: 8px !important; background: none repeat scroll 0 0 #fff; -} -.e-dashboardviewer .e-prop-div .e-btn.e-select:not(.e-disable):hover{ - background: #0DACFC; - color:white; -} -.e-dashboardviewer .e-prop-div .e-drp-btn.e-select, .e-dbrd-control .e-prop-div .e-btn.e-select .e-icon, .e-dashboardviewer .e-prop-div .e-btn.e-select.e-disable:hover, .e-dbrd-control .e-prop-div .e-btn.e-select.e-disable:hover .e-ico{ - color:white; - background:rgb(59, 153, 252); - -} \ No newline at end of file diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/properties.js b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/properties.js deleted file mode 100644 index a6646a91..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Metric/properties.js +++ /dev/null @@ -1,82 +0,0 @@ -var sample = { localization: [] }; // eslint-disable-line no-undef -var isFristRquest=true; -sample.localization["en-US"] = { - Properties: "Properties", - SelectWidget: "Select Metric", - EnableWidgetMode: "Enable Widget Mode", - Apply: "Apply", - DashboardID: "Dashboard ID", - DashboardPath: "Dashboard Path" -}; -var dashboardViewerObj, enableWidgetMode = false, dashboard = { id: "", name: "", path: "" }; -var locale = null; - -function initializeTemplate() { - var action_list_ul = document.getElementById('parent-list'); - action_list_ul.addEventListener("click", selectWidget, false); - isFristRquest=false; - var dataSources=[]; - dataSources.push({ id: "2c7939af-29a5-42d7-b623-879bb57210e4", text: "Financial Sales", path:"/Sales/Financial Sales"}); - dataSources.push({ id: "ad5d8322-4290-4a61-9054-cb9869e009d3", text: "HR Recruitment Dashboard", path:"/Human Resources/HR Recruitment Dashboard"}); - dataSources.push({ id: "420db458-38ad-4d13-a29f-7f810448f487", text: "Personal Expense Analysis", path:"/Predictive Analytics/Personal Expense Analysis"}); - dataSources.push({ id: "96e3de16-bae2-4a43-8983-435dbde38012", text: "Property Management Dashboard", path:"/Property Management/Property Management Dashboard"}); - dataSources.push({ id: "b499af7a-79e7-4ff3-9614-0cb6f4f9116d", text: "Workforce Performance Dashboard", path:"/Human Resources/Workforce Performance Dashboard"}); - $("#widgetCollectionDropDown").ejDropDownList({ - dataSource: dataSources, - fields: { text: "text", value: "id"}, - change: "selectWidget", - cssClass: "e-dbrd-canvas", - width: "100%", - watermarkText: "Select Dashboard" - }); - - $("#applyBtn").ejButton({ - showRoundedCorner: true, - height: "25px", - click: "onApply", - enabled:false, - - }); - $("#widgetCollectionDropDown_popup_wrapper").addClass("e-dbrd-cntrl-combobox e-dbrd-control"); -} - -//view -function getPropertiesTemplate() { - locale = sample.localization["en-US"]; - var properties = '

' + locale.SelectWidget + '

' + - - '
' + - - ' '+ - - '
'; - return properties; -} - -//events -function selectWidget(e) { - var widgetValue = e.target.innerHTML; - $('#parent-list li').removeClass('active'); - $(e.target.parentElement).addClass("active"); - var fieldNameElement = document.getElementById('widget-header'); - fieldNameElement.innerHTML = e.target.innerHTML; - renderWidget(widgetValue); -} - -function onApply() { - renderWidget(dashboard.path); -} - -function setWidgetModeSettings() { - var instance = BoldBI.getInstance("sample_dashboard"); - instance.loadDashboardWidget(widgetDetails.name); -} - - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/index.html b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/index.html deleted file mode 100644 index b1a7f66b..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/index.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - Bold BI | Reports - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- -
- - - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/properties.css b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/properties.css deleted file mode 100644 index 442f8997..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/properties.css +++ /dev/null @@ -1,138 +0,0 @@ -.e-dashboardviewer .e-prop-header { - width: 100%; - height: 40px; - line-height: 40px; - border-bottom: .5px solid #c4ced7; -} -.e-dashboardviewer .e-prop-header p { - color: #1b1e24; - font-family: 'Roboto'; - font-size: 12px; - font-weight: bold; - font-style: normal; - padding-left: 10px; -} - -.e-dashboardviewer .e-prop-div { - padding-top: 10px; - font-family: 'Roboto'; - margin:5px; -} - -.e-dashboardviewer .e-prop-item { - padding: 5px; - font-size:12px; - font-weight:normal; - padding-top:8px; - padding-bottom: 5px; -} -.e-dashboardviewer .e-prop-text { - width: 50%; - height: 25px; - margin-left: 5px; - margin-right: 4px; -} -.e-dashboardviewer .e-prop-textbox { - width: 100%; - height: 30px; - border-radius: 3px; - font-size: 12px; - color: #333; - padding-left: 10px; - text-overflow: ellipsis; - border: 1px solid #c8c8c8; -} -.e-dashboardviewer .eventLog { - color: #807F7F; - height: 150px; - margin: 0 0 10px; - overflow: auto; - padding: 10px 0; - text-align: left; - word-wrap: break-word; -} - -.e-dashboardviewer .e-hidden { - pointer-events : none; - opacity: 0.5; -} - -.e-dashboardviewer .e-show { - pointer-events : auto; - opacity: 1; -} - -.e-dashboardviewer .e-clear-btn { - margin-left: 40%; -} - -.e-dashboardviewer .e-label { - padding-left: 6px; - font-weight:normal; -} - -.e-dashboardviewer .e-event { - margin-top: 25px; -} - -.e-dashboardviewer .e-prop-radio { - float: left; - padding: 15px; -} - -.e-dashboardviewer .e-ddl .e-input, .e-ddl .e-input[readonly] { - font-weight:normal; - font-size: 12px; - font-family: inherit; - font-style: normal; -} - -.e-dashboardviewer .e-prop-div .e-chkbox-wrap .e-icon.e-checkmark:before { - color: #3899fc; - margin-top: 2px; - margin-left: 1px; -} - -.e-dashboardviewer .e-prop-div .e-apply-btn, .e-prop-div .e-apply-btn:hover { - margin-top: 20px; - background-color: rgb(59, 153, 252); - color: rgb(255, 255, 255); - width: 100%!important; -} - -.e-dashboardviewer .e-prop-div .e-prop-item e-label { - user-select: none; -} - - -#widgetCollectionDropDown_popup_wrapper .e-ddl-popup li { - height: 25px; - text-overflow: ellipsis; - white-space: nowrap; - overflow-x: auto; -} -.e-ddl.e-widget .e-in-wrap{ - border-radius: 3px; -} -.e-ddl .e-in-wrap, .e-ddl-popup, .e-ddl .e-options, .e-ddl-popup .e-atc.e-search { - border-color: #c8c8c8; -} -.e-in-wrap { - display: block; - height: 100%; - position: relative; - overflow: hidden; - border: 1px solid; -} -#widgetCollectionDropDown_dropdown.e-select{ - padding-top: 8px !important; background: none repeat scroll 0 0 #fff; -} -.e-dashboardviewer .e-prop-div .e-btn.e-select:not(.e-disable):hover{ - background: #0DACFC; - color:white; -} -.e-dashboardviewer .e-prop-div .e-drp-btn.e-select, .e-dbrd-control .e-prop-div .e-btn.e-select .e-icon, .e-dashboardviewer .e-prop-div .e-btn.e-select.e-disable:hover, .e-dbrd-control .e-prop-div .e-btn.e-select.e-disable:hover .e-ico{ - color:white; - background:rgb(59, 153, 252); - -} \ No newline at end of file diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/properties.js b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/properties.js deleted file mode 100644 index f249c238..00000000 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/Samples/default/Reports/properties.js +++ /dev/null @@ -1,78 +0,0 @@ -var sample = { localization: [] }; // eslint-disable-line no-undef -var isFristRquest=true; -sample.localization["en-US"] = { - Properties: "Properties", - SelectWidget: "Select Dashboard", - EnableWidgetMode: "Enable Widget Mode", - Apply: "Apply", - DashboardID: "Dashboard ID", - DashboardPath: "Dashboard Path" -}; -var dashboardViewerObj, enableWidgetMode = false, dashboard = { id: "", name: "", path: "" }; -var locale = null; - -function initializeTemplate() { - isFristRquest=false; - var dataSources=[]; - dataSources.push({ id: "2c7939af-29a5-42d7-b623-879bb57210e4", text: "Financial Sales", path:"/Sales/Financial Sales"}); - dataSources.push({ id: "ad5d8322-4290-4a61-9054-cb9869e009d3", text: "HR Recruitment Dashboard", path:"/Human Resources/HR Recruitment Dashboard"}); - dataSources.push({ id: "420db458-38ad-4d13-a29f-7f810448f487", text: "Personal Expense Analysis", path:"/Predictive Analytics/Personal Expense Analysis"}); - dataSources.push({ id: "96e3de16-bae2-4a43-8983-435dbde38012", text: "Property Management Dashboard", path:"/Property Management/Property Management Dashboard"}); - dataSources.push({ id: "b499af7a-79e7-4ff3-9614-0cb6f4f9116d", text: "Workforce Performance Dashboard", path:"/Human Resources/Workforce Performance Dashboard"}); - $("#widgetCollectionDropDown").ejDropDownList({ - dataSource: dataSources, - fields: { text: "text", value: "id"}, - change: "selectWidget", - cssClass: "e-dbrd-canvas", - width: "100%", - watermarkText: "Select Dashboard" - }); - - $("#applyBtn").ejButton({ - showRoundedCorner: true, - height: "25px", - click: "onApply", - enabled:false, - - }); - $("#widgetCollectionDropDown_popup_wrapper").addClass("e-dbrd-cntrl-combobox e-dbrd-control"); -} - -//view -function getPropertiesTemplate() { - locale = sample.localization["en-US"]; - var properties = '

' + locale.Properties + '

' + - - '
' + - - - '
' + - '
' + - - '
' + - '
' + - - '
' + - '
' + - - '
' + - - '
'; - return properties; -} - -//events -function selectWidget(e) { - var obj = e.model.dataSource[e.model.selectedIndex]; - dashboard.id = obj.id; - dashboard.name = obj.text; - dashboard.path = obj.path; - $("#dashboardIdBox").val(dashboard.id); - $("#dashboardPathBox").val(dashboard.path); - $("#applyBtn").data("ejButton").enable(); -} - -function onApply() { - renderDashboard(dashboard.path); -} - diff --git a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/js/EmbedBIWrapper.js b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/js/EmbedBIWrapper.js index 0cf6f105..1172e193 100644 --- a/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/js/EmbedBIWrapper.js +++ b/Scenario Based Samples/Add Analysis Widget sample/EmbededShell/EmbeddedbiShell/wwwroot/js/EmbedBIWrapper.js @@ -1,5299 +1 @@ -let bbEmbed; -let tabInstance; -class BoldBI { - constructor() { - this.loadPinboard = this.Invoke(function () { - if (!this.invalidDetail) { - if (this.embedOptions.pinboardName == '') { - throw new Error('Pinboard name should not be empty'); - } - if (this.embedOptions.mode != BoldBI.Mode.View) { - throw new Error('Cant able to render the Pinboard in design mode'); - } - this.embedOptions.dashboardIds = []; - this.embedOptions.dashboardPaths = []; - if (!this._checkWidgetList()) { - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isWidgetMode = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this.isPinboardRendering = true; - this._showLoader(); - this._isDependencyLoaded(this); - } - else if (this.embedOptions.embedType == BoldBI.EmbedType.IFrame) { - const iframe = document.createElement('iframe'); - iframe.frameBorder = 0; - iframe.width = this.embedOptions.width; - iframe.height = this.embedOptions.height; - iframe.id = this.embedOptions.embedContainerId + '_' + this.embedOptions.dashboardId; - iframe.allowfullscreen = this.embedOptions.dashboardSettings.showFullScreen; - iframe.setAttribute('src', this.embedOptions.serverUrl + '/dashboards/' + this.embedOptions.dashboardId + '?isembed=true'); - document.getElementById(this.embedOptions.embedContainerId).appendChild(iframe); - } - } - } - }); - this.loadDatasource = this.Invoke(function () { - if (!this.invalidDetail) { - if (this.embedOptions.dashboardId || this.embedOptions.dashboardPath) { - this.embedOptions.dashboardId = this.embedOptions.dashboardPath = ''; - } - if (this.embedOptions.pinboardName != '') { - this.embedOptions.pinboardName = ''; - } - if (!this._checkWidgetList()) { - if (this.embedOptions.mode == BoldBI.Mode.DataSource || this.embedOptions.mode == BoldBI.Mode.Connection) { - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isWidgetMode = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this._showLoader(); - this._isDependencyLoaded(this); - } - else if (this.embedOptions.embedType == BoldBI.EmbedType.IFrame) { - const iframe = document.createElement('iframe'); - iframe.frameBorder = 0; - iframe.width = this.embedOptions.width; - iframe.height = this.embedOptions.height; - iframe.id = this.embedOptions.embedContainerId + '_' + this.embedOptions.datasourceId; - iframe.allowfullscreen = this.embedOptions.dashboardSettings.showFullScreen; - iframe.setAttribute('src', this.embedOptions.serverUrl + '/datasource-designer/' + this.embedOptions.datasourceId + '?isembed=true'); - document.getElementById(this.embedOptions.embedContainerId).appendChild(iframe); - } - } - else { - throw new Error('Invalid embed Mode'); - } - } - } - }); - this._initializeUrls = this.Invoke(function () { - if (this.embedOptions.serverUrl.indexOf('/bi') <= 0) { - throw new Error('Invalid Bold BI serverUrl.'); - } - if (this.embedOptions.environment == BoldBI.Environment.Enterprise) { - this.rootUrl = this.embedOptions.serverUrl.substr(0, (this.embedOptions.serverUrl.indexOf('/bi/') >= 0 ? (this.embedOptions.serverUrl.indexOf('/bi/') + 3) : (this.embedOptions.serverUrl.indexOf('/bi') + 3))); - this.baseUrl = this.embedOptions.serverUrl; - this.siteIdentifier = this.embedOptions.serverUrl.indexOf('/site/') >= 0 ? this.embedOptions.serverUrl.substr(this.embedOptions.serverUrl.indexOf('/site/') + 1) : ''; - this.dashboardServerApiUrl = this.rootUrl + '/api' + (this._isEmptyOrSpaces(this.siteIdentifier) ? '' : ('/' + this.siteIdentifier)); - this.designerRootUrl = this.rootUrl + '/designer'; - this.customThemeUrl = this.rootUrl.replace(/\/bi(?!.*\/bi)/, '/ums/theme/styles'); - } - else { - this.rootUrl = this.embedOptions.serverUrl.endsWith('/') ? this.embedOptions.serverUrl.slice(0, -1) : this.embedOptions.serverUrl; - this.baseUrl = this.embedOptions.serverUrl; - this.siteIdentifier = ''; - this.dashboardServerApiUrl = this.rootUrl + '/api'; - } - this.scheduleEndpointUrl = this.baseUrl + '/datasources/recurrence-type-page'; - return true; - }); - this._addJquerydependentFiles = this.Invoke(function () { - if (!this._checkDepedentFileExists(this.jQueryDepedentFile, false) && !(window.jQuery != undefined && window.jQuery().jquery == '1.10.2')) { - const script = document.createElement('script'); - if (this.embedOptions.environment == BoldBI.Environment.Enterprise) { - script.setAttribute('src', this.rootUrl + '/cdn/scripts/designer/' + this.jQueryDepedentFile); - } - else { - script.setAttribute('src', this.cdnLink + '/scripts/designer/' + this.jQueryDepedentFile); - } - if (this.embedOptions.nonce) { - script.nonce = this.embedOptions.nonce; - } - document.head.appendChild(script); - // now wait for it to load... - script.onload = () => { - try { - const scriptTag = document.createElement('script'); - scriptTag.append(this.jqConflictFile); - if (this.embedOptions.nonce) { - scriptTag.nonce = this.embedOptions.nonce; - } - document.head.appendChild(scriptTag); - bbEmbed = window.bbEmbed = window.bb$; - this._addWrapperDependentFiles(this, this.wrapperDependentScriptFiles); - this._loadDepedentFiles(); - } - catch (e) { - this._throwError('server Not Found'); - this.invalidDetail = true; - } - }; - script.onerror = (arg) => this._handleEnvironmentError(arg); - } - else { - // Wait for jQuery to finish loading - const checkjQueryLoaded = setInterval(() => { - if (window.jQuery) { - clearInterval(checkjQueryLoaded); - bbEmbed = window.bbEmbed = window.$; - if (typeof window.bb$ != 'undefined') { - bbEmbed = window.bbEmbed = window.bb$; - } - this._addWrapperDependentFiles(this, this.wrapperDependentScriptFiles); - this._loadDepedentFiles(); - } - }, 1000); - } - }); - this._renderDashboard = this.Invoke(function (responseInfo) { - const that = this; - const parameter = ''; - if (!responseInfo.Status) { - if (responseInfo.errorMessage == 'The page you are looking for was unavailable.') { - responseInfo.Status = false; - responseInfo.Message = responseInfo.errorMessage; - } - if (responseInfo.Message === 'Object reference not set to an instance of an object.') { - if (this.embedOptions.mode === 'view' || this.embedOptions.mode === 'design') { - if (!this._isEmptyOrSpaces(this.embedOptions.dashboardId) || !this._isEmptyOrSpaces(this.embedOptions.dashboardPath)) { - responseInfo.Message = 'Invalid dashboard details.'; - } - if (!this._isEmptyOrSpaces(this.embedOptions.pinboardName)) { - responseInfo.Message = 'Invalid pinboard name.'; - } - } - } - throw new Error(responseInfo.Message); - } - else { - if (Array.isArray(responseInfo.Data) && this._isEmptyOrSpaces(this.embedOptions.dashboardId) && this._isEmptyOrSpaces(this.embedOptions.dashboardPath)) { - for (const item of responseInfo.Data) { - if ('ErrorMessage' in item) { - const errorMsg = `BoldBI Embedded: ${item.ErrorMessage}`; - if (!this._isNullOrUndefined(this.embedOptions.onError) && this.embedOptions.onError !== '') { - const errormessage = new Error(errorMsg); - this.onErrorClient(errormessage); - } - else { - console.error(errorMsg); - } - responseInfo.Data = responseInfo.Data.filter((dataItem) => dataItem !== item); - } - } - if (!responseInfo.Data.length) { - throw new Error('Provided dashboard details are invalid.'); - } - } - const embedResponse = responseInfo.Data; - if (this.embedOptions.pinboardName != '' && this.pinboardIds.length == 0) { - if (embedResponse.ColumnInfo) { - this._renderPinboard(embedResponse); - } - else { - throw new Error('Pinboard Details not found'); - } - } - else if (embedResponse.length) { - if (this.isWidgetMode) { - const ele = document.getElementById(this.embedOptions.embedContainerId); - if (BoldBI._hasinstance(ele, 'embeddedBoldBI')) { - BoldBI._removeinstance(ele, 'embeddedBoldBI'); - } - throw new Error('Cant able to render the widget from Multitab dashboard'); - } - else if (this.embedOptions.mode != BoldBI.Mode.View) { - const ele = document.getElementById(this.embedOptions.embedContainerId); - if (BoldBI._hasinstance(ele, 'embeddedBoldBI')) { - BoldBI._removeinstance(ele, 'embeddedBoldBI'); - } - throw new Error('Cant able to render the Multitab dashboard in design mode'); - } - this._renderMultiTabDashboard(embedResponse); - } - else { - let embedContainerId; - embedResponse.ItemDetail = this.embedOptions.mode != BoldBI.Mode.Connection ? !this.embedOptions.token ? JSON.parse(responseInfo.Data.ItemDetail) : responseInfo.Data.ItemDetail : null; - if (!this.embedOptions.token) { - if (this.embedOptions.mode == BoldBI.Mode.View || (embedResponse.ItemDetail && embedResponse.ItemDetail.IsEnableDefaultView)) { - this.isDefaultView = embedResponse.ItemDetail.IsEnableDefaultView; - if (this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)) { - this.embedOptions.dashboardSettings.filterOverviewSettings = {}; - } - if (embedResponse.ItemDetail.ItemViews) { - this.embedOptions.dashboardSettings.filterOverviewSettings.viewId = embedResponse.ItemDetail.ItemViews[0].ViewId; - this.embedOptions.dashboardSettings.filterOverviewSettings.viewName = embedResponse.ItemDetail.ItemViews[0].ViewName; - this.embedOptions.filterParameters = embedResponse.ItemDetail.ItemViews[0].QueryString; - } - } - if (this.embedOptions.mode == BoldBI.Mode.View) { - this.dashboardUrl = '/dashboard/' + embedResponse.ItemDetail.Id + '/' + embedResponse.ItemDetail.CategoryName + '/' + embedResponse.ItemDetail.Name + '?'; - } - if (this.embedOptions.mode == BoldBI.Mode.View && this.embedOptions.viewId) { - this.embedOptions.dashboardId = embedResponse.ItemDetail.Id; - } - } - this.accessToken = that.embedOptions.token ? that.embedOptions.token : embedResponse.access_token; - let dashboardName = ''; - let childDashboardId; - if (this.pinboardIds.length > 0) { - const id = this.embedOptions.token ? embedResponse.Id : embedResponse.WidgetId; - bbEmbed.map(this.pinboardIds, function (value) { - if (value['widgetId'] == id) { - const instance = that._getDashboardInstance(value['pinboardContainerId'] + '_embeddedbi'); - if (that._isNullOrUndefined(instance)) { - embedContainerId = value['pinboardContainerId']; - } - } - }); - childDashboardId = that.embedOptions.token ? embedResponse.ItemId : ''; - } - else if (this.isMultiTab) { - const Id = this.embedOptions.token ? embedResponse.DashboardId.toString().replaceAll('-', '') : embedResponse.ItemDetail.Id.toString().replaceAll('-', ''); - embedContainerId = 'multi_' + Id; - if (!that._isNullOrUndefined(that.embedOptions.dashboardSettings.dashboardName) && typeof that.embedOptions.dashboardSettings.dashboardName != 'string') { - bbEmbed.map(that.embedOptions.dashboardSettings.dashboardName, function (val) { - if (embedResponse.ItemDetail.Id == val.dashboardId) { - dashboardName = val.dashboardName; - } - }); - } - childDashboardId = that.embedOptions.token ? embedResponse.DashboardId : ''; - } - else { - embedContainerId = this.embedOptions.embedContainerId; - if (!that._isNullOrUndefined(that.embedOptions.dashboardSettings.dashboardName) && typeof that.embedOptions.dashboardSettings.dashboardName == 'string') { - dashboardName = that.embedOptions.dashboardSettings.dashboardName; - } - } - const height = this.pinboardIds.length > 0 ? bbEmbed('#' + embedContainerId).height() : this.isMultiTab ? (this.embedOptions.height.indexOf('%') > 0 ? (this.embedOptions.height.includes('calc') ? 'calc(100% - 36px)' : 'calc(' + this.embedOptions.height + ' - 36px)') : (parseInt(this.embedOptions.height, 10) - 36 + 'px')) : this.embedOptions.height; - if (typeof (responseInfo.Data.UserDetail) != 'undefined') { - embedResponse.UserDetail = JSON.parse(responseInfo.Data.UserDetail); - } - if (this.embedOptions.mode == BoldBI.Mode.Connection) { - bbEmbed('').appendTo('head'); - } - this._onBoldBIAuthorizionComplete(embedResponse); - if (this.embedOptions.widgetList == '') { - document.getElementById(embedContainerId).style.height = height; - document.getElementById(embedContainerId).style.width = (this.embedOptions.pinboardName != '' ? document.getElementById(embedContainerId).style.width : (!this.isMultiTab ? this.embedOptions.width : '100%')); - } - if ((this.embedOptions.mode == BoldBI.Mode.View) && (!this.embedOptions.authorizationServer.url) && (!this.embedOptions.authorizationServer.data) && !this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)) { - this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveIcon = false; - this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveAsIcon = false; - } - if (this.embedOptions.mode == BoldBI.Mode.Design && !this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings)) { - this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveIcon = false; - this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveAsIcon = false; - this.embedOptions.dashboardSettings.filterOverviewSettings.showViewSavedFilterIcon = false; - } - let dashboardOptions; - const fontFamilyUrl = this.embedOptions.environment === BoldBI.Environment.Enterprise ? this.rootUrl.replace(/\/bi(?!.*\/bi)/, '/ums/user-interface/fonts') + '?family=' + this.embedOptions.dashboardSettings.fontFamily : `${this.rootUrl + '/user-interface/fonts?family=' + this.embedOptions.dashboardSettings.fontFamily}`; - // eslint-disable-next-line - dashboardOptions = { - siteUrl: this.baseUrl, - serviceUrl: this.designerRootUrl, - dataServiceUrl: this.designerRootUrl, - serverUrl: this.dashboardServerApiUrl, - viewerSettings: { - serviceUrl: this.designerRootUrl + '/v1.0/design' - }, - nonce: this.embedOptions.nonce, - localeSettings: { - culture: this.embedOptions.localeSettings.culture, - dateFormat: this._isEmptyOrSpaces(this.embedOptions.localeSettings.dateFormat) ? 'M/d/yyyy' : this.embedOptions.localeSettings.dateFormat, - timeFormat: this._isEmptyOrSpaces(this.embedOptions.localeSettings.timeFormat) ? 'h:mm:ss tt' : this.embedOptions.localeSettings.timeFormat - }, - mode: this.embedOptions.mode, - environment: this.embedOptions.environment, - IsEmbed: true, - _isPublic: this.embedOptions.mode != BoldBI.Mode.Connection ? (this._isNullOrUndefined(embedResponse.ItemDetail)) ? '' : embedResponse.ItemDetail.IsPublic : '', - itemId: this.embedOptions.mode != BoldBI.Mode.Connection ? (this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? embedResponse.ItemDetail.Id : childDashboardId ? childDashboardId : this.embedOptions.dashboardId : '', - dashboardPath: (this.embedOptions.mode == BoldBI.Mode.DataSource || this.embedOptions.mode == BoldBI.Mode.Connection) ? '' : (this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? embedResponse.ItemDetail.ItemLocation : childDashboardId ? childDashboardId + '/1' : this.embedOptions.dashboardId + '/1', - serviceAuthorizationToken: !(this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? this.embedOptions.token : embedResponse.access_token, - dashboardName: (this.embedOptions.mode == BoldBI.Mode.DataSource || this.embedOptions.mode == BoldBI.Mode.Connection) ? '' : (this._isNullOrUndefined(embedResponse.ItemDetail)) ? '' : this._isEmptyOrSpaces(dashboardName) ? embedResponse.ItemDetail.Name : dashboardName, - dashboardDescription: (this.embedOptions.mode == BoldBI.Mode.DataSource || this.embedOptions.mode == BoldBI.Mode.Connection) ? '' : (this._isNullOrUndefined(embedResponse.ItemDetail)) ? '' : embedResponse.ItemDetail.Description, - theme: this._isEmptyOrSpaces(this.multiTabTheme) ? this.embedOptions.theme : this.multiTabTheme, - enableTheme: this.embedOptions.dashboardSettings.enableTheme === undefined ? false : this.embedOptions.dashboardSettings.enableTheme, - enableFilterOverview: this.embedOptions.dashboardSettings.enableFilterOverview, - isPinWidget: this.pinboardIds.length > 0, - layoutSetting: this.embedOptions.layoutSettings, - export: { - Image: this.embedOptions.exportSettings.showImage, - Excel: this.embedOptions.exportSettings.showExcel, - Pdf: this.embedOptions.exportSettings.showPDF, - CustomFontFamilyUrl: this.embedOptions.dashboardSettings.fontFamily ? fontFamilyUrl : '', - IsDefaultFont: false - }, - dashboardExportMenuSettings: { - showCSV: this.embedOptions.exportSettings.showCSV, - showExcel: this.embedOptions.exportSettings.showExcel, - showImage: this.embedOptions.exportSettings.showImage, - showPDF: this.embedOptions.exportSettings.showPDF - }, - widgetExportMenuSettings: { - showCSV: this.embedOptions.exportSettings.showCSV, - showExcel: this.embedOptions.exportSettings.showExcel, - showImage: this.embedOptions.exportSettings.showImage, - showPDF: this.embedOptions.exportSettings.showPDF - }, - filterParameters: parameter + (this._isEmptyOrSpaces(this.embedOptions.filterParameters) ? '' : '&') + ((this.isMultiTab && window['multiTabFilterParameter']) ? window['multiTabFilterParameter'] : this.embedOptions.filterParameters), - designCanvasSettings: this.embedOptions.designCanvasSettings, - widgetContainerSettings: this.embedOptions.widgetContainerSettings, - viewDataSettings: { - checkShowAllColumns: this._isNullOrUndefined(this.embedOptions.dashboardSettings.viewDataSettings) ? false : this.embedOptions.dashboardSettings.viewDataSettings.showAllColumns - }, - viewDataActions: { - allowExporting: this._isNullOrUndefined(this.embedOptions.dashboardSettings.viewDataSettings) ? true : this.embedOptions.dashboardSettings.viewDataSettings.enableExporting, - allowColumnSelection: this._isNullOrUndefined(this.embedOptions.dashboardSettings.viewDataSettings) ? true : this.embedOptions.dashboardSettings.viewDataSettings.enableColumnSelection - }, - dashboardThemeSettings: { - appearance: !this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings) ? (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings.appearance) ? this.embedOptions.dashboardSettings.themeSettings.appearance : 'light') : 'light', - applicationTheme: !this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings) ? (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings.application) ? this.embedOptions.dashboardSettings.themeSettings.application : null) : null, - dashboardTheme: !this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings) ? (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.themeSettings.dashboard) ? this.embedOptions.dashboardSettings.themeSettings.dashboard : (this.embedOptions.dashboardSettings.themeSettings.isLocalTheme ? 'boldBITheme' : null)) : null - }, - filterOverviewSettings: { - showSaveIcon: this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings) ? false : this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveIcon, - showSaveAsIcon: this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings) ? false : this.embedOptions.dashboardSettings.filterOverviewSettings.showSaveAsIcon, - showViewSavedFilterIcon: this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings) ? false : this.embedOptions.dashboardSettings.filterOverviewSettings.showViewSavedFilterIcon, - viewId: !this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings) ? this._isEmptyOrSpaces(this.embedOptions.dashboardSettings.filterOverviewSettings.viewId) ? null : this.embedOptions.dashboardSettings.filterOverviewSettings.viewId : null, - viewName: !this._isNullOrUndefined(this.embedOptions.dashboardSettings.filterOverviewSettings) ? this._isEmptyOrSpaces(this.embedOptions.dashboardSettings.filterOverviewSettings.viewName) ? null : this.embedOptions.dashboardSettings.filterOverviewSettings.viewName : null - }, - widgets: this._getWidgetFilterInfo(), - actionComplete: function (arg) { - that._onBoldBIDashboardInstaceActionComplete(arg); - }, - beforeBannerIconRender: function (arg) { - that._onBoldBIDashboardBeforeBannerIconRender(arg); - }, - beforeOtherOptionContextMenuRender: function (arg) { - that._onBoldBIDashboardBeforeOtherOptionContextMenuRender(arg); - }, - _onSaveFilter: function (arg) { - that._onBoldBIDashboardSaveFilter(arg); - }, - _onSaveAsFilter: function (arg) { - that._onBoldBIDashboardSaveAsFilter(arg); - }, - _onViewSavedFilters: function (arg) { - that._onBoldBIDashboardOpenViewSection(arg); - }, - onBannerIconClick: function (arg) { - that._onBoldBIDashboardBannerIconClick(arg); - }, - beforeWidgetIconRendered: function (arg) { - that._onBoldBIDashboardBeforeWidgetIconRendered(arg); - }, - onWidgetIconClick: function (arg) { - that._onBoldBIDashboardWidgetIconClick(arg); - }, - _onFavoriteStateChange: function (arg) { - that._onBoldBIDashboardUpdatefavorite(arg); - }, - beforeNavigateUrlLinking: function (arg) { - that._onBoldBIBeforeNavigateUrlLinking(arg); - }, - beforeControlMenuOpen: function (arg) { - that._onBoldBIBeforeControlMenuOpen(arg); - }, - beforeDashboardMobileMenuOpen: function (arg) { - that._onBoldBIBeforeDashboardMobileMenuOpen(arg); - }, - ajaxBeforeLoad: function (arg) { - that._onBoldBIAjaxBeforeLoad(arg); - }, - beforeDesignerToolbarButtonsRendered: function (arg) { - that._onBoldBIbeforeDesignerToolbarButtonsRendered(arg); - }, - onControlMenuClick: function (arg) { - that._onBoldBIonControlMenuClick(arg); - }, - beforeDatasourceToolbarButtonsRendered: function (arg) { - that._onBoldBIbeforeDatasourceToolbarButtonsRendered(arg); - }, - beforeDatasourceToolbarIconsRendered: function (arg) { - that._onBoldBIbeforeDatasourceToolbarIconsRendered(arg); - }, - beforeDesignerToolbarIconsRendered: function (arg) { - that._onBoldBIbeforeDesignerToolbarIconsRendered(arg); - }, - toolbarClick: function (arg) { - that._onBoldBItoolbarClick(arg); - }, - beforeWidgetItemsListed: function (arg) { - that._onBoldBIbeforeWidgetItemsListed(arg); - } - }; - if (this.embedOptions.widgetList == '') { - dashboardOptions.actionBegin = function (arg) { - that._onBoldBIDashboardInstaceActionBegin(arg, embedContainerId); - }; - } - if (this.embedOptions.mode == BoldBI.Mode.Design) { - if ((this.embedOptions.token && !this.embedOptions.dashboardId) || (!this.embedOptions.token && embedResponse.ItemDetail.IsDraft)) { - dashboardOptions.dashboardPath = ''; - } - const datasourceId = !this._isEmptyOrSpaces(embedResponse.DatasourceId) ? embedResponse.DatasourceId : ''; - if (!this._isEmptyOrSpaces(datasourceId)) { - dashboardOptions.datasource = datasourceId; - } - if (this.embedOptions.datasources.length > 0) { - dashboardOptions.datasources = this.embedOptions.datasources; - } - dashboardOptions.disableAutoRecover = this.embedOptions.disableAutoRecover; - dashboardOptions.schedule = { - endPoint: this.scheduleEndpointUrl, - summaryText: '' - }; - dashboardOptions.serverSettings = { - isAdmin: typeof (embedResponse.IsAdmin) == 'undefined' ? false : embedResponse.IsAdmin - }; - dashboardOptions.intermediateDbStatus = embedResponse.IntermediateDbStatus; - dashboardOptions.connectionList = embedResponse.ConnectionList; - dashboardOptions.isAllowUserToCreateDatasource = embedResponse.CanCreateDatasource; - dashboardOptions.enablePublicDashboardSetting = false; - dashboardOptions.beforeNavigateToDashboard = function (arg) { - that._onBoldBIBeforeNavigateToDashboard(arg); - }; - dashboardOptions.toolbarSettings = { - showToolbar: this.embedOptions.toolbarSettings.showToolbar - }; - dashboardOptions.predefinedWidgets = this.embedOptions.preConfiguredWidgets; - if (this.embedOptions.environment == BoldBI.Environment.Enterprise) { - dashboardOptions.configuration = this.rootUrl + '/webdesignerservice/scripts/settings/' + embedResponse.Branding + '/settings.min.js'; - } - else { - dashboardOptions.configuration = this.cdnLink + '/scripts/settings/' + embedResponse.Branding + '/settings.min.js'; - } - dashboardOptions.designerSettings = { - widgetsPanel: { - hideExistingWidgets: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? false : this.embedOptions.dashboardSettings.widgetsPanel.hideExistingWidgets, - hideDefaultWidgets: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? false : this.embedOptions.dashboardSettings.widgetsPanel.hideDefaultWidgets, - defaultPanelDisplayText: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? '' : this.embedOptions.dashboardSettings.widgetsPanel.defaultPanelDisplayText, - existingPanelDisplayText: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? '' : this.embedOptions.dashboardSettings.widgetsPanel.existingPanelDisplayText, - defaultPanelSearchPlaceholder: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? '' : this.embedOptions.dashboardSettings.widgetsPanel.defaultPanelSearchPlaceholder, - existingPanelSearchPlaceholder: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? '' : this.embedOptions.dashboardSettings.widgetsPanel.existingPanelSearchPlaceholder, - existingDashboards: this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) ? [] : this.embedOptions.dashboardSettings.widgetsPanel.existingDashboards, - dragAndDropSettings: { - rowSpan: (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) && !this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings)) ? this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings.rowSpan : null, - columnSpan: (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) && !this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings)) ? this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings.columnSpan : null, - isWidgetMode: (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel) && !this._isNullOrUndefined(this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings)) ? this.embedOptions.dashboardSettings.widgetsPanel.dragAndDropSettings.isWidgetMode : false - } - }, - dataSourceConfig: { - hideDataSourceConfig: this._isNullOrUndefined(this.embedOptions.dashboardSettings.dataSourceConfig) ? false : this.embedOptions.dashboardSettings.dataSourceConfig.hideDataSourceConfig - } - }; - dashboardOptions.userSettings = { - hidePreviewAs: this._isNullOrUndefined(this.embedOptions.dashboardSettings.showPreviewAs) ? false : !this.embedOptions.dashboardSettings.showPreviewAs - }; - } - if (this.embedOptions.mode == BoldBI.Mode.Connection) { - dashboardOptions.connectionList = embedResponse.ConnectionList; - } - if (this.embedOptions.mode == BoldBI.Mode.DataSource) { - dashboardOptions.itemId = (this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? embedResponse.ItemDetail.Id : this.embedOptions.datasourceId; - dashboardOptions.datasourceName = (this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? embedResponse.ItemDetail.Name : this.embedOptions.datasourceName; - dashboardOptions.datasource = (this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? embedResponse.ItemDetail.Id : this.embedOptions.datasourceId; - } - this.isMultipleWidgetMode = (this.embedOptions.widgetList == '') ? false : this.isMultipleWidgetMode; - if (this.isWidgetMode) { - dashboardOptions.isPinWidget = this.isWidgetMode; - dashboardOptions.widgetId = (this._isNullOrUndefined(this.embedOptions.token) || this._isEmptyOrSpaces(this.embedOptions.token)) ? embedResponse.WidgetId : this.widgetName; - } - if (this.embedOptions.dashboardSettings.showHeader == false) { - dashboardOptions.isHideHeader = true; - } - else { - dashboardOptions.isHideHeader = false; - } - if (this.isMultiTab) { - dashboardOptions.dashboardSettings = { - parentId: this.parentDbrdId, - isMultiTab: this.parentId == null || this.parentId === '' ? false : true - }; - } - if (this.embedOptions.dynamicConnection.isEnabled) { - dashboardOptions.customIdentity = this.embedOptions.dynamicConnection.identity; - } - if (this.embedOptions.autoRefreshSettings.enabled) { - dashboardOptions.enableAutoRefresh = true; - dashboardOptions.autoRefreshSettings = { - intervalSettings: { - mode: 'Hourly', - hourlySchedule: { - hours: this.embedOptions.autoRefreshSettings.hourlySchedule.hours, - minutes: this.embedOptions.autoRefreshSettings.hourlySchedule.minutes, - seconds: this.embedOptions.autoRefreshSettings.hourlySchedule.seconds - } - } - }; - } - if (window.bbEmbed instanceof Function) { - if (this.isMultipleWidgetMode == false) { - let embedContainer = window.bbEmbed.call(that, '#' + (that.pinboardIds.length > 0 ? (embedContainerId + '_embeddedbi') : that.childContainer.id)); - let embedChildId; - if (embedContainer.length === 0) { - embedContainer = window.bbEmbed.call(that, '#' + embedContainerId + '_embeddedbi'); - embedChildId = embedContainerId + '_embeddedbi'; - } - if (window.BoldBIDashboardDesigner instanceof Function) { - const existingDashboardInstance = this._getDashboardInstance(embedChildId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.model = Object.assign(existingDashboardInstance.model, dashboardOptions); - existingDashboardInstance.redrawDashboard(); - } - else { - window.BoldBIDashboardDesigner.call(that, embedContainer, dashboardOptions); - } - } - else { - this._throwError('BoldBIDashboardDesigner is not defined'); - } - } - else { - const thatIns = this; - bbEmbed.ajax({ - type: 'POST', - url: dashboardOptions.serviceUrl + '/v1.0/dashboard/preloaddashboard/' + embedResponse.ItemDetail.ItemLocation, - beforeSend: function (xhr) { - xhr.setRequestHeader('Authorization', 'bearer ' + responseInfo.Data.access_token); - xhr.setRequestHeader('Caller', dashboardOptions.serverUrl); - }, - success: function (result) { - if (result.ApiStatus) { - dashboardOptions.isPreLoaded = true; - const widgetIdList = JSON.parse(responseInfo.Data.WidgetList); - const multipleWidgetsList = thatIns.embedOptions.widgetList; - multipleWidgetsList.forEach(function (widgetInfo) { - const boldBIMulObj = new BoldBI(); - dashboardOptions.widgetId = widgetIdList[widgetInfo.widgetName.toLowerCase()]; - const embedWidgetContainerId = widgetInfo.containerId; - dashboardOptions.actionBegin = function (arg) { - that._onBoldBIDashboardInstaceActionBegin(arg, embedWidgetContainerId); - }; - document.getElementById(embedWidgetContainerId).style.height = height; - document.getElementById(embedWidgetContainerId).style.width = !this.isMultiTab ? this.embedOptions.width : '100%'; - const embedContainer = window.bbEmbed.call(that, '#' + (embedWidgetContainerId + '_embeddedbi')); - const embedChildId = embedWidgetContainerId + '_embeddedbi'; - boldBIMulObj.childContainer = embedContainer[0]; - boldBIMulObj.childContainer.id = embedWidgetContainerId + '_embeddedbi'; - boldBIMulObj.embedOptions = thatIns.embedOptions; - boldBIMulObj._initializeUrls(); - boldBIMulObj.isMultipleWidgetMode = true; - boldBIMulObj.isWidgetMode = true; - const ele = document.getElementById(embedWidgetContainerId); - if (BoldBI._hasinstance(ele, 'embeddedBoldBI')) { - BoldBI._removeinstance(ele, 'embeddedBoldBI'); - } - const retObj = Object.assign(boldBIMulObj); - BoldBI._putinstance(ele, 'embeddedBoldBI', retObj); - if (window.BoldBIDashboardDesigner instanceof Function) { - const existingDashboardInstance = that._getDashboardInstance(embedChildId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.model = Object.assign(existingDashboardInstance.model, dashboardOptions); - existingDashboardInstance.redrawDashboard(); - } - else { - window.BoldBIDashboardDesigner.call(that, embedContainer, dashboardOptions); - } - } - else { - this._throwError('BoldBIDashboardDesigner is not defined'); - } - this._removeElementsClass(embedWidgetContainerId, '.preloader-wrap', 'viewer-blue-loader'); - }.bind(thatIns)); - } - }, - error: function () { - that._throwError('Error while downloading the dashboards' + this.embedOptions.dashboardId); - } - }); - } - } - else { - throw new Error('bbEmbed is not defined'); - } - if (this.embedOptions.widgetList == '') { - this._removeElementsClass(embedContainerId, '.preloader-wrap', 'viewer-blue-loader'); - } - if (this.isMultiTab && !this.embedOptions.token && embedResponse.ItemDetail.ItemViews) { - this.embedOptions.dashboardSettings.filterOverviewSettings.viewId = this.embedOptions.dashboardSettings.filterOverviewSettings.viewName = this.embedOptions.filterParameters = null; - } - } - } - }); - this._changeLayoutSuccess = this.Invoke(function (result) { - if (result.Status && this.homepageItemId != '' && this.isVirtualHomepage) { - this.afterVirtualHomepageSave(this.homepageItemId); - } - else if (!result.Status) { - throw new Error('Change layout failure due to' + result.Message); - } - }); - this._createPinboardDom = this.Invoke(function (itemDetail) { - const that = this; - bbEmbed('#widget-container').attr('data-homepage-id', itemDetail.Id).attr('data-current-layout', itemDetail.ColumnInfo.Layout).attr('data-item-type', itemDetail.ItemType).attr('data-virtual-homepage', itemDetail.IsVirtualHomepage); - if (itemDetail.ItemType.toLowerCase() == 'widget') { - const column = itemDetail.ColumnInfo.Column; - bbEmbed.each(column, function (i) { - bbEmbed('#widget-container').append(''); - if (column[`${i}`].Item.length > 0) { - bbEmbed.each(column[`${i}`].Item, function (j) { - const item = column[`${i}`].Item[`${j}`].Id == null ? '/bi/' + that.siteIdentifier + '/widgets/widgets' : '/bi/' + that.siteIdentifier + '/dashboards'; - const itemName = column[`${i}`].Item[`${j}`].Name; - const widgetType = column[`${i}`].Item[`${j}`].WidgetType; - let height = 0; - if (widgetType != null && (widgetType.includes('Card') || widgetType.includes('Image'))) { - height = 250; - } - else { - height = 400; - } - const queryString = column[`${i}`].Item[`${j}`].QueryString != null ? column[`${i}`].Item[`${j}`].QueryString : ''; - const href = column[`${i}`].Item[`${j}`].TabId == null ? (item + '/' + column[`${i}`].Item[`${j}`].ItemId + '/' + (column[`${i}`].Item[`${j}`].Id != null ? (column[`${i}`].Item[`${j}`].CategoryName + '/') : '') + column[`${i}`].Item[`${j}`].ItemName + (queryString != '' ? '?' + queryString : queryString)) : (item + '/' + column[`${i}`].Item[`${j}`].ItemId + '/' + (column[`${i}`].Item[`${j}`].Id != null ? (column[`${i}`].Item[`${j}`].CategoryName + '/') : '') + column[`${i}`].Item[`${j}`].ItemName + '?tab=' + column[`${i}`].Item[`${j}`].TabId + (queryString != '' ? '&' + queryString : queryString)); - const styleAttr = j != 0 ? 'style="width:100%;height:100%;"' : ''; - if (column[`${i}`].Item[`${j}`].ItemExtension.toLowerCase() != '.sydj') { - bbEmbed('#column-' + (i + 1)).append('
  • '); - } - else { - const deleteIconDiv = that.embedOptions.pinboardSettings.enableUnpinWidget || that.embedOptions.pinboardSettings.enableUnpinWidget === undefined ? '
    ' : ''; - bbEmbed('#column-' + (i + 1)).append('
  • ' + itemName + '
    ' + deleteIconDiv + '
  • '); - } - }); - } - else { - bbEmbed('#column-' + (i + 1)).append('
  • Drag your widgets here to customize layout
  • '); - } - }); - const listItems = bbEmbed('li.list-item a'); - for (let t = 0; t < listItems.length; t++) { - bbEmbed('li.list-item a').eq(t).attr('href', bbEmbed('li.list-item a').eq(t).attr('data-url')); - } - } - else if (itemDetail.ItemType.toLowerCase() == 'dashboard') { - bbEmbed('#add-item, #layout-container, #divider').hide(); - bbEmbed('#widget-container').append(''); - } - }); - this._dragAndDropSuccess = this.Invoke(function (result) { - if (!result.Status) { - throw new Error('Drag and drop failure due to' + result.Message); - } - }); - this._renderMultiTabDashboard = this.Invoke(function (embedResponse) { - this.isMultiTab = true; - const that = this; - const embedContainer = bbEmbed('#' + that.embedOptions.embedContainerId); - embedContainer.html(''); - const containerName = that.embedOptions.embedContainerId + '_multi_tab_dashboard'; - const multiTabContainer = bbEmbed('
    '); - embedContainer.append(multiTabContainer); - const tabHeader = bbEmbed('
    '); - const tabContent = bbEmbed('
    '); - bbEmbed.map(embedResponse, function (value) { - let dashboardItemDetail = {}; - if (that.embedOptions.token) { - dashboardItemDetail.Id = value.DashboardId; - dashboardItemDetail.Name = value.DashboardName; - } - else { - dashboardItemDetail = JSON.parse(value.ItemDetail); - } - that.parentDbrdId = that.embedOptions.token ? that.embedOptions.dashboardId : value.parentId; - const dashboardId = dashboardItemDetail.Id.replaceAll('-', ''); - that.dashboardDetails[`${dashboardId}`] = value; - if (!that._isNullOrUndefined(that.embedOptions.dashboardSettings.dashboardName) && typeof that.embedOptions.dashboardSettings.dashboardName != 'string') { - bbEmbed.map(that.embedOptions.dashboardSettings.dashboardName, function (val) { - dashboardItemDetail.Name = (dashboardId == val.dashboardId.replaceAll('-', '')) ? that._isEmptyOrSpaces(val.dashboardName) ? dashboardItemDetail.Name : val.dashboardName : dashboardItemDetail.Name; - }); - } - tabHeader.append(bbEmbed('
    ' + dashboardItemDetail.Name + '
    ')); - const multitabDbrdEle = bbEmbed('
    '); - tabContent.append(bbEmbed('
    ').append(multitabDbrdEle.append('
    '))); - }); - multiTabContainer.append(tabHeader).append(tabContent); - tabInstance = new ejdashboard.navigations.Tab({ - enableAnimation: false, - selected: bbEmbed.proxy(this._tabSelected, this) - }); - tabInstance.appendTo('#' + containerName); - bbEmbed('.e-tab-header .e-toolbar-item .e-tab-text').css({ 'display': 'inline-block', 'width': '150px', 'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'color': '#000', 'font-family': 'var(--font-family)', 'text-transform': 'none' }); - bbEmbed('').appendTo('head'); - bbEmbed('.e-control.e-tab .e-tab-header .e-indicator').addClass('embed-multi-tab-indicator'); - bbEmbed.map(bbEmbed('.e-tab-header .e-toolbar-item .e-tab-text'), function (value, index) { - bbEmbed(value).attr('title', bbEmbed(value).text()); - bbEmbed(bbEmbed('.e-content').find('#e-content-multi_tab_dashboard_' + index).children()).css({ 'height': '100%', 'width': '100%', 'overflow': 'hidden', 'display': 'block', 'position': 'absolute', 'left': bbEmbed('.e-content.e-lib.e-touch').width() * index }); - }); - bbEmbed('.multitab-dbrd .e-content').attr('style', 'height: 100% !important'); - bbEmbed.map(bbEmbed('.multitab-dbrd .e-content').children(), function (value) { - bbEmbed(value).css({ 'height': '100%' }); - }); - bbEmbed(embedContainer).css({ 'overflow-x': 'hidden', 'overflow-y': 'hidden', 'width': that.embedOptions.width }); - bbEmbed('#' + containerName).css({ 'width': bbEmbed('.e-content.e-lib.e-touch').width(), 'height': this.embedOptions.height }); - bbEmbed('.e-tab-header')[0].ej2_instances[0].refreshOverflow(); - tabInstance.resizeContext(); - bbEmbed.map(embedResponse, function (value, index) { - if (index == 0) { - const response = { - Apistatus: true, - Data: value, - Status: true - }; - that._renderDashboard(response); - } - }); - }); - this._getAuthorizationToken = this.Invoke(function (dashboardId) { - const that = this; - const embedDbrdId = dashboardId ? dashboardId : this.embedOptions.dashboardId; - const embedDbrdIds = this.embedOptions.dashboardIds.join(','); - const embedDbrbPaths = this.embedOptions.dashboardPaths.join(','); - let embedQuerString = 'embed_nonce=' + this._uuidv4Generartor() + - '&embed_dashboard_id=' + embedDbrdId + - '&embed_dashboard_ids=' + embedDbrdIds + - '&embed_dashboard_path=' + this.embedOptions.dashboardPath + - '&embed_dashboard_paths=' + embedDbrbPaths + - '&pinboard_name=' + (this.pinBoardRendered ? this.embedOptions.pinboardName : '') + - '&embed_mode=' + this.embedOptions.mode + - '&embed_timestamp=' + Math.round((new Date()).getTime() / 1000) + - '&embed_expirationtime=' + this.embedOptions.expirationTime; - if (this.embedOptions.viewId) { - embedQuerString = embedQuerString + - '&embed_dashboardview_id=' + this.embedOptions.viewId; - } - else if (this.embedOptions.viewName) { - embedQuerString = embedQuerString + '&embed_dashboardview_name=' + this.embedOptions.viewName; - } - if (this.isWidgetMode) { - if (this.isMultipleWidgetMode == false) { - embedQuerString = embedQuerString + - '&embed_widget_isenabled=' + this.isWidgetMode + - '&embed_widget_name=' + this.widgetName; - } - else { - const multipleWidgetList = []; - this.embedOptions.widgetList.forEach(function (widgetDetails) { - multipleWidgetList.push(widgetDetails.widgetName.toLowerCase()); - }); - embedQuerString = embedQuerString + - '&embed_widget_isenabled=' + this.isWidgetMode + - '&embed_widget_list=' + multipleWidgetList; - } - } - if (this.isMultiTab) { - embedQuerString = embedQuerString + - '&isMultiTab=' + this.isMultiTab; - } - if (!this._isEmptyOrSpaces(this.embedOptions.datasourceId)) { - embedQuerString = embedQuerString + - '&embed_datasource_id=' + this.embedOptions.datasourceId; - } - else if (!this._isEmptyOrSpaces(this.embedOptions.datasourceName)) { - embedQuerString = embedQuerString + - '&embed_datasource_name=' + this.embedOptions.datasourceName; - } - const data = { - embedQuerString: encodeURI(embedQuerString), - dashboardServerApiUrl: this.dashboardServerApiUrl - }; - if (this.embedOptions.authorizationServer.url != '') { - this._xhrRequestHelper('POST', this.embedOptions.authorizationServer.url, data, this.embedOptions.authorizationServer.headers, this._renderDashboard); - } - else if (!(this._isNullOrUndefined(this.embedOptions.authorizationServer.data)) && this.embedOptions.authorizationServer.data != '' && this.embedOptions.authorizationServer.url == '') { - this._renderDashboard(this.embedOptions.authorizationServer.data); - } - else if ((this.embedOptions.authorizationServer.url == '' || this.embedOptions.authorizationServer.data == '') && this.embedOptions.mode == BoldBI.Mode.View && this._isEmptyOrSpaces(this.embedOptions.pinboardName) && (this.embedOptions.dashboardId || this.embedOptions.dashboardPath || this.embedOptions.dashboardIds || this.embedOptions.dashboardPaths)) { - bbEmbed.ajax({ - async: true, - type: 'POST', - url: this.dashboardServerApiUrl + this.embedAuthorizeEndPoint, - data: JSON.stringify(embedQuerString), - contentType: 'application/json', - success: bbEmbed.proxy(that._renderDashboard, that) - }); - } - else { - throw new Error('Access has been denied due to the AuthorizationServer is missing in the BoldBI.Create().'); - } - this.pinBoardRendered = true; - }); - this._validateOptions = this.Invoke(function (options) { - this.embedOptions.embedContainer = options.embedContainerId; - if (!this._isNullOrUndefined(options.onError)) { - this.embedOptions.onError = options.onError; - } - if (this._isEmptyOrSpaces(options.embedContainerId) && this._isNullOrUndefined(options.widgetList)) { - this.invalidDetail = true; - throw new Error('Please provide the valid Embed container Id'); - } - if (this._isEmptyOrSpaces(options.serverUrl)) { - this.invalidDetail = true; - throw new Error('Server URL cannot be empty'); - } - if (!this._isUrl(options.serverUrl)) { - this.invalidDetail = true; - throw new Error('Please provide a valid Server URL'); - } - if (!this._isEmptyOrSpaces(options.pinboardName)) { - return true; - } - if (options.mode == BoldBI.Mode.Connection) { - return true; - } - if (options.dashboardPath || (options.dashboardPaths && options.mode !== BoldBI.Mode.DataSource)) { - const pathsToValidate = options.dashboardPath ? [options.dashboardPath] : options.dashboardPaths; - pathsToValidate.forEach((path, index) => { - pathsToValidate[Number(index)] = `${path.startsWith('/') ? '' : '/'}${path}`.replace(/\/+$/, ''); - const splitedPath = pathsToValidate[Number(index)].split('/'); - if (splitedPath.length !== 3 || splitedPath[0] !== '' || splitedPath[1] === '' || splitedPath[2] === '') { - throw new Error('Invalid dashboard path: ' + path); - } - }); - if (options.dashboardPath) { - options.dashboardPath = pathsToValidate[0]; - } - else { - options.dashboardPaths = pathsToValidate; - } - } - if (this._isEmptyOrSpaces(options.dashboardId) && (!options.dashboardIds || !options.dashboardIds.length) && (!options.dashboardPaths || !options.dashboardPaths.length) && this._isEmptyOrSpaces(options.dashboardPath) && options.mode !== BoldBI.Mode.Design && this._isEmptyOrSpaces(options.datasourceId) && this._isEmptyOrSpaces(options.datasourceName)) { - if (options.mode != BoldBI.Mode.DataSource) { - if (this._isEmptyOrSpaces(options.pinboardName) && !this._isNullOrUndefined(options.pinboardName)) { - this.invalidDetail = true; - throw new Error('Pinboard name cannot be empty'); - } - else if (this._isEmptyOrSpaces(options.viewId)) { - this.invalidDetail = true; - throw new Error('Dashboard id or path or view id cannot be empty'); - } - } - else { - this.invalidDetail = true; - throw new Error('Datasource id or name cannot be empty'); - } - } - return true; - }); - this.IsDependencyLoaded = false; - this.rootUrl = ''; - this.baseUrl = ''; - this.siteIdentifier = ''; - this.dashboardServerApiUrl = ''; - this.designerRootUrl = ''; - this.customThemeUrl = ''; - this.scheduleEndpointUrl = ''; - this.childContainer = ''; - this.cdnLink = ''; - this.beforeSaveViewDialogOpenFn = 'beforeSaveViewDialogRendered'; - this.beforeSaveAsViewDialogOpenFn = 'beforeSaveAsViewDialogRendered'; - this.onViewSavedFiltersClickFn = 'openViewSection'; - this.onBannerIconClickFn = 'onBannerIconClick'; - this.beforeWidgetIconRenderedFn = 'beforeWidgetIconRendered'; - this.onWidgetIconClickFn = 'onWidgetIconClick'; - this.actionBeginFn = 'onActionBeginOfNewDashboardViewer'; - this.actionCompleteFn = 'onActionCompleteOfNewDashboardViewer'; - this.beforeBannerIconRenderFn = 'beforeBannerIconRender'; - this.beforeOtherRenderFn = 'beforeOtherOptionContextMenuRender'; - this.isWidgetMode = false; - this.isDashboardRendering = false; - this.isPinboardRendering = false; - this.isDashboardViewRendering = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this.errorImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjExNzgwNzk4MzhBOTExRTQ4MDMxRTZEMkIzQUQzNjdCIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjExNzgwNzk5MzhBOTExRTQ4MDMxRTZEMkIzQUQzNjdCIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MTE3ODA3OTYzOEE5MTFFNDgwMzFFNkQyQjNBRDM2N0IiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MTE3ODA3OTczOEE5MTFFNDgwMzFFNkQyQjNBRDM2N0IiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4RB5yjAAABXklEQVR42rRUsU7DQAzNRWxESMydK2XsAhtiQGHo1LmsZYCBMSNDx3wASJQ1zN0rJjZYOlbqDCsSPxCeq5f0anwtSMHSk52L/c4++85VVRW1KXu14ZwLOn2enK1+Hr48B3evE3ONoQhBcgw1AjKgw+V3YAY8gvz1V4QgOoC6B4b0nQML2inQo/0EXIH4K0hIMslAspsCOQKWKvMuVAEMAMkyE9KmF2LUH3AugQoYK5IbgVob07f0eWJ1ZlLmFDveqjM/JRqhj1QxZOxKYs9nRJ0bTdwHEmM9V7EbhNLNuT4zSkLSSGW5ZNMyi7DjddMiTAL/Ft5YrQd7h3z8+aZwaFPLCaX1t3CkjP1Rssxfj3Omb825wFjvctBnFuGEujCyeCC0FCp2TYiy3qBkSAd6sCF9YmOweVtKxv7P1Qs9DnfAxY7HQaq53vo4qEyOoC4Dz9fEL9MkbEviqGX5FmAA1Vq0VgBUvekAAAAASUVORK5CYII='; - this.pinBoardRendered = true; - this.pinboardIds = []; - this.fromColumn = null; - this.toColumn = null; - this.fromPosition = null; - this.toPosition = null; - this.column = null; - this.position = null; - this.isMultiTab = false; - this.parentDbrdId = ''; - this.isNewConnection = false; - this.multiTabTheme = ''; - this.dashboardDetails = {}; - this.pinboardDetails = []; - this.accessToken = ''; - this.homepageItemId = ''; - this.isVirtualHomepage = false; - this.dashboardUrl = ''; - this.commentsArgs = {}; - this._widgetsCollection = []; - this.jQueryDepedentFile = 'jquery-1.10.2.min.js'; - this.jqConflictFile = 'window.bb$ = jQuery.noConflict();'; - this.isFullscreen = false; - this.embedAuthorizeEndPoint = '/embed/authorize'; - this.embedGetDetailsEndPoint = '/embed/get-details'; - this.isMultipleWidgetMode = false; - this.invalidDetail = false; - this.isDefaultView = false; - this.tokenResponse = { - DatasourceId: '', - ConnectionList: '', - ItemDetail: { - IsPublic: false, - Description: '', - Name: '' - } - }; - this.wrapperDependentScriptFiles = [ - 'jquery.easing.1.3.min.js', - 'jquery-ui.min.js', - 'jsrender.min.js' - ]; - this.viewerScriptFiles = [ - 'ej1.web.all.min.js', - 'ej2.web.all.min.js', - 'designerlocalization.js' - ]; - this.pinBoardScriptFiles = [ - 'bootstrap.min.js' - ]; - this.pinboardCssFiles = [ - 'pinboard-embed.min.css' - ]; - this.ejViewerDependentFiles = [ - 'ej.dashboarddesigner.min.js' - ]; - this.ejDesignerDependentFiles = [ - 'codemirror.min.js' - ]; - this.designerScriptFiles = [ - 'ej1.web.all.min.js', - 'ej2.web.all.min.js', - 'designerlocalization.js', - 'signalr.min.js' - ]; - this.cssFiles = [ - 'font-server.min.css', - 'ej1.web.all.min.css', - 'ej2.partone.web.all.min.css', - 'ej2.parttwo.web.all.min.css', - 'ej.designerwidgets.all.min.css', - 'ej.dashboarddesigner.min.css' - ]; - this.designerCssFiles = [ - 'ej.codemirror.min.css' - ]; - this.applicationThemeCssFiles = [ - 'boldbi.theme.definition.min.css', - 'application.theme.css' - ]; - this.dashboardThemeCssFiles = [ - 'dashboard.theme.css' - ]; - this.fontFamilyCssFiles = [ - 'font-family.min.css' - ]; - this.embedOptions = { - serverUrl: '', - dashboardId: '', - dashboardIds: [], - dashboardPath: '', - dashboardPaths: [], - datasourceId: '', - datasourceName: '', - embedContainerId: '', - embedType: BoldBI.EmbedType.Component, - environment: BoldBI.Environment.Enterprise, - mode: BoldBI.Mode.View, - viewId: '', - viewName: '', - nonce: '', - layoutSettings: { - hideDesignerScroller: false - }, - dashboardSettings: { - showHeader: true, - showExport: true, - showRefresh: true, - showMoreOption: true, - onFavoriteIconClick: '', - beforeIconRender: '', - onIconClick: '', - onInteraction: '', - enableTheme: false, - enableFilterOverview: true, - enableFullScreen: false, - showDashboardParameter: true, - dashboardName: '', - beforePublishAs: '', - beforeDesignerToolbarButtons: '', - enableComment: false, - beforeDesignerToolbarIconsRendered: '', - beforeDatasourceToolbarButtonsRendered: '', - beforeDatasourceToolbarIconsRendered: '', - toolbarClick: '', - fontFamily: '', - widgetsPanel: { - hideDefaultWidgets: false, - hideExistingWidgets: false, - defaultPanelDisplayText: '', - existingPanelDisplayText: '', - defaultPanelSearchPlaceholder: '', - existingPanelSearchPlaceholder: '', - existingDashboards: [], - dragAndDropSettings: { - rowSpan: null, - columnSpan: null, - isWidgetMode: false - } - }, - dataSourceConfig: { - hideDataSourceConfig: false - }, - viewDataSettings: { - showAllColumns: false, - enableExporting: true, - enableColumnSelection: true - }, - showPreviewAs: true, - themeSettings: { - appearance: '', - application: '', - dashboard: '', - isLocalTheme: false - }, - filterOverviewSettings: { - showSaveAsIcon: false, - showSaveIcon: false, - showViewSavedFilterIcon: false, - viewId: '', - viewName: '' - }, - saveFilterClick: '', - saveAsFilterClick: '', - viewSavedFiltersClick: '', - beforeSaveViewDialogOpen: '', - beforeSaveAsViewDialogOpen: '', - onViewSavedFiltersClick: '' - }, - widgetSettings: { - showExport: true, - showMaximize: true, - showMoreOption: true, - showFilter: true, - beforeIconRender: '', - onIconClick: '', - beforeWidgetControlMenuOpen: '', - onWidgetControlMenuClick: '', - enableComment: false, - beforeWidgetItemsListed: '' - }, - filterParameters: '', - dynamicConnection: { - isEnabled: false, - identity: '' - }, - exportSettings: { - showExcel: true, - showPDF: true, - showImage: true, - showCSV: true - }, - height: '768px', - width: '1024px', - theme: '', - authorizationServer: { - url: '', - data: '', - headers: {}, - authorizionComplete: '' - }, - token: '', - expirationTime: 86400, - autoRefreshSettings: { - enabled: false, - hourlySchedule: { - hours: 0, - minutes: 0, - seconds: 0 - } - }, - isRemoveStyle: false, - scalingFactor: 1, - localeSettings: { - culture: 'en-US', - dateFormat: 'M/d/yyyy', - timeFormat: 'h:mm:ss tt', - appLocale: 'en-US' - }, - actionBegin: '', - actionComplete: '', - beforeContextMenuRender: '', - beforeNavigateUrlLinking: '', - beforeNavigateToDashboard: '', - beforeFilterApply: '', - afterFilterApply: '', - toolbarSettings: { - showToolbar: true - }, - pinboardName: '', - pinboardSettings: { - enablePinboardHeader: true, - enableUnpinWidget: true - }, - onUnpin: '', - onDrag: '', - onDrop: '', - onLayoutChange: '', - onResize: '', - datasources: [], - designCanvasSettings: { - margin: null - }, - widgetContainerSettings: { - margin: null, - boxShadow: null - }, - beforeDatasourceSave: '', - afterDatasourceSave: '', - preConfiguredWidgets: { - dashboardId: '', - categoryName: '' - }, - disableAutoRecover: false, - ajaxBeforeLoad: '', - isBingMapRequired: false, - widgetList: '' - }; - this.loadDashboard = this.Invoke(function (dashboardId) { - if (!this.invalidDetail) { - if (this.embedOptions.mode != BoldBI.Mode.View) { - throw new Error('Invalid embeded Mode'); - } - if (this.embedOptions.pinboardName != '') { - this.embedOptions.pinboardName = ''; - } - if (dashboardId != undefined) { - this.embedOptions.dashboardId = dashboardId; - } - this.embedOptions.dashboardIds = []; - this.embedOptions.dashboardPaths = []; - if (!this._checkWidgetList()) { - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isDashboardRendering = true; - this.isWidgetMode = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this._showLoader(); - this._isDependencyLoaded(this); - } - else if (this.embedOptions.embedType == BoldBI.EmbedType.IFrame) { - const iframe = document.createElement('iframe'); - iframe.frameBorder = 0; - iframe.width = this.embedOptions.width; - iframe.height = this.embedOptions.height; - iframe.id = this.embedOptions.embedContainerId + '_' + this.embedOptions.dashboardId; - iframe.allowfullscreen = this.embedOptions.dashboardSettings.showFullScreen; - iframe.setAttribute('src', this.embedOptions.serverUrl + '/dashboards/' + this.embedOptions.dashboardId + '?isembed=true'); - document.getElementById(this.embedOptions.embedContainerId).appendChild(iframe); - } - } - } - }); - this.loadMultitabDashboard = this.Invoke(function (dashboardIds) { - if (!this.invalidDetail) { - if (this.embedOptions.mode != BoldBI.Mode.View) { - throw new Error('Invalid embeded Mode'); - } - if (this.embedOptions.pinboardName != '') { - this.embedOptions.pinboardName = ''; - } - if (dashboardIds !== undefined && dashboardIds !== null) { - this.embedOptions.dashboardIds = dashboardIds; - } - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isWidgetMode = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this._showLoader(); - this._isDependencyLoaded(this); - } - } - }); - this.loadView = this.Invoke(function () { - if (!this.invalidDetail) { - if (this.embedOptions.mode != BoldBI.Mode.View) { - throw new Error('Invalid embeded Mode'); - } - if (this.embedOptions.pinboardName != '') { - this.embedOptions.pinboardName = ''; - } - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isDashboardViewRendering = true; - this.isWidgetMode = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this._showLoader(); - this._isDependencyLoaded(this); - } - } - }); - this.loadDashboardWidget = this.Invoke(function (name, dashboardId) { - if (!this.invalidDetail) { - if (this._isEmptyOrSpaces(name)) { - throw new Error('Widget id or name cannot not be empty'); - } - if (this.embedOptions.mode != BoldBI.Mode.View) { - throw new Error('Cant able to render the Widget in design mode'); - } - if (this.embedOptions.pinboardName != '' && this.pinBoardRendered) { - this.embedOptions.pinboardName = ''; - } - this.embedOptions.dashboardIds = []; - this.embedOptions.dashboardPaths = []; - if (!this._checkWidgetList()) { - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isWidgetMode = true; - this.widgetName = name; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this._showLoader(); - this._isDependencyLoaded(this, dashboardId); - } - else if (this.embedOptions.embedType == BoldBI.EmbedType.IFrame) { - const iframe = document.createElement('iframe'); - iframe.frameBorder = 0; - iframe.width = this.embedOptions.width; - iframe.height = this.embedOptions.height; - iframe.id = this.embedOptions.embedContainerId + '_' + this.embedOptions.dashboardId; - iframe.allowfullscreen = this.embedOptions.dashboardSettings.showFullScreen; - iframe.setAttribute('src', this.embedOptions.serverUrl + '/dashboards/' + this.embedOptions.dashboardId + '?isembed=true'); - document.getElementById(this.embedOptions.embedContainerId).appendChild(iframe); - } - } - } - }); - this.loadMultipleWidgets = this.Invoke(function (dashboardId) { - if (!this.invalidDetail) { - if (this.embedOptions.widgetList == '') { - throw new Error('Provide the Widget details with containerID in an array'); - } - if (this.embedOptions.mode != BoldBI.Mode.View) { - throw new Error('Invalid embed mode'); - } - if (this.embedOptions.pinboardName != '') { - this.embedOptions.pinboardName = ''; - } - if (dashboardId != undefined) { - this.embedOptions.dashboardId = dashboardId; - } - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isWidgetMode = true; - this.isMultipleWidgetMode = true; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - const that = this; - const multipleWidgetsList = this.embedOptions.widgetList; - const checkjQueryLoaded = setInterval(() => { - if (window.jQuery) { - clearInterval(checkjQueryLoaded); - multipleWidgetsList.forEach(function (widgetInfo) { - const embedWidgetContainerId = widgetInfo.containerId; - let embedContainer = window.bbEmbed.call(that, '#' + embedWidgetContainerId + '_embeddedbi'); - if (embedContainer.length === 0) { - this.childContainer = document.createElement('div'); - this.childContainer.id = embedWidgetContainerId + '_embeddedbi'; - bbEmbed('#' + embedWidgetContainerId).css({ 'width': bbEmbed('.e-content.e-lib.e-touch').width(), 'height': this.embedOptions.height }); - document.getElementById(embedWidgetContainerId).append(this.childContainer); - embedContainer = window.bbEmbed.call(that, '#' + embedWidgetContainerId + '_embeddedbi'); - } - this._showLoader(embedWidgetContainerId); - }.bind(this)); - this._isDependencyLoaded(this, dashboardId); - } - }, 1000); - } - } - }); - this.loadDesigner = this.Invoke(function (dashboardId) { - if (!this.invalidDetail) { - if (this.embedOptions.mode != BoldBI.Mode.Design) { - throw new Error('Invalid embed Mode'); - } - if (this.embedOptions.pinboardName != '') { - this.embedOptions.pinboardName = ''; - } - if (dashboardId != undefined) { - this.embedOptions.dashboardId = dashboardId; - } - if (!this._checkWidgetList()) { - if (this.embedOptions.embedType == BoldBI.EmbedType.Component) { - this.isDashboardRendering = true; - this.isWidgetMode = false; - this.widgetName = ''; - this.isDashboardViewMode = false; - this.dashboardViewName = ''; - this._showLoader(); - this._isDependencyLoaded(this); - } - else if (this.embedOptions.embedType == BoldBI.EmbedType.IFrame) { - const iframe = document.createElement('iframe'); - iframe.frameBorder = 0; - iframe.width = this.embedOptions.width; - iframe.height = this.embedOptions.height; - iframe.id = this.embedOptions.embedContainerId + '_' + this.embedOptions.dashboardId; - iframe.allowfullscreen = this.embedOptions.dashboardSettings.showFullScreen; - iframe.setAttribute('src', this.embedOptions.serverUrl + '/dashboard-designer/' + this.embedOptions.dashboardId + '?isembed=true'); - document.getElementById(this.embedOptions.embedContainerId).appendChild(iframe); - } - } - } - }); - /** - * @param {string} widgetNames - Define the name of the widget to be Refresh. - * @param {boolean} hideLoader - Define whether to show or hide loading indicator while processing. - * @param {string} dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard. - */ - this.refreshWidgetData = this.Invoke(function (widgetNames, hideLoader, dashboardId) { - if (Array.isArray(widgetNames) == true) { - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - if (bbEmbed(dashboardContainer[`${i}`]).attr('id').includes(dashboardId.toString().replaceAll('-', '')) > 0) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const dbrdInstance = this._getDashboardInstance(embedId); - if (dbrdInstance != undefined) { - dbrdInstance.refreshWidget(widgetNames, hideLoader); - } - break; - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.refreshWidget(widgetNames, hideLoader); - } - } - } - else { - throw new Error('Cannot able to refresh the widget the WigetName should be in array'); - } - }); - this.renderWidgets = this.Invoke(function (widgetslist) { - if (this.embedOptions.mode != BoldBI.Mode.Design) { - this._throwError('The renderWidgets method is supported only for Design Mode.'); - } - const dbrdInstance = this._getDashboardInstance(); - let widgetValue; - if (dbrdInstance != undefined) { - widgetValue = dbrdInstance.renderWidgets(widgetslist); - } - if (widgetValue != undefined) { - this._throwError(widgetValue); - } - }); - this.getSupportedWidgets = this.Invoke(function (clientFnc) { - if (this.embedOptions.mode != BoldBI.Mode.Design) { - this._throwError('The getSupportedWidgets method is only supported for Design Mode.'); - } - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - const widgetsValue = dbrdInstance.getSupportedWidgets(clientFnc); - if (window[`${clientFnc}`] instanceof Function) { - window[`${clientFnc}`].call(this, widgetsValue); - } - else { - clientFnc.call(this, widgetsValue); - } - } - }); - this.addWidgetToPinboard = this.Invoke(function (dashboardId, widgetId, widgetName) { - if (!this._isEmptyOrSpaces(dashboardId) && !this._isEmptyOrSpaces(widgetId) && !this._isEmptyOrSpaces(widgetName)) { - const specialCharsRegex = /^[a-zA-Z0-9!@$^ ()_=\-}{.`~]*$/; - if (!(specialCharsRegex.test(widgetName))) { - throw new Error('Please avoid special characters in widget name'); - } - const homepageItemId = bbEmbed('#widget-container').attr('data-homepage-id'); - const that = this; - const embedQuerString = 'embed_nonce=' + this._uuidv4Generartor() + - '&homepageId=' + homepageItemId + - '&isPinUpdate=' + true + - '&pinWidgetId=' + widgetId + - '&pinDashbooardId=' + dashboardId + - '&pinWidgetName=' + (this._isNullOrUndefined(widgetName) ? null : widgetName) + - '&pinboard_name=' + this.embedOptions.pinboardName + - '&embed_mode=' + this.embedOptions.mode + - '&embed_timestamp=' + Math.round((new Date()).getTime() / 1000) + - '&embed_expirationtime=' + this.embedOptions.expirationTime; - const data = { - embedQuerString: encodeURI(embedQuerString), - dashboardServerApiUrl: this.dashboardServerApiUrl - }; - this._xhrRequestHelper('POST', this.embedOptions.authorizationServer.url, data, this.embedOptions.authorizationServer.headers, function (result) { - if (result.Status) { - that._addWidgetInPinboard(result.Data); - } - else if (!result.Status) { - that._throwError('Cant able to add the widget due to ' + result.Message); - } - }); - } - else if (this._isEmptyOrSpaces(dashboardId) || this._isEmptyOrSpaces(widgetId)) { - throw new Error('Please provide the valid dashboard id and widget id'); - } - else { - throw new Error('Please provide the valid widget name'); - } - }); - this.saveFilterView = this.Invoke(function (viewParameters, callBackFunc) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidDbrd = regex.exec(viewParameters.ItemId); - const isGuidChildDbrd = this.isMultiTab ? regex.exec(viewParameters.ChildItemId) : false; - if ((!this._isEmptyOrSpaces(viewParameters.ViewName)) && (!this._isEmptyOrSpaces(viewParameters.QueryString)) && ((this.isMultiTab && isGuidChildDbrd && isGuidDbrd) || (isGuidDbrd))) { - const that = this; - const data = { - 'ViewName': viewParameters.ViewName, - 'ItemId': viewParameters.ItemId, - 'QueryString': viewParameters.QueryString, - 'IsPublic': false, - 'ChildItemId': this.isMultiTab ? viewParameters.ChildItemId : null, - 'IsDefault': viewParameters.IsDefault ? viewParameters.IsDefault : false - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: this.dashboardServerApiUrl + '/v4.0/dashboards/views', - headers: { - 'Authorization': 'bearer ' + this.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: function (result) { - if (result.Status) { - const view = {}; // Create a new object in each iteration - view['ItemId'] = viewParameters.ItemId; - view['ViewId'] = result.Data; - view['ViewName'] = viewParameters.ViewName; - that._updateInFilterOverviewUI(viewParameters.ViewName, result.Data); - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, view, result.StatusMessage); - } - else { - callBackFunc.call(that, view, result.StatusMessage); - } - } - else { - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, null, result.StatusMessage); - } - else { - callBackFunc.call(that, null, result.StatusMessage); - } - } - }, - error: function (jqXHR) { that.ajaxErrorFnc(jqXHR); } - }); - } - else { - if (!isGuidDbrd) { - throw new Error('Please provide valid dashboard ID.'); - } - if (this.isMultiTab && !isGuidChildDbrd) { - throw new Error('Please provide valid child dashboard ID.'); - } - if (this._isEmptyOrSpaces(viewParameters.ViewName)) { - throw new Error('Please provide valid view name.'); - } - if (this._isEmptyOrSpaces(viewParameters.QueryString)) { - throw new Error('Please provide valid query string.'); - } - } - }); - this.saveAsFilterView = this.Invoke(function (viewParameters, callBackFunc) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidDbrd = regex.exec(viewParameters.ItemId); - const isGuidChildDbrd = this.isMultiTab ? regex.exec(viewParameters.ChildItemId) : false; - if ((!this._isEmptyOrSpaces(viewParameters.ViewName)) && (!this._isEmptyOrSpaces(viewParameters.QueryString)) && ((this.isMultiTab && isGuidChildDbrd && isGuidDbrd) || (isGuidDbrd))) { - const that = this; - const data = { - 'ViewName': viewParameters.ViewName, - 'ItemId': viewParameters.ItemId, - 'QueryString': viewParameters.QueryString, - 'ChildItemId': this.isMultiTab ? viewParameters.ChildItemId : null, - 'IsDefault': viewParameters.IsDefault ? viewParameters.IsDefault : false - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: this.dashboardServerApiUrl + '/v4.0/dashboards/views', - headers: { - 'Authorization': 'bearer ' + this.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: function (result) { - if (result.Status) { - const view = {}; // Create a new object in each iteration - view['ItemId'] = viewParameters.ItemId; - view['ViewId'] = result.Data; - view['ViewName'] = viewParameters.ViewName; - that._updateInFilterOverviewUI(viewParameters.ViewName, result.Data); - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, view, result.StatusMessage); - } - else { - callBackFunc.call(that, view, result.StatusMessage); - } - } - else { - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, null, result.StatusMessage); - } - else { - callBackFunc.call(that, null, result.StatusMessage); - } - } - }, - error: function (jqXHR) { that.ajaxErrorFnc(jqXHR); } - }); - } - else { - if (!isGuidDbrd) { - throw new Error('Please provide valid dashboard ID.'); - } - if (this.isMultiTab && !isGuidChildDbrd) { - throw new Error('Please provide valid child dashboard ID.'); - } - if (this._isEmptyOrSpaces(viewParameters.ViewName)) { - throw new Error('Please provide valid view name.'); - } - if (this._isEmptyOrSpaces(viewParameters.QueryString)) { - throw new Error('Please provide valid query string.'); - } - } - }); - this.updateFilterView = this.Invoke(function (viewParameters, callBackFunc) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidDbrd = regex.exec(viewParameters.DashboardId); - const isGuidView = regex.exec(viewParameters.ViewId); - if (isGuidDbrd && (!this._isEmptyOrSpaces(viewParameters.QueryString)) && isGuidView) { - const that = this; - const data = { - 'ViewId': viewParameters.ViewId, - 'DashboardId': viewParameters.DashboardId, - 'QueryString': viewParameters.QueryString, - 'IsDefault': viewParameters.IsDefault - }; - bbEmbed.ajax({ - async: false, - type: 'PUT', - url: this.dashboardServerApiUrl + '/v4.0/dashboards/views', - headers: { - 'Authorization': 'bearer ' + this.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: function (result) { - if (result.Status) { - const view = {}; // Create a new object in each iteration - view['ViewId'] = viewParameters.ViewId; - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, view, result.StatusMessage); - } - else { - callBackFunc.call(that, view, result.StatusMessage); - } - } - }, - error: function (jqXHR) { that.ajaxErrorFnc(jqXHR); } - }); - } - else { - if (!isGuidDbrd) { - throw new Error('Please provide valid dashboard ID.'); - } - if (!isGuidView) { - throw new Error('Please provide valid view ID.'); - } - if (this._isEmptyOrSpaces(viewParameters.QueryString)) { - throw new Error('Please provide valid query string.'); - } - } - }); - this.getViewsByDashboardId = this.Invoke(function (dashboardId, callBackFunc) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidDbrd = regex.exec(dashboardId); - if (isGuidDbrd) { - const that = this; - const data = { - 'DashboardId': dashboardId - }; - bbEmbed.ajax({ - async: false, - type: 'GET', - url: this.dashboardServerApiUrl + '/v4.0/dashboards/' + dashboardId + '/views', - headers: { - 'Authorization': 'bearer ' + this.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: function (result) { - if (result) { - const viewItems = []; - for (let x = 0; x < result.length; x++) { - const view = {}; // Create a new object in each iteration - view['ItemId'] = result[`${x}`].ItemId; - view['ViewId'] = result[`${x}`].ViewId; - view['ViewName'] = result[`${x}`].ViewName; - view['QueryString'] = result[`${x}`].QueryString; - viewItems.push(view); // Push the new object to the array - } - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, viewItems); - } - else { - callBackFunc.call(that, viewItems); - } - } - else { - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that); - } - else { - callBackFunc.call(that); - } - } - }, - error: function (jqXHR) { that.ajaxErrorFnc(jqXHR); } - }); - } - else { - if (!isGuidDbrd) { - throw new Error('Please provide valid dashboard ID.'); - } - } - }); - this.getViewByViewId = this.Invoke(function (viewId, callBackFunc) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidView = regex.exec(viewId); - if (isGuidView) { - const that = this; - const data = { - 'ViewId': viewId - }; - bbEmbed.ajax({ - async: false, - type: 'GET', - url: this.dashboardServerApiUrl + '/v4.0/dashboards/views/' + viewId, - headers: { - 'Authorization': 'bearer ' + this.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: function (result) { - const view = {}; // Create a new object in each iteration - if (result) { - view['ViewId'] = result.ViewId; - view['ViewName'] = result.ViewName; - view['QueryString'] = result.QueryString; - } - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, view); - } - else { - callBackFunc.call(that, view); - } - }, - error: function (jqXHR) { that.ajaxErrorFnc(jqXHR); } - }); - } - else { - if (!isGuidView) { - throw new Error('Please provide valid view ID.'); - } - } - }); - this.deleteFilterView = this.Invoke(function (viewId, callBackFunc) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidView = regex.exec(viewId); - if (isGuidView) { - const that = this; - const data = { - 'ViewId': viewId - }; - bbEmbed.ajax({ - async: false, - type: 'DELETE', - url: this.dashboardServerApiUrl + '/v4.0/dashboards/views/' + viewId, - headers: { - 'Authorization': 'bearer ' + this.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: function () { - if (window[`${callBackFunc}`] instanceof Function) { - window[`${callBackFunc}`].call(that, viewId); - } - else { - callBackFunc.call(that, viewId); - } - }, - error: function (jqXHR) { that.ajaxErrorFnc(jqXHR); } - }); - } - else { - if (!isGuidView) { - throw new Error('Please provide valid view ID.'); - } - } - }); - } - // Customer exposed functions - static create(options) { - const boldBIObj = new BoldBI(); - boldBIObj.isMultiTab = false; - boldBIObj.parentDbrdId = ''; - boldBIObj.pinboardIds = []; - delete window['multiTabFilterParameter']; - if (document.addEventListener) { - document.addEventListener('webkitfullscreenchange', function () { boldBIObj._fullscreenExitHandler(boldBIObj); }, false); - document.addEventListener('mozfullscreenchange', function () { boldBIObj._fullscreenExitHandler(boldBIObj); }, false); - document.addEventListener('fullscreenchange', function () { boldBIObj._fullscreenExitHandler(boldBIObj); }, false); - document.addEventListener('MSFullscreenChange', function () { boldBIObj._fullscreenExitHandler(boldBIObj); }, false); - window.addEventListener('resize', function () { - if (boldBIObj.isMultiTab) { - boldBIObj.resizeDashboard(''); - } - else if (!boldBIObj._isEmptyOrSpaces(boldBIObj.embedOptions.pinboardName) || !boldBIObj._isNullOrUndefined(boldBIObj.embedOptions.pinboardName)) { - boldBIObj.setListMinimumHeight(); - } - }); - } - if (boldBIObj._validateOptions(options)) { - boldBIObj._initializeEmbedOptions(options); - if (boldBIObj.embedOptions.embedType == BoldBI.EmbedType.Component) { - try { - if (boldBIObj.embedOptions.widgetList == '' || boldBIObj.embedOptions.embedContainerId) { - boldBIObj.childContainer = document.createElement('div'); - boldBIObj.childContainer.id = boldBIObj.embedOptions.embedContainerId + '_embeddedbi'; - const _biInstance = BoldBI._gettinstance(document.getElementById(boldBIObj.embedOptions.embedContainerId), 'embeddedBoldBI'); - if (_biInstance != null || _biInstance != undefined) { - _biInstance.destroy(); - } - document.getElementById(boldBIObj.embedOptions.embedContainerId).innerHTML = ''; - document.getElementById(boldBIObj.embedOptions.embedContainerId).append(boldBIObj.childContainer); - } - if (boldBIObj._initializeUrls()) { - if (!boldBIObj.IsDependencyLoaded) { - if (boldBIObj.embedOptions.environment == BoldBI.Environment.Cloud) { - if (boldBIObj._isEmptyOrSpaces(boldBIObj.cdnLink) || boldBIObj._isEmptyOrSpaces(boldBIObj.designerRootUrl)) { - boldBIObj._getCloudLinks(); - } - } - else { - boldBIObj._addJquerydependentFiles(); - } - } - } - else { - boldBIObj.invalidDetail = true; - const retObj = Object.assign(boldBIObj); - return retObj; - } - } - catch (ex) { - if (ex.message == 'Cannot read property append of null') { - alert('Invalid Embed Container Id'); - return false; - } - else { - boldBIObj._throwError(ex.message, boldBIObj.embedOptions.embedContainerId); - boldBIObj.invalidDetail = true; - const retObj = Object.assign(boldBIObj); - return retObj; - } - } - } - else { - boldBIObj._throwError('Invalid EmbedType', boldBIObj.embedOptions.embedContainerId); - boldBIObj.invalidDetail = true; - const retObj = Object.assign(boldBIObj); - return retObj; - } - if (boldBIObj.embedOptions.widgetList == '') { - const ele = document.getElementById(boldBIObj.embedOptions.embedContainerId); - if (this._hasinstance(ele, 'embeddedBoldBI')) { - this._removeinstance(ele, 'embeddedBoldBI'); - } - } - //const retObj:any = Object.assign({}, boldBIObj) - // eslint-disable-next-line - const retObj = Object.assign(boldBIObj); - if (boldBIObj.embedOptions.widgetList == '') { - const ele = document.getElementById(boldBIObj.embedOptions.embedContainerId); - this._putinstance(ele, 'embeddedBoldBI', retObj); - } - return retObj; - } - boldBIObj._initializeEmbedOptions(options); - boldBIObj.invalidDetail = true; - const retObj = Object.assign(boldBIObj); - return retObj; - } - static getInstance(eleID) { - BoldBI._widgetsCollection = []; - return this._gettinstance(document.getElementById(eleID), 'embeddedBoldBI'); - } - // eslint-disable-next-line - Invoke(originalMethod) { - const that = this; - // eslint-disable-next-line - return function (...args) { - try { - return originalMethod.apply(this, args); - } - catch (error) { - that._throwError(error, this.embedOptions.embedContainer); - } - }.bind(this); - } - destroy() { - const that = this; - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const existingDashboardInstance = this._getDashboardInstance(embedId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.destroy(); - } - } - BoldBI._removeinstance(document.getElementById(this.embedOptions.embedContainerId), 'embeddedBoldBI'); - document.getElementById(this.embedOptions.embedContainerId).innerHTML = ''; - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - bbEmbed('.pinBoardDbrd').each(function () { - const existingDashboardInstance = that._getDashboardInstance(this.id); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.destroy(); - } - }); - BoldBI._removeinstance(document.getElementById(this.embedOptions.embedContainerId), 'embeddedBoldBI'); - document.getElementById(this.embedOptions.embedContainerId).innerHTML = ''; - } - else { - const embedContainerId = this.embedOptions.embedContainerId; - const existingDashboardInstance = this._getDashboardInstance(); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.destroy(); - } - BoldBI._removeinstance(document.getElementById(embedContainerId), 'embeddedBoldBI'); - document.getElementById(embedContainerId).innerHTML = ''; - } - if (this.embedOptions.isRemoveStyle == true) { - document.querySelectorAll('link').forEach(function (node) { - that.cssFiles.forEach(function (file) { - if (node.href.toLowerCase().indexOf(file.toLowerCase()) != -1) { - node.parentNode.removeChild(node); - } - }); - }); - } - } - loadDashboardView() { - throw new Error('loadDashboardView not implemented'); - } - /** - * @param {object} exportInformation - It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard, "fileName" - Define the name of the file to be exported, "pageSize" - Define the size of the page('A3','A4','A5','Letter'), "pageOrientation" - Define the page orientation('Landscape','Portrait'), "showAppliedFilters" - Define whether we need to export the dashboard with or without a filter. - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard - * @param {string} exportInformation.fileName - Define the name of the file to be exported - * @param {string} exportInformation.pageSize - Define the size of the page('A3','A4','A5','Letter'). - * @param {string} exportInformation.pageOrientation - Define the page orientation('Landscape','Portrait'). - * @param {boolean} exportInformation.showAppliedFilters - Define whether we need to export the dashboard with or without a filter. - */ - exportDashboardAsPdf(exportInformation) { - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportAsPdf(exportInformation.fileName, exportInformation.pageSize, exportInformation.pageOrientation, exportInformation.showAppliedFilters); - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - if (exportInformation) { - dbrdInstance.exportAsPdf(exportInformation.fileName, exportInformation.pageSize, exportInformation.pageOrientation, exportInformation.showAppliedFilters); - } - else { - dbrdInstance.exportAsPdf(); - } - } - } - } - /** - * @param {object} exportInformation -It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard, "fileName" - Define the name of the file to be exported, "exportImageFormat" - Define the format of the image to be exported('jpg','png'and'bmp'), "resolutionDpi" - Define the resolution of the image (Integer value above 96),"showAppliedFilters" - Define whether we need to export the dashboard with or without a filter - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard - * @param {string} exportInformation.fileName - Define the name of the file to be exported - * @param {string} exportInformation.exportImageFormat - Define the format of the image to be exported('jpg','png'and'bmp'). - * @param {number} exportInformation.resolutionDpi - Define the resolution of the image (Integer value above 96). - * @param {boolean} exportInformation.showAppliedFilters - Define whether we need to export the dashboard with or without a filter - */ - exportDashboardAsImage(exportInformation) { - if (parseInt(exportInformation.resolutionDpi, 10) > 300) { - exportInformation.resolutionDpi = '300'; - } - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportAsImage(exportInformation.fileName, exportInformation.exportImageFormat, exportInformation.resolutionDpi, exportInformation.showAppliedFilters); - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - if (exportInformation) { - dbrdInstance.exportAsImage(exportInformation.fileName, exportInformation.exportImageFormat, exportInformation.resolutionDpi, exportInformation.showAppliedFilters); - } - else { - dbrdInstance.exportAsImage(); - } - } - } - } - /** - * @param {object} exportInformation - It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard, "fileName" - Define the name of the file to be exported, "fileType" - Define the type of file to be exported ('xlsx','xls'). - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard - * @param {string} exportInformation.fileName - Define the name of the file to be exported - * @param {string} exportInformation.fileType - Define the type of file to be exported ('xlsx','xls'). - */ - exportDashboardAsExcel(exportInformation) { - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportAsExcel(exportInformation.fileName, exportInformation.fileType); - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - if (exportInformation) { - dbrdInstance.exportAsExcel(exportInformation.fileName, exportInformation.fileType); - } - else { - dbrdInstance.exportAsExcel(); - } - } - } - } - /** - * @param {object} exportInformation - It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard, "widgetName" - Define the name of the widget to be exported, "fileName" - Define the name of the file to be exported, "pageSize" - Define the size of the page('A3','A4','A5','Letter'), "pageOrientation" - Define the page orientation('Landscape','Portrait'), "showAppliedFilters" - Define whether we need to export the dashboard with or without a filter. - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard - * @param {string} exportInformation.widgetName - Define the name of the widget to be exported - * @param {string} exportInformation.fileName - Define the name of the file to be exported - * @param {string} exportInformation.pageSize - Define the size of the page('A3','A4','A5','Letter'). - * @param {string} exportInformation.pageOrientation - Define the page orientation('Landscape','Portrait'). - * @param {boolean} exportInformation.showAppliedFilters - Define whether we need to export the dashboard with or without a filter. - */ - exportWidgetAsPdf(exportInformation) { - const that = this; - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsPdf(exportInformation.widgetName, exportInformation.fileName, exportInformation.pageSize, exportInformation.pageOrientation, exportInformation.showAppliedFilters); - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - const length = bbEmbed('.pinBoardDbrd').length; - for (let i = 0; i < length; i++) { - if (that.pinboardIds[`${i}`].widgetId == exportInformation.dashboardId) { - const pinboardId = that.pinboardIds[`${i}`].pinboardContainerId; - const dbrdInstance = that._getDashboardInstance(pinboardId + '_embeddedbi'); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsPdf(exportInformation.widgetName, exportInformation.fileName, exportInformation.pageSize, exportInformation.pageOrientation, exportInformation.showAppliedFilters); - } - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsPdf(exportInformation.widgetName, exportInformation.fileName, exportInformation.pageSize, exportInformation.pageOrientation, exportInformation.showAppliedFilters); - } - } - } - /** - * @param {object} exportInformation - It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard, "widgetName" - Define the name of the widget to be exported, "fileName" - Define the name of the file to be exported, "exportImageFormat" - Define the format of the image to be exported('jpg','png'and'bmp'), "resolutionDpi" - Define the resolution of the image (Integer value above 96), "showAppliedFilters" - Define whether we need to export the dashboard with or without a filter. - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard - * @param {string} exportInformation.widgetName - Define the name of the widget to be exported - * @param {string} exportInformation.fileName - Define the name of the file to be exported - * @param {string} exportInformation.exportImageFormat - Define the format of the image to be exported('jpg','png'and'bmp'). - * @param {number} exportInformation.resolutionDpi - Define the resolution of the image (Integer value above 96). - * @param {boolean} exportInformation.showAppliedFilters - Define whether we need to export the dashboard with or without a filter. - */ - exportWidgetAsImage(exportInformation) { - const that = this; - if (parseInt(exportInformation.resolutionDpi, 10) > 300) { - exportInformation.resolutionDpi = '300'; - } - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsImage(exportInformation.widgetName, exportInformation.fileName, exportInformation.exportImageFormat, exportInformation.resolutionDpi, exportInformation.showAppliedFilters); - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - const length = bbEmbed('.pinBoardDbrd').length; - for (let i = 0; i < length; i++) { - if (that.pinboardIds[`${i}`].widgetId == exportInformation.dashboardId) { - const pinboardId = that.pinboardIds[`${i}`].pinboardContainerId; - const dbrdInstance = that._getDashboardInstance(pinboardId + '_embeddedbi'); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsImage(exportInformation.widgetName, exportInformation.fileName, exportInformation.exportImageFormat, exportInformation.resolutionDpi, exportInformation.showAppliedFilters); - } - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsImage(exportInformation.widgetName, exportInformation.fileName, exportInformation.exportImageFormat, exportInformation.resolutionDpi, exportInformation.showAppliedFilters); - } - } - } - /** - * @param {object} exportInformation - It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard, "widgetName" - Define the name of the widget to be exported, "fileName" - Define the name of the file to be exported, "fileType" - Define the type of file to be exported ('xlsx','xls'). - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard - * @param {string} exportInformation.widgetName - Define the name of the widget to be exported - * @param {string} exportInformation.fileName - Define the name of the file to be exported - * @param {string} exportInformation.fileType - Define the type of file to be exported ('xlsx','xls'). - */ - exportWidgetAsExcel(exportInformation) { - const that = this; - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsExcel(exportInformation.widgetName, exportInformation.fileName, exportInformation.fileType); - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - const length = bbEmbed('.pinBoardDbrd').length; - for (let i = 0; i < length; i++) { - if (that.pinboardIds[`${i}`].widgetId == exportInformation.dashboardId) { - const pinboardId = that.pinboardIds[`${i}`].pinboardContainerId; - const dbrdInstance = that._getDashboardInstance(pinboardId + '_embeddedbi'); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsExcel(exportInformation.widgetName, exportInformation.fileName, exportInformation.fileType); - } - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsExcel(exportInformation.widgetName, exportInformation.fileName, exportInformation.fileType); - } - } - } - /** - * @param {object} exportInformation - It is an object that holds "dashboardId" - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard, "widgetName" - Define the name of the widget to be exported, "fileName" - Define the name of the file to be exported. - * @param {string} exportInformation.dashboardId - Define the unique id of the dashboard if it is present within the multitab dashboard or widget id present in the pinboard - * @param {string} exportInformation.widgetName - Define the name of the widget to be exported - * @param {string} exportInformation.fileName - Define the name of the file to be exported - */ - exportWidgetAsCsv(exportInformation) { - const that = this; - if (this.isMultiTab) { - let dashboardId = exportInformation.dashboardId; - dashboardId = dashboardId.replaceAll('-', ''); - const MultitabDashboardId = 'multi_' + dashboardId + '_embeddedbi'; - const dbrdInstance = this._getDashboardInstance(MultitabDashboardId); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsCsv(exportInformation.widgetName, exportInformation.fileName); - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - const length = bbEmbed('.pinBoardDbrd').length; - for (let i = 0; i < length; i++) { - if (that.pinboardIds[`${i}`].widgetId == exportInformation.dashboardId) { - const pinboardId = that.pinboardIds[`${i}`].pinboardContainerId; - const dbrdInstance = that._getDashboardInstance(pinboardId + '_embeddedbi'); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsCsv(exportInformation.widgetName, exportInformation.fileName); - } - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.exportWidgetAsCsv(exportInformation.widgetName, exportInformation.fileName); - } - } - } - updateDatasource() { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.modules.queryDesigner.saveQueryInfo(); - } - } - updateFilters(filterParameters) { - const that = this; - if (this.isMultiTab) { - window['multiTabFilterParameter'] = filterParameters; - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const existingDashboardInstance = this._getDashboardInstance(embedId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.option('filterParameters', filterParameters); - } - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - bbEmbed('.pinBoardDbrd').each(function () { - const existingDashboardInstance = that._getDashboardInstance(this.id); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.option('filterParameters', filterParameters); - } - }); - } - else { - const existingDashboardInstance = this._getDashboardInstance(); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.option('filterParameters', filterParameters); - } - } - } - resizeDashboard(filterParameters) { - const that = this; - if (this.isMultiTab) { - bbEmbed('#' + that.embedOptions.embedContainerId + '_multi_tab_dashboard').css('width', bbEmbed('#' + that.embedOptions.embedContainerId).width()); - window['multiTabFilterParameter'] = filterParameters; - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const existingDashboardInstance = this._getDashboardInstance(embedId); - if (existingDashboardInstance != undefined) { - const clientFnc = window[that.embedOptions.onResize]; - if (clientFnc instanceof Function) { - clientFnc.call(this, existingDashboardInstance); - } - if (this.embedOptions.onResize instanceof Function) { - this.embedOptions.onResize.call(this, existingDashboardInstance); - } - existingDashboardInstance.resizeDashboard(); - } - } - this._tabSelected(); - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - bbEmbed('.pinBoardDbrd').each(function () { - const existingDashboardInstance = that._getDashboardInstance(this.id); - if (existingDashboardInstance != undefined) { - const clientFnc = window[that.embedOptions.onResize]; - if (clientFnc instanceof Function) { - clientFnc.call(that, existingDashboardInstance); - } - if (that.embedOptions.onResize instanceof Function) { - that.embedOptions.onResize.call(that, existingDashboardInstance); - } - existingDashboardInstance.resizeDashboard(); - } - }); - } - else { - const existingDashboardInstance = this._getDashboardInstance(); - if (existingDashboardInstance != undefined) { - const clientFnc = window[that.embedOptions.onResize]; - if (clientFnc instanceof Function) { - clientFnc.call(this, existingDashboardInstance); - } - if (this.embedOptions.onResize instanceof Function) { - this.embedOptions.onResize.call(this, existingDashboardInstance); - } - existingDashboardInstance.resizeDashboard(); - } - } - } - refreshDashboard() { - const that = this; - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const existingDashboardInstance = this._getDashboardInstance(embedId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.updateDashboard(); - } - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - bbEmbed('.pinBoardDbrd').each(function () { - const existingDashboardInstance = that._getDashboardInstance(this.id); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.updateDashboard(); - } - }); - } - else { - const existingDashboardInstance = this._getDashboardInstance(); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.updateDashboard(); - } - } - } - hidePopup() { - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const existingDashboardInstance = this._getDashboardInstance(embedId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.hideAllPopupsForDashboard(); - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - dbrdInstance.hideAllPopupsForDashboard(); - } - } - } - hideWaitingIndicator() { - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const waitingPopupInstance = bbEmbed('#' + embedId + '_designAreaContainer').data('BoldBIDashboardWaitingPopup'); - if (waitingPopupInstance !== null && waitingPopupInstance !== undefined) { - waitingPopupInstance.destroy(); - } - } - } - else { - const waitingPopupInstance = bbEmbed('.bbi-dashboarddesigner-designAreaContainer').data('BoldBIDashboardWaitingPopup'); - if (waitingPopupInstance !== null && waitingPopupInstance !== undefined) { - waitingPopupInstance.destroy(); - } - } - } - getWidgetData(widgetName, clientFnc, dashboardId) { - let widgetValue; - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - if (bbEmbed(dashboardContainer[`${i}`]).attr('id').includes(dashboardId.toString().replaceAll('-', '')) > 0) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const dbrdInstance = this._getDashboardInstance(embedId); - if (dbrdInstance != undefined) { - widgetValue = dbrdInstance.getWidgetData(widgetName, clientFnc); - if (widgetValue.toLowerCase().includes('widget') > 0) { - if (window[`${clientFnc}`] instanceof Function) { - window[`${clientFnc}`].call(this, widgetValue); - } - else { - clientFnc.call(this, widgetValue); - } - } - } - break; - } - } - } - else { - const dbrdInstance = this._getDashboardInstance(); - if (dbrdInstance != undefined) { - widgetValue = dbrdInstance.getWidgetData(widgetName, clientFnc); - if (widgetValue.toLowerCase().includes('widget') > 0) { - if (window[`${clientFnc}`] instanceof Function) { - window[`${clientFnc}`].call(this, widgetValue); - } - else { - clientFnc.call(this, widgetValue); - } - } - } - } - } - getWidgetDataWithFilters(widgetName, dashboardId, filter, clientFnc) { - let responseData; - const data = JSON.stringify({ - 'dashboardId': dashboardId, 'widgetName': widgetName, 'filter': filter - }); - if (this._isEmptyOrSpaces(dashboardId)) { - responseData = { - 'status': false, 'message': 'dashboardId is invalid', 'request': data - }; - return responseData; - } - if (this._isEmptyOrSpaces(widgetName)) { - responseData = { - 'status': false, 'message': 'widgetName is invalid', 'request': data - }; - return responseData; - } - const thatIns = this; - bbEmbed.ajax({ - type: 'POST', - url: this.designerRootUrl + '/v1.0/design/loadwidgetdata', - data: data, - contentType: 'application/json; charset=utf-8', - beforeSend: function (xhr) { - xhr.setRequestHeader('Authorization', 'bearer ' + thatIns.accessToken); - xhr.setRequestHeader('Caller', thatIns.dashboardServerApiUrl); - }, - success: function (result) { - if (result.Status) { - responseData = { - 'status': result.Status, 'data': result.Data, 'message': result.Message, 'request': data - }; - } - else { - responseData = { - 'status': result.Status, 'message': result.Message, 'request': data - }; - } - clientFnc.call(thatIns, responseData); - }, - error: function (request, message) { - responseData = { - 'status': false, 'message': message, 'request': request - }; - clientFnc.call(thatIns, responseData); - } - }); - responseData = { - 'status': true, 'message': 'Data fetching initiated.', 'request': data - }; - return responseData; - } - /** - * @param {string} clientFnc - It denotes the method name to be defined - * @param {string} containerId - This should be the container id where you want to embed the dashboard - */ - getDashboardCategories(clientFnc, containerId) { - const dbrdInstance = (this._isNullOrUndefined(containerId) || this._isEmptyOrSpaces(containerId)) ? this._getDashboardInstance() : this._getDashboardInstance(containerId + '_embeddedbi'); - if (dbrdInstance != undefined) { - const widgetValue = dbrdInstance.GetDashboardCategories(clientFnc); - if (window[`${clientFnc}`] instanceof Function) { - window[`${clientFnc}`].call(this, widgetValue); - } - else { - clientFnc.call(this, widgetValue); - } - } - } - /** - * @param {string} categoryName - Define new category name want to create . - * @param {string} categoryDescription - Define the description of new category name . - * @param {string} clientFnc - It denotes the method name to be defined - * @param {string} containerId - This should be the container id where you want to embed the dashboard - */ - createDashboardCategory(categoryName, categoryDescription, clientFnc, containerId) { - const dbrdInstance = (this._isNullOrUndefined(containerId) || this._isEmptyOrSpaces(containerId)) ? this._getDashboardInstance() : this._getDashboardInstance(containerId + '_embeddedbi'); - if (dbrdInstance != undefined) { - const widgetValue = dbrdInstance.CreateDashboardCategory(categoryName, categoryDescription, clientFnc); - if (window[`${clientFnc}`] instanceof Function) { - window[`${clientFnc}`].call(this, widgetValue); - } - else { - clientFnc.call(this, widgetValue); - } - } - } - /** - * @param {string} publishModel - Define the information about publish dashboard - * @param {string} containerId - This should be the container id where you want to embed the dashboard - */ - saveDashboard(publishModel, containerId) { - const dbrdInstance = (this._isNullOrUndefined(containerId) || this._isEmptyOrSpaces(containerId)) ? this._getDashboardInstance() : this._getDashboardInstance(containerId + '_embeddedbi'); - if (dbrdInstance != undefined) { - dbrdInstance.model.serverSettings.enableMarkAsPublic = publishModel.IsPublic ? publishModel.IsPublic : false; - dbrdInstance.saveDashboardToServer(publishModel); - } - } - getWidgetInstance(eleID) { - const widgetBIObjvalue = new widgetBI(); - widgetBIObjvalue.containerID = this.embedOptions.embedContainerId; - this._widgetsCollection[this._widgetsCollection.length] = eleID; - const returnValue = Object.assign(widgetBIObjvalue); - widgetBIObjvalue.widgetCollection = this._widgetsCollection; - if (!BoldBI._hasinstance(document.getElementById(this.embedOptions.embedContainerId), 'embeddedBoldBIWidget_' + eleID)) { - BoldBI._putinstance(document.getElementById(this.embedOptions.embedContainerId), 'embeddedBoldBIWidget_' + eleID, returnValue); - } - return returnValue; - } - /** - * @param {string} containerId - This should be the container id where you want to embed the dashboard - */ - updateWidgetFilters(containerId) { - const that = this; - const filters = this._getWidgetFilterInfo(); - if (this.isMultiTab) { - const dashboardContainer = bbEmbed('#' + this.embedOptions.embedContainerId).find('.e-content .bbembed-multitab-dbrd'); - for (let i = 0; i < dashboardContainer.length; i++) { - const embedId = bbEmbed(dashboardContainer[`${i}`]).attr('id'); - const existingDashboardInstance = this._getDashboardInstance(embedId); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.option('widgets', filters); - } - } - } - else if (bbEmbed('.pinBoardDbrd').length > 0) { - bbEmbed('.pinBoardDbrd').each(function () { - const existingDashboardInstance = that._getDashboardInstance(this.id); - if (existingDashboardInstance != undefined) { - existingDashboardInstance.option('widgets', filters); - } - }); - } - else { - const dbrdInstance = (this._isNullOrUndefined(containerId) || this._isEmptyOrSpaces(containerId)) ? this._getDashboardInstance() : this._getDashboardInstance(containerId + '_embeddedbi'); - if (dbrdInstance != undefined) { - dbrdInstance.option('widgets', filters); - } - } - } - // Internal functions. Will not be accessible outside of this scope. - _initializeEmbedOptions(options) { - this.embedOptions = Object.assign(this.embedOptions, options); - } - _loadCloudDepedentFiles(responseInfo) { - const responseData = responseInfo.Data; - this.cdnLink = responseData.CdnUrl; - this.designerRootUrl = responseData.DesignerServerUrl; - this._addJquerydependentFiles(); - } - _handleEnvironmentError(arg) { - if (arg.type == 'error') { - this._throwError('Server not found. If you are using Cloud BI Server, please ensure that the Environment member is set on the client side.'); - this.invalidDetail = true; - } - } - _getCloudLinks() { - this._xhrRequestHelper('Get', this.dashboardServerApiUrl + '/system-settings/get-url', {}, {}, this._loadCloudDepedentFiles); - } - _loadDepedentFiles() { - if (this.embedOptions.dashboardSettings.themeSettings && !this.embedOptions.dashboardSettings.themeSettings.isLocalTheme && this.embedOptions.dashboardSettings.themeSettings.dashboard) { - this._addedDependentFiles(this, this.dashboardThemeCssFiles, true); - } - else if (this.embedOptions.dashboardSettings.themeSettings && !this.embedOptions.dashboardSettings.themeSettings.isLocalTheme) { - this._addedDependentFiles(this, this.applicationThemeCssFiles, true); - } - else if (!this.embedOptions.dashboardSettings.themeSettings) { - this._addedDependentFiles(this, this.applicationThemeCssFiles, true); - } - if (this.embedOptions.mode == BoldBI.Mode.Design || this.embedOptions.mode == BoldBI.Mode.DataSource || this.embedOptions.mode == BoldBI.Mode.Connection) { - this._addedDependentFiles(this, this.designerScriptFiles, false); - } - else { - this._addedDependentFiles(this, this.viewerScriptFiles, false); - } - if (!this._isNullOrUndefined(this.embedOptions.dashboardSettings.fontFamily) && !this._isEmptyOrSpaces(this.embedOptions.dashboardSettings.fontFamily)) { - this._addedDependentFiles(this, this.fontFamilyCssFiles, true); - } - if (this.embedOptions.pinboardName != '') { - this._addedDependentFiles(this, this.pinBoardScriptFiles, false); - } - this._addedDependentFiles(this, this.cssFiles, true); - if (this.embedOptions.pinboardName != '') { - this._addedDependentFiles(this, this.pinboardCssFiles, true); - } - if (this.embedOptions.mode == BoldBI.Mode.Design || this.embedOptions.mode == BoldBI.Mode.DataSource || this.embedOptions.mode == BoldBI.Mode.Connection) { - this._addedDependentFiles(this, this.designerCssFiles, true); - } - if (this.embedOptions.isBingMapRequired) { - this._loadBingmapDependentFiles(); - } - this._loadDependentDesignerFiles(this); - } - _loadBingmapDependentFiles() { - const scriptTag = ''; - bbEmbed(scriptTag).appendTo('head'); - } - _loadDependentDesignerFiles(that) { - if (window.BoldBIDashboard instanceof Object && - window.BoldBIDashboard.createObject instanceof Function && - window.Designer instanceof Object) { - that._addedDependentFiles(that, that.ejViewerDependentFiles, false); - if (that.embedOptions.mode == BoldBI.Mode.Design || that.embedOptions.mode == BoldBI.Mode.DataSource || that.embedOptions.mode == BoldBI.Mode.Connection) { - that._addedDependentFiles(that, that.ejDesignerDependentFiles, false); - } - } - else { - setTimeout(that._loadDependentDesignerFiles, 50, that); - } - } - _addWrapperDependentFiles(obj, fileUriArray) { - const that = obj; - fileUriArray.forEach(function (file) { - if (!((file == 'jquery-ui.min.js' && window.jQuery.ui != undefined && window.jQuery.ui.version == '1.12.1') || (file == 'jsrender.min.js' && window.jQuery.views != undefined && window.jQuery.views.jsviews == 'v1.0.0-beta'))) { - const scriptTag = document.createElement('script'); - if (this.embedOptions.nonce) { - scriptTag.nonce = this.embedOptions.nonce; - } - if (file == 'jquery.easing.1.3.min.js') { - scriptTag.src = (that.embedOptions.environment == BoldBI.Environment.Enterprise) ? that.rootUrl + '/cdn/scripts/designer/' + file : that.cdnLink + '/scripts/designer/' + file; - } - if (file == 'jquery-ui.min.js') { - scriptTag.src = (that.embedOptions.environment == BoldBI.Environment.Enterprise) ? that.rootUrl + '/cdn/scripts/' + file : that.cdnLink + '/scripts/' + file; - } - else if (file == 'jsrender.min.js') { - scriptTag.src = (that.embedOptions.environment == BoldBI.Environment.Enterprise) ? that.rootUrl + '/cdn/scripts/designer/' + file : that.cdnLink + '/scripts/designer/' + file; - } - document.head.appendChild(scriptTag); - scriptTag.onerror = (arg) => this._handleEnvironmentError(arg); - } - }.bind(that)); - } - _addedDependentFiles(that, fileUriArray, isCSS) { - let fileUri = ''; - fileUriArray.forEach(function (file) { - if (!that._checkDepedentFileExists(file, isCSS)) { - if (isCSS) { - if (that.embedOptions.environment == BoldBI.Environment.Enterprise) { - if (file == 'font-server.min.css') { - fileUri = that.rootUrl + '/cdn/css/' + file; - } - else if (file == 'bootstrap.min.css') { - fileUri = that.rootUrl + '/Content/Styles/Bootstrap/' + file; - } - else if (file == 'pinboard-embed.min.css') { - fileUri = that.rootUrl + '/cdn/css/' + file; - } - else if (file == 'boldbi.theme.definition.min.css') { - if (that.embedOptions.dashboardSettings.themeSettings && !that.embedOptions.dashboardSettings.themeSettings.isLocalTheme && !that._isNullOrUndefined(that.embedOptions.dashboardSettings.themeSettings.appearance) && !that._isEmptyOrSpaces(that.embedOptions.dashboardSettings.themeSettings.appearance)) { - fileUri = that.rootUrl + '/cdn/css/designer/' + that.embedOptions.dashboardSettings.themeSettings.appearance + '/' + file; - } - else { - fileUri = that.rootUrl + '/cdn/css/designer/light/' + file; - } - } - else if (file == 'application.theme.css' || file == 'dashboard.theme.css') { - if (that.embedOptions.dashboardSettings.themeSettings && !that.embedOptions.dashboardSettings.themeSettings.isLocalTheme && !that._isNullOrUndefined(that.embedOptions.dashboardSettings.themeSettings.dashboard) && !that._isEmptyOrSpaces(that.embedOptions.dashboardSettings.themeSettings.dashboard)) { - fileUri = that.customThemeUrl + '/dashboard?theme=' + that.embedOptions.dashboardSettings.themeSettings.dashboard; - } - else if (that.embedOptions.dashboardSettings.themeSettings && !that.embedOptions.dashboardSettings.themeSettings.isLocalTheme && !that._isNullOrUndefined(that.embedOptions.dashboardSettings.themeSettings.application) && !that._isEmptyOrSpaces(that.embedOptions.dashboardSettings.themeSettings.application)) { - fileUri = that.customThemeUrl + '/application?theme=' + that.embedOptions.dashboardSettings.themeSettings.application; - } - } - else if (file == 'font-family.min.css') { - const fontFamilyUrl = this.rootUrl.replace(/\/bi(?!.*\/bi)/, '/ums/user-interface/fonts'); - fileUri = fontFamilyUrl + '?family=' + that.embedOptions.dashboardSettings.fontFamily; - } - else { - fileUri = that.rootUrl + '/webdesignerservice/themes/' + file; - } - } - else { - if (file == 'font-server.min.css') { - fileUri = that.cdnLink + '/css/' + file; - } - else if (file == 'bootstrap.min.css') { - fileUri = that.cdnLink + '/css/' + file; - } - else if (file == 'pinboard-embed.min.css') { - fileUri = that.cdnLink + '/css/' + file; - } - else if (file == 'boldbi.theme.definition.min.css') { - if (that.embedOptions.dashboardSettings.themeSettings && !that.embedOptions.dashboardSettings.themeSettings.isLocalTheme && !that._isNullOrUndefined(that.embedOptions.dashboardSettings.themeSettings.appearance) && !that._isEmptyOrSpaces(that.embedOptions.dashboardSettings.themeSettings.appearance)) { - fileUri = that.cdnLink + '/css/designer/' + that.embedOptions.dashboardSettings.themeSettings.appearance + '/' + file; - } - else { - fileUri = that.cdnLink + '/css/designer/light/' + file; - } - } - else if (file == 'application.theme.css' || file == 'dashboard.theme.css') { - if (that.embedOptions.dashboardSettings.themeSettings && !that.embedOptions.dashboardSettings.themeSettings.isLocalTheme && !that._isNullOrUndefined(that.embedOptions.dashboardSettings.themeSettings.dashboard) && !that._isEmptyOrSpaces(that.embedOptions.dashboardSettings.themeSettings.dashboard)) { - fileUri = that.rootUrl + '/theme/styles/dashboard?theme=' + that.embedOptions.dashboardSettings.themeSettings.dashboard; - } - else if (that.embedOptions.dashboardSettings.themeSettings && !that.embedOptions.dashboardSettings.themeSettings.isLocalTheme && !that._isNullOrUndefined(that.embedOptions.dashboardSettings.themeSettings.application) && !that._isEmptyOrSpaces(that.embedOptions.dashboardSettings.themeSettings.application)) { - fileUri = that.rootUrl + '/theme/styles/application?theme=' + that.embedOptions.dashboardSettings.themeSettings.application; - } - } - else if (file == 'font-family.min.css') { - fileUri = that.rootUrl + '/user-interface/fonts?family=' + that.embedOptions.dashboardSettings.fontFamily; - } - else { - fileUri = that.cdnLink + '/css/designer/' + file; - } - } - const cssTag = document.createElement('link'); - cssTag.rel = 'stylesheet'; - cssTag.href = fileUri; - if (bbEmbed('link[href="' + fileUri + '"]').length < 1) { - document.head.appendChild(cssTag); - } - } - else { - if (that.embedOptions.environment == BoldBI.Environment.Enterprise) { - if (file == 'bootstrap.min.js') { - fileUri = that.rootUrl + '/cdn/scripts/' + file; - } - else if (file == 'designerlocalization.js') { - fileUri = that.rootUrl + '/designer/localization/' + file + '?c=' + that.embedOptions.localeSettings.appLocale; - } - else if (file == 'signalr.min.js') { - fileUri = that.rootUrl + '/cdn/scripts/signalr/' + file; - } - else { - fileUri = that.rootUrl + '/cdn/scripts/designer/' + file; - } - } - else { - if (file == 'bootstrap.min.js') { - fileUri = that.cdnLink + '/scripts/' + file; - } - else if (file == 'designerlocalization.js') { - fileUri = that.designerRootUrl + '/localization/' + file; - } - else if (file == 'signalr.min.js') { - fileUri = that.cdnLink + '/scripts/signalr/' + file; - } - else { - fileUri = that.cdnLink + '/scripts/designer/' + file; - } - } - const scriptTag = document.createElement('script'); - scriptTag.type = 'text/javascript'; - scriptTag.src = fileUri; - if (this.embedOptions.nonce) { - scriptTag.nonce = this.embedOptions.nonce; - } - if (bbEmbed('script[src= "' + fileUri + '"]').length < 1) { - document.head.appendChild(scriptTag); - } - scriptTag.onerror = (arg) => this._handleEnvironmentError(arg); - } - } - }.bind(that)); - } - _checkDepedentFileExists(file, isCSS) { - let isFileExists = false; - const selectItem = isCSS ? 'link' : 'script'; - const tagList = document.head.querySelectorAll(selectItem); - tagList.forEach(function (tag) { - if (!isFileExists) { - if (isCSS) { - isFileExists = tag.href.indexOf(file) != -1; - } - else { - isFileExists = tag.src.indexOf(file) != -1; - } - } - }); - return isFileExists; - } - _renderPinboard(itemDetail) { - const widgetContainer = bbEmbed('
    ' + this.embedOptions.pinboardName + '
    '); - bbEmbed('#' + this.embedOptions.embedContainerId).append(widgetContainer); - this._createPinboardDom(itemDetail); - this._renderItem(itemDetail); - this._removeElementsClass(this.embedOptions.embedContainerId, '.preloader-wrap', 'viewer-blue-loader'); - const that = this; - bbEmbed(document).on('click', '.unpin-widget', function (e) { - e.preventDefault(); - const unpinWidgetInstance = bbEmbed('#' + bbEmbed(e.target).parents('li').find('.pinWidget').attr('id') + '_embeddedbi').data('BoldBIDashboardDesigner'); - const clientFnc = window[that.embedOptions.onUnpin]; - if (clientFnc instanceof Function) { - clientFnc.call(this, unpinWidgetInstance); - } - if (that.embedOptions.onUnpin instanceof Function) { - that.embedOptions.onUnpin.call(that, unpinWidgetInstance); - } - that.column = parseInt(bbEmbed(this).closest('ul').attr('data-column-id'), 10); - that.position = bbEmbed(this).parents('li').index() + 1; - unpinWidgetInstance.destroy(); - that._unPinItem(that.column, that.position); - }); - bbEmbed(document).on('click', '#pinboard-fullscreen', function () { - const embedElement = bbEmbed('#server-app-container')[0]; - if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { - bbEmbed('#server-app-container').removeAttr('style'); - bbEmbed('#server-app-container').attr('style', 'background-color: #f9f9f9; overflow: auto !important'); - if (embedElement.requestFullscreen) { - embedElement.requestFullscreen(); - } - else if (embedElement.msRequestFullscreen) { - embedElement.msRequestFullscreen(); - } - else if (embedElement.mozRequestFullScreen) { - embedElement.mozRequestFullScreen(); - } - else if (embedElement.webkitRequestFullscreen) { - embedElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); - } - else { - if ('ActiveXObject' in window) { - const wscript = new ActiveXObject('Wscript.shell'); - wscript.SendKeys('{F11}'); - setTimeout(function () { - if ((screen.availHeight || screen.height - 30) <= window.innerHeight) { - bbEmbed('#pinboard-fullscreen').removeClass('su-maximize-1').addClass('su-minimize').attr('data-tooltip', 'Exit Fullscreen'); - } - else { - bbEmbed('#pinboard-fullscreen').addClass('su-maximize-1').removeClass('su-minimize').attr('data-tooltip', 'Fullscreen'); - } - }, 400); - } - } - } - else { - bbEmbed('#server-app-container').attr('style', 'background-color: #f9f9f9; height:' + bbEmbed('#content-area').height() + 'px;overflow: hidden !important;min-height: 600px; width:' + that.embedOptions.width + ''); - if (document.exitFullscreen) { - document.exitFullscreen(); - } - else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } - else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } - else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } - } - }); - bbEmbed(document).on('click', '#layout-items span', function () { - const clientFnc = window[that.embedOptions.onLayoutChange]; - if (clientFnc instanceof Function) { - clientFnc.call(this, bbEmbed('#widget-container')); - } - if (that.embedOptions.onLayoutChange instanceof Function) { - that.embedOptions.onLayoutChange.call(that, bbEmbed('#widget-container')); - } - const currentLayout = bbEmbed('#widget-container').attr('data-current-layout'); - bbEmbed('#widget-container').attr('data-current-layout', bbEmbed(this).attr('id')); - bbEmbed('#layout-items span').removeClass('active'); - bbEmbed(this).addClass('active'); - switch (bbEmbed(this).attr('id')) { - case '1': - if (currentLayout != '1') { - that.changeLayout(1); - if (currentLayout == '111') { - that.appendListItem(1, 2); - } - else if (currentLayout == '11' || currentLayout == '12' || currentLayout == '21') { - that.appendListItem(1, 1); - } - that._setLayout(1); - } - break; - case '11': - if (currentLayout != '11') { - that.changeLayout(11); - if (currentLayout == '111') { - that.appendListItem(2, 1); - } - else if (currentLayout == '1') { - that.createEmptyList(2, 2); - } - that._setLayout(11); - } - break; - case '12': - if (currentLayout != '12') { - that.changeLayout(12); - if (currentLayout == '111') { - that.appendListItem(2, 1); - } - else if (currentLayout == '1') { - that.createEmptyList(2, 2); - } - that._setLayout(12); - } - break; - case '21': - if (currentLayout != '21') { - that.changeLayout(21); - if (currentLayout == '111') { - that.appendListItem(2, 1); - } - else if (currentLayout == '1') { - that.createEmptyList(2, 2); - } - that._setLayout(21); - } - break; - case '111': - if (currentLayout != '111') { - that.changeLayout(111); - if (currentLayout == '1') { - that.createEmptyList(2, 3); - } - else if (currentLayout == '11' || currentLayout == '12' || currentLayout == '21') { - that.createEmptyList(3, 3); - } - that._setLayout(111); - } - break; - } - }); - bbEmbed.map(that.pinboardDetails, function (value) { - that.isWidgetMode = true; - that.widgetName = that.embedOptions.token ? value.Id : value.WidgetId; - that.isDashboardViewMode = false; - that.dashboardViewName = ''; - const response = { - Apistatus: true, - Data: that.embedOptions.token ? value : JSON.parse(value), - Status: true - }; - that._renderDashboard(response); - }); - } - createEmptyList(from, to) { - for (let i = from; i <= to; i++) { - bbEmbed('#widget-container').append(''); - } - } - appendListItem(appendTo, count) { - for (let i = appendTo + 1; i <= appendTo + count; i++) { - if (bbEmbed('#column-' + i + ' li:not(.empty)').length > 0) { - bbEmbed('#column-' + appendTo + ' li.empty').remove(); - } - bbEmbed('#column-' + appendTo).append(bbEmbed('#column-' + i + ' li:not(.empty)')); - bbEmbed('#column-' + i).remove(); - } - } - changeLayout(layout) { - const that = this; - let data; - that.homepageItemId = bbEmbed('#widget-container').attr('data-homepage-id'); - that.isVirtualHomepage = bbEmbed('#widget-container').attr('data-virtual-homepage'); - if (that.homepageItemId == '' && that.isVirtualHomepage) { - //that.homepageItemId = saveVirtualHomepage(); - bbEmbed('#initial-message').hide(); - } - const embedQuerString = 'embed_nonce=' + this._uuidv4Generartor() + - '&homepageId=' + that.homepageItemId + - '&layout=' + layout + - '&embed_mode=' + this.embedOptions.mode + - '&embed_timestamp=' + Math.round((new Date()).getTime() / 1000) + - '&embed_expirationtime=' + this.embedOptions.expirationTime; - if (!that.embedOptions.token && !that._isEmptyOrSpaces(that.embedOptions.authorizationServer.url)) { - data = { - embedQuerString: encodeURI(embedQuerString), - dashboardServerApiUrl: this.dashboardServerApiUrl - }; - this._xhrRequestHelper('POST', this.embedOptions.authorizationServer.url, data, this.embedOptions.authorizationServer.headers, this._changeLayoutSuccess); - } - else { - data = { - 'homepageId': that.homepageItemId, - 'layout': layout - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: that.dashboardServerApiUrl + this.embedGetDetailsEndPoint, - headers: { - 'Authorization': 'Bearer ' + that.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: bbEmbed.proxy(that._changeLayoutSuccess, that) - }); - } - } - _checkEmptyHomepage() { - let length = 0; - let isEmptyHomepage = false; - bbEmbed('#widget-container ul').each(function (i) { - length = bbEmbed('#column-' + (i + 1) + ' li:not(".empty")').length; - isEmptyHomepage = length > 0 ? false : true; - return length > 0 ? false : true; - }); - return isEmptyHomepage; - } - _setLayout(layout) { - const itemType = bbEmbed('#widget-container').attr('data-item-type').toLowerCase(); - bbEmbed('#layout-items').find('span#' + layout).addClass('active'); - switch (layout) { - case 1: - bbEmbed('#column-1').removeClass().addClass('col-lg-12 col-md-12 col-sm-12 col-xs-12'); - break; - case 11: - bbEmbed('#column-1,#column-2').removeClass().addClass('col-lg-6 col-md-6 col-sm-6 col-xs-6'); - break; - case 12: - bbEmbed('#column-1').removeClass().addClass('col-lg-4 col-md-4 col-sm-4 col-xs-4'); - bbEmbed('#column-2').removeClass().addClass('col-lg-8 col-md-8 col-sm-8 col-xs-8'); - break; - case 21: - bbEmbed('#column-1').removeClass().addClass('col-lg-8 col-md-8 col-sm-8 col-xs-8'); - bbEmbed('#column-2').removeClass().addClass('col-lg-4 col-md-4 col-sm-4 col-xs-4'); - break; - case 111: - bbEmbed('#column-1,#column-2,#column-3').removeClass().addClass('col-lg-4 col-md-4 col-sm-4 col-xs-4'); - break; - } - const isEmptyHomepage = this._checkEmptyHomepage(); - if (isEmptyHomepage) { - if (!window.IsMobile) { - bbEmbed('#widget-container ul li.empty .empty-content').find('.drag-widget').hide(); - bbEmbed('#widget-container ul li.empty .empty-content').removeClass('non-empty-homepage').addClass('empty-homepage'); - } - else { - bbEmbed('#widget-container ul li.empty .empty-content').removeClass('non-empty-homepage').addClass('mobile-empty-homepage'); - bbEmbed('#widget-container ul li.empty .empty-content').find('.drag-widget').text('Log in using a desktop client to add widgets to this pinboard.').show(); - bbEmbed('#widget-container ul li.empty').css('border', 'none'); - } - } - if (itemType != 'dashboard') { - const that = this; - this.enableSorting(); - this.setListMinimumHeight(); - bbEmbed('.pinBoardDbrd').each(function () { - const dbrdInstance = that._getDashboardInstance(this.id); - const clientFnc = window[that.embedOptions.onResize]; - if (clientFnc instanceof Function) { - clientFnc.call(that, dbrdInstance); - } - if (that.embedOptions.onResize instanceof Function) { - that.embedOptions.onResize.call(that, dbrdInstance); - } - dbrdInstance.resizeDashboard(); - }); - } - } - setListMinimumHeight() { - const tempArr = []; - bbEmbed('#widget-container > ul').each(function (i) { - let tempVar = 0; - bbEmbed(this).find('li').each(function () { - tempVar = tempVar + bbEmbed(this).innerHeight() + 20; - }); - tempArr[`${i}`] = tempVar; - }); - const minimumHeight = Math.max(...tempArr) > 400 ? Math.max(...tempArr) : 440; - bbEmbed('#widget-container > ul').css('min-height', minimumHeight); - bbEmbed('#server-app-container').height(bbEmbed('#content-area').height()); - } - enableSorting() { - const that = this; - window.bbEmbed('#column-1, #column-2, #column-3').sortable({ - connectWith: 'ul', - placeholder: 'placeholder', - handle: '.e-rteItem .e-rte-content, .bbi-dbrd-control-header:not(.bbi-dbrd-control-menu-icon)', - cancel: '.empty, .bbi-dbrd-control-menu-icon', - containment: '#server-app-container', - cursor: 'move', - tolerance: 'pointer', - scroll: true, - scrollSensitivity: 10, - scrollSpeed: 20, - update: function (event, ui) { - that.toColumn = bbEmbed(event.target).data('column-id'); - that.toPosition = ui.item.index() + 1; - }, - start: function (event, ui) { - bbEmbed('li.placeholder').append('
    Drag your widgets here to customize layout
    '); - bbEmbed('li.placeholder').css({ 'height': ui.item.height().toString() + 'px', 'background-color': '#eeeeee', 'border': 'dashed lightgray' }); - bbEmbed('#widget-container ul li.empty').remove(); - that.fromColumn = bbEmbed(event.target).data('column-id'); - that.fromPosition = ui.item.index() + 1; - that.toColumn = bbEmbed(event.target).data('column-id'); - that.toPosition = ui.item.index() + 1; - const dragPinWidgetInstance = bbEmbed('#' + ui.item.find('.pinWidget').attr('id') + '_embeddedbi').data('BoldBIDashboardDesigner'); - const clientFnc = window[that.embedOptions.onDrag]; - if (clientFnc instanceof Function) { - clientFnc.call(this, dragPinWidgetInstance); - } - if (that.embedOptions.onDrag instanceof Function) { - that.embedOptions.onDrag.call(that, dragPinWidgetInstance); - } - }, - stop: function (event, ui) { - that.showEmptyList(); - const clientFnc = window[that.embedOptions.onDrop]; - const dropPinWidgetInstance = bbEmbed('#' + ui.item.find('.pinWidget').attr('id') + '_embeddedbi').data('BoldBIDashboardDesigner'); - if (clientFnc instanceof Function) { - clientFnc.call(this, dropPinWidgetInstance); - } - if (that.embedOptions.onDrop instanceof Function) { - that.embedOptions.onDrop.call(that, dropPinWidgetInstance); - } - if (!(that.fromColumn == that.toColumn && that.fromPosition == that.toPosition)) { - if (that.fromColumn != that.toColumn) { - window.bbEmbed('#' + ui.item.find('.pinWidget').attr('id') + '_embeddedbi').data('BoldBIDashboardDesigner').resizeDashboard(); - } - that.dragAndDrop(that.fromColumn, that.toColumn, that.fromPosition, that.toPosition); - } - that.setListMinimumHeight(); - } - }); - window.bbEmbed('#column-1, #column-2, #column-3').disableSelection(); - } - showEmptyList() { - bbEmbed('#widget-container ul').each(function (i) { - if (bbEmbed('#column-' + (i + 1) + ' li').length < 1) { - bbEmbed('#column-' + (i + 1)).append('
  • Drag your widgets here to customize layout
  • '); - } - }); - } - dragAndDrop(fromColumn, toColumn, fromPosition, toPosition) { - const that = this; - let data; - const homepageItemId = bbEmbed('#widget-container').attr('data-homepage-id'); - const from = { Column: fromColumn, Position: fromPosition }; - const to = { Column: toColumn, Position: toPosition }; - const embedQuerString = 'embed_nonce=' + this._uuidv4Generartor() + - '&homepageId=' + homepageItemId + - '&moveFrom=' + JSON.stringify(from) + - '&moveTo=' + JSON.stringify(to) + - '&embed_mode=' + this.embedOptions.mode + - '&embed_timestamp=' + Math.round((new Date()).getTime() / 1000) + - '&embed_expirationtime=' + this.embedOptions.expirationTime; - if (!that.embedOptions.token && !that._isEmptyOrSpaces(that.embedOptions.authorizationServer.url)) { - data = { - embedQuerString: encodeURI(embedQuerString), - dashboardServerApiUrl: this.dashboardServerApiUrl - }; - this._xhrRequestHelper('POST', this.embedOptions.authorizationServer.url, data, this.embedOptions.authorizationServer.headers, this._dragAndDropSuccess); - } - else { - data = { - 'homepageId': homepageItemId, - 'moveFrom': JSON.stringify(from), - 'moveTo': JSON.stringify(to) - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: that.dashboardServerApiUrl + this.embedGetDetailsEndPoint, - data: JSON.stringify(data), - headers: { - 'Authorization': 'Bearer ' + that.accessToken - }, - contentType: 'application/json', - success: bbEmbed.proxy(that._dragAndDropSuccess, that) - }); - } - } - _unPinItem(column, position) { - const that = this; - let data; - const homepageItemId = bbEmbed('#widget-container').attr('data-homepage-id'); - const unpinPosition = { Column: column, Position: position }; - const embedQuerString = 'embed_nonce=' + this._uuidv4Generartor() + - '&homepageId=' + homepageItemId + - '&unpinPosition=' + JSON.stringify(unpinPosition) + - '&isUnpin=' + true + - '&embed_mode=' + this.embedOptions.mode + - '&embed_timestamp=' + Math.round((new Date()).getTime() / 1000) + - '&embed_expirationtime=' + this.embedOptions.expirationTime; - if (!that.embedOptions.token && !that._isEmptyOrSpaces(that.embedOptions.authorizationServer.url)) { - data = { - embedQuerString: encodeURI(embedQuerString), - dashboardServerApiUrl: this.dashboardServerApiUrl - }; - this._xhrRequestHelper('POST', this.embedOptions.authorizationServer.url, data, this.embedOptions.authorizationServer.headers, this._unPinSuccess); - } - else { - data = { - 'homepageId': homepageItemId, - 'unpinPosition': JSON.stringify(unpinPosition), - 'isUnpin': true - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: that.dashboardServerApiUrl + this.embedGetDetailsEndPoint, - headers: { - 'Authorization': 'Bearer ' + that.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: bbEmbed.proxy(that._unPinSuccess, that) - }); - } - } - _unPinSuccess(result) { - if (result.Status) { - bbEmbed('#column-' + this.column + ' li:eq(' + (this.position - 1) + ')').remove(); - this.showEmptyList(); - const isEmptyHomepage = this.checkEmptyHomepage(); - if (isEmptyHomepage) { - bbEmbed('#widget-container ul li.empty .empty-content').find('.drag-widget').hide(); - bbEmbed('#widget-container ul li.empty .empty-content').removeClass('non-empty-homepage').addClass('empty-homepage'); - } - this.setListMinimumHeight(); - } - } - checkEmptyHomepage() { - let length = 0; - let isEmptyHomepage = false; - bbEmbed('#widget-container ul').each(function (i) { - length = bbEmbed('#column-' + (i + 1) + ' li:not(".empty")').length; - isEmptyHomepage = length > 0 ? false : true; - return length > 0 ? false : true; - }); - return isEmptyHomepage; - } - _renderItem(itemDetail) { - const that = this; - const isEmptyHomepage = this._checkEmptyHomepage(); - if (isEmptyHomepage) { - bbEmbed('#widget-container ul li.empty .empty-content').find('.drag-widget').hide(); - bbEmbed('#widget-container ul li.empty .empty-content').removeClass('non-empty-homepage').addClass('empty-homepage'); - } - bbEmbed('#widget-container').hide(); - if (itemDetail.ItemType.toLowerCase() == 'widget') { - this._setLayout(itemDetail.ColumnInfo.Layout); - const column = itemDetail.ColumnInfo.Column; - bbEmbed.each(column, function (i) { - if (column[`${i}`].Item.length > 0) { - bbEmbed.each(column[`${i}`].Item, function (j) { - if (column[`${i}`].Item[`${j}`].ItemExtension.toLowerCase() != '.sydj') { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).ejDashboardViewer({ - accessToken: this.accessToken, - serviceUrl: this.dashboardServiceUrl, - serverUrl: this.dashboardServerUrl, - _enableHyperLinkOnErrorMessage: false, - cdnFilePath: this.isUseCdn ? this.cdnLink + '/scripts/viewer' : '', - dashboardPath: column[`${i}`].Item[`${j}`].Path, - _itemId: column[`${i}`].Item[`${j}`].ItemId, - reportName: '', - reportDescription: '', - enableExport: true, - enablePrint: false, - actionBegin: function (args) { - if (args.eventType == 'beforeNavigate') { - this.hasWidgetLink = true; - } - }, - localeSettings: { - resourcePath: '' - }, - enableWidgetMode: column[`${i}`].Item[`${j}`].Id == null ? false : true, - filterParameters: column[`${i}`].Item[`${j}`].QueryString, - showTab: column[`${i}`].Item[`${j}`].TabId == null ? true : false, - widgetModeSettings: { - name: '', - id: column[`${i}`].Item[`${j}`].Id == null ? '' : column[`${i}`].Item[`${j}`].Id, - title: column[`${i}`].Item[`${j}`].Name - }, - _selectedTabGuid: column[`${i}`].Item[`${j}`].TabId == null ? '' : column[`${i}`].Item[`${j}`].TabId, - afterWidgetRender: bbEmbed.proxy(function (args, param) { - if (param.data.controlType.toLowerCase() == 'card') { - if (!bbEmbed('#widget_' + (i + 1) + '_' + (j + 1) + ' .e-control-heading span').hasClass('e-control-title')) { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1) + ' .e-control-heading').text(args[`${i}`].Item[`${j}`].Name); - } - } - if (args[`${i}`].Item[`${j}`].IsActive && !args[`${i}`].Item[`${j}`].IsHavingPermission) { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('.bbi-dbrd-control').remove(); - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('.bbi-dbrd-control-container').append('
    You do not have permission to view this widget.
    '); - } - else if (!args[`${i}`].Item[`${j}`].IsActive && !args[`${i}`].Item[`${j}`].IsHavingPermission) { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('.bbi-dbrd-control').remove(); - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('.bbi-dbrd-control-container').append('
    This widget has been deleted.
    '); - } - if (args[`${i}`].Item[`${j}`].IsActive && args[`${i}`].Item[`${j}`].IsHavingPermission && args[`${i}`].Item[`${j}`].QueryString != null) { - const currentElement = bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)); - currentElement.find('#filter-info').parent().append('
    Applied Filters
    '); - //const filtersDom = buildAppliedFiltersDom(parsedQueryFilter); - //currentElement.find(".filter-overview #applied-filters-container").append(filtersDom); - if (currentElement.find('.filter-overview #applied-filters-container').height() > 180) { - currentElement.find('.filter-overview #scroller-content').BoldBIDashboardScroller({ - height: 180, - width: 248, - scrollerSize: 9 - }); - } - currentElement.find('.filter-overview').addClass('display-none'); - } - }, this, column), - beforeWidgetIconRendered: bbEmbed.proxy(function (args, event) { - if (event.widgetInformation.Name.toLowerCase() != 'widget not configured') { - if (!window.IsMobile) { - if (event.widgetInformation.Name.toLowerCase() != 'card') { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).data('ejDashboardViewer').model.size.height = '400px'; - } - else { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).data('ejDashboardViewer').model.size.height = '250px'; - } - } - else { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).data('ejDashboardViewer').model.size.height = '250px'; - } - } - else { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).data('ejDashboardViewer').model.size.height = '200px'; - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('.bbi-dbrd-control-container').append('
    This widget has been deleted.
    '); - } - if (event.iconsinformation.length > 0 && event.iconsinformation[0].classname == 'bbi-dbrd-link-enable') { - event.iconsinformation[0].margintop = '1px'; - } - if (!window.IsMobile) { - event.iconsinformation.unshift({ 'classname': 'su su-delete unpin', 'name': 'Unpin Widget', 'datatooltip': 'Unpin Widget', 'marginright': '-18px', 'margintop': '4px' }); - } - const addWidgetIcons = args[`${i}`].Item[`${j}`].IsActive && args[`${i}`].Item[`${j}`].IsHavingPermission && event.widgetInformation.Name.toLowerCase() != 'widget not configured'; - if (addWidgetIcons) { - event.iconsinformation.unshift({ 'classname': 'su su-maximize unpin', 'name': 'Maximize Widget', 'datatooltip': 'Maximize Widget', 'marginright': '-18px', 'margintop': '4px' }); - event.iconsinformation.unshift({ 'classname': 'su su-open-link-newtab unpin', 'name': 'Go to Dashboard', 'datatooltip': 'Go to Dashboard', 'marginright': '-18px', 'margintop': '4px' }); - } - if (addWidgetIcons && args[`${i}`].Item[`${j}`].QueryString != null) { - event.iconsinformation.unshift({ 'id': 'filter-info', 'classname': 'su su-info unpin', 'name': 'Applied Filters', 'datatooltip': 'View Applied Filters', 'margintop': '4px', 'marginright': '0px' }); - } - bbEmbed('#widget-container').show(); - //hideWaitingPopup('content-area'); - const data = bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).ejDashboardViewer(); - data.resize(); - }, this, column), - dashboardCreated: function () { - const href = bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).attr('data-dashboardurl'); - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('.su-open-link-newtab').wrap(bbEmbed('')); - }, - onMenuIconClick: function (information) { - if (typeof (information.name) != 'undefined' && information.name.toLowerCase() == 'unpin widget') { - //ShowWaitingProgress('#content-area', 'show'); - const column = information.target.parents('ul').data('column-id'); - const position = information.target.parents('li').index() + 1; - this.unPinItem(column, position, information.event); - } - else if (typeof (information.name) != 'undefined' && information.name.toLowerCase() == 'maximize widget') { - //parent.bbEmbed('#maximize').removeClass('display-none'); - //const control = parent.bbEmbed('#' + currentElement).data('ejDashboardViewer').getWidgetDataByReportName(information.widgetId); - //maximizeWidget(header, control, information.event, information.serviceUrl, information.dashboardPath); - } - else if (typeof (information.name) != 'undefined' && information.name.toLowerCase() == 'applied filters') { - const currentElement = bbEmbed(information.event.target).parent().find('.filter-overview'); - currentElement.toggleClass('display-none'); - bbEmbed('.filter-overview').not(currentElement).addClass('display-none'); - information.event.preventDefault(); - } - } - }); - } - else { - const pinboardIdName = that.embedOptions.embedContainerId + '_pinBoard_' + (i + 1) + '_' + (j + 1); - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).append('
    '); - that.pinBoardRendered = false; - that.pinboardIds.push({ 'widgetId': column[`${i}`].Item[`${j}`].Id, 'pinboardContainerId': pinboardIdName }); - that.pinboardDetails[that.pinboardDetails.length] = that.embedOptions.token ? column[`${i}`].Item[`${j}`] : column[`${i}`].Item[`${j}`].WidgetDetails; - if (column[`${i}`].Item[`${j}`].IsActive && !column[`${i}`].Item[`${j}`].IsHavingPermission) { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('iframe').remove(); - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).append('
    You do not have permission to view this widget.
    '); - } - else if (!column[`${i}`].Item[`${j}`].IsActive && !column[`${i}`].Item[`${j}`].IsHavingPermission) { - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).find('iframe').remove(); - bbEmbed('#widget_' + (i + 1) + '_' + (j + 1)).append('
    This widget has been deleted.
    '); - } - } - }); - bbEmbed('#widget-container').show(); - } - else { - bbEmbed('#widget-container').show(); - } - }); - this.enableSorting(); - this.setListMinimumHeight(); - } - else if (itemDetail.ItemType.toLowerCase() == 'dashboard') { - const column = itemDetail.ColumnInfo.Column; - bbEmbed('#dashboard_1_1').css({ 'height': bbEmbed(window).height() - bbEmbed('#header-area').outerHeight() - bbEmbed('#base-footer-div').outerHeight() - bbEmbed('#homepage-header').outerHeight() - 30, 'width': bbEmbed('#content-area').width() - 10 }); - if (column[0].Item[0].IsActive && column[0].Item[0].IsHavingPermission && column[0].Item[0].ItemExtension.toLowerCase() != '.sydj') { - bbEmbed('#dashboard_1_1').ejDashboardViewer({ - // accessToken: accessToken, - // serviceUrl: dashboardServiceUrl, - // serverUrl: dashboardServerUrl, - // _enableHyperLinkOnErrorMessage: false, - // cdnFilePath: isUseCdn ? cdnLink + "/scripts/viewer" : "", - dashboardPath: itemDetail.ColumnInfo.Column[0].Item[0].Path, - _itemId: itemDetail.ColumnInfo.Column[0].Item[0].ItemId, - reportName: '', - reportDescription: '', - enableExport: true, - enablePrint: false, - showGetLinkIcon: false, - localeSettings: { - resourcePath: '' - }, - interactionSettings: { - allowHistoryMaintenance: false, - handleHistoryEvent: false - }, - enableWidgetMode: false, - filterParameters: itemDetail.ColumnInfo.Column[0].Item[0].QueryString, - showTab: itemDetail.ColumnInfo.Column[0].Item[0].TabId != null ? false : true, - _selectedTabGuid: itemDetail.ColumnInfo.Column[0].Item[0].TabId != null ? itemDetail.ColumnInfo.Column[0].Item[0].TabId : '', - beforeControlMenuOpen: function (e) { - e.menuData.splice(1, 1); - }, - onTabSelectionFailure: 'OnFailtoLoadChildDashboard', - beforeContextMenuOpen: function (e) { - const removeByAttr = function (arr, attr, value) { - let i = arr.length; - while (i--) { - if (arr[`${i}`] && Object.prototype.hasOwnProperty.call(arr[`${i}`], attr) && (arguments.length > 2 && arr[`${i}`][`${attr}`] == value)) { - arr.splice(i, 1); - } - } - return arr; - }; - removeByAttr(e.menuData, 'text', 'Export'); - } - }); - } - else { - if (!column[0].Item[0].IsActive) { - bbEmbed('#dashboard_1_1').append('
    This dashboard has been deleted.
    '); - } - else if (column[0].Item[0].IsActive && !column[0].Item[0].IsHavingPermission) { - bbEmbed('#dashboard_1_1').append('
    You do not have permission to view this dashboard.
    '); - } - else if (column[0].Item[0].IsActive && column[0].Item[0].IsHavingPermission && column[0].Item[0].ItemExtension.toLowerCase() == '.sydj') { - bbEmbed('#dashboard_1_1').append('
    Currently this dashboard is not supported.
    '); - } - } - bbEmbed('#widget-container').show(); - //hideWaitingPopup("content-area"); - } - } - _addWidgetInPinboard(itemDetails) { - const ulElement = bbEmbed('#widget-container').find('ul:first'); - if (bbEmbed('#widget-container').find('ul:first li').length == 1 && bbEmbed('#widget-container').find('ul:first li').hasClass('empty')) { - bbEmbed('#widget-container').find('ul:first li').remove(); - } - const ulElementLilength = bbEmbed('#widget-container').find('ul:first li').length; - const column = itemDetails.ColumnInfo.Column[0]; - const item = column.Item[0].Id == null ? '/bi/' + this.siteIdentifier + '/widgets/widgets' : '/bi/' + this.siteIdentifier + '/dashboards'; - const itemName = column.Item[0].Name; - const widgetType = column.Item[0].WidgetType; - let height = 0; - if (widgetType != null && (widgetType.includes('Card') || widgetType.includes('Image'))) { - height = 250; - } - else { - height = 400; - } - const queryString = column.Item[0].QueryString != null ? column.Item[0].QueryString : ''; - const href = column.Item[0].TabId == null ? (item + '/' + column.Item[0].ItemId + '/' + (column.Item[0].Id != null ? (column.Item[0].CategoryName + '/') : '') + column.Item[0].ItemName + (queryString != '' ? '?' + queryString : queryString)) : (item + '/' + column.Item[0].ItemId + '/' + (column.Item[0].Id != null ? (column.Item[0].CategoryName + '/') : '') + column.Item[0].ItemName + '?tab=' + column.Item[0].TabId + (queryString != '' ? '&' + queryString : queryString)); - const deleteIconDiv = this.embedOptions.pinboardSettings.enableUnpinWidget || this.embedOptions.pinboardSettings.enableUnpinWidget === undefined ? '
    ' : ''; - bbEmbed(ulElement).prepend('
  • ' + itemName + '
    ' + deleteIconDiv + '
  • '); - const pinboardIdName = this.embedOptions.embedContainerId + '_pinBoard_1' + '_' + (ulElementLilength + 1); - bbEmbed('#widget_1' + '_' + (ulElementLilength + 1)).append('
    '); - this.pinBoardRendered = false; - this.pinboardIds.push({ 'widgetId': column.Item[0].Id, 'pinboardContainerId': pinboardIdName }); - this.loadDashboardWidget(column.Item[0].Id, column.Item[0].ItemId); - this.enableSorting(); - this.setListMinimumHeight(); - this._removeElementsClass(this.embedOptions.embedContainerId, '.preloader-wrap', 'viewer-blue-loader'); - } - _tabSelected() { - const containerName = window.bbEmbed('.multitab-dbrd').attr('id'); - for (let i = 0; i < window.bbEmbed('#' + containerName + ' .e-toolbar-item').length; i++) { - window.bbEmbed('.e-content').find('#e-content-' + containerName + '_' + i).attr('style', 'display:block !important'); - if (window.bbEmbed('#' + containerName + ' .e-toolbar-item.e-active').attr('aria-controls') == 'e-content-' + containerName + '_' + i) { - window.bbEmbed(window.bbEmbed('.e-content').find('#e-content-' + containerName + '_' + i).children()).css({ 'display': 'block', 'position': 'absolute', 'left': 0 }); - const dbrdInstance = window.bbEmbed('#' + window.bbEmbed(window.bbEmbed('.e-content').find('#e-content-' + containerName + '_' + i).children()).children().attr('id')).data('BoldBIDashboardDesigner'); - if (dbrdInstance == null || dbrdInstance == undefined) { - const dashboardId = window.bbEmbed('.e-content').find('#e-content-' + containerName + '_' + i).children().attr('id').split('_')[1]; - const response = { - Apistatus: true, - Data: this.dashboardDetails[`${dashboardId}`], - Status: true - }; - this._renderDashboard(response); - } - } - else { - window.bbEmbed(window.bbEmbed('.e-content').find('#e-content-' + containerName + '_' + i).children()).css({ 'display': 'block', 'position': 'absolute', 'left': window.bbEmbed('.e-content.e-lib.e-touch').width() * (i + 1) }); - } - } - } - _isDependencyLoaded(that, dashboardId) { - if (window.bbEmbed instanceof Function && - window.BoldBIDashboard instanceof Object && !that._isNullOrUndefined(window.BoldBIDashboard) && - window.BoldBIDashboard.Designer instanceof Object && - window.BoldBIDashboardDesigner instanceof Function && - !that._isEmptyOrSpaces(that.designerRootUrl) && - window.Designer instanceof Object) { - if (!that.IsDependencyLoaded) { - that.IsDependencyLoaded = true; - } - if (that.embedOptions.token) { - if (that.embedOptions.dashboardPath && !that.embedOptions.dashboardId) { - that._throwError('Token API does not support rendering dashboard with dashboardPath'); - } - else if (that.embedOptions.datasourceName && !that.embedOptions.datasourceId) { - that._throwError('Token API does not support rendering dashboard with datasourceName'); - } - else if (that.embedOptions.viewName && !that.embedOptions.viewId) { - that._throwError('Token API does not support rendering dashboard with viewName'); - } - else if ((that.isDashboardRendering && that.embedOptions.dashboardId) || (that.isPinboardRendering && that.embedOptions.pinboardName)) { - const apiUrl = that.isDashboardRendering ? that.dashboardServerApiUrl + '/v5.0/dashboards/' + that.embedOptions.dashboardId : that.dashboardServerApiUrl + '/pinboard/' + that.embedOptions.pinboardName; - bbEmbed.ajax({ - async: false, - type: 'GET', - url: apiUrl, - headers: { - 'Authorization': 'bearer ' + that.embedOptions.token - }, - contentType: 'application/json', - success: function (result) { - const resultData = (that.isDashboardRendering && result.IsMultiDashboard && that.embedOptions.mode == BoldBI.Mode.Design) ? 'Designer embedding' : (that.isDashboardRendering && result.IsMultiDashboard) ? result.TabDetail : (that.isPinboardRendering && result.Status) ? result.Data : that.tokenResponse; - if (resultData != 'Designer embedding') { - that._renderDashboard({ Apistatus: true, Data: resultData, Status: true }); - } - else { - that._throwError('Cannot render Multitab dashboard in designer mode'); - } - }, - error: function (jqXHR) { - if (jqXHR.status == 401) { - that._throwError('Please provide valid access token'); - } - else if (jqXHR.status == 404 && that.isDashboardRendering) { - that._throwError('Please provide valid dashboard ID'); - } - else { - that._throwError('Please provide valid pinboard name'); - } - } - }); - } - else if (that.embedOptions.viewId && that.isDashboardViewRendering) { - bbEmbed.ajax({ - async: false, - type: 'GET', - url: that.dashboardServerApiUrl + '/v5.0/dashboards/views/' + that.embedOptions.viewId, - headers: { - 'Authorization': 'bearer ' + that.embedOptions.token - }, - contentType: 'application/json', - success: function (result) { - if (that._isNullOrUndefined(that.embedOptions.dashboardSettings.filterOverviewSettings)) { - that.embedOptions.dashboardSettings.filterOverviewSettings = {}; - } - that.embedOptions.dashboardId = result.ItemId; - that.embedOptions.dashboardSettings.filterOverviewSettings.viewId = that.embedOptions.viewId; - that.embedOptions.dashboardSettings.filterOverviewSettings.viewName = result.ViewName; - that.embedOptions.filterParameters = result.QueryString; - that._renderDashboard({ Apistatus: true, Data: that.tokenResponse, Status: true }); - }, - error: function (jqXHR) { - if (jqXHR.status == 401) { - that._throwError('Please provide valid access token'); - } - else if (jqXHR.status == 400) { - that._throwError('Please provide valid view ID'); - } - else if (jqXHR.status == 404) { - that._throwError('View details not found'); - } - } - }); - } - else if (that.widgetName) { - const regex = /^(?:\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\}{0,1})$/; - const isGuidDbrd = regex.exec(that.widgetName); - if (!isGuidDbrd) { - that._throwError('Token API does not support rendering widget with widgetName'); - } - else { - that._renderDashboard({ Apistatus: true, Data: that.tokenResponse, Status: true }); - } - } - else { - that._renderDashboard({ Apistatus: true, Data: that.tokenResponse, Status: true }); - } - } - else { - that._getAuthorizationToken(dashboardId); - } - } - else { - setTimeout(that._isDependencyLoaded, 500, that); - } - } - _getDashboardInstance(embedChildId) { - const ele = window.bbEmbed.call(this, '#' + (embedChildId ? embedChildId : this.childContainer.id))[0]; - if (ele) { - return window.bbEmbed.data.call(this, ele, 'BoldBIDashboardDesigner'); - } - } - _checkWidgetList() { - if (this.embedOptions.widgetList.length > 0 && !this.embedOptions.embedContainerId) { - const error = 'Error: For rendering multiple widgets, please use the method loadMultipleWidget()'; - this.embedOptions.widgetList.forEach((widget) => { - const containerId = widget.containerId; - const errorMessage = '
    BoldBI Embedded: ' + error + '
    '; - document.getElementById(containerId).innerHTML = errorMessage; - }); - return true; - } - else { - this.embedOptions.widgetList = ''; - return false; - } - } - _onBoldBIDashboardInstaceActionBegin(arg, embedContainerId) { - if (this.isMultiTab && parseInt(bbEmbed('.e-content .e-active').attr('id').split('_')[bbEmbed('.e-content .e-active').attr('id').split('_').length - 1], 10) == 0) { - const dashboadInstance = bbEmbed('.e-content .e-active').find('.bbembed-multitab-dbrd').data('BoldBIDashboardDesigner'); - this.setDefaultTheme(dashboadInstance.modules.themeHelper.getBannerBackground(), dashboadInstance.modules.themeHelper.getBannerTextColor(), dashboadInstance.modules.themeHelper.getBannerIconColor()); - } - if (typeof (arg) != 'undefined') { - switch (arg.eventType) { - case 'renderLayout': - this._removeElementsClass(embedContainerId, '.preloader-wrap', 'viewer-blue-loader'); - break; - default: - break; - } - } - // Hiding the Refresh Setting button in connection embedding. - if (this.embedOptions.mode == BoldBI.Mode.Connection || this.embedOptions.mode == BoldBI.Mode.Design) { - const style = document.createElement('style'); - style.type = 'text/css'; - // Define the CSS rule to hide the refresh setting button in the webAPI connector. - const cssCode = '#' + this.embedOptions.embedContainerId + '_embeddedbi_newConnection_webDs_schedule_tr .bbi-dbrd-datasource-schedule { display: none }'; - style.appendChild(document.createTextNode(cssCode)); - document.head.appendChild(style); - } - const serverFnc = window[this.actionBeginFn]; - if (serverFnc instanceof Function) { - serverFnc.call(this, arg); - } - const clientFnc = window[this.embedOptions.actionBegin]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.actionBegin instanceof Function) { - this.embedOptions.actionBegin.call(this, arg); - } - if (arg.eventType == 'dataSourceSaveAction') { - this._onBoldBIBeforeDatasourceSaveAction(arg); - } - if (arg.eventType == 'filterInteraction') { - const clientFnc = window[this.embedOptions.beforeFilterApply]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.beforeFilterApply instanceof Function) { - this.embedOptions.beforeFilterApply.call(this, arg); - } - } - if (arg.eventType == 'publishAsAction') { - const clientFnc = window[this.embedOptions.dashboardSettings.beforePublishAs]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.dashboardSettings.beforePublishAs instanceof Function) { - this.embedOptions.dashboardSettings.beforePublishAs.call(this, arg); - } - } - } - _onBoldBIDashboardInstaceActionComplete(arg) { - const that = this; - let data; - const serverFnc = window[this.actionCompleteFn]; - if (!this._isNullOrUndefined(arg.data)) { - if (arg.data.event == 'createConnection') { - this.embedOptions.datasourceId = arg.data.source.data; - this.embedOptions.mode = BoldBI.Mode.DataSource; - this.isNewConnection = true; - if (that.embedOptions.token) { - that._renderDashboard({ Apistatus: true, Data: this.tokenResponse, Status: true }); - } - else if (!that._isEmptyOrSpaces(that.embedOptions.authorizationServer.url)) { - this._getAuthorizationToken(); - } - else { - data = { - 'embed_datasource_id': that.embedOptions.datasourceId, - 'embed_mode': that.embedOptions.mode - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: that.dashboardServerApiUrl + this.embedGetDetailsEndPoint, - headers: { - 'Authorization': 'Bearer ' + that.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: bbEmbed.proxy(that._renderDashboard, that) - }); - } - } - if (arg.data.event == 'cancelDataSource') { - this.embedOptions.mode = BoldBI.Mode.Connection; - if (that.embedOptions.token) { - that._renderDashboard({ Apistatus: true, Data: this.tokenResponse, Status: true }); - } - else if (!that._isEmptyOrSpaces(that.embedOptions.authorizationServer.url)) { - this._getAuthorizationToken(); - } - else { - data = { - 'embed_mode': that.embedOptions.mode - }; - bbEmbed.ajax({ - async: false, - type: 'POST', - url: that.dashboardServerApiUrl + this.embedGetDetailsEndPoint, - headers: { - 'Authorization': 'Bearer ' + that.accessToken - }, - data: JSON.stringify(data), - contentType: 'application/json', - success: bbEmbed.proxy(that._renderDashboard, that) - }); - } - } - } - if (this.pinboardIds.length > 0 && arg.eventType === 'renderWidget') { - const controlHeaderWrapper = arg.source.element.find('.bbi-dbrd-control-header .bbi-dbrd-control-title-wrapper'); - if (controlHeaderWrapper.length === 0) { - arg.source.element.parents('.widget').find('#widget-icons').css('margin-top', '8px'); - if (arg.source.element.attr('data-name').toLowerCase().includes('card')) { - arg.source.element.find('.bbi-dbrd-control').css('top', '20px'); - } - } - else { - arg.source.element.find('.bbi-dbrd-control-header').css('margin-left', '-8px'); - arg.source.element.find('.bbi-dbrd-control-title-wrapper').css('margin-left', '8px'); - } - } - if (arg.eventType == 'interactionCompleted') { - data = { - filterData: this._getFilterData(arg.source.data.encryptedData), - data: arg - }; - const clientFnc = window[this.embedOptions.dashboardSettings.onInteraction]; - if (clientFnc instanceof Function) { - clientFnc.call(this, data); - } - if (this.embedOptions.dashboardSettings.onInteraction instanceof Function) { - this.embedOptions.dashboardSettings.onInteraction.call(this, arg); - } - } - else { - if (serverFnc instanceof Function) { - serverFnc.call(this, arg); - } - const clientFnc = window[this.embedOptions.actionComplete]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.actionComplete instanceof Function) { - this.embedOptions.actionComplete.call(this, arg); - } - } - if (arg.eventType == 'filterInteraction') { - const clientFnc = window[this.embedOptions.afterFilterApply]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.afterFilterApply instanceof Function) { - this.embedOptions.afterFilterApply.call(this, arg); - } - } - if (arg.eventType == 'dataSourceSaveAction' && JSON.parse(arg.schema.schema).length > 0) { - this._onBoldBIAfterDatasourceSaveAction(arg); - } - } - _onBoldBIBeforeDatasourceSaveAction(arg) { - const clientFnc = window[this.embedOptions.beforeDatasourceSave]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.beforeDatasourceSave instanceof Function) { - this.embedOptions.beforeDatasourceSave.call(this, arg); - } - } - _onBoldBIAfterDatasourceSaveAction(arg) { - const clientFnc = window[this.embedOptions.afterDatasourceSave]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.afterDatasourceSave instanceof Function) { - this.embedOptions.afterDatasourceSave.call(this, arg); - } - } - _onBoldBIDashboardBeforeBannerIconRender(arg) { - const themeGroup = arg.iconsinformation.shift(); - const filterOverviewOption = arg.iconsinformation.shift(); - const refreshGroup = arg.iconsinformation.shift(); - if (this.embedOptions.dashboardSettings.showMoreOption == false || this.embedOptions.dashboardSettings.showExport == false || (this.embedOptions.exportSettings.showExcel == false && this.embedOptions.exportSettings.showImage == false && this.embedOptions.exportSettings.showPDF == false && this.embedOptions.exportSettings.showCSV == false)) { - arg.iconsinformation = this._arraySlice(arg.iconsinformation, 'groupName', 'Option'); - } - if (this.embedOptions.dashboardSettings.showDashboardParameter == false) { - for (let i = filterOverviewOption.items.length - 1; i >= 0; i--) { - if (!this._isNullOrUndefined(filterOverviewOption.items[`${i}`]) && filterOverviewOption.items[`${i}`][0].dataset['name'] == 'dashboardparameters') { - filterOverviewOption.items.splice(i, 1); - } - } - } - if (this.embedOptions.dashboardSettings.showRefresh == false) { - refreshGroup.items.splice(0, 1); - } - const serverFnc = window[this.beforeBannerIconRenderFn]; - if (this.embedOptions.dashboardSettings.enableFullScreen) { - const refreshAndFullScreen = { - groupId: 'refresh-fullscreen', - groupName: 'Refresh & FullScreen', - enableGroupSeperator: true, - items: [ - this._createBannerIcon('
    ', 'dashboard-refresh', 'e-dbrd-banner-refresh', 'Refresh', 'refreshdashboard', true, false, { 'display': 'none', 'font-size': '14px' }), - this._createBannerIcon('
    ', 'dashboard-fullscreen', this.isFullscreen ? 'su su-minimize' : 'su su-maximize-1', 'Fullscreen', 'fullscreen', true, false, { 'font-size': '14px' }) - ] - }; - arg.iconsinformation.unshift(refreshAndFullScreen); - } - if (refreshGroup.items.length > 0) { - arg.iconsinformation.unshift(refreshGroup); - arg.iconsinformation[0].enableGroupSeperator = this.embedOptions.dashboardSettings.enableFullScreen ? false : true; - } - if (filterOverviewOption.items.length > 0) { - arg.iconsinformation.unshift(filterOverviewOption); - } - if (themeGroup.items.length > 0) { - arg.iconsinformation.unshift(themeGroup); - } - if (serverFnc instanceof Function) { - serverFnc.call(this, arg); - } - const clientFnc = window[this.embedOptions.dashboardSettings.beforeIconRender]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.dashboardSettings.beforeIconRender instanceof Function) { - this.embedOptions.dashboardSettings.beforeIconRender.call(this, arg); - } - bbEmbed('').appendTo('head'); - } - _createBannerIcon(tag, id, className, label, dataName, dataEvent, showText, css, href) { - if (showText) { - return bbEmbed(tag, { - id: id, - html: bbEmbed('', { 'class': 'icon-with-label', text: label, css: { 'font-family': 'Roboto', 'padding': '10px' } }), - 'class': 'server-banner-icon e-dashboard-banner-icon bbi-dbrd-designer-hoverable ' + className, - 'data-name': dataName, - 'data-event': dataEvent, - 'href': href, - css: css - }); - } - else { - return bbEmbed(tag, { - id: id, - 'class': 'server-banner-icon e-dashboard-banner-icon bbi-dbrd-designer-hoverable ' + className, - 'data-tooltip': label, - 'data-name': dataName, - 'data-event': dataEvent, - css: css - }); - } - } - _onBoldBIDashboardBeforeOtherOptionContextMenuRender(arg) { - if (this.embedOptions.dashboardSettings.showExport == false) { - arg.iconsinformation = this._arraySlice(arg.iconsinformation, 'groupName', 'export'); - } - const serverFnc = window[this.beforeOtherRenderFn]; - if (serverFnc instanceof Function) { - serverFnc.call(this, arg); - } - const clientFnc = window[this.embedOptions.beforeContextMenuRender]; - if (clientFnc instanceof Function) { - clientFnc.call(this, arg); - } - if (this.embedOptions.beforeContextMenuRender instanceof Function) { - this.embedOptions.beforeContextMenuRender.call(this, arg); - } - } - _onBoldBIDashboardSaveFilter(arg) { - const that = this; - const SaveEvent = that.embedOptions.dashboardSettings.beforeSaveViewDialogOpen || that.embedOptions.dashboardSettings.saveFilterClick; - const serverFnc = window[that.beforeSaveViewDialogOpenFn]; - if (serverFnc instanceof Function) { - serverFnc.call(that, arg); - } - const clientFnc = window[`${SaveEvent}`]; - if (clientFnc instanceof Function) { - clientFnc.call(that, arg); - } - if (SaveEvent instanceof Function) { - SaveEvent.call(that, arg); - } - if (arg.cancel === false) { - if (that.embedOptions.dashboardId == '' && that.embedOptions.dashboardIds == '') { - console.error('Please provide DashboardId in BoldBI.Create().'); - } - else { - // If arg.viewId is defined, it will update the existing View; if undefined or null, it will create a new View. - bbEmbed('body').find('#save_view_dialog_wrapper').remove(); - let dashboardId; - if (that.embedOptions.dashboardIds && that.embedOptions.dashboardIds.length > 0) { - dashboardId = that.embedOptions.dashboardId = that._getActiveChildDashboardId(); - } - else { - dashboardId = that.isMultiTab ? that._getActiveChildDashboardId() : that.embedOptions.dashboardId; - } - if (arg.viewId) { - const viewParameters = { - ViewId: arg.viewId, - DashboardId: dashboardId, - QueryString: arg.data.encryptedData - }; - that.updateFilterView(viewParameters, function (view, message) { - console.log(message + ' and you can add custom functionalities using viewId: ' + view.ViewId); - }); - } - else { - that._createSaveViewDialog(arg); - } - } - } - } - _addSaveViewDialogStyles() { - bbEmbed(' ').appendTo('head'); - } - _createSaveViewDialog(args) { - const that = this; - that._addSaveViewDialogStyles(); - const saveViewDialogWrapper = bbEmbed('
    ') - .attr('id', 'save_view_dialog_wrapper') - .appendTo('body'); - const saveViewDialog = bbEmbed('
    ') - .attr('id', 'save_view_dialog') - .appendTo(saveViewDialogWrapper); - const saveViewHeader = '
    ' + - '' + - '
    Save View
    ' + - '
    '; - const saveViewContent = ` -
    -
    - -
    - - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - `; - const saveViewFooter = bbEmbed('
    ') - .attr('id', 'save_view_dialog_footer'); - const saveButton = bbEmbed('