Skip to content

Commit

Permalink
Merge pull request #53 from RevealBi/dsi-refactor
Browse files Browse the repository at this point in the history
added new data source objects
  • Loading branch information
brianlagunas authored May 17, 2024
2 parents 816d8b3 + 1a44972 commit 07583bf
Show file tree
Hide file tree
Showing 35 changed files with 523 additions and 62 deletions.
21 changes: 19 additions & 2 deletions e2e/Sandbox/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
using Reveal.Sdk;
using Reveal.Sdk.Data;
using Reveal.Sdk.Data.Amazon.Athena;
using Reveal.Sdk.Data.Amazon.Redshift;
using Reveal.Sdk.Data.Amazon.S3;
using Reveal.Sdk.Data.Box;
using Reveal.Sdk.Data.Dropbox;
using Reveal.Sdk.Data.Excel;
using Reveal.Sdk.Data.Google.Analytics4;
using Reveal.Sdk.Data.Google.BigQuery;
using Reveal.Sdk.Data.Google.Drive;
using Reveal.Sdk.Data.Json;
using Reveal.Sdk.Data.Microsoft.AnalysisServices;
using Reveal.Sdk.Data.Microsoft.OneDrive;
using Reveal.Sdk.Data.Microsoft.SqlServer;
using Reveal.Sdk.Data.Microsoft.SynapseAnalytics;
using Reveal.Sdk.Data.MongoDB;
using Reveal.Sdk.Data.MySql;
using Reveal.Sdk.Data.OData;
using Reveal.Sdk.Data.Oracle;
using Reveal.Sdk.Data.PostgreSQL;
using Reveal.Sdk.Data.Rest;
using Reveal.Sdk.Data.Snowflake;
using Reveal.Sdk.Dom;
using Reveal.Sdk.Dom.Data;
using Reveal.Sdk.Dom.Visualizations;
Expand Down Expand Up @@ -189,8 +206,8 @@ private async void Create_Dashboard(object sender, RoutedEventArgs e)
//var document = HealthcareDashboard.CreateDashboard();
//var document = ManufacturingDashboard.CreateDashboard();
//var document = CustomDashboard.CreateDashboard();
var document = RestDataSourceDashboards.CreateDashboard();
//var document = SqlServerDataSourceDashboards.CreateDashboard();
//var document = RestDataSourceDashboards.CreateDashboard();
var document = SqlServerDataSourceDashboards.CreateDashboard();
//var document = DashboardLinkingDashboard.CreateDashboard();

var json = document.ToJsonString();
Expand Down
15 changes: 15 additions & 0 deletions e2e/Sandbox/Sandbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,23 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Reveal.Sdk.Data.Amazon.Athena" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Amazon.Redshift" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Amazon.S3" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Box" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Dropbox" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Google.Analytics4" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Google.BigQuery" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Google.Drive" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Microsoft.AnalysisServices" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Microsoft.OneDrive" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Microsoft.SqlServer" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Microsoft.SynapseAnalytics" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.MongoDB" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.MySql" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Oracle" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.PostgreSQL" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Data.Snowflake" Version="1.6.6" />
<PackageReference Include="Reveal.Sdk.Wpf" Version="1.6.6" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Newtonsoft.Json.Converters;
using Reveal.Sdk.Dom.Core;
using Reveal.Sdk.Dom.Core.Constants;
using Reveal.Sdk.Dom.Core.Extensions;
using System;
using System.Collections.Generic;

Expand Down Expand Up @@ -32,6 +33,12 @@ public string Id

public string Subtitle { get; set; }

public string DefaultRefreshRate
{
get => Properties.GetValue<string>("DefaultRefreshRate");
set => Properties.SetItem("DefaultRefreshRate", value);
}

