From 69feb96ff8c44db72441669989bc8e62c2c8a0e2 Mon Sep 17 00:00:00 2001 From: xiayifan Date: Sat, 28 Nov 2020 14:10:34 +0800 Subject: [PATCH] UI tensor add display of scientific notation --- .../components/debugger-grid-table-simple.vue | 2 +- .../ui/src/components/grid-table-simple.vue | 44 +++++++++++++++++-- mindinsight/ui/src/locales/en-us.json | 4 +- mindinsight/ui/src/locales/zh-cn.json | 6 +-- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/mindinsight/ui/src/components/debugger-grid-table-simple.vue b/mindinsight/ui/src/components/debugger-grid-table-simple.vue index 039f7043..4bb9232b 100644 --- a/mindinsight/ui/src/components/debugger-grid-table-simple.vue +++ b/mindinsight/ui/src/components/debugger-grid-table-simple.vue @@ -172,7 +172,7 @@ export default { shape: '', categoryArr: [ {label: this.$t('components.value'), value: 'value'}, - {label: this.$t('components.ScientificCounting'), value: 'science'}, + {label: this.$t('components.scientificCounting'), value: 'science'}, ], category: 'value', // value:Numerical notation science:Scientific notation }; diff --git a/mindinsight/ui/src/components/grid-table-simple.vue b/mindinsight/ui/src/components/grid-table-simple.vue index 995775b6..6bcc6c24 100644 --- a/mindinsight/ui/src/components/grid-table-simple.vue +++ b/mindinsight/ui/src/components/grid-table-simple.vue @@ -36,6 +36,10 @@ limitations under the License. v-if="showOperate && (fullData.length || requestError)">
+
{{$t('components.dimsFilterInputTitle')}} + +
- + + {{$t('components.inCorrectInput')}}
+ {{$t('components.category')}} + + {{$t('components.gridAccuracy')}} @@ -141,6 +154,17 @@ export default { rowStartIndex: 0, colStartIndex: 0, }, + categoryArr: [ + { + label: this.$t('components.value'), + value: 'value', + }, + { + label: this.$t('components.scientificCounting'), + value: 'science', + }, + ], + category: 'value', // value: Numerical; science: Scientific notation }; }, computed: {}, @@ -216,7 +240,7 @@ export default { id: -1, name: ' ', field: -1, - width: 100, + width: 120, headerCssClass: 'headerStyle', }, ]; @@ -228,7 +252,7 @@ export default { id: order, name: order, field: order, - width: 100, + width: 120, headerCssClass: 'headerStyle', formatter: this.formateValueColor, }); @@ -293,7 +317,11 @@ export default { if (isNaN(innerData)) { tempData[innerOrder] = innerData; } else { - tempData[innerOrder] = innerData.toFixed(this.accuracy); + if (this.category === this.categoryArr[0].value) { + tempData[innerOrder] = innerData.toFixed(this.accuracy); + } else { + tempData[innerOrder] = innerData.toExponential(this.accuracy); + } } }); tempArr.push(tempData); @@ -602,12 +630,20 @@ export default { line-height: 32px; color: red; } + .filter-input-title { + line-height: 34px; + margin-right: 10px; + } } .accuracy-container { float: right; .select-item { width: 60px; } + .select-category { + width: 105px; + margin-left: 5px; + } } } } diff --git a/mindinsight/ui/src/locales/en-us.json b/mindinsight/ui/src/locales/en-us.json index c05fe20c..944d4b3f 100644 --- a/mindinsight/ui/src/locales/en-us.json +++ b/mindinsight/ui/src/locales/en-us.json @@ -1,6 +1,6 @@ { "public": { - "netWorkError": "Network or backend service error. Please check.", + "netWorkError": "Network or backend service error. Ensure that the service is started successfully and reload the page.", "browserWarning": "Your browser may cause some functions to become invalid or unavailable. You are advised to use Chrome 65 or later.", "timeout": "Timeout. Try again.", "noData": "No data", @@ -469,7 +469,7 @@ "dimsFilterInputTitle": "Dimension Selection", "dimsFilterInputTip": "The dimension value can be a specific index (consistent with the Python index meaning and supporting negative signs) or a colon (:) that indicates all values of the current dimension.", "category": "Type", - "ScientificCounting": "Scientific notation" + "scientificCounting": "Scientific notation" }, "debugger": { "debugger": "Debugger", diff --git a/mindinsight/ui/src/locales/zh-cn.json b/mindinsight/ui/src/locales/zh-cn.json index 89d2028f..98ed1c68 100644 --- a/mindinsight/ui/src/locales/zh-cn.json +++ b/mindinsight/ui/src/locales/zh-cn.json @@ -1,6 +1,6 @@ { "public": { - "netWorkError": "网络或后端服务错误,请检查。", + "netWorkError": "网络或后端服务错误,请确保服务正常并重新加载页面。", "browserWarning": "您当前的浏览器可能导致部分功能失效或不可使用,建议使用Chrome 65版本以上的浏览器。", "timeout": "超时,请重新请求。", "noData": "暂无数据", @@ -466,9 +466,9 @@ "gridTableNoData": "表格无数据", "value": "数值", "dimsFilterInputTitle": "维度选择", - "dimsFilterInputTip": "维度输入值可以是具体的索引(和Python的索引含义一致,支持负号)或者冒号\":\",其中冒号\":\"表示当前维度的所有值", + "dimsFilterInputTip": "维度输入值可以是具体的索引(和Python的索引含义一致,支持负号)或者冒号\":\",其中冒号\":\"表示当前维度的所有值", "category": "分类", - "ScientificCounting": "科学计数" + "scientificCounting": "科学计数" }, "debugger": { "debugger": "调试器",