Skip to content

Commit 2116209

Browse files
committed
update cs solution
1 parent acb28de commit 2116209

28 files changed

+60042
-0
lines changed

CS/AspNetCoreDashboard.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.2.32516.85
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCoreDashboard", "AspNetCoreDashboard\AspNetCoreDashboard.csproj", "{20720CFB-1F54-4563-8A8D-45EBDE76E0B8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{20720CFB-1F54-4563-8A8D-45EBDE76E0B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{20720CFB-1F54-4563-8A8D-45EBDE76E0B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{20720CFB-1F54-4563-8A8D-45EBDE76E0B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{20720CFB-1F54-4563-8A8D-45EBDE76E0B8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {E02367A3-090F-47E9-8BDE-398D31D16903}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk.Web">
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
6+
<Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings>
7+
8+
</PropertyGroup>
9+
<ItemGroup>
10+
11+
<PackageReference Include="DevExpress.AspNetCore.Dashboard" Version="22.1.5" /><PackageReference Include="System.Data.SQLite.Core" Version="1.0.115.5" /><PackageReference Include="BuildBundlerMinifier" Version="3.2.449" /><PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.113" /></ItemGroup>
12+
<ItemGroup>
13+
<Compile Remove="node_modules\**" />
14+
<Content Remove="node_modules\**" />
15+
<EmbeddedResource Remove="node_modules\**" />
16+
<None Remove="node_modules\**" />
17+
</ItemGroup>
18+
<Target Name="DebugEnsureNodeEnv" BeforeTargets="LibraryManagerRestore" Condition=" '$(Configuration)' == 'Debug' And !Exists('node_modules') ">
19+
<!-- Ensure Node.js is installed -->
20+
<Exec Command="node --version" ContinueOnError="true">
21+
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
22+
</Exec>
23+
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
24+
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
25+
<Exec WorkingDirectory="." Command="npm install" />
26+
</Target>
27+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using DevExpress.DashboardAspNetCore;
2+
using DevExpress.DashboardWeb;
3+
using Microsoft.Extensions.FileProviders;
4+
using AspNetCoreDashboard.Storages;
5+
6+
namespace AspNetCoreDashboard {
7+
public static class DashboardUtils {
8+
public static DashboardConfigurator CreateDashboardConfigurator(IConfiguration configuration, IFileProvider fileProvider) {
9+
DashboardConfigurator configurator = new DashboardConfigurator();
10+
configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(configuration));
11+
12+
DashboardFileStorage dashboardFileStorage = new CustomDashboardFileStorage(@"Data/Dashboards");
13+
configurator.SetDashboardStorage(dashboardFileStorage);
14+
15+
return configurator;
16+
}
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using DevExpress.DashboardAspNetCore;
2+
using DevExpress.DashboardWeb;
3+
using Microsoft.AspNetCore.DataProtection;
4+
5+
namespace AspNetCoreDashboard.Controllers {
6+
public class DefaultDashboardController : DashboardController {
7+
public DefaultDashboardController(DashboardConfigurator configurator, IDataProtectionProvider? dataProtectionProvider = null)
8+
: base(configurator, dataProtectionProvider) {
9+
}
10+
}
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using AspNetCoreDashboard.Storages;
2+
using Microsoft.AspNetCore.Mvc;
3+
4+
namespace AspNetCoreDashboard.Controllers {
5+
public class HomeController : Controller {
6+
public ActionResult Index() {
7+
return View();
8+
}
9+
public ActionResult DeleteDashboard(string DashboardID) {
10+
CustomDashboardFileStorage newDashboardStorage = new CustomDashboardFileStorage(@"Data/Dashboards");
11+
newDashboardStorage.DeleteDashboard(DashboardID);
12+
return new EmptyResult();
13+
}
14+
}
15+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Dashboard>
3+
<Title Text="Sample Dashboard" />
4+
<DataSources>
5+
<SqlDataSource Name="Orders" ComponentName="sqlDataSource1">
6+
<Connection Name="NWindConnectionString" FromAppConfig="true" />
7+
<Query Type="SelectQuery" Name="Orders">
8+
<Tables>
9+
<Table Name="Orders" />
10+
</Tables>
11+
<Columns>
12+
<AllColumns Table="Orders" />
13+
</Columns>
14+
</Query>
15+
<ConnectionOptions CloseConnection="true" />
16+
</SqlDataSource>
17+
</DataSources>
18+
<Items>
19+
<Grid ComponentName="gridDashboardItem1" Name="Grid 1" DataSource="sqlDataSource1" DataMember="Orders">
20+
<DataItems>
21+
<Dimension DataMember="ShipName" DefaultId="DataItem0" />
22+
<Dimension DataMember="ShipCity" DefaultId="DataItem1" />
23+
<Dimension DataMember="ShipCountry" DefaultId="DataItem2" />
24+
</DataItems>
25+
<GridColumns>
26+
<GridDimensionColumn>
27+
<Dimension DefaultId="DataItem0" />
28+
</GridDimensionColumn>
29+
<GridDimensionColumn>
30+
<Dimension DefaultId="DataItem1" />
31+
</GridDimensionColumn>
32+
<GridDimensionColumn>
33+
<Dimension DefaultId="DataItem2" />
34+
</GridDimensionColumn>
35+
</GridColumns>
36+
<GridOptions />
37+
<ColumnFilterOptions />
38+
</Grid>
39+
</Items>
40+
<LayoutTree>
41+
<LayoutGroup Weight="100">
42+
<LayoutItem DashboardItem="gridDashboardItem1" Weight="100" />
43+
</LayoutGroup>
44+
</LayoutTree>
45+
</Dashboard>

CS/AspNetCoreDashboard/Data/nwind.db

644 KB
Binary file not shown.

CS/AspNetCoreDashboard/NuGet.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="DevExpress-Local" value="C:\Program Files\DevExpress 22.1\Components\System\Components\packages" />
5+
</packageSources>
6+
</configuration>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page
2+
3+
<div style="position: absolute; left: 0; top: 0; right: 0; bottom: 0;">
4+
@(Html.DevExpress().Dashboard("dashboardControl1")
5+
.ControllerName("DefaultDashboard")
6+
.Width("100%")
7+
.Height("100%")
8+
.OnBeforeRender("onBeforeRender")
9+
)
10+
</div>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
7+
<title>Dashboard Web Application</title>
8+
9+
<link href="css/site.min.css" rel="stylesheet" />
10+
11+
<!-- Defines the "Save As" extension template. -->
12+
<script type="text/html" id="dx-save-as-form">
13+
<div>Dashboard Name:</div>
14+
<div style="margin: 10px 0" data-bind="dxTextBox: { value: newName }"></div>
15+
<div data-bind="dxButton: { text: 'Save', onClick: saveAs }"></div>
16+
</script>
17+
18+
<script type="text/javascript">
19+
function onBeforeRender(sender) {
20+
var dashboardControl = sender;
21+
dashboardControl.registerExtension(new SaveAsDashboardExtension(dashboardControl));
22+
dashboardControl.registerExtension(new DeleteDashboardExtension(dashboardControl));
23+
}
24+
</script>
25+
</head>
26+
<body>
27+
@RenderBody()
28+
29+
<script src="js/site.min.js"></script>
30+
<script type="text/javascript" src="js/SaveAsExtension.js"></script>
31+
<script type="text/javascript" src="js/DeleteExtension.js"></script>
32+
</body>
33+
</html>

0 commit comments

Comments
 (0)