diff --git a/js/component/header.js b/js/component/header.js index dd54ec8..eb8c87d 100644 --- a/js/component/header.js +++ b/js/component/header.js @@ -28,19 +28,19 @@ beestat.component.header.prototype.decorate_ = function(parent) { pages = [ { - 'layer': 'dashboard', - 'text': 'Dashboard', - 'icon': 'tablet_dashboard' + 'layer': 'detail', + 'text': 'Detail', + 'icon': 'eye_circle' }, { - 'layer': 'sensors', - 'text': 'Sensors', - 'icon': 'signal_variant' + 'layer': 'analyze', + 'text': 'Analyze', + 'icon': 'home_search' }, { - 'layer': 'comparisons', - 'text': 'Comparisons', - 'icon': 'home_group' + 'layer': 'compare', + 'text': 'Compare', + 'icon': 'earth' } ]; diff --git a/js/layer/sensors.js b/js/layer/analyze.js similarity index 60% rename from js/layer/sensors.js rename to js/layer/analyze.js index 4bde099..6cf8cdd 100644 --- a/js/layer/sensors.js +++ b/js/layer/analyze.js @@ -1,12 +1,14 @@ /** - * Sensors layer. + * Analyze layer. */ -beestat.layer.sensors = function() { +beestat.layer.analyze = function() { beestat.layer.apply(this, arguments); }; -beestat.extend(beestat.layer.sensors, beestat.layer); +beestat.extend(beestat.layer.analyze, beestat.layer); + +beestat.layer.analyze.prototype.decorate_ = function(parent) { + const thermostat = beestat.cache.thermostat[beestat.setting('thermostat_id')]; -beestat.layer.sensors.prototype.decorate_ = function(parent) { /* * Set the overflow on the body so the scrollbar is always present so * highcharts graphs render properly. @@ -17,7 +19,7 @@ beestat.layer.sensors.prototype.decorate_ = function(parent) { 'padding': '0 ' + beestat.style.size.gutter + 'px' }); - (new beestat.component.header('sensors')).render(parent); + (new beestat.component.header('analyze')).render(parent); // All the cards var cards = []; @@ -33,15 +35,17 @@ beestat.layer.sensors.prototype.decorate_ = function(parent) { cards.push([ { - 'card': new beestat.component.card.sensors(), + 'card': new beestat.component.card.runtime_thermostat_summary( + thermostat.thermostat_id + ), 'size': 12 } ]); cards.push([ { - 'card': new beestat.component.card.runtime_sensor_detail( - beestat.setting('thermostat_id') + 'card': new beestat.component.card.temperature_profiles( + thermostat.thermostat_id ), 'size': 12 } diff --git a/js/layer/compare.js b/js/layer/compare.js new file mode 100644 index 0000000..bc7c946 --- /dev/null +++ b/js/layer/compare.js @@ -0,0 +1,76 @@ +/** + * Compare layer. + */ +beestat.layer.compare = function() { + beestat.layer.apply(this, arguments); +}; +beestat.extend(beestat.layer.compare, beestat.layer); + +beestat.layer.compare.prototype.decorate_ = function(parent) { + /* + * Set the overflow on the body so the scrollbar is always present so + * highcharts graphs render properly. + */ + $('body').style({ + 'overflow-y': 'scroll', + 'background': beestat.style.color.bluegray.light, + 'padding': '0 ' + beestat.style.size.gutter + 'px' + }); + + (new beestat.component.header('compare')).render(parent); + + const thermostat = beestat.cache.thermostat[beestat.setting('thermostat_id')]; + + // All the cards + const cards = []; + + if (window.is_demo === true) { + cards.push([ + { + 'card': new beestat.component.card.demo(), + 'size': 12 + } + ]); + } + + cards.push([ + { + 'card': new beestat.component.card.compare_notification(), + 'size': 12 + } + ]); + + cards.push([ + { + 'card': new beestat.component.card.comparison_settings( + thermostat.thermostat_id + ), + 'size': 6 + }, + { + 'card': new beestat.component.card.my_home( + thermostat.thermostat_id + ), + 'size': 6 + } + ]); + + cards.push([ + { + 'card': new beestat.component.card.metrics( + thermostat.thermostat_id + ), + 'size': 12 + } + ]); + + // Footer + cards.push([ + { + 'card': new beestat.component.card.footer(), + 'size': 12 + } + ]); + + (new beestat.component.layout(cards)).render(parent); +}; diff --git a/js/layer/comparisons.js b/js/layer/comparisons.js deleted file mode 100644 index cc28e04..0000000 --- a/js/layer/comparisons.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Home comparisons layer. - */ -beestat.layer.comparisons = function() { - beestat.layer.apply(this, arguments); -}; -beestat.extend(beestat.layer.comparisons, beestat.layer); - -beestat.layer.comparisons.prototype.decorate_ = function(parent) { - /* - * Set the overflow on the body so the scrollbar is always present so - * highcharts graphs render properly. - */ - $('body').style({ - 'overflow-y': 'scroll', - 'background': beestat.style.color.bluegray.light, - 'padding': '0 ' + beestat.style.size.gutter + 'px' - }); - - (new beestat.component.header('comparisons')).render(parent); - - var thermostat = beestat.cache.thermostat[beestat.setting('thermostat_id')]; - var thermostat_group = beestat.cache.thermostat_group[thermostat.thermostat_group_id]; - - // All the cards - var cards = []; - - if (window.is_demo === true) { - cards.push([ - { - 'card': new beestat.component.card.demo(), - 'size': 12 - } - ]); - } - - cards.push([ - { - 'card': new beestat.component.card.comparison_settings(), - 'size': 6 - }, - { - 'card': new beestat.component.card.my_home(), - 'size': 6 - } - ]); - - // Scores and graph - if (thermostat_group.temperature_profile !== null) { - cards.push([ - { - 'card': new beestat.component.card.score.heat(), - 'size': 4 - }, - { - 'card': new beestat.component.card.score.cool(), - 'size': 4 - }, - { - 'card': new beestat.component.card.score.resist(), - 'size': 4 - } - ]); - - cards.push([ - { - 'card': new beestat.component.card.temperature_profiles(thermostat_group.thermostat_group_id), - 'size': 12 - } - ]); - } - - if (thermostat_group.profile !== null) { - if (beestat.user.has_early_access() === true) { - cards.push([ - { - 'card': new beestat.component.card.early_access(), - 'size': 12 - } - ]); - cards.push([ - { - 'card': new beestat.component.card.metrics(thermostat_group.thermostat_group_id), - 'size': 12 - } - ]); - cards.push([ - { - 'card': new beestat.component.card.temperature_profiles_new(thermostat_group.thermostat_group_id), - 'size': 12 - } - ]); - } - } - - // Footer - cards.push([ - { - 'card': new beestat.component.card.footer(), - 'size': 12 - } - ]); - - (new beestat.component.layout(cards)).render(parent); -}; diff --git a/js/layer/dashboard.js b/js/layer/detail.js similarity index 78% rename from js/layer/dashboard.js rename to js/layer/detail.js index 37f0031..87d7592 100644 --- a/js/layer/dashboard.js +++ b/js/layer/detail.js @@ -1,82 +1,84 @@ -/** - * Dashboard layer. - */ -beestat.layer.dashboard = function() { - beestat.layer.apply(this, arguments); -}; -beestat.extend(beestat.layer.dashboard, beestat.layer); - -beestat.layer.dashboard.prototype.decorate_ = function(parent) { - /* - * Set the overflow on the body so the scrollbar is always present so - * highcharts graphs render properly. - */ - $('body').style({ - 'overflow-y': 'scroll', - 'background': beestat.style.color.bluegray.light, - 'padding': '0 ' + beestat.style.size.gutter + 'px' - }); - - (new beestat.component.header('dashboard')).render(parent); - - // All the cards - var cards = []; - - if (window.is_demo === true) { - cards.push([ - { - 'card': new beestat.component.card.demo(), - 'size': 12 - } - ]); - } - - cards.push([ - { - 'card': new beestat.component.card.system(), - 'size': 4 - }, - { - 'card': new beestat.component.card.sensors(), - 'size': 4 - }, - { - 'card': new beestat.component.card.alerts(), - 'size': 4 - } - ]); - - if (beestat.component.card.patreon.should_show() === true) { - cards.push([ - { - 'card': new beestat.component.card.patreon(), - 'size': 12 - } - ]); - } - - cards.push([ - { - 'card': new beestat.component.card.runtime_thermostat_detail( - beestat.setting('thermostat_id') - ), - 'size': 12 - } - ]); - cards.push([ - { - 'card': new beestat.component.card.runtime_thermostat_summary( - beestat.setting('thermostat_id') - ), - 'size': 12 - } - ]); - cards.push([ - { - 'card': new beestat.component.card.footer(), - 'size': 12 - } - ]); - - (new beestat.component.layout(cards)).render(parent); -}; +/** + * Detail layer. + */ +beestat.layer.detail = function() { + beestat.layer.apply(this, arguments); +}; +beestat.extend(beestat.layer.detail, beestat.layer); + +beestat.layer.detail.prototype.decorate_ = function(parent) { + /* + * Set the overflow on the body so the scrollbar is always present so + * highcharts graphs render properly. + */ + $('body').style({ + 'overflow-y': 'scroll', + 'background': beestat.style.color.bluegray.light, + 'padding': '0 ' + beestat.style.size.gutter + 'px' + }); + + (new beestat.component.header('detail')).render(parent); + + // All the cards + var cards = []; + + if (window.is_demo === true) { + cards.push([ + { + 'card': new beestat.component.card.demo(), + 'size': 12 + } + ]); + } + + cards.push([ + { + 'card': new beestat.component.card.system(), + 'size': 4 + }, + { + 'card': new beestat.component.card.sensors(), + 'size': 4 + }, + { + 'card': new beestat.component.card.alerts(), + 'size': 4 + } + ]); + + if (beestat.component.card.patreon.should_show() === true) { + cards.push([ + { + 'card': new beestat.component.card.patreon(), + 'size': 12 + } + ]); + } + + cards.push([ + { + 'card': new beestat.component.card.runtime_thermostat_detail( + beestat.setting('thermostat_id') + ), + 'size': 12 + } + ]); + + cards.push([ + { + 'card': new beestat.component.card.runtime_sensor_detail( + beestat.setting('thermostat_id') + ), + 'size': 12 + } + ]); + + cards.push([ + { + 'card': new beestat.component.card.footer(), + 'size': 12 + } + ]); + + (new beestat.component.layout(cards)).render(parent); +}; diff --git a/js/layer/load.js b/js/layer/load.js index d258f8d..b2c1972 100644 --- a/js/layer/load.js +++ b/js/layer/load.js @@ -206,7 +206,7 @@ beestat.layer.load.prototype.decorate_ = function(parent) { // Enable polling for live updates beestat.enable_poll(); - (new beestat.layer.dashboard()).render(); + (new beestat.layer.detail()).render(); beestat.ecobee.notify_if_down();