You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by so...@apache.org on 2022/04/22 06:52:40 UTC

[dolphinscheduler] branch dev updated: [Bug][UI][V1.0.0-Beta] Fix display resource not exist error message bug (#9657)

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

songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1de7f154a3 [Bug][UI][V1.0.0-Beta] Fix display resource not exist error message bug (#9657)
1de7f154a3 is described below

commit 1de7f154a38566f4d7989c8c7ebe8bda16a8dc6e
Author: Devosend <de...@gmail.com>
AuthorDate: Fri Apr 22 14:52:34 2022 +0800

    [Bug][UI][V1.0.0-Beta] Fix display resource not exist error message bug (#9657)
---
 .../src/views/resource/file/index.tsx              | 40 +++++++---------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/dolphinscheduler-ui-next/src/views/resource/file/index.tsx b/dolphinscheduler-ui-next/src/views/resource/file/index.tsx
index cfbc0d9d3e..7ab9878906 100644
--- a/dolphinscheduler-ui-next/src/views/resource/file/index.tsx
+++ b/dolphinscheduler-ui-next/src/views/resource/file/index.tsx
@@ -16,15 +16,7 @@
  */
 
 import { useRouter } from 'vue-router'
-import {
-  defineComponent,
-  onMounted,
-  ref,
-  reactive,
-  Ref,
-  watch,
-  inject
-} from 'vue'
+import { defineComponent, onMounted, ref, reactive, Ref } from 'vue'
 import {
   NIcon,
   NSpace,
@@ -56,12 +48,10 @@ import { ResourceFile } from '@/service/modules/resources/types'
 
 export default defineComponent({
   name: 'File',
-  inject: ['reload'],
   setup() {
     const router: Router = useRouter()
     const fileId = ref(Number(router.currentRoute.value.params.id) || -1)
 
-    const reload: any = inject('reload')
     const resourceListRef = ref()
     const folderShowRef = ref(false)
     const uploadShowRef = ref(false)
@@ -171,24 +161,18 @@ export default defineComponent({
       }
     ])
 
-    watch(
-      () => router.currentRoute.value.params.id,
-      // @ts-ignore
-      () => {
-        reload()
-        const currFileId = Number(router.currentRoute.value.params.id) || -1
-
-        if (currFileId === -1) {
-          fileStore.setCurrentDir('/')
-        } else {
-          queryCurrentResourceById(currFileId).then((res: ResourceFile) => {
-            if (res.fullName) {
-              fileStore.setCurrentDir(res.fullName)
-            }
-          })
-        }
+    onMounted(() => {
+      const currFileId = Number(router.currentRoute.value.params.id) || -1
+      if (currFileId === -1) {
+        fileStore.setCurrentDir('/')
+      } else {
+        queryCurrentResourceById(currFileId).then((res: ResourceFile) => {
+          if (res.fullName) {
+            fileStore.setCurrentDir(res.fullName)
+          }
+        })
       }
-    )
+    })
 
     const initBreadcrumb = async (dirs: string[]) => {
       let index = 0