Class

ResourceDecorator

ResourceDecorator(options)

Base decorator class which decorates the Resource.

Constructor

# new ResourceDecorator(options)

Parameters:
Name Type Attributes Description
options object
resource BaseResource

resource which is decorated

admin AdminJS

current instance of AdminJS

options ResourceOptions <optional>

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 16

Classes

ResourceDecorator

Members

ResourceOptions

# options

Options passed along with a given resource

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 55

# properties

Map of all root level properties. By root properties we mean property which is not nested

under other mixed property.

Examples from PropertyOptions: { rootProperty: { type: mixed }, // root property

// nested property - this should go be the subProperty of rootProperty 'rootProperty.nested': { type: 'string' }

// also root property because there is no another property of type mixed 'another.property': { type: 'string' }, }

for a the reference {@see decorateProperties}

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 34

Array.<PropertyDecorator>

# properties

List of all decorated root properties

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 61

DecoratedProperties

# properties

Map of all root level properties. By root properties we mean property which is not nested

under other mixed property.

Examples from PropertyOptions: { rootProperty: { type: mixed }, // root property

// nested property - this should go be the subProperty of rootProperty 'rootProperty.nested': { type: 'string' }

// also root property because there is no another property of type mixed 'another.property': { type: 'string' }, }

for a the reference {@see decorateProperties}

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 298

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

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 371

Actions assigned to resources

Array.<ActionDecorator>

# getFlattenProperties() → {Record.<string, PropertyDecorator>}

Returns all the properties with corresponding subProperties in one object.

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 353

Record.<string, PropertyDecorator>

# getNavigation() → {Parent}

Returns resource parent along with the icon. By default it is a

database type with its icon

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 326

ResourceJSON['parent']}

Parent

# 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

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 347

Array.<PropertyDecorator>

# getPropertyByKey(propertyPath) → {PropertyDecorator}

Returns propertyDecorator by giving property path
Parameters:
Name Type Description
propertyPath String

property path

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 335

# getResourceName() → {string}

Returns the name for the resource.

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 313

resource name

string

# id() → {string}

Returns the id for the resource.

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 319

resource id

string

# 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

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 380

Actions assigned to each record

Array.<ActionDecorator>

# 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

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 362

Actions assigned to resources

Array.<ActionDecorator>

# 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

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 399

title of given record

String

# titleProperty() → {PropertyDecorator}

Returns PropertyDecorator of a property which should be treated as a title property.

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 387

PropertyDecorator of title property

# toJSON(currentAdmin) → {ResourceJSON}

Returns JSON representation of a resource
Parameters:
Name Type Description
currentAdmin CurrentAdmin

View Source adminjs/src/backend/decorators/resource/resource-decorator.ts, line 407

ResourceJSON