Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]:(SqlManagement) Restore endpoint to accept array type for data consistency #425

Merged
merged 1 commit into from
Sep 20, 2024
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
2 changes: 1 addition & 1 deletion packages/shared/lib/api/sqle/service/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2347,7 +2347,7 @@ export interface ISqlManage {

audit_status?: SqlManageAuditStatusEnum;

endpoints?: string;
endpoints?: string[];

first_appear_timestamp?: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1207,12 +1207,26 @@ exports[`page/SqlManagement/SQLEEIndex filter data with rule name 1`] = `
<td
class="ant-table-cell"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
<div
class="ant-space css-dev-only-do-not-override-bj9uhl ant-space-horizontal ant-space-align-center basic-tooltips-wrapper css-4jbtl9"
>
12
</span>
<div
class="ant-space-item"
style="margin-right: 8px;"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
>
12
</span>
</div>
<div
class="ant-space-item"
>
...
</div>
</div>
</td>
<td
class="ant-table-cell audit-status"
Expand Down Expand Up @@ -3325,12 +3339,26 @@ exports[`page/SqlManagement/SQLEEIndex render table data 1`] = `
<td
class="ant-table-cell"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
<div
class="ant-space css-dev-only-do-not-override-bj9uhl ant-space-horizontal ant-space-align-center basic-tooltips-wrapper css-4jbtl9"
>
12
</span>
<div
class="ant-space-item"
style="margin-right: 8px;"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
>
12
</span>
</div>
<div
class="ant-space-item"
>
...
</div>
</div>
</td>
<td
class="ant-table-cell audit-status"
Expand Down Expand Up @@ -6130,12 +6158,26 @@ exports[`page/SqlManagement/SQLEEIndex render table data when preferred language
<td
class="ant-table-cell"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
<div
class="ant-space css-dev-only-do-not-override-bj9uhl ant-space-horizontal ant-space-align-center basic-tooltips-wrapper css-4jbtl9"
>
12
</span>
<div
class="ant-space-item"
style="margin-right: 8px;"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
>
12
</span>
</div>
<div
class="ant-space-item"
>
...
</div>
</div>
</td>
<td
class="ant-table-cell audit-status"
Expand Down Expand Up @@ -8909,12 +8951,26 @@ exports[`page/SqlManagement/SQLEEIndex render table for not admin 1`] = `
<td
class="ant-table-cell"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
<div
class="ant-space css-dev-only-do-not-override-bj9uhl ant-space-horizontal ant-space-align-center basic-tooltips-wrapper css-4jbtl9"
>
12
</span>
<div
class="ant-space-item"
style="margin-right: 8px;"
>
<span
class="ant-tag ant-tag-default basic-tag-wrapper basic-default-tag-wrapper css-1mjwlcb css-dev-only-do-not-override-bj9uhl"
style="margin-right: 0px;"
>
12
</span>
</div>
<div
class="ant-space-item"
>
...
</div>
</div>
</td>
<td
class="ant-table-cell audit-status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { ISqlManage } from '@actiontech/shared/lib/api/sqle/service/common';
import ResultIconRender from '../../../../components/AuditResultMessage/ResultIconRender';
import { Link } from 'react-router-dom';
import { AvatarCom, EditText, SQLRenderer } from '@actiontech/shared';
import { tooltipsCommonProps } from '@actiontech/shared/lib/components/BasicToolTips';
import { Avatar } from 'antd';
import BasicToolTips, {
tooltipsCommonProps
} from '@actiontech/shared/lib/components/BasicToolTips';
import { Avatar, Space } from 'antd';
import StatusTag from './StatusTag';
import { BasicTag, BasicTypographyEllipsis } from '@actiontech/shared';
import { ACTIONTECH_TABLE_ACTION_BUTTON_WIDTH } from '@actiontech/shared/lib/components/ActiontechTable/hooks/useTableAction';
Expand Down Expand Up @@ -387,11 +389,26 @@ const SqlManagementColumn: (
title: () => t('sqlManagement.table.column.endpoints'),
width: 200,
render: (endpoints) => {
if (!endpoints) {
if (!Array.isArray(endpoints) || endpoints.length === 0) {
return '-';
}
// todo 暂时调整成 string
return <BasicTag style={{ marginRight: 0 }}>{endpoints}</BasicTag>;

return (
<BasicToolTips
title={
endpoints.length > 1 ? (
<Space wrap>
{endpoints.map((v) => (
<BasicTag key={v}>{v}</BasicTag>
))}
</Space>
) : null
}
>
<BasicTag style={{ marginRight: 0 }}>{endpoints[0]}</BasicTag>
{endpoints.length > 1 ? '...' : null}
</BasicToolTips>
);
}
},
{
Expand Down
8 changes: 4 additions & 4 deletions packages/sqle/src/testUtils/mockApi/sqlManage/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const sqlManageListData = {
assignees: ['test'],
status: 'unhandled',
remark: 'this is remark text',
endpoints: '12',
endpoints: ['12', '35', '32'],
priority: 'high'
},
{
Expand Down Expand Up @@ -120,7 +120,7 @@ export const sqlManageListData = {
assignees: null,
status: 'unhandled',
remark: '',
endpoints: '34'
endpoints: ['34']
},
{
id: 1150087,
Expand All @@ -146,7 +146,7 @@ export const sqlManageListData = {
assignees: ['t3', 't2'],
status: 'unhandled',
remark: '',
endpoints: '',
endpoints: [],
priority: ''
},
{
Expand All @@ -173,7 +173,7 @@ export const sqlManageListData = {
assignees: ['t3', 't2'],
status: 'unhandled',
remark: '',
endpoints: '',
endpoints: [],
priority: '',
audit_status: SqlManageAuditStatusEnum.being_audited
}
Expand Down
Loading