pug update to match data

This commit is contained in:
2026-03-01 10:10:41 +10:00
parent f17768bb8e
commit e64b644b33
5 changed files with 70 additions and 327 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
**node_modules
**to_reform
.vscode
current_site/dist

View File

@@ -81,226 +81,3 @@ block variables
{ id: 'val_humidity', value: 'Humidity', label: 'Average Humidity', checked: false },
{ id: 'val_battery', value: 'BatteryLevel', label: 'Average BatteryLevel', checked: false }
]
var sensorData = [
{
sensorId: 'TEMP-001',
location: 'Balcony',
timestamp: '2025-10-03T03:41:50Z',
temperature: 19.4,
tempDifference: -0.2,
sensorType: 'Bmp220',
batteryLevel: 95,
humidity: 38.1,
lastCalibrationDate: '2025-07-26'
},
{
sensorId: 'TEMP-003',
location: 'Bedroom',
timestamp: '2025-10-03T03:42:46Z',
temperature: 18.2,
tempDifference: -0.1,
sensorType: 'Xiaomi',
batteryLevel: 75,
humidity: 45.5,
lastCalibrationDate: '2025-07-21'
},
{
sensorId: 'TEMP-004',
location: 'Balcony',
timestamp: '2025-10-03T03:43:48Z',
temperature: 24.1,
tempDifference: 0.1,
sensorType: 'Xiaomi',
batteryLevel: 72,
humidity: 50.5,
lastCalibrationDate: '2025-08-30'
},
{
sensorId: 'TEMP-001',
location: 'Balcony',
timestamp: '2025-10-03T03:44:34Z',
temperature: 19.1,
tempDifference: -0.3,
sensorType: 'Bmp220',
batteryLevel: 95,
humidity: 56.5,
lastCalibrationDate: '2025-07-26'
},
{
sensorId: 'TEMP-006',
location: 'Kitchen',
timestamp: '2025-10-03T03:45:46Z',
temperature: 22.8,
tempDifference: 0.0,
sensorType: 'Scd30(Internal)',
batteryLevel: 80,
humidity: 41.4,
lastCalibrationDate: '2025-09-10'
},
{
sensorId: 'TEMP-010',
location: 'Balcony',
timestamp: '2025-10-03T03:46:18Z',
temperature: 21.7,
tempDifference: 0.5,
sensorType: 'Scd30(Internal)',
batteryLevel: 79,
humidity: 59.8,
lastCalibrationDate: '2025-08-07'
},
{
sensorId: 'TEMP-006',
location: 'Balcony',
timestamp: '2025-10-03T03:47:05Z',
temperature: 22.7,
tempDifference: -0.1,
sensorType: 'Scd30(Internal)',
batteryLevel: 80,
humidity: 36.1,
lastCalibrationDate: '2025-09-10'
},
{
sensorId: 'TEMP-006',
location: 'Bedroom',
timestamp: '2025-10-03T03:48:13Z',
temperature: 22.9,
tempDifference: 0.2,
sensorType: 'Scd30(Internal)',
batteryLevel: 80,
humidity: 56.1,
lastCalibrationDate: '2025-09-10'
},
{
sensorId: 'TEMP-005',
location: 'Living Room',
timestamp: '2025-10-03T03:49:03Z',
temperature: 24.4,
tempDifference: 0.4,
sensorType: 'Bmp180',
batteryLevel: 91,
humidity: 30.1,
lastCalibrationDate: '2025-08-07'
},
{
sensorId: 'TEMP-001',
location: 'Kitchen',
timestamp: '2025-10-03T03:50:24Z',
temperature: 19.1,
tempDifference: 0.0,
sensorType: 'Bmp220',
batteryLevel: 95,
humidity: 64.8,
lastCalibrationDate: '2025-07-26'
},
{
sensorId: 'TEMP-008',
location: 'Living Room',
timestamp: '2025-10-03T03:51:12Z',
temperature: 21.9,
tempDifference: -0.1,
sensorType: 'Scd30(Internal)',
batteryLevel: 92,
humidity: 36.0,
lastCalibrationDate: '2025-08-02'
},
{
sensorId: 'TEMP-009',
location: 'Balcony',
timestamp: '2025-10-03T03:51:46Z',
temperature: 22.3,
tempDifference: 0.0,
sensorType: 'Xiaomi',
batteryLevel: 76,
humidity: 74.0,
lastCalibrationDate: '2025-09-17'
},
{
sensorId: 'TEMP-003',
location: 'Kitchen',
timestamp: '2025-10-03T03:52:23Z',
temperature: 18.4,
tempDifference: 0.2,
sensorType: 'Xiaomi',
batteryLevel: 75,
humidity: 45.2,
lastCalibrationDate: '2025-07-21'
},
{
sensorId: 'TEMP-010',
location: 'Living Room',
timestamp: '2025-10-03T03:53:44Z',
temperature: 21.8,
tempDifference: 0.1,
sensorType: 'Scd30(Internal)',
batteryLevel: 79,
humidity: 36.3,
lastCalibrationDate: '2025-08-07'
},
{
sensorId: 'TEMP-001',
location: 'Kitchen',
timestamp: '2025-10-03T03:54:46Z',
temperature: 18.7,
tempDifference: -0.4,
sensorType: 'Bmp220',
batteryLevel: 95,
humidity: 44.3,
lastCalibrationDate: '2025-07-26'
},
{
sensorId: 'TEMP-006',
location: 'Bedroom',
timestamp: '2025-10-03T03:55:24Z',
temperature: 23.3,
tempDifference: 0.4,
sensorType: 'Scd30(Internal)',
batteryLevel: 80,
humidity: 55.9,
lastCalibrationDate: '2025-09-10'
},
{
sensorId: 'TEMP-002',
location: 'Kitchen',
timestamp: '2025-10-03T03:55:57Z',
temperature: 17.7,
tempDifference: -0.5,
sensorType: 'Scd30(Internal)',
batteryLevel: 93,
humidity: 70.2,
lastCalibrationDate: '2025-08-30'
},
{
sensorId: 'TEMP-002',
location: 'Balcony',
timestamp: '2025-10-03T03:57:05Z',
temperature: 17.4,
tempDifference: -0.3,
sensorType: 'Scd30(Internal)',
batteryLevel: 93,
humidity: 66.7,
lastCalibrationDate: '2025-08-30'
},
{
sensorId: 'TEMP-009',
location: 'Living Room',
timestamp: '2025-10-03T03:58:28Z',
temperature: 22.6,
tempDifference: 0.3,
sensorType: 'Xiaomi',
batteryLevel: 76,
humidity: 56.4,
lastCalibrationDate: '2025-09-17'
},
{
sensorId: 'TEMP-004',
location: 'Bedroom',
timestamp: '2025-10-03T03:59:51Z',
temperature: 24.3,
tempDifference: 0.2,
sensorType: 'Xiaomi',
batteryLevel: 72,
humidity: 47.3,
lastCalibrationDate: '2025-08-30'
}
];

