Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Scenario Based Samples/Dashboard and Widget Comment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# embedded-bi-samples
This project contains the embedded samples in different platforms, Customer requirement samples and POC.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To run this sample, please refer below help link
https://help.syncfusion.com/bold-bi/embedded-bi/javascript/sample/v3-3-40/asp-net-core

To find more customization and feature, please refer this SDK sample site
http://embed-sdk.boldbi.com/
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.Server.EmbedBoldBI", "Syncfusion.Server.EmbedBoldBI\Syncfusion.Server.EmbedBoldBI.csproj", "{1796FF86-6F6F-4BE2-91EB-462E96CA0144}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1796FF86-6F6F-4BE2-91EB-462E96CA0144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1796FF86-6F6F-4BE2-91EB-462E96CA0144}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1796FF86-6F6F-4BE2-91EB-462E96CA0144}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1796FF86-6F6F-4BE2-91EB-462E96CA0144}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F3882DBD-819F-4717-8B4D-8E335CD4E701}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "3.1.3",
"commands": [
"dotnet-ef"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using System;
using System.Net.Http;
using Microsoft.AspNetCore.Mvc;
using Syncfusion.Server.EmbedBoldBI.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Security.Cryptography;

namespace Syncfusion.Server.EmbedBoldBI.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}


[HttpGet]
[Route("GetDashboards")]
public string GetDashboards()
{
var token = GetToken();

using (var client = new HttpClient())
{
client.BaseAddress = new Uri(EmbedProperties.RootUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Add("Authorization", token.TokenType + " " + token.AccessToken);
var result = client.GetAsync(EmbedProperties.RootUrl + "/api/" + EmbedProperties.SiteIdentifier + "/v2.0/items?ItemType=2").Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
return resultContent;
}
}

public Token GetToken()
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(EmbedProperties.RootUrl);
client.DefaultRequestHeaders.Accept.Clear();

var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("grant_type", "password"),
new KeyValuePair<string, string>("UserId", EmbedProperties.UserEmail),
new KeyValuePair<string, string>("Password", EmbedProperties.UserPassword)
});
var result = client.PostAsync(EmbedProperties.RootUrl + "/api/" + EmbedProperties.SiteIdentifier + "/get-user-key", content).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
var response = JsonConvert.DeserializeObject<TokenObject>(resultContent);//Token token = new Token();
var tokenObj = JsonConvert.DeserializeObject<Token>(response.Token);
return tokenObj;
}
}

[HttpPost]
[Route("GetDetails")]
public string GetDetails([FromBody] object embedQuerString)
{
var embedClass = Newtonsoft.Json.JsonConvert.DeserializeObject<EmbedClass>(embedQuerString.ToString());

var embedQuery = embedClass.embedQuerString;
// User your user-email as embed_user_email
embedQuery += "&embed_user_email=" + EmbedProperties.UserEmail;
//double timeStamp = DateTimeToUnixTimeStamp(DateTime.UtcNow);
//embedQuery += "&embed_server_timestamp=" + timeStamp;
var embedDetailsUrl = "/embed/authorize?" + embedQuery + "&embed_signature=" + GetSignatureUrl(embedQuery);

using (var client = new HttpClient())
{
client.BaseAddress = new Uri(embedClass.dashboardServerApiUrl);
client.DefaultRequestHeaders.Accept.Clear();

var result = client.GetAsync(embedClass.dashboardServerApiUrl + embedDetailsUrl).Result;
//var result = client.GetAsync("http://localhost:51778/bi/api/site/site1" + embedDetailsUrl).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
return resultContent;
}

}

