Class: CRUDGenericAction

CRUDGenericAction

Generic CRUD action class

new CRUDGenericAction()

Members


<static> ACTION


<static> MODEL_ACTION_GET


<static> MODEL_ACTION_PUT


<static> TRANSFORMER


<static> UIConstructor


<static> breadcrumbsTails

Libarary of breadcrumbs tails strings templates

<static> deafultBreadcrumbsTail

Default breadcrumbs tail template string

Methods


<static> bindUIEvents(controller, params, response)

Binds events to action UI
Parameters:
Name Type Description
controller object instance of controller
params Array.<string> list of route params
response object API response

<static> getBreadcrumbsTail(name)

Returns template of breadcrumbs tail
Parameters:
Name Type Description
name string
Returns:
template string
Type
string

<static> getIdField(controller)

Returns name of model identificaiton field
Parameters:
Name Type Description
controller object instance of controller
Returns:
default id field name is '_id'
Type
string

<static> getModelActionName(controller)

Returns model API action name
Parameters:
Name Type Description
controller object instance of controller
Returns:
network interface model action name, for API; default: this.MODEL_ACTION_GET
Type
string

<static> getUI(controller)

Returns instance of this action UI component from controller
Parameters:
Name Type Description
controller object instance of controller
Returns:
instance of UI component
Type
object

<static> isResponseBad(response)

Checks response on success
Parameters:
Name Type Description
response object
Properties
Name Type Description
status string
Returns:
true if response is bad
Type
boolean

<static> isUIRendered(controller)

true, if UI of this action already exists, false, if UI of this action wasn't existed and other UIs were destoryed
Parameters:
Name Type Description
controller object instance of controller
Returns:
true if UI of this action exists, false if UI of other was destroyed
Type
boolean

<async, static> loadData(controller, params)

Return Promise of API reponse
Parameters:
Name Type Description
controller object instance of controller
params Array.<string> array of strings parsed from URI by router and passed to controller
Returns:
API response {status:string, result:any, message:string, errors: {[fieldname]:[...errorMessages]}}
Type
Promise

<static> prepareUIOptions(controller, response)

Creates object with all options needed to initialize UI component
Parameters:
Name Type Description
controller object instance of controller
response object API reponse object
Returns:
ui options object
Type
object

<static> presetBreadcrumbs(controller, params)

Sets breadcrumbs tail, without result details
Parameters:
Name Type Description
controller object instance of controller
params Array.<string> list of route params

<async, static> run(controller, params)

Performing action preparation and renders UI
Parameters:
Name Type Description
controller object instance of controller
params Array.<string> list of route params
Returns:
Type
undefined

<static> setBreadcrumbs(controller, params, response)

Sets breadcrumbs tail with response details, aka title of loaded item
Parameters:
Name Type Description
controller object instance of controller
params Array.<string> list of route params
response object API response in wrapper
Properties
Name Type Description
result object API response result

<static> setUI(controller, ui)

Sets UI of this action in controller
Parameters:
Name Type Description
controller object instance of controller
ui object instance of UI component