BankFeedbackItems(registry, controller, logSource, dbKey)

Class used by the feedback controller to manage the feedback items

new BankFeedbackItems(registry, controller, logSource, dbKey)

Creates an item base object
Parameters:
Name Type Description
registry Registry the core registry
controller BankActionController | BankFeedbackController the item's parent controller
logSource string module name to be used in logs
dbKey string the key to fetch from the database
Since:
  • 2.2.0
Author:

Extends

Members

protected controller :BankActionController|BankFeedbackController

The parent controller
Overrides:

protected dbKey :string

The database to use load/save the items
Overrides:

debug :debug.Debugger

The debugger for this class

protected definitions :Object.<string, Array.<BankItemDefinition>>

Nested arrays for the definitions from the instances: [instance_id][item_id]
Overrides:

protected items :Object.<number, Array.<number, Object.<number, BankItem>>>

Nested arrays containing the items in the banks: [page][bank][item] Also is the data that is stored to the DB.
Overrides:

protected logSource :string

The module name to use in UI logs
Overrides:

protected registry :Registry

the core registry
Overrides:

protected system :EventEmitter

the application's event smitter
Overrides:

Methods

addItem(page, bank, item)

Add an item to a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
item string item information in form: `"instance_id:type"`
Overrides:

addItemByClient(client, result, page, bank, item)

Add item to a bank via a client socket
Parameters:
Name Type Description
client IO.Socket the client socket sending the request
result string the name of the call to send the results back to the client
page number the bank's page
bank number the bank number
item string item information in form: `"instance_id:type"`
Overrides:

protected bank() → {BankController}

Returns:
BankController - the core bank controller
Overrides:

protected checkBankExists(page, bank)

Check if a bank exists and initialize it if it doesn't
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Overrides:

checkBankStatus(page, bank)

Scrub a bank's feedback items to process the current status/style
Parameters:
Name Type Description
page number the bank's page
bank number the bank number

checkInstanceStatus(id, type, checkQueuenullable) → {Array.<string, boolean>}

Scan the page/bank array to find items for an instance or just specific types and populate an array with the findings
Parameters:
Name Type Attributes Description
id string the instance ID to check for
type string the item type to check for
checkQueue Array.<string, boolean> <nullable>
array of flagged banks with keys of `[page_bank]`; empty by default but can have a populated version passed to be added to
Returns:
Array.<string, boolean> - the populated `checkQueue`
Overrides:

checkStatus(page, bank, index)

Check an item's status and update its style
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
index number the item's index
Overrides:

protected db() → {Database}

Returns:
Database - the core database library
Overrides:

deleteInstance(id, checkQueuenullable) → {Array.<string, boolean>}

Scan the page/bank array for items from an instance and delete them
Parameters:
Name Type Attributes Description
id string the instance ID to delete
checkQueue Array.<string, boolean> <nullable>
array of changed banks with keys of `[page_bank]`; empty by default but can have a populated version passed to be added to
Returns:
Array.<string, boolean> - the populated `checkQueue`
Overrides:

deleteItem(page, bank, index)

Delete an item
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
index number the item's index
Overrides:

deleteItemByClient(client, result, page, bank, index)

Delete an item from a bank via a client socket
Parameters:
Name Type Description
client IO.Socket the client socket sending the request
result string the name of the call to send the results back to the client
page number the item's page
bank number the item's bank
index string the item's id (`item.id`)
Overrides:

protected elgatoDM() → {DeviceController}

Returns:
DeviceController - the core device controller
Overrides:

getAll(clone) → {Object}

Get the entire items array
Parameters:
Name Type Default Description
clone boolean false whether or not the return should be a deep clone
Returns:
Object - the array in the form `[page][bank][item]`
Overrides:

getBank(page, bank, clone) → {Array.<BankItem>}

Get the items in a bank
Parameters:
Name Type Default Description
page number the bank's page
bank number the bank number
clone boolean false whether or not the return should be a deep clone
Returns:
Array.<BankItem> - the items array
Overrides:

getBankByClient(client, result, page, bank)

Get the items in a bank via a client socket
Parameters:
Name Type Description
client IO.Socket the client socket sending the request
result string the name of the call to send the results back to the client
page number the bank's page
bank number the bank number
Overrides:

getBankStyles(page, bank, clone) → {Array.<BankStyle>}

Get the current style for a bank's items
Parameters:
Name Type Default Description
page number the item's page
bank number the item bank
clone boolean false whether or not the return should be a deep clone
Returns:
Array.<BankStyle> - the bank array

getInstanceItems(id, clone) → {Object}

Get all the items for a specific instance
Parameters:
Name Type Default Description
id string the instance id
clone boolean false whether or not the return should be a deep clone
Returns:
Object - the items array
Overrides:

getPage(page, clone) → {Array.<number, Array.<BankItem>>}

Get the items on a page
Parameters:
Name Type Default Description
page number the page number
clone boolean false whether or not the return should be a deep clone
Returns:
Array.<number, Array.<BankItem>> - the array in the form `[bank][item]`
Overrides:

getStyle(page, bank, index, clone) → {BankStyle}

Get the current style for an item
Parameters:
Name Type Default Description
page number the item's page
bank number the item's bank
index number the item's index
clone boolean false whether or not the return should be a deep clone
Returns:
BankStyle - the items array

protected graphics() → {Graphics}

Returns:
Graphics - the core graphics controller
Overrides:

importBank(page, bank, items)

Import and subscribe items to a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
items Array.<BankItem> the items to import
Overrides:

protected instance() → {InstanceController}

Returns:
InstanceController - the core instance controller
Overrides:

protected io() → {InterfaceClient}

Returns:
InterfaceClient - the core interface client
Overrides:

protected log(level, message)

Send a log message to the UI
Parameters:
Name Type Description
level string 'debug' | 'info' | 'warn' | 'error'
message atring the message to print
Overrides:

protected page() → {PageController}

Returns:
PageController - the core page controller
Overrides:

resetBank(page, bank)

Unsubscribe, clear a bank, and save
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Overrides:

save()

Flag the database to save
Overrides:

protected schedule() → {ScheduleController}

Returns:
ScheduleController - the core schedule controller
Overrides:

protected services() → {ServiceController}

Returns:
ServiceController - the core service controller
Overrides:

setDefinitions(definitions)

Set a new definitions array
Parameters:
Name Type Description
definitions Array.<BankItemDefinition> the new definitions
Overrides:

protected setStyle(page, bank, index, style)

Save the current return style from a feedback
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
index number the item's index
style BankStyle the current style

protected subscribe(item)

Find a subscribe function for an item and execute it
Parameters:
Name Type Description
item BankItem the item object
Overrides:

subscribeBank(page, bank)

Execute subscribes for all the items in a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Overrides:

protected unsubscribe(item)

Find an unsubscribe function for an item and execute it
Parameters:
Name Type Description
item BankItem the item object
Overrides:

unsubscribeBank(page, bank)

Execute unsubscribes for all the items in a bank
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
Overrides:

updateItemOption(page, bank, item, option, value)

Update an option for an item, subscribe, and save
Parameters:
Name Type Description
page number the item's page
bank number the item's bank
item string the item's id (`item.id`)
option string the option id/key
value string | Array.<string> | number | boolean the new value
Overrides:

updateItemOrder(page, bank, oldIndex, newIndex)

Update a bank item order by swapping two keys
Parameters:
Name Type Description
page number the bank's page
bank number the bank number
oldIndex number the moving item's index
newIndex number the other index to swap with
Overrides:

protected userconfig() → {UserConfig}

Returns:
UserConfig - the core user config manager
Overrides: