mirror of https://github.com/abpframework/abp.git
12 changed files with 136 additions and 35 deletions
@ -0,0 +1,27 @@ |
|||||
|
{ |
||||
|
"iisSettings": { |
||||
|
"windowsAuthentication": false, |
||||
|
"anonymousAuthentication": true, |
||||
|
"iisExpress": { |
||||
|
"applicationUrl": "http://localhost:57333/", |
||||
|
"sslPort": 0 |
||||
|
} |
||||
|
}, |
||||
|
"profiles": { |
||||
|
"IIS Express": { |
||||
|
"commandName": "IISExpress", |
||||
|
"launchBrowser": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
|
} |
||||
|
}, |
||||
|
"Volo.Abp.AspNetCore.Mvc.UI.Dashboards": { |
||||
|
"commandName": "Project", |
||||
|
"launchBrowser": true, |
||||
|
"environmentVariables": { |
||||
|
"ASPNETCORE_ENVIRONMENT": "Development" |
||||
|
}, |
||||
|
"applicationUrl": "http://localhost:57343/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,13 +1,20 @@ |
|||||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.VirtualFileSystem; |
||||
|
|
||||
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards |
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards |
||||
{ |
{ |
||||
[DependsOn( |
[DependsOn( |
||||
typeof(AbpAspNetCoreMvcUiWidgetsModule) |
typeof(AbpAspNetCoreMvcUiWidgetsModule) |
||||
)] |
)] |
||||
public class AbpAspNetCoreMvcUiDashboardsModule : AbpModule |
public class AbpAspNetCoreMvcUiDashboardsModule : AbpModule |
||||
{ |
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<VirtualFileSystemOptions>(options => |
||||
|
{ |
||||
|
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiDashboardsModule>(); |
||||
|
}); |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,17 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard |
||||
|
{ |
||||
|
public class DashboardViewComponent : AbpViewComponent |
||||
|
{ |
||||
|
public async Task<IViewComponentResult> InvokeAsync(string dashboardName, DashboardOptions dashboardOptions, WidgetOptions widgetOptions) |
||||
|
{ |
||||
|
var model = new DashboardViewModel(dashboardName, dashboardOptions, widgetOptions); |
||||
|
return View("~/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/Components/Dashboard/Default.cshtml", model); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard |
||||
|
{ |
||||
|
public class DashboardViewModel |
||||
|
{ |
||||
|
public DashboardDefinition Dashboard { get; set; } |
||||
|
public DashboardOptions DashboardOptions { get; set; } |
||||
|
public WidgetOptions WidgetOptions { get; set; } |
||||
|
|
||||
|
public DashboardViewModel(string dashboardName, DashboardOptions dashboardOptions, WidgetOptions widgetOptions) |
||||
|
{ |
||||
|
Dashboard = dashboardOptions.Dashboards.Single(d => d.Name.Equals(dashboardName)); |
||||
|
DashboardOptions = dashboardOptions; |
||||
|
WidgetOptions = widgetOptions; |
||||
|
} |
||||
|
|
||||
|
public WidgetDefinition GetWidget(string name) |
||||
|
{ |
||||
|
return WidgetOptions.Widgets.Single(d => d.Name.Equals(name)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
@using Microsoft.Extensions.Localization |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets |
||||
|
@inject IWidgetRenderer WidgetRenderer |
||||
|
@inject IStringLocalizerFactory localizer |
||||
|
@model Volo.Abp.AspNetCore.Mvc.UI.Dashboards.Components.Dashboard.DashboardViewModel |
||||
|
@{ |
||||
|
} |
||||
|
<abp-row> |
||||
|
@foreach (var widgetConfiguration in Model.Dashboard.AvailableWidgets) |
||||
|
{ |
||||
|
var widgetDefinition = Model.GetWidget(widgetConfiguration.WidgetName); |
||||
|
widgetDefinition.DefaultDimensions = widgetConfiguration.Dimensions ?? widgetDefinition.DefaultDimensions ?? new WidgetDimensions(5, 5); |
||||
|
|
||||
|
<abp-column class="col-@widgetDefinition.DefaultDimensions.Width" |
||||
|
style="height: @(widgetDefinition.DefaultDimensions.Height * 100)px" |
||||
|
abp-border="Danger"> |
||||
|
|
||||
|
@await WidgetRenderer.RenderAsync(Component, widgetDefinition.Name) |
||||
|
</abp-column> |
||||
|
} |
||||
|
</abp-row> |
||||
@ -0,0 +1,3 @@ |
|||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
||||
|
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
||||
|
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
||||
Loading…
Reference in new issue