You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2023/06/07 06:43:52 UTC

[kylin] branch kylin5 updated (1d1a9d0d60 -> 10e4e9ec3a)

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

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


    from 1d1a9d0d60 [DIRTY] Fix Sonar
     new 424bb2450e KYLIN-5541 support aggregate index text recognize
     new 63634c28e0 KYLIN-5542 add a new indexType when query hit model
     new 9cadd4bccd KYLIN-5543 validate dimensions
     new 2878bb8279 KYLIN-5543 support ddl
     new fbe00ccb6f KYLIN-5547 change the style of recognize aggregate modal
     new 425b154524 KYLIN-5548 change ddl text
     new cf9b4fba09 KYLIN-5549 display the number of used dimensions
     new c3355e6e80 KYLIN-5550 change text in import model
     new 40165755ba KYLIN-5551 get query history within one day
     new b4e366d894 KYLIN-5552 add style of break words
     new b930cdb137 KYLIN-5553 display the result when run show create table
     new 10e4e9ec3a KYLIN-5554 change tips when import same name model

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 kystudio/build/webpack.base.conf.js                |   2 +-
 kystudio/package.json                              |   1 +
 kystudio/src/assets/styles/index.less              |   1 +
 .../src/components/common/DataSourceBar/index.vue  |  48 +-
 .../src/components/common/DataSourceBar/locales.js |   5 +-
 kystudio/src/components/common/Modal/Modal.vue     |   5 +-
 .../common/ModelsImportModal/ModelsImportModal.vue |   4 +-
 .../components/common/ModelsImportModal/locales.js |   6 +-
 .../RecognizeAggregateModal.vue                    | 601 +++++++++++++++++++++
 .../common/RecognizeAggregateModal/error.svg       |   3 +
 .../common/RecognizeAggregateModal/handler.js      | 118 ++++
 .../common/RecognizeAggregateModal/locales.js      |  28 +
 .../common/RecognizeAggregateModal/store.js        | 120 ++++
 .../common/RecognizeAggregateModal/warning.svg     |   3 +
 .../components/layout/layout_left_right_top.vue    |  17 +-
 kystudio/src/components/query/query_history.vue    |   6 +-
 .../src/components/query/query_history_table.vue   |   6 +-
 kystudio/src/components/query/query_result.vue     |  30 +-
 kystudio/src/components/studio/DDL/ddl.vue         | 369 +++++++++++++
 .../StudioModel/ModelList/AggregateModal/index.vue |  47 ++
 .../ModelList/AggregateModal/locales.js            |   3 +-
 .../src/components/studio/StudioSource/index.vue   |   1 +
 kystudio/src/config/index.js                       |  10 +-
 kystudio/src/config/spec.js                        |  14 +-
 kystudio/src/locale/en.js                          |   2 +
 kystudio/src/router/index.js                       |   4 +
 kystudio/src/service/datasource.js                 |   6 +
 kystudio/src/store/datasource.js                   |   8 +
 kystudio/src/store/system.js                       |   4 +-
 kystudio/src/store/types.js                        |   3 +
 30 files changed, 1436 insertions(+), 39 deletions(-)
 create mode 100644 kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
 create mode 100644 kystudio/src/components/common/RecognizeAggregateModal/error.svg
 create mode 100644 kystudio/src/components/common/RecognizeAggregateModal/handler.js
 create mode 100644 kystudio/src/components/common/RecognizeAggregateModal/locales.js
 create mode 100644 kystudio/src/components/common/RecognizeAggregateModal/store.js
 create mode 100644 kystudio/src/components/common/RecognizeAggregateModal/warning.svg
 create mode 100644 kystudio/src/components/studio/DDL/ddl.vue


[kylin] 11/12: KYLIN-5553 display the result when run show create table

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b930cdb137192075dad0a0e5325ce0a5b6cd5b03
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 16:52:09 2023 +0800

    KYLIN-5553 display the result when run show create table
---
 kystudio/src/components/studio/DDL/ddl.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kystudio/src/components/studio/DDL/ddl.vue b/kystudio/src/components/studio/DDL/ddl.vue
index 17d0214873..4042ae762a 100644
--- a/kystudio/src/components/studio/DDL/ddl.vue
+++ b/kystudio/src/components/studio/DDL/ddl.vue
@@ -153,7 +153,7 @@
         const resultData = await handleSuccessAsync(res)
         this.running = false
         this.showCreateSuccessAlert = this.content.toLocaleLowerCase().indexOf('create view') > -1
-        this.showCreateSuccessAlert && this.insertEditorContent(`\n\n${resultData}`)
+        resultData && this.insertEditorContent(`\n\n${resultData}`)
         this.resetErrorMsg()
         this.$message({ type: 'success', message: this.$t('runSuccess') })
       } catch (e) {


[kylin] 12/12: KYLIN-5554 change tips when import same name model

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 10e4e9ec3a889948e51e80891793a86730ede0be
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 17:28:39 2023 +0800

    KYLIN-5554 change tips when import same name model
---
 .../src/components/common/ModelsImportModal/ModelsImportModal.vue     | 4 ++--
 kystudio/src/components/studio/DDL/ddl.vue                            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue b/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue
index acbcf06a19..326b215bb2 100644
--- a/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue
+++ b/kystudio/src/components/common/ModelsImportModal/ModelsImportModal.vue
@@ -63,7 +63,7 @@
       </div>
       <div :class="['single-modal-detail', {'no-conflict': !(activeModalObj && activeModalObj.differences > 0)}]">
         <div :class="['model-detail-tips', getCurrentModelDetails().key]" v-if="getCurrentModelDetails && activeModalObj && activeModalObj.differences > 0">
-          <p class="title">{{$t(activeModalObj.has_same_name ? `${getCurrentModelDetails().title}SameName` : `${getCurrentModelDetails().title}DiffName`)}}<span v-if="!(getCurrentModelDetails().key === 'new' && !activeModalObj.has_same_name)" class="detail-btn" @click="showModelDetails = !showModelDetails">{{$t('detailBtn')}}<i :class="['el-icon-ksd-more_01', 'ksd-ml-5', {'open': showModelDetails}]"></i></span></p>
+          <p class="title">{{$t(activeModalObj.has_same_name ? `${getCurrentModelDetails().title}SameName` : `${getCurrentModelDetails().title}DiffName`)}}<span v-if="!(getCurrentModelDetails().key === 'new' && !(activeModalObj.has_same_name && !activeModalObj.has_same_name_broken))" class="detail-btn" @click="showModelDetails = !showModelDetails">{{$t('detailBtn')}}<i :class="['el-icon-ksd-more_01', 'ksd-ml-5', {'open': showModelDetails}]"></i></span></p>
           <div class="detail-content" v-if="showModelDetails">
             <p>{{$t(activeModalObj.has_same_name ? `${getCurrentModelDetails().details}SameName` : `${getCurrentModelDetails().details}DiffName`)}}</p>
             <div class="ksd-pl-10" v-if="getCurrentDefaultStatus() === 'noImport'">
@@ -75,7 +75,7 @@
               <p v-for="(item, index) in noOverWriteReason" :key="index">* {{$t(item)}}</p>
             </div>
           </div>
-          <p>{{$t(activeModalObj.has_same_name ? `${getCurrentModelDetails().msg}SameName` : `${getCurrentModelDetails().msg}DiffName`)}}</p>
+          <p>{{$t(activeModalObj.has_same_name && !activeModalObj.has_same_name_broken ? `${getCurrentModelDetails().msg}SameName` : `${getCurrentModelDetails().msg}DiffName`)}}</p>
         </div>
         <el-tabs v-model="activeTabName" @tab-click="handleClick" v-if="activeModalObj && activeModalObj.differences > 0">
           <el-tab-pane :name="it.name" v-for="(it, index) in tabPaneList" :key="index">
diff --git a/kystudio/src/components/studio/DDL/ddl.vue b/kystudio/src/components/studio/DDL/ddl.vue
index 4042ae762a..13a11c2381 100644
--- a/kystudio/src/components/studio/DDL/ddl.vue
+++ b/kystudio/src/components/studio/DDL/ddl.vue
@@ -107,7 +107,7 @@
   })
   export default class DDL extends Vue {
     content = ''
-    activeType = ''
+    activeType = 'result'
     rules = []
     ddlError = false
     errorMsg = ''


[kylin] 07/12: KYLIN-5549 display the number of used dimensions

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cf9b4fba092c7b09a98719df51d1670a1f053821
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 15:18:51 2023 +0800

    KYLIN-5549 display the number of used dimensions
---
 .../RecognizeAggregateModal.vue                        | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
index 35192396dd..554e73a2cf 100644
--- a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
+++ b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
@@ -34,6 +34,9 @@
           <template v-if="form.dimensions.length">
             <div class="results-header">
               {{$tc('selectedDimensionCount', selectedDimensionCount, { count: selectedDimensionCount })}}
+              <template>
+                <span class="divide ksd-ml-8 ksd-mr-8">|</span><span>{{$t('usedDimensionCount', {count: usedDimensionCount})}}</span>
+              </template>
             </div>
             <div class="list-actions">
               <el-checkbox :key="isSelectAll" :indeterminate="isIndeterminate" :checked="isSelectAll" @change="handleSelectAll" />
@@ -42,7 +45,7 @@
             </div>
             <RecycleScroller
               class="dimension-list"
-              :items="form.dimensions"
+              :items="dimensionList"
               :item-size="37"
               key-field="value"
             >
@@ -138,6 +141,12 @@
       this.updatePlaceHolder()
       this.updateRecognizeShortcut(newVal, oldVal)
     }
+    get dimensionList () {
+      const { dimensions } = this.form
+      const usedItems = dimensions.filter(it => it.isDisabled)
+      const selectedItems = dimensions.filter(it => !it.isDisabled)
+      return [...selectedItems, ...usedItems]
+    }
     get errorCount () {
       const { errorInEditor } = this
       return errorInEditor.filter(line => [ERROR_TYPE.COLUMN_NOT_IN_MODEL, ERROR_TYPE.COLUMN_NOT_IN_INCLUDES].includes(line.type)).length
@@ -150,6 +159,10 @@
       const { form: { dimensions } } = this
       return dimensions.filter(dimension => dimension.isChecked).length
     }
