Browse Source

refactor

pull/1149/head
Yunus Emre Kalkan 7 years ago
parent
commit
e808fccfc3
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewComponent.cshtml.cs
  2. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewModel.cs
  3. 1
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml
  4. 2
      samples/DashboardDemo/src/DashboardDemo.Web/Dashboards/MyDashboardScriptBundleContributor.cs
  5. 1
      samples/DashboardDemo/src/DashboardDemo.Web/Pages/widgets/MyDashboard.js
  6. 17
      samples/DashboardDemo/src/DashboardDemo.Web/Pages/widgets/MyWidgetScriptBundleContributor.cs
  7. 11
      samples/DashboardDemo/src/DashboardDemo.Web/Pages/widgets/MyWidgetViewComponent.cshtml.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewComponent.cshtml.cs

@ -21,7 +21,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard
{
var dashboard = _dashboardOptions.Dashboards.Single(d => d.Name.Equals(dashboardName));
var model = new DashboardViewModel(dashboard, _widgetOptions);
var model = new DashboardViewModel(dashboard, _widgetOptions.Widgets);
return View("~/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml", model);
}

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/DashboardViewModel.cs

@ -10,17 +10,17 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard
{
public DashboardDefinition Dashboard { get; set; }
public WidgetOptions WidgetOptions { get; set; }
public List<WidgetDefinition> Widgets { get; set; }
public DashboardViewModel(DashboardDefinition dashboard, WidgetOptions widgetOptions)
public DashboardViewModel(DashboardDefinition dashboard, List<WidgetDefinition> widgets)
{
Dashboard = dashboard;
WidgetOptions = widgetOptions;
Widgets = widgets;
}
public WidgetDefinition GetWidget(string name)
{
return WidgetOptions.Widgets.Single(d => d.Name.Equals(name));
return Widgets.Single(d => d.Name.Equals(name));
}
}
}

1
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml

@ -5,6 +5,7 @@
@model Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard.DashboardViewModel
@{
}
<abp-row>
@foreach (var widgetConfiguration in Model.Dashboard.AvailableWidgets)
{

2
samples/DashboardDemo/src/DashboardDemo.Web/Dashboards/MyDashboardScriptBundleContributor.cs

@ -7,7 +7,7 @@ namespace DashboardDemo.Dashboards
{
[DependsOn(
typeof(AbpBasicDashboardScriptContributor),
typeof(MyWidgetViewComponentScriptBundleContributor),
typeof(MyWidgetScriptBundleContributor),
typeof(DemoStatisticsScriptContributor)
)]
public class MyDashboardScriptBundleContributor : BundleContributor

1
samples/DashboardDemo/src/DashboardDemo.Web/Pages/widgets/MyDashboard.js

@ -0,0 +1 @@


17
samples/DashboardDemo/src/DashboardDemo.Web/Pages/widgets/MyWidgetScriptBundleContributor.cs

@ -0,0 +1,17 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery;
using Volo.Abp.Modularity;
namespace DashboardDemo.Pages.widgets
{
[DependsOn(typeof(JQueryScriptContributor))]
[DependsOn(typeof(ClipboardScriptBundleContributor))]
public class MyWidgetScriptBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/Pages/widgets/MyDashboard.js");
}
}
}

11
samples/DashboardDemo/src/DashboardDemo.Web/Pages/widgets/MyWidgetViewComponent.cshtml.cs

@ -1,8 +1,4 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery;
using Volo.Abp.Modularity;
namespace DashboardDemo.Pages.widgets
{
@ -18,11 +14,4 @@ namespace DashboardDemo.Pages.widgets
return View("/Pages/widgets/MyWidgetViewComponent.cshtml", new MyWidgetViewComponent());
}
}
[DependsOn(typeof(JQueryScriptContributor))]
[DependsOn(typeof(ClipboardScriptBundleContributor))]
public class MyWidgetViewComponentScriptBundleContributor : BundleContributor
{
}
}
Loading…
Cancel
Save