-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Weather Page more useful for Network Monitoring [2/2] #6
Changes from 24 commits
b395282
8876f00
2b08cbb
0467ac3
f562113
c639200
866e728
9756407
5fe0c4f
7564a31
fb14f97
bbd069b
57479b1
3e9b743
82c3699
dc6cf3e
43c74e9
1b16ca7
121c888
4c74d23
cdb7b13
a256442
424ee2e
8b9e07c
42264ed
5397f8e
612e47b
f73b418
6e2fefb
c165029
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,59 +18,59 @@ | |
|
||
<div> | ||
<p class="level-heading heading">Current Values</p> | ||
<nav class="level"> | ||
<nav class="level is-mobile"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Air Temp °C</p> | ||
<p class="title">{{ datums['Weather Air Temperature Value'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Air Temperature Value'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Pressure mbar</p> | ||
<p class="title">{{ datums['Weather Barometric Pressure Value'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Barometric Pressure Value'].data, 'Value') }}</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is a filter, it should be used as a filter, like this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duly noted. VueJS shows that the two syntaxes are equivalent so I didn't think it mattered which was used; but its fixed in the latest commit. |
||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Dewpoint °C</p> | ||
<p class="title">{{ datums['Weather Dew Point Value'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Dew Point Value'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Humidity %</p> | ||
<p class="title">{{ datums['Weather Humidity Value'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Humidity Value'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Wind meters per sec</p> | ||
<p class="title">{{ datums['Weather Wind Speed Value'].data | latestVal }}</p> | ||
<p class="heading">Wind meters/second</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Wind Speed Value'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Wind °E of N</p> | ||
<p class="title">{{ datums['Weather Wind Direction Value'].data | latestVal }}°</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Wind Direction Value'].data, 'Value') }}°</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Brightness mag/arcsec<sup>^</sup>2</p> | ||
<p class="title">{{ datums['Weather Sky Brightness Value'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Sky Brightness Value'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Sky Transparency %</p> | ||
<p class="title">{{ datums['Boltwood Transparency Measure'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Boltwood Transparency Measure'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Sky Temp °C</p> | ||
<p class="title">{{ datums['Boltwood Sky Minus Ambient Temperature'].data | latestVal }}</p> | ||
<p class="title">{{ this.$options.filters.latestResult(datums['Boltwood Sky Minus Ambient Temperature'].data, 'Value') }}</p> | ||
</div> | ||
</div> | ||
</nav> | ||
|
@@ -85,7 +85,8 @@ | |
</h4> | ||
|
||
<figure class="image"> | ||
<Timeline datumid="oktoopen" :suntimes="suntTimes" :timezone="site.tz" datumname="Weather Ok To Open" :cdata="datums['Weather Ok To Open'].data"></Timeline> | ||
<Timeline datumid="oktoopen" :suntimes="suntTimes" :timezone="site.tz" datumname="Weather Ok To Open" :cdata="datums['Weather Ok To Open'].data" | ||
:fdata="datums['Weather Failure Reason'].data"></Timeline> | ||
</figure> | ||
</section> | ||
|
||
|
@@ -96,7 +97,7 @@ | |
<figure class="image"> | ||
<TimeChart datumid="airtemp" datumname="Air Temperature" unit="C" | ||
:cdata="datums['Weather Air Temperature Value'].data" | ||
:limit="limit('Weather Air Temperature Value')"> | ||
:limit="limit('Weather Air Temperature Value')" limit_direction="min"> | ||
</TimeChart> | ||
</figure> | ||
</section> | ||
|
@@ -120,7 +121,7 @@ | |
<figure class="image"> | ||
<TimeChart datumid="transparency" datumname="Boltwood Transparency Measure" unit="%" | ||
:cdata="datums['Boltwood Transparency Measure'].data" | ||
:limit="limit('Boltwood Transparency Measure')"> | ||
:limit="limit('Boltwood Transparency Measure')" limit_direction="min"> | ||
</TimeChart> | ||
</figure> | ||
</section> | ||
|
@@ -151,12 +152,12 @@ | |
|
||
<section class="section section-xsmall"> | ||
<h4 class="is-size-4">Air temperature minus dewpoint | ||
<a class="helptoggle is-pulled-right"><sup><small>?</small></sup></a><span class="help is-pulled-right">Dew Point measured by device telemetry.</span> | ||
<a class="helptoggle is-pulled-right"><sup><small>?</small></sup></a><span class="help is-pulled-right">Absolute value of difference between Dew Point and Air Temperature.</span> | ||
</h4> | ||
<figure class="image"> | ||
<TimeChart datumid="ATminusDP" datumname="Air Temperature minus Dewpoint" unit="C" | ||
:cdata="datumDifference(datums['Weather Air Temperature Value'].data, datums['Weather Dew Point Value'].data)" | ||
:limit="2"> | ||
:cdata="datumDifference(datums['Weather Dew Point Value'].data, datums['Weather Air Temperature Value'].data)" | ||
:limit="2" limit_direction="min"> | ||
</TimeChart> | ||
</figure> | ||
</section> | ||
|
@@ -198,8 +199,6 @@ | |
</figure> | ||
</section> | ||
|
||
|
||
|
||
</div> | ||
</template> | ||
<script> | ||
|
@@ -277,7 +276,7 @@ export default { | |
'Boltwood Transparency Measure': { | ||
data: [], | ||
limit: { | ||
default: null | ||
|
||
} | ||
}, | ||
|
||
|
@@ -297,7 +296,7 @@ export default { | |
'Boltwood Transparency Close Threshold': { | ||
data: [], | ||
limit: { | ||
default: null | ||
|
||
} | ||
} | ||
} | ||
|
@@ -357,7 +356,7 @@ export default { | |
|
||
if (datumName == 'Boltwood Transparency Measure') | ||
{ // this datum has a dynamically changing threshold | ||
let latest_value = this.$options.filters.latestVal(this.datums['Boltwood Transparency Close Threshold'].data); | ||
let latest_value = this.$options.filters.latestResult(this.datums['Boltwood Transparency Close Threshold'].data, 'Value'); | ||
return latest_value; | ||
} | ||
|
||
|
@@ -403,7 +402,7 @@ export default { | |
return suntimes_array; | ||
|
||
|
||
}, // TODO: Rename these to last_sunrise/sunset | ||
}, | ||
sunrise(){ | ||
// get last sunrise | ||
return moment.utc((this.suntTimes.slice(-1)[0].sunrise)); | ||
|
@@ -426,27 +425,26 @@ export default { | |
}, | ||
|
||
filters: { | ||
// TODO: Refactor all of the LATEST filters | ||
latestVal(values){ | ||
if (!values || values.length < 1) return 0; | ||
let val = values[values.length - 1].Value; | ||
return val.toFixed(1); | ||
}, | ||
// needed for string values? | ||
latestMsg(messages) | ||
latestResult(values, property) | ||
{ | ||
if (!messages || messages.length < 1) | ||
/** | ||
* @param values - an array of values to parse, must contain a property name that matches the property parameter | ||
* @param property - the property you wish to extract, either 'Value' or 'ValueString' | ||
*/ | ||
|
||
if (property === 'Value') | ||
{ | ||
return ''; | ||
if (!values || values.length < 1) return 0; | ||
let val = values[values.length - 1][property]; | ||
return val.toFixed(1); | ||
} | ||
|
||
else{ | ||
return messages[messages.length - 1].ValueString; | ||
else if (property === 'ValueString') | ||
{ | ||
if (!values || values.length < 1 ) return ''; | ||
return values[values.length -1][property]; | ||
} | ||
}, | ||
parseMsg(msg) | ||
{ | ||
return ((msg === "None" || msg === "Unknown") ? "Open" : msg); | ||
|
||
}, | ||
|
||
cardinal(val){ | ||
|
@@ -479,7 +477,7 @@ export default { | |
<style lang="scss"> | ||
.help { | ||
display: none; | ||
margin-right: 20px; | ||
margin-right: 0px; | ||
} | ||
.helptoggle:hover + .help { | ||
display: inline; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import 'chartjs-plugin-annotation'; | |
import moment from 'moment'; | ||
export default { | ||
name: 'Timechart', | ||
props: ['cdata', 'datumid', 'datumname', 'unit', 'limit', 'max'], | ||
props: ['cdata', 'datumid', 'datumname', 'unit', 'limit', 'max', 'limit_direction'], | ||
computed: { | ||
chartData(){ | ||
if(!this.cdata) return []; | ||
|
@@ -62,17 +62,26 @@ export default { | |
backgroundColor: '#009ec367', | ||
label: that.datumname, | ||
data: that.chartData, | ||
cubicInterpolationMode: 'monotone' | ||
cubicInterpolationMode: 'monotone', | ||
spanGaps: true | ||
}] | ||
}, | ||
options: { | ||
responsive: true, | ||
annotation:{ | ||
annotations:[{ | ||
label: | ||
{ | ||
enabled: true, | ||
position: 'left', | ||
content: (this.limit_direction === 'min') ? 'minimum' : '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This label is super distracting, I think it would be a lot better as a legend. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't quite think this is supported by the plugin that we use. ChartJS obviously has legends,(https://www.chartjs.org/docs/latest/configuration/legend.html) but I don't see any support for legends in the ChartJS annotation plugin -- the only way I see to mark an annotation is through labels, which is what I'm using now. I can control the location of the label within the plot but thats about it. What I could maybe try doing is only showing the annotation label if you hover over the chart? That could make the chart less busy on first glance but still present the information if needed. |
||
yAdjust: -10, | ||
}, | ||
type: 'line', | ||
mode: 'horizontal', | ||
scaleID: 'y-axis-0', | ||
value: this.limit, | ||
borderColor: 'red' | ||
borderColor: (this.limit_direction === 'min') ? 'green': 'red' | ||
}] | ||
}, | ||
legend: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove is-marginless? The page is much easier to read with a bit of a margin.