This is an automated email from the ASF dual-hosted git repository.

liyang pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/kylin5 by this push:
     new 9e8ca1a953 KYLIN-5824,refine handel error for export models
9e8ca1a953 is described below

commit 9e8ca1a9536c9ecf0eafca048c8733e3668f2c76
Author: huangchunyan <qingyanxiaon...@163.com>
AuthorDate: Fri Apr 5 17:31:28 2024 +0800

    KYLIN-5824,refine handel error for export models
---
 .../common/ModelsExportModal/ModelsExportModal.vue |  2 +-
 .../ModelList/AggregateModal/locales.js            |  4 ++--
 kystudio/src/util/business.js                      |  2 +-
 kystudio/src/util/domHelper.js                     | 28 ++++++++++++++++++----
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git 
a/kystudio/src/components/common/ModelsExportModal/ModelsExportModal.vue 
b/kystudio/src/components/common/ModelsExportModal/ModelsExportModal.vue
index 3b3b701b39..49f8931d8d 100644
--- a/kystudio/src/components/common/ModelsExportModal/ModelsExportModal.vue
+++ b/kystudio/src/components/common/ModelsExportModal/ModelsExportModal.vue
@@ -270,7 +270,7 @@ export default class ModelsExportModal extends Vue {
       this.handleClose(true)
       this.$message.success(this.$t('exportSuccess'))
     } catch (e) {
-      this.$message.error(this.$t('exportFailed'))
+      // this.$message.error(this.$t('exportFailed'))
     }
     this.isSubmiting = false
   }
diff --git 
a/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
 
b/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
index 272a94d5ff..56905e9e0b 100644
--- 
a/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
+++ 
b/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
@@ -113,11 +113,11 @@ export default {
     excludeTableCheckbox: 'Display columns excluded from recommendations',
     excludeTableCheckboxTip: 'If an excluded column is added to indexes, this 
column will store "historical truth"(SCD Type2, As Was).',
     excludedTableIconTip: 'Excluded from recommendations',
-    indexTimeRange: 'Index’s Data Range',
+    indexTimeRange: 'Real-time Index Types',
     manyToManyAntiTableTip: 'For the tables excluded from recommendations, if 
the join relationship of a table is One-to-Many or Many-to-Many, dimensions 
from this table can\'t be used in indexes. ',
     indexTimeRangeTips: 'The data range that the indexes will be built in. 
With “Batch and Streaming“ selected, there will be generated batch indexes and 
streaming indexes with same content respectively. ',
     refuseAddIndexTip: 'Can\'t add streaming indexes. Please stop the 
streaming job and then delete all the streaming segments.',
-    disableAddDim: 'Select index\'s data range',
+    disableAddDim: 'Please select the real-time index type',
     textRecognition: 'Text Recognition'
   }
 }
diff --git a/kystudio/src/util/business.js b/kystudio/src/util/business.js
index 5aa4d387df..d170361201 100644
--- a/kystudio/src/util/business.js
+++ b/kystudio/src/util/business.js
@@ -30,7 +30,7 @@ export function handleError (res, errorcallback) {
     if (window.kylinVm.$store.state.config.platform === 'iframe') {
       window.kylinVm.$store.state.config.errorMsgBox.msg = res.message || 
window.kylinVm.$t('kylinLang.common.notConnectServerIframe')
     } else {
-      window.kylinVm.$store.state.config.errorMsgBox.msg = res.message || 
window.kylinVm.$t('kylinLang.common.notConnectServer')
+      window.kylinVm.$store.state.config.errorMsgBox.msg = res.message || 
(responseData && responseData.msg) || 
window.kylinVm.$t('kylinLang.common.notConnectServer')
     }
     window.kylinVm.$store.state.config.errorMsgBox.detail = responseData && 
responseData.stacktrace || res.stack || JSON.stringify(res)
   } else {
diff --git a/kystudio/src/util/domHelper.js b/kystudio/src/util/domHelper.js
index ddec46a24e..40b8146435 100644
--- a/kystudio/src/util/domHelper.js
+++ b/kystudio/src/util/domHelper.js
@@ -1,5 +1,7 @@
 import Vue from 'vue'
 import ElementUI from 'kyligence-kylin-ui'
+import $ from 'jquery'
+import { handleError } from './business'
 
 export const download = {
   post (url, data) {
@@ -32,11 +34,29 @@ export const download = {
     }
 
     document.body.appendChild($form)
-    $form.submit()
-
-    setTimeout(() => {
-      document.body.removeChild($form)
+    return $.ajax({
+      headers: {
+        'Accept-Language': localStorage.getItem('kystudio_lang') === 'en' ? 
'en' : 'cn'
+      },
+      url: $($form).attr('action'), // 获取表单的提交地址
+      method: $($form).attr('method'), // 获取表单的提交方法
+      data: $($form).serialize(), // 序列化表单数据
+      success: (res) => {
+        // 当服务器响应成功时的处理逻辑
+        $form.submit()
+        setTimeout(() => {
+          document.body.removeChild($form)
+        })
+      },
+      error: (xhr, status, error) => {
+        // 当服务器响应错误时的处理逻辑
+        handleError({data: xhr.responseJSON}) // 打印错误信息
+        setTimeout(() => {
+          document.body.removeChild($form)
+        })
+      }
     })
+    // $form.submit()
   }
 }
 

Reply via email to