+    get usedDimensionCount () {
+      const { form: { dimensions } } = this
+      return dimensions.filter(dimension => dimension.isDisabled).length
+    }
     get isSelectAll () {
       const { form: { dimensions } } = this
       return !dimensions.some(dimension => !dimension.isChecked && !dimension.isDisabled)
@@ -475,6 +488,9 @@
       font-weight: 400;
       font-size: 12px;
       line-height: 16px;
+      .divide {
+        color: @text-placeholder-color;
+      }
     }
     .actions {
       position: absolute;


[kylin] 03/12: KYLIN-5543 validate dimensions

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9cadd4bccd48af4c4ceaf514497d53ad3c1ccdcc
Author: Qian Xia <la...@gmail.com>
AuthorDate: Mon Jun 5 16:26:07 2023 +0800

    KYLIN-5543 validate dimensions
---
 .../common/RecognizeAggregateModal/RecognizeAggregateModal.vue        | 4 ++--
 kystudio/src/components/common/RecognizeAggregateModal/handler.js     | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
index c3ab6ac753..8f0928880d 100644
--- a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
+++ b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
@@ -301,8 +301,8 @@
       const dimensions = []
       this.clearupErrors()
       let formattedText = ''
-      for (const text of form.text.replace(/^\n|\n$/g, '').split(/,\n*/g)) {
-        const columnText = text.trim()
+      for (const text of form.text.replace(/\n*/g, '').split(/,\n*/g)) {
+        const columnText = text.trim().toLocaleUpperCase()
         if (columnText) {
           const dimension = modelDimensions.find(d => d.column === columnText)
           if (dimension) {
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/handler.js b/kystudio/src/components/common/RecognizeAggregateModal/handler.js
index cf4930ca14..f8cdc0d6e8 100644
--- a/kystudio/src/components/common/RecognizeAggregateModal/handler.js
+++ b/kystudio/src/components/common/RecognizeAggregateModal/handler.js
@@ -69,6 +69,9 @@ export function scrollToLineAndHighlight (editor, line) {
 export function searchColumnInEditor (editor, column) {
   const { $search: editorSearch } = editor
   const session = editor.getSession()
+  column = column.replace(/[\\$|\\/|\\^|\\?]/g, ($1) => {
+    return `\\${$1}`
+  })
 
   editorSearch.setOptions({
     needle: `^${column},\n`,


[kylin] 01/12: KYLIN-5541 support aggregate index text recognize

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 424bb2450e0a942df00c95b89c29a8783d7029c1
Author: Qian Xia <la...@gmail.com>
AuthorDate: Fri Jun 2 17:39:33 2023 +0800

    KYLIN-5541 support aggregate index text recognize
---
 kystudio/build/webpack.base.conf.js                |   2 +-
 kystudio/package.json                              |   1 +
 kystudio/src/assets/styles/index.less              |   1 +
 kystudio/src/components/common/Modal/Modal.vue     |   5 +-
 .../RecognizeAggregateModal.vue                    | 575 +++++++++++++++++++++
 .../common/RecognizeAggregateModal/error.svg       |   3 +
 .../common/RecognizeAggregateModal/handler.js      | 115 +++++
 .../common/RecognizeAggregateModal/locales.js      |  28 +
 .../common/RecognizeAggregateModal/store.js        | 120 +++++
 .../common/RecognizeAggregateModal/warning.svg     |   3 +
 .../StudioModel/ModelList/AggregateModal/index.vue |  47 ++
 .../ModelList/AggregateModal/locales.js            |   3 +-
 kystudio/src/config/index.js                       |   7 +
 13 files changed, 907 insertions(+), 3 deletions(-)

diff --git a/kystudio/build/webpack.base.conf.js b/kystudio/build/webpack.base.conf.js
index a1532d7b9b..712ff5c1a3 100644
--- a/kystudio/build/webpack.base.conf.js
+++ b/kystudio/build/webpack.base.conf.js
@@ -55,7 +55,7 @@ module.exports = {
       {
         test: /\.js$/,
         loader: 'babel-loader',
-        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-awesome')],
+        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-awesome'), resolve('node_modules/vue-virtual-scroller')],
         options: {
           presets: ['@babel/preset-env']
         }
diff --git a/kystudio/package.json b/kystudio/package.json
index 98802c940d..d7ed33f2e8 100644
--- a/kystudio/package.json
+++ b/kystudio/package.json
@@ -42,6 +42,7 @@
     "vue-property-decorator": "7.0.0",
     "vue-resource": "1.5.1",
     "vue-router": "2.8.1",
+    "vue-virtual-scroller": "^1.0.10",
     "vue2-ace-editor": "0.0.3",
     "vuex": "2.5.0"
   },
diff --git a/kystudio/src/assets/styles/index.less b/kystudio/src/assets/styles/index.less
index 5b1f4c7b0b..1ed2b24a57 100644
--- a/kystudio/src/assets/styles/index.less
+++ b/kystudio/src/assets/styles/index.less
@@ -2,6 +2,7 @@
 @import '~kyligence-kylin-ui/lib/theme-chalk/index.css';
 @import '~smooth-scrollbar/dist/smooth-scrollbar.css';
 @import '~nprogress/nprogress.css';
+@import '~vue-virtual-scroller/dist/vue-virtual-scroller.css';
 
 // custom stylesheet
 @import './icons.less';
diff --git a/kystudio/src/components/common/Modal/Modal.vue b/kystudio/src/components/common/Modal/Modal.vue
index a59d797a6a..cbc9978a48 100644
--- a/kystudio/src/components/common/Modal/Modal.vue
+++ b/kystudio/src/components/common/Modal/Modal.vue
@@ -8,6 +8,7 @@
     <ModelsImportModal />
     <ModelERDiagramModal />
     <EditProjectConfigDialog />
+    <RecognizeAggregateModal />
   </div>
 </template>
 
@@ -23,6 +24,7 @@ import ModelsExportModal from '../ModelsExportModal/ModelsExportModal.vue'
 import ModelsImportModal from '../ModelsImportModal/ModelsImportModal.vue'
 import ModelERDiagramModal from '../ModelERDiagramModal/ModelERDiagramModal'
 import EditProjectConfigDialog from '../EditProjectConfigDialog'
+import RecognizeAggregateModal from '../RecognizeAggregateModal/RecognizeAggregateModal'
 
 @Component({
   computed: {
@@ -38,7 +40,8 @@ import EditProjectConfigDialog from '../EditProjectConfigDialog'
     ModelsImportModal,
     ProjectEditModal,
     ModelERDiagramModal,
-    EditProjectConfigDialog
+    EditProjectConfigDialog,
+    RecognizeAggregateModal
   }
 })
 export default class Modal extends Vue {
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
new file mode 100644
index 0000000000..c3ab6ac753
--- /dev/null
+++ b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
@@ -0,0 +1,575 @@
+<template>
+    <el-dialog class="recognize-aggregate-modal" width="960px"
+      append-to-body
+      :title="$t('title')"
+      :visible="isShow"
+      :close-on-press-escape="false"
+      :close-on-click-modal="false"
+      :before-close="handleCancel"
+      @closed="handleClosed"
+    >
+      <div class="dialog-content">
+        <div class="recognize-area">
+          <div class="recognize-header" v-if="errorLines.length">
+            <div class="result-counter">
+              <span class="error">{{$tc('errorCount', errorCount, { count: errorCount })}}</span>
+              <el-tooltip :content="$t('repeatTip')" placement="top">
+                <span class="warning">{{$tc('repeatCount', repeatCount, { count: repeatCount })}}</span>
+              </el-tooltip>
+            </div>
+            <div class="result-actions">
+              <el-button icon-button text type="primary" size="mini" icon="el-ksd-n-icon-arrow-up-outlined" @click="handlePrevious" /><!--
+           --><el-button icon-button text type="primary" size="mini" icon="el-ksd-n-icon-arrow-down-outlined" @click="handleNext" />
+            </div>
+          </div>
+          <AceEditor :key="isShow" :placeholder="'123'" class="text-input" ref="editorRef" :value="form.text" @input="handleInputText" />
+          <div class="actions">
+            <el-tooltip :content="$t('dexecute')" placement="left">
+              <el-button icon-button class="recognize" size="small" type="primary" icon="el-icon-caret-right" :disabled="!form.text" @click="handleRecognize" />
+            </el-tooltip>
+          </div>
+        </div>
+        <div class="recognize-results">
+          <template v-if="form.dimensions.length">
+            <div class="results-header">
+              {{$tc('selectedDimensionCount', selectedDimensionCount, { count: selectedDimensionCount })}}
+            </div>
+            <div class="list-actions">
+              <el-checkbox :key="isSelectAll" :indeterminate="isIndeterminate" :checked="isSelectAll" @change="handleSelectAll" />
+              <div class="header-dimension-name">{{$t('dimensionName')}}</div>
+              <div class="header-data-type">{{$t('dataType')}}</div>
+            </div>
+            <RecycleScroller
+              class="dimension-list"
+              :items="form.dimensions"
+              :item-size="37"
+              key-field="value"
+            >
+              <template slot-scope="{ item }">
+                <div class="dimension" @click="handleCheckDimension(item)">
+                  <el-checkbox :key="item.isChecked" :checked="item.isChecked" @change="handleCheckDimension(item)" />
+                  <span class="name">{{ item.label }}</span>
+                  <span class="data-type">{{ item.dataType }}</span>
+                  <div v-if="item.isDisabled" class="current-used-mask" />
+                </div>
+              </template>
+            </RecycleScroller>
+          </template>
+          <div class="all-dimension-error" v-else-if="isAllDimensionError">
+            <i class="el-ksd-n-icon-error-circle-filled" />
+            <span>{{$t('recognizeFailed')}}</span>
+          </div>
+          <EmptyData v-else :showImage="false" :content="$t('emptyText')" />
+        </div>
+      </div>
+      <div slot="footer" class="dialog-footer ky-no-br-space">
+        <el-button size="medium" @click="handleCancel">
+          {{$t('kylinLang.common.cancel')}}
+        </el-button>
+        <el-button type="primary" size="medium" :disabled="!selectedDimensionCount" @click="handleSubmit">
+          {{$t('kylinLang.common.submit')}}
+        </el-button>
+      </div>
+    </el-dialog>
+  </template>
+  
+  <script>
+  import Vue from 'vue'
+  import AceEditor from 'vue2-ace-editor'
+  import { Component, Watch } from 'vue-property-decorator'
+  import { RecycleScroller } from 'vue-virtual-scroller'
+  import { mapState, mapMutations, mapGetters } from 'vuex'
+  import locales from './locales'
+  import vuex from '../../../store'
+  import EmptyData from '../../common/EmptyData/EmptyData'
+  import store, { types, getInitialErrors, ALERT_STATUS } from './store'
+  import { collectErrorsInEditor, refreshEditor, scrollToLineAndHighlight, updatePlaceHolder, ERROR_TYPE } from './handler'
+  import { AGGREGATE_TYPE } from '../../../config'
+  vuex.registerModule(['modals', 'RecognizeAggregateModal'], store)
+  @Component({
+    components: {
+      AceEditor,
+      EmptyData,
+      RecycleScroller
+    },
+    computed: {
+      ...mapState('RecognizeAggregateModal', {
+        isShow: state => state.isShow,
+        type: state => state.type,
+        status: state => state.status,
+        form: state => state.form,
+        errors: state => state.errors,
+        errorLines: state => state.errorLines,
+        errorInEditor: state => state.errorInEditor,
+        errorCursor: state => state.errorCursor,
+        callback: state => state.callback
+      }),
+      ...mapGetters('RecognizeAggregateModal', [
+        'modelDimensions',
+        'includes',
+        'mandatories',
+        'hierarchies',
+        'hierarchyItems',
+        'joints',
+        'jointItems'
+      ])
+    },
+    methods: {
+      ...mapMutations('RecognizeAggregateModal', {
+        setModal: types.SET_MODAL,
+        hideModal: types.HIDE_MODAL,
+        resetModal: types.RESET_MODAL,
+        setModalForm: types.SET_MODAL_FORM
+      })
+    },
+    locales
+  })
+  export default class RecognizeAggregateModal extends Vue {
+    ALERT_STATUS = ALERT_STATUS
+    @Watch('$lang')
+    onLocaleChanged () {
+      this.updatePlaceHolder()
+    }
+    @Watch('isShow')
+    onIsShowChanged (newVal, oldVal) {
+      this.updatePlaceHolder()
+      this.updateRecognizeShortcut(newVal, oldVal)
+    }
+    get errorCount () {
+      const { errorInEditor } = this
+      return errorInEditor.filter(line => [ERROR_TYPE.COLUMN_NOT_IN_MODEL, ERROR_TYPE.COLUMN_NOT_IN_INCLUDES].includes(line.type)).length
+    }
+    get repeatCount () {
+      const { errorInEditor } = this
+      return errorInEditor.filter(line => [ERROR_TYPE.COLUMN_DUPLICATE].includes(line.type)).length
+    }
+    get selectedDimensionCount () {
+      const { form: { dimensions } } = this
+      return dimensions.filter(dimension => dimension.isChecked).length
+    }
+    get isSelectAll () {
+      const { form: { dimensions } } = this
+      return !dimensions.some(dimension => !dimension.isChecked && !dimension.isDisabled)
+    }
+    get isAllDimensionError () {
+      const { selectedDimensionCount, errorCount, repeatCount } = this
+      return !selectedDimensionCount && !!(errorCount + repeatCount)
+    }
+    get isIndeterminate () {
+      const { selectedDimensionCount, isSelectAll } = this
+      return selectedDimensionCount && !isSelectAll
+    }
+    isColumnUsedInCurrent (column) {
+      const { type, includes, mandatories, hierarchyItems, jointItems } = this
+      switch (type) {
+        case AGGREGATE_TYPE.INCLUDE: return includes.includes(column)
+        case AGGREGATE_TYPE.MANDATORY: return mandatories.includes(column)
+        case AGGREGATE_TYPE.HIERARCHY: return hierarchyItems.includes(column)
+        case AGGREGATE_TYPE.JOINT: return jointItems.includes(column)
+        default: return false
+      }
+    }
+    isColumnUsedInOther (column) {
+      const { type, groupIdx, mandatories, hierarchies, joints } = this
+      switch (type) {
+        // 层级和联合中有此维度
+        case AGGREGATE_TYPE.MANDATORY:
+          return hierarchies.some(hierarchy => hierarchy.items.some(item => item === column)) ||
+            joints.some(joint => joint.items.some(item => item === column))
+        // 必需、其他层级和联合中有此维度
+        case AGGREGATE_TYPE.HIERARCHY:
+          return mandatories.some(mandatory => mandatory === column) ||
+            hierarchies.some(hierarchy => hierarchy.items.some((item, idx) => idx !== groupIdx && item === column)) ||
+            joints.some(joint => joint.items.some(item => item === column))
+        // 必需、层级和其他联合中有此维度
+        case AGGREGATE_TYPE.JOINT:
+          return mandatories.some(mandatory => mandatory === column) ||
+            hierarchies.some(hierarchy => hierarchy.items.some(item => item === column)) ||
+            joints.some(joint => joint.items.some((item, idx) => idx !== groupIdx && item === column))
+        // 包含维度不做判断
+        case AGGREGATE_TYPE.INCLUDE:
+        default: return false
+      }
+    }
+    isColumnInModel (column) {
+      const { modelDimensions } = this
+      return modelDimensions.some(d => d.column === column)
+    }
+    isColumnInIncludes (column) {
+      const { includes } = this
+      return includes.includes(column)
+    }
+    getColumnErrorMessage (errorType, column) {
+      switch (errorType) {
+        case ERROR_TYPE.COLUMN_NOT_IN_MODEL:
+          return this.$t('columnNotInModel', { column })
+        case ERROR_TYPE.COLUMN_NOT_IN_INCLUDES:
+          return this.$t('columnNotInIncludes', { column })
+        case ERROR_TYPE.COLUMN_DUPLICATE:
+          return this.$t('columnDuplicate', { column })
+        default: return 'Unknow Error'
+      }
+    }
+    setNotInModelError (column) {
+      const { errors } = this
+      if (!errors.notInModel.includes(column)) this.setModal({ errors: { ...errors, notInModel: [...errors.notInModel, column] } })
+    }
+    setNotInIncludesError (column) {
+      const { errors } = this
+      if (!errors.notInIncludes.includes(column)) this.setModal({ errors: { ...errors, notInIncludes: [...errors.notInIncludes, column] } })
+    }
+    setDuplicateError (column) {
+      const { errors } = this
+      if (!errors.duplicate.includes(column)) this.setModal({ errors: { ...errors, duplicate: [...errors.duplicate, column] } })
+    }
+    setUsedInOthersError (column) {
+      const { errors } = this
+      if (!errors.usedInOthers.includes(column)) this.setModal({ errors: { ...errors, usedInOthers: [...errors.usedInOthers, column] } })
+    }
+    clearupErrors () {
+      this.setModal({ errors: getInitialErrors() })
+    }
+    updateRecognizeShortcut (newVal, oldVal) {
+      if (!oldVal && newVal) {
+        document.addEventListener('keydown', this.handleDexecute)
+      } else if (!newVal && oldVal) {
+        document.removeEventListener('keydown', this.handleDexecute)
+      }
+    }
+    updatePlaceHolder () {
+      this.$nextTick(() => {
+        const { editorRef } = this.$refs
+        const { editor } = editorRef || {}
+        updatePlaceHolder(editor, (h) => (
+          <div class="ace_placeholder">
+            <div>
+              {this.$t('inputPlaceholder1')}
+              <el-tooltip
+                popperClass="recognize-aggregate-placeholder-tooltip"
+                content={(
+                  <ul>
+                    <li>{this.$t('inputPlaceholderTooltip1')}</li>
+                    <li>{this.$t('inputPlaceholderTooltip2')}</li>
+                  </ul>
+                )}
+                placement="top"
+              >
+                <span class="how-to-use">{this.$t('inputPlaceholderTooltipTrigger')}</span>
+              </el-tooltip>
+            </div>
+            <div>
+              {this.$t('inputPlaceholder2')}
+            </div>
+          </div>
+        ))
+      })
+    }
+    showErrors () {
+      const { errors } = this
+      const { editorRef: { editor } } = this.$refs
+      const session = editor.getSession()
+      const { errorInEditor, errorLines } = collectErrorsInEditor(errors, editor)
+      session.setAnnotations(errorInEditor.map(error => ({
+        row: error.row,
+        column: 0,
+        text: this.getColumnErrorMessage(error.type, error.column),
+        type: [ERROR_TYPE.COLUMN_DUPLICATE].includes(error.type) ? 'warning' : 'error'
+      })))
+      this.setModal({ errorLines, errorInEditor })
+      this.$nextTick(() => refreshEditor(editor))
+    }
+    handleDexecute (event) {
+      const { metaKey, key, keyCode } = event
+      if (metaKey && (keyCode === 13 || key === 'Enter')) {
+        this.handleRecognize()
+      }
+    }
+    handleInputText (text) {
+      this.setModalForm({ text })
+    }
+    handleCheckDimension (dimension) {
+      const { form } = this
+      if (!dimension.isDisabled) {
+        const dimensions = form.dimensions.map((d) => (
+          d.value === dimension.value ? { ...d, isChecked: !d.isChecked } : d
+        ))
+        this.setModalForm({ dimensions: [...dimensions] })
+      }
+    }
+    handleRecognize () {
+      const { type, form, modelDimensions } = this
+      const dimensions = []
+      this.clearupErrors()
+      let formattedText = ''
+      for (const text of form.text.replace(/^\n|\n$/g, '').split(/,\n*/g)) {
+        const columnText = text.trim()
+        if (columnText) {
+          const dimension = modelDimensions.find(d => d.column === columnText)
+          if (dimension) {
+            if (type !== AGGREGATE_TYPE.INCLUDE && !this.isColumnInIncludes(dimension.column)) {
+              this.setNotInIncludesError(dimension.column)
+            } else if (!this.isColumnUsedInOther(dimension.column)) {
+              const duplicate = dimensions.some(d => d.value === dimension.column)
+              if (!duplicate) {
+                const isFormChecked = form.dimensions.find(d => d.value === columnText)?.isChecked
+                const isChecked = isFormChecked ?? true
+                const isDisabled = this.isColumnUsedInCurrent(dimension.column)
+                const dataType = dimension.type
+                dimensions.push({ value: dimension.column, label: dimension.column, isChecked, isDisabled, dataType })
+              } else {
+                this.setDuplicateError(dimension.column)
+              }
+            } else {
+              this.setUsedInOthersError(dimension.column)
+            }
+          } else {
+            this.setNotInModelError(columnText)
+          }
+          formattedText += `${columnText},\n`
+        }
+      }
+      this.setModalForm({ text: formattedText, dimensions })
+      this.$nextTick(() => {
+        this.showErrors()
+      })
+    }
+    handlePrevious () {
+      const { editorRef: { editor } } = this.$refs
+      const { errorLines, errorCursor } = this
+      const lineIdx = errorLines.indexOf(errorCursor)
+      const nextCursor = errorLines[lineIdx - 1] ?? errorLines[errorLines.length - 1]
+      this.setModal({ errorCursor: nextCursor })
+      scrollToLineAndHighlight(editor, nextCursor)
+    }
+    handleNext () {
+      const { editorRef: { editor } } = this.$refs
+      const { errorLines, errorCursor } = this
+      const lineIdx = errorLines.indexOf(errorCursor)
+      const nextCursor = errorLines[lineIdx + 1] ?? errorLines[0]
+      this.setModal({ errorCursor: nextCursor })
+      scrollToLineAndHighlight(editor, nextCursor)
+    }
+    handleSelectAll () {
+      const { form, isSelectAll } = this
+      const dimensions = isSelectAll
+        ? form.dimensions.map((d) => (
+          !d.isDisabled ? { ...d, isChecked: false } : d
+        ))
+        : form.dimensions.map((d) => (
+          !d.isDisabled ? { ...d, isChecked: true } : d
+        ))
+      this.setModalForm({ dimensions })
+    }
+    handleClosed () {
+      this.resetModal()
+    }
+    handleCancel (done) {
+      if (typeof done === 'function') done()
+      this.hideModal()
+    }
+    handleSubmit () {
+      const { form, callback } = this
+      callback(form.dimensions.filter(d => !d.isDisabled && d.isChecked).map(d => d.value))
+      this.hideModal()
+    }
+  }
+  </script>
+  <style lang="less">
+  @import '../../../assets/styles/variables.less';
+  .recognize-aggregate-modal {
+    .el-dialog {
+      width: 800px !important;
+    }
+    .el-dialog__header {
+      padding: 24px 24px 16px 24px;
+    }
+    .el-dialog__body {
+      padding: 0;
+      border-top: 1px solid @ke-border-divider-color;
+      border-bottom: 1px solid @ke-border-divider-color;
+    }
+    .dialog-content {
+      display: flex;
+      height: 424px;
+    }
+    .recognize-area {
+      display: flex;
+      flex-direction: column;
+      width: 30%;
+      position: relative;
+      border-right: 1px solid @ke-border-divider-color;
+    }
+    .recognize-header {
+      height: 38px;
+      flex: none;
+      display: flex;
+      align-items: center;
+      position: relative;
+      padding: 0px 8px;
+      border-bottom: 1px solid @ke-border-divider-color;
+    }
+    .result-counter {
+      font-weight: 400;
+      font-size: 12px;
+      line-height: 16px;
+      .error {
+        color: @ke-color-danger-hover;
+      }
+      .warning {
+        color: @ke-color-warning-hover;
+      }
+      * + * {
+        margin-left: 7px;
+      }
+    }
+    .result-actions {
+      position: absolute;
+      top: 50%;
+      right: 8px;
+      transform: translateY(-50%);
+      .el-button + .el-button {
+        margin-left: 4px;
+      }
+      .is-text:focus:not(:hover) {
+        background: transparent;
+        border-color: transparent;
+      }
+    }
+    .text-input {
+      background-color: @ke-background-color-secondary;
+      .ace_gutter {
+        background-color: @ke-background-color-secondary;
+      }
+      .ace_placeholder {
+        font-weight: 400;
+        font-size: 12px;
+        line-height: 16px;
+        color: @text-normal-color;
+        padding: 0 6px;
+        white-space: pre-wrap;
+      }
+    }
+    .recognize-results {
+      width: 70%;
+      display: flex;
+      flex-direction: column;
+      position: relative;
+      overflow-x: hidden;
+      overflow-y: auto;
+    }
+    .results-header {
+      height: 38px;
+      flex: none;
+      display: flex;
+      align-items: center;
+      position: relative;
+      padding: 0px 8px;
+      border-bottom: 1px solid @ke-border-divider-color;
+      font-weight: 400;
+      font-size: 12px;
+      line-height: 16px;
+    }
+    .actions {
+      position: absolute;
+      right: 16px;
+      bottom: 16px;
+      z-index: 1;
+    }
+    .empty-data {
+      top: 50%;
+      left: 50%;
+      transform: translate(-50%, -50%);
+    }
+    .list-actions {
+      display: flex;
+      border-bottom: 1px solid @ke-border-divider-color;
+      align-items: center;
+      font-weight: 500;
+      font-size: 12px;
+      line-height: 16px;
+      padding: 10px;
+      .el-checkbox__inner {
+        display: block;
+      }
+      .el-checkbox {
+        margin-right: 16px;
+      }
+    }
+    .dimension-list {
+      border-radius: 3px;
+      height: 100%;
+      box-sizing: border-box;
+    }
+    .dimension {
+      position: relative;
+      padding: 8px 10px;
+      cursor: pointer;
+      display: flex;
+      align-items: center;
+      border-bottom: 1px solid @ke-border-divider-color;
+      user-select: none;
+      .el-checkbox {
+        margin-right: 16px;
+      }
+      &:hover {
+        background-color: @ke-color-info-secondary-bg;
+      }
+    }
+    .dimension > * {
+      vertical-align: middle;
+    }
+    .header-data-type,
+    .data-type {
+      position: absolute;
+      right: 10px;
+      width: 100px;
+    }
+    .current-used-mask {
+      cursor: not-allowed;
+      background: white;
+      opacity: 0.5;
+      position: absolute;
+      top: 0;
+      right: 0;
+      bottom: 0;
+      left: 0;
+      z-index: 1;
+    }
+    .ace_gutter-cell.ace_error {
+      background-image: url('./error.svg');
+      background-repeat: no-repeat;
+      background-position: 4px center;
+    }
+    .ace_gutter-cell.ace_warning {
+      background-image: url('./warning.svg');
+      background-repeat: no-repeat;
+      background-position: 4px center;
+    }
+    .all-dimension-error {
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      transform: translate(-50%, -50%);
+      color: @ke-color-danger-hover;
+    }
+    .how-to-use {
+      color: @ke-color-primary;
+      cursor: pointer;
+      &:hover {
+        color: @ke-color-primary-hover;
+      }
+    }
+  }
+  .recognize-aggregate-placeholder-tooltip {
+    font-weight: 400;
+    font-size: 12px;
+    line-height: 16px;
+    ul, li {
+      list-style: disc;
+    }
+    ul {
+      margin-left: 15px;
+    }
+  }
+  </style>
+  
\ No newline at end of file
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/error.svg b/kystudio/src/components/common/RecognizeAggregateModal/error.svg
new file mode 100644
index 0000000000..b36e44207e
--- /dev/null
+++ b/kystudio/src/components/common/RecognizeAggregateModal/error.svg
@@ -0,0 +1,3 @@
+<svg width="5" height="6" viewBox="0 0 5 6" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="2.5" cy="3" r="2.5" fill="#E03B3B"/>
+</svg>
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/handler.js b/kystudio/src/components/common/RecognizeAggregateModal/handler.js
new file mode 100644
index 0000000000..cf4930ca14
--- /dev/null
+++ b/kystudio/src/components/common/RecognizeAggregateModal/handler.js
@@ -0,0 +1,115 @@
+import { acequire } from 'brace'
+import Vue from 'vue'
+
+const { Range } = acequire('ace/range')
+
+const dom = acequire('ace/lib/dom')
+
+export const ERROR_TYPE = {
+  COLUMN_NOT_IN_MODEL: 'columnNotInModel',
+  COLUMN_NOT_IN_INCLUDES: 'columnNotInIncludes',
+  COLUMN_DUPLICATE: 'columnDuplicate'
+}
+
+export function $updatePlaceholder (editor, renderPlaceholder) {
+  const value = editor.renderer.$composition || editor.getValue()
+  if (value && editor.renderer.placeholderNode) {
+    editor.renderer.off('afterRender', editor.$updatePlaceholder)
+    dom.removeCssClass(editor.container, 'ace_hasPlaceholder')
+    editor.renderer.placeholderNode.remove()
+    editor.renderer.placeholderNode = null
+  } else if (!value && !editor.renderer.placeholderNode) {
+    editor.renderer.on('afterRender', editor.$updatePlaceholder)
+    dom.addCssClass(editor.container, 'ace_hasPlaceholder')
+    var el = dom.createElement('div')
+    editor.renderer.placeholderNode = el
+    editor.renderer.content.appendChild(editor.renderer.placeholderNode)
+
+    var vmEl = dom.createElement('div')
+    el.appendChild(vmEl)
+    editor.renderer.placeholderVm = new Vue({ el: vmEl, render: renderPlaceholder })
+  }
+}
+
+export function updatePlaceHolder (editor, renderPlaceholder) {
+  if (editor) {
+    if (!editor.$updatePlaceholder) {
+      editor.$updatePlaceholder = $updatePlaceholder.bind(this, editor, renderPlaceholder)
+      editor.on('input', editor.$updatePlaceholder)
+    }
+    editor.$updatePlaceholder(editor, renderPlaceholder)
+  }
+}
+
+export function refreshEditor (editor) {
+  if (editor) {
+    editor.resize(true)
+  }
+}
+
+export function clearupMarkers (editor) {
+  const session = editor.getSession()
+  for (const marker of Object.values(session.getMarkers())) {
+    if (marker.type === 'fullLine') {
+      session.removeMarker(marker.id)
+    }
+  }
+}
+
+export function scrollToLineAndHighlight (editor, line) {
+  const session = editor.getSession()
+  if (line !== undefined) {
+    clearupMarkers(editor)
+    editor.scrollToLine(line, true)
+    const range = new Range(line, 0, line, 1)
+    session.addMarker(range, 'ace_active-line', 'fullLine')
+  }
+}
+
+export function searchColumnInEditor (editor, column) {
+  const { $search: editorSearch } = editor
+  const session = editor.getSession()
+
+  editorSearch.setOptions({
+    needle: `^${column},\n`,
+    caseSensitive: true,
+    wholeWord: false,
+    regExp: true
+  })
+  return editorSearch.findAll(session)
+}
+
+export function collectErrorsInEditor (errors, editor) {
+  const { notInModel, duplicate, notInIncludes } = errors
+
+  let errorInEditor = []
+  let errorLines = []
+
+  for (const column of notInModel) {
+    const notInModelRanges = searchColumnInEditor(editor, column)
+    errorInEditor = [...errorInEditor, ...notInModelRanges.map(r => {
+      errorLines.push(r.start.row)
+      return { row: r.start.row, column, type: ERROR_TYPE.COLUMN_NOT_IN_MODEL }
+    })]
+  }
+
+  for (const column of notInIncludes) {
+    const notInIncludesRanges = searchColumnInEditor(editor, column)
+    errorInEditor = [...errorInEditor, ...notInIncludesRanges.map(r => {
+      errorLines.push(r.start.row)
+      return { row: r.start.row, column, type: ERROR_TYPE.COLUMN_NOT_IN_INCLUDES }
+    })]
+  }
+
+  for (const column of duplicate) {
+    const [, ...duplicateRanges] = searchColumnInEditor(editor, column)
+    errorInEditor = [...errorInEditor, ...duplicateRanges.map(r => {
+      errorLines.push(r.start.row)
+      return { row: r.start.row, column, type: ERROR_TYPE.COLUMN_DUPLICATE }
+    })]
+  }
+
+  errorLines = errorLines.sort()
+
+  return { errorInEditor, errorLines }
+}
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/locales.js b/kystudio/src/components/common/RecognizeAggregateModal/locales.js
new file mode 100644
index 0000000000..31ebef97e2
--- /dev/null
+++ b/kystudio/src/components/common/RecognizeAggregateModal/locales.js
@@ -0,0 +1,28 @@
+export default {
+  'en': {
+    title: 'Text Recognition',
+    emptyText: 'The recognized columns will be displayed here',
+    previous: 'Prev',
+    next: 'Next',
+    recognize: 'Recognize',
+    errorCount: ' | {count} error | {count} errors',
+    repeatCount: ' | {count} duplicate | {count} duplicates',
+    selectedDimensionCount: 'Select {count} results | Select {count} result | Select {count} results',
+    usedDimensionCount: '{count} already exists',
+    inputPlaceholder1: 'Please paste the text, separated by "," to identify the selected column.',
+    inputPlaceholder2: 'Example: CUSTOMER.C_CUSTKEY,CUSTOMER.C_CUSTKEY',
+    inputPlaceholderTooltip1: 'Method 1: Enter the formula A1 & "," on a new column in Excel, enter and drag the bottom right corner of the cell to add in bulk;',
+    inputPlaceholderTooltip2: 'Method 2: Select all the cells that need to added in bulk, right-click and select the cell format (shortcut cmd & ctrl + 1). Select "Custom", enter English format General "," or @ "," in the type, confirm and add in bulk.',
+    inputPlaceholderTooltipTrigger: 'Not sure how to batch add characters?',
+    recognizeFailed: 'Recognize failed. No result, please check and try again',
+    columnDuplicate: 'Duplicate with {column}',
+    columnNotInModel: 'Column {column} does not exist in the current model',
+    columnNotInIncludes: 'Column {column} does not exist in include dimension',
+    columnUsedInOther: 'Column {column} is used in other dimension',
+    dimensionName: 'Dimension Name',
+    dataType: 'Data Type',
+    dexecute: 'Dexecute',
+    acceleratorKey: ' ⌃/⌘ enter',
+    repeatTip: 'The selectable options have been automatically deduplicated'
+  }
+}
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/store.js b/kystudio/src/components/common/RecognizeAggregateModal/store.js
new file mode 100644
index 0000000000..47ab670b4b
--- /dev/null
+++ b/kystudio/src/components/common/RecognizeAggregateModal/store.js
@@ -0,0 +1,120 @@
+import { AGGREGATE_TYPE } from '../../../config'
+
+const types = {
+  SHOW_MODAL: 'SHOW_MODAL',
+  HIDE_MODAL: 'HIDE_MODAL',
+  SET_MODAL: 'SET_MODAL',
+  RESET_MODAL: 'RESET_MODAL',
+  SET_MODAL_FORM: 'SET_MODAL_FORM',
+  CALL_MODAL: 'CALL_MODAL'
+}
+
+export const ALERT_STATUS = {
+  INIT: 'INIT',
+  SUCCESS: 'SUCCESS',
+  WARNING: 'WARNING',
+  ERROR: 'ERROR'
+}
+
+export function getInitialErrors () {
+  return {
+    notInModel: [],
+    notInIncludes: [],
+    duplicate: [],
+    usedInOthers: []
+  }
+}
+
+function getInitialState () {
+  return {
+    isShow: false,
+    model: null,
+    aggregate: null,
+    type: AGGREGATE_TYPE.INCLUDE,
+    status: ALERT_STATUS.INIT,
+    groupIdx: null,
+    errors: getInitialErrors(),
+    errorLines: [],
+    errorInEditor: [],
+    errorCursor: 0,
+    form: {
+      text: '',
+      // { label, value, isChecked, type }
+      dimensions: []
+    },
+    callback: null
+  }
+}
+
+export default {
+  state: getInitialState(),
+  mutations: {
+    [types.SHOW_MODAL] (state) {
+      state.isShow = true
+    },
+    [types.HIDE_MODAL] (state) {
+      state.isShow = false
+    },
+    [types.SET_MODAL] (state, payload) {
+      for (const [key, value] of Object.entries(payload)) {
+        state[key] = value
+      }
+    },
+    [types.RESET_MODAL] (state) {
+      for (const [key, value] of Object.entries(getInitialState())) {
+        state[key] = value
+      }
+    },
+    [types.SET_MODAL_FORM] (state, payload) {
+      for (const [key, value] of Object.entries(payload)) {
+        state.form[key] = value
+      }
+    }
+  },
+  getters: {
+    includes (state) {
+      const { aggregate } = state
+      return aggregate?.includes ?? []
+    },
+    mandatories (state) {
+      const { aggregate } = state
+      return aggregate?.mandatory ?? []
+    },
+    hierarchies (state) {
+      const { aggregate } = state
+      return aggregate?.hierarchyArray ?? []
+    },
+    joints (state) {
+      const { aggregate } = state
+      return aggregate?.jointArray ?? []
+    },
+    tableIndexCols (state) {
+      const { allColumns } = state
+      return allColumns.filter(c => c.isUsed).map(c => c.fullName)
+    },
+    hierarchyItems (state) {
+      const { aggregate, groupIdx } = state
+      return aggregate?.hierarchyArray[groupIdx]?.items ?? []
+    },
+    jointItems (state) {
+      const { aggregate, groupIdx } = state
+      return aggregate?.jointArray[groupIdx]?.items ?? []
+    },
+    modelDimensions (state) {
+      const { model } = state
+      return model?.simplified_dimensions?.filter(c => c.status === 'DIMENSION') ?? []
+    }
+  },
+  actions: {
+    [types.CALL_MODAL] ({ commit }, args) {
+      const { aggregate, type, model, allColumns = [], groupIdx = null } = args
+      return new Promise(resolve => {
+        commit(types.SET_MODAL, { aggregate, model, type, groupIdx, allColumns, callback: resolve })
+        commit(types.SHOW_MODAL)
+      })
+    }
+  },
+  namespaced: true
+}
+
+export { types }
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/warning.svg b/kystudio/src/components/common/RecognizeAggregateModal/warning.svg
new file mode 100644
index 0000000000..7d416355bc
--- /dev/null
+++ b/kystudio/src/components/common/RecognizeAggregateModal/warning.svg
@@ -0,0 +1,3 @@
+<svg width="5" height="6" viewBox="0 0 5 6" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="2.5" cy="3" r="2.5" fill="#F29D41"/>
+</svg>
diff --git a/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/index.vue b/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/index.vue
index e8fc98a331..7ad21f77b9 100644
--- a/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/index.vue
+++ b/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/index.vue
@@ -94,6 +94,18 @@
                         <div class="ksd-mb-10">
                           <span class="title font-medium include-title"><span class="is-required">*</span> {{$t('include')}}</span>
                           <div class="row ksd-fright ky-no-br-space">
+                            <common-tip placement="top" :content="(model.model_type === 'HYBRID' && !form.aggregateArray[aggregateIdx].index_range) ? $t('disableAddDim') : $t('refuseAddIndexTip')"
+                              :disabled="!(model.model_type === 'HYBRID' && !form.aggregateArray[aggregateIdx].index_range) || (!indexUpdateEnabled && ['HYBRID', 'STREAMING'].includes(aggregate.index_range))">
+                              <el-button
+                                plain
+                                class="ksd-ml-10"
+                                size="mini"
+                                :disabled="(model.model_type === 'HYBRID' && !form.aggregateArray[aggregateIdx].index_range) || (!indexUpdateEnabled && ['HYBRID', 'STREAMING'].includes(aggregate.index_range))"
+                                @click="handleIncludesRecognize(AGGREGATE_TYPE.INCLUDE, aggregateIdx)"
+                              >
+                                {{$t('textRecognition')}}
+                              </el-button>
+                            </common-tip>
                             <common-tip placement="top" :content="$t('refuseAddIndexTip')"
                               :disabled="!(!indexUpdateEnabled && ['HYBRID', 'STREAMING'].includes(aggregate.index_range))">
                               <el-button
@@ -140,6 +152,20 @@
                             <common-tip placement="right" :content="$t('mandatoryDesc')">
                               <i class="el-ksd-icon-more_info_16"></i>
                             </common-tip>
+                            <span class="row ksd-fright ky-no-br-space">
+                              <common-tip placement="top" v-if="form.aggregateArray[aggregateIdx].includes.length" :content="(model.model_type === 'HYBRID' && !form.aggregateArray[aggregateIdx].index_range) ? $t('disableAddDim') : $t('refuseAddIndexTip')"
+                                :disabled="!(model.model_type === 'HYBRID' && !form.aggregateArray[aggregateIdx].index_range) || (!indexUpdateEnabled && ['HYBRID', 'STREAMING'].includes(aggregate.index_range))">
+                                <el-button
+                                  plain
+                                  class="ksd-ml-10"
+                                  size="mini"
+                                  :disabled="(model.model_type === 'HYBRID' && !form.aggregateArray[aggregateIdx].index_range) || (!indexUpdateEnabled && ['HYBRID', 'STREAMING'].includes(aggregate.index_range))"
+                                  @click="handleMandatoryRecognize(AGGREGATE_TYPE.MANDATORY, aggregateIdx)"
+                                >
+                                  {{$t('textRecognition')}}
+                                </el-button>
+                              </common-tip>
+                            </span>
                           </h2>
                           <el-select
                             multiple
@@ -541,6 +567,7 @@ import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
 
 import vuex from 'store'
 import locales from './locales'
+import { AGGREGATE_TYPE } from 'config'
 import { BuildIndexStatus } from 'config/model'
 import store, { types, initialAggregateData } from './store'
 import { titleMaps, getPlaintDimensions, findIncludeDimension } from './handler'
@@ -591,6 +618,9 @@ vuex.registerModule(['modals', 'AggregateModal'], store)
     ...mapMutations({
       setChangedForm: 'SET_CHANGED_FORM',
       setProject: 'SET_PROJECT'
+    }),
+    ...mapActions('RecognizeAggregateModal', {
+      callRecognizeAggregateModal: types.CALL_MODAL
     })
   },
   locales
@@ -666,6 +696,7 @@ export default class AggregateModal extends Vue {
       width: [50, 1000]
     }
   }
+  AGGREGATE_TYPE = AGGREGATE_TYPE
 
   @Watch('$lang')
   changeCurrentLang (newVal, oldVal) {
@@ -1095,6 +1126,22 @@ export default class AggregateModal extends Vue {
       }
     })
   }
+  async handleIncludesRecognize (type, aggregateIdx, groupIdx = 0) {
+    const { model, form } = this
+    const { aggregateArray = [] } = form
+    const aggregate = aggregateArray[aggregateIdx]
+    const selectedColumns = await this.callRecognizeAggregateModal({ type, model, aggregate, groupIdx })
+    const value = [...aggregate.includes, ...selectedColumns]
+    this.handleInput(`aggregateArray.${aggregateIdx}.includes`, value, aggregate.id)
+  }
+  async handleMandatoryRecognize (type, aggregateIdx, groupIdx = 0) {
+    const { model, form } = this
+    const { aggregateArray = [] } = form
+    const aggregate = aggregateArray[aggregateIdx]
+    const selectedColumns = await this.callRecognizeAggregateModal({ type, model, aggregate, groupIdx })
+    const value = [...aggregate.mandatory, ...selectedColumns]
+    this.handleInput(`aggregateArray.${aggregateIdx}.mandatory`, value, aggregate.id)
+  }
   handleRemoveAllIncludes (aggregateIdx, titleId, id) {
     kylinConfirm(this.$t('clearAllAggregateTip', {aggId: titleId}), {type: 'warning'}, this.$t('clearAggregateTitle')).then(() => {
       const { aggregateArray = [] } = this.form
diff --git a/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js b/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
index c48786c10b..af73fae4c2 100644
--- a/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
+++ b/kystudio/src/components/studio/StudioModel/ModelList/AggregateModal/locales.js
@@ -114,6 +114,7 @@ export default {
     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: 'Select index\'s data range',
+    textRecognition: 'Text Recognition'
   }
 }
diff --git a/kystudio/src/config/index.js b/kystudio/src/config/index.js
index 9b51bf0819..1c9e1da646 100644
--- a/kystudio/src/config/index.js
+++ b/kystudio/src/config/index.js
@@ -730,3 +730,10 @@ export const formatSQLConfig = {
 }
 
 export { projectCfgs } from './projectCfgs'
+
+export const AGGREGATE_TYPE = {
+  INCLUDE: 'includes',
+  MANDATORY: 'mandatory',
+  HIERARCHY: 'hierarchyArray',
+  JOINT: 'jointArray'
+}


[kylin] 02/12: KYLIN-5542 add a new indexType when query hit model

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 63634c28e08d796e040273f8b0d2012294564136
Author: Qian Xia <la...@gmail.com>
AuthorDate: Mon Jun 5 15:56:04 2023 +0800

    KYLIN-5542 add a new indexType when query hit model
---
 kystudio/src/components/query/query_result.vue | 30 +++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/kystudio/src/components/query/query_result.vue b/kystudio/src/components/query/query_result.vue
index 021d21f8e5..b59e864d7b 100644
--- a/kystudio/src/components/query/query_result.vue
+++ b/kystudio/src/components/query/query_result.vue
@@ -4,10 +4,11 @@
     <el-alert
       :title="noModelRangeTips"
       type="warning"
-      class="ksd-mb-10"
+      class="ksd-mb-8"
       v-if="isShowNotModelRangeTips"
       show-icon>
     </el-alert>
+    <el-alert v-if="!realizations.length && !snapshots && !isShowNotModelRangeTips && !includeFilterIndexType" type="warning" show-icon class="ksd-mb-8" :closable="false"><span slot="title">{{$t('buildIndexAlertTip')}}<span class="jump-link" @click="jumpRouter('/studio/model')">{{$t('gotoBuild')}}</span></span></el-alert>
     <div class="resultTipsLine">
       <el-row :gutter="24">
         <el-col :span="12">
@@ -276,7 +277,9 @@ import echarts from 'echarts'
       refreshManual: 'No data, please click to refresh',
       loading: 'Loading...',
       refreshLater: 'No results, please try again later',
-      fetchError: 'Can\'t get the result as the record is missing'
+      fetchError: 'Can\'t get the result as the record is missing',
+      buildIndexAlertTip: 'No model index built. Build model index to speed up query.',
+      gotoBuild: 'Go to build'
     }
   },
   filters: {
@@ -327,6 +330,7 @@ export default class queryResult extends Vue {
   model = {
     uuid: ''
   }
+
   // 增加可视化按钮
   get insightBtnGroups () {
     return [
@@ -483,7 +487,7 @@ export default class queryResult extends Vue {
     if (this.extraoption.realizations && this.extraoption.realizations.length) {
       let realizations = []
       for (let i of this.extraoption.realizations) {
-        if (!((i.layoutId === -1 || i.layoutId === null || i.layoutId === 0) && i.indexType !== null)) {
+        if (!((i.layoutId === -1 || i.layoutId === null || i.layoutId === 0) && (i.indexType !== null && i.indexType !== 'Filter Conflict'))) {
           realizations.push(i)
         }
       }
@@ -531,10 +535,26 @@ export default class queryResult extends Vue {
     }
     return isAnyNull
   }
+  get includeFilterIndexType () {
+    let flag = false
+    if (this.extraoption.realizations && this.extraoption.realizations.length) {
+      for (let i in this.extraoption.realizations) {
+        if (this.extraoption.realizations[i].layoutId === -1 && this.extraoption.realizations[i].indexType === 'Filter Conflict') {
+          flag = true
+          break
+        }
+      }
+    }
+    return flag
+  }
   get noModelRangeTips () {
     return this.$store.state.project.multi_partition_enabled ? this.$t('noModelRangeTips2') : this.$t('noModelRangeTips')
   }
 
+  jumpRouter (path) {
+    this.$router.push(path)
+  }
+
   // 展示 layout 详情
   async openLayoutDetails (item) {
     const {modelId, layoutId} = item
@@ -828,6 +848,10 @@ export default class queryResult extends Vue {
         top: 0px;
       }
     }
+    .jump-link {
+      color: @ke-color-primary;
+      cursor: pointer;
+    }
     .el-table .cell{
        word-break: break-all!important;
     }


[kylin] 08/12: KYLIN-5550 change text in import model

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c3355e6e8009e3a7cab3939895f3259e0a168f5a
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 15:43:35 2023 +0800

    KYLIN-5550 change text in import model
---
 kystudio/src/components/common/ModelsImportModal/locales.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kystudio/src/components/common/ModelsImportModal/locales.js b/kystudio/src/components/common/ModelsImportModal/locales.js
index 5ddbeb2673..e17b9e0457 100644
--- a/kystudio/src/components/common/ModelsImportModal/locales.js
+++ b/kystudio/src/components/common/ModelsImportModal/locales.js
@@ -31,7 +31,7 @@ export default {
     viewDetails: ' View import rules',
     importTips1: 'The system recommends <b>replacing models with the same name in the project</b> if the following are all consistent: fact table, dimension table, join conditions, partition column and format, data loading method, and data filter condition.',
     importTips2: 'The system recommends <b>adding a new model</b> if any of the above items is inconsistent, or there is no model with the same name exists in the project.',
-    importTips3: 'The model <b>can\'t be imported</b> if any of the following is met: can\'t find tables or columns used in the model in the current project; the column\'s data type is inconsistent; the current project has a computed column with same name while the expression is different, or with same expression while using another name.',
+    importTips3: 'The model <b>can\'t be imported</b> if any of the following is met: can\'t find tables or columns used in the model in the current system; the column\'s data type is inconsistent; the current project has a computed column with same name while the expression is different, or with same expression while using another name.',
     modelName: 'Model Name',
     actions: 'Actions',
     addNew: 'Add New',
@@ -80,7 +80,7 @@ export default {
     confirmNoImportBtn: 'Not Import',
     confirmImportBtn: 'Import',
     sameCCNameTips: 'A computed column with same name has been found in model in the curent project, while using a different expression. Please rename it. ',
-    sameCCExpressionTips: 'A computed column with same expression has been found in model in the current project, while the name is "{sameCCName}". Please rename it.',
+    sameCCExpressionTips: 'A computed column with same expression has been found in model in the current system, while the name is "{sameCCName}". Please rename it.',
     validateErrorTips: 'The file parsing failed. Please check if the model metadata package is complete.',
     subPartition: 'Subpartition Columns: ',
     subPartitionValues: 'Subpartition Values: ',
@@ -104,7 +104,7 @@ export default {
     detailBtn: ' Details',
     notFoundTablesOrColumnsTip: 'This table or column has not been loaded into the current project. This causes the model can\'t  imported.',
     changeColumnsDataTypeTip: 'This data type of this column is inconsistent. This causes the model can\'t imported.',
-    noFoundItems: 'Can\'t find {items} used in the model in the current project',
+    noFoundItems: 'Can\'t find {items} used in the model in the current system',
     columnsDataTypeConflict: 'The columns\'s data types is inconsistent. ',
     cannotOverwriteTips: 'This causes the model can\'t replace the existing one in the project.',
     or: ' or ',


[kylin] 10/12: KYLIN-5552 add style of break words

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b4e366d894921cbeff3a2d357b7ae3397457597d
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 16:34:31 2023 +0800

    KYLIN-5552 add style of break words
---
 kystudio/src/components/studio/DDL/ddl.vue | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/kystudio/src/components/studio/DDL/ddl.vue b/kystudio/src/components/studio/DDL/ddl.vue
index 1a2a01205e..17d0214873 100644
--- a/kystudio/src/components/studio/DDL/ddl.vue
+++ b/kystudio/src/components/studio/DDL/ddl.vue
@@ -191,6 +191,7 @@
   </script>
   
   <style lang="less" scoped>
+  @import '../../../assets/styles/variables.less';
   .ddl-container {
     width: 100%;
     height: 100%;
@@ -234,13 +235,13 @@
         flex-direction: column;
         align-items: center;
         gap: 8px;
-        border-left: 1px solid #E6EBF4;
+        border-left: 1px solid @ke-border-secondary;
         padding: 8px 8px;
         box-sizing: border-box;
         .el-button {
-          color: #8B99AE;
+          color: @text-disabled-color;
           &.is-active {
-            background: #ECF0F8 !important;
+            background: @ke-background-color-hover !important;
           }
         }
       }
@@ -251,20 +252,21 @@
           .label {
             font-size: 14px;
             font-weight: 400;
-            color: #8B99AE;
+            color: @text-disabled-color;
             line-height: 22px;
             margin-bottom: 16px;
           }
           .item {
             font-size: 14px;
-            color: #2F374C;
+            color: @text-title-color;
             line-height: 22px;
+            word-break: break-all;
           }
           .trance-msg {
             height: 270px;
             overflow: auto;
-            background: #F8F9FB;
-            border: 1px solid #E6EBF4;
+            background: @ke-background-color-secondary;
+            border: 1px solid @ke-border-secondary;
             border-radius: 4px;
             margin-bottom: 16px;
             padding: 8px 16px;
@@ -319,7 +321,7 @@
       align-items: center;
       padding: 0 16px;
       box-sizing: border-box;
-      border-bottom: 1px solid #E6EBF4;
+      border-bottom: 1px solid @ke-border-secondary;
       .title {
         font-weight: 600;
         font-size: 16px;
@@ -328,6 +330,7 @@
   }
   </style>
   <style lang="less">
+  @import '../../../assets/styles/variables.less';
   .ddl-editor {
     .ace_content {
       width: 100% !important;
@@ -361,6 +364,6 @@
     }
   }
   .accelerator-key {
-    color: #8B99AE;
+    color: @text-disabled-color;
   }
   </style>


[kylin] 05/12: KYLIN-5547 change the style of recognize aggregate modal

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fbe00ccb6ff4591062ce6c8311b75c7f7b478929
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 11:24:56 2023 +0800

    KYLIN-5547 change the style of recognize aggregate modal
---
 .../RecognizeAggregateModal.vue                    | 22 ++++++++++++++++------
 .../common/RecognizeAggregateModal/locales.js      |  2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
index 8f0928880d..35192396dd 100644
--- a/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
+++ b/kystudio/src/components/common/RecognizeAggregateModal/RecognizeAggregateModal.vue
@@ -24,12 +24,13 @@
           </div>
           <AceEditor :key="isShow" :placeholder="'123'" class="text-input" ref="editorRef" :value="form.text" @input="handleInputText" />
           <div class="actions">
-            <el-tooltip :content="$t('dexecute')" placement="left">
-              <el-button icon-button class="recognize" size="small" type="primary" icon="el-icon-caret-right" :disabled="!form.text" @click="handleRecognize" />
+            <el-tooltip placement="left">
+              <div slot="content">{{$t('dexecute')}}<span class="accelerator-key">{{$t('acceleratorKey')}}</span></div>
+              <el-button icon-button class="recognize" size="small" type="primary" icon="el-ksd-n-icon-play-filled" :disabled="!form.text" @click="handleRecognize" />
             </el-tooltip>
           </div>
         </div>
-        <div class="recognize-results">
+        <div class="recognize-results" v-loading="loadingRecognize">
           <template v-if="form.dimensions.length">
             <div class="results-header">
               {{$tc('selectedDimensionCount', selectedDimensionCount, { count: selectedDimensionCount })}}
@@ -67,7 +68,7 @@
           {{$t('kylinLang.common.cancel')}}
         </el-button>
         <el-button type="primary" size="medium" :disabled="!selectedDimensionCount" @click="handleSubmit">
-          {{$t('kylinLang.common.submit')}}
+          {{$t('kylinLang.common.save')}}
         </el-button>
       </div>
     </el-dialog>
@@ -126,6 +127,8 @@
   })
   export default class RecognizeAggregateModal extends Vue {
     ALERT_STATUS = ALERT_STATUS
+    loadingRecognize = false
+
     @Watch('$lang')
     onLocaleChanged () {
       this.updatePlaceHolder()
@@ -279,8 +282,8 @@
       this.$nextTick(() => refreshEditor(editor))
     }
     handleDexecute (event) {
-      const { metaKey, key, keyCode } = event
-      if (metaKey && (keyCode === 13 || key === 'Enter')) {
+      const { metaKey, ctrlKey, key, keyCode } = event
+      if ((metaKey || ctrlKey) && (keyCode === 13 || key === 'Enter')) {
         this.handleRecognize()
       }
     }
@@ -301,6 +304,7 @@
       const dimensions = []
       this.clearupErrors()
       let formattedText = ''
+      this.loadingRecognize = true
       for (const text of form.text.replace(/\n*/g, '').split(/,\n*/g)) {
         const columnText = text.trim().toLocaleUpperCase()
         if (columnText) {
@@ -331,6 +335,9 @@
       this.setModalForm({ text: formattedText, dimensions })
       this.$nextTick(() => {
         this.showErrors()
+        setTimeout(() => {
+          this.loadingRecognize = false
+        }, 500)
       })
     }
     handlePrevious () {
@@ -571,5 +578,8 @@
       margin-left: 15px;
     }
   }
+  .accelerator-key {
+    color: @text-disabled-color;
+  }
   </style>
   
\ No newline at end of file
diff --git a/kystudio/src/components/common/RecognizeAggregateModal/locales.js b/kystudio/src/components/common/RecognizeAggregateModal/locales.js
index 31ebef97e2..c60a41ecea 100644
--- a/kystudio/src/components/common/RecognizeAggregateModal/locales.js
+++ b/kystudio/src/components/common/RecognizeAggregateModal/locales.js
@@ -10,7 +10,7 @@ export default {
     selectedDimensionCount: 'Select {count} results | Select {count} result | Select {count} results',
     usedDimensionCount: '{count} already exists',
     inputPlaceholder1: 'Please paste the text, separated by "," to identify the selected column.',
-    inputPlaceholder2: 'Example: CUSTOMER.C_CUSTKEY,CUSTOMER.C_CUSTKEY',
+    inputPlaceholder2: 'Example: CUSTOMER.C_CUSTKEY, CUSTOMER.C_CUSTKEY',
     inputPlaceholderTooltip1: 'Method 1: Enter the formula A1 & "," on a new column in Excel, enter and drag the bottom right corner of the cell to add in bulk;',
     inputPlaceholderTooltip2: 'Method 2: Select all the cells that need to added in bulk, right-click and select the cell format (shortcut cmd & ctrl + 1). Select "Custom", enter English format General "," or @ "," in the type, confirm and add in bulk.',
     inputPlaceholderTooltipTrigger: 'Not sure how to batch add characters?',


[kylin] 04/12: KYLIN-5543 support ddl

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2878bb8279c6d5c9e7614ff461ddc6f67c3386c2
Author: Qian Xia <la...@gmail.com>
AuthorDate: Mon Jun 5 17:54:59 2023 +0800

    KYLIN-5543 support ddl
---
 .../src/components/common/DataSourceBar/index.vue  |  48 ++-
 .../src/components/common/DataSourceBar/locales.js |   5 +-
 .../components/layout/layout_left_right_top.vue    |  17 +-
 kystudio/src/components/studio/DDL/ddl.vue         | 377 +++++++++++++++++++++
 .../src/components/studio/StudioSource/index.vue   |   1 +
 kystudio/src/config/index.js                       |   3 +-
 kystudio/src/config/spec.js                        |  14 +-
 kystudio/src/locale/en.js                          |   2 +
 kystudio/src/router/index.js                       |   4 +
 kystudio/src/service/datasource.js                 |   6 +
 kystudio/src/store/datasource.js                   |   8 +
 kystudio/src/store/system.js                       |   4 +-
 kystudio/src/store/types.js                        |   3 +
 13 files changed, 466 insertions(+), 26 deletions(-)

diff --git a/kystudio/src/components/common/DataSourceBar/index.vue b/kystudio/src/components/common/DataSourceBar/index.vue
index 5c5b7c482e..bd5b8c11d5 100644
--- a/kystudio/src/components/common/DataSourceBar/index.vue
+++ b/kystudio/src/components/common/DataSourceBar/index.vue
@@ -1,21 +1,32 @@
 <template>
 <div style="height: 100%;" class="clearfix">
   <aside class="data-source-bar" :style="dataSourceStyle">
-    <section class="header clearfix" v-if="isShowActionGroup && !hideBarTitle">
+    <section class="header" v-if="isShowActionGroup && !hideBarTitle">
       <div class="header-text ksd-title-module">
-        <span>{{$t('kylinLang.common.dataSource')}}</span>
+        <span>{{$t('kylinLang.common.dataSourceTable')}}</span>
       </div>
-      <div class="icon-btns clearfix">
+      <div class="icon-btns">
         <!-- <div :class="['header-icons', 'clearfix', {selected: isSwitchSource}]" v-if="isShowSourceSwitch">
           <el-tooltip :content="$t('sourceManagement')" effect="dark" placement="top">
             <i class="ksd-fs-14 el-icon-ksd-setting" @click="handleSwitchSource"></i>
           </el-tooltip>
         </div> -->
-        <div class="add-source-table-icon" v-if="isShowLoadTable">
+        <!-- <div class="add-source-table-icon" v-if="isShowLoadTable">
           <el-tooltip :content="$t('addDatasource')" effect="dark" placement="top">
             <i class="ksd-fs-14 el-icon-ksd-project_add"  @click="importDataSource('selectSource', currentProjectData)"></i>
           </el-tooltip>
-        </div>
+        </div> -->
+        <el-dropdown @command="addDataSource">
+          <el-button text type="primary" icon-button-mini icon="el-ksd-n-icon-plus-outlined"></el-button>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="default" :disabled="!isShowLoadTable">{{$t('importFromDatasource')}}</el-dropdown-item>
+            <!-- <el-tooltip effect="dark" placement="top" :disabled="!hasSecData || hasOrderbyOrSkipIndex('orderBy', 'current')">
+              <span slot="content">{{$t('disableAddOrderByIndexTip')}}<a href="javascript:void(0)" @click="$emit('jumpToSegment')">{{$t('goToDelete')}}</a></span>
+              <span><el-dropdown-item command="orderBy" :disabled="hasSecData || hasOrderbyOrSkipIndex('orderBy', 'current')">{{$t('orderByIndex')}}</el-dropdown-item></span>
+            </el-tooltip> -->
+            <el-dropdown-item command="ddl" v-if="$store.state.config.platform !== 'iframe' && datasourceActions.includes('ddl') && showDDL && $store.state.system.ddlEnabled === 'true'">{{$t('createByDDL')}} <el-tooltip effect="dark" :content="$t('createDDLTip')" placement="bottom"><i class="info-icon el-ksd-n-icon-info-circle-filled"></i></el-tooltip></el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
       </div>
     </section>
     <section class="body">
@@ -173,6 +184,10 @@ import { handleSuccessAsync, handleError, objectClone } from '../../../util'
     isSecondStorageEnabled: {
       type: Boolean,
       default: false
+    },
+    showDDL: {
+      type: Boolean,
+      default: false
     }
   },
   components: {
@@ -182,7 +197,8 @@ import { handleSuccessAsync, handleError, objectClone } from '../../../util'
     ...mapGetters([
       'isAdminRole',
       'isProjectAdmin',
-      'currentProjectData'
+      'currentProjectData',
+      'datasourceActions'
     ])
   },
   methods: {
@@ -330,6 +346,16 @@ export default class DataSourceBar extends Vue {
   hideLoading (data) {
     data.isLoading = false
   }
+  addDataSource (command) {
+    switch (command) {
+      case 'default':
+        this.importDataSource('selectSource', this.currentProjectData)
+        break
+      case 'ddl':
+        this.$router.push('/studio/ddl')
+        break
+    }
+  }
   async initTree () {
     try {
       this.isSearchIng = false
@@ -476,7 +502,7 @@ export default class DataSourceBar extends Vue {
       !isNotResetDefaultExpandedKeys && this.resetDefaultExpandedKeys()
       this.filterText = filterText
       freshTreeOrder(this)
-      this.selectFirstTable()
+      // this.selectFirstTable()
       resolve()
     })
   }
@@ -729,12 +755,13 @@ export default class DataSourceBar extends Vue {
     padding: 24px 16px 16px 16px;
     font-size: 16px;
     color: @text-title-color;
+    display: flex;
+    justify-content: space-between;
   }
   .body {
     padding: 0px 16px 16px;
   }
   .header-text {
-    float: left;
     span {
       line-height: 20px;
     }
@@ -742,7 +769,7 @@ export default class DataSourceBar extends Vue {
   .icon-btns {
     position: relative;
     height: 22px;
-    top: 2px;
+    // top: 2px;
   }
   .header-icons {
     float: right;
@@ -959,4 +986,7 @@ export default class DataSourceBar extends Vue {
     left: 0;
   }
 }
+.info-icon {
+  color: @text-placeholder-color;
+}
 </style>
diff --git a/kystudio/src/components/common/DataSourceBar/locales.js b/kystudio/src/components/common/DataSourceBar/locales.js
index 01ca76d98c..6429a88f26 100644
--- a/kystudio/src/components/common/DataSourceBar/locales.js
+++ b/kystudio/src/components/common/DataSourceBar/locales.js
@@ -19,6 +19,9 @@ export default {
     databases: 'Database',
     tables: 'Table',
     cloudHive: 'Object Storage',
-    factTable: 'Fact Table'
+    factTable: 'Fact Table',
+    importFromDatasource: 'Import from Data Source',
+    createByDDL: 'DDL Create',
+    createDDLTip: 'Data Definition Language Create Table'
   }
 }
diff --git a/kystudio/src/components/layout/layout_left_right_top.vue b/kystudio/src/components/layout/layout_left_right_top.vue
index 63dbeff82d..d07f7bfa81 100644
--- a/kystudio/src/components/layout/layout_left_right_top.vue
+++ b/kystudio/src/components/layout/layout_left_right_top.vue
@@ -329,15 +329,16 @@ export default class LayoutLeftRightTop extends Vue {
     }
   }
   showMenuByRole (menuName) {
-    let isShowSnapshot = true
-    let isShowStreamingJob = true
-    if (menuName === 'snapshot') {
-      isShowSnapshot = this.$store.state.project.snapshot_manual_management_enabled
+    switch (menuName) {
+      case 'snapshot':
+        return this.availableMenus.includes(menuName.toLowerCase()) && this.$store.state.project.snapshot_manual_management_enabled
+      case 'streamingjob':
+        return this.availableMenus.includes(menuName.toLowerCase()) && this.$store.state.system.streamingEnabled === 'true'
+      case 'ddl':
+        return this.availableMenus.includes(menuName.toLowerCase()) && this.$store.state.system.ddlEnabled === 'true'
+      default:
+        return this.availableMenus.includes(menuName.toLowerCase())
     }
-    if (menuName === 'streamingjob') {
-      isShowStreamingJob = this.$store.state.system.streamingEnabled === 'true'
-    }
-    return this.availableMenus.includes(menuName.toLowerCase()) && isShowSnapshot && isShowStreamingJob
   }
   defaultVal (obj) {
     if (!obj) {
diff --git a/kystudio/src/components/studio/DDL/ddl.vue b/kystudio/src/components/studio/DDL/ddl.vue
new file mode 100644
index 0000000000..40dfb12078
--- /dev/null
+++ b/kystudio/src/components/studio/DDL/ddl.vue
@@ -0,0 +1,377 @@
+<template>
+    <div class="ddl-container">
+      <div class="left-layout">
+        <div class="header">
+          <span class="title">{{$t('newDDLTable')}}</span>
+        </div>
+        <el-alert type="warning" show-icon v-if="showCreateSuccessAlert"><span slot="title">{{$t('createViewSuccessAlert')}} <a class="import-link" href="javascript:void(0);" @click="importDataSource">{{$t('goToImport')}}</a></span></el-alert>
+        <div class="editor-content">
+          <editor class="ddl-editor" v-model="content" ref="ddlEditor" lang="sql" theme="chrome" @keydown.meta.enter.native="runSql" @keydown.ctrl.enter.native="runSql"></editor>
+          <div class="run-btn">
+            <el-tooltip effect="dark" placement="left">
+              <div slot="content">{{$t('runBtnTip')}}<span class="accelerator-key">⌃/⌘ enter</span></div>
+              <el-button :loading="running" type="primary" icon-button size="big" icon="el-ksd-n-icon-play-filled" @click="runSql"></el-button>
+            </el-tooltip>
+          </div>
+        </div>
+      </div>
+      <div :class="['right-layout', {'expand': !!activeType}]">
+        <div class="action-btns">
+          <el-tooltip :content="$t('datasourceTable')" effect="dark" placement="left">
+            <el-badge is-dot class="sign-item" :hidden="true">
+              <el-button :class="{'is-active': activeType === 'database'}" text type="primary" icon-button-mini icon="icon el-ksd-n-icon-node-database-filled" @click="activeType = 'database'"></el-button>
+            </el-badge>
+          </el-tooltip>
+          <el-tooltip :content="$t('syntaxRules')" effect="dark" placement="left">
+            <el-badge is-dot class="sign-item" :hidden="!ddlError">
+              <el-button :class="{'is-active': activeType === 'result'}" text type="primary" icon-button-mini icon="icon el-ksd-n-icon-node-thunder-filled" @click="activeType = 'result'"></el-button>
+            </el-badge>
+          </el-tooltip>
+        </div>
+        <div class="panel-content-layout">
+          <div class="panel-header" v-if="activeType">
+            <span class="title">{{activeType === 'database' ? $t('datasourceTable') : $t('syntaxRules')}}</span>
+            <i class="el-ksd-n-icon-close-L-outlined close-btn" @click="activeType = ''"></i>
+          </div>
+          <div class="datasource-layout" v-show="activeType === 'database'">
+            <data-source-bar
+              ref="ddlDataSource"
+              class="data-source-layout"
+              :project-name="currentSelectedProject"
+              :is-show-action-group="false"
+              :is-show-load-source="false"
+              :is-show-load-table="datasourceActions.includes('loadSource') && $store.state.config.platform !== 'iframe'"
+              :is-expand-on-click-node="false"
+              :is-show-drag-width-bar="true"
+              :default-width="240"
+              :expand-node-types="['datasource', 'database']"
+              :hide-bar-title="$store.state.config.platform === 'iframe'"
+              :custom-tree-title="$store.state.config.platform !== 'iframe' ? '' : 'kylinLang.common.dataDirectory'"
+              @autoComplete="handleAutoComplete"
+              @click="clickTable">
+            </data-source-bar>
+          </div>
+          <div class="import-btn" v-if="activeType === 'database'"><el-button @click="importDataSource" type="primary" size="big" icon="el-ksd-n-icon-inport-outlined">{{$t('importDataSource')}}</el-button></div>
+          <template v-if="activeType === 'result'">
+            <div class="feedback-suggestions">
+              <div class="suggestion-list">
+                <div class="label">{{$t('createDDLSuggestionTitle')}}</div>
+                <el-alert v-if="errorMsg" class="ksd-mb-16" :title="errorMsg" type="error" show-icon :closable="false"></el-alert>
+                <div v-if="stacktrace" class="trance-msg">{{stacktrace}}</div>
+                <div class="item" v-for="(item, index) in ($lang === 'en' ? rules[0] : rules[1])" :key="index">{{index + 1}}. {{item}}</div>
+              </div>
+            </div>
+          </template>
+        </div>
+      </div>
+    </div>
+  </template>
+  <script>
+  import { Component, Vue } from 'vue-property-decorator'
+  import { mapActions, mapGetters } from 'vuex'
+  import DataSourceBar from '../../common/DataSourceBar'
+  import { insightKeyword } from '../../../config'
+  import { handleSuccessAsync, handleError } from '../../../util'
+  @Component({
+    computed: {
+      ...mapGetters([
+        'currentSelectedProject',
+        'datasourceActions',
+        'currentProjectData'
+      ])
+    },
+    methods: {
+      ...mapActions({
+        getDDLDescription: 'DDL_DESCRIPTION',
+        runDDL: 'RUN_DDL'
+      })
+    },
+    components: {
+      DataSourceBar
+    },
+    locales: {
+      en: {
+        newDDLTable: 'New DDL Table',
+        datasourceTable: 'Data Source Table',
+        syntaxRules: 'Syntax Rules',
+        createDDLSuggestionTitle: '在 KE 中创建 DDL Table 需要遵循 KE 的语法规则。',
+        importDataSource: 'Import',
+        runBtnTip: '执行 ',
+        runSuccess: 'Dexecute succeed.',
+        runFailed: 'Execute Failed,Please check and try again.',
+        createViewSuccessAlert: 'The DDL Table is created to hive after executing "Create View". Please importing the table to data source to be available.',
+        goToImport: 'Go to Import'
+      },
+      'zh-cn': {
+        newDDLTable: '新的 DDL 表',
+        datasourceTable: '数据源表',
+        syntaxRules: '语法规则',
+        createDDLSuggestionTitle: '在 KE 中创建 DDL Table 需要遵循 KE 的语法规则。',
+        importDataSource: '导入',
+        runBtnTip: 'Dexecute ',
+        runSuccess: '执行成功',
+        runFailed: '执行失败,请检查后重试',
+        createViewSuccessAlert: '“Create View” 执行后 DDL Table 创建至 Hive,需从数据源导入后可用。',
+        goToImport: '立即导入'
+      }
+    }
+  })
+  export default class DDL extends Vue {
+    content = ''
+    activeType = ''
+    rules = []
+    ddlError = false
+    errorMsg = ''
+    stacktrace = ''
+    running = false
+    showCreateSuccessAlert = false
+    setOption (option) {
+      let editor = this.$refs.ddlEditor.editor
+      editor.setOptions(Object.assign({
+        wrap: 'free',
+        enableBasicAutocompletion: true,
+        enableSnippets: true,
+        enableLiveAutocompletion: true
+      }, option))
+    }
+    handleAutoComplete (data) {
+      this.completeData = [...data, ...insightKeyword]
+    }
+    clickTable (leaf) {
+      this.$nextTick(() => {
+        if (leaf) {
+          this.insertEditorContent(leaf.label)
+        }
+      })
+    }
+    importDataSource () {
+      this.$refs.ddlDataSource && this.$refs.ddlDataSource.importDataSource('selectSource', this.currentProjectData)
+    }
+    insertEditorContent (data) {
+      const editor = this.$refs.ddlEditor.editor
+      editor.focus()
+      editor.insert(data)
+      this.content = editor.getValue()
+    }
+    async runSql () {
+      try {
+        this.ddlError = false
+        this.running = true
+        const res = await this.runDDL({
+          sql: this.content,
+          project: this.currentSelectedProject
+        })
+        const resultData = await handleSuccessAsync(res)
+        this.running = false
+        this.showCreateSuccessAlert = this.content.toLocaleLowerCase().indexOf('create view') > -1
+        this.showCreateSuccessAlert && this.insertEditorContent(`\n\n${resultData}`)
+        this.resetErrorMsg()
+        this.$message({ type: 'success', message: this.$t('runSuccess') })
+      } catch (e) {
+        const err = e.body
+        this.ddlError = true
+        this.errorMsg = err.msg
+        this.stacktrace = err.stacktrace
+        this.activeType = 'result'
+        this.running = false
+        this.showCreateSuccessAlert = false
+        this.$message({ type: 'error', message: this.$t('runFailed') })
+        // handleError(e)
+      }
+    }
+    resetErrorMsg () {
+      this.errorMsg = ''
+      this.stacktrace = ''
+    }
+    async getDDLRules () {
+      try {
+        const result = await this.getDDLDescription({project: this.currentSelectedProject, page_type: 'hive'})
+        const rules = await handleSuccessAsync(result)
+        this.rules = rules
+      } catch (e) {
+        handleError(e)
+      }
+    }
+    created () {
+      this.getDDLRules()
+    }
+    mounted () {
+      this.setOption()
+    }
+  }
+  </script>
+  
+  <style lang="less" scoped>
+  .ddl-container {
+    width: 100%;
+    height: 100%;
+    display: flex;
+    .left-layout {
+      flex: 1;
+      display: flex;
+      flex-direction: column;
+      .editor-content {
+        flex: 1;
+        position: relative;
+        .run-btn {
+          width: 40px;
+          height: 38px;
+          position: absolute;
+          right: 16px;
+          bottom: 16px;
+        }
+      }
+      .import-link {
+        color: #1268FB;
+      }
+    }
+    .right-layout {
+      width: 46px;
+      transition: width .5s;
+      display: flex;
+      &.expand {
+        width: 330px;
+      }
+      .sign-item {
+        .is-dot {
+          right: 7px;
+          margin-top: 2px;
+        }
+      }
+      .action-btns {
+        width: 46px;
+        height: 100%;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        gap: 8px;
+        border-left: 1px solid #E6EBF4;
+        padding: 8px 8px;
+        box-sizing: border-box;
+        .el-button {
+          color: #8B99AE;
+          &.is-active {
+            background: #ECF0F8 !important;
+          }
+        }
+      }
+      .feedback-suggestions {
+        padding: 16px 8px;
+        box-sizing: border-box;
+        .suggestion-list {
+          .label {
+            font-size: 14px;
+            font-weight: 400;
+            color: #8B99AE;
+            line-height: 22px;
+            margin-bottom: 16px;
+          }
+          .item {
+            font-size: 14px;
+            color: #2F374C;
+            line-height: 22px;
+          }
+          .trance-msg {
+            height: 270px;
+            overflow: auto;
+            background: #F8F9FB;
+            border: 1px solid #E6EBF4;
+            border-radius: 4px;
+            margin-bottom: 16px;
+            padding: 8px 16px;
+            box-sizing: border-box;
+            word-break: break-word;
+          }
+        }
+      }
+      .panel-content-layout {
+        height: 100%;
+        width: 284px;
+        flex: 1;
+        display: flex;
+        flex-direction: column;
+        .panel-header {
+          height: 60px;
+          padding: 0 8px;
+          box-sizing: border-box;
+          position: relative;
+          .title {
+            line-height: 60px;
+            font-weight: 600;
+            font-size: 16px;
+          }
+          .close-btn {
+            position: absolute;
+            line-height: 60px;
+            right: 25px;
+            cursor: pointer;
+          }
+        }
+        .datasource-layout {
+          flex: 1;
+          height: 0;
+        }
+        .data-source-layout {
+          overflow: hidden;
+        }
+        .import-btn {
+          height: 70px;
+          padding: 16px;
+          box-sizing: border-box;
+          .el-button {
+            width: 100%;
+          }
+        }
+      }
+    }
+    .header {
+      height: 60px;
+      display: flex;
+      align-items: center;
+      padding: 0 16px;
+      box-sizing: border-box;
+      border-bottom: 1px solid #E6EBF4;
+      .title {
+        font-weight: 600;
+        font-size: 16px;
+      }
+    }
+  }
+  </style>
+  <style lang="less">
+  .ddl-editor {
+    .ace_content {
+      width: 100% !important;
+    }
+    .ace_print-margin {
+      visibility: hidden !important;
+    }
+  }
+  .panel-content-layout {
+    .data-source-bar {
+      width: 100% !important;
+      height: 100%;
+      .body {
+        width: 100%;
+        height: 100%;
+        padding: 0;
+        .el-tree {
+          border: 0;
+        }
+      }
+      .el-input__inner {
+        border: 0;
+        box-shadow: none;
+      }
+    }
+  }
+  .sign-item {
+    .el-badge__content.is-fixed.is-dot {
+      right: 7px;
+      margin-top: 2px;
+    }
+  }
+  .accelerator-key {
+    color: #8B99AE;
+  }
+  </style>
diff --git a/kystudio/src/components/studio/StudioSource/index.vue b/kystudio/src/components/studio/StudioSource/index.vue
index ad9ef9f008..7aa6d0fbf5 100644
--- a/kystudio/src/components/studio/StudioSource/index.vue
+++ b/kystudio/src/components/studio/StudioSource/index.vue
@@ -6,6 +6,7 @@
         <DataSourceBar
           :ignore-node-types="['column']"
           ref="datasource-bar"
+          :showDDL="true"
           :project-name="currentSelectedProject"
           :is-show-load-source="true"
           :is-show-load-table="datasourceActions.includes('loadSource')"
diff --git a/kystudio/src/config/index.js b/kystudio/src/config/index.js
index 1c9e1da646..b8ecc8af02 100644
--- a/kystudio/src/config/index.js
+++ b/kystudio/src/config/index.js
@@ -57,7 +57,8 @@ export const menusData = [
     children: [
       { name: 'source', path: '/studio/source' },
       { name: 'modelList', path: '/studio/model' },
-      { name: 'snapshot', path: '/studio/snapshot' }
+      { name: 'snapshot', path: '/studio/snapshot' },
+      { name: 'ddl', path: '/studio/ddl' }
     ]
   },
   {
diff --git a/kystudio/src/config/spec.js b/kystudio/src/config/spec.js
index 1227a5b5ed..236d4d168e 100644
--- a/kystudio/src/config/spec.js
+++ b/kystudio/src/config/spec.js
@@ -18,6 +18,7 @@ export default {
       { "id": "modelDetails", "value": "modeldetails", "title": "Model Details" },
       { "id": "modelSubPartitionValues", "value": "modelsubpartitionvalues", "title": "Model SubPartition Values" },
       { "id": "snapshot", "value": "snapshot", "title": "Snapshot" },
+      { "id": "ddl", "value": "ddl", "title": "DDL" },
       { "id": "monitor", "value": "monitor", "title": "Monitor" },
       { "id": "job", "value": "job", "title": "Job" },
       { "id": "streamingJob", "value": "streamingjob", "title": "streamingJob" },
@@ -76,7 +77,8 @@ export default {
       { "id": "tableIndexActions" },
       { "id": "viewDataSource" },
       { "id": "changeBuildType" },
-      { "id": "changePartition" }
+      { "id": "changePartition" },
+      { "id": "ddl" }
     ],
     "modelActions": [
       { "id": "dataLoad" },
@@ -150,12 +152,12 @@ export default {
       "keyPattern": "groupRole-projectRole-menu",
       "entries": [
         { "key": "systemAdmin-*-[project,user,group,groupDetail,projectAuthority,diagnostic]", "value": "admin,project,user,group,groupDetail,diagnostic,projectAuthority" },
-        { "key": "systemAdmin-*-[dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,monitor,job,streamingJob]", "value": "dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,monitor,job,streamingJob,admin" },
+        { "key": "systemAdmin-*-[dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,ddl,monitor,job,streamingJob]", "value": "dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,ddl,monitor,job,streamingJob,admin" },
         { "key": "systemUser-admin-[project,user,group,groupDetail,projectAuthority]", "value": "project,admin,projectAuthority" },
-        { "key": "systemUser-admin-[dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,monitor,job,streamingJob]", "value": "dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,monitor,job,streamingJob,admin" },
-        { "key": "systemUser-management-*", "value": "dashboard,query,insight,queryHistory,studio,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,monitor,job,streamingJob" },
-        { "key": "systemUser-operation-*", "value": "dashboard,query,insight,queryHistory,studio,model,modelDetails,snapshot,index,monitor,job,streamingJob,modelSubPartitionValues" },
-        { "key": "systemUser-read-*", "value": "dashboard,query,insight,queryHistory,studio,model,modelDetails,snapshot,index" },
+        { "key": "systemUser-admin-[dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,ddl,monitor,job,streamingJob]", "value": "dashboard,query,insight,queryHistory,studio,setting,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,ddl,monitor,job,streamingJob,admin" },
+        { "key": "systemUser-management-*", "value": "dashboard,query,insight,queryHistory,studio,source,model,index,modelEdit,modelDetails,modelSubPartitionValues,snapshot,ddl,monitor,job,streamingJob" },
+        { "key": "systemUser-operation-*", "value": "dashboard,query,insight,queryHistory,studio,model,modelDetails,snapshot,ddl,index,monitor,job,streamingJob,modelSubPartitionValues" },
+        { "key": "systemUser-read-*", "value": "dashboard,query,insight,queryHistory,studio,model,modelDetails,snapshot,ddl,index" },
         { "key": "systemUser-default-*", "value": "dashboard" }
       ]
     },
diff --git a/kystudio/src/locale/en.js b/kystudio/src/locale/en.js
index fa9d97ad4c..22357326e7 100644
--- a/kystudio/src/locale/en.js
+++ b/kystudio/src/locale/en.js
@@ -68,6 +68,7 @@ exports.default = {
     jobs: 'Jobs',
     cubes: 'Cubes',
     dataSource: 'Data Source',
+    dataSourceTable: 'Data Source Table',
     fact: 'Fact Table',
     limitfact: 'Lookup Table(limited)',
     lookup: 'Lookup Table',
@@ -490,6 +491,7 @@ exports.default = {
     index: 'Index',
     modeledit: 'Model Edit',
     snapshot: 'Snapshot',
+    ddl: 'DDL',
     refresh: 'Refresh',
     systemcapacity: 'Capacity'
   },
diff --git a/kystudio/src/router/index.js b/kystudio/src/router/index.js
index b0b6b3c545..4c75e0a7e7 100644
--- a/kystudio/src/router/index.js
+++ b/kystudio/src/router/index.js
@@ -80,6 +80,10 @@ let routerOptions = {
         name: 'Snapshot',
         path: 'studio/snapshot',
         component: () => import('../components/studio/snapshot/snapshot.vue')
+      }, {
+        name: 'DDL',
+        path: 'studio/ddl',
+        component: () => import('../components/studio/DDL/ddl.vue')
       }, {
         name: 'Project',
         path: 'admin/project',
diff --git a/kystudio/src/service/datasource.js b/kystudio/src/service/datasource.js
index e70b0d67b0..7e00128f44 100644
--- a/kystudio/src/service/datasource.js
+++ b/kystudio/src/service/datasource.js
@@ -315,5 +315,11 @@ export default {
   },
   exportCSV (data) {
     return Vue.http.post(apiUrl + 'query/format/csv', data, {emulateJSON: true})
+  },
+  getDDLDescrition (data) {
+    return Vue.resource(apiUrl + 'spark_source/ddl/description').get(data)
+  },
+  runDDL (data) {
+    return Vue.resource(apiUrl + 'spark_source/ddl').save(data)
   }
 }
diff --git a/kystudio/src/store/datasource.js b/kystudio/src/store/datasource.js
index 199d27154d..ac31bd3994 100644
--- a/kystudio/src/store/datasource.js
+++ b/kystudio/src/store/datasource.js
@@ -394,6 +394,14 @@ export default {
     },
     [types.EXPORT_CSV]: function ({commit}, data) {
       return api.datasource.exportCSV(data)
+    },
+    // 获取 ddl 规则
+    [types.DDL_DESCRIPTION]: function (_, data) {
+      return api.datasource.getDDLDescrition(data)
+    },
+    // 执行 ddl 语句
+    [types.RUN_DDL]: function (_, data) {
+      return api.datasource.runDDL(data)
     }
   }
 }
diff --git a/kystudio/src/store/system.js b/kystudio/src/store/system.js
index b662f17c36..7607926d28 100644
--- a/kystudio/src/store/system.js
+++ b/kystudio/src/store/system.js
@@ -59,7 +59,8 @@ export default {
     isShowSecondStorage: false,
     isNonAdminGenQueryDiagPackage: 'true',
     streamingEnabled: 'false',
-    storageQuery: 'true'
+    storageQuery: 'true',
+    ddlEnabled: 'false'
   },
   mutations: {
     [types.COLLECT_MESSAGE_DIRECTIVES]: (state, directive) => {
@@ -183,6 +184,7 @@ export default {
           commit(types.GET_CONF_BY_NAME, {name: 'kylin.model.measure-name-check-enabled', key: 'enableCheckName', defaultValue: 'true'})
           commit(types.GET_CONF_BY_NAME, {name: 'kylin.streaming.enabled', key: 'streamingEnabled', defaultValue: 'false'})
           commit(types.GET_CONF_BY_NAME, {name: 'kylin.second-storage.query-metric-collect', key: 'storageQuery', defaultValue: 'true'})
+          commit(types.GET_CONF_BY_NAME, {name: 'kylin.source.ddl.enabled', key: 'ddlEnabled', defaultValue: 'false'})
           resolve(response)
         }, () => {
           reject()
diff --git a/kystudio/src/store/types.js b/kystudio/src/store/types.js
index 29a4f333de..7ce238b2e7 100644
--- a/kystudio/src/store/types.js
+++ b/kystudio/src/store/types.js
@@ -180,6 +180,9 @@ export const SUBMIT_ACCESS_DATA = 'SUBMIT_ACCESS_DATA'
 export const EXPORT_CSV = 'EXPORT_CSV'
 
 export const LOAD_DATASOURCE_OF_MODEL = 'LOAD_DATASOURCE_OF_MODEL'
+
+export const DDL_DESCRIPTION = 'DDL_DESCRIPTION'
+export const RUN_DDL = 'RUN_DDL'
 // acl table
 export const GET_ACL_SET_TABLE = 'GET_ACL_SET_TABLE'
 export const SAVE_ACL_SET_TABLE = 'SAVE_ACL_SET_TABLE'


[kylin] 06/12: KYLIN-5548 change ddl text

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 425b15452413838cb9b2b4676051cb3506d35c6f
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 14:56:51 2023 +0800

    KYLIN-5548 change ddl text
---
 kystudio/src/components/studio/DDL/ddl.vue | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/kystudio/src/components/studio/DDL/ddl.vue b/kystudio/src/components/studio/DDL/ddl.vue
index 40dfb12078..1a2a01205e 100644
--- a/kystudio/src/components/studio/DDL/ddl.vue
+++ b/kystudio/src/components/studio/DDL/ddl.vue
@@ -9,7 +9,7 @@
           <editor class="ddl-editor" v-model="content" ref="ddlEditor" lang="sql" theme="chrome" @keydown.meta.enter.native="runSql" @keydown.ctrl.enter.native="runSql"></editor>
           <div class="run-btn">
             <el-tooltip effect="dark" placement="left">
-              <div slot="content">{{$t('runBtnTip')}}<span class="accelerator-key">⌃/⌘ enter</span></div>
+              <div slot="content">{{$t('runBtnTip')}}<span class="accelerator-key">{{$t('acceleratorKey')}}</span></div>
               <el-button :loading="running" type="primary" icon-button size="big" icon="el-ksd-n-icon-play-filled" @click="runSql"></el-button>
             </el-tooltip>
           </div>
@@ -94,25 +94,14 @@
         newDDLTable: 'New DDL Table',
         datasourceTable: 'Data Source Table',
         syntaxRules: 'Syntax Rules',
-        createDDLSuggestionTitle: '在 KE 中创建 DDL Table 需要遵循 KE 的语法规则。',
+        createDDLSuggestionTitle: 'To create a DDL Table in KE, you need to follow the syntax rules of KE.',
         importDataSource: 'Import',
-        runBtnTip: '执行 ',
-        runSuccess: 'Dexecute succeed.',
-        runFailed: 'Execute Failed,Please check and try again.',
+        runBtnTip: 'Execute ',
+        acceleratorKey: '⌃/⌘ enter',
+        runSuccess: 'Execute succeed.',
+        runFailed: 'Execute Failed, Please check and try again.',
         createViewSuccessAlert: 'The DDL Table is created to hive after executing "Create View". Please importing the table to data source to be available.',
         goToImport: 'Go to Import'
-      },
-      'zh-cn': {
-        newDDLTable: '新的 DDL 表',
-        datasourceTable: '数据源表',
-        syntaxRules: '语法规则',
-        createDDLSuggestionTitle: '在 KE 中创建 DDL Table 需要遵循 KE 的语法规则。',
-        importDataSource: '导入',
-        runBtnTip: 'Dexecute ',
-        runSuccess: '执行成功',
-        runFailed: '执行失败,请检查后重试',
-        createViewSuccessAlert: '“Create View” 执行后 DDL Table 创建至 Hive,需从数据源导入后可用。',
-        goToImport: '立即导入'
       }
     }
   })


[kylin] 09/12: KYLIN-5551 get query history within one day

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 40165755ba42868790fde247a9e575160cd0cd84
Author: Qian Xia <la...@gmail.com>
AuthorDate: Tue Jun 6 16:10:30 2023 +0800

    KYLIN-5551 get query history within one day
---
 kystudio/src/components/query/query_history.vue       | 6 +++++-
 kystudio/src/components/query/query_history_table.vue | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/kystudio/src/components/query/query_history.vue b/kystudio/src/components/query/query_history.vue
index 1ae5b47fb8..3143c248fe 100644
--- a/kystudio/src/components/query/query_history.vue
+++ b/kystudio/src/components/query/query_history.vue
@@ -87,8 +87,12 @@ import { pageRefTags, apiUrl, bigPageCount } from 'config'
         vm.filterDirectData.startTimeFrom = tm - 1000 * 60 * 60 * 24 * 7
         vm.filterDirectData.startTimeTo = tm
         return
+      } else {
+        let tm = new Date(new Date().toDateString()).getTime()
+        vm.filterDirectData.startTimeFrom = tm
+        vm.filterDirectData.startTimeTo = tm + 1000 * 60 * 60 * 24 * 1
       }
-      vm.currentSelectedProject && vm.loadHistoryList()
+      // vm.currentSelectedProject && vm.loadHistoryList()
     })
   },
   methods: {
diff --git a/kystudio/src/components/query/query_history_table.vue b/kystudio/src/components/query/query_history_table.vue
index d9c8ec41c3..2e9e438282 100644
--- a/kystudio/src/components/query/query_history_table.vue
+++ b/kystudio/src/components/query/query_history_table.vue
@@ -935,7 +935,11 @@ export default class QueryHistoryTable extends Vue {
       const index = this.filterTags.map(item => item.key).indexOf('server')
       this.filterTags.splice(index, 1)
     } else {
-      const index = this.filterData[tag.key].indexOf(tag.label)
+      let delLabel = tag.label
+      if (tag.key === 'realization' && tag.label === 'allModels') {
+        delLabel = 'modelName'
+      }
+      const index = this.filterData[tag.key].indexOf(delLabel)
       index > -1 && this.filterData[tag.key].splice(index, 1)
       this.filterTags = this.filterTags.filter(item => item.key !== tag.key || item.key === tag.key && tag.label !== item.label)
     }