[JsonProperty]
internal Dictionary<string, object> Properties { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public string Table

protected override void InitializeDataSource(DataSource dataSource, string title)
{
//todo: make generic and place in base class
if (!(dataSource is MicrosoftSqlServerDataSource))
{
var ds = MicrosoftSqlServerDataSource.Create(dataSource);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Reveal.Sdk.Dom.Core.Constants;
using Newtonsoft.Json;
using Reveal.Sdk.Dom.Core.Constants;
using Reveal.Sdk.Dom.Core.Extensions;
using Reveal.Sdk.Dom.Visualizations;
using System.Collections.Generic;
Expand Down Expand Up @@ -32,12 +33,14 @@ public RestDataSourceItem(string title, DataSource dataSource) :
UpdateResourceItemDataSource(_dataSource);
}

[JsonIgnore]
public bool IsAnonymous
{
get { return ResourceItemDataSource.Properties.GetValue<bool>("_rpUseAnonymousAuthentication"); }
set { ResourceItemDataSource.Properties.SetItem("_rpUseAnonymousAuthentication", value); }
}

[JsonIgnore]
public string Uri
{
get { return ResourceItem.Properties.GetValue<string>("Url"); }
Expand Down
24 changes: 24 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/AmazonAthenaDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Newtonsoft.Json;

namespace Reveal.Sdk.Dom.Data
{
internal class AmazonAthenaDataSource : DatabaseSource
{
public AmazonAthenaDataSource()
{
Provider = DataSourceProvider.AmazonAthena;
}

[JsonIgnore]
public string DataCatalog { get; set; }

[JsonIgnore]
public string OutputLocation { get; set; }

[JsonIgnore]
public string Region { get; set; }

[JsonIgnore]
public string Workgroup { get; set; }
}
}
20 changes: 20 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/AmazonRedshiftDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Newtonsoft.Json;
using Reveal.Sdk.Dom.Core.Extensions;

namespace Reveal.Sdk.Dom.Data
{
internal class AmazonRedshiftDataSource : HostDatabaseSource
{
public AmazonRedshiftDataSource()
{
Provider = DataSourceProvider.AmazonRedshift;
}

[JsonIgnore]
public string Schema
{
get => Properties.GetValue<string>("Schema");
set => Properties.SetItem("Schema", value);
}
}
}
18 changes: 18 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/AmazonS3DataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

namespace Reveal.Sdk.Dom.Data
{
internal class AmazonS3DataSource : DataSource
{
public AmazonS3DataSource()
{
Provider = DataSourceProvider.AmazonS3;
}

[JsonIgnore]
public string AccountId { get; set; }

[JsonIgnore]
public string Region { get; set; }
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/BoxDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class BoxDataSource : DataSource
{
public BoxDataSource()
{
Provider = DataSourceProvider.Box;
}
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/DropboxDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class DropboxDataSource : DataSource
{
public DropboxDataSource()
{
Provider = DataSourceProvider.Dropbox;
}
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/GoogleAnalytics4DataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class GoogleAnalytics4DataSource : DataSource
{
public GoogleAnalytics4DataSource()
{
Provider = DataSourceProvider.GoogleAnalytics4;
}
}
}
15 changes: 15 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/GoogleBigQueryDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json;

namespace Reveal.Sdk.Dom.Data
{
internal class GoogleBigQueryDataSource : DatabaseSource
{
public GoogleBigQueryDataSource()
{
Provider = DataSourceProvider.GoogleBigQuery;
}

[JsonIgnore]
public string ProjectId { get; set; }
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/GoogleDriveDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class GoogleDriveDataSource : DataSource
{
public GoogleDriveDataSource()
{
Provider = DataSourceProvider.GoogleDrive;
}
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/GoogleSheetsDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class GoogleSheetsDataSource : DataSource
{
public GoogleSheetsDataSource()
{
Provider = DataSourceProvider.GoogleSheets;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Newtonsoft.Json;

namespace Reveal.Sdk.Dom.Data
{
internal class MicrosoftAnalysisServicesDataSource : DataSource
{
public MicrosoftAnalysisServicesDataSource()
{
Provider = DataSourceProvider.MicrosoftAnalysisServices;
}

[JsonIgnore]
public string Catalog { get; set; }

[JsonIgnore]
public string Host { get; set; }

[JsonIgnore]
public int Port { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json;

namespace Reveal.Sdk.Dom.Data
{
internal class MicrosoftAzureAnalysisServicesDataSource : MicrosoftAnalysisServicesDataSource
{
public MicrosoftAzureAnalysisServicesDataSource()
{
Provider = DataSourceProvider.MicrosoftAzureAnalysisServices;
}

[JsonIgnore]
public string ServerUrl { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json;

namespace Reveal.Sdk.Dom.Data
{
internal class MicrosoftAzureSqlServerDataSource : MicrosoftSqlServerDataSource
{
public MicrosoftAzureSqlServerDataSource()
{
Provider = DataSourceProvider.MicrosoftAzureSqlServer;
}

[JsonIgnore]
public bool TrustServerCertificate { get; set; } //todo: implement
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class MicrosoftAzureSynapseAnalyticsDataSource : MicrosoftAzureSqlServerDataSource
{
public MicrosoftAzureSynapseAnalyticsDataSource()
{
Provider = DataSourceProvider.MicrosoftAzureSynapseAnalytics;
}
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/MicrosoftOneDriveDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class MicrosoftOneDriveDataSource : DataSource
{
public MicrosoftOneDriveDataSource()
{
Provider = DataSourceProvider.MicrosoftOneDrive;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Reveal.Sdk.Dom.Data
{
internal class MicrosoftSharePointDataSource : DataSource
{
public MicrosoftSharePointDataSource()
{
Provider = DataSourceProvider.MicrosoftSharePoint;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Newtonsoft.Json;
using Reveal.Sdk.Dom.Core.Extensions;

namespace Reveal.Sdk.Dom.Data
{
public class MicrosoftSqlServerDataSource : SchemaDatabaseSource
{
public MicrosoftSqlServerDataSource()
{
Provider = DataSourceProvider.MicrosoftSqlServer;
}

[JsonIgnore]
public bool Encrypt
{
get => Properties.GetValue<bool>("Encrypt");
set => Properties.SetItem("Encrypt", value);
}

internal static MicrosoftSqlServerDataSource Create(DataSource dataSource)
{
return new MicrosoftSqlServerDataSource()
{
Id = dataSource.Id,
Title = dataSource.Title,
Subtitle = dataSource.Subtitle,
};
}
}
}
30 changes: 30 additions & 0 deletions src/Reveal.Sdk.Dom/Data/DataSources/MongoDBDataSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Newtonsoft.Json;
using Reveal.Sdk.Dom.Core.Extensions;

namespace Reveal.Sdk.Dom.Data
{
internal class MongoDBDataSource : DatabaseSource
{
public MongoDBDataSource()
{
Provider = DataSourceProvider.MongoDB;
}

[JsonIgnore]
public string ConnectionString { get; set; }

[JsonIgnore]
public bool ProcessDataOnServerDefaultValue
{
get => Properties.GetValue<bool>("ServerAggregationDefault");
set => Properties.SetItem("ServerAggregationDefault", value);
}

[JsonIgnore]
public bool ProcessDataOnServerReadOnly
{
get => Properties.GetValue<bool>("ServerAggregationReadOnly");
set => Properties.SetItem("ServerAggregationReadOnly", value);
}
}
}
Loading

0 comments on commit 07583bf

Please sign in to comment.