提交 623155e7 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!25 display user-defined info on model trace ui

Merge pull request !25 from 潘慧/master_ph
<!--
Copyright 2020 Huawei Technologies Co., Ltd.All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<template>
<div class="cl-checklist-container">
<!-- Select tag -->
<div class="select-content">
<div class="title mr24">{{$t("components.tagSelectTitle")}}</div>
<!-- Select all -->
<div class="select-all mr24"
@click="listSelectAll">
<span class="multiCheckBox-border multi-check-border"
:class="operateSelectAll ? 'checkbox-checked':'checkbox-unchecked'"></span>
<span class="label-item select-disable">{{$t("components.selectAll")}}</span>
</div>
<!-- Tag search box -->
<el-input class="search-input-item"
v-model="searchInput"
@input="listFilter"
v-if="listFullScreen"
:placeholder="$t('components.tagFilterPlaceHolder')"></el-input>
<!-- Tag list -->
<div class="select-item-content"
v-if="!listFullScreen"
ref="selectItemContent">
<div class="select-item"
v-for="(item, itemIndex) in checkListArr"
:key="itemIndex"
@click="listItemClick(item)"
v-show="item.show">
<span class="multiCheckBox-border multi-check-border"
:class="item.checked ? 'checkbox-checked':'checkbox-unchecked'"></span>
<span class="label-item">
<el-tooltip effect="dark"
popper-class="tooltip-show-content"
:content="item.label"
placement="top">
<span class="select-disable">{{item.label}}</span>
</el-tooltip>
</span>
</div>
</div>
<!-- Tag expansion/collapse button -->
<div class="select-content-open select-disable"
@click="toggleListFullScreen"
v-if="overRowFlag || searchInput"
v-show="!listFullScreen">{{$t("components.open")}}</div>
<div class="select-content-open select-disable"
@click="toggleListFullScreen"
v-if="overRowFlag || listFullScreen"
v-show="listFullScreen">{{$t("components.close")}}</div>
</div>
<div class="select-content-all"
v-if="listFullScreen">
<div class="select-item"
v-for="(item, itemIndex) in checkListArr"
:key="itemIndex"
@click="listItemClick(item)"
v-show="item.show">
<span class="multiCheckBox-border multi-check-border"
:class="item.checked ? 'checkbox-checked' : 'checkbox-unchecked'"></span>
<span class="label-item">
<el-tooltip effect="dark"
popper-class="tooltip-show-content"
:content="item.label"
placement="top">
<span class="select-disable">{{item.label}}</span>
</el-tooltip>
</span>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
checkListArr: Array,
},
data() {
return {
listFullScreen: false, // Indicates whether to expand the selection list.
overRowFlag: false, // Check whether the list contains more than one line.
searchInputTimer: null, // Timer for filtering.
searchInput: '', // Regular input value of the search.
valiableSearchInput: '', // Last valid input for tag retrieval.
multiSelectedItemNames: {}, // Dictionary for storing the name of the selected tags.
operateSelectAll: true, // Indicates whether to select all tags.
perSelectItemMarginBottom: 1, // Outer margin of the bottom of each selection box.
};
},
computed: {},
watch: {},
mounted() {
this.init();
},
methods: {
/**
* Initialize
*/
init() {
this.$nextTick(() => {
this.resizeCallback();
});
window.addEventListener('resize', this.resizeCallback, false);
},
/**
* The callback of window size changes listener
*/
resizeCallback() {
// Calculating the display of the Expand Folding Button
const selectItemContent = this.$refs.selectItemContent;
if (selectItemContent) {
this.overRowFlag =
selectItemContent.clientHeight <
selectItemContent.scrollHeight - this.perSelectItemMarginBottom;
}
},
/**
* Click select all
*/
listSelectAll() {
this.operateSelectAll = !this.operateSelectAll;
this.multiSelectedItemNames = {};
// Setting the status of list items
if (this.operateSelectAll) {
this.checkListArr.forEach((listItem) => {
if (listItem.show) {
listItem.checked = true;
this.multiSelectedItemNames[listItem.label] = true;
}
});
} else {
this.checkListArr.forEach((listItem) => {
if (listItem.show) {
listItem.checked = false;
}
});
}
// Returns a dictionary containing selected items.
this.$emit('selectedChange', this.multiSelectedItemNames);
},
/**
* Tag Filter
*/
listFilter() {
if (this.searchInputTimer) {
clearTimeout(this.searchInputTimer);
this.searchInputTimer = null;
}
this.searchInputTimer = setTimeout(() => {
let reg;
try {
reg = new RegExp(this.searchInput);
} catch (e) {
this.$message.warning(this.$t('public.regIllegal'));
return;
}
this.valiableSearchInput = this.searchInput;
this.multiSelectedItemNames = {};
let itemSelectAll = true;
// Filter the tags that do not meet the conditions in the operation bar and hide them
this.checkListArr.forEach((listItem) => {
if (reg.test(listItem.label)) {
listItem.show = true;
if (listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
} else {
itemSelectAll = false;
}
} else {
listItem.show = false;
}
});
// Update the selected status of the Select All button
this.operateSelectAll = itemSelectAll;
this.$emit('selectedChange', this.multiSelectedItemNames);
}, 200);
},
/**
* Item click event
* @param {Object} listItem Current item object
*/
listItemClick(listItem) {
if (!listItem) {
return;
}
listItem.checked = !listItem.checked;
// Refreshes the selected status of the current label option
if (listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
} else {
if (this.multiSelectedItemNames[listItem.label]) {
delete this.multiSelectedItemNames[listItem.label];
}
}
// Update the selected status of the Select All button
let itemSelectAll = true;
this.checkListArr.some((curListItem) => {
if (curListItem.show && !curListItem.checked) {
itemSelectAll = false;
return true;
}
});
this.operateSelectAll = itemSelectAll;
// Return a dictionary containing selected items.
this.$emit('selectedChange', this.multiSelectedItemNames);
},
/**
* Expand or collapse the list of items.
*/
toggleListFullScreen() {
this.listFullScreen = !this.listFullScreen;
if (!this.listFullScreen) {
this.$nextTick(() => {
this.resizeCallback();
});
}
},
/**
* Updates the dictionary of selected tags.
* @return {Object} Dictionary containing selected tags
*/
updateSelectedDic() {
let reg;
try {
reg = new RegExp(this.searchInput);
} catch (e) {
reg = new RegExp(this.valiableSearchInput);
}
this.multiSelectedItemNames = {};
let itemSelectAll = true;
this.checkListArr.forEach((listItem) => {
if (reg.test(listItem.label)) {
listItem.show = true;
if (listItem.checked) {
this.multiSelectedItemNames[listItem.label] = true;
} else {
itemSelectAll = false;
}
} else {
listItem.show = false;
}
});
this.operateSelectAll = itemSelectAll;
this.resizeCallback();
return this.multiSelectedItemNames;
},
},
destroyed() {
// Remove the listener of window size change
window.removeEventListener('resize', this.resizeCallback);
// Remove filter timer
if (this.searchInputTimer) {
clearTimeout(this.searchInputTimer);
this.searchInputTimer = null;
}
},
};
</script>
<style lang="scss">
.cl-checklist-container {
width: 100%;
height: 100%;
.select-content {
display: flex;
align-items: center;
.title {
font-size: 14px;
vertical-align: middle;
flex-shrink: 0;
}
.select-all {
cursor: pointer;
flex-shrink: 0;
}
.select-item-content {
display: flex;
height: 16px;
flex-wrap: wrap;
overflow: hidden;
text-overflow: ellipsis;
}
.select-content-open {
flex: 1;
text-align: right;
font-size: 14px;
color: #00a5a7;
cursor: pointer;
min-width: 60px;
}
}
.select-content-all {
max-height: 150px;
padding-left: 72px;
overflow-x: hidden;
display: flex;
flex-wrap: wrap;
.label-item {
line-height: 14px;
}
.select-item {
height: 25px;
margin-top: 25px;
}
}
.select-item {
margin-right: 20px;
flex-shrink: 0;
margin-bottom: 1px;
cursor: pointer;
.label-item {
width: 100px;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text-align: left;
}
}
.multiCheckBox-border {
width: 16px;
height: 16px;
display: block;
margin-right: 20px;
cursor: pointer;
float: left;
}
.checkbox-checked {
background-image: url('../assets/images/mult-select.png');
}
.checkbox-unchecked {
background-image: url('../assets/images/mult-unselect.png');
}
.label-item {
font-size: 14px;
line-height: 14px;
vertical-align: middle;
.el-tooltip {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text-align: left;
height: 16px;
}
span {
font-size: 14px;
line-height: 14px;
display: block;
}
}
.mr24 {
margin-right: 24px;
}
.select-disable {
-moz-user-select: none; /*Firefox*/
-webkit-user-select: none; /*webkitbrowser*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*Early browser*/
user-select: none;
}
.search-input-item {
width: 261px;
}
}
.tooltip-show-content {
max-width: 50%;
}
</style>
...@@ -124,6 +124,13 @@ ...@@ -124,6 +124,13 @@
"tooManyNodes": "节点太多,打开失败", "tooManyNodes": "节点太多,打开失败",
"inputNodeName": "请输入节点名称" "inputNodeName": "请输入节点名称"
}, },
"components": {
"tagSelectTitle": "标签选择",
"selectAll": "全选",
"tagFilterPlaceHolder": "请输入需要的标签(支持正则表达式)",
"open": "展开",
"close": "折叠"
},
"error": { "error": {
"50540000": "系统错误", "50540000": "系统错误",
"50540001": "参数类型错误,请检查请求参数类型是否都符合要求", "50540001": "参数类型错误,请检查请求参数类型是否都符合要求",
...@@ -133,7 +140,6 @@ ...@@ -133,7 +140,6 @@
"50545001": "API 路由资源不存在", "50545001": "API 路由资源不存在",
"50545002": "请求API的HTTP方法错误", "50545002": "请求API的HTTP方法错误",
"50545005": "训练作业不存在", "50545005": "训练作业不存在",
"50545006": "Summary日志路径无效",
"50545007": "Summary数据正在被加载,请等待Summary数据加载结束", "50545007": "Summary数据正在被加载,请等待Summary数据加载结束",
"50545009": "查询的节点不在图中", "50545009": "查询的节点不在图中",
"5054500A": "训练作业ID进行URL解码失败", "5054500A": "训练作业ID进行URL解码失败",
......
...@@ -42,21 +42,6 @@ router.beforeEach((to, from, next) => { ...@@ -42,21 +42,6 @@ router.beforeEach((to, from, next) => {
// forbidden showing production tip // forbidden showing production tip
Vue.config.productionTip = false; Vue.config.productionTip = false;
/**
* Check whether the input string contains special characters
* @param {String} strurl
* @return {Boolen}
*/
function justSql(strurl) {
const reA = /select|create|alert|update|delete|truncate/i;
const reB = /join|union|exec|insert|drop|count|'|"|;|>|</i;
const reAll = new RegExp(reA.source + reB.source, 'i');
if (reAll.test(strurl)) {
return true;
} else {
return false;
}
}
/** /**
* Check the browser version * Check the browser version
...@@ -83,9 +68,6 @@ function isBrowserSupport() { ...@@ -83,9 +68,6 @@ function isBrowserSupport() {
} }
window.onload = function(e) { window.onload = function(e) {
if (justSql(location.hash.toLowerCase())) {
location.href = location.origin;
} else {
if (isBrowserSupport()) { if (isBrowserSupport()) {
Vue.prototype.$warmBrowser = true; Vue.prototype.$warmBrowser = true;
} }
...@@ -98,5 +80,4 @@ window.onload = function(e) { ...@@ -98,5 +80,4 @@ window.onload = function(e) {
render: (h) => h(App), render: (h) => h(App),
}).$mount('#app'); }).$mount('#app');
}, 100); }, 100);
}
}; };
...@@ -50,7 +50,7 @@ axios.interceptors.response.use( ...@@ -50,7 +50,7 @@ axios.interceptors.response.use(
// error returned by backend // error returned by backend
if (error.response && error.response.data && error.response.data.error_code) { if (error.response && error.response.data && error.response.data.error_code) {
if (error.response.data.error_code.toString() === '50540005' || if (error.response.data.error_code.toString() === '50545005' ||
error.response.data.error_code.toString() === '50545006') { error.response.data.error_code.toString() === '50545006') {
if (error.config.headers.ignoreError || if (error.config.headers.ignoreError ||
router.currentRoute.path === '/train-manage/training-dashboard') { router.currentRoute.path === '/train-manage/training-dashboard') {
......
...@@ -850,6 +850,7 @@ export default { ...@@ -850,6 +850,7 @@ export default {
} }
}) })
.catch(() => { .catch(() => {
this.fileSearchBox.suggestions = [];
this.initOver = true; this.initOver = true;
this.loading.show = false; this.loading.show = false;
}); });
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<template> <template>
<div id='cl-model-traceback'> <div id="cl-model-traceback">
<div class="cl-model-right"> <div class="cl-model-right">
<div class="checkbox-area" <div class="checkbox-area"
v-if="!noData && echart.allData.length"> v-if="!noData && echart.allData.length">
...@@ -22,33 +22,28 @@ limitations under the License. ...@@ -22,33 +22,28 @@ limitations under the License.
@click="resetChart" @click="resetChart"
type="primary" type="primary"
size="mini" size="mini"
plain> plain>{{ $t('modelTraceback.showAllData') }}</el-button>
{{$t('modelTraceback.showAllData')}}
</el-button>
<div class="checkbox"> <div class="checkbox">
<el-checkbox v-for="item in table.mandatoryColumn" <el-checkbox v-for="item in table.mandatoryColumn"
:key="item" :key="item"
:label="item" :label="item"
:checked="true" :checked="true"
:disabled="true" :disabled="true"
:class="table.optionsNotInCheckbox.includes(item)?'notShow': ''"> :class="table.optionsNotInCheckbox.includes(item) ? 'notShow' : ''">
{{table.columnOptions[item].label}} {{ table.columnOptions[item].label }}</el-checkbox>
</el-checkbox> <br />
<br>
<el-checkbox class="select-all" <el-checkbox class="select-all"
v-model="table.selectAll" v-model="table.selectAll"
:indeterminate="table.isIndeterminate" :indeterminate="table.isIndeterminate"
@change="checkboxSelectAll"> @change="checkboxSelectAll">{{ $t('scalar.selectAll') }}</el-checkbox>
{{$t('scalar.selectAll')}}
</el-checkbox>
<el-checkbox-group v-model="table.selectedColumn" <el-checkbox-group v-model="table.selectedColumn"
@change="columnSelectionChange"> @change="columnSelectionChange">
<el-checkbox v-for="item in table.optionalColumn" <el-checkbox v-for="item in table.optionalColumn"
:key="item" :key="item"
:label="item" :label="item"
:class="table.optionsNotInCheckbox.includes(item)?'notShow': 'option'"> :class="
{{table.columnOptions[item].label}} table.optionsNotInCheckbox.includes(item) ? 'notShow' : 'option'
</el-checkbox> ">{{ table.columnOptions[item].label }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</div> </div>
...@@ -62,24 +57,30 @@ limitations under the License. ...@@ -62,24 +57,30 @@ limitations under the License.
tooltip-effect="light" tooltip-effect="light"
height="calc(100% - 40px)" height="calc(100% - 40px)"
@selection-change="selectionChange" @selection-change="selectionChange"
@sort-change='sortChange' @sort-change="sortChange"
row-key="summary_dir"> row-key="summary_dir">
<el-table-column type="selection" <el-table-column type="selection"
width="55" width="55"
v-if="table.data.length" v-if="table.data.length"
:reserve-selection="true"> :reserve-selection="true"></el-table-column>
</el-table-column>
<el-table-column v-for="key in table.column" <el-table-column v-for="key in table.column"
:key="key" :key="key"
:prop="key" :prop="key"
:label="table.columnOptions[key].label" :label="table.columnOptions[key].label"
show-overflow-tooltip show-overflow-tooltip
min-width='150' min-width="180"
sortable='custom'> sortable="custom">
<template slot="header"
slot-scope="scope">
<div class="custom-label"
:title="scope.column.label">
{{ scope.column.label }}
</div>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<a v-if="key === 'summary_dir'" <a v-if="key === 'summary_dir'"
@click="jumpToTrainDashboard(scope.row[key])">{{scope.row[key]}}</a> @click="jumpToTrainDashboard(scope.row[key])">{{ scope.row[key] }}</a>
<span v-else> {{formatNumber(key, scope.row[key])}}</span> <span v-else>{{ formatNumber(key, scope.row[key]) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -87,17 +88,14 @@ limitations under the License. ...@@ -87,17 +88,14 @@ limitations under the License.
:current-page="pagination.currentPage" :current-page="pagination.currentPage"
:page-size="pagination.pageSize" :page-size="pagination.pageSize"
:layout="pagination.layout" :layout="pagination.layout"
:total="pagination.total"> :total="pagination.total"></el-pagination>
</el-pagination>
</div> </div>
<div v-if="noData" <div v-if="noData"
class="no-data-page"> class="no-data-page">
<div class="no-data-img"> <div class="no-data-img">
<img :src="require('@/assets/images/nodata.png')" <img :src="require('@/assets/images/nodata.png')"
alt="" /> alt />
<p class='no-data-text'> <p class="no-data-text">{{ $t('public.noData') }}</p>
{{$t("public.noData")}}
</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -283,7 +281,6 @@ export default { ...@@ -283,7 +281,6 @@ export default {
(res) => { (res) => {
if (res && res.data && res.data.object) { if (res && res.data && res.data.object) {
const list = JSON.parse(JSON.stringify(res.data.object)); const list = JSON.parse(JSON.stringify(res.data.object));
const metricKeys = {};
list.forEach((i) => { list.forEach((i) => {
i.model_size = parseFloat( i.model_size = parseFloat(
((i.model_size || 0) / 1024 / 1024).toFixed(2), ((i.model_size || 0) / 1024 / 1024).toFixed(2),
...@@ -292,23 +289,40 @@ export default { ...@@ -292,23 +289,40 @@ export default {
if (keys.length) { if (keys.length) {
keys.forEach((key) => { keys.forEach((key) => {
if (i.metric[key] || i.metric[key] === 0) { if (i.metric[key] || i.metric[key] === 0) {
const temp = 'metric_' + key; const temp = 'metric/' + key;
metricKeys[temp] = key;
i[temp] = i.metric[key]; i[temp] = i.metric[key];
} }
}); });
delete i.metric; delete i.metric;
} }
const udkeys = Object.keys(i.user_defined || {});
if (udkeys.length) {
udkeys.forEach((key) => {
if (i.user_defined[key] || i.user_defined[key] === 0) {
const temp = 'user_defined/' + key;
i[temp] = i.user_defined[key];
}
});
delete i.user_defined;
}
}); });
if (allData) { if (allData) {
const obj = {}; if (res.data.customized) {
Object.keys(metricKeys).forEach((key) => { const customized = JSON.parse(
obj[key] = { JSON.stringify(res.data.customized),
label: metricKeys[key], );
required: true, const customizedKeys = Object.keys(customized);
}; if (customizedKeys.length > 0) {
const metricColumnOptions = {};
const userDefinedColumnOptions = {};
customizedKeys.forEach((key) => {
const str = key.substring(0, key.indexOf('/'));
if ('metric' === str) {
metricColumnOptions[key] = customized[key];
} else if ('user_defined' === str) {
userDefinedColumnOptions[key] = customized[key];
}
}); });
this.table.columnOptions = Object.assign( this.table.columnOptions = Object.assign(
{ {
summary_dir: { summary_dir: {
...@@ -320,9 +334,19 @@ export default { ...@@ -320,9 +334,19 @@ export default {
required: true, required: true,
}, },
}, },
obj, metricColumnOptions,
userDefinedColumnOptions,
this.table.columnOptions, this.table.columnOptions,
); );
customizedKeys.forEach((i) => {
if (customized[i].type === 'int') {
this.keysOfIntValue.push(i);
} else if (customized[i].type === 'str') {
this.keysOfStringValue.push(i);
}
});
}
}
this.noData = !!!res.data.object.length; this.noData = !!!res.data.object.length;
this.echart.allData = list; this.echart.allData = list;
...@@ -438,12 +462,22 @@ export default { ...@@ -438,12 +462,22 @@ export default {
if (keys.length) { if (keys.length) {
keys.forEach((key) => { keys.forEach((key) => {
if (i.metric[key] || i.metric[key] === 0) { if (i.metric[key] || i.metric[key] === 0) {
const temp = 'metric_' + key; const temp = 'metric/' + key;
i[temp] = i.metric[key]; i[temp] = i.metric[key];
} }
}); });
delete i.metric; delete i.metric;
} }
const udkeys = Object.keys(i.user_defined || {});
if (udkeys.length) {
udkeys.forEach((key) => {
if (i.user_defined[key] || i.user_defined[key] === 0) {
const temp = 'user_defined/' + key;
i[temp] = i.user_defined[key];
}
});
delete i.user_defined;
}
}); });
this.table.data = list; this.table.data = list;
this.pagination.total = res.data.count || 0; this.pagination.total = res.data.count || 0;
...@@ -508,6 +542,9 @@ export default { ...@@ -508,6 +542,9 @@ export default {
const echartOption = { const echartOption = {
backgroundColor: 'white', backgroundColor: 'white',
parallelAxis: parallelAxis, parallelAxis: parallelAxis,
tooltip: {
trigger: 'axis',
},
parallel: { parallel: {
top: 25, top: 25,
left: 50, left: 50,
...@@ -540,6 +577,9 @@ export default { ...@@ -540,6 +577,9 @@ export default {
areaSelectStyle: { areaSelectStyle: {
width: 40, width: 40,
}, },
tooltip: {
show: true,
},
realtime: false, realtime: false,
}, },
}, },
...@@ -618,12 +658,22 @@ export default { ...@@ -618,12 +658,22 @@ export default {
if (keys.length) { if (keys.length) {
keys.forEach((key) => { keys.forEach((key) => {
if (i.metric[key] || i.metric[key] === 0) { if (i.metric[key] || i.metric[key] === 0) {
const temp = 'metric_' + key; const temp = 'metric/' + key;
i[temp] = i.metric[key]; i[temp] = i.metric[key];
} }
}); });
delete i.metric; delete i.metric;
} }
const udkeys = Object.keys(i.user_defined || {});
if (udkeys.length) {
udkeys.forEach((key) => {
if (i.user_defined[key] || i.user_defined[key] === 0) {
const temp = 'user_defined/' + key;
i[temp] = i.user_defined[key];
}
});
delete i.user_defined;
}
}); });
this.echart.showData = this.echart.brushData = list; this.echart.showData = this.echart.brushData = list;
...@@ -805,6 +855,11 @@ export default { ...@@ -805,6 +855,11 @@ export default {
height: calc(60% - 74px); height: calc(60% - 74px);
padding: 12px 32px; padding: 12px 32px;
position: relative; position: relative;
.custom-label {
max-width: calc(100% - 25px);
padding: 0;
vertical-align: middle;
}
a { a {
cursor: pointer; cursor: pointer;
} }
......
...@@ -553,12 +553,8 @@ export default { ...@@ -553,12 +553,8 @@ export default {
if (this.curPageArr.length > 0) { if (this.curPageArr.length > 0) {
this.curPageArr.forEach((sampleObject, yIndex) => { this.curPageArr.forEach((sampleObject, yIndex) => {
const runCount = sampleObject.runId.length;
if (runCount === 0) {
return;
}
const params = { const params = {
train_id: sampleObject.runId[0], train_id: this.trainingJobId,
tag: sampleObject.tagName, tag: sampleObject.tagName,
}; };
ajaxArr.push(this.addAjax(params, yIndex)); ajaxArr.push(this.addAjax(params, yIndex));
...@@ -574,15 +570,12 @@ export default { ...@@ -574,15 +570,12 @@ export default {
return; return;
} }
this.curPageArr.forEach((sampleObject, yIndex) => { this.curPageArr.forEach((sampleObject, yIndex) => {
sampleObject.runNames.forEach((runName, runNameIndex) => { sampleObject.colors=
sampleObject.colors.push(
CommonProperty.commonColorArr[this.colorNum] CommonProperty.commonColorArr[this.colorNum]
? CommonProperty.commonColorArr[this.colorNum] ? CommonProperty.commonColorArr[this.colorNum]
: CommonProperty.commonColorArr[this.defColorCount - 1], : CommonProperty.commonColorArr[this.defColorCount - 1];
);
this.colorNum++; this.colorNum++;
}); });
});
this.colorNum = 0; this.colorNum = 0;
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
if (!res[i] || !res[i].data) { if (!res[i] || !res[i].data) {
...@@ -600,9 +593,8 @@ export default { ...@@ -600,9 +593,8 @@ export default {
color: CommonProperty.commonColorArr[this.colorNum] color: CommonProperty.commonColorArr[this.colorNum]
? CommonProperty.commonColorArr[this.colorNum] ? CommonProperty.commonColorArr[this.colorNum]
: CommonProperty.commonColorArr[this.defColorCount - 1], : CommonProperty.commonColorArr[this.defColorCount - 1],
runName: this.returnRunName(this.trainingJobId), runName: this.trainingJobId,
curBackName: curBackName: this.trainingJobId + this.backendString,
this.returnRunName(this.trainingJobId) + this.backendString,
tagName: res[i].params.tag, tagName: res[i].params.tag,
}; };
let relativeTimeBench = 0; let relativeTimeBench = 0;
...@@ -639,22 +631,6 @@ export default { ...@@ -639,22 +631,6 @@ export default {
} }
}, },
/**
* return run name
* @param {String} id
* @return {String}
*/
returnRunName(id) {
if (!id) {
return;
}
let runName = '';
if (this.curPageArr[0].runNames[0]) {
runName = this.curPageArr[0].runNames[0];
}
return runName;
},
/** /**
* add request * add request
......
...@@ -212,9 +212,6 @@ export default { ...@@ -212,9 +212,6 @@ export default {
propsList: [], // dataList props propsList: [], // dataList props
smoothValue: 0, // Initial smoothness of the slider smoothValue: 0, // Initial smoothness of the slider
smoothSliderValueTimer: null, // Smoothness slider timer smoothSliderValueTimer: null, // Smoothness slider timer
// Number of predefined colors
defColorCount: CommonProperty.commonColorArr.length,
curAvlColorIndexArr: [], // color subscript
DomIdIndex: 0, // DomId num DomIdIndex: 0, // DomId num
originDataArr: [], // Original data originDataArr: [], // Original data
curPageArr: [], // data of the current page curPageArr: [], // data of the current page
...@@ -329,9 +326,6 @@ export default { ...@@ -329,9 +326,6 @@ export default {
// Adding a Listener // Adding a Listener
this.getCharMainContentwidth(); this.getCharMainContentwidth();
// Initialize available colors
this.initAvlColorArr();
// Initializing Data // Initializing Data
this.getScalarsList(); this.getScalarsList();
...@@ -367,13 +361,9 @@ export default { ...@@ -367,13 +361,9 @@ export default {
const tempTagList = []; const tempTagList = [];
const dataList = []; const dataList = [];
const propsList = []; const propsList = [];
const data = res.data.train_jobs; const data = res.data.train_jobs[0];
data.forEach((runObj, runObjectIndex) => { const runNmeColor = CommonProperty.commonColorArr[0];
const colorIndex = this.curAvlColorIndexArr.length data.tags.forEach((tagObj) => {
? this.curAvlColorIndexArr.shift()
: this.defColorCount - 1;
const runNmeColor = CommonProperty.commonColorArr[colorIndex];
runObj.tags.forEach((tagObj) => {
// Add the tag list // Add the tag list
this.multiSelectedTagNames[tagObj] = true; this.multiSelectedTagNames[tagObj] = true;
tempTagList.push({ tempTagList.push({
...@@ -387,9 +377,8 @@ export default { ...@@ -387,9 +377,8 @@ export default {
// Adding Chart Data // Adding Chart Data
dataList.push({ dataList.push({
tagName: tagObj, tagName: tagObj,
runNames: [runObj.name], runNames: data.name,
colors: [runNmeColor], colors: runNmeColor,
runId: [runObj.id],
show: false, show: false,
updateFlag: false, updateFlag: false,
dataRemove: false, dataRemove: false,
...@@ -407,13 +396,11 @@ export default { ...@@ -407,13 +396,11 @@ export default {
propsList.push({ propsList.push({
tagName: tagObj, tagName: tagObj,
runNames: [runObj.name], runNames: data.name,
runId: [runObj.id], colors: '',
colors: [],
}); });
this.DomIdIndex++; this.DomIdIndex++;
}); });
});
this.tagOperateList = tempTagList; this.tagOperateList = tempTagList;
this.tagPropsList = JSON.parse(JSON.stringify(tempTagList)); this.tagPropsList = JSON.parse(JSON.stringify(tempTagList));
if (dataList.length === 1) { if (dataList.length === 1) {
...@@ -485,15 +472,11 @@ export default { ...@@ -485,15 +472,11 @@ export default {
return; return;
} }
sampleObject.updateFlag = true; sampleObject.updateFlag = true;
const runCount = sampleObject.runId.length;
if (runCount === 0) {
return;
}
const promiseArr = []; const promiseArr = [];
const params = { const params = {
train_id: sampleObject.runId[0], train_id: this.trainingJobId,
tag: sampleObject.tagName, tag: sampleObject.tagName,
}; };
...@@ -629,7 +612,7 @@ export default { ...@@ -629,7 +612,7 @@ export default {
let returnFlag = false; let returnFlag = false;
const seriesData = []; const seriesData = [];
const oriData = sampleObject.charData.oriData; const oriData = sampleObject.charData.oriData;
sampleObject.runNames.forEach((runName, runNameIndex) => { const runName=sampleObject.runNames;
const curBackName = runName + this.backendString; const curBackName = runName + this.backendString;
const dataObj = { const dataObj = {
name: runName, name: runName,
...@@ -637,7 +620,7 @@ export default { ...@@ -637,7 +620,7 @@ export default {
type: 'line', type: 'line',
showSymbol: false, showSymbol: false,
lineStyle: { lineStyle: {
color: sampleObject.colors[runNameIndex], color: sampleObject.colors,
}, },
}; };
const dataObjBackend = { const dataObjBackend = {
...@@ -647,11 +630,11 @@ export default { ...@@ -647,11 +630,11 @@ export default {
smooth: 0, smooth: 0,
symbol: 'none', symbol: 'none',
lineStyle: { lineStyle: {
color: sampleObject.colors[runNameIndex], color: sampleObject.colors,
opacity: 0.2, opacity: 0.2,
}, },
}; };
const curOriData = oriData[runNameIndex]; const curOriData = oriData[0];
if (curOriData) { if (curOriData) {
if (sampleObject.log) { if (sampleObject.log) {
...@@ -670,7 +653,6 @@ export default { ...@@ -670,7 +653,6 @@ export default {
} }
seriesData.push(dataObj, dataObjBackend); seriesData.push(dataObj, dataObjBackend);
});
if (returnFlag) { if (returnFlag) {
return; return;
} }
...@@ -884,7 +866,7 @@ export default { ...@@ -884,7 +866,7 @@ export default {
}); });
strBody += strBody +=
`<tr><td style="border-radius:50%;width:15px;height:15px;vertical-align: middle;` + `<tr><td style="border-radius:50%;width:15px;height:15px;vertical-align: middle;` +
`margin-right: 5px;background-color:${sampleObject.colors[curIndex]};` + `margin-right: 5px;background-color:${sampleObject.colors};` +
`display:inline-block;"></td><td>${parma.seriesName}</td>` + `display:inline-block;"></td><td>${parma.seriesName}</td>` +
`<td>${that.formateYaxisValue(parma.value[1])}</td>` + `<td>${that.formateYaxisValue(parma.value[1])}</td>` +
`<td>${that.formateYaxisValue( `<td>${that.formateYaxisValue(
...@@ -1292,16 +1274,6 @@ export default { ...@@ -1292,16 +1274,6 @@ export default {
window.addEventListener('resize', this.resizeCallback, false); window.addEventListener('resize', this.resizeCallback, false);
}, },
/**
* Initialize the color array
*/
initAvlColorArr() {
const length = this.defColorCount;
for (let i = 0; i < length; i++) {
this.curAvlColorIndexArr.push(i);
}
},
/** /**
* Clear data * Clear data
...@@ -1368,16 +1340,13 @@ export default { ...@@ -1368,16 +1340,13 @@ export default {
const tagList = []; // tag list const tagList = []; // tag list
let dataRemoveFlag = false; let dataRemoveFlag = false;
// Obtains the current tag and run list // Obtains the current tag and run list
oriData.forEach((runObj, runIndex) => { oriData.tags.forEach((tagObj) => {
runObj.tags.forEach((tagObj) => {
let sameTagIndex = tagList.indexOf(tagObj); let sameTagIndex = tagList.indexOf(tagObj);
if (sameTagIndex === -1) { if (sameTagIndex === -1) {
sameTagIndex = tagList.length; sameTagIndex = tagList.length;
tagList.push(tagObj); tagList.push(tagObj);
} }
}); });
});
// Delete the tag that does not exist // Delete the tag that does not exist
const oldTagListLength = this.tagOperateList.length; const oldTagListLength = this.tagOperateList.length;
for (let i = oldTagListLength - 1; i >= 0; i--) { for (let i = oldTagListLength - 1; i >= 0; i--) {
...@@ -1419,12 +1388,9 @@ export default { ...@@ -1419,12 +1388,9 @@ export default {
return false; return false;
} }
let dataAddFlag = false; let dataAddFlag = false;
oriData.forEach((runObj) => { // oriData.forEach((runObj) => {
const colorIndex = this.curAvlColorIndexArr.length const runColor = CommonProperty.commonColorArr[0];
? this.curAvlColorIndexArr.shift() oriData.tags.forEach((tagObj) => {
: this.defColorCount - 1;
const runColor = CommonProperty.commonColorArr[colorIndex];
runObj.tags.forEach((tagObj) => {
let sameTagIndex = -1; let sameTagIndex = -1;
this.tagOperateList.some((tagItem, tagIndex) => { this.tagOperateList.some((tagItem, tagIndex) => {
if (tagItem.label === tagObj) { if (tagItem.label === tagObj) {
...@@ -1442,9 +1408,8 @@ export default { ...@@ -1442,9 +1408,8 @@ export default {
dataAddFlag = true; dataAddFlag = true;
this.originDataArr.push({ this.originDataArr.push({
tagName: tagObj, tagName: tagObj,
runNames: [runObj.name], runNames: oriData.name,
runId: [runObj.id], colors: runColor,
colors: [runColor],
show: false, show: false,
updateFlag: false, updateFlag: false,
dataRemove: false, dataRemove: false,
...@@ -1460,18 +1425,7 @@ export default { ...@@ -1460,18 +1425,7 @@ export default {
charObj: null, charObj: null,
}); });
this.DomIdIndex++; this.DomIdIndex++;
} else {
const sameSampleObj = this.originDataArr[sameTagIndex];
if (
sameSampleObj &&
sameSampleObj.runNames.indexOf(runObj.name) === -1
) {
sameSampleObj.runNames.push(runObj.name);
sameSampleObj.runId.push(runObj.id);
sameSampleObj.colors.push(runColor);
} }
}
});
}); });
return dataAddFlag; return dataAddFlag;
...@@ -1540,7 +1494,7 @@ export default { ...@@ -1540,7 +1494,7 @@ export default {
this.clearAllData(); this.clearAllData();
return; return;
} }
const data = res.data.train_jobs; const data = res.data.train_jobs[0];
// Delete the data that does not exist // Delete the data that does not exist
const tagRemoveFlag = this.removeNonexistentData(data); const tagRemoveFlag = this.removeNonexistentData(data);
...@@ -1561,9 +1515,8 @@ export default { ...@@ -1561,9 +1515,8 @@ export default {
const tempTagList = []; const tempTagList = [];
const propsList = []; const propsList = [];
data.forEach((runObj, runObjectIndex) => {
// Initial chart data // Initial chart data
runObj.tags.forEach((tagObj) => { data.tags.forEach((tagObj) => {
// Check whether the tag with the same name exists // Check whether the tag with the same name exists
tempTagList.push({ tempTagList.push({
label: tagObj, label: tagObj,
...@@ -1574,10 +1527,8 @@ export default { ...@@ -1574,10 +1527,8 @@ export default {
// Add the tag list. // Add the tag list.
propsList.push({ propsList.push({
tagName: tagObj, tagName: tagObj,
runNames: [runObj.name], runNames: data.name,
runId: [runObj.id], colors: '',
colors: [],
});
}); });
}); });
this.tagPropsList = tempTagList; this.tagPropsList = tempTagList;
...@@ -1796,10 +1747,6 @@ export default { ...@@ -1796,10 +1747,6 @@ export default {
if (this.abort) { if (this.abort) {
this.curPageArr.forEach((sampleObject) => { this.curPageArr.forEach((sampleObject) => {
let runCount = sampleObject.runNames.length;
sampleObject.runNames.forEach((runName, runNameIndex) => {
runCount--;
if (runCount === 0) {
this.$nextTick(() => { this.$nextTick(() => {
// Draw chart // Draw chart
if (!this.compare) { if (!this.compare) {
...@@ -1808,8 +1755,6 @@ export default { ...@@ -1808,8 +1755,6 @@ export default {
this.abort = true; this.abort = true;
} }
}); });
}
});
}); });
this.abort = false; this.abort = false;
} }
......
...@@ -29,7 +29,7 @@ limitations under the License. ...@@ -29,7 +29,7 @@ limitations under the License.
<div class="cl-dashboard-title"> {{$t("trainingDashboard.trainingScalar")}}</div> <div class="cl-dashboard-title"> {{$t("trainingDashboard.trainingScalar")}}</div>
<div class="cl-module"> <div class="cl-module">
<div class="cl-scalar-tagName" <div class="cl-scalar-tagName"
v-if="curPageArr.length && !wrongPlugin"> v-show="curPageArr.length && !wrongPlugin">
<div v-for="(sampleItem,index) in curPageArr" <div v-for="(sampleItem,index) in curPageArr"
:key="index" :key="index"
:class="['tagNameLeft',index==1? 'tagNameRight':'']"> :class="['tagNameLeft',index==1? 'tagNameRight':'']">
...@@ -37,10 +37,10 @@ limitations under the License. ...@@ -37,10 +37,10 @@ limitations under the License.
</div> </div>
</div> </div>
<div id="module-chart" <div id="module-chart"
v-if="curPageArr.length && !wrongPlugin" v-show="curPageArr.length && !wrongPlugin"
key="chart-data"></div> key="chart-data"></div>
<div class="no-data-img" <div class="no-data-img"
v-if="!curPageArr.length || wrongPlugin" v-show="!curPageArr.length || wrongPlugin"
key="no-chart-data"> key="no-chart-data">
<img :src="require('@/assets/images/nodata.png')" <img :src="require('@/assets/images/nodata.png')"
alt="" /> alt="" />
...@@ -107,12 +107,12 @@ limitations under the License. ...@@ -107,12 +107,12 @@ limitations under the License.
:class="originImageDataArr.length && !wrongPlugin ? '' : 'no-data-img'"> :class="originImageDataArr.length && !wrongPlugin ? '' : 'no-data-img'">
<img class="sample-img select-disable" <img class="sample-img select-disable"
:src="curImageShowSample.curImgUrl" :src="curImageShowSample.curImgUrl"
v-if="originImageDataArr.length && !wrongPlugin"> v-show="originImageDataArr.length && !wrongPlugin">
<img :src="require('@/assets/images/nodata.png')" <img :src="require('@/assets/images/nodata.png')"
alt="" alt=""
v-if="!originImageDataArr.length || wrongPlugin"> v-show="!originImageDataArr.length || wrongPlugin">
<p class='no-data-text' <p class='no-data-text'
v-if=" !originImageDataArr.length || wrongPlugin"> v-show=" !originImageDataArr.length || wrongPlugin">
{{$t("public.noData")}} {{$t("public.noData")}}
</p> </p>
</div> </div>
...@@ -615,7 +615,7 @@ export default { ...@@ -615,7 +615,7 @@ export default {
}, },
grid: { grid: {
top: 20, top: 20,
bottom: 50, bottom: 66,
left: 66, left: 66,
right: 60, right: 60,
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册