-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
934 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<template> | ||
<section v-if="scales && scales.length > 0"> | ||
<h3>Units of measurement</h3> | ||
<div class="scalegrid"> | ||
<div v-for="item in scales" :key="item.label"> | ||
<template v-if="item?.zones && (item.name || item.label)"> | ||
<p> | ||
<b v-if="item.name">{{ | ||
locale === "en" ? item.name.en : item.name.ru | ||
}}</b> | ||
<b v-else>{{ item.label }}</b> | ||
({{ item.unit }}) | ||
</p> | ||
<template v-for="zone in item.zones" :key="zone.color"> | ||
<div | ||
class="scales-color" | ||
v-if="zone.color && zone.label" | ||
:style="`--color: ${zone.color}`" | ||
> | ||
<b>{{ locale === "en" ? zone.label.en : zone.label.ru }}</b> | ||
(<template v-if="zone.value">up to {{ zone.value }}</template> | ||
<template v-else>above</template>) | ||
</div> | ||
</template> | ||
</template> | ||
</div> | ||
</div> | ||
</section> | ||
</template> | ||
|
||
<script> | ||
import measurements from "./measurements"; | ||
export default { | ||
props: ["log"], | ||
setup(props) { | ||
const scales = []; | ||
let units = []; | ||
for (const item of props.log) { | ||
for (const unit of item.data) { | ||
if (units.indexOf(unit.fullKey) === -1) { | ||
units.push(unit.fullKey); | ||
if (measurements[unit.fullKey]) { | ||
scales.push(measurements[unit.fullKey]); | ||
} | ||
} | ||
} | ||
} | ||
return { | ||
locale: "en", | ||
scales | ||
}; | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
/* + scales */ | ||
.scalegrid { | ||
display: grid; | ||
grid-template-columns: repeat(3, 1fr); | ||
gap: var(--gap); | ||
font-size: 0.8em; | ||
} | ||
.scalegrid p { | ||
margin-bottom: calc(var(--gap) * 0.5); | ||
} | ||
.scales-color { | ||
position: relative; | ||
padding-left: calc(var(--gap) * 2); | ||
} | ||
.scales-color:before { | ||
content: ""; | ||
display: block; | ||
position: absolute; | ||
background-color: var(--color); | ||
top: 0; | ||
left: 0; | ||
bottom: 0; | ||
width: var(--gap); | ||
} | ||
/* - scales */ | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<div class="textsmall"> | ||
This information holds no legal validity and is intended solely for personal | ||
use. | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.textsmall { | ||
font-size: 0.8em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template> | ||
<section> | ||
<h3>Advanced information</h3> | ||
<div class="infoline flexline"> | ||
<div class="infoline-title">Sensor id:</div> | ||
<div class="infoline-info"> | ||
{{ sensor_id }} | ||
</div> | ||
</div> | ||
</section> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["sensor_id"] | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
:root { | ||
--gap: 10px; | ||
} | ||
.flexline { | ||
display: flex; | ||
gap: calc(var(--gap) * 2); | ||
align-items: center; | ||
} | ||
.flexline .flexline { | ||
gap: var(--gap); | ||
} | ||
.infoline.flexline { | ||
gap: calc(var(--gap) * 0.5); | ||
} | ||
.infoline-title { | ||
font-weight: bold; | ||
} | ||
.infoline-info { | ||
font-size: 0.9rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export default { | ||
label: "PM2.5", // ! Обязательное поле. Название | ||
// Необязательное поле, для некоторых значений хочется более человеческого описания + локализация | ||
name: { | ||
en: "Humidity", | ||
ru: "Влажность" | ||
}, | ||
unit: "μg/m3", // ! Обязательное поле. Единица измерения | ||
chartColor: "#89b268", // Цвет на графике | ||
range: [0, 50, 90], // диапазон значений для отображения цвета | ||
colors: ["#60bc2a", "#ff9d00", "#fc0202"], // диапозон цвета в зависимости от значения для отрисовки маркера на карте | ||
// зоны для графика, value - высшее значение, color - цвет на графике, label [en/ru] - локализованная подпись короткая | ||
zones: [ | ||
{ | ||
value: 50, | ||
color: "#60bc2a", | ||
label: { | ||
en: "Good", | ||
ru: "Хорошо" | ||
} | ||
} | ||
], | ||
calculate: function (v) { | ||
// преобразование значения, например для приведения к нужной единице измерения, только для реалтайм | ||
return Number(v) * 2; | ||
}, | ||
info: "", // Описание | на данный момент не используется | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
label: "Airtemp", | ||
unit: "℃", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
label: "AvgAirtemp", | ||
unit: "℃", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
label: "MaxAirtemp", | ||
unit: "℃", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
label: "MinAirtemp", | ||
unit: "℃", | ||
}; |
Oops, something went wrong.