You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by jo...@apache.org on 2020/02/28 09:09:22 UTC

[incubator-dolphinscheduler] branch dev-resource-tree updated: Breadcrumb development (#2033)

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

journey pushed a commit to branch dev-resource-tree
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev-resource-tree by this push:
     new badf531  Breadcrumb development (#2033)
badf531 is described below

commit badf5314e07678df36837e099aa7cf29f6adae30
Author: break60 <79...@qq.com>
AuthorDate: Fri Feb 28 17:09:16 2020 +0800

    Breadcrumb development (#2033)
    
    * File management list modification
    
    * Shell task resources and authorization resources
    
    * Spark task resource changes
    
    * UDF resource tree and change DAG style
    
    * Breadcrumb development
    
    * Breadcrumb development
---
 .../pages/file/pages/list/_source/rename.vue       |  3 +-
 .../file/pages/subdirectory/_source/rename.vue     |  3 +-
 .../pages/file/pages/subdirectory/index.vue        | 61 +++++++++++++++++++---
 .../pages/udf/pages/resource/_source/rename.vue    |  3 +-
 .../udf/pages/subUdfDirectory/_source/rename.vue   |  3 +-
 .../pages/udf/pages/subUdfDirectory/index.vue      | 55 ++++++++++++++++++-
 .../src/js/conf/home/store/resource/actions.js     |  9 ++++
 .../components/fileUpdate/fileChildUpdate.vue      |  4 +-
 .../js/module/components/fileUpdate/fileUpdate.vue |  2 +-
 .../components/fileUpdate/resourceChildUpdate.vue  |  4 +-
 .../js/module/components/fileUpdate/udfUpdate.vue  |  2 +-
 11 files changed, 131 insertions(+), 18 deletions(-)

diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/rename.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/rename.vue
index b082f88..6f7daca 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/rename.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/rename.vue
@@ -47,6 +47,7 @@
 <script>
   import i18n from '@/module/i18n'
   import store from '@/conf/home/store'
+  import localStore from '@/module/util/localStorage'
   import mPopup from '@/module/components/popup/popup'
   import mListBoxF from '@/module/components/listBoxF/listBoxF'
 
@@ -71,7 +72,7 @@
             })
           }else{
             return this.store.dispatch('resource/resourceVerifyName', {
-              name: this.name,
+              fullName: localStore.getItem('currentDir')+'/'+this.name,
               type: 'FILE'
             })
           }
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue
index b082f88..6f7daca 100755
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/rename.vue
@@ -47,6 +47,7 @@
 <script>
   import i18n from '@/module/i18n'
   import store from '@/conf/home/store'
+  import localStore from '@/module/util/localStorage'
   import mPopup from '@/module/components/popup/popup'
   import mListBoxF from '@/module/components/listBoxF/listBoxF'
 
@@ -71,7 +72,7 @@
             })
           }else{
             return this.store.dispatch('resource/resourceVerifyName', {
-              name: this.name,
+              fullName: localStore.getItem('currentDir')+'/'+this.name,
               type: 'FILE'
             })
           }
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
index 86d1e87..d694548 100755
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/index.vue
@@ -23,7 +23,10 @@
             <x-button type="ghost" @click="() => $router.push({path: `/resource/file/subFileFolder/${searchParams.id}`})">{{$t('Create folder')}}</x-button>
             <x-button type="ghost" @click="() => $router.push({path: `/resource/file/subFile/${searchParams.id}`})">{{$t('Create File')}}</x-button>
             <x-button type="ghost" @click="_uploading">{{$t('Upload Files')}}</x-button>
-            <a style="padding: 7px 0;line-height: 14px;position: relative;float: left;cursor: pointer;" @click="() => $router.push({path: `/resource/file`})">全部文件</a>
+            <span class="bread">(</span>
+            <a class="bread" @click="() => $router.push({path: `/resource/file`})">全部文件</a>
+            <a class="bread" v-for="(item,$index) in breadList" :key="$index" @click="_ckOperation($index)">{{'>'+item}}</a>
+            <span class="bread">)</span>
           </x-button-group>
         </template>
       </m-conditions>
@@ -48,6 +51,7 @@
   import _ from 'lodash'
   import { mapActions } from 'vuex'
   import mList from './_source/list'
+  import localStore from '@/module/util/localStorage'
   import mSpin from '@/module/components/spin/spin'
   import { findComponentDownward } from '@/module/util/'
   import mNoData from '@/module/components/noData/noData'
@@ -68,13 +72,14 @@
           pageNo: 1,
           searchVal: '',
           type: 'FILE'
