diff --git a/ui/src/assets/css/main.css b/ui/src/assets/css/main.css index f242969..eb3a8c7 100644 --- a/ui/src/assets/css/main.css +++ b/ui/src/assets/css/main.css @@ -20,10 +20,6 @@ hr { background-color: rgba(255, 255, 255, 0.2); } -.huge { - font-size: 32px; -} - #sidebar { background-color: #222; background-size: cover; diff --git a/ui/src/assets/images/loader.gif b/ui/src/assets/images/loader.gif new file mode 100644 index 0000000..1b4b838 Binary files /dev/null and b/ui/src/assets/images/loader.gif differ diff --git a/ui/src/components/Science.vue b/ui/src/components/Science.vue index 64af7c9..aeb8a7a 100644 --- a/ui/src/components/Science.vue +++ b/ui/src/components/Science.vue @@ -14,6 +14,7 @@
+
@@ -30,7 +31,6 @@ import { Datetime } from 'vue-datetime' import moment from 'moment'; - const FROM_DEFAULT = moment().add('-24', 'hours').toISOString(); const TO_DEFAULT = moment().toISOString(); @@ -42,6 +42,8 @@ export default { to: TO_DEFAULT, lastFrom: FROM_DEFAULT, lastTo: TO_DEFAULT, + graphIsLoading: true, + loaderUrl: require('../assets/images/loader.gif'), } }, components: { @@ -50,6 +52,8 @@ export default { mounted() { this.loadGraphImage(); this.updateDownloadUrl(); + + this.$refs.graph.onload = () => this.graphIsLoading = false; }, methods: { rangeUpdated() { @@ -75,6 +79,8 @@ export default { let root = this.$http.options.root; let binSize = 1; + this.$refs.graph.src = ''; + this.graphIsLoading = true; let imageUrl = `${root}histogram.png?from=${from}&to=${to}&bin_size=${binSize}`; this.$refs.graph.src = imageUrl; }, diff --git a/ui/src/components/dashboard/Dashboard.vue b/ui/src/components/dashboard/Dashboard.vue index 8e538fc..0c0ebf3 100644 --- a/ui/src/components/dashboard/Dashboard.vue +++ b/ui/src/components/dashboard/Dashboard.vue @@ -1,19 +1,35 @@ + + diff --git a/ui/src/components/dashboard/Location.vue b/ui/src/components/dashboard/Location.vue new file mode 100644 index 0000000..0817fe8 --- /dev/null +++ b/ui/src/components/dashboard/Location.vue @@ -0,0 +1,38 @@ + + + + + + diff --git a/ui/src/components/dashboard/TimeSeries.vue b/ui/src/components/dashboard/TimeSeries.vue index 7882fb4..7cf9e30 100644 --- a/ui/src/components/dashboard/TimeSeries.vue +++ b/ui/src/components/dashboard/TimeSeries.vue @@ -1,12 +1,10 @@ @@ -69,4 +67,10 @@ export default { */ }, } - \ No newline at end of file + + + diff --git a/ui/src/components/dashboard/Value.vue b/ui/src/components/dashboard/Value.vue index fbf3aec..6d13d16 100644 --- a/ui/src/components/dashboard/Value.vue +++ b/ui/src/components/dashboard/Value.vue @@ -1,19 +1,17 @@ \ No newline at end of file diff --git a/ui/src/store.js b/ui/src/store.js index de68c31..ad48410 100644 --- a/ui/src/store.js +++ b/ui/src/store.js @@ -3,7 +3,7 @@ import Vuex from 'vuex'; import moment from 'moment'; -const SERIES_MAX_SIZE = 30; +const SERIES_MAX_SIZE = 100; Vue.use(Vuex); @@ -32,6 +32,15 @@ const getters = { } return 'NA'; }, + getNumberOfEvents: (state) => () => { + return state.series.length; + }, + getPeriod: (state) => () => { + if (state.series.length > 1) { + return state.series[state.series.length - 1].UTCUnixTime - state.series[0].UTCUnixTime; + } + return 0; + }, isLogged: (state) => () => { return (state.token !== null); }, @@ -52,7 +61,11 @@ const getters = { const actions = { requestSeries({ commit }) { - Vue.http.get('series?format=json').then(response => { + let params = { + format: 'json', + limit: SERIES_MAX_SIZE, + }; + Vue.http.get('series', { params }).then(response => { commit('setSeries', response.body); }); }, @@ -71,7 +84,15 @@ const actions = { const mutations = { setSeries(state, data) { - state.series.push(...data); + data.sort((l, r) => l.UTCUnixTime + l.SubSeconds > r.UTCUnixTime + r.SubSeconds ? 1 : -1); + for (let item of data) { + let last = state.series[state.series.length - 1]; + let lastUTCUnixTime = last ? last.UTCUnixTime : 0; + let lastSubSeconds = last ? last.SubSeconds : 0; + if (item.UTCUnixTime + item.SubSeconds >= lastUTCUnixTime + lastSubSeconds) { + state.series.push(item); + } + } state.series = state.series.slice(-SERIES_MAX_SIZE); }, setAuth(state, token) { diff --git a/ui/webpack.config.js b/ui/webpack.config.js index 843fc31..6e50f34 100644 --- a/ui/webpack.config.js +++ b/ui/webpack.config.js @@ -19,12 +19,19 @@ module.exports = { exclude: /node_modules/ }, { - test: /\.(png|jpg|gif|svg)$/, + test: /\.(png|jpg|svg)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } }, + { + test: /\.gif$/, + loader: 'file-loader', + options: { + name: '[name].[ext]' + } + }, { test: /\.css$/, loader: 'style-loader!css-loader'