提交 0be5b06c 编写于 作者: J Jeff Wang 提交者: daminglu

Eslint clean up (#369)

上级 6dfa1d42
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
language: system language: system
files: \.(py)$ files: \.(py)$
#- repo: local - repo: local
# hooks: hooks:
# - id: eslint-format-checker - id: eslint-format-checker
# name: eslint-format-checker name: eslint-format-checker
# description: Format files with ESLint. description: Format files with ESLint.
# entry: bash ./.eslint_format.hook entry: bash ./.eslint_format.hook
# language: system language: system
...@@ -5,11 +5,20 @@ module.exports = { ...@@ -5,11 +5,20 @@ module.exports = {
'plugin:vue/essential', 'plugin:vue/essential',
'plugin:vue/strongly-recommended', 'plugin:vue/strongly-recommended',
], ],
parserOptions: {
"sourceType": "module",
},
rules: { rules: {
// override/add rules settings here, such as: // override/add rules settings here, such as:
'vue/no-unused-vars': 'warn', 'vue/no-unused-vars': 'warn',
'max-len': ["warn", 120], 'max-len': ["warn", 120],
"vue/prop-name-casing": ["error"], "vue/prop-name-casing": ["error"],
'vue/script-indent': 'error', 'vue/script-indent': 'error',
// The following rules should apply eventually. Turn them off for now
// so we can have pre-commit running
'no-invalid-this': 'off',
'require-jsdoc': 'off',
'no-unused-vars': 'off',
} }
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<script> <script>
import {getPluginAudioTags, getRuns} from '../service'; import {getPluginAudioTags, getRuns} from '../service';
import {debounce, flatten, uniq, isArray} from 'lodash'; import {debounce, flatten, uniq} from 'lodash';
import autoAdjustHeight from '../common/util/autoAdjustHeight'; import autoAdjustHeight from '../common/util/autoAdjustHeight';
import Config from './ui/Config'; import Config from './ui/Config';
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<p> <p>
<span>Step:</span> <span>Step:</span>
<span>{{ audioData.step }}</span> <span>{{ audioData.step }}</span>
<span class="visual-del-audio-time">{{ audioData.wall_time | formatTime }}</span> <span class="visual-del-audio-time">{{ audioData.wallTime | formatTime }}</span>
</p> </p>
<v-slider <v-slider
:max="steps" :max="steps"
...@@ -31,7 +31,24 @@ import {getPluginAudioAudio} from '../../service'; ...@@ -31,7 +31,24 @@ import {getPluginAudioAudio} from '../../service';
const intervalTime = 30; const intervalTime = 30;
export default { export default {
props: ['tagInfo', 'runs', 'running', 'runsItems'], props: {
runsItems: {
type: Array,
required: true,
},
tagInfo: {
type: Object,
required: true,
},
runs: {
type: Array,
required: true,
},
running: {
type: Boolean,
required: true,
},
},
computed: { computed: {
steps() { steps() {
let data = this.data || []; let data = this.data || [];
...@@ -85,13 +102,13 @@ export default { ...@@ -85,13 +102,13 @@ export default {
currentIndex: function(index) { currentIndex: function(index) {
if (this.data && this.data[index]) { if (this.data && this.data[index]) {
let currentAudioInfo = this.data ? this.data[index] : {}; let currentAudioInfo = this.data ? this.data[index] : {};
let {query, step, wall_time} = currentAudioInfo; let {query, step, wallTime} = currentAudioInfo;
let url = '/data/plugin/audio/individualAudio?ts=' + wall_time; let url = '/data/plugin/audio/individualAudio?ts=' + wallTime;
let audioSrc = [url, query].join('&'); let audioSrc = [url, query].join('&');
this.audioData = { this.audioData = {
audioSrc, audioSrc,
step, step,
wall_time, wallTime,
}; };
} }
}, },
......
...@@ -29,7 +29,24 @@ import AudioPanel from './AudioPanel'; ...@@ -29,7 +29,24 @@ import AudioPanel from './AudioPanel';
import {cloneDeep, flatten} from 'lodash'; import {cloneDeep, flatten} from 'lodash';
export default { export default {
props: ['config', 'runsItems', 'tagList', 'title'], props: {
runsItems: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
tagList: {
type: Array,
required: true,
},
title: {
type: String,
required: true,
},
},
components: { components: {
'ui-audio': AudioPanel, 'ui-audio': AudioPanel,
'ui-expand-panel': ExpandPanel, 'ui-expand-panel': ExpandPanel,
......
...@@ -33,8 +33,14 @@ ...@@ -33,8 +33,14 @@
export default { export default {
props: { props: {
runsItems: Array, runsItems: {
config: Object, type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
}, },
data() { data() {
return { return {
......
...@@ -22,7 +22,12 @@ ...@@ -22,7 +22,12 @@
<script> <script>
export default { export default {
props: ['initialRoute'], props: {
initialRoute: {
type: String,
required: true,
},
},
name: 'AppMenu', name: 'AppMenu',
data() { data() {
return { return {
......
...@@ -23,8 +23,14 @@ ...@@ -23,8 +23,14 @@
<script> <script>
export default { export default {
props: { props: {
title: String, title: {
info: Number, type: String,
required: true,
},
info: {
type: Number,
required: true,
},
}, },
computed: { computed: {
iconName() { iconName() {
......
...@@ -54,7 +54,16 @@ ...@@ -54,7 +54,16 @@
<script> <script>
export default { export default {
props: ['config', 'curNode'], props: {
curNode: {
type: Object,
required: true,
},
config: {
type: Object,
required: true,
},
},
methods: { methods: {
handleFitScreen() { handleFitScreen() {
this.$emit('fitScreen'); this.$emit('fitScreen');
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
:display-word-label="config.displayWordLabel" :display-word-label="config.displayWordLabel"
:search-text="config.searchText" :search-text="config.searchText"
:dimension="config.dimension" :dimension="config.dimension"
:embedding_data="embedding_data" :embedding-data="embeddingData"
/> />
</div> </div>
<div class="visual-dl-page-right"> <div class="visual-dl-page-right">
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
reduction: 'tsne', reduction: 'tsne',
running: true, running: true,
}, },
embedding_data: [], embeddingData: [],
}; };
}, },
created() { created() {
...@@ -65,14 +65,14 @@ export default { ...@@ -65,14 +65,14 @@ export default {
reduction: this.config.reduction, reduction: this.config.reduction,
}; };
getHighDimensionalDatasets(params).then(({errno, data}) => { getHighDimensionalDatasets(params).then(({errno, data}) => {
let vector_data = data.embedding; let vectorData = data.embedding;
let labels = data.labels; let labels = data.labels;
for ( let i = 0; i < vector_data.length; i ++) { for ( let i = 0; i < vectorData.length; i ++) {
vector_data[i].push(labels[i]); vectorData[i].push(labels[i]);
} }
this.embedding_data = vector_data; this.embeddingData = vectorData;
}); });
}, },
}, },
......
...@@ -14,7 +14,28 @@ import echarts from 'echarts'; ...@@ -14,7 +14,28 @@ import echarts from 'echarts';
import 'echarts-gl'; import 'echarts-gl';
export default { export default {
props: ['config', 'displayWordLabel', 'searchText', 'embedding_data', 'dimension'], props: {
embeddingData: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
displayWordLabel: {
type: Boolean,
required: true,
},
searchText: {
type: String,
required: true,
},
dimension: {
type: String,
required: true,
},
},
data() { data() {
return { return {
width: 900, width: 900,
...@@ -36,7 +57,7 @@ export default { ...@@ -36,7 +57,7 @@ export default {
this.setDisplayWordLabel(); this.setDisplayWordLabel();
}, },
watch: { watch: {
embedding_data: function(val) { embeddingData: function(val) {
this.myChart.hideLoading(); this.myChart.hideLoading();
this.myChart.setOption({ this.myChart.setOption({
series: [{ series: [{
...@@ -62,7 +83,7 @@ export default { ...@@ -62,7 +83,7 @@ export default {
}, },
searchText: function(val) { searchText: function(val) {
// Filter the data that has the hasPrefix // Filter the data that has the hasPrefix
let matched_words = []; let matchedWords = [];
if (val != '') { if (val != '') {
val = val.toLowerCase(); val = val.toLowerCase();
...@@ -71,7 +92,7 @@ export default { ...@@ -71,7 +92,7 @@ export default {
return (typeof word == 'string' && word.toLowerCase().startsWith(val)); return (typeof word == 'string' && word.toLowerCase().startsWith(val));
} }
matched_words = this.embedding_data.filter(hasPrefix); matchedWords = this.embeddingData.filter(hasPrefix);
} }
// Update the matched series data // Update the matched series data
...@@ -79,7 +100,7 @@ export default { ...@@ -79,7 +100,7 @@ export default {
series: [{ series: [{
// Grab the 'matched' series data // Grab the 'matched' series data
name: 'matched', name: 'matched',
data: matched_words, data: matchedWords,
}], }],
}); });
}, },
...@@ -91,14 +112,13 @@ export default { ...@@ -91,14 +112,13 @@ export default {
this.myChart = echarts.init(el); this.myChart = echarts.init(el);
}, },
set2DChartOptions() { set2DChartOptions() {
let typeD = 'normal';
let option = { let option = {
xAxis: {}, xAxis: {},
yAxis: {}, yAxis: {},
series: [{ series: [{
name: 'all', name: 'all',
symbolSize: 10, symbolSize: 10,
data: this.embedding_data, data: this.embeddingData,
type: 'scatter', type: 'scatter',
}, },
{ {
...@@ -137,7 +157,7 @@ export default { ...@@ -137,7 +157,7 @@ export default {
xAxis3D: {}, xAxis3D: {},
zAxis3D: {}, zAxis3D: {},
dataset: { dataset: {
source: this.embedding_data, source: this.embeddingData,
}, },
series: [ series: [
{ {
......
...@@ -55,8 +55,10 @@ ...@@ -55,8 +55,10 @@
export default { export default {
props: { props: {
runsItems: Array, config: {
config: Object, type: Object,
required: true,
},
}, },
data() { data() {
return { return {
......
...@@ -40,7 +40,28 @@ const p = Math.max(0, precisionRound(0.01, 1.01) - 1); ...@@ -40,7 +40,28 @@ const p = Math.max(0, precisionRound(0.01, 1.01) - 1);
const yValueFormat = format('.' + p + 'e'); const yValueFormat = format('.' + p + 'e');
export default { export default {
props: ['tagInfo', 'runs', 'chartType', 'running', 'runsItems'], props: {
runsItems: {
type: Array,
required: true,
},
tagInfo: {
type: Object,
required: true,
},
runs: {
type: Array,
required: true,
},
running: {
type: Boolean,
required: true,
},
chartType: {
type: String,
required: true,
},
},
data() { data() {
return { return {
originData: [], originData: [],
......
...@@ -31,8 +31,24 @@ import Chart from './Chart'; ...@@ -31,8 +31,24 @@ import Chart from './Chart';
import {cloneDeep, flatten} from 'lodash'; import {cloneDeep, flatten} from 'lodash';
export default { export default {
props: ['config', 'runsItems', 'tagList', 'title'], props: {
runsItems: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
tagList: {
type: Array,
required: true,
},
title: {
type: String,
required: true,
},
},
components: { components: {
'ui-chart': Chart, 'ui-chart': Chart,
'ui-expand-panel': ExpandPanel, 'ui-expand-panel': ExpandPanel,
......
...@@ -42,7 +42,16 @@ ...@@ -42,7 +42,16 @@
</template> </template>
<script> <script>
export default { export default {
props: ['config', 'runsItems'], props: {
runsItems: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
},
data() { data() {
return { return {
chartTypeItems: [ chartTypeItems: [
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<script> <script>
import {getPluginImagesTags, getRuns} from '../service'; import {getPluginImagesTags, getRuns} from '../service';
import {debounce, flatten, uniq, isArray} from 'lodash'; import {debounce, flatten, uniq} from 'lodash';
import autoAdjustHeight from '../common/util/autoAdjustHeight'; import autoAdjustHeight from '../common/util/autoAdjustHeight';
import Config from './ui/Config'; import Config from './ui/Config';
...@@ -112,7 +112,6 @@ export default { ...@@ -112,7 +112,6 @@ export default {
}); });
}, },
filteredConfig() { filteredConfig() {
let tansformArr = ['isActualImageSize'];
let config = this.config || {}; let config = this.config || {};
let filteredConfig = {}; let filteredConfig = {};
Object.keys(config).forEach((key) => { Object.keys(config).forEach((key) => {
......
...@@ -30,7 +30,24 @@ import Image from './Image'; ...@@ -30,7 +30,24 @@ import Image from './Image';
import {cloneDeep, flatten} from 'lodash'; import {cloneDeep, flatten} from 'lodash';
export default { export default {
props: ['config', 'runsItems', 'tagList', 'title'], props: {
runsItems: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
tagList: {
type: Array,
required: true,
},
title: {
type: String,
required: true,
},
},
components: { components: {
'ui-image': Image, 'ui-image': Image,
'ui-expand-panel': ExpandPanel, 'ui-expand-panel': ExpandPanel,
......
...@@ -38,8 +38,14 @@ ...@@ -38,8 +38,14 @@
export default { export default {
props: { props: {
runsItems: Array, runsItems: {
config: Object, type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
}, },
data() { data() {
return { return {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<p> <p>
<span>Step:</span> <span>Step:</span>
<span>{{ imgData.step }}</span> <span>{{ imgData.step }}</span>
<span class="visual-del-image-time">{{ imgData.wall_time | formatTime }}</span> <span class="visual-del-image-time">{{ imgData.wallTime | formatTime }}</span>
</p> </p>
<v-slider <v-slider
:max="steps" :max="steps"
...@@ -32,7 +32,28 @@ const defaultImgHeight = 300; ...@@ -32,7 +32,28 @@ const defaultImgHeight = 300;
const intervalTime = 30; const intervalTime = 30;
export default { export default {
props: ['tagInfo', 'isActualImageSize', 'runs', 'running', 'runsItems'], props: {
runsItems: {
type: Array,
required: true,
},
tagInfo: {
type: Object,
required: true,
},
runs: {
type: Array,
required: true,
},
running: {
type: Boolean,
required: true,
},
isActualImageSize: {
type: Boolean,
required: true,
},
},
computed: { computed: {
steps() { steps() {
let data = this.data || []; let data = this.data || [];
...@@ -95,15 +116,15 @@ export default { ...@@ -95,15 +116,15 @@ export default {
/* eslint-disable fecs-camelcase */ /* eslint-disable fecs-camelcase */
if (this.data && this.data[index]) { if (this.data && this.data[index]) {
let currentImgInfo = this.data ? this.data[index] : {}; let currentImgInfo = this.data ? this.data[index] : {};
let {height, width, query, step, wall_time} = currentImgInfo; let {height, width, query, step, wallTime} = currentImgInfo;
let url = '/data/plugin/images/individualImage?ts=' + wall_time; let url = '/data/plugin/images/individualImage?ts=' + wallTime;
let imgSrc = [url, query].join('&'); let imgSrc = [url, query].join('&');
this.imgData = { this.imgData = {
imgSrc, imgSrc,
height, height,
width, width,
step, step,
wall_time, wallTime,
}; };
} }
/* eslint-enable fecs-camelcase */ /* eslint-enable fecs-camelcase */
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<script> <script>
import {getPluginScalarsTags, getRuns} from '../service'; import {getPluginScalarsTags, getRuns} from '../service';
import {debounce, flatten, uniq, isArray} from 'lodash'; import {debounce, flatten, uniq} from 'lodash';
import autoAdjustHeight from '../common/util/autoAdjustHeight'; import autoAdjustHeight from '../common/util/autoAdjustHeight';
import Config from './ui/Config'; import Config from './ui/Config';
......
...@@ -102,8 +102,40 @@ const maxQuantile = 0.95; ...@@ -102,8 +102,40 @@ const maxQuantile = 0.95;
const intervalTime = 15; const intervalTime = 15;
export default { export default {
props: ['tagInfo', 'groupNameReg', 'smoothing', 'horizontal', 'sortingMethod', 'outlier', 'runs', props: {
'running', 'runsItems'], runsItems: {
type: Array,
required: true,
},
tagInfo: {
type: Object,
required: true,
},
runs: {
type: Array,
required: true,
},
running: {
type: Boolean,
required: true,
},
smoothing: {
type: Number,
required: true,
},
horizontal: {
type: String,
required: true,
},
sortingMethod: {
type: String,
required: true,
},
outlier: {
type: Boolean,
required: true,
},
},
computed: { computed: {
computedStyle() { computedStyle() {
return 'height:' + this.height + 'px;' return 'height:' + this.height + 'px;'
...@@ -366,7 +398,7 @@ export default { ...@@ -366,7 +398,7 @@ export default {
/** /**
* @desc 1、add smooth data depend on smoothingWeight. see https://en.wikipedia.org/wiki/Moving_average for detail * @desc 1、add smooth data depend on smoothingWeight. see https://en.wikipedia.org/wiki/Moving_average for detail
* 2、add relative data * 2、add relative data
* @param {Object} echarts series Object * @param {Object} seriesData: echarts series Object
* @param {number} smoothingWeight smooth weight, between 0 ~ 1 * @param {number} smoothingWeight smooth weight, between 0 ~ 1
*/ */
transformData(seriesData, smoothingWeight) { transformData(seriesData, smoothingWeight) {
...@@ -645,7 +677,8 @@ export default { ...@@ -645,7 +677,8 @@ export default {
let headerHtml = '<tr style="font-size:14px;">'; let headerHtml = '<tr style="font-size:14px;">';
headerHtml += Object.keys(transformedData[0]).map((key) => { headerHtml += Object.keys(transformedData[0]).map((key) => {
return '<td style="padding: 0 4px; font-family: \'Merriweather Sans\'; font-weight: bold; width:' + widthPropMap[key] + 'px;">' + key + '</td>'; return '<td style="padding: 0 4px; font-family: \'Merriweather Sans\'; font-weight: bold; width:' +
widthPropMap[key] + 'px;">' + key + '</td>';
}).join(''); }).join('');
headerHtml += '</tr>'; headerHtml += '</tr>';
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
v-for="(tagInfo, index) in filteredTagList" v-for="(tagInfo, index) in filteredTagList"
:key="index" :key="index"
:tag-info="tagInfo" :tag-info="tagInfo"
:group-name-reg="config.groupNameReg"
:smoothing="config.smoothing" :smoothing="config.smoothing"
:horizontal="config.horizontal" :horizontal="config.horizontal"
:sorting-method="config.sortingMethod" :sorting-method="config.sortingMethod"
...@@ -37,9 +36,25 @@ export default { ...@@ -37,9 +36,25 @@ export default {
components: { components: {
'ui-chart': Chart, 'ui-chart': Chart,
'ui-expand-panel': ExpandPanel, 'ui-expand-panel': ExpandPanel,
// 'ui-pagination': Pagination
}, },
props: ['config', 'runsItems', 'tagList', 'title'], props: {
runsItems: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
tagList: {
type: Array,
required: true,
},
title: {
type: String,
required: true,
},
},
computed: { computed: {
filteredRunsList() { filteredRunsList() {
let tagList = this.tagList || []; let tagList = this.tagList || [];
......
...@@ -77,8 +77,14 @@ ...@@ -77,8 +77,14 @@
export default { export default {
props: { props: {
runsItems: Array, runsItems: {
config: Object, type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
}, },
data() { data() {
return { return {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<script> <script>
import {getPluginTextsTags, getRuns} from '../service'; import {getPluginTextsTags, getRuns} from '../service';
import {debounce, flatten, uniq, isArray} from 'lodash'; import {debounce, flatten, uniq} from 'lodash';
import autoAdjustHeight from '../common/util/autoAdjustHeight'; import autoAdjustHeight from '../common/util/autoAdjustHeight';
import Config from './ui/Config'; import Config from './ui/Config';
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<p> <p>
<span>Step:</span> <span>Step:</span>
<span>{{ textData.step }}</span> <span>{{ textData.step }}</span>
<span class="visual-del-text-time">{{ textData.wall_time | formatTime }}</span> <span class="visual-del-text-time">{{ textData.wallTime | formatTime }}</span>
</p> </p>
<v-slider <v-slider
:max="steps" :max="steps"
...@@ -28,7 +28,24 @@ import {getPluginTextsTexts} from '../../service'; ...@@ -28,7 +28,24 @@ import {getPluginTextsTexts} from '../../service';
const intervalTime = 30; const intervalTime = 30;
export default { export default {
props: ['tagInfo', 'runs', 'running', 'runsItems'], props: {
runsItems: {
type: Array,
required: true,
},
tagInfo: {
type: Object,
required: true,
},
runs: {
type: Array,
required: true,
},
running: {
type: Boolean,
required: true,
},
},
computed: { computed: {
steps() { steps() {
let data = this.data || []; let data = this.data || [];
...@@ -82,13 +99,13 @@ export default { ...@@ -82,13 +99,13 @@ export default {
currentIndex: function(index) { currentIndex: function(index) {
if (this.data && this.data[index]) { if (this.data && this.data[index]) {
let currentTextInfo = this.data ? this.data[index] : {}; let currentTextInfo = this.data ? this.data[index] : {};
let wall_time = currentTextInfo[0]; let wallTime = currentTextInfo[0];
let step = currentTextInfo[1]; let step = currentTextInfo[1];
let message = currentTextInfo[2]; let message = currentTextInfo[2];
this.textData = { this.textData = {
step, step,
wall_time, wallTime,
message, message,
}; };
} }
......
...@@ -35,7 +35,24 @@ export default { ...@@ -35,7 +35,24 @@ export default {
'ui-chart': Chart, 'ui-chart': Chart,
'ui-expand-panel': ExpandPanel, 'ui-expand-panel': ExpandPanel,
}, },
props: ['config', 'runsItems', 'tagList', 'title'], props: {
runsItems: {
type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
tagList: {
type: Array,
required: true,
},
title: {
type: String,
required: true,
},
},
computed: { computed: {
filteredRunsList() { filteredRunsList() {
let tagList = this.tagList || []; let tagList = this.tagList || [];
......
...@@ -35,8 +35,14 @@ ...@@ -35,8 +35,14 @@
export default { export default {
props: { props: {
runsItems: Array, runsItems: {
config: Object, type: Array,
required: true,
},
config: {
type: Object,
required: true,
},
}, },
data() { data() {
return { return {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册