Constructor
# new ResourceDecorator(options)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
object | ||
resource |
BaseResource | resource which is decorated |
|
admin |
AdminBro | current instance of AdminBro |
|
options |
ResourceOptions |
<optional> |
Members
Methods
# bulkActions(currentAdmin) → {Array.<ActionDecorator>}
List of all actions which should be invoked for entire resource and not for a particular record
Parameters:
Name | Type | Description |
---|---|---|
currentAdmin |
CurrentAdmin | currently logged in admin user |
Actions assigned to resources
# decorateActions() → {Record.<string, ActionDecorator>}
Used to create an ActionDecorator based on both default actions and actions specified by the user via AdminBroOptions
# getParent() → {Record.<string, string>}
Returns resource parent along with the icon. By default it is a database type with its icon
returns { name, icon }
# getProperties(options) → {Array.<PropertyDecorator>}
Returns list of all properties which will be visible in given place (where)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object | ||
where |
String | one of: 'list', 'show', 'edit', 'filter' |
|
max |
String |
<optional> |
maximum number of properties returned where there are no overrides in the options |
# getPropertyByKey(propertyPath) → {PropertyDecorator}
Returns propertyDecorator by giving property path
Parameters:
Name | Type | Description |
---|---|---|
propertyPath |
String | property path |
when there is no property for given key
# recordActions(currentAdminopt) → {Array.<ActionDecorator>}
List of all actions which should be invoked for given record and not for an entire resource
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
currentAdmin |
CurrentAdmin |
<optional> |
currently logged in admin user |
Actions assigned to each record
# resourceActions(currentAdmin) → {Array.<ActionDecorator>}
List of all actions which should be invoked for entire resource and not for a particular record
Parameters:
Name | Type | Description |
---|---|---|
currentAdmin |
CurrentAdmin | currently logged in admin user |
Actions assigned to resources
# titleOf(record) → {String}
Returns title for given record.
For example: If given record has name
property and this property has isTitle
flag set in
options or by the Adapter - value for this property will be shown
Parameters:
Name | Type | Description |
---|---|---|
record |
BaseRecord |
title of given record
# titleProperty() → {PropertyDecorator}
Returns PropertyDecorator of a property which should be treated as a title property.
PropertyDecorator of title property
# toJSON(currentAdmin) → {ResourceJSON}
Returns JSON representation of a resource
Parameters:
Name | Type | Description |
---|---|---|
currentAdmin |
CurrentAdmin |