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

chenxingchun 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 c61aefa  Authorized resource interface replacement
     new 852d79a  Merge pull request #2251 from break60/dev-resource-tree
c61aefa is described below

commit c61aefa51339a3c57c242d03b3c79faadac354d2
Author: break60 <[email protected]>
AuthorDate: Fri Mar 20 18:16:02 2020 +0800

    Authorized resource interface replacement
---
 .../pages/security/pages/users/_source/list.vue    |  8 ++---
 .../src/js/conf/home/store/security/actions.js     | 39 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git 
a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
 
b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
index 303b1ad..d88d6e8 100644
--- 
a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
+++ 
b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
@@ -144,7 +144,7 @@
       pageSize: Number
     },
     methods: {
-      ...mapActions('security', ['deleteUser', 'getAuthList', 
'grantAuthorization']),
+      ...mapActions('security', ['deleteUser', 'getAuthList', 
'grantAuthorization','getResourceList']),
       _closeDelete (i) {
         this.$refs[`poptip-delete-${i}`][0].doClose()
       },
@@ -215,9 +215,9 @@
           })
         })
       },
-      _authFile (item, i) {
+      _authFile (item, i) { 
         this.$refs[`poptip-auth-${i}`][0].doClose()
-        this.getAuthList({
+        this.getResourceList({
           id: item.id,
           type: 'file',
           category: 'resources'
@@ -247,8 +247,6 @@
               udfTargetList.push(value)
             }
           })
-          fileSourceList = fileTargetList.concat(fileSourceList)
-          udfSourceList  = udfTargetList.concat(udfSourceList)
           fileTargetList = _.map(fileTargetList, v => {
             return v.id
           })
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js 
b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js
index ff96adc..10a2bf1 100644
--- a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js
@@ -195,6 +195,45 @@ export default {
       })
     })
   },
+
+  getResourceList ({ state }, payload) {
+    let o = {
+      type: payload.type,
+      category: payload.category
+    }
+
+    let param = {}
+    // Manage user
+    if (o.type === 'user') {
+      param.alertgroupId = payload.id
+    } else {
+      param.userId = payload.id
+    }
+
+    // Authorized project
+    const p1 = new Promise((resolve, reject) => {
+      io.get(`${o.category}/authorize-resource-tree`, param, res => {
+        resolve(res.data)
+      }).catch(e => {
+        reject(e)
+      })
+    })
+    // Unauthorized project
+    const p2 = new Promise((resolve, reject) => {
+      io.get(`${o.category}/authed-${o.type}`, param, res => {
+        resolve(res.data)
+      }).catch(e => {
+        reject(e)
+      })
+    })
+    return new Promise((resolve, reject) => {
+      Promise.all([p1, p2]).then(a => {
+        resolve(a)
+      }).catch(e => {
+        reject(e)
+      })
+    })
+  },
   /**
    * Authorization [project, resource, data source]
    * @param Project,Resources,Datasource

Reply via email to