mirror of https://github.com/abpframework/abp.git
401 changed files with 1846 additions and 69566 deletions
@ -0,0 +1,274 @@ |
|||
# Widgety |
|||
|
|||
ABP poskytuje model a infastrukturu k vytváření **znovu použitelných widgetů**. Systém widgetů je rozšíření pro [ASP.NET Core pohledové komponenty](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-components). Widgety jsou zvláště užitečné, když chcete; |
|||
|
|||
* Definovat widgety v znovu použitelných **[modulech](../Module-Development-Basics.md)**. |
|||
* Mít závislosti na **skriptech & stylech** ve vašem widgetu. |
|||
* Vytvářet **[řídící panely](Dashboards.md)** za použítí widgetů. |
|||
* Spolupráci widgetů s **[authorizačními](../Authorization.md)** a **[svazovacími](Bundling-Minification.md)** systémy. |
|||
|
|||
## Základní definice widgetu |
|||
|
|||
### Tvorba pohledové komponenty |
|||
|
|||
Jako první krok, vytvoříme běžnou ASP.NET Core pohledovou komponentu: |
|||
|
|||
 |
|||
|
|||
**MySimpleWidgetViewComponent.cs**: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
Dědění z `AbpViewComponent` není vyžadováno. Můžeme dědit ze standardního ASP.NET Core `ViewComponent`. `AbpViewComponent` pouze definuje pár základních a užitečných vlastnosti. |
|||
|
|||
**Default.cshtml**: |
|||
|
|||
```xml |
|||
<div class="my-simple-widget"> |
|||
<h2>My Simple Widget</h2> |
|||
<p>This is a simple widget!</p> |
|||
</div> |
|||
``` |
|||
|
|||
### Definice widgetu |
|||
|
|||
Přidáme atribut `Widget` k třídě `MySimpleWidgetViewComponent` pro označení této pohledové komponenty jako widgetu: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
## Vykreslení widgetu |
|||
|
|||
Vykreslení widgetu je vcelku standardní. Použijeme metodu `Component.InvokeAsync` v razor pohledu/stránce jako s kteroukoliv jinou pohledovou komponentou. Příklady: |
|||
|
|||
````xml |
|||
@await Component.InvokeAsync("MySimpleWidget") |
|||
@await Component.InvokeAsync(typeof(MySimpleWidgetViewComponent)) |
|||
```` |
|||
|
|||
První přístup používá název widgetu, zatímco druhý používá typ pohledové komponenty. |
|||
|
|||
## Název widgetu |
|||
|
|||
Výchozí název pohledových komponent je vypočítán na základě názvu typu pohledové komponenty. Pokud je typ pohledové komponenty `MySimpleWidgetViewComponent` potom název widgetu bude `MySimpleWidget` (odstraní se `ViewComponent` postfix). Takto ASP.NET Core vypočítává název pohledové komponenty. |
|||
|
|||
Chceme-li přizpůsobit název widgetu, stačí použít standardní atribut `ViewComponent` z ASP.NET Core: |
|||
|
|||
```csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget] |
|||
[ViewComponent(Name = "MyCustomNamedWidget")] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("~/Pages/Components/MySimpleWidget/Default.cshtml"); |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
ABP bude respektovat přizpůsobený název při zpracování widgetu. |
|||
|
|||
> Pokud jsou názvy pohledové komponenty a složky, která pohledovou komponentu obsahuje rozdílné, pravděpodobně budete muset ručně uvést cestu pohledu tak jako je to provedeno v tomto příkladu. |
|||
|
|||
### Zobrazovaný název |
|||
|
|||
Můžeme také definovat čitelný & lokalizovatelný zobrazovaný název pro widget. Tento zobrazovaný název může být využít na uživatelském rozhraní kdykoliv je to potřeba. Zobrazovaný název je nepovinný a lze ho definovat pomocí vlastností atributu `Widget`: |
|||
|
|||
````csharp |
|||
using DashboardDemo.Localization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget( |
|||
DisplayName = "MySimpleWidgetDisplayName", // Lokalizační klíč |
|||
DisplayNameResource = typeof(DashboardDemoResource) // Lokalizační zdroj |
|||
)] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
Podívejte se na [dokument lokalizace](../Localization.md) pro více informací o lokalizačních zdrojích a klíčích. |
|||
|
|||
## Závislosti na stylech & skriptech |
|||
|
|||
Problémy když má widget soubory skriptů a stylů; |
|||
|
|||
* Každý stránka, která používá widget musí také přidat soubory **skriptů & stylů** tohoto widgetu. |
|||
* Stránka se také musí postarat o **závislé knihovny/soubory** widgetu. |
|||
|
|||
ABP tyto problémy řeší, když správně propojíme zdroje s widgetem. O závislosti widgetu se při jeho používání nestaráme. |
|||
|
|||
### Definování jednoduchých cest souborů |
|||
|
|||
Níže uvedený příklad widgetu přidá stylové a skriptové soubory: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget( |
|||
StyleFiles = new[] { "/Pages/Components/MySimpleWidget/Default.css" }, |
|||
ScriptFiles = new[] { "/Pages/Components/MySimpleWidget/Default.js" } |
|||
)] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
ABP bere v úvahu tyto závislosti a správně je přidává do pohledu/stránky při použití widgetu. Stylové/skriptové soubory mohou být **fyzické nebo virtuální**. Plně integrováno do [virtuálního systému souborů](../Virtual-File-System.md). |
|||
|
|||
### Definování přispěvatelů balíku |
|||
|
|||
Všechny zdroje použité ve widgetech na stránce jsou přidány jako **svazek** (svázány & minifikovány v produkci pokud nenastavíte jinak). Kromě přidání jednoduchého souboru můžete využít plnou funkčnost přispěvatelů balíčků. |
|||
|
|||
Níže uvedený ukázkový kód provádí totéž co výše uvedený kód, ale definuje a používá přispěvatele balíků: |
|||
|
|||
````csharp |
|||
using System.Collections.Generic; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget( |
|||
StyleTypes = new []{ typeof(MySimpleWidgetStyleBundleContributor) }, |
|||
ScriptTypes = new[]{ typeof(MySimpleWidgetScriptBundleContributor) } |
|||
)] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
|
|||
public class MySimpleWidgetStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files |
|||
.AddIfNotContains("/Pages/Components/MySimpleWidget/Default.css"); |
|||
} |
|||
} |
|||
|
|||
public class MySimpleWidgetScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files |
|||
.AddIfNotContains("/Pages/Components/MySimpleWidget/Default.js"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
```` |
|||
|
|||
Systém přispěvatelů balíků je velmi schopný. Pokud váš widget používá k vykreslení grafu JavaScript knihovnu, můžete ji deklarovat jako závislost, díky tomu se knihovna pokud nebyla dříve přidána automaticky přidá na stránku Tímto způsobem se stránka využívající váš widget nestará o závislosti. |
|||
|
|||
Podívejte se na dokumentaci [svazování & minifikace](Bundling-Minification.md) pro více informací o tomto systému. |
|||
|
|||
## Autorizace |
|||
|
|||
Některé widgety budou pravděpodobně muset být dostupné pouze pro ověřené nebo autorizované uživatele. V tomto případě použijte následující vlastnosti atributu `Widget`: |
|||
|
|||
* `RequiresAuthentication` (`bool`): Nastavte na true, aby byl tento widget použitelný pouze pro ověřené uživatele (uživatel je přihlášen do aplikace). |
|||
* `RequiredPolicies` (`List<string>`): Seznam názvů zásad k autorizaci uživatele. Další informace o zásadách naleznete v [dokumentu autorizace](../Authorization.md). |
|||
|
|||
Příklad: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget(RequiredPolicies = new[] { "MyPolicyName" })] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
## Možnosti widgetu |
|||
|
|||
Jako alternativu k atributu `Widget` můžete ke konfiguraci widgetů použít `WidgetOptions`: |
|||
|
|||
```csharp |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets.Add<MySimpleWidgetViewComponent>(); |
|||
}); |
|||
``` |
|||
|
|||
Toto vepište do metody `ConfigureServices` vašeho [modulu](../Module-Development-Basics.md). Veškerá konfigurace udělaná přes atribut `Widget` je dostupná i za pomoci `WidgetOptions`. Příklad konfigurace, která přidává styl pro widget: |
|||
|
|||
````csharp |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets |
|||
.Add<MySimpleWidgetViewComponent>() |
|||
.WithStyles("/Pages/Components/MySimpleWidget/Default.css"); |
|||
}); |
|||
```` |
|||
|
|||
> Tip: `WidgetOptions` lze také použít k získání existujícího widgetu a ke změně jeho konfigurace. To je obzvláště užitečné, pokud chcete změnit konfiguraci widgetu uvnitř modulu používaného vaší aplikací. Použíjte `options.Widgets.Find` k získání existujícího `WidgetDefinition`. |
|||
@ -1,559 +0,0 @@ |
|||
# Dashboard & Widget System |
|||
|
|||
Dashboard & Widget System allows you to create reusable widgets and dashboards. |
|||
|
|||
 |
|||
|
|||
You can see a sample dashboard, build with that system, in the screenshot above. Top section, where the filters and refresh button is placed is global filter section and each card below is a widget. Both widgets and global filters are reusable components. Also dashboard layout is reusable too. |
|||
|
|||
Now we will see how those are defined, used in an application. |
|||
|
|||
## Dashboard Component |
|||
|
|||
Firstly, we will define a dashboard in our application (you can download a new application template from [abp.io/get-started](https://abp.io/get-started). To keep it simple, Please don't use tiered option). |
|||
|
|||
In *.Web project, we create **DashboardNames.cs** and **DashboardDefinitionProvider.cs** classes: |
|||
|
|||
```c# |
|||
public static class DashboardNames |
|||
{ |
|||
public const string MyDashboard = "MyDashboard"; |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(DashboardNames)); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
```c# |
|||
public static class DashboardDefinitionProvider |
|||
{ |
|||
public static List<DashboardDefinition> GetDefinitions() |
|||
{ |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard") |
|||
); |
|||
|
|||
return new List<DashboardDefinition> |
|||
{ |
|||
myDashboard |
|||
}; |
|||
} |
|||
} |
|||
``` |
|||
|
|||
We need to add that definition to **DashboardOptions** in **ConfigureServices** method of ***WebModule.cs** file: |
|||
|
|||
```c# |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
//... |
|||
public class DashboardDemoWebModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
//other codes.. |
|||
Configure<DashboardOptions>(options => |
|||
{ |
|||
options.Dashboards.AddRange(DashboardDefinitionProvider.GetDefinitions()); |
|||
}) |
|||
//other codes.. |
|||
} |
|||
//other codes.. |
|||
} |
|||
``` |
|||
|
|||
Then we can create the view file that the dashboard we have defined will be rendered, **Pages/MyDashboard.cshtml**: |
|||
|
|||
```html |
|||
@page |
|||
@using DashboardDemo.Dashboards |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Dashboards |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
@inject IWidgetRenderer WidgetRenderer |
|||
@inject IDashboardRenderer DashboardRenderer |
|||
@inject IStringLocalizerFactory localizer |
|||
@model DashboardDemo.Pages.MyDashboardModel |
|||
@{ |
|||
} |
|||
@section styles { |
|||
<abp-style-bundle name="@DashboardNames.MyDashboard" /> |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle name="@DashboardNames.MyDashboard" /> |
|||
} |
|||
|
|||
@await DashboardRenderer.RenderAsync(Component, new { dashboardName = DashboardNames.MyDashboard }) |
|||
|
|||
|
|||
``` |
|||
|
|||
**DashboardRenderer.RenderAsync** method renders the dashboard we have defined. Now we have to define the script and style bundles that you can see their usage in the code above: |
|||
|
|||
```c# |
|||
[DependsOn(typeof(AbpBasicDashboardStyleContributor))] |
|||
public class MyDashboardStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
``` |
|||
|
|||
```c# |
|||
[DependsOn(typeof(AbpBasicDashboardScriptContributor))] |
|||
public class MyDashboardScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
``` |
|||
|
|||
The dashboard system uses [Bundling & Minification](../Bundling-Minification.md) for scripts and styles. Dashboard contributors will be dependent on their widget and global filter contributors, and widget and global filters will be dependent on the other contributors they need. This guarantees that more than one widget can request a javascript library and it won't be duplicated. |
|||
|
|||
We need to add those contributors to bundling options in **ConfigureServices** method of ***WebModule.cs** file: |
|||
|
|||
```c# |
|||
Configure<BundlingOptions>(options => |
|||
{ |
|||
options.ScriptBundles.Add(DashboardNames.MyDashboard, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(MyDashboardScriptBundleContributor)); |
|||
}); |
|||
|
|||
options.StyleBundles.Add(DashboardNames.MyDashboard, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(MyDashboardStyleBundleContributor)); |
|||
}); |
|||
}); |
|||
``` |
|||
|
|||
Now we can start to create widgets. |
|||
|
|||
## Widgets |
|||
|
|||
Widgets are view components those are rendered in order when you add them to a dashboard. They also can be rendered anywhere you like. |
|||
|
|||
We will see how to create a widget and add it to the dashboard we created. We will create the "Monthly profit" widget in the screenshot at the beginning of this tutorial. |
|||
|
|||
Before creating our widget, we need a application service to return dummy data for our widget. |
|||
|
|||
```c# |
|||
namespace DashboardDemo |
|||
{ |
|||
public interface IDemoStatisticAppService : IApplicationService |
|||
{ |
|||
Task<GetMonthlyUserStatisticDto> GetMonthlyUserStatistic(FilterDto filter); |
|||
|
|||
Task<MonthlyProfitStatisticDto> GetMonthlyProfitStatistic(FilterDto filter); |
|||
} |
|||
|
|||
public class DemoStatisticAppService : ApplicationService, IDemoStatisticAppService |
|||
{ |
|||
public async Task<MonthlyProfitStatisticDto> GetMonthlyProfitStatistic(FilterDto filter) |
|||
{ |
|||
var monthCount = GetLabels(filter, out var monthList); |
|||
|
|||
var data = Enumerable |
|||
.Repeat(0, monthCount) |
|||
.Select(i => new Random().Next(-20, 40)) |
|||
.ToArray(); |
|||
|
|||
return new MonthlyProfitStatisticDto { Labels = monthList.ToArray(), Data = data }; |
|||
} |
|||
|
|||
private static int GetLabels(FilterDto filter, out List<string> monthList) |
|||
{ |
|||
DateTime endDate = filter.EndDate ?? DateTime.Now; |
|||
DateTime startDate = filter.StartDate ?? DateTime.Now.AddYears(-1); |
|||
|
|||
if (filter.StartDate > filter.EndDate) |
|||
{ |
|||
throw new BusinessException("Start date can not be greater than end date."); |
|||
} |
|||
|
|||
var months = new[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}; |
|||
var monthCount = (endDate.Year - startDate.Year) * 12 + endDate.Month - startDate.Month +1; |
|||
monthList = new List<string>(); |
|||
|
|||
for (int i = 0; i < monthCount; i++) |
|||
{ |
|||
monthList.Add(months[endDate.Month-1]); |
|||
endDate = endDate.AddMonths(-1); |
|||
} |
|||
|
|||
monthList.Reverse(); |
|||
|
|||
return monthCount; |
|||
} |
|||
} |
|||
|
|||
public class MonthlyProfitStatisticDto |
|||
{ |
|||
public string[] Labels { get; set; } |
|||
|
|||
public int[] Data { get; set; } |
|||
} |
|||
|
|||
public class FilterDto |
|||
{ |
|||
public DateTime? StartDate { get; set; } |
|||
|
|||
public DateTime? EndDate { get; set; } |
|||
} |
|||
} |
|||
``` |
|||
|
|||
We will use **FilterDto** in **Global Filters** section. |
|||
|
|||
Now we can start to work on our widget. |
|||
|
|||
 |
|||
|
|||
You can see the files that we will create our widget. (If your widget won't need css or javascript, you don't need to create them and contributors as well.) |
|||
|
|||
First we create the **MonthlyProfitWidgetViewComponent**: |
|||
|
|||
```html |
|||
@inject IHtmlLocalizer<DashboardDemoResource> L |
|||
@using DashboardDemo.Localization.DashboardDemo |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@model DashboardDemo.Pages.widgets.MonthlyProfitWidgetViewComponent |
|||
@{ |
|||
} |
|||
<div id="MonthlyProfitWidgetContainer"> |
|||
<abp-card background="Light"> |
|||
<abp-card-header background="Info">@L["Monthly Profit"]</abp-card-header> |
|||
<abp-card-body> |
|||
<div class="row margin-bottom-5"> |
|||
<canvas id="MonthlyProfitStatistics"></canvas> |
|||
</div> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
</div> |
|||
|
|||
``` |
|||
|
|||
```c# |
|||
public class MonthlyProfitWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public const string Name = "MonthlyProfitWidget"; |
|||
|
|||
public const string DisplayName = "Monthly Profit Widget"; |
|||
|
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidgetViewComponent.cshtml", new MonthlyProfitWidgetViewComponent()); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
We will use [chart.js library](https://www.chartjs.org/) to create the chart. To add this library to our project, we add the package dependency to **package.json**: |
|||
|
|||
```json |
|||
"dependencies": { |
|||
//other dependencies... |
|||
"chart.js": "^2.8.0" |
|||
} |
|||
``` |
|||
|
|||
Then add the mapping **abp.resourcemappings.js**: (see [related doc](/AspNetCore/Client-Side-Package-Management#resource-mapping-definition-file)) |
|||
|
|||
```js |
|||
mappings: { |
|||
//other mappings... |
|||
"@node_modules/chart.js/dist/*.*": "@libs/chart.js/" |
|||
} |
|||
``` |
|||
|
|||
Now we have chart.js library in our application. In order to use it, we will create it's contributors: |
|||
|
|||
```c# |
|||
public class ChartjsScriptContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/libs/chart.js/Chart.js"); |
|||
} |
|||
} |
|||
|
|||
public class ChartjsStyleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/libs/chart.js/Chart.css"); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
Well. Now we create the contributors for our widget files and make them dependent on chart.js: |
|||
|
|||
```c# |
|||
[DependsOn(typeof(JQueryScriptContributor))] |
|||
[DependsOn(typeof(ChartjsScriptContributor))] |
|||
public class MonthlyProfitWidgetScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidget.js"); |
|||
} |
|||
} |
|||
|
|||
[DependsOn(typeof(BootstrapStyleContributor))] |
|||
[DependsOn(typeof(ChartjsStyleContributor))] |
|||
public class MonthlyProfitWidgetStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidget.css"); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
**MonthlyProfitWidget.css** is empty for our widget. |
|||
|
|||
**MonthlyProfitWidget.js** content is below: |
|||
|
|||
```js |
|||
(function ($) { |
|||
var $container = $('#MonthlyProfitWidgetContainer'); |
|||
if ($container.length > 0) { |
|||
var chart = {}; |
|||
|
|||
var createChart = function () { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({}).then(function (result) { |
|||
chart = new Chart($container.find('#MonthlyProfitStatistics'), { |
|||
type: 'line', |
|||
data: { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
options: { |
|||
scales: { |
|||
yAxes: [{ |
|||
ticks: { |
|||
beginAtZero: true |
|||
} |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
createChart(); |
|||
} |
|||
})(jQuery); |
|||
|
|||
``` |
|||
|
|||
We have created our widget. There is one last thing before adding it to dashboard; we need to define it: |
|||
|
|||
```c# |
|||
public static class WidgetDefinitionProvider |
|||
{ |
|||
public static List<WidgetDefinition> GetDefinitions() |
|||
{ |
|||
//other widgets... |
|||
|
|||
var monthlyProfitWidget = new WidgetDefinition( |
|||
MonthlyProfitWidgetViewComponent.Name, |
|||
LocalizableString.Create<DashboardDemoResource>(MonthlyProfitWidgetViewComponent.DisplayName), |
|||
typeof(MonthlyProfitWidgetViewComponent) |
|||
) |
|||
.SetDefaultDimension(6, 4) |
|||
.AddRequiredPermission(IdentityPermissions.Users.Default); |
|||
|
|||
return new List<WidgetDefinition> |
|||
{ |
|||
//other widgets... |
|||
monthlyProfitWidget |
|||
}; |
|||
} |
|||
} |
|||
``` |
|||
|
|||
**.SetDefaultDimension(int x, int y):** Sets the dimensions of the widget. This will be used when rendering it in dashboard. X is for column width in bootstrap, can be between 1 and 12. Y is height in pixels, will be multiplied by 100. |
|||
|
|||
**AddRequiredPermission(string permissionName)**: Sets the permission for widget. So a user that doesn't have this permission will not see this widget. |
|||
|
|||
We need to add the widget definitions to **WidgetOptions** in **ConfigureServices** method of ***WebModule.cs** file as well: |
|||
|
|||
```c# |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets.AddRange(WidgetDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
``` |
|||
|
|||
Now our widget is ready to use. We will use **WithWidget** method to add it to our dashboard in **DashboardDefinitionProvider.cs**: |
|||
|
|||
```c# |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard")) |
|||
.WithWidget(MonthlyProfitWidgetViewComponent.Name); |
|||
``` |
|||
|
|||
And add the javascript and contributor dependencies to dashboard: |
|||
|
|||
```c# |
|||
[DependsOn(typeof(MonthlyProfitWidgetScriptBundleContributor))] // <<<<<< |
|||
[DependsOn(typeof(AbpBasicDashboardScriptContributor))] |
|||
public class MyDashboardScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
|||
[DependsOn(typeof(MonthlyProfitWidgetStyleBundleContributor))] // <<<<<< |
|||
[DependsOn(typeof(AbpBasicDashboardStyleContributor))] |
|||
public class MyDashboardStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
``` |
|||
|
|||
Now start your application and go to **/MyDashboard** page. |
|||
|
|||
## Global Filters |
|||
|
|||
Global filters are used for filtering all widgets with same input. If you add a global filter to a dashboard, a refresh button will appear for refreshing widgets with new filter values. When this button is clicked, it serializes filters to object and fires an event with that object as parameter. |
|||
|
|||
Let's implement a **date range** global filter. |
|||
|
|||
First, we need to create **DateRangeGlobalFilterViewComponent.cshtml**: |
|||
|
|||
```html |
|||
@inject IHtmlLocalizer<DashboardDemoResource> L |
|||
@using DashboardDemo.Localization.DashboardDemo |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@model DashboardDemo.Pages.widgets.Filters.DateRangeGlobalFilterViewComponent |
|||
@{ |
|||
} |
|||
<div id="DateRangeGlobalFilterContainer"> |
|||
<div class="row"> |
|||
<div class="col-md-6 mb-3"> |
|||
<label for="DateFilterStartDateInput">@L["Start Date"].Value</label> |
|||
<input class="form-control" type="date" name="StartDate" id="DateFilterStartDateInput"> |
|||
</div> |
|||
<div class="col-md-6 mb-3"> |
|||
<label for="DateFilterEndDateInput">@L["End Date"].Value</label> |
|||
<input class="form-control" type="date" name="EndDate" id="EndDateStartDateInput"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
``` |
|||
|
|||
```c# |
|||
namespace DashboardDemo.Pages.widgets.Filters |
|||
{ |
|||
[ViewComponent] |
|||
public class DateRangeGlobalFilterViewComponent : ViewComponent |
|||
{ |
|||
public const string Name = "DateRangeGlobalFilter"; |
|||
|
|||
public const string DisplayName = "Date Range Filter"; |
|||
|
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("/Pages/widgets/Filters/DateRangeGlobalFilterViewComponent.cshtml", new DateRangeGlobalFilterViewComponent()); |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
You can add javascript and css files in the same way you add them to widgets, but in this example they are not needed. |
|||
|
|||
We will add the global filter definitions to **GlobalFilterOptions** in **ConfigureServices** method of ***WebModule.cs** file as well: |
|||
|
|||
```c# |
|||
Configure<GlobalFilterOptions>(options => |
|||
{ |
|||
options.GlobalFilters.AddRange(GlobalFilterDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
``` |
|||
|
|||
And add it to our dashboard in **DashboardDefinitionProvider.cs** using **WithGlobalFilter** method: |
|||
|
|||
```c# |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard")) |
|||
.WithWidget(MonthlyProfitWidgetViewComponent.Name) |
|||
.WithGlobalFilter(DateRangeGlobalFilterViewComponent.Name); |
|||
``` |
|||
|
|||
That's it! Now let's catch the refresh event in our widget: |
|||
|
|||
```js |
|||
(function ($) { |
|||
var $container = $('#MonthlyProfitWidgetContainer'); |
|||
if ($container.length > 0) { |
|||
var chart = {}; |
|||
|
|||
var createChart = function () { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({}).then(function (result) { |
|||
chart = new Chart($container.find('#MonthlyProfitStatistics'), { |
|||
type: 'line', |
|||
data: { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
options: { |
|||
scales: { |
|||
yAxes: [{ |
|||
ticks: { |
|||
beginAtZero: true |
|||
} |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
$(document).on('RefreshWidgets', |
|||
function (event, filters) { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({ startDate: filters.startDate, endDate: filters.endDate }).then(function (result) { |
|||
chart.data = { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
chart.update(); |
|||
}); |
|||
}); |
|||
|
|||
createChart(); |
|||
} |
|||
})(jQuery); |
|||
|
|||
``` |
|||
|
|||
## Source Code |
|||
|
|||
You can see a sample application for dashboard at [Github](https://github.com/abpframework/abp/tree/dev/samples/DashboardDemo). |
|||
@ -0,0 +1,3 @@ |
|||
# Dashboards |
|||
|
|||
TODO |
|||
@ -0,0 +1,274 @@ |
|||
# Widgets |
|||
|
|||
ABP provides a model and infrastructure to create **reusable widgets**. Widget system is an extension to [ASP.NET Core's ViewComponents](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-components). Widgets are especially useful when you want to; |
|||
|
|||
* Define widgets in reusable **[modules](../Module-Development-Basics.md)**. |
|||
* Have **scripts & styles** dependencies for your widget. |
|||
* Create **[dashboards](Dashboards.md)** with widgets used inside. |
|||
* Co-operate widgets with **[authorization](../Authorization.md)** and **[bundling](Bundling-Minification.md)** systems. |
|||
|
|||
## Basic Widget Definition |
|||
|
|||
### Create a View Component |
|||
|
|||
As the first step, create a new regular ASP.NET Core View Component: |
|||
|
|||
 |
|||
|
|||
**MySimpleWidgetViewComponent.cs**: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
Inheriting from `AbpViewComponent` is not required. You could inherit from ASP.NET Core's standard `ViewComponent`. `AbpViewComponent` only defines some base useful properties. |
|||
|
|||
**Default.cshtml**: |
|||
|
|||
```xml |
|||
<div class="my-simple-widget"> |
|||
<h2>My Simple Widget</h2> |
|||
<p>This is a simple widget!</p> |
|||
</div> |
|||
``` |
|||
|
|||
### Define the Widget |
|||
|
|||
Add a `Widget` attribute to the `MySimpleWidgetViewComponent` class to mark this view component as a widget: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
## Rendering a Widget |
|||
|
|||
Rendering a widget is pretty standard. Use the `Component.InvokeAsync` method in a razor view/page as you do for any view component. Examples: |
|||
|
|||
````xml |
|||
@await Component.InvokeAsync("MySimpleWidget") |
|||
@await Component.InvokeAsync(typeof(MySimpleWidgetViewComponent)) |
|||
```` |
|||
|
|||
First approach uses the widget name while second approach uses the view component type. |
|||
|
|||
## Widget Name |
|||
|
|||
Default name of the view components are calculated based on the name of the view component type. If your view component type is `MySimpleWidgetViewComponent` then the widget name will be `MySimpleWidget` (removes `ViewComponent` postfix). This is how ASP.NET Core calculates a view component's name. |
|||
|
|||
To customize widget's name, just use the standard `ViewComponent` attribute of ASP.NET Core: |
|||
|
|||
```csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget] |
|||
[ViewComponent(Name = "MyCustomNamedWidget")] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("~/Pages/Components/MySimpleWidget/Default.cshtml"); |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
ABP will respect to the custom name by handling the widget. |
|||
|
|||
> If the view component name and the folder name of the view component don't match, you may need to manually write the view path as done in this example. |
|||
|
|||
### Display Name |
|||
|
|||
You can also define a human-readable, localizable display name for the widget. This display name then can be used on the UI when needed. Display name is optional and can be defined using properties of the `Widget` attribute: |
|||
|
|||
````csharp |
|||
using DashboardDemo.Localization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget( |
|||
DisplayName = "MySimpleWidgetDisplayName", //Localization key |
|||
DisplayNameResource = typeof(DashboardDemoResource) //localization resource |
|||
)] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
See [the localization document](../Localization.md) to learn about localization resources and keys. |
|||
|
|||
## Style & Script Dependencies |
|||
|
|||
There are some challenges when your widget has script and style files; |
|||
|
|||
* Any page uses the widget should also include the **its script & styles** files into the page. |
|||
* The page should also care about **depended libraries/files** of the widget. |
|||
|
|||
ABP solves these issues when you properly relate the resources with the widget. You don't care about dependencies of the widget while using it. |
|||
|
|||
### Defining as Simple File Paths |
|||
|
|||
The example widget below adds a style and a script file: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget( |
|||
StyleFiles = new[] { "/Pages/Components/MySimpleWidget/Default.css" }, |
|||
ScriptFiles = new[] { "/Pages/Components/MySimpleWidget/Default.js" } |
|||
)] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
ABP takes account these dependencies and properly adds to the view/page when you use the widget. Style/script files can be **physical or virtual**. It is completely integrated to the [Virtual File System](../Virtual-File-System.md). |
|||
|
|||
### Defining Bundle Contributors |
|||
|
|||
All resources for used widgets in a page are added as a **bundle** (bundled & minified in production if you don't configure otherwise). In addition to adding a simple file, you can take full power of the bundle contributors. |
|||
|
|||
The sample code below does the same with the code above, but defines and uses bundle contributors: |
|||
|
|||
````csharp |
|||
using System.Collections.Generic; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget( |
|||
StyleTypes = new []{ typeof(MySimpleWidgetStyleBundleContributor) }, |
|||
ScriptTypes = new[]{ typeof(MySimpleWidgetScriptBundleContributor) } |
|||
)] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
|
|||
public class MySimpleWidgetStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files |
|||
.AddIfNotContains("/Pages/Components/MySimpleWidget/Default.css"); |
|||
} |
|||
} |
|||
|
|||
public class MySimpleWidgetScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files |
|||
.AddIfNotContains("/Pages/Components/MySimpleWidget/Default.js"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
```` |
|||
|
|||
Bundle contribution system is very powerful. If your widget uses a JavaScript library to render a chart, then you can declare it as a dependency, so the JavaScript library is automatically added to the page if it wasn't added before. In this way, the page using your widget doesn't care about the dependencies. |
|||
|
|||
See the [bundling & minification](Bundling-Minification.md) documentation for more information about that system. |
|||
|
|||
## Authorization |
|||
|
|||
Some widgets may need to be available only for authenticated or authorized users. In this case, use the following properties of the `Widget` attribute: |
|||
|
|||
* `RequiresAuthentication` (`bool`): Set to true to make this widget usable only for authentication users (user have logged in to the application). |
|||
* `RequiredPolicies` (`List<string>`): A list of policy names to authorize the user. See [the authorization document](../Authorization.md) for more info about policies. |
|||
|
|||
Example: |
|||
|
|||
````csharp |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Web.Pages.Components.MySimpleWidget |
|||
{ |
|||
[Widget(RequiredPolicies = new[] { "MyPolicyName" })] |
|||
public class MySimpleWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View(); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
## Widget Options |
|||
|
|||
As alternative to the `Widget` attribute, you can use the `WidgetOptions` to configure widgets: |
|||
|
|||
```csharp |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets.Add<MySimpleWidgetViewComponent>(); |
|||
}); |
|||
``` |
|||
|
|||
Write this into the `ConfigureServices` method of your [module](../Module-Development-Basics.md). All the configuration done with the `Widget` attribute is also possible with the `WidgetOptions`. Example configuration that adds a style for the widget: |
|||
|
|||
````csharp |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets |
|||
.Add<MySimpleWidgetViewComponent>() |
|||
.WithStyles("/Pages/Components/MySimpleWidget/Default.css"); |
|||
}); |
|||
```` |
|||
|
|||
> Tip: `WidgetOptions` can also be used to get an existing widget and change its configuration. This is especially useful if you want to modify the configuration of a widget inside a module used by your application. Use `options.Widgets.Find` to get an existing `WidgetDefinition`. |
|||
|
After Width: | Height: | Size: 9.9 KiB |
@ -1,559 +0,0 @@ |
|||
# 仪表板和小部件(Widget)系统 |
|||
|
|||
仪表板和小部件(Widget)系统允许你创建可重用的小部件和仪表板。 |
|||
|
|||
 |
|||
|
|||
你可以在上面的屏幕截图中看到使用该系统构建的示例仪表板. 放置过滤器和刷新按钮的顶部是全局过滤器部分,下面的每个卡片都是一个小部件. 小部件和全局过滤器都是可重用的组件.仪表板布局也可以重复使用. |
|||
|
|||
现在我们将看到如何在应用程序中使用它们. |
|||
|
|||
## 仪表板组件 |
|||
|
|||
首先,我们将在应用程序中定义仪表板,你可以从[abp.io/get-started](https://abp.io/get-started)下载新的应用程序模板. 为简单起见,请不要使用分层选项. |
|||
|
|||
在 *.Web项目中, 我们创建**DashboardNames.cs**和**DashboardDefinitionProvider.cs**类: |
|||
|
|||
```c# |
|||
public static class DashboardNames |
|||
{ |
|||
public const string MyDashboard = "MyDashboard"; |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(DashboardNames)); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
```c# |
|||
public static class DashboardDefinitionProvider |
|||
{ |
|||
public static List<DashboardDefinition> GetDefinitions() |
|||
{ |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard") |
|||
); |
|||
|
|||
return new List<DashboardDefinition> |
|||
{ |
|||
myDashboard |
|||
}; |
|||
} |
|||
} |
|||
``` |
|||
|
|||
我们需要将该定义添加到**WebModule.cs**文件中**ConfigureServices**方法的**DashboardOptions**: |
|||
|
|||
```c# |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
//... |
|||
public class DashboardDemoWebModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
//other codes.. |
|||
Configure<DashboardOptions>(options => |
|||
{ |
|||
options.Dashboards.AddRange(DashboardDefinitionProvider.GetDefinitions()); |
|||
}) |
|||
//other codes.. |
|||
} |
|||
//other codes.. |
|||
} |
|||
``` |
|||
|
|||
然后我们可以创建我们定义的仪表板它将被渲染 **Pages/MyDashboard.cshtml**: |
|||
|
|||
```html |
|||
@page |
|||
@using DashboardDemo.Dashboards |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Dashboards |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
@inject IWidgetRenderer WidgetRenderer |
|||
@inject IDashboardRenderer DashboardRenderer |
|||
@inject IStringLocalizerFactory localizer |
|||
@model DashboardDemo.Pages.MyDashboardModel |
|||
@{ |
|||
} |
|||
@section styles { |
|||
<abp-style-bundle name="@DashboardNames.MyDashboard" /> |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle name="@DashboardNames.MyDashboard" /> |
|||
} |
|||
|
|||
@await DashboardRenderer.RenderAsync(Component, new { dashboardName = DashboardNames.MyDashboard }) |
|||
|
|||
|
|||
``` |
|||
|
|||
**DashboardRenderer.RenderAsync** 方法呈现我们定义的仪表板. 现在我们必须定义script和style bundles. 你可以在上面的代码中看到它们的用法: |
|||
|
|||
```c# |
|||
[DependsOn(typeof(AbpBasicDashboardStyleContributor))] |
|||
public class MyDashboardStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
``` |
|||
|
|||
```c# |
|||
[DependsOn(typeof(AbpBasicDashboardScriptContributor))] |
|||
public class MyDashboardScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
``` |
|||
|
|||
仪表板系统使用[Bundling & Minification](../Bundling-Minification.md)作为脚本和样式. 仪表板贡献者将依赖于他们的小部件和全局过滤器贡献者, 小部件和全局过滤器将依赖于他们需要的其他贡献者. 这可以保证多个小部件可以请求javascript库, 并且不会重复. |
|||
|
|||
我们需要将这些贡献者添加到**WebModule.cs**文件的**ConfigureServices**方法中的bundling选项: |
|||
|
|||
```c# |
|||
Configure<BundlingOptions>(options => |
|||
{ |
|||
options.ScriptBundles.Add(DashboardNames.MyDashboard, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(MyDashboardScriptBundleContributor)); |
|||
}); |
|||
|
|||
options.StyleBundles.Add(DashboardNames.MyDashboard, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(MyDashboardStyleBundleContributor)); |
|||
}); |
|||
}); |
|||
``` |
|||
|
|||
现在我们可以开始创建小部件了. |
|||
|
|||
## 小部件 |
|||
|
|||
小部件是在将它们添加到仪表板时按顺序呈现的视图组件. 它们也可以在任何你喜欢的地方呈现. |
|||
|
|||
我们将看到如何创建小部件并将其添加到我们创建的仪表板中. 我们将在本教程开头的屏幕截图中创建"每月利润"小部件. |
|||
|
|||
在创建小部件之前,我们需要一个应用程序服务来返回小部件的虚拟数据. |
|||
|
|||
```c# |
|||
namespace DashboardDemo |
|||
{ |
|||
public interface IDemoStatisticAppService : IApplicationService |
|||
{ |
|||
Task<GetMonthlyUserStatisticDto> GetMonthlyUserStatistic(FilterDto filter); |
|||
|
|||
Task<MonthlyProfitStatisticDto> GetMonthlyProfitStatistic(FilterDto filter); |
|||
} |
|||
|
|||
public class DemoStatisticAppService : ApplicationService, IDemoStatisticAppService |
|||
{ |
|||
public async Task<MonthlyProfitStatisticDto> GetMonthlyProfitStatistic(FilterDto filter) |
|||
{ |
|||
var monthCount = GetLabels(filter, out var monthList); |
|||
|
|||
var data = Enumerable |
|||
.Repeat(0, monthCount) |
|||
.Select(i => new Random().Next(-20, 40)) |
|||
.ToArray(); |
|||
|
|||
return new MonthlyProfitStatisticDto { Labels = monthList.ToArray(), Data = data }; |
|||
} |
|||
|
|||
private static int GetLabels(FilterDto filter, out List<string> monthList) |
|||
{ |
|||
DateTime endDate = filter.EndDate ?? DateTime.Now; |
|||
DateTime startDate = filter.StartDate ?? DateTime.Now.AddYears(-1); |
|||
|
|||
if (filter.StartDate > filter.EndDate) |
|||
{ |
|||
throw new BusinessException("Start date can not be greater than end date."); |
|||
} |
|||
|
|||
var months = new[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}; |
|||
var monthCount = (endDate.Year - startDate.Year) * 12 + endDate.Month - startDate.Month +1; |
|||
monthList = new List<string>(); |
|||
|
|||
for (int i = 0; i < monthCount; i++) |
|||
{ |
|||
monthList.Add(months[endDate.Month-1]); |
|||
endDate = endDate.AddMonths(-1); |
|||
} |
|||
|
|||
monthList.Reverse(); |
|||
|
|||
return monthCount; |
|||
} |
|||
} |
|||
|
|||
public class MonthlyProfitStatisticDto |
|||
{ |
|||
public string[] Labels { get; set; } |
|||
|
|||
public int[] Data { get; set; } |
|||
} |
|||
|
|||
public class FilterDto |
|||
{ |
|||
public DateTime? StartDate { get; set; } |
|||
|
|||
public DateTime? EndDate { get; set; } |
|||
} |
|||
} |
|||
``` |
|||
|
|||
我们将在**Global Filters**中使用**FilterDto**. |
|||
|
|||
现在我们可以开始处理我们的小部件了. |
|||
|
|||
 |
|||
|
|||
你可以看到我们将创建小部件的文件. (如果你的小部件不需要css或javascript,则不需要创建它们和贡献者). |
|||
|
|||
首先我们创建 **MonthlyProfitWidgetViewComponent**: |
|||
|
|||
```html |
|||
@inject IHtmlLocalizer<DashboardDemoResource> L |
|||
@using DashboardDemo.Localization.DashboardDemo |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@model DashboardDemo.Pages.widgets.MonthlyProfitWidgetViewComponent |
|||
@{ |
|||
} |
|||
<div id="MonthlyProfitWidgetContainer"> |
|||
<abp-card background="Light"> |
|||
<abp-card-header background="Info">@L["Monthly Profit"]</abp-card-header> |
|||
<abp-card-body> |
|||
<div class="row margin-bottom-5"> |
|||
<canvas id="MonthlyProfitStatistics"></canvas> |
|||
</div> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
</div> |
|||
|
|||
``` |
|||
|
|||
```c# |
|||
public class MonthlyProfitWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
public const string Name = "MonthlyProfitWidget"; |
|||
|
|||
public const string DisplayName = "Monthly Profit Widget"; |
|||
|
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidgetViewComponent.cshtml", new MonthlyProfitWidgetViewComponent()); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
我们将使用[chart.js library](https://www.chartjs.org/)来创建图表. 要将此库添加到项目中,我们将包依赖项添加到**package.json**: |
|||
|
|||
```json |
|||
"dependencies": { |
|||
//other dependencies... |
|||
"chart.js": "^2.8.0" |
|||
} |
|||
``` |
|||
|
|||
然后添加映射到**abp.resourcemappings.js**:(参见[相关文档](/AspNetCore/Client-Side-Package-Management#resource-mapping-definition-file)) |
|||
|
|||
```js |
|||
mappings: { |
|||
//other mappings... |
|||
"@node_modules/chart.js/dist/*.*": "@libs/chart.js/" |
|||
} |
|||
``` |
|||
|
|||
现在我们的应用程序中有chart.js库. 为了使用它,我们将创建它的贡献者: |
|||
|
|||
```c# |
|||
public class ChartjsScriptContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/libs/chart.js/Chart.js"); |
|||
} |
|||
} |
|||
|
|||
public class ChartjsStyleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/libs/chart.js/Chart.css"); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
现在我们为小部件文件创建贡献者并使它们依赖于chart.js: |
|||
|
|||
```c# |
|||
[DependsOn(typeof(JQueryScriptContributor))] |
|||
[DependsOn(typeof(ChartjsScriptContributor))] |
|||
public class MonthlyProfitWidgetScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidget.js"); |
|||
} |
|||
} |
|||
|
|||
[DependsOn(typeof(BootstrapStyleContributor))] |
|||
[DependsOn(typeof(ChartjsStyleContributor))] |
|||
public class MonthlyProfitWidgetStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidget.css"); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
**MonthlyProfitWidget.css** 对于我们的小部件是空的. |
|||
|
|||
**MonthlyProfitWidget.js** 内容如下: |
|||
|
|||
```js |
|||
(function ($) { |
|||
var $container = $('#MonthlyProfitWidgetContainer'); |
|||
if ($container.length > 0) { |
|||
var chart = {}; |
|||
|
|||
var createChart = function () { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({}).then(function (result) { |
|||
chart = new Chart($container.find('#MonthlyProfitStatistics'), { |
|||
type: 'line', |
|||
data: { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
options: { |
|||
scales: { |
|||
yAxes: [{ |
|||
ticks: { |
|||
beginAtZero: true |
|||
} |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
createChart(); |
|||
} |
|||
})(jQuery); |
|||
|
|||
``` |
|||
|
|||
我们创建了小部件. 在将其添加到仪表板之前还有最后一件事, 我们需要定义它: |
|||
|
|||
```c# |
|||
public static class WidgetDefinitionProvider |
|||
{ |
|||
public static List<WidgetDefinition> GetDefinitions() |
|||
{ |
|||
//other widgets... |
|||
|
|||
var monthlyProfitWidget = new WidgetDefinition( |
|||
MonthlyProfitWidgetViewComponent.Name, |
|||
LocalizableString.Create<DashboardDemoResource>(MonthlyProfitWidgetViewComponent.DisplayName), |
|||
typeof(MonthlyProfitWidgetViewComponent) |
|||
) |
|||
.SetDefaultDimension(6, 4) |
|||
.AddRequiredPermission(IdentityPermissions.Users.Default); |
|||
|
|||
return new List<WidgetDefinition> |
|||
{ |
|||
//other widgets... |
|||
monthlyProfitWidget |
|||
}; |
|||
} |
|||
} |
|||
``` |
|||
|
|||
**SetDefaultDimension(int x, int y):** 设置小部件的尺寸. 在仪表板中渲染时将使用此选项. X表示bootstrap中的列宽,可以在1到12之间.Y是以像素为单位的高度,将乘以100. |
|||
|
|||
**AddRequiredPermission(string permissionName)**: 设置窗口小部件的权限. 因此, 没有此权限的用户将看不到此小部件. |
|||
|
|||
我们需要在**WebModule.cs**文件的**ConfigureServices**方法中将小部件定义添加到**WidgetOptions**: |
|||
|
|||
```c# |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets.AddRange(WidgetDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
``` |
|||
|
|||
现在我们的小部件已经可以使用了. 我们将使用**DashboardDefinitionProvider.cs**中**WithWidget**方法将其添加到仪表板中: |
|||
|
|||
```c# |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard")) |
|||
.WithWidget(MonthlyProfitWidgetViewComponent.Name); |
|||
``` |
|||
|
|||
并将javascript和contributor依赖项添加到仪表板: |
|||
|
|||
```c# |
|||
[DependsOn(typeof(MonthlyProfitWidgetScriptBundleContributor))] // <<<<<< |
|||
[DependsOn(typeof(AbpBasicDashboardScriptContributor))] |
|||
public class MyDashboardScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
|||
[DependsOn(typeof(MonthlyProfitWidgetStyleBundleContributor))] // <<<<<< |
|||
[DependsOn(typeof(AbpBasicDashboardStyleContributor))] |
|||
public class MyDashboardStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
``` |
|||
|
|||
现在启动应用程序并转到 **/MyDashboard**页面. |
|||
|
|||
## 全局过滤器 |
|||
|
|||
全局过滤器用于过滤具有相同输入的所有小部件. 如果向仪表板添加全局过滤器,则会显示刷新按钮,以使用新过滤器值刷新窗口小部件. 单击此按钮时,它会将过滤器序列化为对象,并以该对象作为参数触发事件. |
|||
|
|||
我们来实现一个**date range**全局过滤器. |
|||
|
|||
首先我们创建 **DateRangeGlobalFilterViewComponent.cshtml**: |
|||
|
|||
```html |
|||
@inject IHtmlLocalizer<DashboardDemoResource> L |
|||
@using DashboardDemo.Localization.DashboardDemo |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@model DashboardDemo.Pages.widgets.Filters.DateRangeGlobalFilterViewComponent |
|||
@{ |
|||
} |
|||
<div id="DateRangeGlobalFilterContainer"> |
|||
<div class="row"> |
|||
<div class="col-md-6 mb-3"> |
|||
<label for="DateFilterStartDateInput">@L["Start Date"].Value</label> |
|||
<input class="form-control" type="date" name="StartDate" id="DateFilterStartDateInput"> |
|||
</div> |
|||
<div class="col-md-6 mb-3"> |
|||
<label for="DateFilterEndDateInput">@L["End Date"].Value</label> |
|||
<input class="form-control" type="date" name="EndDate" id="EndDateStartDateInput"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
``` |
|||
|
|||
```c# |
|||
namespace DashboardDemo.Pages.widgets.Filters |
|||
{ |
|||
[ViewComponent] |
|||
public class DateRangeGlobalFilterViewComponent : ViewComponent |
|||
{ |
|||
public const string Name = "DateRangeGlobalFilter"; |
|||
|
|||
public const string DisplayName = "Date Range Filter"; |
|||
|
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("/Pages/widgets/Filters/DateRangeGlobalFilterViewComponent.cshtml", new DateRangeGlobalFilterViewComponent()); |
|||
} |
|||
} |
|||
} |
|||
``` |
|||
|
|||
您可以像添加到窗口小部件一样添加javascript和css文件,但在此示例中不需要它们. |
|||
|
|||
我们将在**WebModule.cs**文件的**ConfigureServices**方法中将全局过滤器定义添加到**GlobalFilterOptions**: |
|||
|
|||
```c# |
|||
Configure<GlobalFilterOptions>(options => |
|||
{ |
|||
options.GlobalFilters.AddRange(GlobalFilterDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
``` |
|||
|
|||
并使用**WithGlobalFilter**方法将其添加到**DashboardDefinitionProvider.cs**中的仪表板中: |
|||
|
|||
```c# |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard")) |
|||
.WithWidget(MonthlyProfitWidgetViewComponent.Name) |
|||
.WithGlobalFilter(DateRangeGlobalFilterViewComponent.Name); |
|||
``` |
|||
|
|||
现在让我们在小部件中捕获刷新事件: |
|||
|
|||
```js |
|||
(function ($) { |
|||
var $container = $('#MonthlyProfitWidgetContainer'); |
|||
if ($container.length > 0) { |
|||
var chart = {}; |
|||
|
|||
var createChart = function () { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({}).then(function (result) { |
|||
chart = new Chart($container.find('#MonthlyProfitStatistics'), { |
|||
type: 'line', |
|||
data: { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
options: { |
|||
scales: { |
|||
yAxes: [{ |
|||
ticks: { |
|||
beginAtZero: true |
|||
} |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
$(document).on('RefreshWidgets', |
|||
function (event, filters) { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({ startDate: filters.startDate, endDate: filters.endDate }).then(function (result) { |
|||
chart.data = { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
chart.update(); |
|||
}); |
|||
}); |
|||
|
|||
createChart(); |
|||
} |
|||
})(jQuery); |
|||
|
|||
``` |
|||
|
|||
## 源代码 |
|||
|
|||
你可以在[Github](https://github.com/abpframework/abp/tree/dev/samples/DashboardDemo)查看仪表板的示例应用程序 |
|||
@ -1,6 +1,6 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
{ |
|||
public static class BundleContributorListExtensions |
|||
public static class BundleContributorCollectionExtensions |
|||
{ |
|||
public static void AddFiles(this BundleContributorCollection contributors, params string[] files) |
|||
{ |
|||
@ -1,13 +1,55 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.ViewComponents; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAspNetCoreMvcUiBootstrapModule) |
|||
)] |
|||
typeof(AbpAspNetCoreMvcUiBootstrapModule), |
|||
typeof(AbpAspNetCoreMvcUiBundlingModule) |
|||
)] |
|||
public class AbpAspNetCoreMvcUiWidgetsModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
AutoAddWidgets(context.Services); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddTransient<DefaultViewComponentHelper>(); |
|||
|
|||
Configure<VirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpAspNetCoreMvcUiWidgetsModule>(); |
|||
}); |
|||
} |
|||
|
|||
private static void AutoAddWidgets(IServiceCollection services) |
|||
{ |
|||
var widgetTypes = new List<Type>(); |
|||
|
|||
services.OnRegistred(context => |
|||
{ |
|||
if (WidgetAttribute.IsWidget(context.ImplementationType)) |
|||
{ |
|||
widgetTypes.Add(context.ImplementationType); |
|||
} |
|||
}); |
|||
|
|||
services.Configure<WidgetOptions>(options => |
|||
{ |
|||
foreach (var widgetType in widgetTypes) |
|||
{ |
|||
options.Widgets.Add(new WidgetDefinition(widgetType)); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,85 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Html; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.Rendering; |
|||
using Microsoft.AspNetCore.Mvc.ViewComponents; |
|||
using Microsoft.AspNetCore.Mvc.ViewFeatures; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.Authorization; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class AbpViewComponentHelper : IViewComponentHelper, IViewContextAware, ITransientDependency |
|||
{ |
|||
protected WidgetOptions Options { get; } |
|||
protected IPageWidgetManager PageWidgetManager { get; } |
|||
protected IAuthorizationService AuthorizationService { get; } |
|||
protected ICurrentUser CurrentUser { get; } |
|||
protected DefaultViewComponentHelper DefaultViewComponentHelper { get; } |
|||
|
|||
public AbpViewComponentHelper( |
|||
DefaultViewComponentHelper defaultViewComponentHelper, |
|||
IOptions<WidgetOptions> widgetOptions, |
|||
IPageWidgetManager pageWidgetManager, |
|||
IAuthorizationService authorizationService, |
|||
ICurrentUser currentUser) |
|||
{ |
|||
DefaultViewComponentHelper = defaultViewComponentHelper; |
|||
PageWidgetManager = pageWidgetManager; |
|||
AuthorizationService = authorizationService; |
|||
CurrentUser = currentUser; |
|||
Options = widgetOptions.Value; |
|||
} |
|||
|
|||
public virtual async Task<IHtmlContent> InvokeAsync(string name, object arguments) |
|||
{ |
|||
var widget = Options.Widgets.Find(name); |
|||
if (widget == null) |
|||
{ |
|||
return await DefaultViewComponentHelper.InvokeAsync(name, arguments); |
|||
} |
|||
|
|||
return await InvokeWidgetAsync(arguments, widget); |
|||
} |
|||
|
|||
public virtual async Task<IHtmlContent> InvokeAsync(Type componentType, object arguments) |
|||
{ |
|||
var widget = Options.Widgets.Find(componentType); |
|||
if (widget == null) |
|||
{ |
|||
return await DefaultViewComponentHelper.InvokeAsync(componentType, arguments); |
|||
} |
|||
|
|||
return await InvokeWidgetAsync(arguments, widget); |
|||
} |
|||
|
|||
public virtual void Contextualize(ViewContext viewContext) |
|||
{ |
|||
DefaultViewComponentHelper.Contextualize(viewContext); |
|||
} |
|||
|
|||
protected virtual async Task<IHtmlContent> InvokeWidgetAsync(object arguments, WidgetDefinition widget) |
|||
{ |
|||
if (widget.RequiredPolicies.Any()) |
|||
{ |
|||
foreach (var requiredPolicy in widget.RequiredPolicies) |
|||
{ |
|||
await AuthorizationService.AuthorizeAsync(requiredPolicy); |
|||
} |
|||
} |
|||
else if (widget.RequiresAuthentication && !CurrentUser.IsAuthenticated) |
|||
{ |
|||
throw new AbpAuthorizationException("Authorization failed! User has not logged in."); |
|||
} |
|||
|
|||
PageWidgetManager.TryAdd(widget); |
|||
return await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components |
|||
{ |
|||
public class WidgetResourcesViewModel |
|||
{ |
|||
public IReadOnlyList<WidgetDefinition> Widgets { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
@model Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetResourcesViewModel |
|||
@if (Model.Widgets.Any()) |
|||
{ |
|||
var resourceItems = Model.Widgets.SelectMany(w => w.Scripts).ToArray(); |
|||
if (resourceItems.Any()) |
|||
{ |
|||
<abp-script-bundle> |
|||
@foreach (var resourceItem in resourceItems) |
|||
{ |
|||
if (resourceItem.Src != null) |
|||
{ |
|||
<abp-script src="@resourceItem.Src" /> |
|||
} |
|||
else |
|||
{ |
|||
<abp-script type="@resourceItem.Type" /> |
|||
} |
|||
} |
|||
</abp-script-bundle> |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetScripts |
|||
{ |
|||
public class WidgetScriptsViewComponent : AbpViewComponent |
|||
{ |
|||
protected IPageWidgetManager PageWidgetManager { get; } |
|||
protected WidgetOptions Options { get; } |
|||
|
|||
public WidgetScriptsViewComponent( |
|||
IPageWidgetManager pageWidgetManager, |
|||
IOptions<WidgetOptions> options) |
|||
{ |
|||
PageWidgetManager = pageWidgetManager; |
|||
Options = options.Value; |
|||
} |
|||
|
|||
public virtual IViewComponentResult Invoke() |
|||
{ |
|||
return View( |
|||
"~/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetScripts/Default.cshtml", |
|||
new WidgetResourcesViewModel |
|||
{ |
|||
Widgets = PageWidgetManager.GetAll() |
|||
} |
|||
); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
@model Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetResourcesViewModel |
|||
@if (Model.Widgets.Any()) |
|||
{ |
|||
var resourceItems = Model.Widgets.SelectMany(w => w.Styles).ToArray(); |
|||
if (resourceItems.Any()) |
|||
{ |
|||
<abp-style-bundle> |
|||
@foreach (var resourceItem in resourceItems) |
|||
{ |
|||
if (resourceItem.Src != null) |
|||
{ |
|||
<abp-style src="@resourceItem.Src" /> |
|||
} |
|||
else |
|||
{ |
|||
<abp-style type="@resourceItem.Type" /> |
|||
} |
|||
} |
|||
</abp-style-bundle> |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Options; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets.Components.WidgetStyles |
|||
{ |
|||
public class WidgetStylesViewComponent : AbpViewComponent |
|||
{ |
|||
protected IPageWidgetManager PageWidgetManager { get; } |
|||
protected WidgetOptions Options { get; } |
|||
|
|||
public WidgetStylesViewComponent( |
|||
IPageWidgetManager pageWidgetManager, |
|||
IOptions<WidgetOptions> options) |
|||
{ |
|||
PageWidgetManager = pageWidgetManager; |
|||
Options = options.Value; |
|||
} |
|||
|
|||
public virtual IViewComponentResult Invoke() |
|||
{ |
|||
return View( |
|||
"~/Volo/Abp/AspNetCore/Mvc/UI/Widgets/Components/WidgetStyles/Default.cshtml", |
|||
new WidgetResourcesViewModel |
|||
{ |
|||
Widgets = PageWidgetManager.GetAll() |
|||
} |
|||
); |
|||
} |
|||
} |
|||
} |
|||
@ -1,3 +1,3 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -0,0 +1,11 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public interface IPageWidgetManager |
|||
{ |
|||
bool TryAdd(WidgetDefinition widget); |
|||
|
|||
IReadOnlyList<WidgetDefinition> GetAll(); |
|||
} |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Html; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public interface IWidgetRenderer : ITransientDependency |
|||
{ |
|||
Task<IHtmlContent> RenderAsync(IViewComponentHelper componentHelper, string widgetName, object args = null); |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
using System.Collections.Generic; |
|||
using System.Collections.Immutable; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public class PageWidgetManager : IPageWidgetManager, IScopedDependency |
|||
{ |
|||
public const string HttpContextItemName = "__AbpCurrentWidgets"; |
|||
|
|||
private readonly IHttpContextAccessor _httpContextAccessor; |
|||
|
|||
public PageWidgetManager(IHttpContextAccessor httpContextAccessor) |
|||
{ |
|||
_httpContextAccessor = httpContextAccessor; |
|||
} |
|||
|
|||
public bool TryAdd(WidgetDefinition widget) |
|||
{ |
|||
return GetWidgetList() |
|||
.AddIfNotContains(widget); |
|||
} |
|||
|
|||
private List<WidgetDefinition> GetWidgetList() |
|||
{ |
|||
var httpContext = _httpContextAccessor.HttpContext; |
|||
if (httpContext == null) |
|||
{ |
|||
throw new AbpException($"{typeof(PageWidgetManager).AssemblyQualifiedName} should be used in a web request! Can not get IHttpContextAccessor.HttpContext."); |
|||
} |
|||
|
|||
var widgets = httpContext.Items[HttpContextItemName] as List<WidgetDefinition>; |
|||
if (widgets == null) |
|||
{ |
|||
widgets = new List<WidgetDefinition>(); |
|||
httpContext.Items[HttpContextItemName] = widgets; |
|||
} |
|||
|
|||
return widgets; |
|||
} |
|||
|
|||
public IReadOnlyList<WidgetDefinition> GetAll() |
|||
{ |
|||
return GetWidgetList().ToImmutableArray(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
using System; |
|||
using System.Reflection; |
|||
using JetBrains.Annotations; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
[AttributeUsage(AttributeTargets.Class)] |
|||
public class WidgetAttribute : Attribute |
|||
{ |
|||
[CanBeNull] |
|||
public string[] StyleFiles { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public Type[] StyleTypes { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string[] ScriptFiles { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public Type[] ScriptTypes { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string DisplayName { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public Type DisplayNameResource { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string[] RequiredPolicies { get; set; } |
|||
|
|||
public bool RequiresAuthentication { get; set; } |
|||
|
|||
public static bool IsWidget(Type type) |
|||
{ |
|||
return type.IsSubclassOf(typeof(ViewComponent)) && |
|||
type.IsDefined(typeof(WidgetAttribute), true); |
|||
} |
|||
|
|||
public static WidgetAttribute Get(Type viewComponentType) |
|||
{ |
|||
return viewComponentType.GetCustomAttribute<WidgetAttribute>(true) |
|||
?? throw new AbpException($"Given type '{viewComponentType.AssemblyQualifiedName}' does not declare a {typeof(WidgetAttribute).AssemblyQualifiedName}"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.Immutable; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public class WidgetDefinitionCollection |
|||
{ |
|||
private readonly Dictionary<string, WidgetDefinition> _widgetsByName; |
|||
private readonly Dictionary<Type, WidgetDefinition> _widgetsByType; |
|||
|
|||
public WidgetDefinitionCollection() |
|||
{ |
|||
_widgetsByName = new Dictionary<string, WidgetDefinition>(); |
|||
_widgetsByType = new Dictionary<Type, WidgetDefinition>(); |
|||
} |
|||
|
|||
public void Add(WidgetDefinition widget) |
|||
{ |
|||
var existingWidget = _widgetsByName.GetOrDefault(widget.Name); |
|||
if (existingWidget != null) |
|||
{ |
|||
_widgetsByType[existingWidget.ViewComponentType] = widget; |
|||
} |
|||
|
|||
_widgetsByName[widget.Name] = widget; |
|||
_widgetsByType[widget.ViewComponentType] = widget; |
|||
} |
|||
|
|||
public WidgetDefinition Add<TViewComponent>( |
|||
[CanBeNull] ILocalizableString displayName = null) |
|||
{ |
|||
return Add(typeof(TViewComponent), displayName); |
|||
} |
|||
|
|||
public WidgetDefinition Add( |
|||
[NotNull] Type viewComponentType, |
|||
[CanBeNull] ILocalizableString displayName = null) |
|||
{ |
|||
var widget = new WidgetDefinition(viewComponentType, displayName); |
|||
Add(widget); |
|||
return widget; |
|||
} |
|||
|
|||
[CanBeNull] |
|||
public WidgetDefinition Find(string name) |
|||
{ |
|||
return _widgetsByName.GetOrDefault(name); |
|||
} |
|||
|
|||
[CanBeNull] |
|||
public WidgetDefinition Find<TViewComponent>() |
|||
{ |
|||
return Find(typeof(TViewComponent)); |
|||
} |
|||
|
|||
[CanBeNull] |
|||
public WidgetDefinition Find(Type viewComponentType) |
|||
{ |
|||
return _widgetsByType.GetOrDefault(viewComponentType); |
|||
} |
|||
|
|||
public IReadOnlyCollection<WidgetDefinition> GetAll() |
|||
{ |
|||
return _widgetsByName.Values.ToImmutableArray(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +1,12 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public class WidgetOptions |
|||
{ |
|||
public List<WidgetDefinition> Widgets { get; } |
|||
public WidgetDefinitionCollection Widgets { get; } |
|||
|
|||
public WidgetOptions() |
|||
{ |
|||
Widgets = new List<WidgetDefinition>(); |
|||
Widgets = new WidgetDefinitionCollection(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,25 +0,0 @@ |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Html; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Options; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public class WidgetRenderer : IWidgetRenderer |
|||
{ |
|||
private readonly WidgetOptions _widgetOptions; |
|||
|
|||
public WidgetRenderer(IOptions<WidgetOptions> widgetOptions) |
|||
{ |
|||
_widgetOptions = widgetOptions.Value; |
|||
} |
|||
|
|||
public async Task<IHtmlContent> RenderAsync(IViewComponentHelper componentHelper, string widgetName, object args = null) |
|||
{ |
|||
var widget = _widgetOptions.Widgets.Single(w=>w.Name.Equals(widgetName)); |
|||
|
|||
return await componentHelper.InvokeAsync(widget.ViewComponentType, args ?? new object()); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
{ |
|||
public class WidgetResourceItem |
|||
{ |
|||
[CanBeNull] |
|||
public string Src { get; } |
|||
|
|||
[CanBeNull] |
|||
public Type Type { get; } |
|||
|
|||
public WidgetResourceItem([NotNull] string src) |
|||
{ |
|||
Src = Check.NotNullOrWhiteSpace(src, nameof(src)); |
|||
} |
|||
|
|||
public WidgetResourceItem([NotNull] Type type) |
|||
{ |
|||
Type = Check.NotNull(type, nameof(type)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
namespace System |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="DateTime"/>.
|
|||
/// </summary>
|
|||
public static class AbpDateTimeExtensions |
|||
{ |
|||
public static DateTime ClearTime(this DateTime dateTime) |
|||
{ |
|||
return dateTime.Subtract( |
|||
new TimeSpan( |
|||
0, |
|||
dateTime.Hour, |
|||
dateTime.Minute, |
|||
dateTime.Second, |
|||
dateTime.Millisecond |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|||
@ -1 +0,0 @@ |
|||
**/wwwroot/libs/** linguist-vendored |
|||
@ -1,255 +0,0 @@ |
|||
## Ignore Visual Studio temporary files, build results, and |
|||
## files generated by popular Visual Studio add-ons. |
|||
|
|||
# User-specific files |
|||
*.suo |
|||
*.user |
|||
*.userosscache |
|||
*.sln.docstates |
|||
|
|||
# User-specific files (MonoDevelop/Xamarin Studio) |
|||
*.userprefs |
|||
|
|||
# Build results |
|||
[Dd]ebug/ |
|||
[Dd]ebugPublic/ |
|||
[Rr]elease/ |
|||
[Rr]eleases/ |
|||
x64/ |
|||
x86/ |
|||
bld/ |
|||
[Bb]in/ |
|||
[Oo]bj/ |
|||
[Ll]og/ |
|||
|
|||
# Visual Studio 2015 cache/options directory |
|||
.vs/ |
|||
# Uncomment if you have tasks that create the project's static files in wwwroot |
|||
#wwwroot/ |
|||
|
|||
# MSTest test Results |
|||
[Tt]est[Rr]esult*/ |
|||
[Bb]uild[Ll]og.* |
|||
|
|||
# NUNIT |
|||
*.VisualState.xml |
|||
TestResult.xml |
|||
|
|||
# Build Results of an ATL Project |
|||
[Dd]ebugPS/ |
|||
[Rr]eleasePS/ |
|||
dlldata.c |
|||
|
|||
# DNX |
|||
project.lock.json |
|||
artifacts/ |
|||
|
|||
*_i.c |
|||
*_p.c |
|||
*_i.h |
|||
*.ilk |
|||
*.meta |
|||
*.obj |
|||
*.pch |
|||
*.pdb |
|||
*.pgc |
|||
*.pgd |
|||
*.rsp |
|||
*.sbr |
|||
*.tlb |
|||
*.tli |
|||
*.tlh |
|||
*.tmp |
|||
*.tmp_proj |
|||
*.log |
|||
*.vspscc |
|||
*.vssscc |
|||
.builds |
|||
*.pidb |
|||
*.svclog |
|||
*.scc |
|||
|
|||
# Chutzpah Test files |
|||
_Chutzpah* |
|||
|
|||
# Visual C++ cache files |
|||
ipch/ |
|||
*.aps |
|||
*.ncb |
|||
*.opendb |
|||
*.opensdf |
|||
*.sdf |
|||
*.cachefile |
|||
*.VC.db |
|||
*.VC.VC.opendb |
|||
|
|||
# Visual Studio profiler |
|||
*.psess |
|||
*.vsp |
|||
*.vspx |
|||
*.sap |
|||
|
|||
# TFS 2012 Local Workspace |
|||
$tf/ |
|||
|
|||
# Guidance Automation Toolkit |
|||
*.gpState |
|||
|
|||
# ReSharper is a .NET coding add-in |
|||
_ReSharper*/ |
|||
*.[Rr]e[Ss]harper |
|||
*.DotSettings.user |
|||
|
|||
# JustCode is a .NET coding add-in |
|||
.JustCode |
|||
|
|||
# TeamCity is a build add-in |
|||
_TeamCity* |
|||
|
|||
# DotCover is a Code Coverage Tool |
|||
*.dotCover |
|||
|
|||
# NCrunch |
|||
_NCrunch_* |
|||
.*crunch*.local.xml |
|||
nCrunchTemp_* |
|||
|
|||
# MightyMoose |
|||
*.mm.* |
|||
AutoTest.Net/ |
|||
|
|||
# Web workbench (sass) |
|||
.sass-cache/ |
|||
|
|||
# Installshield output folder |
|||
[Ee]xpress/ |
|||
|
|||
# DocProject is a documentation generator add-in |
|||
DocProject/buildhelp/ |
|||
DocProject/Help/*.HxT |
|||
DocProject/Help/*.HxC |
|||
DocProject/Help/*.hhc |
|||
DocProject/Help/*.hhk |
|||
DocProject/Help/*.hhp |
|||
DocProject/Help/Html2 |
|||
DocProject/Help/html |
|||
|
|||
# Click-Once directory |
|||
publish/ |
|||
|
|||
# Publish Web Output |
|||
*.[Pp]ublish.xml |
|||
*.azurePubxml |
|||
# TODO: Comment the next line if you want to checkin your web deploy settings |
|||
# but database connection strings (with potential passwords) will be unencrypted |
|||
*.pubxml |
|||
*.publishproj |
|||
|
|||
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
|||
# checkin your Azure Web App publish settings, but sensitive information contained |
|||
# in these scripts will be unencrypted |
|||
PublishScripts/ |
|||
|
|||
# NuGet Packages |
|||
*.nupkg |
|||
# The packages folder can be ignored because of Package Restore |
|||
**/packages/* |
|||
# except build/, which is used as an MSBuild target. |
|||
!**/packages/build/ |
|||
# Uncomment if necessary however generally it will be regenerated when needed |
|||
#!**/packages/repositories.config |
|||
# NuGet v3's project.json files produces more ignoreable files |
|||
*.nuget.props |
|||
*.nuget.targets |
|||
|
|||
# Microsoft Azure Build Output |
|||
csx/ |
|||
*.build.csdef |
|||
|
|||
# Microsoft Azure Emulator |
|||
ecf/ |
|||
rcf/ |
|||
|
|||
# Windows Store app package directories and files |
|||
AppPackages/ |
|||
BundleArtifacts/ |
|||
Package.StoreAssociation.xml |
|||
_pkginfo.txt |
|||
|
|||
# Visual Studio cache files |
|||
# files ending in .cache can be ignored |
|||
*.[Cc]ache |
|||
# but keep track of directories ending in .cache |
|||
!*.[Cc]ache/ |
|||
|
|||
# Others |
|||
ClientBin/ |
|||
~$* |
|||
*~ |
|||
*.dbmdl |
|||
*.dbproj.schemaview |
|||
*.pfx |
|||
*.publishsettings |
|||
node_modules/ |
|||
orleans.codegen.cs |
|||
|
|||
# Since there are multiple workflows, uncomment next line to ignore bower_components |
|||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
|||
#bower_components/ |
|||
|
|||
# RIA/Silverlight projects |
|||
Generated_Code/ |
|||
|
|||
# Backup & report files from converting an old project file |
|||
# to a newer Visual Studio version. Backup files are not needed, |
|||
# because we have git ;-) |
|||
_UpgradeReport_Files/ |
|||
Backup*/ |
|||
UpgradeLog*.XML |
|||
UpgradeLog*.htm |
|||
|
|||
# SQL Server files |
|||
*.mdf |
|||
*.ldf |
|||
|
|||
# Business Intelligence projects |
|||
*.rdl.data |
|||
*.bim.layout |
|||
*.bim_*.settings |
|||
|
|||
# Microsoft Fakes |
|||
FakesAssemblies/ |
|||
|
|||
# GhostDoc plugin setting file |
|||
*.GhostDoc.xml |
|||
|
|||
# Node.js Tools for Visual Studio |
|||
.ntvs_analysis.dat |
|||
|
|||
# Visual Studio 6 build log |
|||
*.plg |
|||
|
|||
# Visual Studio 6 workspace options file |
|||
*.opt |
|||
|
|||
# Visual Studio LightSwitch build output |
|||
**/*.HTMLClient/GeneratedArtifacts |
|||
**/*.DesktopClient/GeneratedArtifacts |
|||
**/*.DesktopClient/ModelManifest.xml |
|||
**/*.Server/GeneratedArtifacts |
|||
**/*.Server/ModelManifest.xml |
|||
_Pvt_Extensions |
|||
|
|||
# Paket dependency manager |
|||
.paket/paket.exe |
|||
paket-files/ |
|||
|
|||
# FAKE - F# Make |
|||
.fake/ |
|||
|
|||
# JetBrains Rider |
|||
.idea/ |
|||
*.sln.iml |
|||
|
|||
# DashboardDemo |
|||
src/DashboardDemo.Web/Logs/logs.txt |
|||
@ -1,74 +0,0 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio 15 |
|||
VisualStudioVersion = 15.0.27703.1 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Domain", "src\DashboardDemo.Domain\DashboardDemo.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Application", "src\DashboardDemo.Application\DashboardDemo.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.EntityFrameworkCore", "src\DashboardDemo.EntityFrameworkCore\DashboardDemo.EntityFrameworkCore.csproj", "{C956DD76-69C8-4A9C-83EA-D17DF83340FD}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Web", "src\DashboardDemo.Web\DashboardDemo.Web.csproj", "{068855E8-9240-4F1A-910B-CF825794513B}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Application.Tests", "test\DashboardDemo.Application.Tests\DashboardDemo.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.Web.Tests", "test\DashboardDemo.Web.Tests\DashboardDemo.Web.Tests.csproj", "{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DashboardDemo.EntityFrameworkCore.DbMigrations", "src\DashboardDemo.EntityFrameworkCore.DbMigrations\DashboardDemo.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(NestedProjects) = preSolution |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{068855E8-9240-4F1A-910B-CF825794513B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -1,7 +0,0 @@ |
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
|||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/@KeyIndexDefined">True</s:Boolean> |
|||
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/AbsolutePath/@EntryValue">D:\github\abp\common.DotSettings</s:String> |
|||
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=59923913AE66194DB837F628B1FC08BE/RelativePath/@EntryValue">..\..\..\common.DotSettings</s:String> |
|||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File59923913AE66194DB837F628B1FC08BE/@KeyIndexDefined">True</s:Boolean> |
|||
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File59923913AE66194DB837F628B1FC08BE/RelativePriority/@EntryValue">1</s:Double> |
|||
</wpf:ResourceDictionary> |
|||
@ -1,7 +0,0 @@ |
|||
<Project> |
|||
<PropertyGroup> |
|||
<LangVersion>latest</LangVersion> |
|||
<Version>1.0.0</Version> |
|||
<NoWarn>$(NoWarn);CS1591</NoWarn> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -1,18 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>DashboardDemo</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\DashboardDemo.Domain\DashboardDemo.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application\Volo.Abp.TenantManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Application\Volo.Abp.FeatureManagement.Application.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,12 +0,0 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class DashboardDemoApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public DashboardDemoApplicationAutoMapperProfile() |
|||
{ |
|||
//Configure your AutoMapper mapping configuration here...
|
|||
} |
|||
} |
|||
} |
|||
@ -1,27 +0,0 @@ |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.TenantManagement; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
[DependsOn( |
|||
typeof(DashboardDemoDomainModule), |
|||
typeof(AbpIdentityApplicationModule), |
|||
typeof(AbpPermissionManagementApplicationModule), |
|||
typeof(AbpTenantManagementApplicationModule), |
|||
typeof(AbpFeatureManagementApplicationModule) |
|||
)] |
|||
public class DashboardDemoApplicationModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddProfile<DashboardDemoApplicationAutoMapperProfile>(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -1,63 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class DemoStatisticAppService : ApplicationService, IDemoStatisticAppService |
|||
{ |
|||
public async Task<GetMonthlyUserStatisticDto> GetMonthlyUserStatistic(FilterDto filter) |
|||
{ |
|||
var monthCount = GetLabels(filter, out var monthList); |
|||
|
|||
var data = Enumerable |
|||
.Repeat(0, monthCount) |
|||
.Select(i => new Random().Next(750, 960)) |
|||
.ToArray(); |
|||
|
|||
return new GetMonthlyUserStatisticDto{Labels = monthList.ToArray(), Data = data}; |
|||
} |
|||
|
|||
public async Task<MonthlyProfitStatisticDto> GetMonthlyProfitStatistic(FilterDto filter) |
|||
{ |
|||
var monthCount = GetLabels(filter, out var monthList); |
|||
|
|||
var data = Enumerable |
|||
.Repeat(0, monthCount) |
|||
.Select(i => new Random().Next(-20, 40)) |
|||
.ToArray(); |
|||
|
|||
return new MonthlyProfitStatisticDto { Labels = monthList.ToArray(), Data = data }; |
|||
} |
|||
|
|||
private static int GetLabels(FilterDto filter, out List<string> monthList) |
|||
{ |
|||
DateTime endDate = filter.EndDate ?? DateTime.Now; |
|||
DateTime startDate = filter.StartDate ?? DateTime.Now.AddYears(-1); |
|||
|
|||
if (filter.StartDate > filter.EndDate) |
|||
{ |
|||
throw new BusinessException("Start date can not be greater than end date."); |
|||
} |
|||
|
|||
var months = new[] {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}; |
|||
var monthCount = (endDate.Year - startDate.Year) * 12 + endDate.Month - startDate.Month +1; |
|||
monthList = new List<string>(); |
|||
|
|||
for (int i = 0; i < monthCount; i++) |
|||
{ |
|||
monthList.Add(months[endDate.Month-1]); |
|||
endDate = endDate.AddMonths(-1); |
|||
} |
|||
|
|||
|
|||
monthList.Reverse(); |
|||
|
|||
return monthCount; |
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
using System; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class FilterDto |
|||
{ |
|||
public DateTime? StartDate { get; set; } |
|||
|
|||
public DateTime? EndDate { get; set; } |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
namespace DashboardDemo |
|||
{ |
|||
public class GetMonthlyUserStatisticDto |
|||
{ |
|||
public string[] Labels { get; set; } |
|||
|
|||
public int[] Data { get; set; } |
|||
} |
|||
} |
|||
@ -1,15 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public interface IDemoStatisticAppService : IApplicationService |
|||
{ |
|||
Task<GetMonthlyUserStatisticDto> GetMonthlyUserStatistic(FilterDto filter); |
|||
|
|||
Task<MonthlyProfitStatisticDto> GetMonthlyProfitStatistic(FilterDto filter); |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace DashboardDemo.Permissions |
|||
{ |
|||
public class DashboardDemoPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var myGroup = context.AddGroup(DashboardDemoPermissions.GroupName); |
|||
|
|||
//Define your own permissions here. Example:
|
|||
//myGroup.AddPermission(DashboardDemoPermissions.MyPermission1, L("Permission:MyPermission1"));
|
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<DashboardDemoResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.Reflection; |
|||
|
|||
namespace DashboardDemo.Permissions |
|||
{ |
|||
public static class DashboardDemoPermissions |
|||
{ |
|||
public const string GroupName = "DashboardDemo"; |
|||
|
|||
//Add your own permission names. Example:
|
|||
//public const string MyPermission1 = GroupName + ".MyPermission1";
|
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
//Return an array of all permissions
|
|||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(DashboardDemoPermissions)); |
|||
} |
|||
} |
|||
} |
|||
@ -1,25 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>DashboardDemo</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Auditing\Volo.Abp.Auditing.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Domain\Volo.Abp.Identity.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\background-jobs\src\Volo.Abp.BackgroundJobs.Domain\Volo.Abp.BackgroundJobs.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.Domain\Volo.Abp.AuditLogging.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Domain\Volo.Abp.TenantManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Domain\Volo.Abp.FeatureManagement.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.PermissionManagement.Domain.Identity\Volo.Abp.PermissionManagement.Domain.Identity.csproj" /> |
|||
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Localization\DashboardDemo\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,11 +0,0 @@ |
|||
namespace DashboardDemo |
|||
{ |
|||
public static class DashboardDemoConsts |
|||
{ |
|||
public const string DbTablePrefix = "App"; |
|||
|
|||
public const string DbSchema = null; |
|||
|
|||
public const bool IsMultiTenancyEnabled = true; |
|||
} |
|||
} |
|||
@ -1,49 +0,0 @@ |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.AuditLogging; |
|||
using Volo.Abp.BackgroundJobs; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Localization.Resources.AbpValidation; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.PermissionManagement.Identity; |
|||
using Volo.Abp.TenantManagement; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpIdentityDomainModule), |
|||
typeof(AbpPermissionManagementDomainIdentityModule), |
|||
typeof(AbpAuditingModule), |
|||
typeof(BackgroundJobsDomainModule), |
|||
typeof(AbpAuditLoggingDomainModule), |
|||
typeof(AbpTenantManagementDomainModule), |
|||
typeof(AbpFeatureManagementDomainModule) |
|||
)] |
|||
public class DashboardDemoDomainModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<VirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<DashboardDemoDomainModule>("DashboardDemo"); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<DashboardDemoResource>("en") |
|||
.AddBaseTypes(typeof(AbpValidationResource)) |
|||
.AddVirtualJson("/Localization/DashboardDemo"); |
|||
}); |
|||
|
|||
Configure<MultiTenancyOptions>(options => |
|||
{ |
|||
options.IsEnabled = DashboardDemoConsts.IsMultiTenancyEnabled; |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace DashboardDemo.Localization.DashboardDemo |
|||
{ |
|||
[LocalizationResourceName("DashboardDemo")] |
|||
public class DashboardDemoResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
{ |
|||
"culture": "cs", |
|||
"texts": { |
|||
"Menu:Home": "Úvod", |
|||
"Welcome": "Vítejte", |
|||
"RolesInApplication": "Role v aplikaci", |
|||
"UserCount": "Počet uživatelů", |
|||
"LongWelcomeMessage": "Vítejte v aplikaci. Toto je startovací projekt založený na ABP frameworku. Pro více informací, navštivte abp.io." |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Welcome", |
|||
"RolesInApplication": "Roles in application", |
|||
"UserCount": "User count", |
|||
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io." |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
{ |
|||
"culture": "pl", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Witaj", |
|||
"RolesInApplication": "Role w aplikacji", |
|||
"UserCount": "Ilość użytkowników", |
|||
"LongWelcomeMessage": "Witaj w aplikacji. To jest inicjalny projekt bazujący na ABP framework. Po więcej informacji odwiedź stronę abp.io." |
|||
} |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
{ |
|||
"culture": "pt-BR", |
|||
"texts": { |
|||
"Menu:Home": "Principal", |
|||
"Welcome": "Seja bem-vindo!", |
|||
"LongWelcomeMessage": "Bem-vindo a esta aplicação. Este é um projeto inicial baseado no ABP framework. Para mais informações, visite abp.io." |
|||
} |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"Menu:Home": "Ana sayfa", |
|||
"Welcome": "Hoşgeldiniz", |
|||
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz." |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
{ |
|||
"culture": "vi", |
|||
"texts": { |
|||
"Menu:Home": "Trang chủ", |
|||
"Welcome": "Xin chào bạn", |
|||
"RolesInApplication": "Vai trò trong ứng dụng", |
|||
"UserCount": "Số lượng người dùng", |
|||
"LongWelcomeMessage": "Chào mừng bạn đến ứng dụng. Đây là mẫu khởi động dự án dựa trên khung ABP. Để biết thêm thông tin, hãy truy cập abp.io." |
|||
} |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Menu:Home": "首页", |
|||
"Welcome": "欢迎", |
|||
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io." |
|||
} |
|||
} |
|||
@ -1,13 +0,0 @@ |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace DashboardDemo.Settings |
|||
{ |
|||
public class DashboardDemoSettingDefinitionProvider : SettingDefinitionProvider |
|||
{ |
|||
public override void Define(ISettingDefinitionContext context) |
|||
{ |
|||
//Define your own settings here. Example:
|
|||
//context.Add(new SettingDefinition(DashboardDemoSettings.MySetting1));
|
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
namespace DashboardDemo.Settings |
|||
{ |
|||
public static class DashboardDemoSettings |
|||
{ |
|||
private const string Prefix = "DashboardDemo"; |
|||
|
|||
//Add your own setting names here. Example:
|
|||
//public const string MySetting1 = Prefix + ".MySetting1";
|
|||
} |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace DashboardDemo.Users |
|||
{ |
|||
/* This entity shares the same table/collection ("AbpUsers" by default) with the |
|||
* IdentityUser entity of the Identity module. |
|||
* |
|||
* - You can define your custom properties into this class. |
|||
* - You never create or delete this entity, because it is Identity module's job. |
|||
* - You can query users from database with this entity. |
|||
* - You can update values of your custom properties. |
|||
*/ |
|||
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser |
|||
{ |
|||
#region Base properties
|
|||
|
|||
/* These properties are shared with the IdentityUser entity of the Identity module. |
|||
* Do not change these properties through this class. Instead, use Identity module |
|||
* services (like IdentityUserManager) to change them. |
|||
* So, this properties are designed as read only! |
|||
*/ |
|||
|
|||
public virtual Guid? TenantId { get; private set; } |
|||
|
|||
public virtual string UserName { get; private set; } |
|||
|
|||
public virtual string Name { get; private set; } |
|||
|
|||
public virtual string Surname { get; private set; } |
|||
|
|||
public virtual string Email { get; private set; } |
|||
|
|||
public virtual bool EmailConfirmed { get; private set; } |
|||
|
|||
public virtual string PhoneNumber { get; private set; } |
|||
|
|||
public virtual bool PhoneNumberConfirmed { get; private set; } |
|||
|
|||
#endregion
|
|||
|
|||
/* Add your own properties here. Example: |
|||
* |
|||
* public virtual string MyProperty { get; set; } |
|||
*/ |
|||
|
|||
private AppUser() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>DashboardDemo</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Migrations\20190320072839_Initial.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\DashboardDemo.EntityFrameworkCore\DashboardDemo.EntityFrameworkCore.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,46 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
|||
|
|||
namespace DashboardDemo.EntityFrameworkCore |
|||
{ |
|||
public class DashboardDemoMigrationsDbContext : AbpDbContext<DashboardDemoMigrationsDbContext> |
|||
{ |
|||
public DashboardDemoMigrationsDbContext(DbContextOptions<DashboardDemoMigrationsDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Include modules to your migration db context */ |
|||
|
|||
builder.ConfigurePermissionManagement(); |
|||
builder.ConfigureSettingManagement(); |
|||
builder.ConfigureBackgroundJobs(); |
|||
builder.ConfigureAuditLogging(); |
|||
builder.ConfigureIdentity(); |
|||
builder.ConfigureTenantManagement(); |
|||
|
|||
/* Configure customizations for entities from the modules included */ |
|||
|
|||
builder.Entity<IdentityUser>(b => |
|||
{ |
|||
b.ConfigureCustomUserProperties(); |
|||
}); |
|||
|
|||
/* Configure your own tables/entities inside the ConfigureDashboardDemo method */ |
|||
|
|||
builder.ConfigureDashboardDemo(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
using System.IO; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Design; |
|||
using Microsoft.Extensions.Configuration; |
|||
|
|||
namespace DashboardDemo.EntityFrameworkCore |
|||
{ |
|||
public class DashboardDemoMigrationsDbContextFactory : IDesignTimeDbContextFactory<DashboardDemoMigrationsDbContext> |
|||
{ |
|||
public DashboardDemoMigrationsDbContext CreateDbContext(string[] args) |
|||
{ |
|||
var configuration = BuildConfiguration(); |
|||
|
|||
var builder = new DbContextOptionsBuilder<DashboardDemoMigrationsDbContext>() |
|||
.UseSqlServer(configuration.GetConnectionString("Default")); |
|||
|
|||
return new DashboardDemoMigrationsDbContext(builder.Options); |
|||
} |
|||
|
|||
private static IConfigurationRoot BuildConfiguration() |
|||
{ |
|||
var builder = new ConfigurationBuilder() |
|||
.SetBasePath(Directory.GetCurrentDirectory()) |
|||
.AddJsonFile("appsettings.json", optional: false); |
|||
|
|||
return builder.Build(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,760 +0,0 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using DashboardDemo.EntityFrameworkCore; |
|||
|
|||
namespace DashboardDemo.Migrations |
|||
{ |
|||
[DbContext(typeof(DashboardDemoMigrationsDbContext))] |
|||
[Migration("20190402131334_Initial")] |
|||
partial class Initial |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128) |
|||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ApplicationName") |
|||
.HasColumnName("ApplicationName") |
|||
.HasMaxLength(96); |
|||
|
|||
b.Property<string>("BrowserInfo") |
|||
.HasColumnName("BrowserInfo") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("ClientId") |
|||
.HasColumnName("ClientId") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ClientIpAddress") |
|||
.HasColumnName("ClientIpAddress") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ClientName") |
|||
.HasColumnName("ClientName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("Comments") |
|||
.HasColumnName("Comments") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("CorrelationId") |
|||
.HasColumnName("CorrelationId") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Exceptions") |
|||
.HasColumnName("Exceptions") |
|||
.HasMaxLength(4000); |
|||
|
|||
b.Property<int>("ExecutionDuration") |
|||
.HasColumnName("ExecutionDuration"); |
|||
|
|||
b.Property<DateTime>("ExecutionTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("HttpMethod") |
|||
.HasColumnName("HttpMethod") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<int?>("HttpStatusCode") |
|||
.HasColumnName("HttpStatusCode"); |
|||
|
|||
b.Property<Guid?>("ImpersonatorTenantId") |
|||
.HasColumnName("ImpersonatorTenantId"); |
|||
|
|||
b.Property<Guid?>("ImpersonatorUserId") |
|||
.HasColumnName("ImpersonatorUserId"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<string>("TenantName"); |
|||
|
|||
b.Property<string>("Url") |
|||
.HasColumnName("Url") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("UserId") |
|||
.HasColumnName("UserId"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.HasColumnName("UserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "ExecutionTime"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "ExecutionTime"); |
|||
|
|||
b.ToTable("AbpAuditLogs"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<Guid>("AuditLogId") |
|||
.HasColumnName("AuditLogId"); |
|||
|
|||
b.Property<int>("ExecutionDuration") |
|||
.HasColumnName("ExecutionDuration"); |
|||
|
|||
b.Property<DateTime>("ExecutionTime") |
|||
.HasColumnName("ExecutionTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("MethodName") |
|||
.HasColumnName("MethodName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("Parameters") |
|||
.HasColumnName("Parameters") |
|||
.HasMaxLength(2000); |
|||
|
|||
b.Property<string>("ServiceName") |
|||
.HasColumnName("ServiceName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("AuditLogId"); |
|||
|
|||
b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); |
|||
|
|||
b.ToTable("AbpAuditLogActions"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<Guid>("AuditLogId") |
|||
.HasColumnName("AuditLogId"); |
|||
|
|||
b.Property<DateTime>("ChangeTime") |
|||
.HasColumnName("ChangeTime"); |
|||
|
|||
b.Property<byte>("ChangeType") |
|||
.HasColumnName("ChangeType"); |
|||
|
|||
b.Property<string>("EntityId") |
|||
.IsRequired() |
|||
.HasColumnName("EntityId") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("EntityTenantId"); |
|||
|
|||
b.Property<string>("EntityTypeFullName") |
|||
.IsRequired() |
|||
.HasColumnName("EntityTypeFullName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("AuditLogId"); |
|||
|
|||
b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); |
|||
|
|||
b.ToTable("AbpEntityChanges"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<Guid>("EntityChangeId"); |
|||
|
|||
b.Property<string>("NewValue") |
|||
.HasColumnName("NewValue") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("OriginalValue") |
|||
.HasColumnName("OriginalValue") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("PropertyName") |
|||
.IsRequired() |
|||
.HasColumnName("PropertyName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("PropertyTypeFullName") |
|||
.IsRequired() |
|||
.HasColumnName("PropertyTypeFullName") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("EntityChangeId"); |
|||
|
|||
b.ToTable("AbpEntityPropertyChanges"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsAbandoned") |
|||
.ValueGeneratedOnAdd() |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("JobArgs") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576); |
|||
|
|||
b.Property<string>("JobName") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<DateTime?>("LastTryTime"); |
|||
|
|||
b.Property<DateTime>("NextTryTime"); |
|||
|
|||
b.Property<byte>("Priority") |
|||
.ValueGeneratedOnAdd() |
|||
.HasDefaultValue((byte)15); |
|||
|
|||
b.Property<short>("TryCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasDefaultValue((short)0); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("IsAbandoned", "NextTryTime"); |
|||
|
|||
b.ToTable("AbpBackgroundJobs"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Regex") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("RegexDescription") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<bool>("Required"); |
|||
|
|||
b.Property<int>("ValueType"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AbpClaimTypes"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDefault") |
|||
.HasColumnName("IsDefault"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnName("IsPublic"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnName("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedName") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("NormalizedName"); |
|||
|
|||
b.ToTable("AbpRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleId"); |
|||
|
|||
b.ToTable("AbpRoleClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("AccessFailedCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("AccessFailedCount") |
|||
.HasDefaultValue(0); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Email") |
|||
.HasColumnName("Email") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<bool>("EmailConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("EmailConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<bool>("LockoutEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("LockoutEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTimeOffset?>("LockoutEnd"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasColumnName("Name") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("NormalizedEmail") |
|||
.HasColumnName("NormalizedEmail") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedUserName") |
|||
.IsRequired() |
|||
.HasColumnName("NormalizedUserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PasswordHash") |
|||
.HasColumnName("PasswordHash") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PhoneNumber") |
|||
.HasColumnName("PhoneNumber") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<bool>("PhoneNumberConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("PhoneNumberConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("SecurityStamp") |
|||
.IsRequired() |
|||
.HasColumnName("SecurityStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Surname") |
|||
.HasColumnName("Surname") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<bool>("TwoFactorEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("TwoFactorEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasColumnName("UserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Email"); |
|||
|
|||
b.HasIndex("NormalizedEmail"); |
|||
|
|||
b.HasIndex("NormalizedUserName"); |
|||
|
|||
b.HasIndex("UserName"); |
|||
|
|||
b.ToTable("AbpUsers"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId"); |
|||
|
|||
b.ToTable("AbpUserClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderDisplayName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(196); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider"); |
|||
|
|||
b.HasIndex("LoginProvider", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpUserLogins"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "RoleId"); |
|||
|
|||
b.HasIndex("RoleId", "UserId"); |
|||
|
|||
b.ToTable("AbpUserRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<string>("Value"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider", "Name"); |
|||
|
|||
b.ToTable("AbpUserTokens"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpPermissionGrants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasMaxLength(2048); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name") |
|||
.IsUnique(); |
|||
|
|||
b.ToTable("AbpTenants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => |
|||
{ |
|||
b.Property<Guid>("TenantId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasMaxLength(1024); |
|||
|
|||
b.HasKey("TenantId", "Name"); |
|||
|
|||
b.ToTable("AbpTenantConnectionStrings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.AuditLogging.AuditLog") |
|||
.WithMany("Actions") |
|||
.HasForeignKey("AuditLogId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.AuditLogging.AuditLog") |
|||
.WithMany("EntityChanges") |
|||
.HasForeignKey("AuditLogId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.AuditLogging.EntityChange") |
|||
.WithMany("PropertyChanges") |
|||
.HasForeignKey("EntityChangeId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Logins") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany() |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
|
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Roles") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Tokens") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.TenantManagement.Tenant") |
|||
.WithMany("ConnectionStrings") |
|||
.HasForeignKey("TenantId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -1,546 +0,0 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace DashboardDemo.Migrations |
|||
{ |
|||
public partial class Initial : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpAuditLogs", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(nullable: true), |
|||
ApplicationName = table.Column<string>(maxLength: 96, nullable: true), |
|||
UserId = table.Column<Guid>(nullable: true), |
|||
UserName = table.Column<string>(maxLength: 256, nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
TenantName = table.Column<string>(nullable: true), |
|||
ImpersonatorUserId = table.Column<Guid>(nullable: true), |
|||
ImpersonatorTenantId = table.Column<Guid>(nullable: true), |
|||
ExecutionTime = table.Column<DateTime>(nullable: false), |
|||
ExecutionDuration = table.Column<int>(nullable: false), |
|||
ClientIpAddress = table.Column<string>(maxLength: 64, nullable: true), |
|||
ClientName = table.Column<string>(maxLength: 128, nullable: true), |
|||
ClientId = table.Column<string>(maxLength: 64, nullable: true), |
|||
CorrelationId = table.Column<string>(maxLength: 64, nullable: true), |
|||
BrowserInfo = table.Column<string>(maxLength: 512, nullable: true), |
|||
HttpMethod = table.Column<string>(maxLength: 16, nullable: true), |
|||
Url = table.Column<string>(maxLength: 256, nullable: true), |
|||
Exceptions = table.Column<string>(maxLength: 4000, nullable: true), |
|||
Comments = table.Column<string>(maxLength: 256, nullable: true), |
|||
HttpStatusCode = table.Column<int>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpBackgroundJobs", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(nullable: true), |
|||
JobName = table.Column<string>(maxLength: 128, nullable: false), |
|||
JobArgs = table.Column<string>(maxLength: 1048576, nullable: false), |
|||
TryCount = table.Column<short>(nullable: false, defaultValue: (short)0), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
NextTryTime = table.Column<DateTime>(nullable: false), |
|||
LastTryTime = table.Column<DateTime>(nullable: true), |
|||
IsAbandoned = table.Column<bool>(nullable: false, defaultValue: false), |
|||
Priority = table.Column<byte>(nullable: false, defaultValue: (byte)15) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpBackgroundJobs", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpClaimTypes", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
Name = table.Column<string>(maxLength: 256, nullable: false), |
|||
Required = table.Column<bool>(nullable: false), |
|||
IsStatic = table.Column<bool>(nullable: false), |
|||
Regex = table.Column<string>(maxLength: 512, nullable: true), |
|||
RegexDescription = table.Column<string>(maxLength: 128, nullable: true), |
|||
Description = table.Column<string>(maxLength: 256, nullable: true), |
|||
ValueType = table.Column<int>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpPermissionGrants", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
Name = table.Column<string>(maxLength: 128, nullable: false), |
|||
ProviderName = table.Column<string>(maxLength: 64, nullable: false), |
|||
ProviderKey = table.Column<string>(maxLength: 64, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpRoles", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
Name = table.Column<string>(maxLength: 256, nullable: false), |
|||
NormalizedName = table.Column<string>(maxLength: 256, nullable: false), |
|||
IsDefault = table.Column<bool>(nullable: false), |
|||
IsStatic = table.Column<bool>(nullable: false), |
|||
IsPublic = table.Column<bool>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpRoles", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpSettings", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
Name = table.Column<string>(maxLength: 128, nullable: false), |
|||
Value = table.Column<string>(maxLength: 2048, nullable: false), |
|||
ProviderName = table.Column<string>(maxLength: 64, nullable: true), |
|||
ProviderKey = table.Column<string>(maxLength: 64, nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpSettings", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpTenants", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(nullable: true), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(nullable: true), |
|||
LastModifierId = table.Column<Guid>(nullable: true), |
|||
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
Name = table.Column<string>(maxLength: 64, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpTenants", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUsers", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(nullable: true), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(nullable: true), |
|||
LastModifierId = table.Column<Guid>(nullable: true), |
|||
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
UserName = table.Column<string>(maxLength: 256, nullable: false), |
|||
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false), |
|||
Name = table.Column<string>(maxLength: 64, nullable: true), |
|||
Surname = table.Column<string>(maxLength: 64, nullable: true), |
|||
Email = table.Column<string>(maxLength: 256, nullable: true), |
|||
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), |
|||
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false), |
|||
PasswordHash = table.Column<string>(maxLength: 256, nullable: true), |
|||
SecurityStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
PhoneNumber = table.Column<string>(maxLength: 16, nullable: true), |
|||
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false), |
|||
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false), |
|||
LockoutEnd = table.Column<DateTimeOffset>(nullable: true), |
|||
LockoutEnabled = table.Column<bool>(nullable: false, defaultValue: false), |
|||
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUsers", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpAuditLogActions", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
AuditLogId = table.Column<Guid>(nullable: false), |
|||
ServiceName = table.Column<string>(maxLength: 256, nullable: true), |
|||
MethodName = table.Column<string>(maxLength: 128, nullable: true), |
|||
Parameters = table.Column<string>(maxLength: 2000, nullable: true), |
|||
ExecutionTime = table.Column<DateTime>(nullable: false), |
|||
ExecutionDuration = table.Column<int>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", |
|||
column: x => x.AuditLogId, |
|||
principalTable: "AbpAuditLogs", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpEntityChanges", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
AuditLogId = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ChangeTime = table.Column<DateTime>(nullable: false), |
|||
ChangeType = table.Column<byte>(nullable: false), |
|||
EntityTenantId = table.Column<Guid>(nullable: true), |
|||
EntityId = table.Column<string>(maxLength: 128, nullable: false), |
|||
EntityTypeFullName = table.Column<string>(maxLength: 128, nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", |
|||
column: x => x.AuditLogId, |
|||
principalTable: "AbpAuditLogs", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpRoleClaims", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ClaimType = table.Column<string>(maxLength: 256, nullable: false), |
|||
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true), |
|||
RoleId = table.Column<Guid>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpRoleClaims_AbpRoles_RoleId", |
|||
column: x => x.RoleId, |
|||
principalTable: "AbpRoles", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpTenantConnectionStrings", |
|||
columns: table => new |
|||
{ |
|||
TenantId = table.Column<Guid>(nullable: false), |
|||
Name = table.Column<string>(maxLength: 64, nullable: false), |
|||
Value = table.Column<string>(maxLength: 1024, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", |
|||
column: x => x.TenantId, |
|||
principalTable: "AbpTenants", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserClaims", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ClaimType = table.Column<string>(maxLength: 256, nullable: false), |
|||
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true), |
|||
UserId = table.Column<Guid>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserClaims", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserClaims_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserLogins", |
|||
columns: table => new |
|||
{ |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
LoginProvider = table.Column<string>(maxLength: 64, nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ProviderKey = table.Column<string>(maxLength: 196, nullable: false), |
|||
ProviderDisplayName = table.Column<string>(maxLength: 128, nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserLogins_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserRoles", |
|||
columns: table => new |
|||
{ |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
RoleId = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserRoles_AbpRoles_RoleId", |
|||
column: x => x.RoleId, |
|||
principalTable: "AbpRoles", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserRoles_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserTokens", |
|||
columns: table => new |
|||
{ |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
LoginProvider = table.Column<string>(maxLength: 64, nullable: false), |
|||
Name = table.Column<string>(maxLength: 128, nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
Value = table.Column<string>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserTokens_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpEntityPropertyChanges", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
EntityChangeId = table.Column<Guid>(nullable: false), |
|||
NewValue = table.Column<string>(maxLength: 512, nullable: true), |
|||
OriginalValue = table.Column<string>(maxLength: 512, nullable: true), |
|||
PropertyName = table.Column<string>(maxLength: 128, nullable: false), |
|||
PropertyTypeFullName = table.Column<string>(maxLength: 64, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", |
|||
column: x => x.EntityChangeId, |
|||
principalTable: "AbpEntityChanges", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogActions_AuditLogId", |
|||
table: "AbpAuditLogActions", |
|||
column: "AuditLogId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", |
|||
table: "AbpAuditLogActions", |
|||
columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogs_TenantId_ExecutionTime", |
|||
table: "AbpAuditLogs", |
|||
columns: new[] { "TenantId", "ExecutionTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", |
|||
table: "AbpAuditLogs", |
|||
columns: new[] { "TenantId", "UserId", "ExecutionTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpBackgroundJobs_IsAbandoned_NextTryTime", |
|||
table: "AbpBackgroundJobs", |
|||
columns: new[] { "IsAbandoned", "NextTryTime" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpEntityChanges_AuditLogId", |
|||
table: "AbpEntityChanges", |
|||
column: "AuditLogId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", |
|||
table: "AbpEntityChanges", |
|||
columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpEntityPropertyChanges_EntityChangeId", |
|||
table: "AbpEntityPropertyChanges", |
|||
column: "EntityChangeId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", |
|||
table: "AbpPermissionGrants", |
|||
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpRoleClaims_RoleId", |
|||
table: "AbpRoleClaims", |
|||
column: "RoleId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpRoles_NormalizedName", |
|||
table: "AbpRoles", |
|||
column: "NormalizedName"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpSettings_Name_ProviderName_ProviderKey", |
|||
table: "AbpSettings", |
|||
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpTenants_Name", |
|||
table: "AbpTenants", |
|||
column: "Name", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserClaims_UserId", |
|||
table: "AbpUserClaims", |
|||
column: "UserId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserLogins_LoginProvider_ProviderKey", |
|||
table: "AbpUserLogins", |
|||
columns: new[] { "LoginProvider", "ProviderKey" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserRoles_RoleId_UserId", |
|||
table: "AbpUserRoles", |
|||
columns: new[] { "RoleId", "UserId" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_Email", |
|||
table: "AbpUsers", |
|||
column: "Email"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_NormalizedEmail", |
|||
table: "AbpUsers", |
|||
column: "NormalizedEmail"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_NormalizedUserName", |
|||
table: "AbpUsers", |
|||
column: "NormalizedUserName"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_UserName", |
|||
table: "AbpUsers", |
|||
column: "UserName"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpAuditLogActions"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpBackgroundJobs"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpClaimTypes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpEntityPropertyChanges"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpPermissionGrants"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpRoleClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpSettings"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpTenantConnectionStrings"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserLogins"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserRoles"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserTokens"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpEntityChanges"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpTenants"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpRoles"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUsers"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpAuditLogs"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,758 +0,0 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using DashboardDemo.EntityFrameworkCore; |
|||
|
|||
namespace DashboardDemo.Migrations |
|||
{ |
|||
[DbContext(typeof(DashboardDemoMigrationsDbContext))] |
|||
partial class DashboardDemoMigrationsDbContextModelSnapshot : ModelSnapshot |
|||
{ |
|||
protected override void BuildModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128) |
|||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ApplicationName") |
|||
.HasColumnName("ApplicationName") |
|||
.HasMaxLength(96); |
|||
|
|||
b.Property<string>("BrowserInfo") |
|||
.HasColumnName("BrowserInfo") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("ClientId") |
|||
.HasColumnName("ClientId") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ClientIpAddress") |
|||
.HasColumnName("ClientIpAddress") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ClientName") |
|||
.HasColumnName("ClientName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("Comments") |
|||
.HasColumnName("Comments") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("CorrelationId") |
|||
.HasColumnName("CorrelationId") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Exceptions") |
|||
.HasColumnName("Exceptions") |
|||
.HasMaxLength(4000); |
|||
|
|||
b.Property<int>("ExecutionDuration") |
|||
.HasColumnName("ExecutionDuration"); |
|||
|
|||
b.Property<DateTime>("ExecutionTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("HttpMethod") |
|||
.HasColumnName("HttpMethod") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<int?>("HttpStatusCode") |
|||
.HasColumnName("HttpStatusCode"); |
|||
|
|||
b.Property<Guid?>("ImpersonatorTenantId") |
|||
.HasColumnName("ImpersonatorTenantId"); |
|||
|
|||
b.Property<Guid?>("ImpersonatorUserId") |
|||
.HasColumnName("ImpersonatorUserId"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<string>("TenantName"); |
|||
|
|||
b.Property<string>("Url") |
|||
.HasColumnName("Url") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("UserId") |
|||
.HasColumnName("UserId"); |
|||
|
|||
b.Property<string>("UserName") |
|||
.HasColumnName("UserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("TenantId", "ExecutionTime"); |
|||
|
|||
b.HasIndex("TenantId", "UserId", "ExecutionTime"); |
|||
|
|||
b.ToTable("AbpAuditLogs"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<Guid>("AuditLogId") |
|||
.HasColumnName("AuditLogId"); |
|||
|
|||
b.Property<int>("ExecutionDuration") |
|||
.HasColumnName("ExecutionDuration"); |
|||
|
|||
b.Property<DateTime>("ExecutionTime") |
|||
.HasColumnName("ExecutionTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("MethodName") |
|||
.HasColumnName("MethodName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("Parameters") |
|||
.HasColumnName("Parameters") |
|||
.HasMaxLength(2000); |
|||
|
|||
b.Property<string>("ServiceName") |
|||
.HasColumnName("ServiceName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("AuditLogId"); |
|||
|
|||
b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); |
|||
|
|||
b.ToTable("AbpAuditLogActions"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<Guid>("AuditLogId") |
|||
.HasColumnName("AuditLogId"); |
|||
|
|||
b.Property<DateTime>("ChangeTime") |
|||
.HasColumnName("ChangeTime"); |
|||
|
|||
b.Property<byte>("ChangeType") |
|||
.HasColumnName("ChangeType"); |
|||
|
|||
b.Property<string>("EntityId") |
|||
.IsRequired() |
|||
.HasColumnName("EntityId") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("EntityTenantId"); |
|||
|
|||
b.Property<string>("EntityTypeFullName") |
|||
.IsRequired() |
|||
.HasColumnName("EntityTypeFullName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("AuditLogId"); |
|||
|
|||
b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); |
|||
|
|||
b.ToTable("AbpEntityChanges"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<Guid>("EntityChangeId"); |
|||
|
|||
b.Property<string>("NewValue") |
|||
.HasColumnName("NewValue") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("OriginalValue") |
|||
.HasColumnName("OriginalValue") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("PropertyName") |
|||
.IsRequired() |
|||
.HasColumnName("PropertyName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("PropertyTypeFullName") |
|||
.IsRequired() |
|||
.HasColumnName("PropertyTypeFullName") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("EntityChangeId"); |
|||
|
|||
b.ToTable("AbpEntityPropertyChanges"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsAbandoned") |
|||
.ValueGeneratedOnAdd() |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("JobArgs") |
|||
.IsRequired() |
|||
.HasMaxLength(1048576); |
|||
|
|||
b.Property<string>("JobName") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<DateTime?>("LastTryTime"); |
|||
|
|||
b.Property<DateTime>("NextTryTime"); |
|||
|
|||
b.Property<byte>("Priority") |
|||
.ValueGeneratedOnAdd() |
|||
.HasDefaultValue((byte)15); |
|||
|
|||
b.Property<short>("TryCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasDefaultValue((short)0); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("IsAbandoned", "NextTryTime"); |
|||
|
|||
b.ToTable("AbpBackgroundJobs"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Regex") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("RegexDescription") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<bool>("Required"); |
|||
|
|||
b.Property<int>("ValueType"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AbpClaimTypes"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDefault") |
|||
.HasColumnName("IsDefault"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnName("IsPublic"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnName("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedName") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("NormalizedName"); |
|||
|
|||
b.ToTable("AbpRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleId"); |
|||
|
|||
b.ToTable("AbpRoleClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("AccessFailedCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("AccessFailedCount") |
|||
.HasDefaultValue(0); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Email") |
|||
.HasColumnName("Email") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<bool>("EmailConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("EmailConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<bool>("LockoutEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("LockoutEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTimeOffset?>("LockoutEnd"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasColumnName("Name") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("NormalizedEmail") |
|||
.HasColumnName("NormalizedEmail") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedUserName") |
|||
.IsRequired() |
|||
.HasColumnName("NormalizedUserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PasswordHash") |
|||
.HasColumnName("PasswordHash") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PhoneNumber") |
|||
.HasColumnName("PhoneNumber") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<bool>("PhoneNumberConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("PhoneNumberConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("SecurityStamp") |
|||
.IsRequired() |
|||
.HasColumnName("SecurityStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Surname") |
|||
.HasColumnName("Surname") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<bool>("TwoFactorEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("TwoFactorEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasColumnName("UserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Email"); |
|||
|
|||
b.HasIndex("NormalizedEmail"); |
|||
|
|||
b.HasIndex("NormalizedUserName"); |
|||
|
|||
b.HasIndex("UserName"); |
|||
|
|||
b.ToTable("AbpUsers"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId"); |
|||
|
|||
b.ToTable("AbpUserClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderDisplayName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(196); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider"); |
|||
|
|||
b.HasIndex("LoginProvider", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpUserLogins"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "RoleId"); |
|||
|
|||
b.HasIndex("RoleId", "UserId"); |
|||
|
|||
b.ToTable("AbpUserRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<string>("Value"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider", "Name"); |
|||
|
|||
b.ToTable("AbpUserTokens"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpPermissionGrants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasMaxLength(2048); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("IsDeleted") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name") |
|||
.IsUnique(); |
|||
|
|||
b.ToTable("AbpTenants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => |
|||
{ |
|||
b.Property<Guid>("TenantId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasMaxLength(1024); |
|||
|
|||
b.HasKey("TenantId", "Name"); |
|||
|
|||
b.ToTable("AbpTenantConnectionStrings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.AuditLogging.AuditLog") |
|||
.WithMany("Actions") |
|||
.HasForeignKey("AuditLogId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.AuditLogging.AuditLog") |
|||
.WithMany("EntityChanges") |
|||
.HasForeignKey("AuditLogId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.AuditLogging.EntityChange") |
|||
.WithMany("PropertyChanges") |
|||
.HasForeignKey("EntityChangeId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Logins") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany() |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
|
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Roles") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Tokens") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.TenantManagement.Tenant") |
|||
.WithMany("ConnectionStrings") |
|||
.HasForeignKey("TenantId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>DashboardDemo</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\DashboardDemo.Domain\DashboardDemo.Domain.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.EntityFrameworkCore\Volo.Abp.Identity.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\background-jobs\src\Volo.Abp.BackgroundJobs.EntityFrameworkCore\Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.EntityFrameworkCore\Volo.Abp.TenantManagement.EntityFrameworkCore.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.EntityFrameworkCore\Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,45 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using DashboardDemo.Users; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|||
using Volo.Abp.Users.EntityFrameworkCore; |
|||
|
|||
namespace DashboardDemo.EntityFrameworkCore |
|||
{ |
|||
[ConnectionStringName("Default")] |
|||
public class DashboardDemoDbContext : AbpDbContext<DashboardDemoDbContext> |
|||
{ |
|||
public DbSet<AppUser> Users { get; set; } |
|||
|
|||
public DashboardDemoDbContext(DbContextOptions<DashboardDemoDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Configure the shared tables (with included modules) here */ |
|||
|
|||
builder.Entity<AppUser>(b => |
|||
{ |
|||
b.ToTable("AbpUsers"); //Sharing the same table "AbpUsers" with the IdentityUser
|
|||
|
|||
b.ConfigureFullAudited(); |
|||
b.ConfigureExtraProperties(); |
|||
b.ConfigureConcurrencyStamp(); |
|||
b.ConfigureAbpUser(); |
|||
|
|||
//Moved customization to a method so we can share it with the DashboardDemoMigrationsDbContext class
|
|||
b.ConfigureCustomUserProperties(); |
|||
}); |
|||
|
|||
/* Configure your own tables/entities inside the ConfigureDashboardDemo method */ |
|||
|
|||
builder.ConfigureDashboardDemo(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace DashboardDemo.EntityFrameworkCore |
|||
{ |
|||
public static class DashboardDemoDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureDashboardDemo(this ModelBuilder builder) |
|||
{ |
|||
Check.NotNull(builder, nameof(builder)); |
|||
|
|||
/* Configure your own tables/entities inside here */ |
|||
|
|||
//builder.Entity<YourEntity>(b =>
|
|||
//{
|
|||
// b.ToTable(DashboardDemoConsts.DbTablePrefix + "YourEntities", DashboardDemoConsts.DbSchema);
|
|||
|
|||
// //...
|
|||
//});
|
|||
} |
|||
|
|||
public static void ConfigureCustomUserProperties<TUser>(this EntityTypeBuilder<TUser> b) |
|||
where TUser: class, IUser |
|||
{ |
|||
//b.Property<string>(nameof(AppUser.MyProperty))...
|
|||
} |
|||
} |
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.SqlServer; |
|||
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
|||
|
|||
namespace DashboardDemo.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(DashboardDemoDomainModule), |
|||
typeof(AbpIdentityEntityFrameworkCoreModule), |
|||
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|||
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|||
typeof(AbpEntityFrameworkCoreSqlServerModule), |
|||
typeof(BackgroundJobsEntityFrameworkCoreModule), |
|||
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|||
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
|||
typeof(AbpFeatureManagementEntityFrameworkCoreModule) |
|||
)] |
|||
public class DashboardDemoEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<DashboardDemoDbContext>(options => |
|||
{ |
|||
//Remove "includeAllEntities: true" to create default repositories only for aggregate roots
|
|||
options.AddDefaultRepositories(includeAllEntities: true); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace DashboardDemo.Branding |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class DashboardDemoBrandingProvider : DefaultBrandingProvider |
|||
{ |
|||
public override string AppName => "DashboardDemo"; |
|||
} |
|||
} |
|||
@ -1,43 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> |
|||
<RootNamespace>DashboardDemo</RootNamespace> |
|||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> |
|||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> |
|||
<PreserveCompilationContext>true</PreserveCompilationContext> |
|||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Logs\**" /> |
|||
<Content Remove="Logs\**" /> |
|||
<EmbeddedResource Remove="Logs\**" /> |
|||
<None Remove="Logs\**" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.App" /> |
|||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" /> |
|||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> |
|||
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\DashboardDemo.Application\DashboardDemo.Application.csproj" /> |
|||
<ProjectReference Include="..\DashboardDemo.EntityFrameworkCore.DbMigrations\DashboardDemo.EntityFrameworkCore.DbMigrations.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Dashboards\Volo.Abp.AspNetCore.Mvc.UI.Dashboards.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Web\Volo.Abp.Identity.Web.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web\Volo.Abp.Account.Web.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Web\Volo.Abp.TenantManagement.Web.csproj" /> |
|||
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Web\Volo.Abp.FeatureManagement.Web.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -1,12 +0,0 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class DashboardDemoWebAutoMapperProfile : Profile |
|||
{ |
|||
public DashboardDemoWebAutoMapperProfile() |
|||
{ |
|||
//Configure your AutoMapper mapping configuration here...
|
|||
} |
|||
} |
|||
} |
|||
@ -1,257 +0,0 @@ |
|||
using System.IO; |
|||
using System.Linq; |
|||
using DashboardDemo.Dashboards; |
|||
using Localization.Resources.AbpUi; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using DashboardDemo.EntityFrameworkCore; |
|||
using DashboardDemo.GlobalFilters; |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using DashboardDemo.Menus; |
|||
using DashboardDemo.Pages; |
|||
using DashboardDemo.Pages.widgets; |
|||
using DashboardDemo.Permissions; |
|||
using DashboardDemo.Widgets; |
|||
using Swashbuckle.AspNetCore.Swagger; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Account.Web; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc.UI; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Identity.Web; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Localization.Resources.AbpValidation; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement.Web; |
|||
using Volo.Abp.Threading; |
|||
using Volo.Abp.UI; |
|||
using Volo.Abp.UI.Navigation; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.TenantManagement.Web; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
[DependsOn( |
|||
typeof(DashboardDemoApplicationModule), |
|||
typeof(DashboardDemoEntityFrameworkCoreModule), |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpIdentityWebModule), |
|||
typeof(AbpAccountWebModule), |
|||
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
|||
typeof(AbpAspNetCoreMvcUiDashboardsModule), |
|||
typeof(AbpTenantManagementWebModule) |
|||
)] |
|||
public class DashboardDemoWebModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
|||
{ |
|||
options.AddAssemblyResource( |
|||
typeof(DashboardDemoResource), |
|||
typeof(DashboardDemoDomainModule).Assembly, |
|||
typeof(DashboardDemoApplicationModule).Assembly, |
|||
typeof(DashboardDemoWebModule).Assembly |
|||
); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
var configuration = context.Services.GetConfiguration(); |
|||
|
|||
ConfigureWidgets(); |
|||
ConfigureGlobalFilters(); |
|||
ConfigureDashboards(); |
|||
ConfigureDatabaseServices(); |
|||
ConfigureAutoMapper(); |
|||
ConfigureVirtualFileSystem(hostingEnvironment); |
|||
ConfigureLocalizationServices(); |
|||
ConfigureNavigationServices(); |
|||
ConfigureAutoApiControllers(); |
|||
ConfigureSwaggerServices(context.Services); |
|||
} |
|||
|
|||
private void ConfigureWidgets() |
|||
{ |
|||
Configure<WidgetOptions>(options => |
|||
{ |
|||
options.Widgets.AddRange(WidgetDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureGlobalFilters() |
|||
{ |
|||
Configure<GlobalFilterOptions>(options => |
|||
{ |
|||
options.GlobalFilters.AddRange(GlobalFilterDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureDashboards() |
|||
{ |
|||
Configure<DashboardOptions>(options => |
|||
{ |
|||
options.Dashboards.AddRange(DashboardDefinitionProvider.GetDefinitions()); |
|||
}); |
|||
|
|||
Configure<BundlingOptions>(options => |
|||
{ |
|||
options.ScriptBundles.Add(DashboardNames.MyDashboard, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(MyDashboardScriptBundleContributor)); |
|||
}); |
|||
options.ScriptBundles.Add(UserCountWidgetViewComponent.Name, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(UserCountWidgetScriptBundleContributor)); |
|||
}); |
|||
options.StyleBundles.Add(DashboardNames.MyDashboard, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(MyDashboardStyleBundleContributor)); |
|||
}); |
|||
options.StyleBundles.Add(UserCountWidgetViewComponent.Name, configuration => |
|||
{ |
|||
configuration.AddContributors(typeof(UserCountWidgetStyleBundleContributor)); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureDatabaseServices() |
|||
{ |
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
options.UseSqlServer(); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureAutoMapper() |
|||
{ |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddProfile<DashboardDemoWebAutoMapperProfile>(); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureVirtualFileSystem(IHostingEnvironment hostingEnvironment) |
|||
{ |
|||
if (hostingEnvironment.IsDevelopment()) |
|||
{ |
|||
Configure<VirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.ReplaceEmbeddedByPhysical<DashboardDemoDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}DashboardDemo.Domain", Path.DirectorySeparatorChar))); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
private void ConfigureLocalizationServices() |
|||
{ |
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<DashboardDemoResource>() |
|||
.AddBaseTypes( |
|||
typeof(AbpValidationResource), |
|||
typeof(AbpUiResource) |
|||
); |
|||
|
|||
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština")); |
|||
options.Languages.Add(new LanguageInfo("en", "en", "English")); |
|||
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); |
|||
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe")); |
|||
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureNavigationServices() |
|||
{ |
|||
Configure<NavigationOptions>(options => |
|||
{ |
|||
options.MenuContributors.Add(new DashboardDemoMenuContributor()); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureAutoApiControllers() |
|||
{ |
|||
Configure<AbpAspNetCoreMvcOptions>(options => |
|||
{ |
|||
options.ConventionalControllers.Create(typeof(DashboardDemoApplicationModule).Assembly); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureSwaggerServices(IServiceCollection services) |
|||
{ |
|||
services.AddSwaggerGen( |
|||
options => |
|||
{ |
|||
options.SwaggerDoc("v1", new Info { Title = "DashboardDemo API", Version = "v1" }); |
|||
options.DocInclusionPredicate((docName, description) => true); |
|||
options.CustomSchemaIds(type => type.FullName); |
|||
}); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
var env = context.GetEnvironment(); |
|||
|
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
else |
|||
{ |
|||
app.UseErrorPage(); |
|||
} |
|||
|
|||
app.UseVirtualFiles(); |
|||
app.UseAuthentication(); |
|||
|
|||
if (DashboardDemoConsts.IsMultiTenancyEnabled) |
|||
{ |
|||
app.UseMultiTenancy(); |
|||
} |
|||
|
|||
app.UseAbpRequestLocalization(); |
|||
|
|||
app.UseSwagger(); |
|||
app.UseSwaggerUI(options => |
|||
{ |
|||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "DashboardDemo API"); |
|||
}); |
|||
|
|||
app.UseAuditing(); |
|||
|
|||
app.UseMvcWithDefaultRouteAndArea(); |
|||
|
|||
SeedDatabase(context); |
|||
} |
|||
|
|||
private static void SeedDatabase(ApplicationInitializationContext context) |
|||
{ |
|||
using (var scope = context.ServiceProvider.CreateScope()) |
|||
{ |
|||
AsyncHelper.RunSync(async () => |
|||
{ |
|||
await scope.ServiceProvider |
|||
.GetRequiredService<IDataSeeder>() |
|||
.SeedAsync(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
using System.Collections.Generic; |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using DashboardDemo.Pages.widgets; |
|||
using DashboardDemo.Pages.widgets.Filters; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace DashboardDemo.Dashboards |
|||
{ |
|||
public static class DashboardDefinitionProvider |
|||
{ |
|||
public static List<DashboardDefinition> GetDefinitions() |
|||
{ |
|||
var myDashboard = new DashboardDefinition( |
|||
DashboardNames.MyDashboard, |
|||
LocalizableString.Create<DashboardDemoResource>("MyDashboard") |
|||
) |
|||
.WithWidget(UserCountWidgetViewComponent.Name) |
|||
.WithWidget(MonthlyProfitWidgetViewComponent.Name) |
|||
.WithWidget(RoleListWidgetViewComponent.Name) |
|||
.WithGlobalFilter(DateRangeGlobalFilterViewComponent.Name); |
|||
|
|||
return new List<DashboardDefinition> |
|||
{ |
|||
myDashboard |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using Volo.Abp.Reflection; |
|||
|
|||
namespace DashboardDemo.Dashboards |
|||
{ |
|||
public static class DashboardNames |
|||
{ |
|||
public const string MyDashboard = "MyDashboard"; |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(DashboardNames)); |
|||
} |
|||
} |
|||
} |
|||
@ -1,29 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using DashboardDemo.Pages.widgets; |
|||
using DashboardDemo.Pages.widgets.Filters; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace DashboardDemo.GlobalFilters |
|||
{ |
|||
public static class GlobalFilterDefinitionProvider |
|||
{ |
|||
public static List<GlobalFilterDefinition> GetDefinitions() |
|||
{ |
|||
var dateRangeFilter = new GlobalFilterDefinition( |
|||
DateRangeGlobalFilterViewComponent.Name, |
|||
LocalizableString.Create<DashboardDemoResource>("DateRangeFilter"), |
|||
typeof(DateRangeGlobalFilterViewComponent) |
|||
); |
|||
|
|||
return new List<GlobalFilterDefinition> |
|||
{ |
|||
dateRangeFilter |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,33 +0,0 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Localization; |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using Volo.Abp.TenantManagement.Web.Navigation; |
|||
using Volo.Abp.UI.Navigation; |
|||
|
|||
namespace DashboardDemo.Menus |
|||
{ |
|||
public class DashboardDemoMenuContributor : IMenuContributor |
|||
{ |
|||
public async Task ConfigureMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (context.Menu.Name == StandardMenus.Main) |
|||
{ |
|||
await ConfigureMainMenuAsync(context); |
|||
} |
|||
} |
|||
|
|||
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (!DashboardDemoConsts.IsMultiTenancyEnabled) |
|||
{ |
|||
ApplicationMenuItem administration = context.Menu.GetAdministration(); |
|||
administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName); |
|||
} |
|||
|
|||
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<DashboardDemoResource>>(); |
|||
|
|||
context.Menu.Items.Insert(0, new ApplicationMenuItem("DashboardDemo.Home", l["Menu:Home"], "/")); |
|||
} |
|||
} |
|||
} |
|||
@ -1,13 +0,0 @@ |
|||
using Microsoft.AspNetCore.Mvc.Localization; |
|||
using Microsoft.AspNetCore.Mvc.Razor.Internal; |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace DashboardDemo.Pages |
|||
{ |
|||
public abstract class DashboardDemoPageBase : AbpPage |
|||
{ |
|||
[RazorInject] |
|||
public IHtmlLocalizer<DashboardDemoResource> L { get; set; } |
|||
} |
|||
} |
|||
@ -1,13 +0,0 @@ |
|||
using DashboardDemo.Localization.DashboardDemo; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace DashboardDemo.Pages |
|||
{ |
|||
public abstract class DashboardDemoPageModelBase : AbpPageModel |
|||
{ |
|||
protected DashboardDemoPageModelBase() |
|||
{ |
|||
LocalizationResourceType = typeof(DashboardDemoResource); |
|||
} |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
@page |
|||
@inject IOptions<DashboardOptions> OptionsDashboadOptions |
|||
@inject IStringLocalizerFactory localizer |
|||
@using Microsoft.Extensions.Options |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Dashboards |
|||
@using DashboardDemo.Pages |
|||
@using DashboardDemo.Pages.widgets |
|||
@using DashboardDemo.Widgets |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
@inherits DashboardDemoPageBase |
|||
@inject IWidgetRenderer WidgetRenderer |
|||
@model IndexModel |
|||
@section styles { |
|||
<link href="~/pages/index.css" rel="stylesheet" /> |
|||
<abp-style-bundle name="@UserCountWidgetViewComponent.Name" /> |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle name="@UserCountWidgetViewComponent.Name" /> |
|||
} |
|||
<abp-card> |
|||
<abp-card-header>@L["Welcome"]</abp-card-header> |
|||
<abp-card-body> |
|||
@await WidgetRenderer.RenderAsync(Component, UserCountWidgetViewComponent.Name) |
|||
</abp-card-body> |
|||
</abp-card> |
|||
@foreach (var dashboard in OptionsDashboadOptions.Value.Dashboards) |
|||
{ |
|||
<a href="/@dashboard.Name">Go to @dashboard.DisplayName.Localize(localizer)</a> |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
namespace DashboardDemo.Pages |
|||
{ |
|||
public class IndexModel : DashboardDemoPageModelBase |
|||
{ |
|||
public void OnGet() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
@page |
|||
@using DashboardDemo.Dashboards |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Dashboards |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Widgets |
|||
@inject IWidgetRenderer WidgetRenderer |
|||
@inject IDashboardRenderer DashboardRenderer |
|||
@inject IStringLocalizerFactory localizer |
|||
@model DashboardDemo.Pages.MyDashboardModel |
|||
@{ |
|||
} |
|||
@section styles { |
|||
<abp-style-bundle name="@DashboardNames.MyDashboard" /> |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle name="@DashboardNames.MyDashboard" /> |
|||
} |
|||
|
|||
<abp-card-body style="background: rgb(240,240,240)" class="p-4"> |
|||
@await DashboardRenderer.RenderAsync(Component, new { dashboardName = DashboardNames.MyDashboard }) |
|||
</abp-card-body> |
|||
|
|||
@ -1,13 +0,0 @@ |
|||
using System.Linq; |
|||
using DashboardDemo.Dashboards; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace DashboardDemo.Pages |
|||
{ |
|||
public class MyDashboardModel : DashboardDemoPageModelBase |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
using DashboardDemo.Pages.widgets; |
|||
using DashboardDemo.Pages.widgets.Filters; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace DashboardDemo.Pages |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpBasicDashboardScriptContributor), |
|||
typeof(UserCountWidgetScriptBundleContributor), |
|||
typeof(MonthlyProfitWidgetScriptBundleContributor), |
|||
typeof(RoleListWidgetScriptContributor), |
|||
typeof(DateRangeGlobalFilterScriptContributor) |
|||
)] |
|||
public class MyDashboardScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,21 +0,0 @@ |
|||
using DashboardDemo.Pages.widgets; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Dashboards; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace DashboardDemo.Pages |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpBasicDashboardStyleContributor), |
|||
typeof(UserCountWidgetStyleBundleContributor), |
|||
typeof(MonthlyProfitWidgetStyleBundleContributor), |
|||
typeof(RoleListWidgetStyleContributor) |
|||
)] |
|||
public class MyDashboardStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +0,0 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -1,6 +0,0 @@ |
|||
(function ($) { |
|||
var $container = $('#DateRangeGlobalFilterContainer'); |
|||
if ($container.length > 0) { |
|||
|
|||
} |
|||
})(jQuery); |
|||
@ -1,12 +0,0 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
|
|||
namespace DashboardDemo.Pages.widgets.Filters |
|||
{ |
|||
public class DateRangeGlobalFilterScriptContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/Filters/DateRangeGlobalFilter.js"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
@inject IHtmlLocalizer<DashboardDemoResource> L |
|||
@using DashboardDemo.Localization.DashboardDemo |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@model DashboardDemo.Pages.widgets.Filters.DateRangeGlobalFilterViewComponent |
|||
@{ |
|||
} |
|||
<div id="DateRangeGlobalFilterContainer"> |
|||
<div class="row"> |
|||
<div class="col-md-6 mb-3"> |
|||
<label for="DateFilterStartDateInput">@L["Start Date"].Value</label> |
|||
<input class="form-control" type="date" name="StartDate" id="DateFilterStartDateInput"> |
|||
</div> |
|||
<div class="col-md-6 mb-3"> |
|||
<label for="DateFilterEndDateInput">@L["End Date"].Value</label> |
|||
<input class="form-control" type="date" name="EndDate" id="EndDateStartDateInput"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
@ -1,17 +0,0 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace DashboardDemo.Pages.widgets.Filters |
|||
{ |
|||
[ViewComponent] |
|||
public class DateRangeGlobalFilterViewComponent : ViewComponent |
|||
{ |
|||
public const string Name = "DateRangeGlobalFilter"; |
|||
|
|||
public const string DisplayName = "Date Range Filter"; |
|||
|
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("/Pages/widgets/Filters/DateRangeGlobalFilterViewComponent.cshtml", new DateRangeGlobalFilterViewComponent()); |
|||
} |
|||
} |
|||
} |
|||
@ -1,3 +0,0 @@ |
|||
body { |
|||
margin: 0; |
|||
} |
|||
@ -1,48 +0,0 @@ |
|||
(function ($) { |
|||
var $container = $('#MonthlyProfitWidgetContainer'); |
|||
if ($container.length > 0) { |
|||
var chart = {}; |
|||
|
|||
var createChart = function () { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({}).then(function (result) { |
|||
chart = new Chart($container.find('#MonthlyProfitStatistics'), { |
|||
type: 'line', |
|||
data: { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
options: { |
|||
scales: { |
|||
yAxes: [{ |
|||
ticks: { |
|||
beginAtZero: true |
|||
} |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
$(document).on('RefreshWidgets', |
|||
function (event, filters) { |
|||
dashboardDemo.demoStatistic.getMonthlyProfitStatistic({ startDate: filters.startDate, endDate: filters.endDate }).then(function (result) { |
|||
chart.data = { |
|||
labels: result.labels, |
|||
datasets: [{ |
|||
label: 'Monthly Profit', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 255, 132, 0.2)' |
|||
}] |
|||
}, |
|||
chart.update(); |
|||
}); |
|||
}); |
|||
|
|||
createChart(); |
|||
} |
|||
})(jQuery); |
|||
@ -1,19 +0,0 @@ |
|||
using DashboardDemo.Pages.widgets.Chartjs; |
|||
using DashboardDemo.Pages.widgets.Filters; |
|||
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(ChartjsScriptContributor))] |
|||
public class MonthlyProfitWidgetScriptBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidget.js"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
using DashboardDemo.Pages.widgets.Chartjs; |
|||
using DashboardDemo.Pages.widgets.Filters; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Bootstrap; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Packages.HighlightJs; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace DashboardDemo.Pages.widgets |
|||
{ |
|||
[DependsOn(typeof(BootstrapStyleContributor))] |
|||
[DependsOn(typeof(ChartjsStyleContributor))] |
|||
public class MonthlyProfitWidgetStyleBundleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/Pages/widgets/MonthlyProfitWidget/MonthlyProfitWidget.css"); |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue