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 11a91ca0be7aa53b890e8927b21be8bf1f9cc53f
Author: Qian Xia <lauraxiaq...@gmail.com>
AuthorDate: Thu Jul 27 17:53:32 2023 +0800

    KYLIN-5672 advance operator issue
---
 .../src/components/common/DataSourceModal/locales.js    |  2 +-
 kystudio/src/components/layout/layout_full.vue          |  9 +++++++--
 kystudio/src/components/project/project_authority.vue   | 13 +++++++++++--
 kystudio/src/components/query/query_history.vue         |  9 ++++++---
 kystudio/src/components/query/query_result.vue          |  9 ++++++---
 .../StudioModel/ModelList/ModelAggregate/index.vue      | 13 ++++++++++---
 .../StudioModel/ModelList/ModelLayout/modelLayout.vue   | 17 +++++++++--------
 kystudio/src/store/system.js                            |  7 ++++++-
 kystudio/src/store/user.js                              |  7 +++++++
 9 files changed, 63 insertions(+), 23 deletions(-)

diff --git a/kystudio/src/components/common/DataSourceModal/locales.js 
b/kystudio/src/components/common/DataSourceModal/locales.js
index 9a9da86499..3ebf86b2fc 100644
--- a/kystudio/src/components/common/DataSourceModal/locales.js
+++ b/kystudio/src/components/common/DataSourceModal/locales.js
@@ -18,6 +18,6 @@ export default {
     needAttachedHiveTableInfo: 'Please select an attached Hive table.',
     needTimestampColumnInfo: 'Can\'t load. Please ensure the table has at 
least a timestamp column.',
     hiveTableErrorTips: 'Can\'t attach. Please ensure that the columns of the 
Kafka table and the Hive table are identical.',
-    tableNumOver: 'Up to 1000 tables could be loaded per time, please modify 
and try again.'
+    tableNumOver: 'Up to 1000 tables could be loaded per time, please modify 
and resubmit.'
   }
 }
diff --git a/kystudio/src/components/layout/layout_full.vue 
b/kystudio/src/components/layout/layout_full.vue
index 9738eec92b..33922c0fcd 100644
--- a/kystudio/src/components/layout/layout_full.vue
+++ b/kystudio/src/components/layout/layout_full.vue
@@ -43,11 +43,15 @@
 <script>
 import Vue from 'vue'
 import { Component, Watch } from 'vue-property-decorator'
-import { mapState } from 'vuex'
+import { mapState, mapGetters } from 'vuex'
 import Modal from '../common/Modal/Modal'
 import { filterInjectScript } from 'util'
 @Component({
   computed: {
+    ...mapGetters([
+      'isProjectOperator',
+      'isAdvancedOperator'
+    ]),
     ...mapState({
       showErrorMsgBox: state => state.config.errorMsgBox.isShow,
       enableStackTrace: state => state.system.enableStackTrace
@@ -55,7 +59,8 @@ import { filterInjectScript } from 'util'
   },
   provide () {
     return {
-      forceUpdateRoute: this.forceUpdateRoute
+      forceUpdateRoute: this.forceUpdateRoute,
+      isAdvancedOperatorUser: () => this.isProjectOperator && 
this.isAdvancedOperator // 高级运维人员,可以设计索引
     }
   },
   components: {
diff --git a/kystudio/src/components/project/project_authority.vue 
b/kystudio/src/components/project/project_authority.vue
index 7978a3179e..518c95fdd1 100644
--- a/kystudio/src/components/project/project_authority.vue
+++ b/kystudio/src/components/project/project_authority.vue
@@ -71,7 +71,8 @@
     <el-dialog :title="authorTitle" width="960px" class="user-access-dialog" 
:close-on-press-escape="false" :close-on-click-modal="false" 
:visible.sync="authorizationVisible" @close="initAccessData">
       <div class="content-container">
         <div class="author-tips">
-          <div class="item-point" v-html="$t('authorTips2')"></div>
+          <div class="item-point" v-if="!isAdvancedOperatorUser()" 
v-html="$t('authorTips2')"></div>
+          <div class="item-point" v-else v-html="$t('authorTips3')"></div>
           <div class="item-point ksd-mt-16">{{$t('authorTips')}}</div>
           <div class="item-point">{{$t('authorTips1')}}</div>
         </div>
@@ -168,6 +169,9 @@ import userAccess from './user_access'
       'projectActions'
     ])
   },
+  inject: [
+    'isAdvancedOperatorUser'
+  ],
   components: {
     'user_access': userAccess
   },
@@ -206,9 +210,14 @@ import userAccess from './user_access'
       authorTips1: 'By default, the added user/user group would be granted 
full access to all the tables in the project.',
       authorTips2: `<div class="ksd-mb-8">What roles does Kyligence Enterprise 
provide?</div>
       <p><span>Project Admin</span><span>For the project admin who needs all 
permission and could manage and maintain this project, including loading 
tables, authorizing user access permission, etc.</span></p>
-      <p><span>Management</span><span>For the model designer who needs 
permission to load tables, design models, build indexes and monitor job 
status.</span></p>
+      <p><span>Management</span><span>For the model designer who needs 
permission to load tables, design models and indexes, build indexes and monitor 
job status.</span></p>
       <p><span>Operation</span><span>For the operator who needs permission to 
build indexes and monitor job status.</span></p>
       <p><span>Query</span><span>For the business analyst who needs permission 
to query tables or indexes.</span></p>`,
+      authorTips3: `<div class="ksd-mb-8">What roles does Kyligence Enterprise 
provide?</div>
+      <p><span>Project Admin</span><span>For the project admin who needs all 
permission and could manage and maintain this project, including loading 
tables, authorizing user access permission, etc.</span></p>
+      <p><span>Management</span><span>For the model designer who needs 
permission to load tables, design models and indexes, build indexes and monitor 
job status.</span></p>
+      <p><span>Operation</span><span>For the operator who needs permission to 
design indexes, build indexes and monitor job status.</span></p>
+      <p><span>Query</span><span>For the business analyst who needs permission 
to query tables or indexes.</span></p>`,
       noAuthorityTip: 'Access denied. Please try again after logging in.'
     }
   }
