Class WidgetBase
Represents the base class for all widgets.
Inherited Members
Namespace: DataWeb.Dashboard
Assembly: DataWeb.Core.dll
Syntax
public abstract class WidgetBase
Constructors
WidgetBase(IServiceProvider)
Initializes a new instance of the WidgetBase class.
Declaration
public WidgetBase(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
Fields
serviceProvider
Declaration
protected readonly IServiceProvider serviceProvider
Field Value
Type | Description |
---|---|
IServiceProvider |
Properties
IdMaster
Gets or sets the unique identifier.
Declaration
public string IdMaster { get; set; }
Property Value
Type |
---|
string |
Name
Gets or sets the widget name.
Declaration
public string Name { get; set; }
Property Value
Type |
---|
string |
Settings
Gets or sets the widget settings.
Declaration
public WidgetSettings Settings { get; set; }
Property Value
Type |
---|
WidgetSettings |
Title
Gets or sets the widget title.
Declaration
public string Title { get; set; }
Property Value
Type |
---|
string |
Type
Gets or sets the widget type.
Declaration
public string Type { get; set; }
Property Value
Type |
---|
string |
VisibleRoles
Gets or sets the list of visible roles.
Declaration
public List<string> VisibleRoles { get; set; }
Property Value
Type |
---|
List<string> |
WidgetClass
Gets or sets the widget class.
Declaration
public string WidgetClass { get; set; }
Property Value
Type |
---|
string |
WidgetComponent
Gets or sets the widget component.
Declaration
public string WidgetComponent { get; set; }
Property Value
Type |
---|
string |
Methods
GetDataAsync(Panel, Dictionary<string, object>, IUser)
Gets the data for the widget.
Declaration
public virtual Task<BaseData> GetDataAsync(Panel panel, Dictionary<string, object> widgetSettings, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Panel | panel | The Panel that the widget belongs to. |
Dictionary<string, object> | widgetSettings | The widget settings. |
IUser | user | The IUser who is viewing the widget. |
Returns
Type | Description |
---|---|
Task<BaseData> | The widget data. |
GetDefaultSettingsAsync(Panel, IUser)
Gets the default settings for the widget.
Declaration
public virtual Task<Dictionary<string, object>> GetDefaultSettingsAsync(Panel panel, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Panel | panel | The Panel that the widget belongs to. |
IUser | user | The IUser who is viewing the widget. |
Returns
Type | Description |
---|---|
Task<Dictionary<string, object>> | A dictionary of default settings. |
GetOptionsAsync(Panel, Dictionary<string, object>, IUser)
Gets the options for the widget.
Declaration
public virtual Task<BaseOptions> GetOptionsAsync(Panel panel, Dictionary<string, object> widgetSettings, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Panel | panel | The Panel that the widget belongs to. |
Dictionary<string, object> | widgetSettings | The widget settings. |
IUser | user | The IUser who is viewing the widget. |
Returns
Type | Description |
---|---|
Task<BaseOptions> | The widget options. |
UpdateSettingsAsync(Panel, Dictionary<string, object>, Dictionary<string, object>, IUser)
Updates the widget settings.
Declaration
public virtual Task UpdateSettingsAsync(Panel panel, Dictionary<string, object> providedSettings, Dictionary<string, object> widgetSettings, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Panel | panel | The Panel that the widget belongs to. |
Dictionary<string, object> | providedSettings | The provided settings. |
Dictionary<string, object> | widgetSettings | The widget settings. |
IUser | user | The IUser who is viewing the widget. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
ValidateSettingsAsync(Panel, Dictionary<string, object>, Dictionary<string, object>, IUser)
Validates the widget settings.
Declaration
public virtual Task<List<ValidationError>> ValidateSettingsAsync(Panel panel, Dictionary<string, object> providedSettings, Dictionary<string, object> widgetSettings, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Panel | panel | The Panel that the widget belongs to. |
Dictionary<string, object> | providedSettings | The provided settings. |
Dictionary<string, object> | widgetSettings | The widget settings. |
IUser | user | The IUser who is viewing the widget. |
Returns
Type | Description |
---|---|
Task<List<ValidationError>> | The list of validation errors. |