diff --git a/frontend/mock/data/plugin/images/images.js b/frontend/mock/data/plugin/images/images.js new file mode 100644 index 0000000000000000000000000000000000000000..98ee5bc9531160294bf73ffc368b66dd2b571dce --- /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 0000000000000000000000000000000000000000..c4dafc4ec3a14b8fae8ec3e3a400ff6de111c712 --- /dev/null +++ b/frontend/mock/data/plugin/images/individualImage.js @@ -0,0 +1,29 @@ +/** + * @file mock data + * @author autoresponse + */ + +/* eslint-disable fecs-camelcase */ + +/** + * 获取 mock 响应数据 + * + * @param {string} path 请求路径名 + * @param {Object} queryParam 查询参数信息 + * @param {Object} postParam post 的查询参数信息 + * @return {Object} + */ +module.exports = function (path, queryParam, postParam) { + return { + // 可以通过该属性来设置响应的延时,也可以设为值为'0,100',表示随机 0-100ms 的延时,默认 0 + _timeout: 0, + + // 通过该状态来设置响应的 http 的状态码,默认 200 + _status: 200, + + // 对于要响应的 json 数据可以统一放在该字段里,也可以不使用该字段,直接跟 _xx 属性平级放 + _data: [] + }; +}; + +/* eslint-enable fecs-camelcase */ diff --git a/frontend/mock/data/plugin/images/tags.js b/frontend/mock/data/plugin/images/tags.js new file mode 100644 index 0000000000000000000000000000000000000000..bf0b3acf59b82d9bf9a6f020c30755bfc6b7f74a --- /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 4e9854de65a0a6026d55fdd2c3b8234dacb3354c..1a7897bc5266a1d5fb1936c1bf32b6e1753f2a13 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 57dc9b6da20359fb2ddbfd2f84ed6f48c27b9da0..5cd4c1f81ece93f589a05cda39b66540a62d5990 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,9 +8,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" @@ -54,7 +52,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/ui/AppMenu.san b/frontend/src/common/ui/AppMenu.san index df93520329b4d0610bb639288cb9fa06d6cabfc9..a89279c97d018ccea216d710ee154197114dadd2 100644 --- a/frontend/src/common/ui/AppMenu.san +++ b/frontend/src/common/ui/AppMenu.san @@ -32,7 +32,7 @@ export default { }, { value: '2', - url: '/image', + url: '/images', title: 'IMAGES' } ] diff --git a/frontend/src/common/ui/Charts/chart.san b/frontend/src/common/ui/Charts/chart.san index e9121a3480f4f85fd48747ed2516a4d2c72cd4f2..ac314fd9bce0a94c7ade3a2c4c3ff8864e6a93aa 100644 --- a/frontend/src/common/ui/Charts/chart.san +++ b/frontend/src/common/ui/Charts/chart.san @@ -3,31 +3,57 @@
+ + settings_overscan + - - file_download + + file_download
diff --git a/frontend/src/common/ui/Charts/image.san b/frontend/src/common/ui/Charts/image.san new file mode 100644 index 0000000000000000000000000000000000000000..03288b0c85daee659e9c7330fc44a7a40276c8c0 --- /dev/null +++ b/frontend/src/common/ui/Charts/image.san @@ -0,0 +1,101 @@ + + + + diff --git a/frontend/src/common/ui/ExpandPanel.san b/frontend/src/common/ui/ExpandPanel.san index 243e43296db59c6814af72791f4e051c88397475..cc3fec1d2dd8e8beedf821eb907f00790ab051d4 100644 --- a/frontend/src/common/ui/ExpandPanel.san +++ b/frontend/src/common/ui/ExpandPanel.san @@ -7,7 +7,7 @@ {{title}}
@@ -16,12 +16,6 @@ @@ -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/ui/ui-common.styl b/frontend/src/common/ui/ui-common.styl index 9384719dd62a022d7df263c09f8f11ea205cd171..d4982106e1f8a63f2f14c93ae7f1ef8be8462971 100644 --- a/frontend/src/common/ui/ui-common.styl +++ b/frontend/src/common/ui/ui-common.styl @@ -52,7 +52,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 +79,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/index.js b/frontend/src/common/util/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4f0efd2c205b4f6dd5bd7c2335d6af6a7c638a3f --- /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 0000000000000000000000000000000000000000..0adc69d8b0c90e3385945393acae53b69f1fb1bc --- /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 0000000000000000000000000000000000000000..11db42b7d591eccdb02df04bbada8d08fa6d7b55 --- /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 0000000000000000000000000000000000000000..fab509cf14ebc2701be636dba099b3f632301286 --- /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 0000000000000000000000000000000000000000..01d1fd72d5686124edd7042ee4d52c50c4a5f0a1 --- /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 0000000000000000000000000000000000000000..38e53de0e43cbdc59581d40874034a6a39031cf5 --- /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 0000000000000000000000000000000000000000..750d22031092386ed40abaaca9de62a34f90d46c --- /dev/null +++ b/frontend/src/images/ui/config.san @@ -0,0 +1,63 @@ + + + diff --git a/frontend/src/index.js b/frontend/src/index.js index 5519c68614a6673d0e23c47906a8235e834a7b8d..03486227b17543c1a39e501897b81b50851d2e8a 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -4,6 +4,7 @@ import './common/ui/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 7c907ce9b4b7b548a950847f54b8571b1388dad7..d15e61cef302f90c6548cdaf7e696ec0454c184f 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', + smoothing: 0.6, + horizontal: 'step', sortingMethod: '2', - link: [], - chart: [] + 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 aa1eb5db25035f6bf088dd15e470b6336ae0552e..20ea7db0e8730654c07bb54feb6c683c23d9be3b 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 e30dfbf3355167d1fae3a48359b1c13e176a096c..d759f32b4e5c9bfc395013b473c7431b0218a816 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 ce67a520d36f6c7d0fa0fe61e9cee42241cec5f6..31acce6c1e436f51c390bc486b5bedef2a7d6492 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 d8a67b1f106f82df771200a8c6bb096c441d77cc..3cfaf7cc1b5a81a1cafc8b3c828540eafe3942a9 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 d882b7bf83be35b3fca65f4d790c7451120e35c9..61627601e3a46c71554ba1c2f94dbea798d0a9cd 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 98299e0c2632d7b0633a5685525e63fe424d9ea1..feed66fb507a1860b349d36d6c5615d044b2b67a 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 78754c6a5dc394ade713c1522657690d9be3b3fc..f19b4630a06662757d1eb34e930048ace2623cf6 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 24764208c456bb784655b5934e7c272782abf101..ae2862a0a93abee232ea94946053c174d2ee9b59 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 5b16958fafa422373ac0ba00075de5616d4d97ca..334304e4e06c4d112f8214e9b0b9d4222b86edf2 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 fa73c7837ef2a7ea12803ba5d6885f01520bbc8b..7c76cff713e00e38222f4b9764729c054b334b60 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');