diff --git a/kystudio/src/components/query/query_history.vue 
b/kystudio/src/components/query/query_history.vue
index 3143c248fe..2102f3b78c 100644
--- a/kystudio/src/components/query/query_history.vue
+++ b/kystudio/src/components/query/query_history.vue
@@ -25,9 +25,9 @@
         :project-name="currentSelectedProject"
         :layout-id="aggIndexLayoutId"
         :is-show-aggregate-action="false"
-        :isShowEditAgg="datasourceActions.includes('editAggGroup')"
-        :isShowBulidIndex="datasourceActions.includes('buildIndex')"
-        
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions')">
+        :isShowEditAgg="datasourceActions.includes('editAggGroup') || 
isAdvancedOperatorUser()"
+        :isShowBulidIndex="datasourceActions.includes('buildIndex') || 
isAdvancedOperatorUser()"
+        
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions') || 
isAdvancedOperatorUser()">
       </ModelAggregate>
     </el-dialog>
 
@@ -101,6 +101,9 @@ import { pageRefTags, apiUrl, bigPageCount } from 'config'
       loadOnlineQueryNodes: 'LOAD_ONLINE_QUERY_NODES'
     })
   },
+  inject: [
+    'isAdvancedOperatorUser'
+  ],
   computed: {
     ...mapGetters([
       'currentSelectedProject',
diff --git a/kystudio/src/components/query/query_result.vue 
b/kystudio/src/components/query/query_result.vue
index 0217620557..5797e7c7c4 100644
--- a/kystudio/src/components/query/query_result.vue
+++ b/kystudio/src/components/query/query_result.vue
@@ -185,9 +185,9 @@
         :project-name="currentSelectedProject"
         :layout-id="aggIndexLayoutId"
         :is-show-aggregate-action="false"
-        :isShowEditAgg="datasourceActions.includes('editAggGroup')"
-        :isShowBulidIndex="datasourceActions.includes('buildIndex')"
-        
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions')">
+        :isShowEditAgg="datasourceActions.includes('editAggGroup') || 
isAdvancedOperatorUser()"
+        :isShowBulidIndex="datasourceActions.includes('buildIndex') || 
isAdvancedOperatorUser()"
+        
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions') || 
isAdvancedOperatorUser()">
       </ModelAggregate>
     </el-dialog>
   </div>
@@ -214,6 +214,9 @@ import echarts from 'echarts'
       callGlobalDetailDialog: 'CALL_MODAL'
     })
   },