-        }
+        },
+        breadList: []
       }
     },
     mixins: [listUrlParamHandle],
     props: {},
     methods: {
-      ...mapActions('resource', ['getResourcesListP']),
+      ...mapActions('resource', ['getResourcesListP','getResourceId']),
       /**
        * File Upload
        */
@@ -114,7 +119,27 @@
        _onUpdate (data) {
         this.searchParams.id = data
         this._debounceGET()
-      }, 
+      },
+      _ckOperation(index) {
+        let breadName =''
+        this.breadList.forEach((item, i) => {
+          if(i<=index) {
+            breadName = breadName+'/'+item
+          }
+        })
+        this.transferApi(breadName)
+      },
+      transferApi(api) {
+        this.getResourceId({
+          type: 'FILE',
+          fullName: api
+        }).then(res => {
+          localStore.setItem('currentDir', `${res.fullName}`)
+          this.$router.push({ path: `/resource/file/subdirectory/${res.id}` })
+        }).catch(e => {
+          this.$message.error(e.msg || '')
+        })
+      }
     },
     watch: {
       // router
@@ -122,13 +147,37 @@
         // url no params get instance list
         this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo
         this.searchParams.id = a.params.id
+        let dir = localStore.getItem('currentDir').split('/')
+        dir.shift()
+        this.breadList = dir
+        this.getResourceId({
+          type: 'FILE',
+          pid: a.params.id
+        }).then(res => {
+          dir = res.fullName.split('/')
+          dir.shift()
+          this.breadList = dir
+        }).catch(e => {
+          this.$message.error(e.msg || '')
+        })
       }
     },
-    created () {
-    },
+    created () {},
     mounted () {
+      let dir = localStore.getItem('currentDir').split('/')
+      dir.shift()
+      this.breadList = dir
       this.$modal.destroy()
     },
     components: { mListConstruction, mConditions, mList, mSpin, mNoData }
   }
 </script>
+<style lang="scss" rel="stylesheet/scss">
+  .bread {
+    padding: 7px 0;
+    line-height: 14px;
+    position: relative;
+    float: left;
+    cursor: pointer;
+  }
+</style>
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/rename.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/rename.vue
index 69acdef..0c3b2f0 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/rename.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/rename.vue
@@ -48,6 +48,7 @@
 <script>
   import i18n from '@/module/i18n'
   import store from '@/conf/home/store'
+  import localStore from '@/module/util/localStorage'
   import mPopup from '@/module/components/popup/popup'
   import mListBoxF from '@/module/components/listBoxF/listBoxF'
 
@@ -72,7 +73,7 @@
             })
           }else{
             return this.store.dispatch('resource/resourceVerifyName', {
-              name: this.name,
+              fullName: localStore.getItem('currentDir')+'/'+this.name,
               type: 'UDF'
             })
           }
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/rename.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/rename.vue
index 69acdef..0c3b2f0 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/rename.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/rename.vue
@@ -48,6 +48,7 @@
 <script>
   import i18n from '@/module/i18n'
   import store from '@/conf/home/store'
+  import localStore from '@/module/util/localStorage'
   import mPopup from '@/module/components/popup/popup'
   import mListBoxF from '@/module/components/listBoxF/listBoxF'
 
@@ -72,7 +73,7 @@
             })
           }else{
             return this.store.dispatch('resource/resourceVerifyName', {
-              name: this.name,
+              fullName: localStore.getItem('currentDir')+'/'+this.name,
               type: 'UDF'
             })
           }
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/index.vue
index fb52856..e943549 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/index.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/index.vue
@@ -22,6 +22,10 @@
           <x-button-group size="small">
             <x-button type="ghost" @click="() => $router.push({name: 'resource-udf-subCreateUdfFolder'})">{{$t('Create folder')}}</x-button>
             <x-button type="ghost" size="small"  @click="_uploading">{{$t('Upload UDF Resources')}}</x-button>
+            <span class="bread">(</span>
+            <a class="bread" @click="() => $router.push({path: `/resource/udf`})">全部文件</a>
+            <a class="bread" v-for="(item,$index) in breadList" :key="$index" @click="_ckOperation($index)">{{'>'+item}}</a>
+            <span class="bread">)</span>
           </x-button-group>
         </template>
       </m-conditions>
@@ -46,6 +50,7 @@
   import _ from 'lodash'
   import { mapActions } from 'vuex'
   import mList from './_source/list'
+  import localStore from '@/module/util/localStorage'
   import mSpin from '@/module/components/spin/spin'
   import { findComponentDownward } from '@/module/util/'
   import mNoData from '@/module/components/noData/noData'
@@ -66,13 +71,14 @@
           pageNo: 1,
           searchVal: '',
           type: 'UDF'
-        }
+        },
+        breadList: []
       }
     },
     mixins: [listUrlParamHandle],
     props: {},
     methods: {
-      ...mapActions('resource', ['getResourcesListP']),
+      ...mapActions('resource', ['getResourcesListP','getResourceId']),
       /**
        * File Upload
        */
@@ -112,6 +118,26 @@
         }).catch(e => {
           this.isLoading = false
         })
