This is an automated email from the ASF dual-hosted git repository.
leonbao 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 bc8d610 fix the mismatch of upload url between frontend and backend
(#6226)
bc8d610 is described below
commit bc8d610e87291a45c597eb09e0b58781213a53e6
Author: Liyue <[email protected]>
AuthorDate: Sun Sep 26 20:56:03 2021 +0800
fix the mismatch of upload url between frontend and backend (#6226)
* fix: fix the url mismatch between frontend and backend
* fix the url mismatch between frontend and backend
* fix the resource download url
* fix: update for unit test
---
.../dolphinscheduler/api/controller/ResourcesControllerTest.java | 5 +++--
.../js/conf/home/pages/resource/pages/file/pages/details/index.vue | 4 +---
.../conf/home/pages/resource/pages/file/pages/list/_source/list.vue | 4 +---
.../pages/resource/pages/file/pages/subdirectory/_source/list.vue | 4 +---
.../home/pages/resource/pages/udf/pages/resource/_source/list.vue | 4 +---
.../pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue | 4 +---
dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js | 2 +-
.../src/js/module/components/fileUpdate/fileChildUpdate.vue | 2 +-
.../src/js/module/components/fileUpdate/fileUpdate.vue | 2 +-
.../src/js/module/components/fileUpdate/resourceChildUpdate.vue | 2 +-
.../src/js/module/components/fileUpdate/udfUpdate.vue | 2 +-
dolphinscheduler-ui/src/js/module/download/index.js | 2 +-
12 files changed, 14 insertions(+), 23 deletions(-)
diff --git
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java
index 6946cb1..81bde4d 100644
---
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java
+++
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java
@@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.api.controller;
import static
org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static
org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static
org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static
org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static
org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -152,7 +153,7 @@ public class ResourcesControllerTest extends
AbstractControllerTest {
paramsMap.add("id", "1");
paramsMap.add("content","echo test_1111");
- MvcResult mvcResult = mockMvc.perform(post("/resources/update-content")
+ MvcResult mvcResult =
mockMvc.perform(put("/resources/1/update-content")
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
@@ -171,7 +172,7 @@ public class ResourcesControllerTest extends
AbstractControllerTest {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id", "5");
- MvcResult mvcResult = mockMvc.perform(get("/resources/download")
+ MvcResult mvcResult = mockMvc.perform(get("/resources/{id}/download",5)
.header(SESSION_ID, sessionId)
.params(paramsMap))
.andExpect(status().isOk())
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue
index 08c9dbe..40c19ce 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue
@@ -87,9 +87,7 @@
this.$router.go(-1)
},
_downloadFile () {
- downloadFile('resources/download', {
- id: this.$route.params.id
- })
+ downloadFile(`resources/${this.$route.params.id}/download`)
},
_getViewResources () {
this.isLoading = true
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
index 348496b..ab68e5a 100755
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
@@ -124,9 +124,7 @@
}
},
_downloadFile (item) {
- downloadFile('resources/download', {
- id: item.id
- })
+ downloadFile(`resources/${item.id}/download`)
},
_rtSize (val) {
return bytesToSize(parseInt(val))
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
index c51aded..3e1eac1 100755
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
@@ -123,9 +123,7 @@
}
},
_downloadFile (item) {
- downloadFile('resources/download', {
- id: item.id
- })
+ downloadFile(`resources/${item.id}/download`)
},
_rtSize (val) {
return bytesToSize(parseInt(val))
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/list.vue
index 24bf712..6d767d2 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/list.vue
@@ -109,9 +109,7 @@
methods: {
...mapActions('resource', ['deleteResource']),
_downloadFile (item) {
- downloadFile('resources/download', {
- id: item.id
- })
+ downloadFile(`resources/${item.id}/download`)
},
_go (item) {
localStore.setItem('file', `${item.alias}|${item.size}`)
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue
index 17d0d2a..b527422 100755
---
a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue
@@ -106,9 +106,7 @@
methods: {
...mapActions('resource', ['deleteResource']),
_downloadFile (item) {
- downloadFile('resources/download', {
- id: item.id
- })
+ downloadFile(`resources/${item.id}/download`)
},
_go (item) {
localStore.setItem('file', `${item.alias}|${item.size}`)
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 8ffa7c1..0ab83e2 100755
--- a/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
@@ -150,7 +150,7 @@ export default {
*/
updateContent ({ state }, payload) {
return new Promise((resolve, reject) => {
- io.post(`resources/${payload.id}/update-content`, payload, res => {
+ io.put(`resources/${payload.id}/update-content`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
diff --git
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
index 369a161..a9cc962 100644
---
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
+++
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
@@ -177,7 +177,7 @@
formData.append('pid', this.id)
formData.append('currentDir', this.currentDir)
formData.append('description', this.description)
- io.post('resources/create', res => {
+ io.post('resources', res => {
this.$message.success(res.msg)
resolve()
self.$emit('onUpdateFileChildUpdate')
diff --git
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
index a9193a3..dcfe340 100755
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
@@ -175,7 +175,7 @@
formData.append('pid', this.pid)
formData.append('currentDir', this.currentDir)
formData.append('description', this.description)
- io.post('resources/create', res => {
+ io.post('resources', res => {
this.$message.success(res.msg)
resolve()
self.$emit('onUpdateFileUpdate')
diff --git
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
index fedb2b2..a119c9a 100755
---
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
+++
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
@@ -177,7 +177,7 @@
formData.append('pid', this.id)
formData.append('currentDir', this.currentDir)
formData.append('description', this.description)
- io.post('resources/create', res => {
+ io.post('resources', res => {
this.$message.success(res.msg)
resolve()
self.$emit('onUpdateResourceChildUpdate')
diff --git
a/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
b/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
index ed93820..35d9726 100644
--- a/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
+++ b/dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
@@ -119,7 +119,7 @@
formData.append('description', this.udfDesc)
this.spinnerLoading = true
this.$emit('on-update-present', false)
- io.post('resources/create', res => {
+ io.post('resources', res => {
this.$message.success(res.msg)
this.spinnerLoading = false
this.progress = 0
diff --git a/dolphinscheduler-ui/src/js/module/download/index.js
b/dolphinscheduler-ui/src/js/module/download/index.js
index 6f51a3b..55d18e0 100644
--- a/dolphinscheduler-ui/src/js/module/download/index.js
+++ b/dolphinscheduler-ui/src/js/module/download/index.js
@@ -24,7 +24,7 @@ import { resolveURL } from '@/module/io'
const downloadFile = ($url, $obj) => {
const param = {
url: resolveURL($url),
- obj: $obj
+ obj: $obj || {}
}
if (!param.url) {