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

casion pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
     new b4ba79535 fix some dev-1.3.1 frontend bug (#3936)
b4ba79535 is described below

commit b4ba79535a4e14bfed8e609783bd43e50d68b294
Author: Yonghao Mei <[email protected]>
AuthorDate: Wed Nov 30 21:54:01 2022 +0800

    fix some dev-1.3.1 frontend bug (#3936)
    
    * fix dev.1.3.1 frontend bug
    
    * handle conflict
    
    Co-authored-by: Casion <[email protected]>
---
 linkis-web/src/apps/linkis/i18n/common/en.json     |   1 +
 linkis-web/src/apps/linkis/i18n/common/zh.json     |   1 +
 .../linkis/module/EnginePluginManagement/index.vue |  43 ++++++-
 .../linkis/module/datasourceEnv/EditForm/index.vue | 140 ++++++++++++++++-----
 .../src/apps/linkis/module/datasourceEnv/index.vue |  43 +++++--
 5 files changed, 186 insertions(+), 42 deletions(-)

diff --git a/linkis-web/src/apps/linkis/i18n/common/en.json 
b/linkis-web/src/apps/linkis/i18n/common/en.json
index 10814eafd..7e6acf219 100644
--- a/linkis-web/src/apps/linkis/i18n/common/en.json
+++ b/linkis-web/src/apps/linkis/i18n/common/en.json
@@ -297,6 +297,7 @@
       "resetAllTip": "Whether to reset all user resources (this operation will 
only clean up user resource records, not the resources that have been 
generated)?",
       "viewlog": "View Log",
       "datasource": {
+        "pleaseUpload": "Please upload",
         "pleaseInput": "Please input",
         "datasourceSrc": "Datasource",
         "connectTest": "Test Connection",
diff --git a/linkis-web/src/apps/linkis/i18n/common/zh.json 
b/linkis-web/src/apps/linkis/i18n/common/zh.json
index edfaf190a..e9215ea74 100644
--- a/linkis-web/src/apps/linkis/i18n/common/zh.json
+++ b/linkis-web/src/apps/linkis/i18n/common/zh.json
@@ -300,6 +300,7 @@
       "viewlog": "查看日志",
       "datasource": {
         "pleaseInput": "请输入",
+        "pleaseUpload": "请上传",
         "datasourceSrc": "数据源",
         "connectTest": "测试连接",
         "sourceName": "数据源名称",
diff --git a/linkis-web/src/apps/linkis/module/EnginePluginManagement/index.vue 
b/linkis-web/src/apps/linkis/module/EnginePluginManagement/index.vue
index 57f202aa0..f6c1eede7 100644
--- a/linkis-web/src/apps/linkis/module/EnginePluginManagement/index.vue
+++ b/linkis-web/src/apps/linkis/module/EnginePluginManagement/index.vue
@@ -73,7 +73,7 @@
       <Spin size="large" fix v-if="loadingForm"></Spin>
       <div style="height: 200px">
         <form style="width: 200px;height: 200px">
-          <input type="file" @change="getFile($event)"></input>
+          <input type="file" @change="getFile($event)" />
         </form>
       </div>
 
@@ -82,7 +82,7 @@
           <div>
             <Button
               type="primary"
-              @click="showFileOperate = false"
+              @click="handleCancel"
             >{{ $t('message.linkis.close') }}</Button>
             <Button type="primary" @click="onSubmit">{{
               $t('message.linkis.complete')}}</Button>
@@ -90,7 +90,7 @@
         </div>
       </div>
     </Modal>
-    <Row class="search-bar" type="flex" justify="flex-start">
+    <Row class="search-bar" type="flex" justify="start">
       <Col span="5">
         <div class="search-item">
           <span class="lable" 
:title="$t('message.linkis.EnginePluginManagement.engineConnType')">{{ 
$t('message.linkis.EnginePluginManagement.engineConnType') }}</span>
@@ -146,6 +146,15 @@
         >{{ `${row.bmlResourceVersion || '-'}` }}</Button
         >
       </template>
+      <template slot-scope="{ row }" slot="action">
+        <Button
+          size="small"
+          type="primary"
+          style="margin-right: 5px;"
+          @click="() => tableActionHandler(row, 'upd')"
+        >{{ $t('message.linkis.EnginePluginManagement.updateFileOnly') 
}}</Button
+        >
+      </template>
     </Table>
     <div style="margin: 10px; overflow: hidden; textAlign: center">
       <div>
@@ -184,6 +193,7 @@ export default {
       actionNum: '',
       loadingForm: false,
       tableLoading: false,
+      updWay: '',
       tableColumnNum: [
         {
           title: "ID",
@@ -232,6 +242,7 @@ export default {
           slot: 'bmlResourceVersion',
           tooltip: true,
           align: 'center',
+          minWidth: 30,
         },
         {
           title: 
this.$t('message.linkis.EnginePluginManagement.lastUpdateTime'),
@@ -248,6 +259,7 @@ export default {
         {
           title: this.$t('message.linkis.EnginePluginManagement.action'),
           slot: 'action',
+          minWidth: 20,
           align: 'center',
         },
       ],
@@ -286,6 +298,7 @@ export default {
   watch: {
     ecType(newName, oldName) {
       console.log(oldName);
+      if(!newName) return;
       this.getTypeVersionList(newName)
     }
   },
@@ -343,8 +356,13 @@ export default {
         formData.append('file', this.file);
         formData.append('ecType', this.ecType);
         formData.append('version', this.version);
-        api.fetch('/engineplugin/updateEnginePluginBML', formData, {method: 
'post', 'Content-Type': 'multipart/form-data'}).then(response => {
+        api.fetch('/engineplugin/updateEnginePluginBML', formData, {methed: 
'post', 'Content-Type': 'multipart/form-data'}).then(response => {
           this.$Message.success(response.msg);
+          if(this.updWay === 'table') {
+            this.ecType = '';
+            this.version = '';
+            this.updWay = '';
+          }
           this.getTypeList();
           this.initECMList();
           this.showFileOperate = false;
@@ -357,6 +375,14 @@ export default {
       }
 
     },
+    handleCancel() {
+      this.showFileOperate = false;
+      if(this.updWay === 'table') {
+        this.ecType = '';
+        this.version = '';
+        this.updWay = '';
+      }
+    },
     deleteBML(){
       var th=this;
       var reqList=[]
@@ -408,6 +434,15 @@ export default {
       }
       this.showFileOperate = true
     },
+    async tableActionHandler(row, type) {
+      console.log(row);
+      if(type === 'upd') {
+        this.ecType = row.engineConnType;
+        this.version = row.version;
+        this.updWay = 'table';
+        this.createOrUpdate(1);
+      } 
+    },
     async openVersionList(row) {
       this.currentEnginpluginData = row
       this.currentEngineType=row.engineConnType;
diff --git a/linkis-web/src/apps/linkis/module/datasourceEnv/EditForm/index.vue 
b/linkis-web/src/apps/linkis/module/datasourceEnv/EditForm/index.vue
index 3d18f2b13..06b94a0fa 100644
--- a/linkis-web/src/apps/linkis/module/datasourceEnv/EditForm/index.vue
+++ b/linkis-web/src/apps/linkis/module/datasourceEnv/EditForm/index.vue
@@ -27,6 +27,7 @@
 </template>
 
 <script>
+import { cloneDeep } from 'lodash'
 export default {
   props: {
     mode: String,
@@ -86,16 +87,8 @@ export default {
           props: {
             placeholder: "",
           },
-          validate: [
-            {
-              required: true,
-              message: `${this.$t(
-                'message.linkis.datasource.pleaseInput'
-              )} 
`+this.$t('message.linkis.basedataManagement.datasourceEnv.envDesc'),
-              trigger: 'blur',
-            },
-          ],
         },
+        //3
         {
           type: "select",
           field: "datasourceTypeId",
@@ -105,50 +98,117 @@ export default {
           validate: [
             {
               required: true,
+              type: 'number',
               message: `${this.$t(
                 'message.linkis.datasource.pleaseInput'
               )} 
`+this.$t('message.linkis.basedataManagement.datasourceEnv.datasourceType')
             },
           ],
         },
+        //4
         {
           type: "radio",
           title: 
this.$t('message.linkis.basedataManagement.datasourceEnv.keytab'),
-          field: "keytab",
+          field: "hasKeyTab",
           value: false,
+          hidden: true,
           options: [
             {value: false,label: "否",disabled: false},
             {value: true,label: "是",disabled: false},
           ],
           on: {
             'on-change': () => {
-              this.rule[5].hidden = !this.rule[5].hidden;
+              this.rule[8].hidden = !this.rule[8].hidden;
             }
           }
         },
+        //5
         {
           type: "upload",
           field: "pic",
           title: "keytab",
-          value: [],
+          value: '',
           hidden: true,
+          validate: [
+            {
+              required: true,
+              message: `${this.$t(
+                'message.linkis.datasource.pleaseUpload'
+              )}"keytab"`,
+              trigger: 'blur',
+            },
+            {
+              validator: this.keyTabValidator,
+              trigger: 'blur'
+            }
+          ],
           props: {
             uploadType: 'file',
             action: "/api/rest_j/v1/bml/upload",
             maxLength: 1,
             multiple: false,
             onSuccess: (res) =>{
-              let tmpParameter = this.formData.parameter ? 
JSON.parse(this.formData.parameter) : {};
-              tmpParameter.keytab = res.data.resourceId;
-              this.formData.parameter = JSON.stringify(tmpParameter);
+              this.formData.keytab = res.data.resourceId;
             }
           },
         },
+        //6
+        {
+          type: 'input',
+          title: "keytab",
+          field: 'keytab',
+          value: '',
+          hidden: true,
+          validate: [
+            {
+              required: true,
+              message: `${this.$t(
+                'message.linkis.datasource.pleaseUpload'
+              )}"keytab"`,
+              trigger: 'blur',
+            },
+          ],
+          props: {
+            placeholder: "",
+            readonly: true,
+            clearable: true,
+          },
+        },
+        //7
+        {
+          type: 'input',
+          title: "uris",
+          field: 'uris',
+          value: '',
+          props: {
+            placeholder: "",
+          },
+          validate: [
+            {
+              required: true,
+              message: `${this.$t(
+                'message.linkis.datasource.pleaseInput'
+              )}"uris"`,
+              trigger: 'blur',
+            },
+          ],
+        },
+        //8
+        {
+          type: 'input',
+          title: "principle",
+          field: 'principle',
+          value: '',
+          hidden: true,
+          props: {
+            placeholder: "",
+          },
+        },
         {
           type: 'v-jsoneditor',
           title: 
this.$t('message.linkis.basedataManagement.datasourceEnv.parameter'),
-          field: 'parameter',
-          value: '',
+          field: 'hadoopConf',
+          value: {},
           props: {
             type: 'form-create',
             height: "280px",
@@ -156,7 +216,7 @@ export default {
               mode: "code",
               modes: ['code','tree'],
             }
-          }
+          },
         },
       ]
     }
@@ -166,12 +226,36 @@ export default {
   },
   methods: {
     getData(data){
-      this.formData = {...data}
-      if(this.formData.parameter.length>0){
-        this.formData.parameter = JSON.parse(this.formData.parameter)
-      }else{
-        this.formData.parameter= {}
+      this.formData = cloneDeep(data);
+      // if (this.formData.parameter) {
+      //   this.formData.parameter = JSON.parse(this.formData.parameter)
+      //   this.formData.uris = this.formData.parameter.uris
+      // }
+    },
+    changeSelector(options){
+      this.rule[3].options = [...options];
+      options.forEach(ele=> {
+        this.keyToName[ele.value] = ele.label;
+      })
+    },
+    hiddenHandler (newV) {
+      // radio
+      this.rule[4].hidden = !(newV.datasourceTypeId === 4);
+      // keytab value
+      this.rule[6].hidden = !newV.keytab;
+      // upload
+      this.rule[5].hidden = !this.rule[6].hidden;
+      if (!newV.hasKeyTab || newV.datasourceTypeId !== 4){
+        this.rule[5].hidden = true;
+        this.rule[6].hidden = true;
+        this.rule[8].hidden = true;
+      }
+    },
+    keyTabValidator(rule, val, cb) {
+      if (!this.formData.keytab) {
+        cb(new 
Error(`${this.$t('message.linkis.datasource.pleaseUpload')}"keytab"`));
       }
+      cb();
     },
   },
   watch: {
@@ -183,20 +267,14 @@ export default {
     },
     data: {
       handler(newV) {
-        this.rule[4].hidden = this.keyToName[newV.datasourceTypeId] == 'hive' 
? false : true;
-        this.rule[5].hidden = !this.formData.keytab;
-        if(this.rule[4].hidden) this.rule[5].hidden = true;
+        this.hiddenHandler(newV)
         this.getData(newV)
       },
       deep: true,
     },
     formData: {
       handler(newV){
-        console.log(this.keyToName)
-        this.rule[4].hidden = this.keyToName[newV.datasourceTypeId] == 'hive' 
? false : true;
-        if(this.rule[4].hidden) this.rule[5].hidden = true;
-        else if(this.formData.keytab && newV.datasourceTypeId == 4) 
this.rule[5].hidden = false;
-        else this.rule[5].hidden = true;
+        this.hiddenHandler(newV)
       },
       deep: true
     }
diff --git a/linkis-web/src/apps/linkis/module/datasourceEnv/index.vue 
b/linkis-web/src/apps/linkis/module/datasourceEnv/index.vue
index 3176fe320..61f498753 100644
--- a/linkis-web/src/apps/linkis/module/datasourceEnv/index.vue
+++ b/linkis-web/src/apps/linkis/module/datasourceEnv/index.vue
@@ -44,13 +44,14 @@
             size="small"
             type="primary"
             @click="onTableEdit(row, index)"
+            style="margin-right: 5px"
           >{{ $t('message.linkis.basedataManagement.edit') }}
           </Button
           >
           <Button
             :disabled="row.expire"
             size="small"
-            type="primary"
+            type="error"
             @click="onTableDelete(row, index)"
           >
             {{ $t('message.linkis.basedataManagement.remove') }}
@@ -182,6 +183,10 @@ export default {
         modifyTime: '',
         modifyUser: '',
         parameter: '',
+        uris: '',
+        keytab: '',
+        principle: '',
+        hadoopConf: '',
         _index: '',
         _rowKey: ''
       },
@@ -190,7 +195,7 @@ export default {
     };
   },
   created() {
-    this.load()
+    // this.load()
   },
   mounted() {
     this.init();
@@ -207,7 +212,7 @@ export default {
       }
       getAllEnv().then((res) => {
         let options = [...res.typeList].sort((a, b) => a.id - b.id)
-          .map(item => { return {value: +item.id, label: item.name}})
+          .map(item => { return {value: +item.id, label: item.name, disabled: 
![2, 4].includes(+item.id)}})
         this.datasourceTypeOptions= options
         // 获取列表
         getList(params).then((data) => {
@@ -234,8 +239,17 @@ export default {
       this.modalShow = true
     },
     onTableEdit(row){
-      row.keytab = JSON.parse(row.parameter).keytab ? true : false;
+      row.hasKeyTab = JSON.parse(row.parameter).keytab ? true : false;
       this.modalEditData = {...row}
+      // format parameter for modal
+      if (this.modalEditData.parameter) {
+        this.modalEditData.parameter = JSON.parse(this.modalEditData.parameter)
+        const { uris, principle, keytab, hadoopConf } = 
this.modalEditData.parameter
+        this.modalEditData.uris = uris;
+        this.modalEditData.principle = principle;
+        this.modalEditData.keytab = keytab;
+        this.modalEditData.hadoopConf = hadoopConf;
+      }
       this.modalAddMode = 'edit'
       this.modalShow = true
     },
@@ -268,17 +282,31 @@ export default {
     clearForm(){
       for(let key in this.modalEditData) {
         this.modalEditData[key] = ''
+        console.log(key);
       }
-      this.modalEditData.keytab = false;
+      this.modalEditData.hasKeyTab = false;
     },
     onModalOk(){
       this.$refs.editForm.formModel.submit((formData)=>{
-        if('keytab' in formData) delete formData['keytab'];
         if('pic' in formData) delete formData['pic'];
         delete formData._index
         delete formData._rowKey
         this.modalLoading = true
+        const { uris, keytab, principle, hadoopConf } = formData;
+        if (formData.hasKeyTab) {
+          // inject props to parameter
+          formData.parameter = {
+            keytab, principle
+          }
+        }
+        formData.parameter.uris = uris
+        formData.parameter.hadoopConf = hadoopConf
         formData.parameter = JSON.stringify(formData.parameter)
+        if('hasKeyTab' in formData) delete formData['hasKeyTab'];
+        if('principle' in formData) delete formData['principle'];
+        if('hadoopConf' in formData) delete formData['hadoopConf'];
+        if('keytab' in formData) delete formData['keytab'];
+        if('uris' in formData) delete formData['uris'];
         if(this.modalAddMode=='add') {
           add(formData).then((data)=>{
             if(data.result) {
@@ -310,13 +338,14 @@ export default {
             this.load()
           })
         }
+        console.log(formData);
         this.modalLoading=false
         this.modalShow = false
 
       })
     },
     onModalCancel(){
-      this.modalLoading=false
+      this.modalLoading = false
       this.modalShow = false
     }
   },


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to