Browse Source

[1.3.7-prepare][Improvement-5567][UI] Add project id in web ui url for sharing and project name in project page #5568 (#5913)

Shiwen Cheng 3 years ago committed by GitHub
parent
commit
d487cd8b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
  2. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
  3. 3
      dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue
  4. 3
      dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue
  5. 3
      dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue
  6. 6
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/taskRecordList/index.vue
  7. 10
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
  8. 8
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue
  9. 9
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/index.vue
  10. 7
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/timing/_source/list.vue
  11. 6
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/defineUserCount.vue
  12. 7
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/processStateCount.vue
  13. 7
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/taskCtatusCount.vue
  14. 10
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/index.vue
  15. 2
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/index.vue
  16. 8
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue
  17. 5
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue
  18. 9
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/list/_source/list.vue
  19. 4
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/_source/list.vue
  20. 10
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/index.vue
  21. 46
      dolphinscheduler-ui/src/js/conf/home/router/index.js
  22. 3
      dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js
  23. 7
      dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
  24. 12
      dolphinscheduler-ui/src/js/conf/home/store/projects/actions.js
  25. 9
      dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue
  26. 33
      dolphinscheduler-ui/src/js/module/mixin/switchProject.js
  27. 38
      dolphinscheduler-ui/src/js/module/project/router.js

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

@ -366,7 +366,7 @@
// source @/conf/home/pages/dag/_source/editAffirmModel/index.js // source @/conf/home/pages/dag/_source/editAffirmModel/index.js
if (sourceType !== 'affirm') { if (sourceType !== 'affirm') {
// Jump process definition // Jump process definition
this.$router.push({ name: 'projects-definition-list' }) this.$router.push({ name: 'projects-definition-list', params: { projectId: this.projectId } })
} }
resolve() resolve()
}).catch(e => { }).catch(e => {
@ -652,7 +652,7 @@
} }
}, },
computed: { computed: {
...mapState('dag', ['tasks', 'locations', 'connects', 'isEditDag', 'name']) ...mapState('dag', ['projectId', 'tasks', 'locations', 'connects', 'isEditDag', 'name'])
}, },
components: {} components: {}
} }

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue

@ -268,7 +268,7 @@
</template> </template>
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import { mapActions } from 'vuex' import { mapActions, mapState } from 'vuex'
import mLog from './log' import mLog from './log'
import mMr from './tasks/mr' import mMr from './tasks/mr'
import mSql from './tasks/sql' import mSql from './tasks/sql'
@ -394,6 +394,7 @@
_seeHistory () { _seeHistory () {
this.self.$router.push({ this.self.$router.push({
name: 'task-instance', name: 'task-instance',
params: { projectId: this.projectId },
query: { query: {
processInstanceId: this.self.$route.params.id, processInstanceId: this.self.$route.params.id,
taskName: this.backfillItem.name taskName: this.backfillItem.name
@ -686,6 +687,7 @@
destroyed () { destroyed () {
}, },
computed: { computed: {
...mapState('dag', ['projectId']),
/** /**
* Child workflow entry show/hide * Child workflow entry show/hide
*/ */

3
dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue

@ -25,6 +25,7 @@
import mSpin from '@/module/components/spin/spin' import mSpin from '@/module/components/spin/spin'
import Affirm from './_source/jumpAffirm' import Affirm from './_source/jumpAffirm'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import switchProject from '@/module/mixin/switchProject'
import { mapActions, mapMutations } from 'vuex' import { mapActions, mapMutations } from 'vuex'
export default { export default {
@ -37,7 +38,7 @@
releaseState: '' releaseState: ''
} }
}, },
mixins: [disabledState], mixins: [disabledState, switchProject],
props: {}, props: {},
methods: { methods: {
...mapMutations('dag', ['resetParams', 'setIsDetails']), ...mapMutations('dag', ['resetParams', 'setIsDetails']),

3
dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue

@ -26,6 +26,7 @@
import mSpin from '@/module/components/spin/spin' import mSpin from '@/module/components/spin/spin'
import Affirm from './_source/jumpAffirm' import Affirm from './_source/jumpAffirm'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'create-index', name: 'create-index',
@ -36,7 +37,7 @@
} }
}, },
// mixins // mixins
mixins: [disabledState], mixins: [disabledState, switchProject],
props: {}, props: {},
methods: { methods: {
...mapMutations('dag', ['resetParams']), ...mapMutations('dag', ['resetParams']),

3
dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue

@ -30,6 +30,7 @@
import mStartingParam from './_source/startingParam' import mStartingParam from './_source/startingParam'
import Affirm from './_source/jumpAffirm' import Affirm from './_source/jumpAffirm'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'instance-details', name: 'instance-details',
@ -39,7 +40,7 @@
isLoading: true isLoading: true
} }
}, },
mixins: [disabledState], mixins: [disabledState, switchProject],
props: {}, props: {},
methods: { methods: {
...mapMutations('dag', ['setIsDetails', 'resetParams']), ...mapMutations('dag', ['setIsDetails', 'resetParams']),

6
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/taskRecordList/index.vue

@ -42,6 +42,7 @@
import mSpin from '@/module/components/spin/spin' import mSpin from '@/module/components/spin/spin'
import mNoData from '@/module/components/noData/noData' import mNoData from '@/module/components/noData/noData'
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' import listUrlParamHandle from '@/module/mixin/listUrlParamHandle'
import switchProject from '@/module/mixin/switchProject'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
@ -66,7 +67,7 @@
} }
} }
}, },
mixins: [listUrlParamHandle], mixins: [listUrlParamHandle, switchProject],
props: { props: {
config: String config: String
}, },
@ -94,6 +95,9 @@
}, },
_onUpdate () { _onUpdate () {
this._debounceGET() this._debounceGET()
},
_updateProject () {
this._debounceGET()
} }
}, },
watch: { watch: {

10
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue

@ -59,7 +59,7 @@
</td> </td>
<td style="min-width: 200px;max-width: 300px;padding-right: 10px;"> <td style="min-width: 200px;max-width: 300px;padding-right: 10px;">
<span class="ellipsis"> <span class="ellipsis">
<router-link :to="{ path: '/projects/definition/list/' + item.id}" tag="a" class="links" :title="item.name"> <router-link :to="{ path: `/projects/${projectId}/definition/list/${item.id}` }" tag="a" class="links" :title="item.name">
{{item.name}} {{item.name}}
</router-link> </router-link>
</span> </span>
@ -148,6 +148,7 @@
import mTiming from './timing' import mTiming from './timing'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { publishStatus } from '@/conf/home/pages/dag/_source/config' import { publishStatus } from '@/conf/home/pages/dag/_source/config'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'definition-list', name: 'definition-list',
@ -163,6 +164,7 @@
pageNo: Number, pageNo: Number,
pageSize: Number pageSize: Number
}, },
mixins: [switchProject],
methods: { methods: {
...mapActions('dag', ['editProcessState', 'getStartCheck', 'getReceiver', 'deleteDefinition', 'batchDeleteDefinition','exportDefinition','copyProcess']), ...mapActions('dag', ['editProcessState', 'getStartCheck', 'getReceiver', 'deleteDefinition', 'batchDeleteDefinition','exportDefinition','copyProcess']),
...mapActions('security', ['getWorkerGroupsAll']), ...mapActions('security', ['getWorkerGroupsAll']),
@ -170,7 +172,7 @@
return _.filter(publishStatus, v => v.code === code)[0].desc return _.filter(publishStatus, v => v.code === code)[0].desc
}, },
_treeView (item) { _treeView (item) {
this.$router.push({ path: `/projects/definition/tree/${item.id}` }) this.$router.push({ path: `/projects/${this.projectId}/definition/tree/${item.id}` })
}, },
/** /**
* Start * Start
@ -257,7 +259,7 @@
* Timing manage * Timing manage
*/ */
_timingManage (item) { _timingManage (item) {
this.$router.push({ path: `/projects/definition/list/timing/${item.id}` }) this.$router.push({ path: `/projects/${this.projectId}/definition/list/timing/${item.id}` })
}, },
/** /**
* Close the delete layer * Close the delete layer
@ -296,7 +298,7 @@
* edit * edit
*/ */
_edit (item) { _edit (item) {
this.$router.push({ path: `/projects/definition/list/${item.id}` }) this.$router.push({ path: `/projects/${this.projectId}/definition/list/${item.id}` })
}, },
/** /**
* Offline * Offline

8
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/index.vue

@ -20,7 +20,7 @@
<template slot="conditions"> <template slot="conditions">
<m-conditions @on-conditions="_onConditions"> <m-conditions @on-conditions="_onConditions">
<template slot="button-group"> <template slot="button-group">
<x-button type="ghost" size="small" @click="() => this.$router.push({name: 'definition-create'})">{{$t('Create process')}}</x-button> <x-button type="ghost" size="small" @click="() => this.$router.push({name: 'definition-create', params: { projectId }})">{{$t('Create process')}}</x-button>
<x-button type="ghost" size="small" @click="_uploading">{{$t('Import process')}}</x-button> <x-button type="ghost" size="small" @click="_uploading">{{$t('Import process')}}</x-button>
</template> </template>
</m-conditions> </m-conditions>
@ -48,6 +48,7 @@
import localStore from '@/module/util/localStorage' import localStore from '@/module/util/localStorage'
import mNoData from '@/module/components/noData/noData' import mNoData from '@/module/components/noData/noData'
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' import listUrlParamHandle from '@/module/mixin/listUrlParamHandle'
import switchProject from '@/module/mixin/switchProject'
import mConditions from '@/module/components/conditions/conditions' import mConditions from '@/module/components/conditions/conditions'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
@ -69,7 +70,7 @@
isLeft: true isLeft: true
} }
}, },
mixins: [listUrlParamHandle], mixins: [listUrlParamHandle, switchProject],
props: { props: {
}, },
methods: { methods: {
@ -126,6 +127,9 @@
this.searchParams.pageNo = 1 this.searchParams.pageNo = 1
this.searchParams.searchVal = '' this.searchParams.searchVal = ''
this._debounceGET() this._debounceGET()
},
_updateProject () {
this._debounceGET()
} }
}, },
watch: { watch: {

9
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/index.vue

@ -79,6 +79,7 @@
import { tasksType, tasksState } from '@/conf/home/pages/dag/_source/config' import { tasksType, tasksState } from '@/conf/home/pages/dag/_source/config'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'tree-view-index-index', name: 'tree-view-index-index',
@ -99,6 +100,7 @@
} }
}, },
props: {}, props: {},
mixins: [switchProject],
methods: { methods: {
...mapActions('dag', ['getViewTree']), ...mapActions('dag', ['getViewTree']),
/** /**
@ -162,7 +164,7 @@
if (id !== idsArr[0]) { if (id !== idsArr[0]) {
query = { subProcessIds: ids.join(',') } query = { subProcessIds: ids.join(',') }
} }
this.$router.push({ path: `/projects/definition/tree/${id}`, query: query }) this.$router.push({ path: `/projects/${this.projectId}/definition/tree/${id}`, query: query })
}, },
/** /**
* Subprocess processing * Subprocess processing
@ -178,11 +180,14 @@
} else { } else {
subProcessIds.push(this.$route.params.id) subProcessIds.push(this.$route.params.id)
} }
this.$router.push({ path: `/projects/definition/tree/${subProcessId}`, query: { subProcessIds: subProcessIds.join(',') } }) this.$router.push({ path: `/projects/${this.projectId}/definition/tree/${subProcessId}`, query: { subProcessIds: subProcessIds.join(',') } })
}, },
_onChangeSelect (o) { _onChangeSelect (o) {
this.limit = o.value this.limit = o.value
this._getViewTree() this._getViewTree()
},
_updateProject () {
this._getViewTree()
} }
}, },
watch: { watch: {

7
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/timing/_source/list.vue

@ -156,6 +156,7 @@
import mSpin from '@/module/components/spin/spin' import mSpin from '@/module/components/spin/spin'
import mTiming from '../../pages/list/_source/timing' import mTiming from '../../pages/list/_source/timing'
import mNoData from '@/module/components/noData/noData' import mNoData from '@/module/components/noData/noData'
import switchProject from '@/module/mixin/switchProject'
import { publishStatus } from '@/conf/home/pages/dag/_source/config' import { publishStatus } from '@/conf/home/pages/dag/_source/config'
export default { export default {
@ -171,6 +172,7 @@
}, },
props: { props: {
}, },
mixins: [switchProject],
methods: { methods: {
...mapActions('dag', ['getScheduleList', 'scheduleOffline', 'scheduleOnline', 'getReceiver','deleteTiming']), ...mapActions('dag', ['getScheduleList', 'scheduleOffline', 'scheduleOnline', 'getReceiver','deleteTiming']),
/** /**
@ -182,7 +184,7 @@
}).then(res => { }).then(res => {
this.$refs[`poptip-delete-${i}`][0].doClose() this.$refs[`poptip-delete-${i}`][0].doClose()
this.$message.success(res.msg) this.$message.success(res.msg)
this.$router.push({ name: 'projects-definition-list' }) this.$router.push({ name: 'projects-definition-list', params: { projectId: this.projectId } })
}).catch(e => { }).catch(e => {
this.$refs[`poptip-delete-${i}`][0].doClose() this.$refs[`poptip-delete-${i}`][0].doClose()
this.$message.error(e.msg || '') this.$message.error(e.msg || '')
@ -211,6 +213,9 @@
this.pageSize = val this.pageSize = val
this._getScheduleList() this._getScheduleList()
}, },
_updateProject () {
this._getScheduleList()
},
/** /**
* Inquire list * Inquire list
*/ */

