Browse Source

[Feature][UI Next] Fix a few bug with workflow manage (#8360)

* fix workflow define international bug

* fix workflow name link font color

* fix operation tooltip display bug
3.0.0/version-upgrade
Devosend 3 years ago committed by GitHub
parent
commit
9e9edbfe27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      dolphinscheduler-ui-next/src/locales/modules/en_US.ts
  2. 3
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/table-action.tsx
  3. 8
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.module.scss
  4. 9
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx
  5. 87
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts

3
dolphinscheduler-ui-next/src/locales/modules/en_US.ts

@ -384,7 +384,8 @@ const project = {
start: 'Start', start: 'Start',
timing: 'Timing', timing: 'Timing',
timezone: 'Timezone', timezone: 'Timezone',
upline: 'Online', up_line: 'Online',
down_line: 'Offline',
copy_workflow: 'Copy Workflow', copy_workflow: 'Copy Workflow',
cron_manage: 'Cron manage', cron_manage: 'Cron manage',
delete: 'Delete', delete: 'Delete',

3
dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/table-action.tsx

@ -131,6 +131,7 @@ export default defineComponent({
<NButton <NButton
size='tiny' size='tiny'
type='primary' type='primary'
tag='div'
circle circle
onClick={this.handleStartWorkflow} onClick={this.handleStartWorkflow}
disabled={releaseState === 'OFFLINE'} disabled={releaseState === 'OFFLINE'}
@ -168,6 +169,7 @@ export default defineComponent({
<NButton <NButton
size='tiny' size='tiny'
type={releaseState === 'ONLINE' ? 'warning' : 'error'} type={releaseState === 'ONLINE' ? 'warning' : 'error'}
tag='div'
circle circle
onClick={this.handleReleaseWorkflow} onClick={this.handleReleaseWorkflow}
> >
@ -227,6 +229,7 @@ export default defineComponent({
<NButton <NButton
size='tiny' size='tiny'
type='error' type='error'
tag='div'
circle circle
disabled={releaseState === 'ONLINE'} disabled={releaseState === 'ONLINE'}
> >

8
dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.module.scss

@ -86,3 +86,11 @@
width: 86%; width: 86%;
} }
} }
.links {
color: #2080f0;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}

9
dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx

@ -25,7 +25,7 @@ import {
NPagination, NPagination,
NSpace NSpace
} from 'naive-ui' } from 'naive-ui'
import { defineComponent, onMounted, toRefs } from 'vue' import { defineComponent, onMounted, toRefs, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useTable } from './use-table' import { useTable } from './use-table'
import ImportModal from './components/import-modal' import ImportModal from './components/import-modal'
@ -43,7 +43,7 @@ export default defineComponent({
const route = useRoute() const route = useRoute()
const projectCode = Number(route.params.projectCode) const projectCode = Number(route.params.projectCode)
const { variables, getTableData } = useTable() const { variables, createColumns, getTableData } = useTable()
const requestData = () => { const requestData = () => {
getTableData({ getTableData({
@ -73,7 +73,12 @@ export default defineComponent({
}) })
} }
watch(useI18n().locale, () => {
createColumns(variables)
})
onMounted(() => { onMounted(() => {
createColumns(variables)
requestData() requestData()
}) })

87
dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.tsx → dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts

@ -17,7 +17,7 @@
import { h, ref, reactive } from 'vue' import { h, ref, reactive } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter, RouterLink } from 'vue-router' import { useRouter } from 'vue-router'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
import type { TableColumns } from 'naive-ui/es/data-table/src/interface' import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
import { useAsyncState } from '@vueuse/core' import { useAsyncState } from '@vueuse/core'
@ -38,38 +38,61 @@ export function useTable() {
const { t } = useI18n() const { t } = useI18n()
const router: Router = useRouter() const router: Router = useRouter()
const columns: TableColumns<any> = [ const variables = reactive({
columns: [],
row: {},
tableData: [],
projectCode: ref(Number(router.currentRoute.value.params.projectCode)),
page: ref(1),
pageSize: ref(10),
searchVal: ref(),
totalPage: ref(1),
showRef: ref(false),
startShowRef: ref(false),
timingShowRef: ref(false),
versionShowRef: ref(false)
})
const createColumns = (variables: any) => {
variables.columns = [
{ {
title: t('project.workflow.id'), title: t('project.workflow.id'),
key: 'id', key: 'id',
width: 50, width: 50,
render: (_row, index) => index + 1 render: (row, index) => index + 1
}, },
{ {
title: t('project.workflow.workflow_name'), title: t('project.workflow.workflow_name'),
key: 'name', key: 'name',
width: 200, width: 200,
render: (_row) => ( render: (row) =>
<NEllipsis h(
style={{ NEllipsis,
maxWidth: '200px' { style: 'max-width: 200px; color: #2080f0' },
}} {
> default: () =>
<RouterLink h(
to={{ 'a',
path: `/projects/${_row.projectCode}/workflow/definitions/${_row.code}` {
}} href: 'javascript:',
> class: styles.links,
{_row.name} onClick: () =>
</RouterLink> router.push({
</NEllipsis> name: 'workflow-definition-detail',
params: { code: row.code }
})
},
row.name
),
tooltip: () => row.name
}
) )
}, },
{ {
title: t('project.workflow.status'), title: t('project.workflow.status'),
key: 'releaseState', key: 'releaseState',
render: (_row) => render: (row) =>
_row.releaseState === 'ONLINE' row.releaseState === 'ONLINE'
? t('project.workflow.up_line') ? t('project.workflow.up_line')
: t('project.workflow.down_line') : t('project.workflow.down_line')
}, },
@ -98,8 +121,8 @@ export function useTable() {
{ {
title: t('project.workflow.schedule_publish_status'), title: t('project.workflow.schedule_publish_status'),
key: 'scheduleReleaseState', key: 'scheduleReleaseState',
render: (_row) => { render: (row) => {
if (_row.scheduleReleaseState === 'ONLINE') { if (row.scheduleReleaseState === 'ONLINE') {
return h( return h(
NTag, NTag,
{ type: 'success', size: 'small' }, { type: 'success', size: 'small' },
@ -107,7 +130,7 @@ export function useTable() {
default: () => t('project.workflow.up_line') default: () => t('project.workflow.up_line')
} }
) )
} else if (_row.scheduleReleaseState === 'OFFLINE') { } else if (row.scheduleReleaseState === 'OFFLINE') {
return h( return h(
NTag, NTag,
{ type: 'warning', size: 'small' }, { type: 'warning', size: 'small' },
@ -139,8 +162,8 @@ export function useTable() {
onGotoTimingManage: () => gotoTimingManage(row) onGotoTimingManage: () => gotoTimingManage(row)
}) })
} }
] ] as TableColumns<any>
}
const startWorkflow = (row: any) => { const startWorkflow = (row: any) => {
variables.startShowRef = true variables.startShowRef = true
variables.row = row variables.row = row
@ -258,21 +281,6 @@ export function useTable() {
}) })
} }
const variables = reactive({
columns,
row: {},
tableData: [],
projectCode: ref(Number(router.currentRoute.value.params.projectCode)),
page: ref(1),
pageSize: ref(10),
searchVal: ref(),
totalPage: ref(1),
showRef: ref(false),
startShowRef: ref(false),
timingShowRef: ref(false),
versionShowRef: ref(false)
})
const getTableData = (params: IDefinitionParam) => { const getTableData = (params: IDefinitionParam) => {
const { state } = useAsyncState( const { state } = useAsyncState(
queryListPaging({ ...params }, variables.projectCode).then((res: any) => { queryListPaging({ ...params }, variables.projectCode).then((res: any) => {
@ -288,6 +296,7 @@ export function useTable() {
return { return {
variables, variables,
createColumns,
getTableData getTableData
} }
} }
Loading…
Cancel
Save