Browse Source

[Feature][UI Next][V1.0.0-Alpha] Adjust all table column widths in th… (#9062)

* [Feature][UI Next][V1.0.0-Alpha] Adjust all table column widths in this project.

* [Fix][UI Next][V1.0.0-Alpha] Fix workflow delete handle (#9057)

* [Fix][UI Next][V1.0.0-Alpha] User Manage Queue display error (#9060)

* fix package bug (#9051)

* [Fix][UI Next][V1.0.0-Alpha] Fix the monitoring center does not support multiple worker. (#9061)

* [Fix][UI Next][V1.0.0-Alpha] Remove the unused Ref.

* [Fix-9025] [UI Next] Rectify this issue about failing to save a process when the user is ordinary user. (#9063)

* modify the back-edn api

* fix this issue

* [Fix][UI Next][V1.0.0-Alpha]Change the column-config file name to column-width-config and COLUMN_CONFIG to COLUMN_WIDTH_CONFIG.

* [Bug][UI Next] Fix style errors (#9067)

* [Feature][UI Next][V1.0.0-Alpha] Adjust all table column widths in this project.

* [Fix][UI Next][V1.0.0-Alpha] Remove the unused Ref.

* [Fix][UI Next][V1.0.0-Alpha]Change the column-config file name to column-width-config and COLUMN_CONFIG to COLUMN_WIDTH_CONFIG.

Co-authored-by: Devosend <devosend@gmail.com>
Co-authored-by: zixi0825 <sunzhaohe0825@gmail.com>
Co-authored-by: songjianet <1778651752@qq.com>
Co-authored-by: calvin <jianghuachinacom@163.com>
Co-authored-by: labbomb <739955946@qq.com>
3.0.0/version-upgrade
Amy0104 3 years ago committed by GitHub
parent
commit
bf1f959f58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 94
      dolphinscheduler-ui-next/src/utils/column-width-config.ts
  2. 6
      dolphinscheduler-ui-next/src/views/data-quality/task-result/index.tsx
  3. 60
      dolphinscheduler-ui-next/src/views/data-quality/task-result/use-table.ts
  4. 2
      dolphinscheduler-ui-next/src/views/datasource/list/detail.tsx
  5. 6
      dolphinscheduler-ui-next/src/views/datasource/list/index.tsx
  6. 40
      dolphinscheduler-ui-next/src/views/datasource/list/use-columns.ts
  7. 1
      dolphinscheduler-ui-next/src/views/projects/list/index.tsx
  8. 53
      dolphinscheduler-ui-next/src/views/projects/list/use-table.ts
  9. 6
      dolphinscheduler-ui-next/src/views/projects/task/definition/index.tsx
  10. 45
      dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts
  11. 2
      dolphinscheduler-ui-next/src/views/projects/task/instance/index.tsx
  12. 37
      dolphinscheduler-ui-next/src/views/projects/task/instance/use-table.ts
  13. 2
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/index.tsx
  14. 1
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/index.tsx
  15. 32
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/use-table.ts
  16. 36
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts
  17. 2
      dolphinscheduler-ui-next/src/views/projects/workflow/instance/index.tsx
  18. 36
      dolphinscheduler-ui-next/src/views/projects/workflow/instance/use-table.ts
  19. 8
      dolphinscheduler-ui-next/src/views/resource/file/index.tsx
  20. 43
      dolphinscheduler-ui-next/src/views/resource/file/table/use-table.ts
  21. 3
      dolphinscheduler-ui-next/src/views/resource/task-group/option/index.tsx
  22. 53
      dolphinscheduler-ui-next/src/views/resource/task-group/option/use-table.ts
  23. 1
      dolphinscheduler-ui-next/src/views/resource/task-group/queue/index.tsx
  24. 66
      dolphinscheduler-ui-next/src/views/resource/task-group/queue/use-table.ts
  25. 1
      dolphinscheduler-ui-next/src/views/resource/udf/function/index.tsx
  26. 34
      dolphinscheduler-ui-next/src/views/resource/udf/function/use-table.ts
  27. 1
      dolphinscheduler-ui-next/src/views/resource/udf/resource/index.tsx
  28. 27
      dolphinscheduler-ui-next/src/views/resource/udf/resource/use-table.ts
  29. 1
      dolphinscheduler-ui-next/src/views/security/environment-manage/index.tsx
  30. 29
      dolphinscheduler-ui-next/src/views/security/environment-manage/use-table.ts
  31. 6
      dolphinscheduler-ui-next/src/views/security/k8s-namespace-manage/index.tsx
  32. 37
      dolphinscheduler-ui-next/src/views/security/k8s-namespace-manage/use-table.ts
  33. 1
      dolphinscheduler-ui-next/src/views/security/tenant-manage/index.tsx
  34. 29
      dolphinscheduler-ui-next/src/views/security/tenant-manage/use-table.ts
  35. 3
      dolphinscheduler-ui-next/src/views/security/user-manage/index.tsx
  36. 49
      dolphinscheduler-ui-next/src/views/security/user-manage/use-columns.ts

94
dolphinscheduler-ui-next/src/utils/column-width-config.ts

@ -0,0 +1,94 @@
/*
* 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 { isNumber, sumBy } from 'lodash'
import type {
TableColumns,
CommonColumnInfo
} from 'naive-ui/es/data-table/src/interface'
export const COLUMN_WIDTH_CONFIG = {
selection: {
width: 50
},
index: {
width: 50
},
name: {
width: 200,
ellipsis: {
tooltip: true
}
},
state: {
width: 120
},
type: {
width: 120
},
version: {
width: 80
},
time: {
width: 180
},
operation: (number: number): CommonColumnInfo => ({
fixed: 'right',
width: Math.max(30 * number + 12 * (number - 1) + 24, 100)
}),
userName: {
width: 120,
ellipsis: {
tooltip: true
}
},
ruleType: {
width: 120
},
note: {
width: 180,
ellipsis: {
tooltip: true
}
},
dryRun: {
width: 140
},
times: {
width: 120
},
duration: {
width: 120
},
yesOrNo: {
width: 100,
ellipsis: {
tooltip: true
}
},
size: {
width: 100
},
tag: {
width: 160
}
}
export const calculateTableWidth = (columns: TableColumns) =>
sumBy(columns, (column) => (isNumber(column.width) ? column.width : 0))
export const DefaultTableWidth = 1800

6
dolphinscheduler-ui-next/src/views/data-quality/task-result/index.tsx

@ -155,7 +155,11 @@ const TaskResult = defineComponent({
</NSpace> </NSpace>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable columns={this.columns} data={this.tableData} /> <NDataTable
columns={this.columns}
data={this.tableData}
scrollX={this.tableWidth}
/>
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}

60
dolphinscheduler-ui-next/src/views/data-quality/task-result/use-table.ts

@ -20,6 +20,11 @@ import { reactive, ref } from 'vue'
import { useAsyncState } from '@vueuse/core' import { useAsyncState } from '@vueuse/core'
import { queryExecuteResultListPaging } from '@/service/modules/data-quality' import { queryExecuteResultListPaging } from '@/service/modules/data-quality'
import { format } from 'date-fns' import { format } from 'date-fns'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { import type {
ResultItem, ResultItem,
ResultListRes ResultListRes
@ -31,6 +36,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
tableData: [], tableData: [],
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
@ -46,15 +52,18 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('data_quality.task_result.task_name'), title: t('data_quality.task_result.task_name'),
key: 'userName' key: 'userName',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('data_quality.task_result.workflow_instance'), title: t('data_quality.task_result.workflow_instance'),
key: 'processInstanceName' key: 'processInstanceName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('data_quality.task_result.rule_type'), title: t('data_quality.task_result.rule_type'),
@ -69,11 +78,13 @@ export function useTable() {
} else if (row.ruleType === 3) { } else if (row.ruleType === 3) {
return t('data_quality.task_result.multi_table_comparison') return t('data_quality.task_result.multi_table_comparison')
} }
} },
...COLUMN_WIDTH_CONFIG['ruleType']
}, },
{ {
title: t('data_quality.task_result.rule_name'), title: t('data_quality.task_result.rule_name'),
key: 'ruleName' key: 'ruleName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('data_quality.task_result.state'), title: t('data_quality.task_result.state'),
@ -86,15 +97,18 @@ export function useTable() {
} else if (row.state === 2) { } else if (row.state === 2) {
return t('data_quality.task_result.failure') return t('data_quality.task_result.failure')
} }
} },
...COLUMN_WIDTH_CONFIG['state']
}, },
{ {
title: t('data_quality.task_result.actual_value'), title: t('data_quality.task_result.actual_value'),
key: 'statisticsValue' key: 'statisticsValue',
width: 140
}, },
{ {
title: t('data_quality.task_result.excepted_value'), title: t('data_quality.task_result.excepted_value'),
key: 'comparisonValue' key: 'comparisonValue',
width: 140
}, },
{ {
title: t('data_quality.task_result.check_type'), title: t('data_quality.task_result.check_type'),
@ -109,7 +123,8 @@ export function useTable() {
} else if (row.checkType === 3) { } else if (row.checkType === 3) {
return t('data_quality.task_result.expected_and_actual_or_expected') return t('data_quality.task_result.expected_and_actual_or_expected')
} }
} },
...COLUMN_WIDTH_CONFIG['type']
}, },
{ {
title: t('data_quality.task_result.operator'), title: t('data_quality.task_result.operator'),
@ -128,40 +143,51 @@ export function useTable() {
} else if (row.operator === 5) { } else if (row.operator === 5) {
return '!=' return '!='
} }
} },
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('data_quality.task_result.threshold'), title: t('data_quality.task_result.threshold'),
key: 'threshold' key: 'threshold',
width: 120
}, },
{ {
title: t('data_quality.task_result.failure_strategy'), title: t('data_quality.task_result.failure_strategy'),
key: 'failureStrategy' key: 'failureStrategy',
width: 150
}, },
{ {
title: t('data_quality.task_result.excepted_value_type'), title: t('data_quality.task_result.excepted_value_type'),
key: 'comparisonTypeName' key: 'comparisonTypeName',
width: 200
}, },
{ {
title: t('data_quality.task_result.error_output_path'), title: t('data_quality.task_result.error_output_path'),
key: 'errorOutputPath', key: 'errorOutputPath',
render: (row: ResultItem) => { render: (row: ResultItem) => {
return row.errorOutputPath ? row : '-' return row.errorOutputPath ? row : '-'
} },
width: 200
}, },
{ {
title: t('data_quality.task_result.username'), title: t('data_quality.task_result.username'),
key: 'userName' key: 'userName',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('data_quality.task_result.create_time'), title: t('data_quality.task_result.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('data_quality.task_result.update_time'), title: t('data_quality.task_result.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const getTableData = (params: any) => { const getTableData = (params: any) => {

2
dolphinscheduler-ui-next/src/views/datasource/list/detail.tsx

@ -141,7 +141,7 @@ const DetailModal = defineComponent({
rules={rules} rules={rules}
ref='detailFormRef' ref='detailFormRef'
require-mark-placement='left' require-mark-placement='left'
label-align='right' label-align='left'
> >
<NFormItem <NFormItem
label={t('datasource.datasource')} label={t('datasource.datasource')}

6
dolphinscheduler-ui-next/src/views/datasource/list/index.tsx

@ -31,6 +31,7 @@ import { useI18n } from 'vue-i18n'
import { useColumns } from './use-columns' import { useColumns } from './use-columns'
import { useTable } from './use-table' import { useTable } from './use-table'
import styles from './index.module.scss' import styles from './index.module.scss'
import type { TableColumns } from './types'
const list = defineComponent({ const list = defineComponent({
name: 'list', name: 'list',
@ -38,7 +39,7 @@ const list = defineComponent({
const { t } = useI18n() const { t } = useI18n()
const showDetailModal = ref(false) const showDetailModal = ref(false)
const selectId = ref() const selectId = ref()
const columns = ref() const columns = ref({ columns: [] as TableColumns, tableWidth: 0 })
const { data, changePage, changePageSize, deleteRecord, updateList } = const { data, changePage, changePageSize, deleteRecord, updateList } =
useTable() useTable()
@ -131,10 +132,11 @@ const list = defineComponent({
<Card title='' class={styles['mt-8']}> <Card title='' class={styles['mt-8']}>
<NDataTable <NDataTable
row-class-name='data-source-items' row-class-name='data-source-items'
columns={columns} columns={columns.columns}
data={list} data={list}
loading={loading} loading={loading}
striped striped
scrollX={columns.tableWidth}
/> />
<NPagination <NPagination
page={page} page={page}

40
dolphinscheduler-ui-next/src/views/datasource/list/use-columns.ts

@ -28,33 +28,43 @@ import {
import { EditOutlined, DeleteOutlined } from '@vicons/antd' import { EditOutlined, DeleteOutlined } from '@vicons/antd'
import JsonHighlight from './json-highlight' import JsonHighlight from './json-highlight'
import ButtonLink from '@/components/button-link' import ButtonLink from '@/components/button-link'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { TableColumns } from './types' import type { TableColumns } from './types'
export function useColumns(onCallback: Function) { export function useColumns(onCallback: Function) {
const { t } = useI18n() const { t } = useI18n()
const getColumns = (): TableColumns => { const getColumns = (): { columns: TableColumns; tableWidth: number } => {
return [ const columns = [
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (rowData, rowIndex) => rowIndex + 1 render: (unused, rowIndex) => rowIndex + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('datasource.datasource_name'), title: t('datasource.datasource_name'),
key: 'name' key: 'name',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('datasource.datasource_user_name'), title: t('datasource.datasource_user_name'),
key: 'userName' key: 'userName',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('datasource.datasource_type'), title: t('datasource.datasource_type'),
key: 'type' key: 'type',
width: 180
}, },
{ {
title: t('datasource.datasource_parameter'), title: t('datasource.datasource_parameter'),
key: 'parameter', key: 'parameter',
width: 180,
render: (rowData) => { render: (rowData) => {
return h( return h(
NPopover, NPopover,
@ -71,20 +81,23 @@ export function useColumns(onCallback: Function) {
}, },
{ {
title: t('datasource.description'), title: t('datasource.description'),
key: 'note' key: 'note',
...COLUMN_WIDTH_CONFIG['note']
}, },
{ {
title: t('datasource.create_time'), title: t('datasource.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('datasource.update_time'), title: t('datasource.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('datasource.operation'), title: t('datasource.operation'),
key: 'operation', key: 'operation',
width: 150, ...COLUMN_WIDTH_CONFIG['operation'](2),
render: (rowData) => { render: (rowData) => {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -139,7 +152,12 @@ export function useColumns(onCallback: Function) {
}) })
} }
} }
] ] as TableColumns
return {
columns,
tableWidth: calculateTableWidth(columns) || DefaultTableWidth
}
} }
return { return {

1
dolphinscheduler-ui-next/src/views/projects/list/index.tsx

@ -126,6 +126,7 @@ const list = defineComponent({
<NDataTable <NDataTable
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth}
row-class-name='items' row-class-name='items'
/> />
<div class={styles.pagination}> <div class={styles.pagination}>

53
dolphinscheduler-ui-next/src/views/projects/list/use-table.ts

@ -32,6 +32,11 @@ import {
NSpace, NSpace,
NTooltip NTooltip
} from 'naive-ui' } from 'naive-ui'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
import type { ProjectRes } from '@/service/modules/projects/types' import type { ProjectRes } from '@/service/modules/projects/types'
import { DeleteOutlined, EditOutlined } from '@vicons/antd' import { DeleteOutlined, EditOutlined } from '@vicons/antd'
@ -64,12 +69,14 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (unused: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('project.list.project_name'), title: t('project.list.project_name'),
key: 'name', key: 'name',
className: 'project-name', className: 'project-name',
...COLUMN_WIDTH_CONFIG['name'],
render: (row: { code: string; name: any }) => render: (row: { code: string; name: any }) =>
h( h(
NEllipsis, NEllipsis,
@ -89,18 +96,46 @@ export function useTable() {
} }
) )
}, },
{ title: t('project.list.owned_users'), key: 'userName' }, {
{ title: t('project.list.workflow_define_count'), key: 'defCount' }, title: t('project.list.owned_users'),
key: 'userName',
...COLUMN_WIDTH_CONFIG['userName']
},
{
title: t('project.list.workflow_define_count'),
key: 'defCount',
width: 120,
ellipsis: {
tooltip: true
}
},
{ {
title: t('project.list.process_instance_running_count'), title: t('project.list.process_instance_running_count'),
key: 'instRunningCount' key: 'instRunningCount',
width: 120,
ellipsis: {
tooltip: true
}
},
{
title: t('project.list.description'),
key: 'description',
...COLUMN_WIDTH_CONFIG['note']
},
{
title: t('project.list.create_time'),
key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
},
{
title: t('project.list.update_time'),
key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ title: t('project.list.description'), key: 'description' },
{ title: t('project.list.create_time'), key: 'createTime' },
{ title: t('project.list.update_time'), key: 'updateTime' },
{ {
title: t('project.list.operation'), title: t('project.list.operation'),
key: 'actions', key: 'actions',
...COLUMN_WIDTH_CONFIG['operation'](2),
render(row: any) { render(row: any) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -168,10 +203,14 @@ export function useTable() {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
tableData: [], tableData: [],
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),

6
dolphinscheduler-ui-next/src/views/projects/task/definition/index.tsx

@ -162,7 +162,11 @@ const TaskDefinition = defineComponent({
</div> </div>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable columns={this.columns} data={this.tableData} /> <NDataTable
columns={this.columns}
data={this.tableData}
scrollX={this.tableWidth}
/>
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}

45
dolphinscheduler-ui-next/src/views/projects/task/definition/use-table.ts

@ -31,6 +31,11 @@ import {
deleteTaskDefinition deleteTaskDefinition
} from '@/service/modules/task-definition' } from '@/service/modules/task-definition'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { import type {
TaskDefinitionItem, TaskDefinitionItem,
TaskDefinitionRes TaskDefinitionRes
@ -47,7 +52,8 @@ export function useTable(onEdit: Function) {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('project.task.task_name'), title: t('project.task.task_name'),
@ -59,40 +65,41 @@ export function useTable(onEdit: Function) {
onClick: () => void onEdit(row, true) onClick: () => void onEdit(row, true)
}, },
{ default: () => row.taskName } { default: () => row.taskName }
) ),
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.task.workflow_name'), title: t('project.task.workflow_name'),
key: 'processDefinitionName' key: 'processDefinitionName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.task.workflow_state'), title: t('project.task.workflow_state'),
key: 'processReleaseState', key: 'processReleaseState',
render: (row: any) => { render: (row: any) => {
if (row.processReleaseState === 'OFFLINE') { if (row.processReleaseState === 'OFFLINE') {
return h( return h(NTag, { type: 'error', size: 'small' }, () =>
NTag,
{ type: 'error', size: 'small' },
t('project.task.offline') t('project.task.offline')
) )
} else if (row.processReleaseState === 'ONLINE') { } else if (row.processReleaseState === 'ONLINE') {
return h( return h(NTag, { type: 'info', size: 'small' }, () =>
NTag,
{ type: 'info', size: 'small' },
t('project.task.online') t('project.task.online')
) )
} }
} },
...COLUMN_WIDTH_CONFIG['state']
}, },
{ {
title: t('project.task.task_type'), title: t('project.task.task_type'),
key: 'taskType' key: 'taskType',
...COLUMN_WIDTH_CONFIG['type']
}, },
{ {
title: t('project.task.version'), title: t('project.task.version'),
key: 'taskVersion', key: 'taskVersion',
render: (row: TaskDefinitionItem) => render: (row: TaskDefinitionItem) =>
h('span', null, 'v' + row.taskVersion) h('span', null, 'v' + row.taskVersion),
...COLUMN_WIDTH_CONFIG['version']
}, },
{ {
title: t('project.task.upstream_tasks'), title: t('project.task.upstream_tasks'),
@ -113,19 +120,23 @@ export function useTable(onEdit: Function) {
) )
}) })
}) })
) ),
width: 140
}, },
{ {
title: t('project.task.create_time'), title: t('project.task.create_time'),
key: 'taskCreateTime' key: 'taskCreateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('project.task.update_time'), title: t('project.task.update_time'),
key: 'taskUpdateTime' key: 'taskUpdateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('project.task.operation'), title: t('project.task.operation'),
key: 'operation', key: 'operation',
...COLUMN_WIDTH_CONFIG['operation'](4),
render(row: any) { render(row: any) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -251,10 +262,14 @@ export function useTable(onEdit: Function) {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
tableData: [], tableData: [],
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),

2
dolphinscheduler-ui-next/src/views/projects/task/instance/index.tsx

@ -185,7 +185,7 @@ const TaskInstance = defineComponent({
<NDataTable <NDataTable
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={1800} scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

37
dolphinscheduler-ui-next/src/views/projects/task/instance/use-table.ts

@ -33,6 +33,11 @@ import {
import { format } from 'date-fns' import { format } from 'date-fns'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { parseTime, tasksState } from '@/utils/common' import { parseTime, tasksState } from '@/utils/common'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { Router, TaskInstancesRes, IRecord, ITaskState } from './types' import type { Router, TaskInstancesRes, IRecord, ITaskState } from './types'
export function useTable() { export function useTable() {
@ -44,6 +49,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
tableData: [] as IRecord[], tableData: [] as IRecord[],
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
@ -64,15 +70,18 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('project.task.task_name'), title: t('project.task.task_name'),
key: 'name' key: 'name',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.task.workflow_instance'), title: t('project.task.workflow_instance'),
key: 'processInstanceName', key: 'processInstanceName',
...COLUMN_WIDTH_CONFIG['name'],
render: (row: { render: (row: {
processInstanceId: number processInstanceId: number
processInstanceName: string processInstanceName: string
@ -92,52 +101,61 @@ export function useTable() {
}, },
{ {
title: t('project.task.executor'), title: t('project.task.executor'),
key: 'executorName' key: 'executorName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.task.node_type'), title: t('project.task.node_type'),
key: 'taskType' key: 'taskType',
...COLUMN_WIDTH_CONFIG['type']
}, },
{ {
title: t('project.task.state'), title: t('project.task.state'),
key: 'state', key: 'state',
...COLUMN_WIDTH_CONFIG['state'],
render: (row: IRecord) => renderStateCell(row.state, t) render: (row: IRecord) => renderStateCell(row.state, t)
}, },
{ {
title: t('project.task.submit_time'), title: t('project.task.submit_time'),
...COLUMN_WIDTH_CONFIG['time'],
key: 'submitTime' key: 'submitTime'
}, },
{ {
title: t('project.task.start_time'), title: t('project.task.start_time'),
...COLUMN_WIDTH_CONFIG['time'],
key: 'startTime' key: 'startTime'
}, },
{ {
title: t('project.task.end_time'), title: t('project.task.end_time'),
...COLUMN_WIDTH_CONFIG['time'],
key: 'endTime' key: 'endTime'
}, },
{ {
title: t('project.task.duration'), title: t('project.task.duration'),
key: 'duration', key: 'duration',
...COLUMN_WIDTH_CONFIG['duration'],
render: (row: any) => h('span', null, row.duration ? row.duration : '-') render: (row: any) => h('span', null, row.duration ? row.duration : '-')
}, },
{ {
title: t('project.task.retry_count'), title: t('project.task.retry_count'),
key: 'retryTimes' key: 'retryTimes',
...COLUMN_WIDTH_CONFIG['times']
}, },
{ {
title: t('project.task.dry_run_flag'), title: t('project.task.dry_run_flag'),
key: 'dryRun', key: 'dryRun',
...COLUMN_WIDTH_CONFIG['dryRun'],
render: (row: IRecord) => (row.dryRun === 1 ? 'YES' : 'NO') render: (row: IRecord) => (row.dryRun === 1 ? 'YES' : 'NO')
}, },
{ {
title: t('project.task.host'), title: t('project.task.host'),
key: 'host' key: 'host',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.task.operation'), title: t('project.task.operation'),
key: 'operation', key: 'operation',
width: 150, ...COLUMN_WIDTH_CONFIG['operation'](3),
fixed: 'right',
render(row: any) { render(row: any) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -220,6 +238,9 @@ export function useTable() {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const handleLog = (row: any) => { const handleLog = (row: any) => {

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

@ -154,10 +154,10 @@ export default defineComponent({
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
striped striped
size={'small'}
class={styles.table} class={styles.table}
v-model:checked-row-keys={this.checkedRowKeys} v-model:checked-row-keys={this.checkedRowKeys}
row-class-name='items' row-class-name='items'
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

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

@ -92,6 +92,7 @@ export default defineComponent({
striped striped
size={'small'} size={'small'}
class={styles.table} class={styles.table}
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

32
dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/use-table.ts

@ -31,11 +31,16 @@ import {
DeleteOutlined, DeleteOutlined,
EditOutlined EditOutlined
} from '@vicons/antd' } from '@vicons/antd'
import type { Router } from 'vue-router' import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import { format } from 'date-fns-tz' import { format } from 'date-fns-tz'
import { ISearchParam } from './types' import { ISearchParam } from './types'
import { useTimezoneStore } from '@/store/timezone/timezone' import { useTimezoneStore } from '@/store/timezone/timezone'
import styles from '../index.module.scss' import styles from '../index.module.scss'
import type { Router } from 'vue-router'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -45,6 +50,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
row: {}, row: {},
tableData: [], tableData: [],
projectCode: ref(Number(router.currentRoute.value.params.projectCode)), projectCode: ref(Number(router.currentRoute.value.params.projectCode)),
@ -70,13 +76,13 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, ...COLUMN_WIDTH_CONFIG['index'],
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1
}, },
{ {
title: t('project.workflow.workflow_name'), title: t('project.workflow.workflow_name'),
key: 'processDefinitionName', key: 'processDefinitionName',
width: 200, ...COLUMN_WIDTH_CONFIG['name'],
render: (row: any) => render: (row: any) =>
h( h(
NEllipsis, NEllipsis,
@ -89,24 +95,29 @@ export function useTable() {
{ {
title: t('project.workflow.start_time'), title: t('project.workflow.start_time'),
key: 'startTime', key: 'startTime',
...COLUMN_WIDTH_CONFIG['time'],
render: (row: any) => renderTime(row.startTime) render: (row: any) => renderTime(row.startTime)
}, },
{ {
title: t('project.workflow.end_time'), title: t('project.workflow.end_time'),
key: 'endTime', key: 'endTime',
...COLUMN_WIDTH_CONFIG['time'],
render: (row: any) => renderTime(row.endTime) render: (row: any) => renderTime(row.endTime)
}, },
{ {
title: t('project.workflow.crontab'), title: t('project.workflow.crontab'),
key: 'crontab' key: 'crontab',
width: 140
}, },
{ {
title: t('project.workflow.failure_strategy'), title: t('project.workflow.failure_strategy'),
key: 'failureStrategy' key: 'failureStrategy',
width: 140
}, },
{ {
title: t('project.workflow.status'), title: t('project.workflow.status'),
key: 'releaseState', key: 'releaseState',
...COLUMN_WIDTH_CONFIG['state'],
render: (row: any) => render: (row: any) =>
row.releaseState === 'ONLINE' row.releaseState === 'ONLINE'
? t('project.workflow.up_line') ? t('project.workflow.up_line')
@ -114,16 +125,18 @@ export function useTable() {
}, },
{ {
title: t('project.workflow.create_time'), title: t('project.workflow.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('project.workflow.update_time'), title: t('project.workflow.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('project.workflow.operation'), title: t('project.workflow.operation'),
key: 'operation', key: 'operation',
fixed: 'right', ...COLUMN_WIDTH_CONFIG['operation'](3),
className: styles.operation, className: styles.operation,
render: (row: any) => { render: (row: any) => {
return h(NSpace, null, { return h(NSpace, null, {
@ -218,6 +231,9 @@ export function useTable() {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const handleEdit = (row: any) => { const handleEdit = (row: any) => {

36
dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts

@ -31,10 +31,15 @@ import {
release release
} from '@/service/modules/process-definition' } from '@/service/modules/process-definition'
import TableAction from './components/table-action' import TableAction from './components/table-action'
import { IDefinitionParam } from './types'
import styles from './index.module.scss' import styles from './index.module.scss'
import { NEllipsis, NTag } from 'naive-ui' import { NEllipsis, NTag } from 'naive-ui'
import ButtonLink from '@/components/button-link' import ButtonLink from '@/components/button-link'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { IDefinitionParam } from './types'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -42,6 +47,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
checkedRowKeys: [] as Array<RowKey>, checkedRowKeys: [] as Array<RowKey>,
row: {}, row: {},
tableData: [], tableData: [],
@ -62,19 +68,20 @@ export function useTable() {
{ {
type: 'selection', type: 'selection',
disabled: (row) => row.releaseState === 'ONLINE', disabled: (row) => row.releaseState === 'ONLINE',
className: 'btn-selected' className: 'btn-selected',
...COLUMN_WIDTH_CONFIG['selection']
}, },
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, ...COLUMN_WIDTH_CONFIG['index'],
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,
className: 'workflow-name', className: 'workflow-name',
...COLUMN_WIDTH_CONFIG['name'],
render: (row) => render: (row) =>
h( h(
NEllipsis, NEllipsis,
@ -99,6 +106,7 @@ export function useTable() {
{ {
title: t('project.workflow.status'), title: t('project.workflow.status'),
key: 'releaseState', key: 'releaseState',
...COLUMN_WIDTH_CONFIG['state'],
render: (row) => render: (row) =>
row.releaseState === 'ONLINE' row.releaseState === 'ONLINE'
? t('project.workflow.up_line') ? t('project.workflow.up_line')
@ -107,28 +115,32 @@ export function useTable() {
{ {
title: t('project.workflow.create_time'), title: t('project.workflow.create_time'),
key: 'createTime', key: 'createTime',
width: 150 ...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('project.workflow.update_time'), title: t('project.workflow.update_time'),
key: 'updateTime', key: 'updateTime',
width: 150 ...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('project.workflow.description'), title: t('project.workflow.description'),
key: 'description' key: 'description',
...COLUMN_WIDTH_CONFIG['note']
}, },
{ {
title: t('project.workflow.create_user'), title: t('project.workflow.create_user'),
key: 'userName' key: 'userName',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('project.workflow.modify_user'), title: t('project.workflow.modify_user'),
key: 'modifyBy' key: 'modifyBy',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('project.workflow.schedule_publish_status'), title: t('project.workflow.schedule_publish_status'),
key: 'scheduleReleaseState', key: 'scheduleReleaseState',
...COLUMN_WIDTH_CONFIG['state'],
render: (row) => { render: (row) => {
if (row.scheduleReleaseState === 'ONLINE') { if (row.scheduleReleaseState === 'ONLINE') {
return h( return h(
@ -154,8 +166,7 @@ export function useTable() {
{ {
title: t('project.workflow.operation'), title: t('project.workflow.operation'),
key: 'operation', key: 'operation',
width: 360, ...COLUMN_WIDTH_CONFIG['operation'](8.5),
fixed: 'right',
className: styles.operation, className: styles.operation,
render: (row) => render: (row) =>
h(TableAction, { h(TableAction, {
@ -173,6 +184,9 @@ export function useTable() {
}) })
} }
] as TableColumns<any> ] as TableColumns<any>
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const editWorkflow = (row: any) => { const editWorkflow = (row: any) => {

2
dolphinscheduler-ui-next/src/views/projects/workflow/instance/index.tsx

@ -105,7 +105,7 @@ export default defineComponent({
striped striped
size={'small'} size={'small'}
class={styles.table} class={styles.table}
scrollX={1800} scrollX={this.tableWidth}
v-model:checked-row-keys={this.checkedRowKeys} v-model:checked-row-keys={this.checkedRowKeys}
row-class-name='items-workflow-instances' row-class-name='items-workflow-instances'
/> />

36
dolphinscheduler-ui-next/src/views/projects/workflow/instance/use-table.ts

@ -33,6 +33,11 @@ import { runningType } from '@/utils/common'
import { parseTime } from '@/utils/common' import { parseTime } from '@/utils/common'
import styles from './index.module.scss' import styles from './index.module.scss'
import { renderStateCell } from '../../task/instance/use-table' import { renderStateCell } from '../../task/instance/use-table'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { Router } from 'vue-router' import type { Router } from 'vue-router'
import type { IWorkflowInstance } from '@/service/modules/process-instances/types' import type { IWorkflowInstance } from '@/service/modules/process-instances/types'
import type { ICountDownParam } from './types' import type { ICountDownParam } from './types'
@ -44,6 +49,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
checkedRowKeys: [] as Array<RowKey>, checkedRowKeys: [] as Array<RowKey>,
tableData: [] as Array<IWorkflowInstance>, tableData: [] as Array<IWorkflowInstance>,
page: ref(1), page: ref(1),
@ -62,18 +68,19 @@ export function useTable() {
variables.columns = [ variables.columns = [
{ {
type: 'selection', type: 'selection',
className: 'btn-selected' className: 'btn-selected',
...COLUMN_WIDTH_CONFIG['selection']
}, },
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, ...COLUMN_WIDTH_CONFIG['index'],
render: (rowData: any, rowIndex: number) => rowIndex + 1 render: (rowData: any, rowIndex: number) => rowIndex + 1
}, },
{ {
title: t('project.workflow.workflow_name'), title: t('project.workflow.workflow_name'),
key: 'name', key: 'name',
width: 200, ...COLUMN_WIDTH_CONFIG['name'],
className: 'workflow-name', className: 'workflow-name',
render: (row: IWorkflowInstance) => render: (row: IWorkflowInstance) =>
h( h(
@ -92,12 +99,14 @@ export function useTable() {
{ {
title: t('project.workflow.status'), title: t('project.workflow.status'),
key: 'state', key: 'state',
...COLUMN_WIDTH_CONFIG['state'],
className: 'workflow-status', className: 'workflow-status',
render: (_row: IWorkflowInstance) => renderStateCell(_row.state, t) render: (_row: IWorkflowInstance) => renderStateCell(_row.state, t)
}, },
{ {
title: t('project.workflow.run_type'), title: t('project.workflow.run_type'),
key: 'commandType', key: 'commandType',
width: 160,
className: 'workflow-run-type', className: 'workflow-run-type',
render: (_row: IWorkflowInstance) => render: (_row: IWorkflowInstance) =>
( (
@ -108,6 +117,7 @@ export function useTable() {
{ {
title: t('project.workflow.scheduling_time'), title: t('project.workflow.scheduling_time'),
key: 'scheduleTime', key: 'scheduleTime',
...COLUMN_WIDTH_CONFIG['time'],
render: (_row: IWorkflowInstance) => render: (_row: IWorkflowInstance) =>
_row.scheduleTime _row.scheduleTime
? format(parseTime(_row.scheduleTime), 'yyyy-MM-dd HH:mm:ss') ? format(parseTime(_row.scheduleTime), 'yyyy-MM-dd HH:mm:ss')
@ -116,6 +126,7 @@ export function useTable() {
{ {
title: t('project.workflow.start_time'), title: t('project.workflow.start_time'),
key: 'startTime', key: 'startTime',
...COLUMN_WIDTH_CONFIG['time'],
render: (_row: IWorkflowInstance) => render: (_row: IWorkflowInstance) =>
_row.startTime _row.startTime
? format(parseTime(_row.startTime), 'yyyy-MM-dd HH:mm:ss') ? format(parseTime(_row.startTime), 'yyyy-MM-dd HH:mm:ss')
@ -124,6 +135,7 @@ export function useTable() {
{ {
title: t('project.workflow.end_time'), title: t('project.workflow.end_time'),
key: 'endTime', key: 'endTime',
...COLUMN_WIDTH_CONFIG['time'],
render: (_row: IWorkflowInstance) => render: (_row: IWorkflowInstance) =>
_row.endTime _row.endTime
? format(parseTime(_row.endTime), 'yyyy-MM-dd HH:mm:ss') ? format(parseTime(_row.endTime), 'yyyy-MM-dd HH:mm:ss')
@ -132,35 +144,40 @@ export function useTable() {
{ {
title: t('project.workflow.duration'), title: t('project.workflow.duration'),
key: 'duration', key: 'duration',
...COLUMN_WIDTH_CONFIG['duration'],
render: (_row: IWorkflowInstance) => _row.duration || '-' render: (_row: IWorkflowInstance) => _row.duration || '-'
}, },
{ {
title: t('project.workflow.run_times'), title: t('project.workflow.run_times'),
key: 'runTimes', key: 'runTimes',
...COLUMN_WIDTH_CONFIG['times'],
className: 'workflow-run-times' className: 'workflow-run-times'
}, },
{ {
title: t('project.workflow.fault_tolerant_sign'), title: t('project.workflow.fault_tolerant_sign'),
key: 'recovery' key: 'recovery',
width: 100
}, },
{ {
title: t('project.workflow.dry_run_flag'), title: t('project.workflow.dry_run_flag'),
key: 'dryRun', key: 'dryRun',
...COLUMN_WIDTH_CONFIG['dryRun'],
render: (_row: IWorkflowInstance) => (_row.dryRun === 1 ? 'YES' : 'NO') render: (_row: IWorkflowInstance) => (_row.dryRun === 1 ? 'YES' : 'NO')
}, },
{ {
title: t('project.workflow.executor'), title: t('project.workflow.executor'),
key: 'executorName' key: 'executorName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.workflow.host'), title: t('project.workflow.host'),
key: 'host' key: 'host',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('project.workflow.operation'), title: t('project.workflow.operation'),
key: 'operation', key: 'operation',
width: 250, ...COLUMN_WIDTH_CONFIG['operation'](6),
fixed: 'right',
className: styles.operation, className: styles.operation,
render: (_row: IWorkflowInstance, index: number) => render: (_row: IWorkflowInstance, index: number) =>
h(TableAction, { h(TableAction, {
@ -213,6 +230,9 @@ export function useTable() {
}) })
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const getTableData = () => { const getTableData = () => {

8
dolphinscheduler-ui-next/src/views/resource/file/index.tsx

@ -196,7 +196,7 @@ export default defineComponent({
const newDir = dirs.slice(0, index + 1).join('/') const newDir = dirs.slice(0, index + 1).join('/')
if (newDir) { if (newDir) {
const id = 0 const id = 0
let resource = await queryResourceById( const resource = await queryResourceById(
{ {
id, id,
type: 'FILE', type: 'FILE',
@ -249,7 +249,10 @@ export default defineComponent({
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
const { columnsRef } = useTable(this.handleRenameFile, this.updateList) const { columnsRef, tableWidth } = useTable(
this.handleRenameFile,
this.updateList
)
const { const {
handleConditions, handleConditions,
handleCreateFolder, handleCreateFolder,
@ -322,6 +325,7 @@ export default defineComponent({
size={'small'} size={'small'}
class={styles['table-box']} class={styles['table-box']}
row-class-name='items' row-class-name='items'
scrollX={tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

43
dolphinscheduler-ui-next/src/views/resource/file/table/use-table.ts

@ -23,6 +23,11 @@ import { useFileStore } from '@/store/file/file'
import TableAction from './table-action' import TableAction from './table-action'
import { IRenameFile } from '../types' import { IRenameFile } from '../types'
import ButtonLink from '@/components/button-link' import ButtonLink from '@/components/button-link'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
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'
@ -46,13 +51,13 @@ export function useTable(renameResource: IRenameFile, updateList: () => void) {
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, ...COLUMN_WIDTH_CONFIG['index'],
render: (_row, index) => index + 1 render: (_row, index) => index + 1
}, },
{ {
title: t('resource.file.name'), title: t('resource.file.name'),
key: 'name', key: 'name',
width: 120, ...COLUMN_WIDTH_CONFIG['name'],
render: (row) => render: (row) =>
h( h(
ButtonLink, ButtonLink,
@ -62,37 +67,55 @@ export function useTable(renameResource: IRenameFile, updateList: () => void) {
{ default: () => row.name } { default: () => row.name }
) )
}, },
{ title: t('resource.file.user_name'), width: 100, key: 'user_name' }, {
title: t('resource.file.user_name'),
...COLUMN_WIDTH_CONFIG['userName'],
key: 'user_name'
},
{ {
title: t('resource.file.whether_directory'), title: t('resource.file.whether_directory'),
key: 'whether_directory', key: 'whether_directory',
width: 100, ...COLUMN_WIDTH_CONFIG['yesOrNo'],
render: (row) => render: (row) =>
row.directory ? t('resource.file.yes') : t('resource.file.no') row.directory ? t('resource.file.yes') : t('resource.file.no')
}, },
{ title: t('resource.file.file_name'), key: 'file_name' }, {
{ title: t('resource.file.description'), width: 150, key: 'description' }, title: t('resource.file.file_name'),
...COLUMN_WIDTH_CONFIG['name'],
key: 'file_name'
},
{
title: t('resource.file.description'),
...COLUMN_WIDTH_CONFIG['note'],
key: 'description'
},
{ {
title: t('resource.file.size'), title: t('resource.file.size'),
key: 'size', key: 'size',
...COLUMN_WIDTH_CONFIG['size'],
render: (row) => bytesToSize(row.size) render: (row) => bytesToSize(row.size)
}, },
{ title: t('resource.file.update_time'), width: 150, key: 'update_time' }, {
title: t('resource.file.update_time'),
...COLUMN_WIDTH_CONFIG['time'],
key: 'update_time'
},
{ {
title: t('resource.file.operation'), title: t('resource.file.operation'),
key: 'operation', key: 'operation',
width: 150,
render: (row) => render: (row) =>
h(TableAction, { h(TableAction, {
row, row,
onRenameResource: (id, name, description) => onRenameResource: (id, name, description) =>
renameResource(id, name, description), renameResource(id, name, description),
onUpdateList: () => updateList() onUpdateList: () => updateList()
}) }),
...COLUMN_WIDTH_CONFIG['operation'](4)
} }
] ]
return { return {
columnsRef columnsRef,
tableWidth: calculateTableWidth(columnsRef) || DefaultTableWidth
} }
} }

3
dolphinscheduler-ui-next/src/views/resource/task-group/option/index.tsx

@ -41,7 +41,7 @@ const taskGroupOption = defineComponent({
const searchParamRef = ref() const searchParamRef = ref()
let updateItemData = reactive({ const updateItemData = reactive({
id: 0, id: 0,
name: '', name: '',
projectCode: 0, projectCode: 0,
@ -180,6 +180,7 @@ const taskGroupOption = defineComponent({
size={'small'} size={'small'}
data={this.tableData} data={this.tableData}
striped striped
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

53
dolphinscheduler-ui-next/src/views/resource/task-group/option/use-table.ts

@ -18,12 +18,17 @@
import { h, reactive, ref } from 'vue' import { h, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { format } from 'date-fns' import { format } from 'date-fns'
import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
import { queryTaskGroupListPaging } from '@/service/modules/task-group' import { queryTaskGroupListPaging } from '@/service/modules/task-group'
import { queryAllProjectList } from '@/service/modules/projects' import { queryAllProjectList } from '@/service/modules/projects'
import TableAction from './components/table-action' import TableAction from './components/table-action'
import _ from 'lodash' import _ from 'lodash'
import { parseTime } from '@/utils/common' import { parseTime } from '@/utils/common'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
export function useTable( export function useTable(
updateItem = ( updateItem = (
@ -39,24 +44,51 @@ export function useTable(
const { t } = useI18n() const { t } = useI18n()
const columns: TableColumns<any> = [ const columns: TableColumns<any> = [
{ title: '#', key: 'index', render: (row, index) => index + 1 }, {
{ title: t('resource.task_group_option.name'), key: 'name' }, title: '#',
{ title: t('resource.task_group_option.project_name'), key: 'projectName' }, key: 'index',
render: (row, index) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
},
{
title: t('resource.task_group_option.name'),
key: 'name',
...COLUMN_WIDTH_CONFIG['name']
},
{
title: t('resource.task_group_option.project_name'),
key: 'projectName',
...COLUMN_WIDTH_CONFIG['name']
},
{ {
title: t('resource.task_group_option.resource_pool_size'), title: t('resource.task_group_option.resource_pool_size'),
key: 'groupSize' key: 'groupSize',
width: 160
}, },
{ {
title: t('resource.task_group_option.resource_used_pool_size'), title: t('resource.task_group_option.resource_used_pool_size'),
key: 'useSize' key: 'useSize',
width: 140
},
{
title: t('resource.task_group_option.desc'),
key: 'description',
...COLUMN_WIDTH_CONFIG['note']
},
{
title: t('resource.task_group_option.create_time'),
key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
},
{
title: t('resource.task_group_option.update_time'),
key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ title: t('resource.task_group_option.desc'), key: 'description' },
{ title: t('resource.task_group_option.create_time'), key: 'createTime' },
{ title: t('resource.task_group_option.update_time'), key: 'updateTime' },
{ {
title: t('resource.task_group_option.actions'), title: t('resource.task_group_option.actions'),
key: 'actions', key: 'actions',
width: 150, ...COLUMN_WIDTH_CONFIG['operation'](3),
render: (row: any) => render: (row: any) =>
h(TableAction, { h(TableAction, {
row, row,
@ -82,6 +114,7 @@ export function useTable(
const variables = reactive({ const variables = reactive({
tableData: [], tableData: [],
tableWidth: calculateTableWidth(columns) || DefaultTableWidth,
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
name: ref(null), name: ref(null),

1
dolphinscheduler-ui-next/src/views/resource/task-group/queue/index.tsx

@ -196,6 +196,7 @@ const taskGroupQueue = defineComponent({
size={'small'} size={'small'}
data={this.tableData} data={this.tableData}
striped striped
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

66
dolphinscheduler-ui-next/src/views/resource/task-group/queue/use-table.ts

@ -25,6 +25,11 @@ import {
} from '@/service/modules/task-group' } from '@/service/modules/task-group'
import TableAction from './components/table-action' import TableAction from './components/table-action'
import _ from 'lodash' import _ from 'lodash'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import { parseTime } from '@/utils/common' import { parseTime } from '@/utils/common'
export function useTable( export function useTable(
@ -34,30 +39,66 @@ export function useTable(
const { t } = useI18n() const { t } = useI18n()
const columns: TableColumns<any> = [ const columns: TableColumns<any> = [
{ title: '#', key: 'index', render: (row, index) => index + 1 }, {
{ title: t('resource.task_group_queue.project_name'), key: 'projectName' }, title: '#',
{ title: t('resource.task_group_queue.task_name'), key: 'taskName' }, key: 'index',
render: (row, index) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
},
{
title: t('resource.task_group_queue.project_name'),
key: 'projectName',
...COLUMN_WIDTH_CONFIG['name']
},
{
title: t('resource.task_group_queue.task_name'),
key: 'taskName',
...COLUMN_WIDTH_CONFIG['name']
},
{ {
title: t('resource.task_group_queue.process_instance_name'), title: t('resource.task_group_queue.process_instance_name'),
key: 'processInstanceName' key: 'processInstanceName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('resource.task_group_queue.task_group_name'), title: t('resource.task_group_queue.task_group_name'),
key: 'taskGroupName' key: 'taskGroupName',
...COLUMN_WIDTH_CONFIG['name']
},
{
title: t('resource.task_group_queue.priority'),
key: 'priority',
width: 120
}, },
{ title: t('resource.task_group_queue.priority'), key: 'priority' },
{ {
title: t('resource.task_group_queue.force_starting_status'), title: t('resource.task_group_queue.force_starting_status'),
key: 'forceStart' key: 'forceStart',
...COLUMN_WIDTH_CONFIG['state']
},
{
title: t('resource.task_group_queue.in_queue'),
key: 'inQueue',
width: 120
},
{
title: t('resource.task_group_queue.task_status'),
key: 'status',
...COLUMN_WIDTH_CONFIG['state']
},
{
title: t('resource.task_group_queue.create_time'),
key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
},
{
title: t('resource.task_group_queue.update_time'),
key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ title: t('resource.task_group_queue.in_queue'), key: 'inQueue' },
{ title: t('resource.task_group_queue.task_status'), key: 'status' },
{ title: t('resource.task_group_queue.create_time'), key: 'createTime' },
{ title: t('resource.task_group_queue.update_time'), key: 'updateTime' },
{ {
title: t('resource.task_group_queue.actions'), title: t('resource.task_group_queue.actions'),
key: 'actions', key: 'actions',
width: 150, ...COLUMN_WIDTH_CONFIG['operation'](2),
render: (row: any) => render: (row: any) =>
h(TableAction, { h(TableAction, {
row, row,
@ -76,6 +117,7 @@ export function useTable(
const variables = reactive({ const variables = reactive({
tableData: [], tableData: [],
tableWidth: calculateTableWidth(columns) || DefaultTableWidth,
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
groupId: ref(3), groupId: ref(3),

1
dolphinscheduler-ui-next/src/views/resource/udf/function/index.tsx

@ -129,6 +129,7 @@ export default defineComponent({
size={'small'} size={'small'}
class={styles.table} class={styles.table}
row-class-name='items' row-class-name='items'
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

34
dolphinscheduler-ui-next/src/views/resource/udf/function/use-table.ts

@ -27,7 +27,12 @@ import {
queryUdfFuncListPaging, queryUdfFuncListPaging,
deleteUdfFunc deleteUdfFunc
} from '@/service/modules/resources' } from '@/service/modules/resources'
import { IUdfFunctionParam } from './types' import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { IUdfFunctionParam } from './types'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -35,6 +40,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
row: {}, row: {},
tableData: [], tableData: [],
id: ref(Number(router.currentRoute.value.params.id) || -1), id: ref(Number(router.currentRoute.value.params.id) || -1),
@ -50,36 +56,43 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, render: (_row, index) => index + 1,
render: (_row, index) => index + 1 ...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('resource.function.udf_function_name'), title: t('resource.function.udf_function_name'),
key: 'funcName' key: 'funcName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('resource.function.class_name'), title: t('resource.function.class_name'),
key: 'className' key: 'className',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('resource.function.type'), title: t('resource.function.type'),
key: 'type' key: 'type',
...COLUMN_WIDTH_CONFIG['type']
}, },
{ {
title: t('resource.function.description'), title: t('resource.function.description'),
key: 'description' key: 'description',
...COLUMN_WIDTH_CONFIG['note']
}, },
{ {
title: t('resource.function.jar_package'), title: t('resource.function.jar_package'),
key: 'resourceName' key: 'resourceName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('resource.function.update_time'), title: t('resource.function.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('resource.function.operation'), title: t('resource.function.operation'),
key: 'operation', key: 'operation',
...COLUMN_WIDTH_CONFIG['operation'](2),
render: (row) => { render: (row) => {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -143,6 +156,9 @@ export function useTable() {
} }
} }
] as TableColumns<any> ] as TableColumns<any>
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const getTableData = (params: IUdfFunctionParam) => { const getTableData = (params: IUdfFunctionParam) => {

1
dolphinscheduler-ui-next/src/views/resource/udf/resource/index.tsx

@ -161,6 +161,7 @@ export default defineComponent({
size={'small'} size={'small'}
class={styles.table} class={styles.table}
row-class-name='items' row-class-name='items'
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

27
dolphinscheduler-ui-next/src/views/resource/udf/resource/use-table.ts

@ -32,7 +32,12 @@ import {
queryResourceById queryResourceById
} from '@/service/modules/resources' } from '@/service/modules/resources'
import ButtonLink from '@/components/button-link' import ButtonLink from '@/components/button-link'
import { IUdfResourceParam } from './types' import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { IUdfResourceParam } from './types'
const goSubFolder = (router: Router, item: any) => { const goSubFolder = (router: Router, item: any) => {
const fileStore = useFileStore() const fileStore = useFileStore()
@ -51,6 +56,7 @@ export function useTable() {
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
row: {}, row: {},
tableData: [], tableData: [],
breadList: [], breadList: [],
@ -68,12 +74,13 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'id', key: 'id',
width: 50, ...COLUMN_WIDTH_CONFIG['index'],
render: (_row, index) => index + 1 render: (_row, index) => index + 1
}, },
{ {
title: t('resource.udf.udf_source_name'), title: t('resource.udf.udf_source_name'),
key: 'alias', key: 'alias',
width: 60,
render: (row) => { render: (row) => {
return !row.directory return !row.directory
? row.alias ? row.alias
@ -89,33 +96,40 @@ export function useTable() {
{ {
title: t('resource.udf.whether_directory'), title: t('resource.udf.whether_directory'),
key: 'whether_directory', key: 'whether_directory',
...COLUMN_WIDTH_CONFIG['yesOrNo'],
render: (row) => render: (row) =>
row.directory ? t('resource.file.yes') : t('resource.file.no') row.directory ? t('resource.file.yes') : t('resource.file.no')
}, },
{ {
title: t('resource.udf.file_name'), title: t('resource.udf.file_name'),
...COLUMN_WIDTH_CONFIG['name'],
key: 'fileName' key: 'fileName'
}, },
{ {
title: t('resource.udf.file_size'), title: t('resource.udf.file_size'),
key: 'size', key: 'size',
...COLUMN_WIDTH_CONFIG['size'],
render: (row) => bytesToSize(row.size) render: (row) => bytesToSize(row.size)
}, },
{ {
title: t('resource.udf.description'), title: t('resource.udf.description'),
key: 'description' key: 'description',
...COLUMN_WIDTH_CONFIG['note']
}, },
{ {
title: t('resource.udf.create_time'), title: t('resource.udf.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('resource.udf.update_time'), title: t('resource.udf.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('resource.udf.operation'), title: t('resource.udf.operation'),
key: 'operation', key: 'operation',
...COLUMN_WIDTH_CONFIG['operation'](3),
render: (row) => { render: (row) => {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -204,6 +218,9 @@ export function useTable() {
} }
} }
] as TableColumns<any> ] as TableColumns<any>
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const getTableData = (params: IUdfResourceParam) => { const getTableData = (params: IUdfResourceParam) => {

1
dolphinscheduler-ui-next/src/views/security/environment-manage/index.tsx

@ -138,6 +138,7 @@ const environmentManage = defineComponent({
row-class-name='items' row-class-name='items'
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

29
dolphinscheduler-ui-next/src/views/security/environment-manage/use-table.ts

@ -30,6 +30,11 @@ import type {
EnvironmentItem EnvironmentItem
} from '@/service/modules/environment/types' } from '@/service/modules/environment/types'
import { parseTime } from '@/utils/common' import { parseTime } from '@/utils/common'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -45,24 +50,29 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('security.environment.environment_name'), title: t('security.environment.environment_name'),
key: 'name', key: 'name',
className: 'environment-name' className: 'environment-name',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('security.environment.environment_config'), title: t('security.environment.environment_config'),
key: 'config' key: 'config',
...COLUMN_WIDTH_CONFIG['note']
}, },
{ {
title: t('security.environment.environment_desc'), title: t('security.environment.environment_desc'),
key: 'description' key: 'description',
...COLUMN_WIDTH_CONFIG['note']
}, },
{ {
title: t('security.environment.worker_groups'), title: t('security.environment.worker_groups'),
key: 'workerGroups', key: 'workerGroups',
...COLUMN_WIDTH_CONFIG['tag'],
render: (row: EnvironmentItem) => render: (row: EnvironmentItem) =>
h(NSpace, null, { h(NSpace, null, {
default: () => default: () =>
@ -77,15 +87,18 @@ export function useTable() {
}, },
{ {
title: t('security.environment.create_time'), title: t('security.environment.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.environment.update_time'), title: t('security.environment.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.environment.operation'), title: t('security.environment.operation'),
key: 'operation', key: 'operation',
...COLUMN_WIDTH_CONFIG['operation'](2),
render(row: any) { render(row: any) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -153,10 +166,14 @@ export function useTable() {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
tableData: [], tableData: [],
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),

6
dolphinscheduler-ui-next/src/views/security/k8s-namespace-manage/index.tsx

@ -130,7 +130,11 @@ const k8sNamespaceManage = defineComponent({
</div> </div>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable columns={this.columns} data={this.tableData} /> <NDataTable
columns={this.columns}
data={this.tableData}
scrollX={this.tableWidth}
/>
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}

37
dolphinscheduler-ui-next/src/views/security/k8s-namespace-manage/use-table.ts

@ -30,6 +30,11 @@ import type {
NamespaceItem NamespaceItem
} from '@/service/modules/k8s-namespace/types' } from '@/service/modules/k8s-namespace/types'
import { parseTime } from '@/utils/common' import { parseTime } from '@/utils/common'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -58,43 +63,53 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('security.k8s_namespace.k8s_namespace'), title: t('security.k8s_namespace.k8s_namespace'),
key: 'namespace' key: 'namespace',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('security.k8s_namespace.k8s_cluster'), title: t('security.k8s_namespace.k8s_cluster'),
key: 'k8s' key: 'k8s',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('security.k8s_namespace.owner'), title: t('security.k8s_namespace.owner'),
key: 'owner' key: 'owner',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('security.k8s_namespace.tag'), title: t('security.k8s_namespace.tag'),
key: 'tag' key: 'tag',
...COLUMN_WIDTH_CONFIG['tag']
}, },
{ {
title: t('security.k8s_namespace.limit_cpu'), title: t('security.k8s_namespace.limit_cpu'),
key: 'limitsCpu' key: 'limitsCpu',
width: 140
}, },
{ {
title: t('security.k8s_namespace.limit_memory'), title: t('security.k8s_namespace.limit_memory'),
key: 'limitsMemory' key: 'limitsMemory',
width: 140
}, },
{ {
title: t('security.k8s_namespace.create_time'), title: t('security.k8s_namespace.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.k8s_namespace.update_time'), title: t('security.k8s_namespace.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.k8s_namespace.operation'), title: t('security.k8s_namespace.operation'),
key: 'operation', key: 'operation',
...COLUMN_WIDTH_CONFIG['operation'](2),
render(row: NamespaceItem) { render(row: NamespaceItem) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -160,11 +175,15 @@ export function useTable() {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableData: [], tableData: [],
tableWidth: DefaultTableWidth,
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),
searchVal: ref(null), searchVal: ref(null),

1
dolphinscheduler-ui-next/src/views/security/tenant-manage/index.tsx

@ -127,6 +127,7 @@ const tenementManage = defineComponent({
columns={this.columns} columns={this.columns}
data={this.tableData} data={this.tableData}
row-class-name='items' row-class-name='items'
scrollX={this.tableWidth}
/> />
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination

29
dolphinscheduler-ui-next/src/views/security/tenant-manage/use-table.ts

@ -24,6 +24,11 @@ import { reactive, h, ref } from 'vue'
import { NButton, NIcon, NPopconfirm, NSpace, NTooltip } from 'naive-ui' import { NButton, NIcon, NPopconfirm, NSpace, NTooltip } from 'naive-ui'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { DeleteOutlined, EditOutlined } from '@vicons/antd' import { DeleteOutlined, EditOutlined } from '@vicons/antd'
import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
export function useTable() { export function useTable() {
const { t } = useI18n() const { t } = useI18n()
@ -52,35 +57,39 @@ export function useTable() {
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (row: any, index: number) => index + 1 render: (row: any, index: number) => index + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('security.tenant.tenant_code'), title: t('security.tenant.tenant_code'),
key: 'tenantCode', key: 'tenantCode',
className: 'tenant-code' className: 'tenant-code',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('security.tenant.description'), title: t('security.tenant.description'),
key: 'description', key: 'description',
ellipsis: { ...COLUMN_WIDTH_CONFIG['note']
tooltip: true
}
}, },
{ {
title: t('security.tenant.queue_name'), title: t('security.tenant.queue_name'),
key: 'queueName' key: 'queueName',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('security.tenant.create_time'), title: t('security.tenant.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.tenant.update_time'), title: t('security.tenant.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.tenant.actions'), title: t('security.tenant.actions'),
key: 'actions', key: 'actions',
...COLUMN_WIDTH_CONFIG['operation'](2),
render(row: any) { render(row: any) {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -148,10 +157,14 @@ export function useTable() {
} }
} }
] ]
if (variables.tableWidth) {
variables.tableWidth = calculateTableWidth(variables.columns)
}
} }
const variables = reactive({ const variables = reactive({
columns: [], columns: [],
tableWidth: DefaultTableWidth,
tableData: [], tableData: [],
page: ref(1), page: ref(1),
pageSize: ref(10), pageSize: ref(10),

3
dolphinscheduler-ui-next/src/views/security/user-manage/index.tsx

@ -90,9 +90,10 @@ const UsersManage = defineComponent({
<NSpace vertical> <NSpace vertical>
<NDataTable <NDataTable
row-class-name='items' row-class-name='items'
columns={this.columnsRef} columns={this.columnsRef.columns}
data={this.list} data={this.list}
loading={this.loading} loading={this.loading}
scrollX={this.columnsRef.tableWidth}
/> />
<NSpace justify='center'> <NSpace justify='center'>
<NPagination <NPagination

49
dolphinscheduler-ui-next/src/views/security/user-manage/use-columns.ts

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { h, ref, watch, onMounted, Ref } from 'vue' import { h, ref, watch, onMounted } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { import {
NSpace, NSpace,
@ -27,24 +27,34 @@ import {
NPopconfirm NPopconfirm
} from 'naive-ui' } from 'naive-ui'
import { EditOutlined, DeleteOutlined, UserOutlined } from '@vicons/antd' import { EditOutlined, DeleteOutlined, UserOutlined } from '@vicons/antd'
import { TableColumns, InternalRowData } from './types' import {
COLUMN_WIDTH_CONFIG,
calculateTableWidth,
DefaultTableWidth
} from '@/utils/column-width-config'
import type { TableColumns, InternalRowData } from './types'
export function useColumns(onCallback: Function) { export function useColumns(onCallback: Function) {
const { t } = useI18n() const { t } = useI18n()
const columnsRef = ref([]) as Ref<TableColumns> const columnsRef = ref({
columns: [] as TableColumns,
tableWidth: DefaultTableWidth
})
const createColumns = () => { const createColumns = () => {
columnsRef.value = [ const columns = [
{ {
title: '#', title: '#',
key: 'index', key: 'index',
render: (rowData: InternalRowData, rowIndex: number) => rowIndex + 1 render: (rowData: InternalRowData, rowIndex: number) => rowIndex + 1,
...COLUMN_WIDTH_CONFIG['index']
}, },
{ {
title: t('security.user.username'), title: t('security.user.username'),
key: 'userName', key: 'userName',
className: 'name' className: 'name',
...COLUMN_WIDTH_CONFIG['userName']
}, },
{ {
title: t('security.user.user_type'), title: t('security.user.user_type'),
@ -52,27 +62,33 @@ export function useColumns(onCallback: Function) {
render: (rowData: InternalRowData) => render: (rowData: InternalRowData) =>
rowData.userType === 'GENERAL_USER' rowData.userType === 'GENERAL_USER'
? t('security.user.ordinary_user') ? t('security.user.ordinary_user')
: t('security.user.administrator') : t('security.user.administrator'),
...COLUMN_WIDTH_CONFIG['type']
}, },
{ {
title: t('security.user.tenant_code'), title: t('security.user.tenant_code'),
key: 'tenantCode' key: 'tenantCode',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('security.user.queue'), title: t('security.user.queue'),
key: 'queue' key: 'queue',
width: 120
}, },
{ {
title: t('security.user.email'), title: t('security.user.email'),
key: 'email' key: 'email',
...COLUMN_WIDTH_CONFIG['name']
}, },
{ {
title: t('security.user.phone'), title: t('security.user.phone'),
key: 'phone' key: 'phone',
width: 140
}, },
{ {
title: t('security.user.state'), title: t('security.user.state'),
key: 'state', key: 'state',
...COLUMN_WIDTH_CONFIG['state'],
render: (rowData: any, unused: number) => render: (rowData: any, unused: number) =>
h( h(
NTag, NTag,
@ -89,15 +105,18 @@ export function useColumns(onCallback: Function) {
}, },
{ {
title: t('security.user.create_time'), title: t('security.user.create_time'),
key: 'createTime' key: 'createTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.user.update_time'), title: t('security.user.update_time'),
key: 'updateTime' key: 'updateTime',
...COLUMN_WIDTH_CONFIG['time']
}, },
{ {
title: t('security.user.operation'), title: t('security.user.operation'),
key: 'operation', key: 'operation',
...COLUMN_WIDTH_CONFIG['operation'](3),
render: (rowData: any, unused: number) => { render: (rowData: any, unused: number) => {
return h(NSpace, null, { return h(NSpace, null, {
default: () => [ default: () => [
@ -204,6 +223,10 @@ export function useColumns(onCallback: Function) {
} }
} }
] ]
columnsRef.value = {
columns,
tableWidth: calculateTableWidth(columns)
}
} }
onMounted(() => { onMounted(() => {

Loading…
Cancel
Save