Browse Source

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
2.0.7-release
Liyue 3 years ago committed by GitHub
parent
commit
bc8d610e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ResourcesControllerTest.java
  2. 4
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue
  3. 4
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue
  4. 4
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue
  5. 4
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/list.vue
  6. 4
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue
  7. 2
      dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js
  8. 2
      dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue
  9. 2
      dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue
  10. 2
      dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue
  11. 2
      dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue
  12. 2
      dolphinscheduler-ui/src/js/module/download/index.js

5
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.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; 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.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; 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("id", "1");
paramsMap.add("content","echo test_1111"); 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) .header(SESSION_ID, sessionId)
.params(paramsMap)) .params(paramsMap))
.andExpect(status().isOk()) .andExpect(status().isOk())
@ -171,7 +172,7 @@ public class ResourcesControllerTest extends AbstractControllerTest {
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
paramsMap.add("id", "5"); paramsMap.add("id", "5");
MvcResult mvcResult = mockMvc.perform(get("/resources/download") MvcResult mvcResult = mockMvc.perform(get("/resources/{id}/download",5)
.header(SESSION_ID, sessionId) .header(SESSION_ID, sessionId)
.params(paramsMap)) .params(paramsMap))
.andExpect(status().isOk()) .andExpect(status().isOk())

4
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue

@ -87,9 +87,7 @@
this.$router.go(-1) this.$router.go(-1)
}, },
_downloadFile () { _downloadFile () {
downloadFile('resources/download', { downloadFile(`resources/${this.$route.params.id}/download`)
id: this.$route.params.id
})
}, },
_getViewResources () { _getViewResources () {
this.isLoading = true this.isLoading = true

4
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/list/_source/list.vue

@ -124,9 +124,7 @@
} }
}, },
_downloadFile (item) { _downloadFile (item) {
downloadFile('resources/download', { downloadFile(`resources/${item.id}/download`)
id: item.id
})
}, },
_rtSize (val) { _rtSize (val) {
return bytesToSize(parseInt(val)) return bytesToSize(parseInt(val))

4
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subdirectory/_source/list.vue

@ -123,9 +123,7 @@
} }
}, },
_downloadFile (item) { _downloadFile (item) {
downloadFile('resources/download', { downloadFile(`resources/${item.id}/download`)
id: item.id
})
}, },
_rtSize (val) { _rtSize (val) {
return bytesToSize(parseInt(val)) return bytesToSize(parseInt(val))

4
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/resource/_source/list.vue

@ -109,9 +109,7 @@
methods: { methods: {
...mapActions('resource', ['deleteResource']), ...mapActions('resource', ['deleteResource']),
_downloadFile (item) { _downloadFile (item) {
downloadFile('resources/download', { downloadFile(`resources/${item.id}/download`)
id: item.id
})
}, },
_go (item) { _go (item) {
localStore.setItem('file', `${item.alias}|${item.size}`) localStore.setItem('file', `${item.alias}|${item.size}`)

4
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/udf/pages/subUdfDirectory/_source/list.vue

@ -106,9 +106,7 @@
methods: { methods: {
...mapActions('resource', ['deleteResource']), ...mapActions('resource', ['deleteResource']),
_downloadFile (item) { _downloadFile (item) {
downloadFile('resources/download', { downloadFile(`resources/${item.id}/download`)
id: item.id
})
}, },
_go (item) { _go (item) {
localStore.setItem('file', `${item.alias}|${item.size}`) localStore.setItem('file', `${item.alias}|${item.size}`)

2
dolphinscheduler-ui/src/js/conf/home/store/resource/actions.js

@ -150,7 +150,7 @@ export default {
*/ */
updateContent ({ state }, payload) { updateContent ({ state }, payload) {
return new Promise((resolve, reject) => { 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) resolve(res)
}).catch(e => { }).catch(e => {
reject(e) reject(e)

2
dolphinscheduler-ui/src/js/module/components/fileUpdate/fileChildUpdate.vue

@ -177,7 +177,7 @@
formData.append('pid', this.id) formData.append('pid', this.id)
formData.append('currentDir', this.currentDir) formData.append('currentDir', this.currentDir)
formData.append('description', this.description) formData.append('description', this.description)
io.post('resources/create', res => { io.post('resources', res => {
this.$message.success(res.msg) this.$message.success(res.msg)
resolve() resolve()
self.$emit('onUpdateFileChildUpdate') self.$emit('onUpdateFileChildUpdate')

2
dolphinscheduler-ui/src/js/module/components/fileUpdate/fileUpdate.vue

@ -175,7 +175,7 @@
formData.append('pid', this.pid) formData.append('pid', this.pid)
formData.append('currentDir', this.currentDir) formData.append('currentDir', this.currentDir)
formData.append('description', this.description) formData.append('description', this.description)
io.post('resources/create', res => { io.post('resources', res => {
this.$message.success(res.msg) this.$message.success(res.msg)
resolve() resolve()
self.$emit('onUpdateFileUpdate') self.$emit('onUpdateFileUpdate')

2
dolphinscheduler-ui/src/js/module/components/fileUpdate/resourceChildUpdate.vue

@ -177,7 +177,7 @@
formData.append('pid', this.id) formData.append('pid', this.id)
formData.append('currentDir', this.currentDir) formData.append('currentDir', this.currentDir)
formData.append('description', this.description) formData.append('description', this.description)
io.post('resources/create', res => { io.post('resources', res => {
this.$message.success(res.msg) this.$message.success(res.msg)
resolve() resolve()
self.$emit('onUpdateResourceChildUpdate') self.$emit('onUpdateResourceChildUpdate')

2
dolphinscheduler-ui/src/js/module/components/fileUpdate/udfUpdate.vue

@ -119,7 +119,7 @@
formData.append('description', this.udfDesc) formData.append('description', this.udfDesc)
this.spinnerLoading = true this.spinnerLoading = true
this.$emit('on-update-present', false) this.$emit('on-update-present', false)
io.post('resources/create', res => { io.post('resources', res => {
this.$message.success(res.msg) this.$message.success(res.msg)
this.spinnerLoading = false this.spinnerLoading = false
this.progress = 0 this.progress = 0

2
dolphinscheduler-ui/src/js/module/download/index.js

@ -24,7 +24,7 @@ import { resolveURL } from '@/module/io'
const downloadFile = ($url, $obj) => { const downloadFile = ($url, $obj) => {
const param = { const param = {
url: resolveURL($url), url: resolveURL($url),
obj: $obj obj: $obj || {}
} }
if (!param.url) { if (!param.url) {

Loading…
Cancel
Save