public string GetSignatureUrl(string queryString)
{
if (queryString != null)
{
var encoding = new System.Text.UTF8Encoding();
var keyBytes = encoding.GetBytes(EmbedProperties.EmbedSecret);
var messageBytes = encoding.GetBytes(queryString);
using (var hmacsha1 = new HMACSHA256(keyBytes))
{
var hashMessage = hmacsha1.ComputeHash(messageBytes);
return Convert.ToBase64String(hashMessage);
}
}
return string.Empty;
}
static double DateTimeToUnixTimeStamp(DateTime dateTime)
{
DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
long unixTimeStampInTicks = (dateTime.ToUniversalTime() - unixStart).Ticks;
return unixTimeStampInTicks / TimeSpan.TicksPerSecond;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace Syncfusion.Server.EmbedBoldBI.Models
{
[DataContract]
public class EmbedClass
{
[DataMember]
public string embedQuerString { get; set; }
[DataMember]
public string dashboardServerApiUrl { get; set; }
}

public class TokenObject
{
public string Message { get; set; }

public string Status { get; set; }

public string Token { get; set; }
}

public class Token
{
[JsonProperty("access_token")]
public string AccessToken {get;set;}

[JsonProperty("token_type")]
public string TokenType {get;set; }

[JsonProperty("expires_in")]
public string ExpiresIn {get; set;}

[JsonProperty("email")]
public string Email {get;set;}

public string LoginResult {get;set;}

public string LoginStatusInfo {get;set;}

[JsonProperty(".issued")]
public string Issued { get; set; }

[JsonProperty(".expires")]
public string Expires { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
namespace Syncfusion.Server.EmbedBoldBI.Models
{

//public class EmbedProperties
//{
// //Dashboard Server BI URL (ex: http://localhost:5000/bi, http://demo.boldbi.com/bi)
// public static string RootUrl = "https://dev-linux-upgrade-test.boldbi.com/bi";

// //For Bold BI Enterprise edition, it should be like `site/site1`. For Bold BI Cloud, it should be empty string.
// public static string SiteIdentifier = "site/site1";

// //Your Bold BI application environment. (If Cloud, you should use `cloud`, if Enterprise, you should use `enterprise`)
// public static string Environment = "enterprise";

// //Enter DashboardId you want to render
// public static string DashboardId = "";

// //Enter your BoldBI credentials here.
// public static string UserEmail = "admin@boldbi.com";
// public static string UserPassword = "Admin@123";

// // Get the embedSecret key from Bold BI.Please refer this link(https://help.syncfusion.com/bold-bi/on-premise/site-settings/embed-settings)
// public static string EmbedSecret = "kpGN7jUm5XGpmbJpZPalEzns9vpeYd9p";
//}

//public class EmbedProperties
//{
// Dashboard Server BI URL(ex: http://localhost:5000/bi, http://demo.boldbi.com/bi)
// public static string RootUrl = "https://dev-docker-upgrade-test.boldbi.com:4443/bi";
// public static string RootUrl = "https://staging-ds.boldbi.com/bi";

// For Bold BI Enterprise edition, it should be like `site/site1`. For Bold BI Cloud, it should be empty string.
// public static string SiteIdentifier = "site/site1";

// Your Bold BI application environment. (If Cloud, you should use `cloud`, if Enterprise, you should use `enterprise`)
// public static string Environment = "cloud";

// Enter DashboardId you want to render
// public static string DashboardId = "";

// Enter your BoldBI credentials here.
// public static string UserEmail = "alagarsamyd@syncfusion.com";
// public static string UserPassword = "Admin@123";

// Get the embedSecret key from Bold BI.Please refer this link(https://help.syncfusion.com/bold-bi/on-premise/site-settings/embed-settings)
// public static string EmbedSecret = "6WQ9GRGEWomCBL3FD73Y9Tw38nlqXSCn";
//}


public class EmbedProperties
{
// Dashboard Server BI URL(ex: http://localhost:5000/bi, http://demo.boldbi.com/bi)
public static string RootUrl = "http://localhost:54879/bi";

// For Bold BI Enterprise edition, it should be like `site/site1`. For Bold BI Cloud, it should be empty string.
public static string SiteIdentifier = "site/site1";

// Your Bold BI application environment. (If Cloud, you should use `cloud`, if Enterprise, you should use `enterprise`)
public static string Environment = "enterprise";
// public static string Environment = "onpremise";

// Enter DashboardId you want to render
public static string DashboardId = "d64dc9ca-0f96-464d-a117-da3ba0bf161e";

// Enter your BoldBI credentials here.
public static string UserEmail = "suryavijayakumar.sf4316@gmail.com";
public static string UserPassword = "Surya@1232002";

// Get the embedSecret key from Bold BI.Please refer this link(https://help.syncfusion.com/bold-bi/on-premise/site-settings/embed-settings)
public static string EmbedSecret = "6eVa8kIe3TJilZZYEub9bY48zSN3qse7";
}

//public class EmbedProperties
//{
// //BoldBI server URL (ex: http://localhost:5000/bi, http://demo.boldbi.com/bi)
// public static string RootUrl = "https://demo-datebucket.boldbi.com/bi";

// //For Bold BI Enterprise edition, it should be like `site/site1`. For Bold BI Cloud, it should be empty string.
// public static string SiteIdentifier = "site/site1";

// //Your Bold BI application environment. (If Cloud, you should use `cloud`, if Enterprise, you should use `enterprise`)
// public static string Environment = "enterprise";

// //Enter your BoldBI credentials here.
// public static string UserEmail = "demo@boldbi.com";
// public static string UserPassword = "Demo$786";

// // Get the embedSecret key from Bold BI, please check this link(https://help.syncfusion.com/bold-bi/on-premise/site-settings/embed-settings)
// public static string EmbedSecret = "pnKJyu6Xr3U31xyBK6LmSy5IDsPKYKOi";
//}


//public class EmbedProperties
//{
// //BoldBI server URL (ex: http://localhost:5000/bi, http://demo.boldbi.com/bi)
// public static string RootUrl = "https://dev-ds-cloud.boldbi.com/bi";

// //For Bold BI Enterprise edition, it should be like `site/site1`. For Bold BI Cloud, it should be empty string.
// public static string SiteIdentifier = "";

// //Your Bold BI application environment. (If Cloud, you should use `cloud`, if Enterprise, you should use `enterprise`)
// public static string Environment = "cloud";

// //Enter your BoldBI credentials here.
// public static string UserEmail = "naveena.thangaraj@syncfusion.com";
// public static string UserPassword = "Saibaba$96";

// // Get the embedSecret key from Bold BI, please check this link(https://help.syncfusion.com/bold-bi/on-premise/site-settings/embed-settings)
// public static string EmbedSecret = "cRoqtr9QNH0ILkEmRYk8VXmJjj4jrPX9";
//}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace Syncfusion.Server.EmbedBoldBI
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>1796ff86-6f6f-4be2-91eb-462e96ca0144</ProjectGuid>
<publishUrl>bin\Release\netcoreapp2.1\publish\</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<TargetFramework>netcoreapp2.1</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PublishTargetUrl>D:\Javascript sample\sample (6)\Syncfusion.Server.EmbedBoldBI\bin\Release\netcoreapp2.1\publish\</_PublishTargetUrl>
<History>True|2022-08-16T07:52:44.4405025Z;</History>
</PropertyGroup>
</Project>
Loading