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