Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { ActiontechTableColumn } from '@actiontech/shared/lib/components/Actiont
import { t } from '../../../../../locale';
import ResultIconRender from 'sqle/src/components/AuditResultMessage/ResultIconRender';
import AuditResultMessage from 'sqle/src/components/AuditResultMessage';
import {
IAuditSQLResult,
IListDataExportTaskSQL
} from '@actiontech/shared/lib/api/base/service/common';
import { IListDataExportTaskSQL } from '@actiontech/shared/lib/api/base/service/common';
import { SQLRenderer } from '@actiontech/shared';

export const AuditResultForCreateOrderColumn = (
Expand Down Expand Up @@ -36,13 +33,13 @@ export const AuditResultForCreateOrderColumn = (
{
dataIndex: 'export_sql_type',
title: () => t('dmsDataExport.common.auditResult.column.sqlType'),
render: (type: string) => type || '-'
render: (type) => type || '-'
},
{
dataIndex: 'audit_sql_result',
title: () => t('dmsDataExport.common.auditResult.column.auditResult'),
className: 'audit-result-column',
render: (result: IAuditSQLResult[], record) => {
render: (result = [], record) => {
return (
<div onClick={() => onClickAuditResult(record)}>
{result?.length > 1 ? (
Expand Down
14 changes: 6 additions & 8 deletions packages/base/src/page/DataExportManagement/List/column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ExportWorkflowListColumn: (
dataIndex: 'workflow_uid',
title: () => t('dmsDataExport.list.column.id'),
className: 'ellipsis-column-width',
render: (id: string) => {
render: (id) => {
return (
<TableColumnWithIconStyleWrapper>
<BriefcaseFilled width={14} height={14} />
Expand All @@ -67,7 +67,7 @@ export const ExportWorkflowListColumn: (
dataIndex: 'workflow_name',
title: () => t('dmsDataExport.list.column.name'),
className: 'ellipsis-column-width',
render: (name: string) => {
render: (name) => {
return name ? (
<BasicTypographyEllipsis copyable={false} textCont={name} />
) : (
Expand All @@ -79,7 +79,7 @@ export const ExportWorkflowListColumn: (
dataIndex: 'desc',
title: () => t('dmsDataExport.list.column.desc'),
className: 'ellipsis-column-width-large',
render: (desc: string, record: IListDataExportWorkflow) =>
render: (desc, record) =>
desc ? (
<BasicTypographyEllipsis
textCont={desc}
Expand All @@ -106,7 +106,7 @@ export const ExportWorkflowListColumn: (
{
dataIndex: 'creater',
title: () => t('dmsDataExport.list.column.createUser'),
render: (user: IListDataExportWorkflow['creater']) => {
render: (user) => {
return user?.name ?? '-';
},
filterCustomType: 'select',
Expand All @@ -115,7 +115,7 @@ export const ExportWorkflowListColumn: (
{
dataIndex: 'status',
title: () => t('dmsDataExport.list.column.status'),
render: (status: IListDataExportWorkflow['status']) => {
render: (status) => {
return <WorkflowStatus status={status} />;
}
},
Expand All @@ -124,9 +124,7 @@ export const ExportWorkflowListColumn: (
title: () => t('dmsDataExport.list.column.assignee'),
filterCustomType: 'select',
filterKey: 'filter_current_step_assignee_user_uid',
render: (
list: IListDataExportWorkflow['current_step_assignee_user_list']
) => {
render: (list) => {
if (!list || list.length === 0) {
return '-';
}
Expand Down
13 changes: 6 additions & 7 deletions packages/base/src/page/Member/List/column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { t } from '../../../locale';
import {
IListMember,
IListMemberRoleWithOpRange,
IUidWithName,
IListMemberGroup
} from '@actiontech/shared/lib/api/base/service/common';
import renderRolesInfo from '../Common/renderRolesInfo';
Expand Down Expand Up @@ -49,7 +48,7 @@ export const MemberListColumns: ActiontechTableColumn<IListMember> = [
dataIndex: 'user',
title: t('common.username'),
width: '25%',
render: (user: IUidWithName) => {
render: (user) => {
return user?.name ?? '-';
}
},
Expand All @@ -73,15 +72,15 @@ export const MemberListColumns: ActiontechTableColumn<IListMember> = [
</BasicToolTips>
);
},
render: (roles: IListMemberRoleWithOpRange[], record: IListMember) => {
render: (roles = [], record: IListMember) => {
return commonRoleOperateRangesRender(roles, record);
}
},
{
dataIndex: 'is_project_admin',
title: t('dmsMember.memberList.columns.isProjectAdmin'),
width: '20%',
render: (isAdmin: boolean) => {
render: (isAdmin) => {
if (typeof isAdmin !== 'boolean') {
return t('common.unknownStatus');
}
Expand Down Expand Up @@ -135,7 +134,7 @@ export const MemberGroupListColumns: ActiontechTableColumn<IListMemberGroup> = [
{
dataIndex: 'users',
title: t('dmsMember.memberGroupList.columns.users'),
render(users: IUidWithName[]) {
render(users) {
if (!Array.isArray(users)) {
return null;
}
Expand Down Expand Up @@ -165,14 +164,14 @@ export const MemberGroupListColumns: ActiontechTableColumn<IListMemberGroup> = [
</BasicToolTips>
);
},
render: (roles: IListMemberRoleWithOpRange[], record: IListMemberGroup) => {
render: (roles = [], record: IListMemberGroup) => {
return commonRoleOperateRangesRender(roles, record);
}
},
{
dataIndex: 'is_project_admin',
title: t('dmsMember.memberList.columns.isProjectAdmin'),
render: (isAdmin: boolean) => {
render: (isAdmin) => {
if (typeof isAdmin !== 'boolean') {
return t('common.unknownStatus');
}
Expand Down
6 changes: 3 additions & 3 deletions packages/base/src/page/Project/ImportProject/column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ export const importProjectListColumn: ActiontechTableColumn<IPreviewImportProjec
dataIndex: 'name',
className: 'ellipsis-column-small-width',
title: () => t('dmsProject.importProject.table.project'),
render: (value: string) => value || '-'
render: (value) => value || '-'
},
{
dataIndex: 'desc',
className: 'ellipsis-column-small-width',
title: () => t('dmsProject.importProject.table.desc'),
render: (desc: string) => {
render: (desc) => {
return desc ? <BasicTypographyEllipsis textCont={desc} /> : '-';
}
},
{
dataIndex: 'business',
className: 'ellipsis-column-width',
title: () => t('dmsProject.importProject.table.business'),
render: (business: IPreviewImportProjects['business']) => {
render: (business) => {
// 判断是否全为'' 因为后端会把文件中的空列解析为[''] 所以加此判断
if (!business || !business.length || business.every((i) => i === '')) {
return '-';
Expand Down
16 changes: 6 additions & 10 deletions packages/base/src/page/Project/List/columns.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { t } from '../../../locale';
import { formatTime } from '@actiontech/shared/lib/utils/Common';
import {
IListProject,
IUidWithName,
IBusiness
} from '@actiontech/shared/lib/api/base/service/common';
import { IListProject } from '@actiontech/shared/lib/api/base/service/common';
import { Link } from 'react-router-dom';
import {
ActiontechTableColumn,
Expand All @@ -23,7 +19,7 @@ export const ProjectListTableColumnFactory =
{
dataIndex: 'name',
title: () => t('dmsProject.projectForm.name'),
render(name: string, record) {
render(name, record) {
return (
<Link to={`/sqle/project/${record.uid}/overview`}>{name}</Link>
);
Expand All @@ -32,7 +28,7 @@ export const ProjectListTableColumnFactory =
{
dataIndex: 'business',
title: () => t('dmsProject.projectForm.business'),
render: (business: IBusiness[]) => {
render: (business) => {
if (!business || !business.length) {
return '-';
}
Expand Down Expand Up @@ -63,14 +59,14 @@ export const ProjectListTableColumnFactory =
ellipsis: true,
title: () => t('dmsProject.projectForm.desc'),
className: 'ellipsis-column-width',
render: (desc: string) => {
render: (desc) => {
return desc ? <BasicTypographyEllipsis textCont={desc} /> : '-';
}
},
{
dataIndex: 'archived',
title: () => t('dmsProject.projectList.columns.status'),
render(archived: boolean) {
render(archived) {
return (
<TableColumnWithIconStyleWrapper>
{archived ? (
Expand Down Expand Up @@ -100,7 +96,7 @@ export const ProjectListTableColumnFactory =
dataIndex: 'create_user',
ellipsis: true,
title: () => t('dmsProject.projectList.columns.createUser'),
render: (userInfo: IUidWithName) => {
render: (userInfo) => {
return userInfo?.name ?? '';
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { ActiontechTableColumn } from '@actiontech/shared/lib/components/ActiontechTable/index.type';
import {
IListOpPermission,
IUidWithName
} from '@actiontech/shared/lib/api/base/service/common';
import { IListOpPermission } from '@actiontech/shared/lib/api/base/service/common';
import { t } from '../../../../locale';
import { getOpRangeTypeName } from '../../../../hooks/useOpPermission/index.data';
import { ListMemberRoleWithOpRangeOpRangeTypeEnum } from '@actiontech/shared/lib/api/base/service/common.enum';
Expand All @@ -12,15 +9,17 @@ export const PermissionListColumns: () => ActiontechTableColumn<IListOpPermissio
{
dataIndex: 'op_permission',
title: () => t('dmsUserCenter.role.opPermissionList.columns.name'),
render: (opPermission: IUidWithName) => {
render: (opPermission) => {
return opPermission?.name ?? '';
}
},
{
dataIndex: 'range_type',
title: () => t('dmsUserCenter.role.opPermissionList.columns.range'),
render: (rangeType: ListMemberRoleWithOpRangeOpRangeTypeEnum) =>
getOpRangeTypeName(rangeType)
render: (rangeType) =>
getOpRangeTypeName(
rangeType as ListMemberRoleWithOpRangeOpRangeTypeEnum | undefined
)
},
{
dataIndex: 'description',
Expand Down
11 changes: 4 additions & 7 deletions packages/base/src/page/UserCenter/components/RoleList/column.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
IListRole,
IUidWithName
} from '@actiontech/shared/lib/api/base/service/common';
import { IListRole } from '@actiontech/shared/lib/api/base/service/common';
import {
ActiontechTableColumn,
ActiontechTableActionMeta
Expand All @@ -24,14 +21,14 @@ export const RoleListColumns: () => ActiontechTableColumn<IListRole> = () => [
dataIndex: 'desc',
title: () => t('dmsUserCenter.role.roleForm.desc'),
className: 'ellipsis-column-width',
render: (desc: string) => {
render: (desc) => {
return desc ? <BasicTypographyEllipsis textCont={desc} /> : '-';
}
},
{
dataIndex: 'stat',
title: () => t('common.status'),
render: (stat: ListRoleStatEnum) => {
render: (stat) => {
return (
<TableColumnWithIconStyleWrapper>
{stat === ListRoleStatEnum.被禁用 ? (
Expand All @@ -47,7 +44,7 @@ export const RoleListColumns: () => ActiontechTableColumn<IListRole> = () => [
{
dataIndex: 'op_permissions',
title: () => t('dmsUserCenter.role.roleForm.opPermissions'),
render: (list: IUidWithName[]) => {
render: (list) => {
if (!Array.isArray(list)) {
return '-';
}
Expand Down
13 changes: 5 additions & 8 deletions packages/base/src/page/UserCenter/components/UserList/column.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
IListUser,
IUidWithName
} from '@actiontech/shared/lib/api/base/service/common';
import { IListUser } from '@actiontech/shared/lib/api/base/service/common';
import {
ActiontechTableColumn,
ActiontechTableActionMeta
Expand All @@ -21,21 +18,21 @@ export const UserListColumns: () => ActiontechTableColumn<IListUser> = () => [
{
dataIndex: 'email',
title: () => t('dmsUserCenter.user.userForm.email'),
render: (text: string) => {
render: (text) => {
return text || '-';
}
},
{
dataIndex: 'phone',
title: () => t('dmsUserCenter.user.userForm.phone'),
render: (text: string) => {
render: (text) => {
return text || '-';
}
},
{
dataIndex: 'stat',
title: () => t('dmsUserCenter.user.userList.columns.status'),
render: (status: ListUserStatEnum) => {
render: (status) => {
return (
<TableColumnWithIconStyleWrapper>
{status === ListUserStatEnum.被禁用 ? (
Expand All @@ -55,7 +52,7 @@ export const UserListColumns: () => ActiontechTableColumn<IListUser> = () => [
{
dataIndex: 'op_permissions',
title: () => t('dmsUserCenter.user.userForm.opPermissions'),
render: (list: IUidWithName[]) => {
render: (list) => {
if (!Array.isArray(list)) {
return '-';
}
Expand Down
6 changes: 4 additions & 2 deletions packages/shared/lib/components/ActiontechTable/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import ToolBar from './components/Toolbar';
import FilterContainer from './components/FilterContainer';
import { useTranslation } from 'react-i18next';
import { ActiontechTableStyleWrapper, tableToken } from './style';
import useTableAction from './hooks/useTableAction';
import useTableAction, {
ACTIONTECH_TABLE_OPERATOR_COLUMN_DATA_INDEX
} from './hooks/useTableAction';
import classnames from 'classnames';
import { useEffect, useMemo } from 'react';
import useTableSettings from './hooks/useTableSettings';
Expand All @@ -31,7 +33,7 @@ const ActiontechTable = <
const { catchDefaultColumnsInfo, localColumns } = useTableSettings<
T,
F,
OtherColumnKeys
OtherColumnKeys | typeof ACTIONTECH_TABLE_OPERATOR_COLUMN_DATA_INDEX
>(tableName, username);

const mergerColumns = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ const useTableAction = () => {
const renderActionInTable = useCallback(
<T extends Record<string, any>>(
actions: ActiontechTableProps<T>['actions']
): ActiontechTableColumn<T>[0] | undefined => {
):
| ActiontechTableColumn<
T,
Record<string, any>,
typeof ACTIONTECH_TABLE_OPERATOR_COLUMN_DATA_INDEX
>[0]
| undefined => {
if (Array.isArray(actions)) {
if (actions.length === 0) {
return;
Expand Down
Loading