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

[fix](SqlExecWorkflow): Capture unformatted SQL errors #517

Merged
merged 3 commits into from
Dec 3, 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
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ const SqlMode: React.FC<SqlExecuteResultCardProps> = ({
};

const formattedRollbackSql = useMemo(() => {
return props.rollback_sqls?.map((v) => formatterSQL(v))?.join('\n');
}, [props.rollback_sqls]);
return props.rollback_sqls
?.map((v) => formatterSQL(v, props.dbType))
?.join('\n');
}, [props.rollback_sqls, props.dbType]);

return (
<TasksResultCardStyleWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ describe('sqle/ExecWorkflow/AuditDetail/SqlMode ce', () => {
) => {
const someParams: Pick<
SqlExecuteResultCardProps,
'projectID' | 'taskId' | 'onUpdateDescription'
'projectID' | 'taskId' | 'onUpdateDescription' | 'dbType'
> = {
projectID,
taskId,
onUpdateDescription: onUpdateDescriptionFn
onUpdateDescription: onUpdateDescriptionFn,
dbType: 'MySQL'
};
return superRender(<SQLMode {...someParams} {...params} />);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('sqle/ExecWorkflow/AuditDetail/SqlMode', () => {
const customRender = (
params: Omit<
SqlExecuteResultCardProps,
'projectID' | 'taskId' | 'onUpdateDescription'
'projectID' | 'taskId' | 'onUpdateDescription' | 'dbType'
>
) => {
const someParams: Pick<
Expand All @@ -34,7 +34,7 @@ describe('sqle/ExecWorkflow/AuditDetail/SqlMode', () => {
taskId,
onUpdateDescription: onUpdateDescriptionFn
};
return superRender(<SQLMode {...someParams} {...params} />);
return superRender(<SQLMode {...someParams} {...params} dbType="MySQL" />);
};

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type SqlExecuteResultCardProps = BaseProps &
onUpdateDescription?: () => void;
projectID: string;
backupConflict?: boolean;
dbType?: string;
};

export type FileExecuteResultCardProps = BaseProps &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const SqlExecuteMode: React.FC<SqlExecuteModeProps> = ({
currentListLayout,
workflowStatus,
auditResultActiveKey,
backupConflict
backupConflict,
dbType
}) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -81,6 +82,7 @@ const SqlExecuteMode: React.FC<SqlExecuteModeProps> = ({
onUpdateDescription={refresh}
executeMode={WorkflowResV2ExecModeEnum.sqls}
backupConflict={backupConflict}
dbType={dbType}
/>
</List.Item>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export type TasksResultListBaseProps = {
assigneeUserNames: string[];
executeMode: WorkflowResV2ExecModeEnum;
backupConflict?: boolean;
dbType?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const AuditExecResultPanel: React.FC<AuditExecResultPanelProps> = ({
WorkflowResV2ExecModeEnum.sqls
}
backupConflict={currentTask?.backup_conflict_with_instance}
dbType={currentTask?.instance_db_type}
/>
</EmptyBox>
</AuditExecResultPanelStyleWrapper>
Expand Down
Loading