Skip to content

Commit

Permalink
[chore](SqlExecWorkflow): Hide export rollback SQL code
Browse files Browse the repository at this point in the history
  • Loading branch information
zzyangh committed Nov 28, 2024
1 parent 98f9ad3 commit 8511f7f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,139 +56,6 @@ exports[`sqle/ExecWorkflow/Common/DownloadRecord render snap download btn 1`] =
</body>
`;

exports[`sqle/ExecWorkflow/Common/DownloadRecord render snap when click down backup sql 1`] = `
<body>
<div>
<button
class="ant-btn css-dev-only-do-not-override-674gwq ant-btn-default ant-btn-sm basic-button-wrapper css-geipcv"
type="button"
>
<span
class="ant-btn-icon"
>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1.75 11.083h10.5v1.167H1.75zm5.833-3.4 3.542-3.541.825.824L7 9.916 2.05 4.968l.825-.825 3.542 3.54V1.167h1.166z"
/>
</svg>
</span>
<div
class="ant-space css-dev-only-do-not-override-674gwq ant-space-horizontal ant-space-align-center"
>
<div
class="ant-space-item"
style="margin-right: 5px;"
>
下载
</div>
<div
class="ant-space-item"
>
<span
class="css-u3jcp4"
>
<svg
color="currentColor"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="m8 8.781 3.3-3.3.943.943L8 10.667 3.757 6.424l.943-.943z"
fill="currentColor"
/>
</svg>
</span>
</div>
</div>
</button>
</div>
<div>
<div
class="ant-popover ant-popover-hidden css-dev-only-do-not-override-txh9fw css-dev-only-do-not-override-txh9fw ant-popover-placement-bottomLeft"
style="--arrow-x: 0px; --arrow-y: 0px; left: 0px; top: 0px; box-sizing: border-box; pointer-events: none;"
>
<div
class="ant-popover-content"
>
<div
class="ant-popover-inner"
role="tooltip"
style="padding: 0px;"
>
<div
class="ant-popover-inner-content"
>
<div
class="css-1oz57g3"
>
<div
class="download-record-item"
>
<svg
class="download-record-item-icon"
color="currentColor"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M14 6v7.995a.666.666 0 0 1-.662.672H2.662A.66.66 0 0 1 2 14.005V1.995c0-.358.298-.662.665-.662h6.668v4A.667.667 0 0 0 10 6zm0-1.333h-3.333V1.335zm-8.667 0V6h2V4.667zm0 2.666v1.334h5.334V7.333zm0 2.667v1.333h5.334V10z"
fill="currentColor"
/>
</svg>
下载审核报告
</div>
<div
class="download-record-item"
>
<svg
class="download-record-item-icon"
height="16"
viewBox="0 0 18 18"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15 7.5H3v6.75h12zM2.25 2.25h13.5a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H2.25A.75.75 0 0 1 1.5 15V3a.75.75 0 0 1 .75-.75m1.5 2.25V6h1.5V4.5zm3 0V6h1.5V4.5zm-3 3.75H6V12H3.75z"
fill="currentColor"
/>
</svg>
下载SQL语句
</div>
<div
class="download-record-item"
>
<svg
class="download-record-item-icon"
height="16"
viewBox="0 0 18 18"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15 7.5H3v6.75h12zM2.25 2.25h13.5a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H2.25A.75.75 0 0 1 1.5 15V3a.75.75 0 0 1 .75-.75m1.5 2.25V6h1.5V4.5zm3 0V6h1.5V4.5zm-3 3.75H6V12H3.75z"
fill="currentColor"
/>
</svg>
下载回滚语句
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
`;

exports[`sqle/ExecWorkflow/Common/DownloadRecord render snap when click down file 1`] = `
<body>
<div>
Expand Down Expand Up @@ -296,23 +163,6 @@ exports[`sqle/ExecWorkflow/Common/DownloadRecord render snap when click down fil
</svg>
下载SQL语句
</div>
<div
class="download-record-item"
>
<svg
class="download-record-item-icon"
height="16"
viewBox="0 0 18 18"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15 7.5H3v6.75h12zM2.25 2.25h13.5a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H2.25A.75.75 0 0 1 1.5 15V3a.75.75 0 0 1 .75-.75m1.5 2.25V6h1.5V4.5zm3 0V6h1.5V4.5zm-3 3.75H6V12H3.75z"
fill="currentColor"
/>
</svg>
下载回滚语句
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -429,23 +279,6 @@ exports[`sqle/ExecWorkflow/Common/DownloadRecord render snap when click down rep
</svg>
下载SQL语句
</div>
<div
class="download-record-item"
>
<svg
class="download-record-item-icon"
height="16"
viewBox="0 0 18 18"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15 7.5H3v6.75h12zM2.25 2.25h13.5a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H2.25A.75.75 0 0 1 1.5 15V3a.75.75 0 0 1 .75-.75m1.5 2.25V6h1.5V4.5zm3 0V6h1.5V4.5zm-3 3.75H6V12H3.75z"
fill="currentColor"
/>
</svg>
下载回滚语句
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -563,23 +396,6 @@ exports[`sqle/ExecWorkflow/Common/DownloadRecord render snap when click down sho
</svg>
下载SQL语句
</div>
<div
class="download-record-item"
>
<svg
class="download-record-item-icon"
height="16"
viewBox="0 0 18 18"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15 7.5H3v6.75h12zM2.25 2.25h13.5a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H2.25A.75.75 0 0 1 1.5 15V3a.75.75 0 0 1 .75-.75m1.5 2.25V6h1.5V4.5zm3 0V6h1.5V4.5zm-3 3.75H6V12H3.75z"
fill="currentColor"
/>
</svg>
下载回滚语句
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('sqle/ExecWorkflow/Common/DownloadRecord ce', () => {
await act(async () => jest.advanceTimersByTime(300));
expect(screen.getByText('下载审核报告')).toBeInTheDocument();
expect(screen.getByText('下载SQL语句')).toBeInTheDocument();
expect(screen.queryByText('下载回滚语句')).not.toBeInTheDocument();
// expect(screen.queryByText('下载回滚语句')).not.toBeInTheDocument();
expect(baseElement).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('sqle/ExecWorkflow/Common/DownloadRecord', () => {
await act(async () => jest.advanceTimersByTime(300));
expect(screen.getByText('下载审核报告')).toBeInTheDocument();
expect(screen.getByText('下载SQL语句')).toBeInTheDocument();
expect(screen.getByText('下载回滚语句')).toBeInTheDocument();
// expect(screen.getByText('下载回滚语句')).toBeInTheDocument();
expect(baseElement).toMatchSnapshot();
});

Expand Down Expand Up @@ -115,28 +115,28 @@ describe('sqle/ExecWorkflow/Common/DownloadRecord', () => {
);
});

it('render snap when click down backup sql', async () => {
const { baseElement } = customRender({
taskId: 'task Id',
noDuplicate: true,
workflowId: 'workflow id'
});
fireEvent.click(screen.getByText('下载'));
await act(async () => jest.advanceTimersByTime(300));
expect(screen.getByText('下载回滚语句')).toBeInTheDocument();
// it('render snap when click down backup sql', async () => {
// const { baseElement } = customRender({
// taskId: 'task Id',
// noDuplicate: true,
// workflowId: 'workflow id'
// });
// fireEvent.click(screen.getByText('下载'));
// await act(async () => jest.advanceTimersByTime(300));
// expect(screen.getByText('下载回滚语句')).toBeInTheDocument();

fireEvent.click(screen.getByText('下载回滚语句'));
await act(async () => jest.advanceTimersByTime(300));
expect(baseElement).toMatchSnapshot();
await act(async () => jest.advanceTimersByTime(2800));
expect(downloadBackupFileSpy).toHaveBeenCalled();
expect(downloadBackupFileSpy).toHaveBeenCalledWith(
{
task_id: 'task Id',
project_name: mockProjectInfo.projectName,
workflow_id: 'workflow id'
},
{ responseType: 'blob' }
);
});
// fireEvent.click(screen.getByText('下载回滚语句'));
// await act(async () => jest.advanceTimersByTime(300));
// expect(baseElement).toMatchSnapshot();
// await act(async () => jest.advanceTimersByTime(2800));
// expect(downloadBackupFileSpy).toHaveBeenCalled();
// expect(downloadBackupFileSpy).toHaveBeenCalledWith(
// {
// task_id: 'task Id',
// project_name: mockProjectInfo.projectName,
// workflow_id: 'workflow id'
// },
// { responseType: 'blob' }
// );
// });
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
DownArrowLineOutlined
} from '@actiontech/icons';
import { CommonIconStyleWrapper } from '@actiontech/shared/lib/styleWrapper/element';
import { useCurrentProject } from '@actiontech/shared/lib/global';
// import { useCurrentProject } from '@actiontech/shared/lib/global';

const DownloadRecord: React.FC<DownloadRecordProps> = ({
noDuplicate,
Expand All @@ -23,7 +23,7 @@ const DownloadRecord: React.FC<DownloadRecordProps> = ({
const { t } = useTranslation();
const [open, setOpen] = useState(false);

const { projectName } = useCurrentProject();
// const { projectName } = useCurrentProject();

const downloadSql = () => {
task.downloadAuditTaskSQLFileV1(
Expand All @@ -46,18 +46,19 @@ const DownloadRecord: React.FC<DownloadRecordProps> = ({
setOpen(false);
};

// todo 后端暂未实现导出回滚sql接口 暂时注释导出回滚sql相关代码
// #if [ee]
const downloadRollbackSql = () => {
task.downloadBackupFileV1(
{
task_id: taskId,
workflow_id: workflowId ?? '',
project_name: projectName
},
{ responseType: 'blob' }
);
setOpen(false);
};
// const downloadRollbackSql = () => {
// task.downloadBackupFileV1(
// {
// task_id: taskId,
// workflow_id: workflowId ?? '',
// project_name: projectName
// },
// { responseType: 'blob' }
// );
// setOpen(false);
// };
// #endif

const renderDownloadDropdown = () => {
Expand All @@ -76,10 +77,10 @@ const DownloadRecord: React.FC<DownloadRecordProps> = ({
{t('execWorkflow.audit.downloadSql')}
</div>
{/* #if [ee] */}
<div className="download-record-item" onClick={downloadRollbackSql}>
{/* <div className="download-record-item" onClick={downloadRollbackSql}>
<PanelCardOutlined className="download-record-item-icon" />
{t('execWorkflow.audit.downloadRollbackSql')}
</div>
</div> */}
{/* #endif */}
</DownloadDropdownStyleWrapper>
);
Expand Down

0 comments on commit 8511f7f

Please sign in to comment.