Skip to content
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

Merged
merged 30 commits into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b395282
tooltips now work -- meaning you can hover over a section marked clos…
May 18, 2018
8876f00
Small visual changes, preparing to add the status feature to sidebar
May 18, 2018
2b08cbb
Early rough draft of trying to use the existing Store pattern to stor…
May 19, 2018
0467ac3
Still having a bit of trouble with the Vue store, going to try a diff…
May 21, 2018
f562113
The sidebar now properly displays the status of the site. There was a…
May 22, 2018
c639200
Now correctly displays how many sites are open and how many sites are…
May 22, 2018
866e728
Added the 28 day option as suggested
May 22, 2018
9756407
Commenting out some console log statements, added a few TODOs to keep…
May 22, 2018
5fe0c4f
Changed 28 day option to 14 day option, 28 day option takes too long …
May 22, 2018
7564a31
Some more refactoring, removing commented code
May 22, 2018
fb14f97
Removed package_lock.json file that was causing vulernability error o…
May 22, 2018
bbd069b
Removed unused store methods
May 22, 2018
57479b1
Fixed issue where Night icon wasnt showing up in the blue box, was ca…
May 22, 2018
3e9b743
Removed commented code, fixed some method documentation, removed unne…
May 23, 2018
82c3699
Comitting changes from merge conflict, as I'm being instructed to by Git
May 23, 2018
dc6cf3e
Fixed merge conflicts from master, added property to let timelines co…
May 24, 2018
43c74e9
removed node-sass dependency from package.json file, since that packa…
May 24, 2018
1b16ca7
removed commented code that i missed earlier
May 24, 2018
121c888
Fixed issue with hoek dependency -- no longer shows up in dependency …
May 24, 2018
4c74d23
Trying again to fix the security issues, changed the temperature thre…
May 24, 2018
cdb7b13
Committing package_lock.json to fix the security issues
May 24, 2018
a256442
Added is-fluid to container so that it would take up the full space o…
May 24, 2018
424ee2e
looks like the CSS is mostly fixed, overlapping elements are gone, co…
May 25, 2018
8b9e07c
More fiddling with the CSS, trying to see if i can get to switch to v…
May 25, 2018
42264ed
Removed inaccurate comment
May 29, 2018
5397f8e
Removed is-marginless, changed global filter to just be a methods() f…
May 29, 2018
612e47b
Added feature to only show labels if they're clicked on, added proper…
May 30, 2018
f73b418
Added actual threshold value to min/max label, added short text to ex…
May 30, 2018
6e2fefb
Added the min/max legend in the sidepanel, took out the Tip text, add…
May 31, 2018
c165029
Moved legend from sidebar to underneath all plots; removed min/max va…
May 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,449 changes: 2,509 additions & 2,940 deletions client/package-lock.json

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,35 @@
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"bulma": "^0.6.2",
"bulma": "^0.7.1",
"chart.js": "^2.7.1",
"chartjs-plugin-annotation": "^0.5.7",
"moment": "^2.20.1",
"serve-static": "^1.13.1",
"moment": "^2.22.1",
"serve-static": "^1.13.2",
"suncalc": "^1.8.0",
"vue": "^2.5.11",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"weathericons": "^2.1.0"
"weathericons": "^2.1.0",
"node-sass": "^4.9.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"eslint": "^4.15.0",
"eslint-plugin-html": "^4.0.1",
"cross-env": "^5.1.6",
"css-loader": "^0.28.11",
"eslint": "^4.19.0",
"request": "^2.87.0",
"eslint-plugin-html": "^4.0.3",
"file-loader": "^1.1.4",
"node-sass": "^4.5.3",
"hawk": "^7.0.7",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
Expand Down
12 changes: 7 additions & 5 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div id="app">
<section class="section">
<div class="container">
<div class="container is-fluid is-marginless">
Copy link
Contributor

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.

<div class="columns">
<div class="column is-one-quarter">
<div class="column is-one-fifth-desktop is-one-half-tablet">
<div class="fixed">
<WeatherNav/>
</div>
</div>
<div class="column">
<div class="column is-three-fourths-desktop">
<router-view/>
</div>
</div>
Expand All @@ -26,8 +26,10 @@
<style lang="scss">
@media screen and (min-width: 1224px){
.fixed {
position: fixed;
width: 19rem;

width: 95%;
padding-right: 5px;
resize: both
}
}
</style>
6 changes: 4 additions & 2 deletions client/src/components/NavItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div class="navitem">
<div class="columns level mini-info">
<div class="column status is-one-fifth"> {{site_status}} </div>
<div class="column place is-two-thirds">
{{site.name}} {{ site.country }}
</div>
Expand All @@ -19,7 +20,7 @@
import moment from 'moment';
export default {
name: 'NavItem',
props: ['site'],
props: ['site', 'site_status'],
computed: {
mapimg(){
return require(`../assets/maps/${this.site.code}.png`); // eslint-disable-line no-undef
Expand All @@ -39,6 +40,7 @@
display: none;
}
.mini-info {
margin-right: 0rem;
margin-right: 3rem;
padding-right: 3rem;
}
</style>
78 changes: 38 additions & 40 deletions client/src/components/Site.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 &deg;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>
Copy link
Contributor

Choose a reason for hiding this comment

The 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: {{ datums['Weather Barometric Pressure Value'] | latestResult }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 &deg;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 &deg;E of N</p>
<p class="title">{{ datums['Weather Wind Direction Value'].data | latestVal }}&deg;</p>
<p class="title">{{ this.$options.filters.latestResult(datums['Weather Wind Direction Value'].data, 'Value') }}&deg;</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 &deg;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>
Expand All @@ -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>

Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -198,8 +199,6 @@
</figure>
</section>



</div>
</template>
<script>
Expand Down Expand Up @@ -277,7 +276,7 @@ export default {
'Boltwood Transparency Measure': {
data: [],
limit: {
default: null

}
},

Expand All @@ -297,7 +296,7 @@ export default {
'Boltwood Transparency Close Threshold': {
data: [],
limit: {
default: null

}
}
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
Expand All @@ -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){
Expand Down Expand Up @@ -479,7 +477,7 @@ export default {
<style lang="scss">
.help {
display: none;
margin-right: 20px;
margin-right: 0px;
}
.helptoggle:hover + .help {
display: inline;
Expand Down
15 changes: 12 additions & 3 deletions client/src/components/TimeChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
Expand Down Expand Up @@ -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' : '',
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

@raleighlittles raleighlittles May 29, 2018

Choose a reason for hiding this comment

The 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: {
Expand Down
Loading