+      },
+       _ckOperation(index) {
+        let breadName =''
+        this.breadList.forEach((item, i) => {
+          if(i<=index) {
+            breadName = breadName+'/'+item
+          }
+        })
+        this.transferApi(breadName)
+      },
+      transferApi(api) {
+        this.getResourceId({
+          type: 'UDF',
+          fullName: api
+        }).then(res => {
+          localStore.setItem('currentDir', `${res.fullName}`)
+          this.$router.push({ path: `/resource/udf/subUdfDirectory/${res.id}` })
+        }).catch(e => {
+          this.$message.error(e.msg || '')
+        })
       }
     },
     watch: {
@@ -120,13 +146,38 @@
         // url no params get instance list
         this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo
         this.searchParams.id = a.params.id
+        let dir = localStore.getItem('currentDir').split('/')
+        dir.shift()
+        this.breadList = dir
+        this.getResourceId({
+          type: 'UDF',
+          pid: a.params.id
+        }).then(res => {
+          dir = res.fullName.split('/')
+          dir.shift()
+          this.breadList = dir
+        }).catch(e => {
+          this.$message.error(e.msg || '')
+        })
       }
     },
     created () {
     },
     mounted () {
+      let dir = localStore.getItem('currentDir').split('/')
+      dir.shift()
+      this.breadList = dir
       this.$modal.destroy()
     },
     components: { mListConstruction, mConditions, mList, mSpin, mNoData }
   }
 </script>
+<style lang="scss" rel="stylesheet/scss">
+  .bread {
+    padding: 7px 0;
+    line-height: 14px;
+    position: relative;
+    float: left;
+    cursor: pointer;
+  }
+</style>
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
index 6077e57..c27c6d0 100755
--- a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
@@ -30,6 +30,15 @@ export default {
       })
     })
   },
+  getResourceId ({ state }, payload) {
+    return new Promise((resolve, reject) => {
+      io.get(`resources/queryResource`, payload, res => {
+        resolve(res.data)
+      }).catch(e => {
+        reject(e)
+      })
+    })
+  },
   getResourcesList ({ state }, payload) {
     return new Promise((resolve, reject) => {
       io.get(`resources/list`, payload, res => {
diff --git a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
index 4052c44..05d12b1 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
@@ -90,9 +90,9 @@
   import io from '@/module/io'
   import i18n from '@/module/i18n'
   import store from '@/conf/home/store'
+  import localStore from '@/module/util/localStorage'
   import mPopup from '@/module/components/popup/popup'
   import mListBoxF from '@/module/components/listBoxF/listBoxF'
-  import localStore from '@/module/util/localStorage'
   import mProgressBar from '@/module/components/progressBar/progressBar'
 
   export default {
@@ -128,7 +128,7 @@
         this.$refs['popup'].spinnerLoading = true
         if (this._validation()) {
           this.store.dispatch('resource/resourceVerifyName', {
-            name: this.name,
+            fullName: this.currentDir+'/'+this.name,
             type: this.type
           }).then(res => {
             const isLt1024M = this.file.size / 1024 / 1024 < 1024
diff --git a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
index 1fe209e..5e06dda 100755
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
@@ -126,7 +126,7 @@
         this.$refs['popup'].spinnerLoading = true
         if (this._validation()) {
           this.store.dispatch('resource/resourceVerifyName', {
-            name: this.name,
+            fullName: '/'+this.name,
             type: this.type
           }).then(res => {
             const isLt1024M = this.file.size / 1024 / 1024 < 1024
diff --git a/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue b/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
index 4052c44..05d12b1 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
@@ -90,9 +90,9 @@
   import io from '@/module/io'
   import i18n from '@/module/i18n'
   import store from '@/conf/home/store'
+  import localStore from '@/module/util/localStorage'
   import mPopup from '@/module/components/popup/popup'
   import mListBoxF from '@/module/components/listBoxF/listBoxF'
-  import localStore from '@/module/util/localStorage'
   import mProgressBar from '@/module/components/progressBar/progressBar'
 
   export default {
@@ -128,7 +128,7 @@
         this.$refs['popup'].spinnerLoading = true
         if (this._validation()) {
           this.store.dispatch('resource/resourceVerifyName', {
-            name: this.name,
+            fullName: this.currentDir+'/'+this.name,
             type: this.type
           }).then(res => {
             const isLt1024M = this.file.size / 1024 / 1024 < 1024
diff --git a/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue b/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
index 4285df5..d62e470 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
@@ -90,7 +90,7 @@
       _verifyName () {
         return new Promise((resolve, reject) => {
           this.store.dispatch('resource/resourceVerifyName', {
-            name: this.udfName,
+            fullName: '/'+this.udfName,
             type: 'UDF'
           }).then(res => {
             resolve()