Skip to content
This repository was archived by the owner on Mar 7, 2018. It is now read-only.

Latest commit

 

History

History
321 lines (229 loc) · 9.93 KB

File metadata and controls

321 lines (229 loc) · 9.93 KB

Classes

App

App model containing all data, methods, ajax calls of this application It runs on its own and views can 'observe' for changes to redraw.

Observable

Simple Observable class to notify others listening for changes

Functions

_autoScrollOnLive(argName)string

On live mode when new rows are coming and auto-scroll is on, scroll-down

_autoScrollOnReset()

Auto-scroll top on logs reference change for example when we clean and add new rows, just scroll top

_autoScrollOnSelected()

Auto-scroll to selected row: A row is selected and it was not the case earlier, so let's scroll to it if not in the screen!

_computeTablePosition()

Fake big scroll Only dozen of rows are actually displayed in the table inside a big DIV scrolling so we need to calculate the position of the table inside it this is made for performance, DOM cannot handle 50k nodes

App

App model containing all data, methods, ajax calls of this application It runs on its own and views can 'observe' for changes to redraw.

Kind: global class

new App()

Constructor, declares default properties and init Observable super class

app.reconnect()

Reconnect ws when connection is lost, 2s between tries

Kind: instance method of App

app.query() ⇒ xhr

Query server for logs stored in DB

Kind: instance method of App
Returns: xhr - jquery ajax instance

app.live(enabled) ⇒ bool

Getter/setter of live mode state, if argument is provided it tells the server to start/stop sending logs by websocket

Kind: instance method of App
Returns: bool - live mode state

Param Type Description
enabled bool (optional) start/stop live mode

app.onLiveMessage(log)

Inserts log into list and notify observers

Kind: instance method of App

Param Type Description
log string log object to be inserted

app.empty()

Empty all logs stored

Kind: instance method of App

app.displayField(fieldName, value) ⇒ bool

Getter/setter if a field should be displayed or not

Kind: instance method of App
Returns: bool - if should be displayed

Param Type Description
fieldName string field to be set
value boolean display or not

app.rawFilters(rawFilters)

Set many raw filters from an object, because it calls rawFilter, parsed filters will be setted too, it must be used to load any filter from outside model

Kind: instance method of App

Param Type Description
rawFilters object field->operator

app.rawFilter(field, operator, value) ⇒ string

Getter/setter for input field, this also update the parsed/casted filters

Kind: instance method of App
Returns: string - always a string, to show to user

Param Type Description
field string name of the column
operator string criteria to apply to the column
value string the string given by user

app.parsedFilters(field, operator) ⇒ string | date | number

Getter for the parsed filters

Kind: instance method of App
Returns: string | date | number - the parsed value associated to this filter

Param Type Description
field string name of the column
operator string criteria to apply to the column

app.selected(row) ⇒ object

Getter/setter for the row selected in the table, we use virtualId as an id

Kind: instance method of App
Returns: object - the row selected or null

Param Type Description
row object | string the row to be selected, or its virtualId

app.moveSelected(n)

Move current cursor by n rows

Kind: instance method of App

Param Type Description
n Number can be negative or positive

app.moveSelectedError(n)

Move current cursor by n rows, but only errors

Kind: instance method of App

Param Type Description
n Number negative or positive number, Infinity for first and last error

app.logs(log(s), append) ⇒ array

Getter/setter for logs, can append with second arg

Kind: instance method of App
Returns: array - logs in memory

Param Type Description
log(s) array | object the new log(s)
append bool just push on last position and truncate if needed

app.inspector(activated) ⇒ bool

Getter/setter for the inspector

Kind: instance method of App
Returns: bool - if the inspector is enabled or not

Param Type Description
activated bool state of the inspector

app.autoScroll(enabled) ⇒ bool

Getter/setter for the auto-scroll

Kind: instance method of App
Returns: bool - if the auto-scroll is enabled or not

Param Type Description
enabled bool state of auto-scroll

app.max(max) ⇒ Number

Getter/setter for the max number of logs loaded in memory

Kind: instance method of App
Returns: Number - how many logs

Param Type Description
max Number how many logs

Observable

Simple Observable class to notify others listening for changes

Kind: global class

observable.observe(callback)

Add an observer

Kind: instance method of Observable

Param Type Description
callback function will be called for each notification

observable.unobserve(callback)

Remove an observer

Kind: instance method of Observable

Param Type Description
callback function the callback to remove

observable.notify()

Notify every observer that something changed

Kind: instance method of Observable

_autoScrollOnLive(argName) ⇒ string

On live mode when new rows are coming and auto-scroll is on, scroll-down

Kind: global function
Returns: string - blabla

Param Type Description
argName string blabla

_autoScrollOnReset()

Auto-scroll top on logs reference change for example when we clean and add new rows, just scroll top

Kind: global function

_autoScrollOnSelected()

Auto-scroll to selected row: A row is selected and it was not the case earlier, so let's scroll to it if not in the screen!

Kind: global function

_computeTablePosition()

Fake big scroll Only dozen of rows are actually displayed in the table inside a big DIV scrolling so we need to calculate the position of the table inside it this is made for performance, DOM cannot handle 50k nodes

Kind: global function