Browse Source

Improve dashboard definition

pull/1140/head
Halil ibrahim Kalkan 7 years ago
parent
commit
80ddad7038
  1. 42
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardDefinition.cs
  2. 23
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardWidgetConfiguration.cs
  3. 14
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/WidgetOptions.cs
  4. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDefinition.cs
  5. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDimensions.cs

42
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardDefinition.cs

@ -0,0 +1,42 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
using Volo.Abp.Localization;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardDefinition
{
/// <summary>
/// Unique name of the dashboard.
/// </summary>
[NotNull]
public string Name { get; }
/// <summary>
/// A list of Widgets available for this dashboard.
/// </summary>
public List<DashboardWidgetConfiguration> AvailableWidgets { get; }
/// <summary>
/// Display name of the widget.
/// </summary>
[NotNull]
public ILocalizableString DisplayName
{
get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value));
}
private ILocalizableString _displayName;
public DashboardDefinition(
[NotNull] string name,
[CanBeNull] ILocalizableString displayName)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
DisplayName = displayName ?? new FixedLocalizableString(name);
AvailableWidgets = new List<DashboardWidgetConfiguration>();
}
}
}

23
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/DashboardWidgetConfiguration.cs

@ -0,0 +1,23 @@
using JetBrains.Annotations;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardWidgetConfiguration
{
[NotNull]
public string WidgetName { get; }
[CanBeNull]
public WidgetDimensions Dimensions { get; set; }
public DashboardWidgetConfiguration(
[NotNull] string widgetName,
[CanBeNull] WidgetDimensions dimensions
)
{
WidgetName = Check.NotNullOrWhiteSpace(widgetName, nameof(widgetName));
Dimensions = dimensions;
}
}
}

14
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Dashboards/Volo/Abp/AspNetCore/Mvc/UI/Dashboards/WidgetOptions.cs

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Volo.Abp.AspNetCore.Mvc.UI.Dashboards
{
public class DashboardOptions
{
public List<DashboardDefinition> Dashboards { get; }
public DashboardOptions()
{
Dashboards = new List<DashboardDefinition>();
}
}
}

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDefinition.cs

@ -23,13 +23,19 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
} }
private ILocalizableString _displayName; private ILocalizableString _displayName;
[NotNull]
public Type ViewComponentType { get; set; } public Type ViewComponentType { get; set; }
[CanBeNull]
public WidgetDimensions DefaultDimensions { get; set; }
public WidgetDefinition( public WidgetDefinition(
[NotNull] string name, [NotNull] string name,
[NotNull] Type viewComponentType, [NotNull] Type viewComponentType,
[CanBeNull] ILocalizableString displayName) [CanBeNull] ILocalizableString displayName,
[CanBeNull] WidgetDimensions defaultDimensions = null)
{ {
DefaultDimensions = defaultDimensions;
Name = Check.NotNullOrWhiteSpace(name, nameof(name)); Name = Check.NotNullOrWhiteSpace(name, nameof(name));
ViewComponentType = Check.NotNull(viewComponentType, nameof(viewComponentType)); ViewComponentType = Check.NotNull(viewComponentType, nameof(viewComponentType));
DisplayName = displayName ?? new FixedLocalizableString(name); DisplayName = displayName ?? new FixedLocalizableString(name);

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDimensions.cs

@ -0,0 +1,15 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
public class WidgetDimensions
{
public int Width { get; }
public int Height { get; }
public WidgetDimensions(int width, int height)
{
Width = width;
Height = height;
}
}
}
Loading…
Cancel
Save