diff --git a/package.json b/package.json index 046ce7c..a1ec340 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "express": "^4.17.1", "express-http-proxy": "^1.6.2", "faker": "^4.1.0", + "hjson": "^3.2.1", "knex": "^0.21.2", "simplex-noise": "^2.4.0", "sqlite3": "^5.0.0", diff --git a/src/components/ChartView.vue b/src/components/ChartView.vue index 6c9fbdb..ca7df20 100644 --- a/src/components/ChartView.vue +++ b/src/components/ChartView.vue @@ -1,13 +1,6 @@ diff --git a/src/components/ViewComponent.vue b/src/components/ViewComponent.vue new file mode 100644 index 0000000..a4c2f15 --- /dev/null +++ b/src/components/ViewComponent.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/default.js b/src/default.js new file mode 100644 index 0000000..df591fb --- /dev/null +++ b/src/default.js @@ -0,0 +1,50 @@ +export default [ + { + type: 'table', + columns: [ + 'id', + 'app', + 'timestamp' + ] + }, + { + type: 'table', + columns: [ 'data' ] + }, + { + type: 'chart', + x: 'timestamp', + y: [ + { + label: 'foo', + field: 'data/num2', + color: '#ff000055', + fill: '#0000' + }, + { + label: 'bar', + field: 'data/num3', + color: '#00ff00', + fill: '#0000' + } + ] + }, + { + type: 'table', + columns: [ + 'id', + 'app', + 'message' + ] + }, + { + type: 'table', + columns: [ + 'id', + 'app', + 'message', + 'data', + 'timestamp' + ] + } +]; diff --git a/src/helper.js b/src/helper.js new file mode 100644 index 0000000..d3837dd --- /dev/null +++ b/src/helper.js @@ -0,0 +1,7 @@ +export function resolve_data (set, index) { + const keys = typeof index === 'string' ? index.split ('/') : index; + const data = set[keys[0]]; + if (keys.length === 1) + return data; + return resolve_data (data, keys.slice (1)); +} diff --git a/src/views/AppView.vue b/src/views/AppView.vue index f7c6419..0fb3874 100644 --- a/src/views/AppView.vue +++ b/src/views/AppView.vue @@ -2,45 +2,36 @@
- - - + - -