Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sandbox UI #106

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
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();
}
}
}
}
}