+  inject: [
+    'isAdvancedOperatorUser'
+  ],
   computed: {
     ...mapGetters([
       'currentSelectedProject',
diff --git 
a/kystudio/src/components/studio/StudioModel/ModelList/ModelAggregate/index.vue 
b/kystudio/src/components/studio/StudioModel/ModelList/ModelAggregate/index.vue
index 6f4e55eaf1..8e6b0e09a3 100644
--- 
a/kystudio/src/components/studio/StudioModel/ModelList/ModelAggregate/index.vue
+++ 
b/kystudio/src/components/studio/StudioModel/ModelList/ModelAggregate/index.vue
@@ -62,7 +62,7 @@
               </el-dropdown>
                 <el-button icon="el-ksd-icon-build_index_22" 
:disabled="!checkedList.length || isHaveLockedIndex" text type="primary" 
class="ksd-ml-2 ksd-fleft" v-if="datasourceActions.includes('buildIndex')" 
@click="complementedIndexes('batchIndexes')">{{$t('buildIndex')}}</el-button>
               <template>
-                <el-tooltip placement="top" 
:content="$t('disabledDelBaseIndexTips')" 
v-if="datasourceActions.includes('delAggIdx')&&isDisableDelBaseIndex">
+                <el-tooltip placement="top" 
:content="$t('disabledDelBaseIndexTips')" 
v-if="isHaveDelIndexActionSpec&&isDisableDelBaseIndex">
                   <div class="ksd-fleft">
                     <el-dropdown
                       split-button
@@ -73,7 +73,7 @@
                       :class="{'is-disabled': isDisableDelBaseIndex}"
                       placement="bottom-start"
                       :loading="removeLoading"
-                      
v-if="datasourceActions.includes('delAggIdx')&&isDisableDelBaseIndex">{{$t('kylinLang.common.delete')}}
+                      
v-if="isHaveDelIndexActionSpec&&isDisableDelBaseIndex">{{$t('kylinLang.common.delete')}}
                       <el-dropdown-menu slot="dropdown" 
class="model-actions-dropdown">
                         <el-dropdown-item
                           :disabled="isDisableDelBaseIndex">
@@ -93,7 +93,7 @@
                   placement="bottom-start"
                   :loading="removeLoading"
                   @click="removeIndexes"
-                  
v-if="datasourceActions.includes('delAggIdx')&&!isDisableDelBaseIndex">{{$t('kylinLang.common.delete')}}
+                  
v-if="isHaveDelIndexActionSpec&&!isDisableDelBaseIndex">{{$t('kylinLang.common.delete')}}
                   <el-dropdown-menu slot="dropdown" 
class="model-actions-dropdown">
                     <el-dropdown-item
                       :disabled="!checkedList.length"
@@ -238,6 +238,9 @@ import IndexDetails from './indexDetails'
       default: ''
     }
   },
+  inject: [
+    'isAdvancedOperatorUser'
+  ],
   computed: {
     ...mapGetters([
       'currentProjectData',
@@ -330,6 +333,10 @@ export default class ModelAggregate extends Vue {
     }
   }
 
+  get isHaveDelIndexActionSpec () {
+    return this.datasourceActions.includes('delAggIdx') || 
this.isAdvancedOperatorUser()
+  }
+
   formatDataSize (dataSize) {
     const [size = +size, ext] = 
this.$root.$options.filters.dataSize(dataSize).split(' ')
     const intType = ['B', 'KB']
diff --git 
a/kystudio/src/components/studio/StudioModel/ModelList/ModelLayout/modelLayout.vue
 
b/kystudio/src/components/studio/StudioModel/ModelList/ModelLayout/modelLayout.vue
index a5c09d6822..928eeca6a3 100644
--- 
a/kystudio/src/components/studio/StudioModel/ModelList/ModelLayout/modelLayout.vue
+++ 
b/kystudio/src/components/studio/StudioModel/ModelList/ModelLayout/modelLayout.vue
@@ -81,26 +81,26 @@
             <ModelAggregate
               :model="currentModelRow"
               :project-name="currentSelectedProject"
-              :isShowEditAgg="datasourceActions.includes('editAggGroup')"
-              :isShowBulidIndex="datasourceActions.includes('buildIndex')"
-              
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions')"
+              :isShowEditAgg="datasourceActions.includes('editAggGroup') || 
isAdvancedOperatorUser()"
+              :isShowBulidIndex="datasourceActions.includes('buildIndex') || 
isAdvancedOperatorUser()"
+              
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions') || 
isAdvancedOperatorUser()"
               ref="modelAggregateItem"
               @refreshModel="refreshModelData"
               v-if="currentIndexTab === 'indexOverview'" />
           </el-tab-pane>
-          <el-tab-pane class="tab-pane-item" 
v-if="datasourceActions.includes('editAggGroup')" :label="$t('aggregateGroup')" 
name="aggGroup">
+          <el-tab-pane class="tab-pane-item" 
v-if="datasourceActions.includes('editAggGroup') || isAdvancedOperatorUser()" 
:label="$t('aggregateGroup')" name="aggGroup">
             <ModelAggregateView
               :model="currentModelRow"
               :project-name="currentSelectedProject"
-              :isShowEditAgg="datasourceActions.includes('editAggGroup')"
+              :isShowEditAgg="datasourceActions.includes('editAggGroup') || 
isAdvancedOperatorUser()"
               @refreshModel="refreshModelData"
               v-if="currentIndexTab === 'aggGroup'" />
           </el-tab-pane>
-          <el-tab-pane class="tab-pane-item" 
v-if="datasourceActions.includes('editAggGroup')" :label="$t('tableIndex')" 
name="tableIndex">
+          <el-tab-pane class="tab-pane-item" 
v-if="datasourceActions.includes('editAggGroup') || isAdvancedOperatorUser()" 
:label="$t('tableIndex')" name="tableIndex">
             <TableIndexView
               :model="currentModelRow"
               :project-name="currentSelectedProject"
-              
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions')"
+              
:isShowTableIndexActions="datasourceActions.includes('tableIndexActions') || 
isAdvancedOperatorUser()"
               @refreshModel="refreshModelData"
               v-if="currentIndexTab === 'tableIndex'" />
           </el-tab-pane>
@@ -181,7 +181,8 @@ import ModelTitleDescription from 
'../Components/ModelTitleDescription'
     })
   },
   inject: [
-    'forceUpdateRoute'
+    'forceUpdateRoute',
+    'isAdvancedOperatorUser'
   ],
   methods: {
     ...mapActions({
diff --git a/kystudio/src/store/system.js b/kystudio/src/store/system.js
index 46264b62ec..9f8f1b8052 100644
--- a/kystudio/src/store/system.js
+++ b/kystudio/src/store/system.js
@@ -63,7 +63,8 @@ export default {
     ddlEnabled: 'false',
     logicalViewEnabled: 'false',
     logicalViewDatabase: 'KYLIN_LOGICAL_VIEW',
-    loadThresholdEnabled: 'true'
+    loadThresholdEnabled: 'true',
+    advancedOperator: 'false'
   },
   mutations: {
     [types.COLLECT_MESSAGE_DIRECTIVES]: (state, directive) => {
@@ -191,6 +192,7 @@ export default {
           commit(types.GET_CONF_BY_NAME, {name: 
'kylin.source.ddl.logical-view.enabled', key: 'logicalViewEnabled', 
defaultValue: 'false'})
           commit(types.GET_CONF_BY_NAME, {name: 
'kylin.source.ddl.logical-view.database', key: 'logicalViewDatabase', 
defaultValue: 'KYLIN_LOGICAL_VIEW'})
           commit(types.GET_CONF_BY_NAME, {name: 
'kylin.table.load-threshold-enabled', key: 'loadThresholdEnabled', 
defaultValue: 'true'})
+          commit(types.GET_CONF_BY_NAME, {name: 
'kylin.index.enable-operator-design', key: 'advancedOperator', defaultValue: 
'false'})
           resolve(response)
         }, () => {
           reject()
@@ -247,6 +249,9 @@ export default {
     },
     logicalViewDatabaseName: (state) => {
       return state.logicalViewDatabase
+    },
+    isAdvancedOperator: (state) => {
+      return state.advancedOperator === 'true'
     }
   }
 }
diff --git a/kystudio/src/store/user.js b/kystudio/src/store/user.js
index fbba4e3fd4..45993af7b6 100644
--- a/kystudio/src/store/user.js
+++ b/kystudio/src/store/user.js
@@ -168,6 +168,13 @@ export default {
         permissions.MANAGEMENT.value
       ].includes(state.currentUserAccess)
     },
+    isProjectOperator (state) {
+      return [
+        permissions.ADMINISTRATION.value,
+        permissions.MANAGEMENT.value,
+        permissions.OPERATION.value
+      ].includes(state.currentUserAccess)
+    },
     isDataPermission (state) {
       return state.ext_permissions
     }

Reply via email to