View File

@@ -28,97 +28,51 @@ mixin filtersMixin()
details.filters
summary.filters__summary Filters
form.filters__form
fieldset.filters__fieldset
.filter-group
i.filter-group__label
b Location
br
.filter-group__items
each filter in locationFilters
input.filter-group__checkbox(type="checkbox" id=filter.id name="location" value=filter.value)
span #{filter.label}
br
.filter-group
i.filter-group__label
b Sensor Type
br
.filter-group__items
each filter in sensorTypeFilters
input.filter-group__checkbox(type="checkbox" id=filter.id name="sensor_type" value=filter.value)
span #{filter.label}
br
.filter-group
i.filter-group__label
b Numeric Values
br
.filter-group__range
span Temperature from:
input.filter-group__input(type="number" name="temp_min" placeholder="20")
span to:
input.filter-group__input(type="number" name="temp_max" placeholder="30")
br
span Humidity from:
input.filter-group__input(type="number" name="humidity_min" placeholder="40")
span to:
input.filter-group__input(type="number" name="humidity_max" placeholder="60")
br
.filter-group
i.filter-group__label
b Device Specific Filters
br
.filter-group__items
span Sensor Name:
input.filter-group__input(type="text" name="sensor_name")
br
span Days Since Calibration (max):
input.filter-group__input(type="number" name="calibration_days" placeholder="30")
br
.filter-group
i.filter-group__label
b Measurement Period
br
.filter-group__dates
span From:
input.filter-group__input(type="date" name="date_from")
br
span To:
input.filter-group__input(type="date" name="date_to")
br
.filter-group__buttons
input.filter-group__button.filter-group__button--submit(type="submit" value="Apply Filters")
input.filter-group__button.filter-group__button--reset(type="reset" value="Reset Filters")
p
label(for='type') Type:
select(id ='type')
p
label(for='name') Name:
input(type='text' id='name')
p
label(for='manufacturer') Manufacturer name:
input(type='text' id='manufacturer')
p
label(for='sizeFrom') Size:
| from
input(type='number' id='sizeFrom')
| to
input(type='number' id='sizeTo')
p
label(for='releaseDateFrom') Release Date:
| from
input(type='number' id='releaseDateFrom')
| to
input(type='number' id='releaseDateTo')
p
label(for='priceFrom') Release Date:
| from
input(type='number' id='priceFrom')
| to
input(type='number' id='priceTo')
input.filter-group__button--apply(type='button' id='applyFiltersButton' value="Apply Filters")
input.filter-group__button--reset(type='button' id='resetFiltersButton' value="Reset Filters")
mixin sortLevel(level)
.sort-level
i.sort-level__label
b Sort Level #{level}
br
label.sort-level__field-label(for=`sort${level}`) Field:
select.sort-level__select(id=`sort${level}` name=`sort${level}`)
each option in sortOptions
option(value=option.value) #{option.label}
label.sort-level__reverse-label(for=`sort${level}_reverse`)
input.sort-level__checkbox(type="checkbox" id=`sort${level}_reverse` name=`sort${level}_reverse`)
span Reverse
br
if level === '3'
input.sort-level__submit(type="submit" value="Sort")
else
br
p
select.sort-level__select(id=`sort_${level}`)
| ascending?
input(type="checkbox", id=`sort_reverse_${level}`)
mixin sortingMixin()
- const sortLevels = ['1', '2', '3'];
details.sorting
summary.sorting__summary Sortings
summary.sorting__summary Sort
form.sorting__form
fieldset.sorting__fieldset
each level in sortLevels
+sortLevel(level)
input.sort-group__button--apply(type='button' id='applySortButton' value="Apply Sort")
input.sort-group__button--reset(type='button' id='resetSortButton' value="Reset Sort")
mixin graphXOption(option)
if option.checked

View File

@@ -1,8 +1,12 @@
include ../components/mixins.pug
include ../components/data.pug
head
title table
script(src='./table/data.js')
script(src='./table/filter.js')
script(src='./table/main.js')
script(src='./table/sort.js')
script(src='./table/table.js')
body
+navbarMixin("Table")
@@ -13,13 +17,3 @@ body
+graphMixin()
table.table
tbody.table-content
each dataItem,index in sensorData
if index == 0
tr.table-content__table-header
each value,header in dataItem
th #{header}
tr.table-content__table-row
each value,header in dataItem
td #{value}

View File

@@ -59,11 +59,28 @@ module.exports = {
onStart: {
delete: ["dist"],
},
onEnd: {
copy: [
{
source: path.join(__dirname, "src", "pages", "table", "*.js"),
destination: path.join(__dirname, "dist", "table"),
},
],
},
},
}),
],
devServer: {
watchFiles: path.join(__dirname, "src"),
port: 9000,
static: [
{
directory: path.join(__dirname, "dist"),
},
{
directory: path.join(__dirname, "src", "pages"),
publicPath: "/",
},
],
},
};