6
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/defineUserCount.vue

@ -28,7 +28,7 @@
</template> </template>
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import { mapActions } from 'vuex' import { mapActions, mapState } from 'vuex'
import { bar } from './chartConfig' import { bar } from './chartConfig'
import Chart from '@/module/ana-charts' import Chart from '@/module/ana-charts'
import mNoData from '@/module/components/noData/noData' import mNoData from '@/module/components/noData/noData'
@ -61,6 +61,7 @@
myChart.echart.on('click', e => { myChart.echart.on('click', e => {
this.$router.push({ this.$router.push({
name: 'projects-definition-list', name: 'projects-definition-list',
params: { projectId: this.projectId },
query: { query: {
userId: e.name.split(',')[1] userId: e.name.split(',')[1]
} }
@ -83,6 +84,9 @@
}, },
mounted () { mounted () {
}, },
computed: {
...mapState('dag', ['projectId'])
},
components: { mNoData } components: { mNoData }
} }
</script> </script>

7
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/processStateCount.vue

@ -49,7 +49,7 @@
</template> </template>
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import { mapActions } from 'vuex' import { mapActions, mapState } from 'vuex'
import { pie } from './chartConfig' import { pie } from './chartConfig'
import Chart from '@/module/ana-charts' import Chart from '@/module/ana-charts'
import echarts from 'echarts' import echarts from 'echarts'
@ -74,6 +74,7 @@
_goProcess (name) { _goProcess (name) {
this.$router.push({ this.$router.push({
name: 'projects-instance-list', name: 'projects-instance-list',
params: { projectId: this.projectId },
query: { query: {
stateType: _.find(stateType, ['label', name])['code'], stateType: _.find(stateType, ['label', name])['code'],
startDate: this.searchParams.startDate, startDate: this.searchParams.startDate,
@ -136,7 +137,9 @@
}, },
destroyed () { destroyed () {
}, },
computed: {}, computed: {
...mapState('dag', ['projectId'])
},
components: { mNoData } components: { mNoData }
} }
</script> </script>

7
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/taskCtatusCount.vue

@ -51,7 +51,7 @@
</template> </template>
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import { mapActions } from 'vuex' import { mapActions, mapState } from 'vuex'
import { pie } from './chartConfig' import { pie } from './chartConfig'
import Chart from '@/module/ana-charts' import Chart from '@/module/ana-charts'
import echarts from 'echarts' import echarts from 'echarts'
@ -77,6 +77,7 @@
_goTask (name) { _goTask (name) {
this.$router.push({ this.$router.push({
name: 'task-instance', name: 'task-instance',
params: { projectId: this.projectId },
query: { query: {
stateType: _.find(stateType, ['label', name])['code'], stateType: _.find(stateType, ['label', name])['code'],
startDate: this.searchParams.startDate, startDate: this.searchParams.startDate,
@ -141,7 +142,9 @@
}, },
destroyed () { destroyed () {
}, },
computed: {}, computed: {
...mapState('dag', ['projectId'])
},
components: { mNoData } components: { mNoData }
} }
</script> </script>

10
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/index.vue

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
<template> <template>
<m-list-construction :title="searchParams.projectId ? $t('Project Home') : $t('Home')"> <m-list-construction :title="searchParams.projectId ? `${$t('Project Home')} - ${projectName}` : $t('Home')">
<template slot="content"> <template slot="content">
<div class="perject-home-content"> <div class="perject-home-content">
<div class="time-model"> <div class="time-model">
@ -71,7 +71,7 @@
import mTaskCtatusCount from './_source/taskCtatusCount' import mTaskCtatusCount from './_source/taskCtatusCount'
import mProcessStateCount from './_source/processStateCount' import mProcessStateCount from './_source/processStateCount'
import mQueueCount from './_source/queueCount' import mQueueCount from './_source/queueCount'
import localStore from '@/module/util/localStorage' import switchProject from '@/module/mixin/switchProject'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
@ -89,14 +89,18 @@
props: { props: {
id: Number id: Number
}, },
mixins: [switchProject],
methods: { methods: {
_datepicker (val) { _datepicker (val) {
this.searchParams.startDate = val[0] this.searchParams.startDate = val[0]
this.searchParams.endDate = val[1] this.searchParams.endDate = val[1]
},
_updateProject () {
this.searchParams.projectId = this.id === 0 ? 0 : this.projectId
} }
}, },
created () { created () {
this.searchParams.projectId = this.id === 0 ? 0 : localStore.getItem('projectId') this.searchParams.projectId = this.id === 0 ? 0 : this.projectId
this.searchParams.startDate = dayjs().format('YYYY-MM-DD 00:00:00') this.searchParams.startDate = dayjs().format('YYYY-MM-DD 00:00:00')
this.searchParams.endDate = dayjs().format('YYYY-MM-DD HH:mm:ss') this.searchParams.endDate = dayjs().format('YYYY-MM-DD HH:mm:ss')
}, },

2
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/index.vue

@ -50,6 +50,7 @@
import mConditions from '@/module/components/conditions/conditions' import mConditions from '@/module/components/conditions/conditions'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'instance-gantt-index', name: 'instance-gantt-index',
@ -68,6 +69,7 @@
} }
}, },
props: {}, props: {},
mixins: [switchProject],
methods: { methods: {
...mapActions('dag', ['getViewGantt']), ...mapActions('dag', ['getViewGantt']),
/** /**

8
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue

@ -68,7 +68,7 @@
<span>{{parseInt(pageNo === 1 ? ($index + 1) : (($index + 1) + (pageSize * (pageNo - 1))))}}</span> <span>{{parseInt(pageNo === 1 ? ($index + 1) : (($index + 1) + (pageSize * (pageNo - 1))))}}</span>
</td> </td>
<td style="min-width: 200px;max-width: 300px;padding-right: 10px;"> <td style="min-width: 200px;max-width: 300px;padding-right: 10px;">
<span class="ellipsis" style="padding-left: 4px;"><router-link :to="{ path: '/projects/instance/list/' + item.id , query:{id: item.processDefinitionId}}" tag="a" class="links" :title="item.name">{{item.name}}</router-link></span> <span class="ellipsis" style="padding-left: 4px;"><router-link :to="{ path: `/projects/${projectId}/instance/list/${item.id}` , query:{id: item.processDefinitionId}}" tag="a" class="links" :title="item.name">{{item.name}}</router-link></span>
</td> </td>
<td> <td>
<span v-html="_rtState(item.state)" style="cursor: pointer;"></span> <span v-html="_rtState(item.state)" style="cursor: pointer;"></span>
@ -302,6 +302,7 @@
import _ from 'lodash' import _ from 'lodash'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { tasksState, runningType } from '@/conf/home/pages/dag/_source/config' import { tasksState, runningType } from '@/conf/home/pages/dag/_source/config'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'list', name: 'list',
@ -320,6 +321,7 @@
pageNo: Number, pageNo: Number,
pageSize: Number pageSize: Number
}, },
mixins: [switchProject],
methods: { methods: {
...mapActions('dag', ['editExecutorsState', 'deleteInstance', 'batchDeleteInstance']), ...mapActions('dag', ['editExecutorsState', 'deleteInstance', 'batchDeleteInstance']),
/** /**
@ -372,7 +374,7 @@
* edit * edit
*/ */
_reEdit (item) { _reEdit (item) {
this.$router.push({ path: `/projects/instance/list/${item.id}` }) this.$router.push({ path: `/projects/${this.projectId}/instance/list/${item.id}` })
}, },
/** /**
* Rerun * Rerun
@ -513,7 +515,7 @@
} }
}, },
_gantt (item) { _gantt (item) {
this.$router.push({ path: `/projects/instance/gantt/${item.id}` }) this.$router.push({ path: `/projects/${this.projectId}/instance/gantt/${item.id}` })
}, },
_topCheckBoxClick (is) { _topCheckBoxClick (is) {

5
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue

@ -43,6 +43,7 @@
import mSpin from '@/module/components/spin/spin' import mSpin from '@/module/components/spin/spin'
import localStore from '@/module/util/localStorage' import localStore from '@/module/util/localStorage'
import { setUrlParams } from '@/module/util/routerUtil' import { setUrlParams } from '@/module/util/routerUtil'
import switchProject from '@/module/mixin/switchProject'
import mNoData from '@/module/components/noData/noData' import mNoData from '@/module/components/noData/noData'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
@ -81,6 +82,7 @@
} }
}, },
props: {}, props: {},
mixins: [switchProject],
methods: { methods: {
...mapActions('dag', ['getProcessInstance']), ...mapActions('dag', ['getProcessInstance']),
/** /**
@ -129,6 +131,9 @@
_onUpdate () { _onUpdate () {
this._debounceGET() this._debounceGET()
}, },
_updateProject () {
this._debounceGET()
},
/** /**
* Routing changes * Routing changes
*/ */

9
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/list/_source/list.vue

@ -132,12 +132,13 @@
}, },
methods: { methods: {
...mapActions('projects', ['deleteProjects']), ...mapActions('projects', ['deleteProjects']),
...mapMutations('dag', ['setProjectName']), ...mapMutations('dag', ['setProjectId', 'setProjectName']),
_switchProjects (item) { _switchProjects (item) {
this.setProjectId(item.id)
this.setProjectName(item.name) this.setProjectName(item.name)
localStore.setItem('projectName', `${item.name}`) localStore.setItem('projectId', item.id)
localStore.setItem('projectId', `${item.id}`) localStore.setItem('projectName', item.name)
this.$router.push({ path: `/projects/index` }) this.$router.push({ path: `/projects/${item.id}/index` })
}, },
_closeDelete (i) { _closeDelete (i) {
this.$refs[`poptip-${i}`][0].doClose() this.$refs[`poptip-${i}`][0].doClose()

4
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/_source/list.vue

@ -111,6 +111,7 @@
import Permissions from '@/module/permissions' import Permissions from '@/module/permissions'
import mLog from '@/conf/home/pages/dag/_source/formModel/log' import mLog from '@/conf/home/pages/dag/_source/formModel/log'
import { tasksState } from '@/conf/home/pages/dag/_source/config' import { tasksState } from '@/conf/home/pages/dag/_source/config'
import switchProject from '@/module/mixin/switchProject'
export default { export default {
name: 'list', name: 'list',
@ -126,6 +127,7 @@
pageNo: Number, pageNo: Number,
pageSize: Number pageSize: Number
}, },
mixins: [switchProject],
methods: { methods: {
_rtState (code) { _rtState (code) {
let o = tasksState[code] let o = tasksState[code]
@ -158,7 +160,7 @@
}) })
}, },
_go (item) { _go (item) {
this.$router.push({ path: `/projects/instance/list/${item.processInstanceId}` }) this.$router.push({ path: `/projects/${this.projectId}/instance/list/${item.processInstanceId}` })
}, },
}, },
watch: { watch: {

10
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/index.vue

@ -43,6 +43,7 @@
import mSpin from '@/module/components/spin/spin' import mSpin from '@/module/components/spin/spin'
import mNoData from '@/module/components/noData/noData' import mNoData from '@/module/components/noData/noData'
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' import listUrlParamHandle from '@/module/mixin/listUrlParamHandle'
import switchProject from '@/module/mixin/switchProject'
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
import mListConstruction from '@/module/components/listConstruction/listConstruction' import mListConstruction from '@/module/components/listConstruction/listConstruction'
import mInstanceConditions from '@/conf/home/pages/projects/pages/_source/instanceConditions' import mInstanceConditions from '@/conf/home/pages/projects/pages/_source/instanceConditions'
@ -77,7 +78,7 @@
isLeft: true isLeft: true
} }
}, },
mixins: [listUrlParamHandle], mixins: [listUrlParamHandle, switchProject],
props: {}, props: {},
methods: { methods: {
...mapActions('dag', ['getTaskInstanceList']), ...mapActions('dag', ['getTaskInstanceList']),
@ -104,7 +105,7 @@
_getList (flag) { _getList (flag) {
this.isLoading = !flag this.isLoading = !flag
if(this.searchParams.pageNo == undefined) { if(this.searchParams.pageNo == undefined) {
this.$router.push({ path: `/projects/index` }) this.$router.push({ path: `/projects/${this.projectId}/index` })
return false return false
} }
this.getTaskInstanceList(this.searchParams).then(res => { this.getTaskInstanceList(this.searchParams).then(res => {
@ -130,7 +131,10 @@
}, 100, { }, 100, {
'leading': false, 'leading': false,
'trailing': true 'trailing': true
}) }),
_updateProject () {
this._debounceGET()
}
}, },
watch: { watch: {
// router // router

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

@ -17,6 +17,7 @@
import Vue from 'vue' import Vue from 'vue'
import i18n from '@/module/i18n/index.js' import i18n from '@/module/i18n/index.js'
import { beforeProjectRoute } from '@/module/project/router'
import Router from 'vue-router' import Router from 'vue-router'
Vue.use(Router) Vue.use(Router)
@ -48,15 +49,10 @@ const router = new Router({
redirect: { redirect: {
name: 'projects-list' name: 'projects-list'
}, },
beforeEnter: (to, from, next) => {
beforeProjectRoute(to, from, next)
},
children: [ children: [
{
path: '/projects/index',
name: 'projects-index',
component: resolve => require(['../pages/projects/pages/index/index'], resolve),
meta: {
title: `${i18n.$t('Project Home')}`
}
},
{ {
path: '/projects/list', path: '/projects/list',
name: 'projects-list', name: 'projects-list',
@ -66,7 +62,15 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/definition', path: '/projects/:projectId/index',
name: 'projects-index',
component: resolve => require(['../pages/projects/pages/index/index'], resolve),
meta: {
title: `${i18n.$t('Project Home')}`
}
},
{
path: '/projects/:projectId/definition',
name: 'definition', name: 'definition',
component: resolve => require(['../pages/projects/pages/definition/index'], resolve), component: resolve => require(['../pages/projects/pages/definition/index'], resolve),
meta: { meta: {
@ -77,7 +81,7 @@ const router = new Router({
}, },
children: [ children: [
{ {
path: '/projects/definition/list', path: '/projects/:projectId/definition/list',
name: 'projects-definition-list', name: 'projects-definition-list',
component: resolve => require(['../pages/projects/pages/definition/pages/list/index'], resolve), component: resolve => require(['../pages/projects/pages/definition/pages/list/index'], resolve),
meta: { meta: {
@ -85,7 +89,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/definition/list/:id', path: '/projects/:projectId/definition/list/:id',
name: 'projects-definition-details', name: 'projects-definition-details',
component: resolve => require(['../pages/projects/pages/definition/pages/details/index'], resolve), component: resolve => require(['../pages/projects/pages/definition/pages/details/index'], resolve),
meta: { meta: {
@ -93,7 +97,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/definition/create', path: '/projects/:projectId/definition/create',
name: 'definition-create', name: 'definition-create',
component: resolve => require(['../pages/projects/pages/definition/pages/create/index'], resolve), component: resolve => require(['../pages/projects/pages/definition/pages/create/index'], resolve),
meta: { meta: {
@ -101,7 +105,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/definition/tree/:id', path: '/projects/:projectId/definition/tree/:id',
name: 'definition-tree-view-index', name: 'definition-tree-view-index',
component: resolve => require(['../pages/projects/pages/definition/pages/tree/index'], resolve), component: resolve => require(['../pages/projects/pages/definition/pages/tree/index'], resolve),
meta: { meta: {
@ -109,7 +113,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/definition/list/timing/:id', path: '/projects/:projectId/definition/list/timing/:id',
name: 'definition-timing-details', name: 'definition-timing-details',
component: resolve => require(['../pages/projects/pages/definition/timing/index'], resolve), component: resolve => require(['../pages/projects/pages/definition/timing/index'], resolve),
meta: { meta: {
@ -119,7 +123,7 @@ const router = new Router({
] ]
}, },
{ {
path: '/projects/instance', path: '/projects/:projectId/instance',
name: 'instance', name: 'instance',
component: resolve => require(['../pages/projects/pages/instance/index'], resolve), component: resolve => require(['../pages/projects/pages/instance/index'], resolve),
meta: { meta: {
@ -130,7 +134,7 @@ const router = new Router({
}, },
children: [ children: [
{ {
path: '/projects/instance/list', path: '/projects/:projectId/instance/list',
name: 'projects-instance-list', name: 'projects-instance-list',
component: resolve => require(['../pages/projects/pages/instance/pages/list/index'], resolve), component: resolve => require(['../pages/projects/pages/instance/pages/list/index'], resolve),
meta: { meta: {
@ -138,7 +142,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/instance/list/:id', path: '/projects/:projectId/instance/list/:id',
name: 'projects-instance-details', name: 'projects-instance-details',
component: resolve => require(['../pages/projects/pages/instance/pages/details/index'], resolve), component: resolve => require(['../pages/projects/pages/instance/pages/details/index'], resolve),
meta: { meta: {
@ -146,7 +150,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/instance/gantt/:id', path: '/projects/:projectId/instance/gantt/:id',
name: 'instance-gantt-index', name: 'instance-gantt-index',
component: resolve => require(['../pages/projects/pages/instance/pages/gantt/index'], resolve), component: resolve => require(['../pages/projects/pages/instance/pages/gantt/index'], resolve),
meta: { meta: {
@ -156,7 +160,7 @@ const router = new Router({
] ]
}, },
{ {
path: '/projects/task-instance', path: '/projects/:projectId/task-instance',
name: 'task-instance', name: 'task-instance',
component: resolve => require(['../pages/projects/pages/taskInstance'], resolve), component: resolve => require(['../pages/projects/pages/taskInstance'], resolve),
meta: { meta: {
@ -165,7 +169,7 @@ const router = new Router({
}, },
{ {
path: '/projects/task-record', path: '/projects/:projectId/task-record',
name: 'task-record', name: 'task-record',
component: resolve => require(['../pages/projects/pages/taskRecord'], resolve), component: resolve => require(['../pages/projects/pages/taskRecord'], resolve),
meta: { meta: {
@ -173,7 +177,7 @@ const router = new Router({
} }
}, },
{ {
path: '/projects/history-task-record', path: '/projects/:projectId/history-task-record',
name: 'history-task-record', name: 'history-task-record',
component: resolve => require(['../pages/projects/pages/historyTaskRecord'], resolve), component: resolve => require(['../pages/projects/pages/historyTaskRecord'], resolve),
meta: { meta: {

3
dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js

@ -18,6 +18,9 @@
import _ from 'lodash' import _ from 'lodash'
export default { export default {
setProjectId (state, payload) {
state.projectId = payload
},
setProjectName (state, payload) { setProjectName (state, payload) {
state.projectName = payload state.projectName = payload
}, },

7
dolphinscheduler-ui/src/js/conf/home/store/dag/state.js

@ -17,7 +17,8 @@
import localStore from '@/module/util/localStorage' import localStore from '@/module/util/localStorage'
// Get the name of the item currently clicked // Get the project currently clicked
const projectId = localStore.getItem('projectId')
const projectName = localStore.getItem('projectName') const projectName = localStore.getItem('projectName')
export default { export default {
@ -43,7 +44,9 @@ export default {
runFlag: '', runFlag: '',
// Whether to edit // Whether to edit
isEditDag: false, isEditDag: false,
// Current project // Current project id
projectId: projectId,
// Current project name
projectName: projectName || '', projectName: projectName || '',
// Whether to update the process definition // Whether to update the process definition
syncDefine: true, syncDefine: true,

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

@ -30,6 +30,18 @@ export default {
}) })
}) })
}, },
/**
* Get project by id
*/
getProjectById ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('projects/query-by-id', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
})
})
},
/** /**
* Create project * Create project
*/ */

9
dolphinscheduler-ui/src/js/module/components/secondaryMenu/secondaryMenu.vue

@ -27,7 +27,7 @@
<div class="name" @click="_toggleSubMenu(item)"> <div class="name" @click="_toggleSubMenu(item)">
<a href="javascript:"> <a href="javascript:">
<em class="fa icon" :class="item.icon"></em> <em class="fa icon" :class="item.icon"></em>
<span>{{item.name}}</span> <span>{{item.name}}{{ item.path === 'projects-index' ? ` - ${projectName}` : '' }}</span>
<em class="fa angle" :class="item.isOpen ? 'ans-icon-arrow-down' : 'ans-icon-arrow-right'" v-if="item.children.length"></em> <em class="fa angle" :class="item.isOpen ? 'ans-icon-arrow-down' : 'ans-icon-arrow-right'" v-if="item.children.length"></em>
</a> </a>
</div> </div>
@ -54,6 +54,7 @@
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import menu from './_source/menu' import menu from './_source/menu'
import store from '@/conf/home/store' import store from '@/conf/home/store'
export default { export default {
@ -93,6 +94,9 @@
} }
}, },
mounted () { mounted () {
},
computed: {
...mapState('dag', ['projectName'])
} }
} }
</script> </script>
@ -142,6 +146,9 @@
display: block; display: block;
position: relative; position: relative;
padding-left: 10px; padding-left: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
>.icon { >.icon {
vertical-align: middle; vertical-align: middle;
font-size: 15px; font-size: 15px;

33
dolphinscheduler-ui/src/js/module/mixin/switchProject.js

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { mapState } from 'vuex'
import { beforeProjectRoute } from '@/module/project/router'
export default {
computed: {
...mapState('dag', ['projectId', 'projectName'])
},
watch: {
projectId () {
typeof this._updateProject === 'function' && this._updateProject()
}
},
beforeRouteUpdate (to, from, next) {
beforeProjectRoute(to, from, next)
}
}

38
dolphinscheduler-ui/src/js/module/project/router.js

@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import store from '@/conf/home/store'
import localStore from '@/module/util/localStorage'
export function beforeProjectRoute (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 => {
store.commit('dag/setProjectId', res.id)
store.commit('dag/setProjectName', res.name)
localStore.setItem('projectId', res.id)
localStore.setItem('projectName', res.name)
next()
}).catch(e => {
next({ name: 'projects-list' })
})
} else {
next()
}
}
Loading…
Cancel
Save