From a6b80b997f40a34559ee21bc761d3598a736e94e Mon Sep 17 00:00:00 2001 From: Jeff Wang Date: Thu, 8 Mar 2018 11:46:32 -0800 Subject: [PATCH] Migrate from san to vue (#281) * Initial checking to setup Vue basic requirements. (#264) Add App.vue Add AppMenu.vue * Vue with app menu (#265) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add major components (#266) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add Scalars, Images, Histograms, Graph. * Switch to use the stylus language for CSS * Port functions from Scalars.san to Scalars.vue * Add config vue (#267) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add Config Vue * Integrate chart to scalar with Vue (#268) * Fix warnings from Vue compiler * use default prop instead of duplicate data and prop * use function instead of shorthand declaration with data * refract naming style, fix scalar options * Fix config UI * Add chart and chart page and integrate to scalar * update with varun and jeff's comments * Add images config (#270) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add the Config.vue for Images * Add the CharPage.vue and Image.vue * Hook up the config to the image.vue so that the image height and width can update * Show Scalar Data and add ExpandPanel (#272) * Watch tagInfo changes to update chart and fix tooltip issue * Add expand panel and maintain isShow state in the panel * Add Expand Panel in Image * Add watch group name reg (#273) * Add vuetify framework Update AppMenu.vue to include the basic menu item. * use name as key. * Add Watch on the groupNameReg * Allow the nav bar to persist the selected item style. (#274) * Fix the incorrect pagination issue. (#276) * Add the Graph.vue and the Config.vue for Graph tab (#277) * Add the Histogram related vue files. (#278) * Fix error message on charts (#279) * Make sure to clear the chart before each use. * Add key for v-for loop. * Add theme and fix UI (#280) -Apply theme color in Vuetify -Add main.styl to override Vuetify default stylus variables -Add relative path in web pack config to find variables.styl * Fix multiple scalar issues: (#283) * Fix multiple scalar issues: -download link / outliers should take boolean value instead of array -download link now show proper selector of runsItem and download button -Use tag as key to prevent chart re-rendering -Add missing label in scalar config and fix UI * simply use index for key because scalar has different tag info structure from image and histogram * Fix font size and reorganize css and stylus (#287) * Fix comments * placeholder index.js * Fix issue where download data link points to empty run (#294) -Dropdown should only display non empty runs -Select first run by default -Remove drop down if all are empty runs -Refract download type to runItemForDownload -Add train run and multiple tags in mock data * Fix error when scalar data empty (#298) -Error comes in when trying to access elements inside empty data -When one of the runs has empty data, the chart will display nothing even other run has non empty data -Fix by checking length of data before accessing --- frontend/mock/data/plugin/histograms/tags.js | 28 +- frontend/mock/data/plugin/scalars/tags.js | 14 + frontend/package.json | 9 +- frontend/src/App.vue | 75 +++ frontend/src/common/component/AppMenu.vue | 85 +++ frontend/src/common/component/ExpandPanel.vue | 65 ++ .../common/component/Notification/index.js | 10 +- frontend/src/graph/Graph.vue | 60 ++ frontend/src/graph/ui/Chart.vue | 189 ++++++ frontend/src/graph/ui/Config.vue | 57 ++ frontend/src/histogram/Histogram.vue | 158 +++++ frontend/src/histogram/ui/Chart.vue | 525 ++++++++++++++++ frontend/src/histogram/ui/ChartPage.vue | 88 +++ frontend/src/histogram/ui/Config.vue | 71 +++ frontend/src/images/Images.vue | 168 +++++ frontend/src/images/ui/ChartPage.vue | 89 +++ frontend/src/images/ui/Config.vue | 62 ++ frontend/src/images/ui/Image.vue | 158 +++++ frontend/src/index.js | 56 +- frontend/src/router/index.js | 34 + frontend/src/scalars/Scalars.vue | 161 +++++ frontend/src/scalars/ui/Chart.vue | 591 ++++++++++++++++++ frontend/src/scalars/ui/ChartPage.vue | 85 +++ frontend/src/scalars/ui/Config.vue | 130 ++++ frontend/src/style/main.styl | 11 + frontend/src/style/variables.styl | 4 +- frontend/template/index.html | 1 + frontend/tool/webpack.config.js | 17 +- 28 files changed, 2960 insertions(+), 41 deletions(-) create mode 100644 frontend/src/App.vue create mode 100644 frontend/src/common/component/AppMenu.vue create mode 100644 frontend/src/common/component/ExpandPanel.vue create mode 100644 frontend/src/graph/Graph.vue create mode 100644 frontend/src/graph/ui/Chart.vue create mode 100644 frontend/src/graph/ui/Config.vue create mode 100644 frontend/src/histogram/Histogram.vue create mode 100644 frontend/src/histogram/ui/Chart.vue create mode 100644 frontend/src/histogram/ui/ChartPage.vue create mode 100644 frontend/src/histogram/ui/Config.vue create mode 100644 frontend/src/images/Images.vue create mode 100644 frontend/src/images/ui/ChartPage.vue create mode 100644 frontend/src/images/ui/Config.vue create mode 100644 frontend/src/images/ui/Image.vue create mode 100644 frontend/src/router/index.js create mode 100644 frontend/src/scalars/Scalars.vue create mode 100644 frontend/src/scalars/ui/Chart.vue create mode 100644 frontend/src/scalars/ui/ChartPage.vue create mode 100644 frontend/src/scalars/ui/Config.vue create mode 100644 frontend/src/style/main.styl diff --git a/frontend/mock/data/plugin/histograms/tags.js b/frontend/mock/data/plugin/histograms/tags.js index 71c747f7..9359f879 100644 --- a/frontend/mock/data/plugin/histograms/tags.js +++ b/frontend/mock/data/plugin/histograms/tags.js @@ -19,15 +19,27 @@ module.exports = function (path, queryParam, postParam) { data: { "test": { "layer1/Wx_plus_b/pre_activations": - { - "displayName": "layer1/Wx_plus_b/pre_activations", - "description": "" - }, + { + "displayName": "layer1/Wx_plus_b/pre_activations", + "description": "" + }, "layer1/Wx_plus_b/pre_activations_1": - { - "displayName": "layer1/Wx_plus_b/pre_activations_1", - "description": "" - } + { + "displayName": "layer1/Wx_plus_b/pre_activations_1", + "description": "" + } + }, + "train": { + "layer1/Wx_plus_b/pre_activations": + { + "displayName": "layer1/Wx_plus_b/pre_activations", + "description": "" + }, + "layer1/Wx_plus_b/pre_activations_1": + { + "displayName": "layer1/Wx_plus_b/pre_activations_1", + "description": "" + } } } } diff --git a/frontend/mock/data/plugin/scalars/tags.js b/frontend/mock/data/plugin/scalars/tags.js index 6cf9b62f..ec8acdeb 100644 --- a/frontend/mock/data/plugin/scalars/tags.js +++ b/frontend/mock/data/plugin/scalars/tags.js @@ -22,6 +22,20 @@ module.exports = function (path, queryParam, postParam) { "displayName": "layer2/biases/summaries/mean", "description": "" } + }, + "train": { + "layer2/biases/summaries/mean": { + "displayName": "layer2/biases/summaries/mean", + "description": "" + }, + "layer2/biases/summaries/accuracy": { + "displayName": "layer2/biases/summaries/accuracy", + "description": "" + }, + "layer2/biases/summaries/cost": { + "displayName": "layer2/biases/summaries/cost", + "description": "" + } } } } diff --git a/frontend/package.json b/frontend/package.json index 92250d37..41cf3259 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,6 +27,9 @@ "san-router": "^1.1.1", "san-store": "^1.0.1", "san-update": "^2.1.0", + "vue": "^2.5.2", + "vue-router": "^3.0.1", + "vuetify": "^0.17.7", "xlsx": "^0.11.3" }, "devDependencies": { @@ -72,6 +75,10 @@ "webpack-dev-server": "^2.4.2", "webpack-hot-middleware": "^2.19.1", "webpack-merge": "^4.1.0", - "yargs": "^8.0.2" + "yargs": "^8.0.2", + "vue-jest": "^1.0.2", + "vue-loader": "^13.3.0", + "vue-style-loader": "^3.0.1", + "vue-template-compiler": "^2.5.2" } } diff --git a/frontend/src/App.vue b/frontend/src/App.vue new file mode 100644 index 00000000..1a0d8600 --- /dev/null +++ b/frontend/src/App.vue @@ -0,0 +1,75 @@ + + + + + + diff --git a/frontend/src/common/component/AppMenu.vue b/frontend/src/common/component/AppMenu.vue new file mode 100644 index 00000000..9cd847be --- /dev/null +++ b/frontend/src/common/component/AppMenu.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/frontend/src/common/component/ExpandPanel.vue b/frontend/src/common/component/ExpandPanel.vue new file mode 100644 index 00000000..322ef3ea --- /dev/null +++ b/frontend/src/common/component/ExpandPanel.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/frontend/src/common/component/Notification/index.js b/frontend/src/common/component/Notification/index.js index 460b76af..71f89fa5 100644 --- a/frontend/src/common/component/Notification/index.js +++ b/frontend/src/common/component/Notification/index.js @@ -1,7 +1,3 @@ -import Notification from './Notification'; -import NotificationItem from './NotificationItem'; - -export { - NotificationItem, - Notification as default -}; +/** + * Created by ludaming on 3/4/18. + */ diff --git a/frontend/src/graph/Graph.vue b/frontend/src/graph/Graph.vue new file mode 100644 index 00000000..0b1a3e12 --- /dev/null +++ b/frontend/src/graph/Graph.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/frontend/src/graph/ui/Chart.vue b/frontend/src/graph/ui/Chart.vue new file mode 100644 index 00000000..b9c911e6 --- /dev/null +++ b/frontend/src/graph/ui/Chart.vue @@ -0,0 +1,189 @@ + + + diff --git a/frontend/src/graph/ui/Config.vue b/frontend/src/graph/ui/Config.vue new file mode 100644 index 00000000..f5ea3ee4 --- /dev/null +++ b/frontend/src/graph/ui/Config.vue @@ -0,0 +1,57 @@ + + + diff --git a/frontend/src/histogram/Histogram.vue b/frontend/src/histogram/Histogram.vue new file mode 100644 index 00000000..6cd5e4fa --- /dev/null +++ b/frontend/src/histogram/Histogram.vue @@ -0,0 +1,158 @@ + + + + + diff --git a/frontend/src/histogram/ui/Chart.vue b/frontend/src/histogram/ui/Chart.vue new file mode 100644 index 00000000..1cfb9282 --- /dev/null +++ b/frontend/src/histogram/ui/Chart.vue @@ -0,0 +1,525 @@ + + + + diff --git a/frontend/src/histogram/ui/ChartPage.vue b/frontend/src/histogram/ui/ChartPage.vue new file mode 100644 index 00000000..d5a5e521 --- /dev/null +++ b/frontend/src/histogram/ui/ChartPage.vue @@ -0,0 +1,88 @@ + + + diff --git a/frontend/src/histogram/ui/Config.vue b/frontend/src/histogram/ui/Config.vue new file mode 100644 index 00000000..9607984a --- /dev/null +++ b/frontend/src/histogram/ui/Config.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/frontend/src/images/Images.vue b/frontend/src/images/Images.vue new file mode 100644 index 00000000..8f484db5 --- /dev/null +++ b/frontend/src/images/Images.vue @@ -0,0 +1,168 @@ + + + + + diff --git a/frontend/src/images/ui/ChartPage.vue b/frontend/src/images/ui/ChartPage.vue new file mode 100644 index 00000000..3116b82f --- /dev/null +++ b/frontend/src/images/ui/ChartPage.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/frontend/src/images/ui/Config.vue b/frontend/src/images/ui/Config.vue new file mode 100644 index 00000000..71137c31 --- /dev/null +++ b/frontend/src/images/ui/Config.vue @@ -0,0 +1,62 @@ + + + diff --git a/frontend/src/images/ui/Image.vue b/frontend/src/images/ui/Image.vue new file mode 100644 index 00000000..04a8e72d --- /dev/null +++ b/frontend/src/images/ui/Image.vue @@ -0,0 +1,158 @@ + + + + diff --git a/frontend/src/index.js b/frontend/src/index.js index 8506d669..af9fa301 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,16 +1,46 @@ -import 'normalize.css/normalize.css'; -import 'san-mui/index.css'; -import './common/component/ui-common.styl'; +//import 'normalize.css/normalize.css'; +//import 'san-mui/index.css'; +//import './common/component/ui-common.styl'; +// +//import './home/index'; +//import './scalars/index'; +//import './images/index'; +//import './histogram/index'; +//import './graph/index'; +// +//import App from './App'; +//new App({ +// data: { +// titleName: 'VisualDL' +// } +//}).attach(document.getElementById('root')); +// +//var vm = new Vue({ +// el: "#root", +// +//}) -import './home/index'; -import './scalars/index'; -import './images/index'; -import './histogram/index'; -import './graph/index'; -import App from './App'; -new App({ - data: { - titleName: 'VisualDL' + +// The Vue build version to load with the `import` command +// (runtime-only or standalone) has been set in webpack.base.conf with an alias. +import Vue from 'vue' +import App from './App' +import Vuetify from 'vuetify' +import router from '@/router' +Vue.config.productionTip = false + +Vue.use(Vuetify, { + theme: { + primary: '#008c99', + accent: '#008c99' } -}).attach(document.getElementById('root')); +}) + +/* eslint-disable no-new */ +new Vue({ + el: '#root', + router, + components: {App}, + template: '', +}) diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js new file mode 100644 index 00000000..6832582f --- /dev/null +++ b/frontend/src/router/index.js @@ -0,0 +1,34 @@ +import Vue from 'vue' +import Router from 'vue-router' + +import Scalars from '@/scalars/Scalars' +import Histogram from '@/histogram/Histogram' +import Images from '@/images/Images' +import Graph from '@/graph/Graph' + +Vue.use(Router) + +export default new Router({ + routes: [ + { + path: '/scalars', + name: 'Scalars', + component: Scalars + }, + { + path: '/histograms', + name: 'Histograms', + component: Histogram + }, + { + path: '/images', + name: 'Images', + component: Images + }, + { + path: '/graphs', + name: 'Graph', + component: Graph + }, + ] +}) diff --git a/frontend/src/scalars/Scalars.vue b/frontend/src/scalars/Scalars.vue new file mode 100644 index 00000000..bfa18c68 --- /dev/null +++ b/frontend/src/scalars/Scalars.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/frontend/src/scalars/ui/Chart.vue b/frontend/src/scalars/ui/Chart.vue new file mode 100644 index 00000000..66a4c508 --- /dev/null +++ b/frontend/src/scalars/ui/Chart.vue @@ -0,0 +1,591 @@ + + + + diff --git a/frontend/src/scalars/ui/ChartPage.vue b/frontend/src/scalars/ui/ChartPage.vue new file mode 100644 index 00000000..af30bb6f --- /dev/null +++ b/frontend/src/scalars/ui/ChartPage.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/frontend/src/scalars/ui/Config.vue b/frontend/src/scalars/ui/Config.vue new file mode 100644 index 00000000..d77143c1 --- /dev/null +++ b/frontend/src/scalars/ui/Config.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/frontend/src/style/main.styl b/frontend/src/style/main.styl new file mode 100644 index 00000000..f8b5da7d --- /dev/null +++ b/frontend/src/style/main.styl @@ -0,0 +1,11 @@ +//stylus variables define before import statement +$input-font-size = 14px + +@import '../../node_modules/vuetify/src/stylus/main' + +//css define after import statement +.input-group.input-group--slider label + font-size $input-font-size + +.input-group__details + min-height 14px \ No newline at end of file diff --git a/frontend/src/style/variables.styl b/frontend/src/style/variables.styl index 91fd99c0..0110766d 100644 --- a/frontend/src/style/variables.styl +++ b/frontend/src/style/variables.styl @@ -8,6 +8,6 @@ $-left-background-color = #303a3a $-content-text-color = #303a3a -$-left-border-clor = #e9e9e9 +$-left-border-color = #e9e9e9 -$-right-font-color = #ccc +$-right-font-color = rgba(#fff, 0.7) diff --git a/frontend/template/index.html b/frontend/template/index.html index e984f5e2..198a8895 100755 --- a/frontend/template/index.html +++ b/frontend/template/index.html @@ -5,6 +5,7 @@ Visual DL +
diff --git a/frontend/tool/webpack.config.js b/frontend/tool/webpack.config.js index a0f7e8b6..1cece3cb 100644 --- a/frontend/tool/webpack.config.js +++ b/frontend/tool/webpack.config.js @@ -46,11 +46,13 @@ const config = { resolve: { alias: { - 'san-mui': 'san-mui/lib', - axios: 'axios/dist/axios.min.js' + axios: 'axios/dist/axios.min.js', + 'vue$': 'vue/dist/vue.esm.js', + '@': path.resolve(projectPath, 'src'), + style: path.resolve(__dirname, '../src/style') }, - extensions: ['.js', '.json', '.styl', '.css', '.html', '.san'] + extensions: ['.js', '.json', '.styl', '.css', '.html', '.vue'] }, module: { @@ -59,13 +61,8 @@ const config = { ], rules: [ { - test: /\.san$/, - loader: 'san-loader', - options: { - loaders: { - stylus: getLoaders(isDev, 'stylus') - } - } + test: /\.vue$/, + loader: 'vue-loader', }, { test: /\.js$/, -- GitLab