From 35ecf344d04f862bab3265b2ec46f8964298f3c6 Mon Sep 17 00:00:00 2001 From: Jeff Wang Date: Fri, 23 Mar 2018 16:48:08 -0700 Subject: [PATCH] Create text ui feature (#337) --- frontend/mock/data/plugin/texts/tags.js | 39 +++++ frontend/mock/data/plugin/texts/texts.js | 38 +++++ frontend/src/common/component/AppMenu.vue | 5 + frontend/src/router/index.js | 6 + frontend/src/service.js | 4 + frontend/src/texts/Texts.vue | 167 ++++++++++++++++++++++ frontend/src/texts/index.js | 9 ++ frontend/src/texts/ui/Chart.vue | 146 +++++++++++++++++++ frontend/src/texts/ui/ChartPage.vue | 78 ++++++++++ frontend/src/texts/ui/Config.vue | 73 ++++++++++ 10 files changed, 565 insertions(+) create mode 100644 frontend/mock/data/plugin/texts/tags.js create mode 100644 frontend/mock/data/plugin/texts/texts.js create mode 100644 frontend/src/texts/Texts.vue create mode 100644 frontend/src/texts/index.js create mode 100644 frontend/src/texts/ui/Chart.vue create mode 100644 frontend/src/texts/ui/ChartPage.vue create mode 100644 frontend/src/texts/ui/Config.vue diff --git a/frontend/mock/data/plugin/texts/tags.js b/frontend/mock/data/plugin/texts/tags.js new file mode 100644 index 000000000..a89f897cc --- /dev/null +++ b/frontend/mock/data/plugin/texts/tags.js @@ -0,0 +1,39 @@ +/** + * get mock data + * + * @param {string} path request path + * @param {Object} queryParam query params + * @param {Object} postParam post params + * @return {Object} + */ +module.exports = function (path, queryParam, postParam) { + return { + // moock delay + _timeout: 0, + // mock http status + _status: 200, + // mock response data + _data: { + status: 0, + msg: 'SUCCESS', + data: { + "test": { + "layer3/generated/animal": { + "displayName": "layer3/generated/animal", + "description": "" + } + }, + "train": { + "layer3/generated/animal": { + "displayName": "layer3/generated/animal", + "description": "" + }, + "layer3/generated/flower": { + "displayName": "layer3/generated/flower", + "description": "" + }, + } + } + } + }; +}; diff --git a/frontend/mock/data/plugin/texts/texts.js b/frontend/mock/data/plugin/texts/texts.js new file mode 100644 index 000000000..80c62985c --- /dev/null +++ b/frontend/mock/data/plugin/texts/texts.js @@ -0,0 +1,38 @@ +/** + * get mock data + * + * @param {string} path request path + * @param {Object} queryParam query params + * @param {Object} postParam post params + * @return {Object} + */ +module.exports = function (path, queryParam, postParam) { + if (queryParam.run === 'train') { + return { + // moock delay + _timeout: 0, + // mock http status + _status: 200, + // mock response data + _data: { + status: 0, + msg: 'SUCCESS', + data: [[1511842145.705075, 1, "Hello 1"], [1511842145.7388, 2, "Hello 2"], [1511842145.774563, 3, "Hello 3"], [1511842145.806828, 4, "Hello 4"], [1511842145.838082, 5, "Hello 5"], [1511842145.868955, 6, "Hello 6"], [1511842145.899323, 7, "Hello 7"], [1511842145.930518, 8, "Hello 8"], [1511842145.96089, 9, "Hello 7"], [1511842146.460557, 11, "Hello 11"], [1511842146.4952, 12, "Hello 12"], [1511842146.525936, 13, "Hello 13"], [1511842146.556059, 14, "Hello 14"], [1511842146.648703, 15, "Hello 15"], [1511842146.683295, 16, "Hello 16"], [1511842146.719782, 17, "Hello 17"], [1511842146.752392, 18, "Hello 18"]] + } + } + } + else { + return { + // moock delay + _timeout: 0, + // mock http status + _status: 200, + // mock response data + _data: { + status: 0, + msg: 'SUCCESS', + data: [[1511842145.514333, 0, "Hello 0"], [1511842146.427384, 10, "Hello 10"], [1511842147.260405, 20, "Hello 20"], [1511842148.019018, 30, "Hello 30 "], [1511842148.793569, 40, "Hello 40 "], [1511842149.610228, 50, "Hello 50 "], [1511842150.437095, 60, "Hello 60"], [1511842151.254679, 70, "Hello 70"], [1511842152.039353, 80, "Hello 80"], [1511842152.800043, 90, "Hello 90"]] + } + } + } +}; diff --git a/frontend/src/common/component/AppMenu.vue b/frontend/src/common/component/AppMenu.vue index 0999df9bd..8041865ca 100644 --- a/frontend/src/common/component/AppMenu.vue +++ b/frontend/src/common/component/AppMenu.vue @@ -41,6 +41,11 @@ export default { url: '/graphs', title: 'GRAPHS', name: 'graphs' + }, + { + url: '/texts', + title: 'TEXTS', + name: 'texts' } ] } diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 6832582f2..353f25cd4 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -5,6 +5,7 @@ import Scalars from '@/scalars/Scalars' import Histogram from '@/histogram/Histogram' import Images from '@/images/Images' import Graph from '@/graph/Graph' +import Texts from '@/texts/Texts' Vue.use(Router) @@ -30,5 +31,10 @@ export default new Router({ name: 'Graph', component: Graph }, + { + path: '/texts', + name: 'Texts', + component: Texts + } ] }) diff --git a/frontend/src/service.js b/frontend/src/service.js index 743936df6..012074d8e 100644 --- a/frontend/src/service.js +++ b/frontend/src/service.js @@ -15,3 +15,7 @@ export const getPluginHistogramsTags = makeService('/data/plugin/histograms/tags export const getPluginHistogramsHistograms = makeService('/data/plugin/histograms/histograms'); export const getPluginGraphsGraph = makeService('/data/plugin/graphs/graph'); + +export const getPluginTextsTags = makeService('/data/plugin/texts/tags'); + +export const getPluginTextsTexts = makeService('/data/plugin/texts/texts'); diff --git a/frontend/src/texts/Texts.vue b/frontend/src/texts/Texts.vue new file mode 100644 index 000000000..9afefc5de --- /dev/null +++ b/frontend/src/texts/Texts.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/frontend/src/texts/index.js b/frontend/src/texts/index.js new file mode 100644 index 000000000..dc142957d --- /dev/null +++ b/frontend/src/texts/index.js @@ -0,0 +1,9 @@ +import {router} from 'san-router'; + +import Texts from './Texts'; + +router.add({ + target: '#content', + rule: '/texts', + Component: Texts +}); diff --git a/frontend/src/texts/ui/Chart.vue b/frontend/src/texts/ui/Chart.vue new file mode 100644 index 000000000..c83e37047 --- /dev/null +++ b/frontend/src/texts/ui/Chart.vue @@ -0,0 +1,146 @@ + + + + + diff --git a/frontend/src/texts/ui/ChartPage.vue b/frontend/src/texts/ui/ChartPage.vue new file mode 100644 index 000000000..ff82eca5f --- /dev/null +++ b/frontend/src/texts/ui/ChartPage.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/frontend/src/texts/ui/Config.vue b/frontend/src/texts/ui/Config.vue new file mode 100644 index 000000000..c09cbe04f --- /dev/null +++ b/frontend/src/texts/ui/Config.vue @@ -0,0 +1,73 @@ + + + + +