Browse Source

[Fix-6649][UI] Get project according to code (#6649) (#6650)

Co-authored-by: linyanbin <linyanbin@lizhi.fm>
3.0.0/version-upgrade
Yanbin Lin 3 years ago committed by GitHub
parent
commit
a728c85a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      dolphinscheduler-ui/src/js/conf/home/router/index.js
  2. 4
      dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js

7
dolphinscheduler-ui/src/js/conf/home/router/index.js

@ -54,10 +54,9 @@ const router = new Router({
},
beforeEnter: (to, from, next) => {
const blacklist = ['projects', 'projects-list']
if (!blacklist.includes(to.name) && to.params.projectId && to.params.projectId !== localStore.getItem('projectId')) {
store.dispatch('projects/getProjectById', {
projectId: to.params.projectId
}).then(res => {
const { projectCode } = to.params || {}
if (!blacklist.includes(to.name) && projectCode && projectCode !== localStore.getItem('projectCode')) {
store.dispatch('projects/getProjectByCode', projectCode).then(res => {
store.commit('dag/setProjectId', res.id)
store.commit('dag/setProjectCode', res.code)
store.commit('dag/setProjectName', res.name)

4
dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js

@ -31,9 +31,9 @@ export default {
})
},
/**
* Get project by id
* Get project by code
*/
getProjectById ({ state }, payload) {
getProjectByCode ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${payload}`, {}, res => {
resolve(res.data)

Loading…
Cancel
Save