diff --git a/src/app.vue b/src/app.vue index 296863d..ac3f948 100644 --- a/src/app.vue +++ b/src/app.vue @@ -1,59 +1,107 @@ @@ -73,11 +124,27 @@ import axios from 'axios' import metric from './metric.vue' export default { - name: 'app', + name: 'App', components: { metric, }, + + data() { + return { + api_key: null, + filter_text: '', + level_filter: 3, + level_filters: [ + { value: 3, text: 'Unknown, OK, Warning, Critical' }, + { value: 0, text: 'OK, Warning, Critical' }, + { value: 1, text: 'Warning, Critical' }, + { value: 2, text: 'Critical' }, + ], + metrics: [], + show_filters: false, + } + }, computed: { dash_id() { return window.location.pathname.substr(1) @@ -118,20 +185,12 @@ export default { }, }, - data() { - return { - api_key: null, - filter_text: '', - level_filter: 3, - level_filters: [ - { value: 3, text: 'Unknown, OK, Warning, Critical' }, - { value: 0, text: 'OK, Warning, Critical' }, - { value: 1, text: 'Warning, Critical' }, - { value: 2, text: 'Critical' }, - ], - metrics: [], - show_filters: false, - } + watch: { + }, + + mounted() { + this.updateDashboardData() + window.setInterval(() => this.updateDashboardData(), 10000) }, methods: { @@ -145,13 +204,5 @@ export default { .catch(err => console.error(err)) }, }, - - mounted() { - this.updateDashboardData() - window.setInterval(() => this.updateDashboardData(), 10000) - }, - - watch: { - }, } diff --git a/src/graph.vue b/src/graph.vue index da6cb42..c44e9a1 100644 --- a/src/graph.vue +++ b/src/graph.vue @@ -1,5 +1,8 @@ diff --git a/src/history-bar.vue b/src/history-bar.vue index 8953bb0..56d74be 100644 --- a/src/history-bar.vue +++ b/src/history-bar.vue @@ -1,14 +1,16 @@ @@ -16,8 +18,13 @@ import moment from 'moment' export default { - name: 'history-bar', - props: ['metric'], + name: 'HistoryBar', + props: { + metric: { + required: true, + type: Object, + }, + }, methods: { moment, diff --git a/src/main.js b/src/main.js index f1b89fa..1597aa7 100644 --- a/src/main.js +++ b/src/main.js @@ -11,7 +11,7 @@ import 'chartist/dist/chartist.min.css' Vue.use(BootstrapVue) new Vue({ - components: { app }, el: '#app', + components: { app }, render: c => c('app'), })