Skip to content

Commit

Permalink
Merge pull request #435 from actiontech/feature/version-detail
Browse files Browse the repository at this point in the history
[feature]: Offline Execute workflow
  • Loading branch information
LZS911 authored Oct 8, 2024
2 parents fe97775 + 8be18d7 commit 16d8305
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 22 deletions.
14 changes: 7 additions & 7 deletions packages/shared/lib/api/sqle/service/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2192,12 +2192,6 @@ export interface IReportPushConfigList {
type?: string;
}

export interface IRetryExecWorkflowReqV1 {
task_ids?: number[];

workflow_id?: string;
}

export interface IRewriteRule {
message?: string;

Expand Down Expand Up @@ -3401,7 +3395,13 @@ export interface IBatchCancelWorkflowsReqV2 {
}

export interface IBatchCompleteWorkflowsReqV2 {
workflow_id_list?: string[];
workflow_list?: ICompleteWorkflowReq[];
}

export interface ICompleteWorkflowReq {
desc?: string;

workflow_id?: string;
}

export interface ICreateWorkflowReqV2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ describe('sqle/ExecWorkflow/Detail', () => {

expect(batchCompleteWorkflowsSpy).toHaveBeenCalledTimes(1);
expect(batchCompleteWorkflowsSpy).toHaveBeenCalledWith({
workflow_id_list: [workflowsDetailData.workflow_id],
workflow_list: [{ workflow_id: workflowsDetailData.workflow_id }],
project_name: mockProjectInfo.projectName
});
await act(async () => jest.advanceTimersByTime(3000));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const useGenerateWorkflowStepsProps = ({
const completeAction = useCallback(async () => {
return workflow
.batchCompleteWorkflowsV2({
workflow_id_list: [workflowId],
workflow_list: [{ workflow_id: workflowId }],
project_name: projectName
})
.then((res) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BasicTable } from '@actiontech/shared';
import { useTranslation } from 'react-i18next';
import WorkflowStatus from '../../../../../SqlExecWorkflow/List/components/WorkflowStatus';
import { WorkflowDetailResV1StatusEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum';
import { IBasicTable } from '@actiontech/shared/lib/components/BasicTable';

const WorkflowTableField: React.FC<{
value?: React.Key[];
Expand All @@ -16,16 +17,11 @@ const WorkflowTableField: React.FC<{
onChange?.(keys);
};

const columns = [
const columns: IBasicTable<IAssociateWorkflows>['columns'] = [
{
dataIndex: 'workflow_name',
title: t('versionManagement.associateWorkflow.workflowName')
},
{
dataIndex: 'desc',
title: t('versionManagement.associateWorkflow.workflowDesc'),
render: (desc: string) => desc || '-'
},
{
dataIndex: 'status',
title: t('versionManagement.associateWorkflow.workflowStatus'),
Expand All @@ -34,6 +30,11 @@ const WorkflowTableField: React.FC<{
status={status as unknown as WorkflowDetailResV1StatusEnum}
/>
)
},
{
dataIndex: 'desc',
title: t('versionManagement.associateWorkflow.workflowDesc'),
render: (desc: string) => desc || '-'
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ const OfflineExecModal = () => {
dispatch(updateSelectVersionStageId({ stageId: null }));
};

const onSubmit = () => {
form.validateFields();
// todo 待后端补充备注字段
const onSubmit = async () => {
const values = await form.validateFields();
startSubmit();
workflow
.batchCompleteWorkflowsV2({
workflow_id_list: [workflowId ?? ''],
workflow_list: [
{
workflow_id: workflowId ?? '',
desc: values.remarks
}
],
project_name: projectName
})
.then((res) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const useTestConnection = (releaseWorkflows: TargetReleaseWorkflowType[]) => {
const {
data: connectionInfo,
loading: getConnectionInfoLoading,
run: getConnectionInfo
run: getConnectionInfo,
mutate: setConnectionInfo
} = useRequest(
() => {
const params: IBatchCheckInstanceIsConnectableByNameParams = {
Expand Down Expand Up @@ -84,11 +85,16 @@ const useTestConnection = (releaseWorkflows: TargetReleaseWorkflowType[]) => {
[t, connectionInfo]
);

const clearConnectionInfo = useCallback(() => {
setConnectionInfo(undefined);
}, [setConnectionInfo]);

return {
renderTestDatabasesConnectInfo,
getConnectionInfoLoading,
getConnectionInfo,
testConnectionAble: !!instanceNames?.length
testConnectionAble: !!instanceNames?.length,
clearConnectionInfo
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const ReleaseModal: React.FC = () => {
renderTestDatabasesConnectInfo,
getConnectionInfoLoading,
getConnectionInfo,
testConnectionAble
testConnectionAble,
clearConnectionInfo
} = useTestConnection(releaseWorkflows);

const { stageId, currentStageWorkflowList, visible } = useSelector(
Expand Down Expand Up @@ -114,6 +115,7 @@ const ReleaseModal: React.FC = () => {

const onClose = () => {
form.resetFields();
clearConnectionInfo();
dispatch(
updateVersionManagementModalStatus({
modalName: ModalName.Version_Management_Release_Modal,
Expand Down

0 comments on commit 16d8305

Please sign in to comment.