| ... | ... | @@ -125,7 +125,7 @@ The Cron job executes the [[main_cron.py|https://github.com/alanmitchell/bmon/bl |
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Details on Django Web Browser Application
|
|
|
|
## Details on the Client Web Browser Application
|
|
|
|
|
|
|
|
The BMON Django server application delivers content to the BMON web browser application, which consists of HTML and JavaScript. The browser application provides the user interface for users that are viewing and analyzing the sensor data and configuring the BMON application through the Django Admin interface.
|
|
|
|
|
| ... | ... | @@ -191,11 +191,32 @@ class BaseChart(object): |
|
|
|
TIMED_REFRESH = 0
|
|
|
|
```
|
|
|
|
|
|
|
|
The Django chart/report class that is responsible for creating the main content for the chart controls which Input elements are needed for the chart. [[The main JavaScript file for the browser app|https://github.com/alanmitchell/bmon/blob/master/bmsapp/static/bmsapp/scripts/bmsapp.coffee]] controls the visibility of those Inputs.
|
|
|
|
These class properties are converted to HTML attributes and sent to the browser client; [[The main JavaScript file for the browser app|https://github.com/alanmitchell/bmon/blob/master/bmsapp/static/bmsapp/scripts/bmsapp.coffee]] reads these attributes and controls the user interface accordingly.
|
|
|
|
|
|
|
|
```coffee
|
|
|
|
# Updates the results portion of the page
|
|
|
|
update_results = ->
|
|
|
|
$("body").css "cursor", "wait" # show hourglass
|
|
|
|
url = "#{$("#BaseURL").text()}reports/results/"
|
|
|
|
$.getJSON(url, $("#content select, #content input").serialize()
|
|
|
|
).done((results) ->
|
|
|
|
# load the returned HTML into the results div, but empty first to ensure
|
|
|
|
# event handlers, etc. are removed
|
|
|
|
$("body").css "cursor", "default" # remove hourglass cursor
|
|
|
|
$("#results").empty()
|
|
|
|
$("#results").html results.html
|
|
|
|
# Loop through the returned JavaScript objects to create and make them
|
|
|
|
$.each results.objects, (ix, obj) ->
|
|
|
|
[obj_type, obj_config] = obj
|
|
|
|
switch obj_type
|
|
|
|
when 'highcharts' then new Highcharts.Chart(obj_config)
|
|
|
|
when 'highstock' then new Highcharts.StockChart(obj_config)
|
|
|
|
when 'dashboard' then ANdash.createDashboard(obj_config)
|
|
|
|
).fail (jqxhr, textStatus, error) ->
|
|
|
|
$("body").css "cursor", "default" # remove hourglass cursor
|
|
|
|
alert "Error Occurred: " + err
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
* Config of pages
|
|
|
|
* Single Page App
|
|
|
|
* Chart type determines visibility of controls, recalc settings
|
|
|
|
* AJAX calls to refresh input control contents & results
|
|
|
|
* HTML and object creation.
|
|
|
|
* Two JS files, main and dashboard, created with CoffeeScript |
|
|
\ No newline at end of file |