Skip to content

Commit

Permalink
Merge pull request #106 from RevealBi/feat/sandbox
Browse files Browse the repository at this point in the history
Update sandbox UI
  • Loading branch information
hainv-ohio authored Dec 4, 2024
2 parents 0a78b79 + 90c8725 commit ff1bb42
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
11 changes: 6 additions & 5 deletions e2e/Sandbox/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button Click="Load_Dashboard">Load Dashboard</Button>
<Button Click="Read_Dashboard">Read Dashboard</Button>
<Button Click="Create_Dashboard">Create Dashboard</Button>
<Button Click="Clear_Dashboard">Clear Dashboard</Button>
<Button Click="Read_Dashboard">Read Dashboard</Button>
<Button Click="Clear_Dashboard" Content="Clear Dashboard"/>
</StackPanel>

<rv:RevealView Grid.Row="1" x:Name="_revealView" ShowEditDataSource="True" ShowDataBlending="True"
SaveDashboard="RevealView_SaveDashboard"/>
SaveDashboard="RevealView_SaveDashboard" Margin="0,34,0,0"/>
<ComboBox Name="_dashboardTypeSelector" HorizontalAlignment="Left" Margin="1,5,0,0" Grid.Row="1" VerticalAlignment="Top" Width="120"/>
<Button Content="Create Dashboard with Type" Name="_createDashboardWithTypeBtn" HorizontalAlignment="Left" Margin="126,6,0,0" Grid.Row="1" VerticalAlignment="Top" Width="164" Click="CreateDashboardWithTypeBtn_Click"/>
</Grid>

</Window>
44 changes: 29 additions & 15 deletions e2e/Sandbox/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public partial class MainWindow : Window
static readonly string _dashboardFilePath = Path.Combine(Environment.CurrentDirectory, "Dashboards");

//readonly string _readFilePath = Path.Combine(_dashboardFilePath, DashboardFileNames.Sales);
readonly string _readFilePath = Path.Combine(_dashboardFilePath, "New Dashboard.rdash");
readonly string _readFilePath = Path.Combine(_dashboardFilePath, "Healthcare.rdash");

readonly string _saveJsonToPath = Path.Combine(_dashboardFilePath, "MyDashboard.json");
readonly string _saveRdashToPath = Path.Combine(_dashboardFilePath, DashboardFileNames.MyDashboard);
Expand All @@ -59,6 +59,7 @@ public MainWindow()
RevealSdkSettings.DataSourceProvider = new Sandbox.RevealSDK.DataSourceProvider();
RevealSdkSettings.AuthenticationProvider = new AuthenticationProvider();
RevealSdkSettings.DataSources.RegisterMicrosoftSqlServer().RegisterMicrosoftAnalysisServices();
_dashboardTypeSelector.ItemsSource = Enum.GetValues(typeof(DataSourceType)).Cast<DataSourceType>();

_revealView.LinkedDashboardProvider = (string dashboardId, string linkTitle) =>
{
Expand Down Expand Up @@ -216,21 +217,34 @@ private async void Read_Dashboard(object sender, RoutedEventArgs e)
_revealView.Dashboard = await RVDashboard.LoadFromJsonAsync(json);
}

private async void Create_Dashboard(object sender, RoutedEventArgs e)
private async void CreateDashboardWithTypeBtn_Click(object sender, RoutedEventArgs e)
{
//var document = MarketingDashboard.CreateDashboard();
var document = SalesDashboard.CreateDashboard();
//var document = CampaignsDashboard.CreateDashboard();
//var document = HealthcareDashboard.CreateDashboard();
//var document = ManufacturingDashboard.CreateDashboard();
//var document = CustomDashboard.CreateDashboard();
//var document = RestDataSourceDashboards.CreateDashboard();
//var document = SqlServerDataSourceDashboards.CreateDashboard();
//var document = DashboardLinkingDashboard.CreateDashboard();

var json = document.ToJsonString();

_revealView.Dashboard = await RVDashboard.LoadFromJsonAsync(json);
var selectedDSTypeItem = _dashboardTypeSelector.SelectedItem;
if (selectedDSTypeItem != null)
{
var dataSourceType = _dashboardTypeSelector.SelectedItem;
RdashDocument document = null;
switch (dataSourceType)
{
case DataSourceType.REST:
document = SalesDashboard.CreateDashboard();
break;
case DataSourceType.MicrosoftSqlServer:
break;
default:
break;
}

if (document != null)
{
var json = document.ToJsonString();
_revealView.Dashboard = await RVDashboard.LoadFromJsonAsync(json);
}
else
{
_revealView.Dashboard = new RVDashboard();
}
}
}
}
}

0 comments on commit ff1bb42

Please sign in to comment.