Interface

ResourceOptions

ResourceOptions

Options for given resource

Usage with TypeScript

import { ResourceOptions } from 'admin-bro'

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 26

Members

object | object

# actions Optional

List of all actions along with their options

Properties:
Name Type Attributes Description
show Partial.<Action.<RecordActionResponse>> <optional>
edit Partial.<Action.<RecordActionResponse>> <optional>
delete Partial.<Action.<RecordActionResponse>> <optional>
bulkDelete Partial.<Action.<BulkActionResponse>> <optional>
new Partial.<Action.<RecordActionResponse>> <optional>
list Partial.<Action.<ListActionResponse>> <optional>
search Partial.<Action.<SearchActionResponse>> <optional>
{...} Partial.<Action.<ActionResponse>>

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 114

Array.<string>

# editProperties Optional

List of properties which should be visible on edit view

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 58

Array.<string>

# filterProperties Optional

List of properties which should be visible on the filter

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 64

HrefFunction | string

# href Optional

Where resource link in sidebar should redirect. Default to the list action.

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 70

string

# id Optional

Unique id of a resource.

So let's suppose that you connected 2 databases to AdminBro. Both of them have the same collection: 'users'. In this case AdminBro wont be able to distinguish them. In this case changing Id of one of the resources helps to solve this issue.

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 36

Array.<string>

# listProperties Optional

List of properties which should be visible on a list

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 46

object | string | null

Navigation option saying under which resource should be nested in sidebar. Default to the database name.

You have couple of options:

  • when you give both name and icon - your resource will be nested under this menu.
  • when you set it to null - resource will be top level, but without the icon
  • finally you can set the icon but leave name as null. In such case resource will be top level and it will have an icon.
Properties:
Name Type Attributes Description
name string | null <optional>
icon string <optional>
New:
  • In version 3.3

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 76

object | string | null

# parent Optional

Properties:
Name Type Attributes Description
name string | null <optional>
icon string <optional>
Deprecated:
  • in favour of ResourceOptions.navigation

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 92

Record.<string, PropertyOptions>

# properties Optional

List of properties along with their options

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 108

Array.<string>

# showProperties Optional

List of properties which should be visible on show view

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 52

object

# sort Optional

Default sort property and direction.

Properties:
Name Type Description
direction 'asc' | 'desc'
sortBy string

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 100

Type Definitions

object

# HrefContext

Properties:
Name Type Attributes Description
h ViewHelpers

view helpers

resource BaseResource

Resource on which href has been invoked.

currentAdmin CurrentAdmin <optional>

Currently logged in admin

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 10

# HrefFunction(context)

Function returning string or string

Parameters:
Name Type Description
context HrefContext

View Source admin-bro/src/backend/decorators/resource/resource-options.interface.ts, line 18

SoftwareBrothers

Proudly built and maintained by SoftwareBrothers

Software House with a passion for both JavaScript and TypeScript.

See what we do See what we believe in

Proudly built and maintained by

SoftwareBrothers