1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Hiding card menus for #261

This commit is contained in:
Jon Ziebell 2020-03-03 20:56:55 -05:00
parent f68f97d6ce
commit 8ee82d4bd0
2 changed files with 147 additions and 143 deletions

View File

@ -251,74 +251,76 @@ beestat.component.card.runtime_sensor_detail.prototype.decorate_top_right_ = fun
var menu = (new beestat.component.menu()).render(parent);
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 1 Day')
.set_icon('numeric_1_box')
.set_callback(function() {
if (
beestat.setting('runtime_sensor_detail_range_dynamic') !== 1 ||
beestat.setting('runtime_sensor_detail_range_type') !== 'dynamic'
) {
beestat.cache.delete('runtime_sensor');
beestat.setting({
'runtime_sensor_detail_range_dynamic': 1,
'runtime_sensor_detail_range_type': 'dynamic'
});
}
}));
if (this.has_data_() === true) {
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 1 Day')
.set_icon('numeric_1_box')
.set_callback(function() {
if (
beestat.setting('runtime_sensor_detail_range_dynamic') !== 1 ||
beestat.setting('runtime_sensor_detail_range_type') !== 'dynamic'
) {
beestat.cache.delete('runtime_sensor');
beestat.setting({
'runtime_sensor_detail_range_dynamic': 1,
'runtime_sensor_detail_range_type': 'dynamic'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 3 Days')
.set_icon('numeric_3_box')
.set_callback(function() {
if (
beestat.setting('runtime_sensor_detail_range_dynamic') !== 3 ||
beestat.setting('runtime_sensor_detail_range_type') !== 'dynamic'
) {
beestat.cache.delete('runtime_sensor');
beestat.setting({
'runtime_sensor_detail_range_dynamic': 3,
'runtime_sensor_detail_range_type': 'dynamic'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 3 Days')
.set_icon('numeric_3_box')
.set_callback(function() {
if (
beestat.setting('runtime_sensor_detail_range_dynamic') !== 3 ||
beestat.setting('runtime_sensor_detail_range_type') !== 'dynamic'
) {
beestat.cache.delete('runtime_sensor');
beestat.setting({
'runtime_sensor_detail_range_dynamic': 3,
'runtime_sensor_detail_range_type': 'dynamic'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 7 Days')
.set_icon('numeric_7_box')
.set_callback(function() {
if (
beestat.setting('runtime_sensor_detail_range_dynamic') !== 7 ||
beestat.setting('runtime_sensor_detail_range_type') !== 'dynamic'
) {
beestat.cache.delete('runtime_sensor');
beestat.setting({
'runtime_sensor_detail_range_dynamic': 7,
'runtime_sensor_detail_range_type': 'dynamic'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 7 Days')
.set_icon('numeric_7_box')
.set_callback(function() {
if (
beestat.setting('runtime_sensor_detail_range_dynamic') !== 7 ||
beestat.setting('runtime_sensor_detail_range_type') !== 'dynamic'
) {
beestat.cache.delete('runtime_sensor');
beestat.setting({
'runtime_sensor_detail_range_dynamic': 7,
'runtime_sensor_detail_range_type': 'dynamic'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Custom')
.set_icon('calendar_edit')
.set_callback(function() {
(new beestat.component.modal.runtime_sensor_detail_custom()).render();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Custom')
.set_icon('calendar_edit')
.set_callback(function() {
(new beestat.component.modal.runtime_sensor_detail_custom()).render();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Download Chart')
.set_icon('download')
.set_callback(function() {
self.charts_.temperature.export();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Download Chart')
.set_icon('download')
.set_callback(function() {
self.charts_.temperature.export();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Reset Zoom')
.set_icon('magnify_minus')
.set_callback(function() {
self.charts_.temperature.reset_zoom();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Reset Zoom')
.set_icon('magnify_minus')
.set_callback(function() {
self.charts_.temperature.reset_zoom();
}));
}
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Help')

View File

@ -507,92 +507,94 @@ beestat.component.card.runtime_thermostat_summary.prototype.decorate_top_right_
var menu = (new beestat.component.menu()).render(parent);
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 3 Months')
.set_icon('calendar_range')
.set_callback(function() {
if (
beestat.setting('runtime_thermostat_summary_time_count') !== 3 ||
beestat.setting('runtime_thermostat_summary_time_period') !== 'month' ||
beestat.setting('runtime_thermostat_summary_group_by') !== 'day'
) {
beestat.setting({
'runtime_thermostat_summary_time_count': 3,
'runtime_thermostat_summary_time_period': 'month',
'runtime_thermostat_summary_group_by': 'day'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Past 12 Months')
.set_icon('calendar_range')
.set_callback(function() {
if (
beestat.setting('runtime_thermostat_summary_time_count') !== 12 ||
beestat.setting('runtime_thermostat_summary_time_period') !== 'month' ||
beestat.setting('runtime_thermostat_summary_group_by') !== 'week'
) {
beestat.setting({
'runtime_thermostat_summary_time_count': 12,
'runtime_thermostat_summary_time_period': 'month',
'runtime_thermostat_summary_group_by': 'week'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('All Time')
.set_icon('calendar_range')
.set_callback(function() {
if (
beestat.setting('runtime_thermostat_summary_time_count') !== 0 ||
beestat.setting('runtime_thermostat_summary_time_period') !== 'all' ||
beestat.setting('runtime_thermostat_summary_group_by') !== 'month'
) {
beestat.setting({
'runtime_thermostat_summary_time_count': 0,
'runtime_thermostat_summary_time_period': 'all',
'runtime_thermostat_summary_group_by': 'month'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Custom')
.set_icon('calendar_edit')
.set_callback(function() {
(new beestat.component.modal.runtime_thermostat_summary_custom()).render();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Download Chart')
.set_icon('download')
.set_callback(function() {
self.chart_.export();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Reset Zoom')
.set_icon('magnify_minus')
.set_callback(function() {
self.chart_.reset_zoom();
}));
if (beestat.setting('runtime_thermostat_summary_gap_fill') === true) {
if (beestat.thermostat.get_sync_progress(this.thermostat_id_) !== null) {
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Disable Gap-Fill')
.set_icon('basket_unfill')
.set_text('Past 3 Months')
.set_icon('calendar_range')
.set_callback(function() {
beestat.setting('runtime_thermostat_summary_gap_fill', false);
if (
beestat.setting('runtime_thermostat_summary_time_count') !== 3 ||
beestat.setting('runtime_thermostat_summary_time_period') !== 'month' ||
beestat.setting('runtime_thermostat_summary_group_by') !== 'day'
) {
beestat.setting({
'runtime_thermostat_summary_time_count': 3,
'runtime_thermostat_summary_time_period': 'month',
'runtime_thermostat_summary_group_by': 'day'
});
}
}));
} else {
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Enable Gap-Fill')
.set_icon('basket_fill')
.set_text('Past 12 Months')
.set_icon('calendar_range')
.set_callback(function() {
beestat.setting('runtime_thermostat_summary_gap_fill', true);
if (
beestat.setting('runtime_thermostat_summary_time_count') !== 12 ||
beestat.setting('runtime_thermostat_summary_time_period') !== 'month' ||
beestat.setting('runtime_thermostat_summary_group_by') !== 'week'
) {
beestat.setting({
'runtime_thermostat_summary_time_count': 12,
'runtime_thermostat_summary_time_period': 'month',
'runtime_thermostat_summary_group_by': 'week'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('All Time')
.set_icon('calendar_range')
.set_callback(function() {
if (
beestat.setting('runtime_thermostat_summary_time_count') !== 0 ||
beestat.setting('runtime_thermostat_summary_time_period') !== 'all' ||
beestat.setting('runtime_thermostat_summary_group_by') !== 'month'
) {
beestat.setting({
'runtime_thermostat_summary_time_count': 0,
'runtime_thermostat_summary_time_period': 'all',
'runtime_thermostat_summary_group_by': 'month'
});
}
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Custom')
.set_icon('calendar_edit')
.set_callback(function() {
(new beestat.component.modal.runtime_thermostat_summary_custom()).render();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Download Chart')
.set_icon('download')
.set_callback(function() {
self.chart_.export();
}));
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Reset Zoom')
.set_icon('magnify_minus')
.set_callback(function() {
self.chart_.reset_zoom();
}));
if (beestat.setting('runtime_thermostat_summary_gap_fill') === true) {
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Disable Gap-Fill')
.set_icon('basket_unfill')
.set_callback(function() {
beestat.setting('runtime_thermostat_summary_gap_fill', false);
}));
} else {
menu.add_menu_item(new beestat.component.menu_item()
.set_text('Enable Gap-Fill')
.set_icon('basket_fill')
.set_callback(function() {
beestat.setting('runtime_thermostat_summary_gap_fill', true);
}));
}
}
menu.add_menu_item(new beestat.component.menu_item()