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

!435 UI display the error message in table area

Merge pull request !435 from 夏易凡/0710master
...@@ -20,7 +20,11 @@ limitations under the License. ...@@ -20,7 +20,11 @@ limitations under the License.
class="error-msg-container"> class="error-msg-container">
{{$t('components.gridIncorrectDataError')}} {{$t('components.gridIncorrectDataError')}}
</div> </div>
<div v-show="!fullData.length && updated && !incorrectData" <div v-show="!incorrectData && requestError"
class="error-msg-container">
{{errorMsg}}
</div>
<div v-show="!fullData.length && updated && !incorrectData && !requestError"
class="error-msg-container"> class="error-msg-container">
{{$t('components.gridTableNoData')}} {{$t('components.gridTableNoData')}}
</div> </div>
...@@ -29,7 +33,7 @@ limitations under the License. ...@@ -29,7 +33,7 @@ limitations under the License.
class="grid-item"></div> class="grid-item"></div>
</div> </div>
<div class="operate-container" <div class="operate-container"
v-if="showOperate && fullData.length"> v-if="(showOperate && fullData.length) || requestError">
<div class="filter-container" <div class="filter-container"
@keyup.enter="filterChange"> @keyup.enter="filterChange">
<div v-for="(item, itemIndex) in filterArr" <div v-for="(item, itemIndex) in filterArr"
...@@ -114,6 +118,8 @@ export default { ...@@ -114,6 +118,8 @@ export default {
updated: false, // Updated updated: false, // Updated
scrollTop: false, // Wheather scroll to the top scrollTop: false, // Wheather scroll to the top
filterCorrect: true, // Wheather the dimension input is correct filterCorrect: true, // Wheather the dimension input is correct
requestError: false, // Exceeded the specification
errorMsg: '', // Error message
viewResizeFlag: false, // Size reset flag viewResizeFlag: false, // Size reset flag
// Accuray options // Accuray options
accuracyArr: [ accuracyArr: [
...@@ -126,6 +132,7 @@ export default { ...@@ -126,6 +132,7 @@ export default {
], ],
// Table configuration items // Table configuration items
optionObj: { optionObj: {
enableColumnReorder: false,
enableCellNavigation: true, enableCellNavigation: true,
frozenColumn: 0, frozenColumn: 0,
frozenRow: 0, frozenRow: 0,
...@@ -348,6 +355,7 @@ export default { ...@@ -348,6 +355,7 @@ export default {
*/ */
updateGridData(newDataFlag, dimension, statistics, filterStr) { updateGridData(newDataFlag, dimension, statistics, filterStr) {
this.updated = true; this.updated = true;
this.requestError = false;
this.$nextTick(() => { this.$nextTick(() => {
if (!this.fullData || !this.fullData.length) { if (!this.fullData || !this.fullData.length) {
return; return;
...@@ -369,7 +377,7 @@ export default { ...@@ -369,7 +377,7 @@ export default {
*/ */
resizeView() { resizeView() {
if (this.gridObj) { if (this.gridObj) {
if (this.incorrectData) { if (this.incorrectData || this.requestError) {
this.viewResizeFlag = true; this.viewResizeFlag = true;
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -385,6 +393,19 @@ export default { ...@@ -385,6 +393,19 @@ export default {
toggleFullScreen() { toggleFullScreen() {
this.$emit('toggleFullScreen'); this.$emit('toggleFullScreen');
}, },
/**
* Show Error message
* @param {String} errorMsg Error message
* @param {Array} dimension Array of dimension
* @param {String} filterStr String of dimension selection
*/
showRequestErrorMessage(errorMsg, dimension, filterStr) {
this.errorMsg = errorMsg;
if (!this.filterArr.length) {
this.initializeFilterArr(dimension, filterStr);
}
this.requestError = true;
},
}, },
destroyed() {}, destroyed() {},
}; };
......
...@@ -61,6 +61,9 @@ axios.interceptors.response.use( ...@@ -61,6 +61,9 @@ axios.interceptors.response.use(
} else if ( router.currentRoute.path === '/profiling/profiling-dashboard' && } else if ( router.currentRoute.path === '/profiling/profiling-dashboard' &&
error.config.headers.ignoreError ) { error.config.headers.ignoreError ) {
return Promise.reject(error); return Promise.reject(error);
} else if ( error.response.data.error_code.toString() === '50545013' &&
router.currentRoute.path === '/train-manage/tensor') {
return Promise.reject(error);
} }
if (errorData[error.response.data.error_code]) { if (errorData[error.response.data.error_code]) {
Vue.prototype.$message.error(errorData[error.response.data.error_code]); Vue.prototype.$message.error(errorData[error.response.data.error_code]);
......
...@@ -117,6 +117,9 @@ limitations under the License. ...@@ -117,6 +117,9 @@ limitations under the License.
:viewName="curViewName" :viewName="curViewName"
:axisName="curAxisName" :axisName="curAxisName"
:fullData="sampleItem.curData"></histogramUntil> :fullData="sampleItem.curData"></histogramUntil>
<div class="loading-cover"
v-if="sampleItem.showLoading">
<i class="el-icon-loading"></i></div>
</div> </div>
<!-- Information display area --> <!-- Information display area -->
<div class="sample-data-show" <div class="sample-data-show"
...@@ -378,6 +381,7 @@ export default { ...@@ -378,6 +381,7 @@ export default {
tagName: tagName, tagName: tagName,
summaryName: this.trainingJobId, summaryName: this.trainingJobId,
show: false, show: false,
showLoading: false,
sliderValue: 0, sliderValue: 0,
newDataFlag: true, newDataFlag: true,
totalStepNum: 0, totalStepNum: 0,
...@@ -415,6 +419,7 @@ export default { ...@@ -415,6 +419,7 @@ export default {
* @param {Object} sampleItem The object that is being operated * @param {Object} sampleItem The object that is being operated
*/ */
filterChange(data, sampleItem) { filterChange(data, sampleItem) {
sampleItem.showLoading = true;
sampleItem.filterStr = `[${data.toString()}]`; sampleItem.filterStr = `[${data.toString()}]`;
sampleItem.newDataFlag = true; sampleItem.newDataFlag = true;
this.freshtMartixData(sampleItem); this.freshtMartixData(sampleItem);
...@@ -517,7 +522,9 @@ export default { ...@@ -517,7 +522,9 @@ export default {
tag: sampleItem.tagName, tag: sampleItem.tagName,
detail: 'histogram', detail: 'histogram',
}; };
RequestService.getTensorsSample(params).then((res) => { RequestService.getTensorsSample(params).then(
(res) => {
sampleItem.showLoading = false;
if (!res || !res.data || !this.curDataType) { if (!res || !res.data || !this.curDataType) {
return; return;
} }
...@@ -534,7 +541,11 @@ export default { ...@@ -534,7 +541,11 @@ export default {
elementItem[0].updateHistogramData(); elementItem[0].updateHistogramData();
} }
}); });
}); },
() => {
sampleItem.showLoading = false;
},
);
}, },
/** /**
* Obtain table data * Obtain table data
...@@ -549,9 +560,11 @@ export default { ...@@ -549,9 +560,11 @@ export default {
RequestService.getTensorsSample(params).then( RequestService.getTensorsSample(params).then(
(res) => { (res) => {
if (!res || !res.data || this.curDataType) { if (!res || !res.data || this.curDataType) {
sampleItem.showLoading = false;
return; return;
} }
if (!res.data.tensors.length) { if (!res.data.tensors.length) {
sampleItem.showLoading = false;
return; return;
} }
const resData = JSON.parse(JSON.stringify(res.data.tensors[0])); const resData = JSON.parse(JSON.stringify(res.data.tensors[0]));
...@@ -567,6 +580,7 @@ export default { ...@@ -567,6 +580,7 @@ export default {
sampleItem.sliderValue = 0; sampleItem.sliderValue = 0;
sampleItem.totalStepNum = 0; sampleItem.totalStepNum = 0;
this.clearMartixData(sampleItem); this.clearMartixData(sampleItem);
sampleItem.showLoading = false;
return; return;
} }
const oldTotalStepNum = sampleItem.totalStepNum; const oldTotalStepNum = sampleItem.totalStepNum;
...@@ -610,6 +624,7 @@ export default { ...@@ -610,6 +624,7 @@ export default {
sampleItem.sliderValue = 0; sampleItem.sliderValue = 0;
sampleItem.totalStepNum = 0; sampleItem.totalStepNum = 0;
this.clearMartixData(sampleItem); this.clearMartixData(sampleItem);
sampleItem.showLoading = false;
}, },
); );
}, },
...@@ -628,6 +643,7 @@ export default { ...@@ -628,6 +643,7 @@ export default {
sampleItem.curMartixShowSliderValue = sampleItem.sliderValue; sampleItem.curMartixShowSliderValue = sampleItem.sliderValue;
RequestService.getTensorsSample(params).then( RequestService.getTensorsSample(params).then(
(res) => { (res) => {
sampleItem.showLoading = false;
if (!res || !res.data || this.curDataType) { if (!res || !res.data || this.curDataType) {
return; return;
} }
...@@ -660,16 +676,27 @@ export default { ...@@ -660,16 +676,27 @@ export default {
sampleItem.newDataFlag = false; sampleItem.newDataFlag = false;
}); });
}, },
() => { (e) => {
this.clearMartixData(sampleItem); let showLimitError = false;
if (
e.response &&
e.response.data &&
e.response.data.error_code &&
e.response.data.error_code.toString() === '50545013'
) {
showLimitError = true;
}
this.clearMartixData(sampleItem, showLimitError);
sampleItem.showLoading = false;
}, },
); );
}, },
/** /**
* Clear table display * Clear table display
* @param {Object} sampleItem The object that is being operated * @param {Object} sampleItem The object that is being operated
* @param {Boolean} showLimitError Display request error message
*/ */
clearMartixData(sampleItem) { clearMartixData(sampleItem, showLimitError) {
sampleItem.curData = []; sampleItem.curData = [];
sampleItem.newDataFlag = true; sampleItem.newDataFlag = true;
let elementItem = null; let elementItem = null;
...@@ -677,6 +704,13 @@ export default { ...@@ -677,6 +704,13 @@ export default {
elementItem = this.$refs[sampleItem.ref]; elementItem = this.$refs[sampleItem.ref];
if (elementItem) { if (elementItem) {
elementItem[0].updateGridData(); elementItem[0].updateGridData();
if (showLimitError) {
elementItem[0].showRequestErrorMessage(
this.$t('error.50545013'),
sampleItem.formateData.value.dims,
sampleItem.filterStr,
);
}
} }
}); });
}, },
...@@ -917,6 +951,7 @@ export default { ...@@ -917,6 +951,7 @@ export default {
tagName: tagName, tagName: tagName,
summaryName: this.trainingJobId, summaryName: this.trainingJobId,
show: false, show: false,
showLoading: false,
sliderValue: 0, sliderValue: 0,
newDataFlag: true, newDataFlag: true,
totalStepNum: 0, totalStepNum: 0,
...@@ -981,6 +1016,7 @@ export default { ...@@ -981,6 +1016,7 @@ export default {
return; return;
} }
sampleItem.sliderChangeTimer = setTimeout(() => { sampleItem.sliderChangeTimer = setTimeout(() => {
sampleItem.showLoading = true;
this.freshtMartixData(sampleItem); this.freshtMartixData(sampleItem);
}, 500); }, 500);
}, },
...@@ -1112,6 +1148,19 @@ export default { ...@@ -1112,6 +1148,19 @@ export default {
position: relative; position: relative;
background: #f0f3fa; background: #f0f3fa;
overflow-x: hidden; overflow-x: hidden;
.loading-cover {
width: 100%;
height: 100%;
z-index: 9;
position: absolute;
top: 0;
left: 0;
display: flex;
background: white;
opacity: 0.5;
align-items: center;
justify-content: center;
}
} }
.sample-data-show { .sample-data-show {
padding: 32px 16px; padding: 32px 16px;
......
...@@ -148,7 +148,9 @@ limitations under the License. ...@@ -148,7 +148,9 @@ limitations under the License.
</div> </div>
<div class="cl-dashboard-con-up" <div class="cl-dashboard-con-up"
:class="!!tensorTag && !wrongPlugin ? '' : 'no-data-hover'" :class="!!tensorTag && !wrongPlugin ? '' : 'no-data-hover'"
@click="viewMoreTensors"> @mousedown="viewMoreTensors($event)"
@mouseup="viewMoreTensors($event)"
@click="viewMoreTensors($event)">
<div class="cl-dashboard-title">{{$t("tensors.titleText")}}</div> <div class="cl-dashboard-title">{{$t("tensors.titleText")}}</div>
<div class="cl-module"> <div class="cl-module">
<div class="tensor-char-container" <div class="tensor-char-container"
...@@ -220,6 +222,18 @@ export default { ...@@ -220,6 +222,18 @@ export default {
fileTag: '', fileTag: '',
tensorData: [], tensorData: [],
tensorTag: '', tensorTag: '',
tensorNewDataFlag: true,
tensorMouseData: {
timeStamp: 0,
pageX: 0,
pageY: 0,
isClick: false,
},
mouseEventKey: {
click: 'click',
mousedown: 'mousedown',
mouseup: 'mouseup',
},
}; };
}, },
computed: { computed: {
...@@ -413,17 +427,39 @@ export default { ...@@ -413,17 +427,39 @@ export default {
}, },
/** /**
* Viewing more tensors information * Viewing more tensors information
* @param {Object} event Mouse event
*/ */
viewMoreTensors() { viewMoreTensors(event) {
if (!this.tensorTag) { if (!this.tensorTag) {
return; return;
} }
if (event.type === this.mouseEventKey.mousedown) {
this.tensorMouseData.isClick = false;
this.tensorMouseData.pageX = event.pageX;
this.tensorMouseData.pageY = event.pageY;
} else if (event.type === this.mouseEventKey.mouseup) {
// offset buffer is 3
const offsetBuffer = 3;
if (
Math.abs(event.pageX - this.tensorMouseData.pageX) <= offsetBuffer &&
Math.abs(event.pageY - this.tensorMouseData.pageY) <= offsetBuffer
) {
this.tensorMouseData.isClick = true;
this.tensorMouseData.timeStamp = event.timeStamp;
}
} else if (event.type === this.mouseEventKey.click) {
if (
this.tensorMouseData.isClick &&
event.timeStamp === this.tensorMouseData.timeStamp
) {
this.$router.push({ this.$router.push({
path: '/train-manage/tensor', path: '/train-manage/tensor',
query: { query: {
train_id: this.trainingJobId, train_id: this.trainingJobId,
}, },
}); });
}
}
}, },
/** /**
* Go to data. * Go to data.
...@@ -828,11 +864,17 @@ export default { ...@@ -828,11 +864,17 @@ export default {
this.getSampleRandomly(); this.getSampleRandomly();
}, },
dealTensorData(tags) { dealTensorData(tags) {
const oldTag = this.tensorTag;
if (tags.length) { if (tags.length) {
this.tensorTag = tags[0]; this.tensorTag = tags[0];
} else { } else {
this.tensorTag = ''; this.tensorTag = '';
} }
if (this.tensorTag !== oldTag) {
this.tensorNewDataFlag = true;
} else {
this.tensorNewDataFlag = false;
}
if (this.tensorTag) { if (this.tensorTag) {
this.getTensorGridData(); this.getTensorGridData();
} }
...@@ -920,7 +962,7 @@ export default { ...@@ -920,7 +962,7 @@ export default {
const elementItem = this.$refs.tensorChart; const elementItem = this.$refs.tensorChart;
if (elementItem) { if (elementItem) {
elementItem.updateGridData( elementItem.updateGridData(
true, this.tensorNewDataFlag,
curStepData.value.dims, curStepData.value.dims,
statistics, statistics,
); );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册