diff --git a/frontend/mock/data/plugin/images/images.js b/frontend/mock/data/plugin/images/images.js new file mode 100644 index 000000000..98ee5bc95 --- /dev/null +++ b/frontend/mock/data/plugin/images/images.js @@ -0,0 +1,42 @@ +/** + * 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: [ + { + "wall_time": 1512549785.061623, + "step": 60, + "query": + "sample=0&index=0&tag=input_reshape%2Finput%2Fimage%2F0&run=test", + "width": 28, + "height": 28 + }, + {"wall_time": 1512886109.672786, "step": 60, "query": "sample=0&index=1&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886124.266915, "step": 210, "query": "sample=0&index=2&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886138.898628, "step": 330, "query": "sample=0&index=3&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886139.883663, "step": 340, "query": "sample=0&index=4&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886147.195567, "step": 410, "query": "sample=0&index=5&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886156.47856, "step": 500, "query": "sample=0&index=6&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886187.82793, "step": 810, "query": "sample=0&index=7&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886200.386198, "step": 950, "query": "sample=0&index=8&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28}, + {"wall_time": 1512886204.224405, "step": 990, "query": "sample=0&index=9&tag=input_reshape%2Finput%2Fimage%2F0&run=test", "width": 28, "height": 28} + ] + } + }; +}; + + diff --git a/frontend/mock/data/plugin/images/individualImage.js b/frontend/mock/data/plugin/images/individualImage.js new file mode 100644 index 000000000..c284c9ddf --- /dev/null +++ b/frontend/mock/data/plugin/images/individualImage.js @@ -0,0 +1,22 @@ +/** + * 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: '' + } + }; +}; diff --git a/frontend/mock/data/plugin/images/tags.js b/frontend/mock/data/plugin/images/tags.js new file mode 100644 index 000000000..bf0b3acf5 --- /dev/null +++ b/frontend/mock/data/plugin/images/tags.js @@ -0,0 +1,25 @@ +/** + * 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": { + "input_reshape/input/image/6": { + "displayName": "input_reshape/input/image/6", "description": "", "samples": 1}, "input_reshape/input/image/7": {"displayName": "input_reshape/input/image/7", "description": "", "samples": 1}, "input_reshape/input/image/4": {"displayName": "input_reshape/input/image/4", "description": "", "samples": 1}, "input_reshape/input/image/5": {"displayName": "input_reshape/input/image/5", "description": "", "samples": 1}, "input_reshape/input/image/2": {"displayName": "input_reshape/input/image/2", "description": "", "samples": 1}, "input_reshape/input/image/3": {"displayName": "input_reshape/input/image/3", "description": "", "samples": 1}, "input_reshape/input/image/0": {"displayName": "input_reshape/input/image/0", "description": "", "samples": 1}, "input_reshape/input/image/1": {"displayName": "input_reshape/input/image/1", "description": "", "samples": 1}, "input_reshape/input/image/8": {"displayName": "input_reshape/input/image/8", "description": "", "samples": 1}, "input_reshape/input/image/9": {"displayName": "input_reshape/input/image/9", "description": "", "samples": 1}}, "train": {"input_reshape/input/image/6": {"displayName": "input_reshape/input/image/6", "description": "", "samples": 1}, "input_reshape/input/image/7": {"displayName": "input_reshape/input/image/7", "description": "", "samples": 1}, "input_reshape/input/image/4": {"displayName": "input_reshape/input/image/4", "description": "", "samples": 1}, "input_reshape/input/image/5": {"displayName": "input_reshape/input/image/5", "description": "", "samples": 1}, "input_reshape/input/image/2": {"displayName": "input_reshape/input/image/2", "description": "", "samples": 1}, "input_reshape/input/image/3": {"displayName": "input_reshape/input/image/3", "description": "", "samples": 1}, "input_reshape/input/image/0": {"displayName": "input_reshape/input/image/0", "description": "", "samples": 1}, "input_reshape/input/image/1": {"displayName": "input_reshape/input/image/1", "description": "", "samples": 1}, "input_reshape/input/image/8": {"displayName": "input_reshape/input/image/8", "description": "", "samples": 1}, "input_reshape/input/image/9": {"displayName": "input_reshape/input/image/9", "description": "", "samples": 1}}} + } + }; +}; diff --git a/frontend/mock/data/runs.js b/frontend/mock/data/runs.js index 4e9854de6..1a7897bc5 100644 --- a/frontend/mock/data/runs.js +++ b/frontend/mock/data/runs.js @@ -16,7 +16,7 @@ module.exports = function (path, queryParam, postParam) { _data: { status: 0, msg: 'SUCCESS', - data: ["train", "test", "model"] + data: ["train", "test"] } }; }; diff --git a/frontend/package.json b/frontend/package.json index 7297c4fcc..c131147fc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,9 +6,7 @@ "release": "cross-env NODE_ENV=production node ./tool/build.js", "build": "cross-env NODE_ENV=dev node ./tool/build.js", "dev": "cross-env NODE_ENV=dev node tool/dev-server.js", - "lint": "./node_modules/fecs/bin/fecs --rule", - "precommit": "npm run lint", - "prepush": "npm run lint" + "lint": "./node_modules/fecs/bin/fecs --rule" }, "engines": { "node": ">= 6.4.0" @@ -52,7 +50,6 @@ "html-loader": "^0.4.4", "html-webpack-plugin": "^2.28.0", "http-proxy-middleware": "^0.17.4", - "husky": "^0.14.3", "json-loader": "^0.5.4", "opn": "^5.1.0", "optimize-css-assets-webpack-plugin": "^1.3.2", diff --git a/frontend/src/common/component/AppMenu.san b/frontend/src/common/component/AppMenu.san index df9352032..a89279c97 100644 --- a/frontend/src/common/component/AppMenu.san +++ b/frontend/src/common/component/AppMenu.san @@ -32,7 +32,7 @@ export default { }, { value: '2', - url: '/image', + url: '/images', title: 'IMAGES' } ] diff --git a/frontend/src/common/component/Charts/chart.san b/frontend/src/common/component/Charts/chart.san index 9aad89535..98f4eb0b0 100644 --- a/frontend/src/common/component/Charts/chart.san +++ b/frontend/src/common/component/Charts/chart.san @@ -3,26 +3,52 @@
+ + settings_overscan + - - file_download + + file_download
diff --git a/frontend/src/common/component/Charts/image.san b/frontend/src/common/component/Charts/image.san new file mode 100644 index 000000000..03288b0c8 --- /dev/null +++ b/frontend/src/common/component/Charts/image.san @@ -0,0 +1,101 @@ + + + + diff --git a/frontend/src/common/component/ExpandPanel.san b/frontend/src/common/component/ExpandPanel.san index 243e43296..0ddf3f648 100644 --- a/frontend/src/common/component/ExpandPanel.san +++ b/frontend/src/common/component/ExpandPanel.san @@ -5,9 +5,13 @@ on-click="handleHeadClick()" > {{title}} + + {{iconName}} + ({{info}}) +
@@ -15,11 +19,15 @@
@@ -53,7 +64,7 @@ export default { margin-right 20px margin-top 4px float left - width 100px + width 160px .sm-slider-thumb transform translate(0, -50%) .sm-inputNumber diff --git a/frontend/src/common/component/ui-common.styl b/frontend/src/common/component/ui-common.styl index 9384719dd..9266923a6 100644 --- a/frontend/src/common/component/ui-common.styl +++ b/frontend/src/common/component/ui-common.styl @@ -1,3 +1,7 @@ +html { + font-family: "RobotoDraft", "Roboto", sans-serif; +} + // initual style body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin:0; padding:0; } body, button, input, select, textarea { font:12px/1.5tahoma, arial, \5b8b\4f53; } h1, h2, h3, h4, h5, h6{ font-size:100%; } address, cite, dfn, em, var { font-style:normal; } code, kbd, pre, samp { font-family:couriernew, courier, monospace; } small{ font-size:12px; } ul, ol { list-style:none; } a { text-decoration:none; } a:hover { text-decoration:underline; } sup { vertical-align:text-top; } sub{ vertical-align:text-bottom; } legend { color:#000; } fieldset, img { border:0; } button, input, select, textarea { font-size:100%; } table { border-collapse:collapse; border-spacing:0; } @@ -5,8 +9,8 @@ body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, fo // modify some styles of san-mui .sm-icon - width 100% - height 100% + width 20px + height 20px overflow hidden .sm-radio, @@ -52,7 +56,22 @@ body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, fo color #58666e .sm-dropdown-menu + .sm-text-field + margin-bottom 0px + min-height 30px + border-bottom solid 1px #e4e4e4 + + .sm-text-field-content + padding 0 + padding-left 4px + + input + cursor pointer + .sm-dropdown-menu-icon + top 6px + right 0 + bottom 0 .sm-icon color #58666e @@ -64,12 +83,14 @@ body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, fo .sm-menu-item.state-selected color #ff4081 - +.sm-text-field + width 100% .sm-text-field-input color #58666e .sm-form-item margin-top 10px + overflow hidden .label color rgba(0,0,0,0.54) diff --git a/frontend/src/common/util/http.js b/frontend/src/common/util/http.js index 9f77fdedd..3d6293863 100644 --- a/frontend/src/common/util/http.js +++ b/frontend/src/common/util/http.js @@ -1,6 +1,6 @@ import axios from 'axios'; import qs from 'qs'; -import Notification from '../ui/Notification'; +import Notification from '../component/Notification'; const STATUS = 'status'; const STATUSINFO = 'msg'; diff --git a/frontend/src/common/util/index.js b/frontend/src/common/util/index.js new file mode 100644 index 000000000..4f0efd2c2 --- /dev/null +++ b/frontend/src/common/util/index.js @@ -0,0 +1,5 @@ +import quantile from './quantile'; + +export { + quantile +}; diff --git a/frontend/src/common/util/number.js b/frontend/src/common/util/number.js new file mode 100644 index 000000000..0adc69d8b --- /dev/null +++ b/frontend/src/common/util/number.js @@ -0,0 +1,3 @@ +export default function (x) { + return x === null ? NaN : +x; +} diff --git a/frontend/src/common/util/quantile.js b/frontend/src/common/util/quantile.js new file mode 100644 index 000000000..11db42b7d --- /dev/null +++ b/frontend/src/common/util/quantile.js @@ -0,0 +1,21 @@ +import number from './number'; +export default function (values, p, valueof) { + if (valueof == null) { + return valueof = number; + } + let n = values.length; + if (!(n)) { + return; + } + if ((p = +p) <= 0 || n < 2) { + return +valueof(values[0], 0, values); + } + if (p >= 1) { + return +valueof(values[n - 1], n - 1, values); + } + let i = (n - 1) * p; + let i0 = Math.floor(i); + let value0 = +valueof(values[i0], i0, values); + let value1 = +valueof(values[i0 + 1], i0 + 1, values); + return value0 + (value1 - value0) * (i - i0); +} diff --git a/frontend/src/images/Images.san b/frontend/src/images/Images.san new file mode 100644 index 000000000..fab509cf1 --- /dev/null +++ b/frontend/src/images/Images.san @@ -0,0 +1,155 @@ + + + + + diff --git a/frontend/src/images/index.js b/frontend/src/images/index.js new file mode 100644 index 000000000..01d1fd72d --- /dev/null +++ b/frontend/src/images/index.js @@ -0,0 +1,9 @@ +import {router} from 'san-router'; + +import Images from './Images'; + +router.add({ + target: '#content', + rule: '/images', + Component: Images +}); diff --git a/frontend/src/images/ui/chartPage.san b/frontend/src/images/ui/chartPage.san new file mode 100644 index 000000000..19ddfb157 --- /dev/null +++ b/frontend/src/images/ui/chartPage.san @@ -0,0 +1,71 @@ + + + + + diff --git a/frontend/src/images/ui/config.san b/frontend/src/images/ui/config.san new file mode 100644 index 000000000..0cfdb4cb5 --- /dev/null +++ b/frontend/src/images/ui/config.san @@ -0,0 +1,55 @@ + + + diff --git a/frontend/src/index.js b/frontend/src/index.js index 4c2921d0a..99656cf8b 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -4,6 +4,7 @@ import './common/component/ui-common.styl'; import './home/index'; import './scalars/index'; +import './images/index'; import App from './App'; new App({ diff --git a/frontend/src/scalars/Scalars.san b/frontend/src/scalars/Scalars.san index 7c907ce9b..bdee9d625 100644 --- a/frontend/src/scalars/Scalars.san +++ b/frontend/src/scalars/Scalars.san @@ -10,14 +10,14 @@
{ + let val = config[key]; + if (tansformArr.indexOf(key) > -1) { + filteredConfig[key] = isArray(val) && val[0] === 'yes'; + } + else { + filteredConfig[key] = val; + } + }); + return filteredConfig; } }, initData() { @@ -99,11 +114,13 @@ export default { tags: [], config: { groupNameReg: '.*', - smoothing: '0.5', - horizontal: '1', - sortingMethod: '2', - link: [], - chart: [] + smoothing: 0.6, + horizontal: 'step', + sortingMethod: 'default', + downloadLink: [], + outlier: [], + runs: [], + running: true } }; }, @@ -117,6 +134,7 @@ export default { }); getRuns().then(({errno, data}) => { this.data.set('runsArray', data); + this.data.set('config.runs', data); }); // need debounce, can't use computed diff --git a/frontend/src/scalars/ui/chartPage.san b/frontend/src/scalars/ui/chartPage.san index 3272ea0c0..96ca0a5c9 100644 --- a/frontend/src/scalars/ui/chartPage.san +++ b/frontend/src/scalars/ui/chartPage.san @@ -1,11 +1,18 @@ diff --git a/frontend/src/service.js b/frontend/src/service.js index e30dfbf33..d759f32b4 100644 --- a/frontend/src/service.js +++ b/frontend/src/service.js @@ -5,3 +5,7 @@ export const getPluginScalarsTags = makeService('/data/plugin/scalars/tags'); export const getRuns = makeService('/data/runs'); export const getPluginScalarsScalars = makeService('/data/plugin/scalars/scalars'); + +export const getPluginImagesTags = makeService('/data/plugin/images/tags'); + +export const getPluginImagesImages = makeService('/data/plugin/images/images'); diff --git a/frontend/tool/HtmlReplacePlugin.js b/frontend/tool/HtmlReplacePlugin.js index ce67a520d..31acce6c1 100644 --- a/frontend/tool/HtmlReplacePlugin.js +++ b/frontend/tool/HtmlReplacePlugin.js @@ -1,3 +1,4 @@ +'use strict'; function noopReplace (val) { return val; } function HtmlReplacePlugin(options) { diff --git a/frontend/tool/build.js b/frontend/tool/build.js index d8a67b1f1..3cfaf7cc1 100644 --- a/frontend/tool/build.js +++ b/frontend/tool/build.js @@ -1,3 +1,4 @@ +'use strict'; const webpack = require('webpack'); const rm = require('rimraf'); const ora = require('ora'); diff --git a/frontend/tool/dev-client.js b/frontend/tool/dev-client.js index d882b7bf8..61627601e 100644 --- a/frontend/tool/dev-client.js +++ b/frontend/tool/dev-client.js @@ -1,3 +1,4 @@ +'use strict'; var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') hotClient.subscribe(function (event) { diff --git a/frontend/tool/dev-server.js b/frontend/tool/dev-server.js index 98299e0c2..feed66fb5 100644 --- a/frontend/tool/dev-server.js +++ b/frontend/tool/dev-server.js @@ -1,3 +1,4 @@ +'use strict'; process.env.NODE_ENV = 'dev'; let devPort = 8999; let opn = require('opn'); diff --git a/frontend/tool/entry.js b/frontend/tool/entry.js index 78754c6a5..f19b4630a 100644 --- a/frontend/tool/entry.js +++ b/frontend/tool/entry.js @@ -1,3 +1,4 @@ +'use strict'; const path = require('path'); const projectPath = path.resolve(__dirname, '..'); const HtmlWebpackPlugin = require('html-webpack-plugin'); diff --git a/frontend/tool/webpack.config.js b/frontend/tool/webpack.config.js index 24764208c..ae2862a0a 100644 --- a/frontend/tool/webpack.config.js +++ b/frontend/tool/webpack.config.js @@ -1,3 +1,4 @@ +'use strict'; const webpack = require('webpack'); const path = require('path'); const projectPath = path.resolve(__dirname, '..'); diff --git a/frontend/tool/webpack.dev.config.js b/frontend/tool/webpack.dev.config.js index 5b16958fa..334304e4e 100644 --- a/frontend/tool/webpack.dev.config.js +++ b/frontend/tool/webpack.dev.config.js @@ -1,3 +1,4 @@ +'use strict'; const webpack = require('webpack'); const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin'); let merge = require('webpack-merge'); diff --git a/frontend/tool/webpack.prod.config.js b/frontend/tool/webpack.prod.config.js index fa73c7837..7c76cff71 100644 --- a/frontend/tool/webpack.prod.config.js +++ b/frontend/tool/webpack.prod.config.js @@ -1,3 +1,4 @@ +'use strict'; const webpack = require('webpack'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const path = require('path');