mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +00:00
* - Changed the method for editing the test suite pipeline from PATCH to PUT - Provided option to redploy the pipeline in the table * Worked on comments
This commit is contained in:
parent
0451de4c09
commit
ecff318546
@ -12,7 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
import { Col, Row, Typography } from 'antd';
|
import { Col, Row, Typography } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { compare } from 'fast-json-patch';
|
|
||||||
import { camelCase, isEmpty } from 'lodash';
|
import { camelCase, isEmpty } from 'lodash';
|
||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
@ -20,7 +19,7 @@ import {
|
|||||||
addIngestionPipeline,
|
addIngestionPipeline,
|
||||||
checkAirflowStatus,
|
checkAirflowStatus,
|
||||||
deployIngestionPipelineById,
|
deployIngestionPipelineById,
|
||||||
patchIngestionPipeline,
|
updateIngestionPipeline as putIngestionPipeline,
|
||||||
} from '../../axiosAPIs/ingestionPipelineAPI';
|
} from '../../axiosAPIs/ingestionPipelineAPI';
|
||||||
import {
|
import {
|
||||||
DEPLOYED_PROGRESS_VAL,
|
DEPLOYED_PROGRESS_VAL,
|
||||||
@ -137,32 +136,45 @@ const TestSuiteIngestion: React.FC<TestSuiteIngestionProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateIngestionPipeline = async (repeatFrequency: string) => {
|
const updateIngestionPipeline = async (repeatFrequency: string) => {
|
||||||
const updatedPipeline = {
|
const {
|
||||||
...ingestionPipeline,
|
airflowConfig,
|
||||||
|
description,
|
||||||
|
displayName,
|
||||||
|
loggerLevel,
|
||||||
|
name,
|
||||||
|
owner,
|
||||||
|
pipelineType,
|
||||||
|
service,
|
||||||
|
sourceConfig,
|
||||||
|
} = ingestionPipeline as IngestionPipeline;
|
||||||
|
|
||||||
|
const updatedPipelineData = {
|
||||||
airflowConfig: {
|
airflowConfig: {
|
||||||
...ingestionPipeline?.airflowConfig,
|
...airflowConfig,
|
||||||
scheduleInterval: isEmpty(repeatFrequency)
|
scheduleInterval: isEmpty(repeatFrequency)
|
||||||
? undefined
|
? undefined
|
||||||
: repeatFrequency,
|
: repeatFrequency,
|
||||||
},
|
},
|
||||||
|
description,
|
||||||
|
displayName,
|
||||||
|
loggerLevel,
|
||||||
|
name,
|
||||||
|
owner,
|
||||||
|
pipelineType,
|
||||||
|
service,
|
||||||
|
sourceConfig,
|
||||||
};
|
};
|
||||||
const jsonPatch = compare(
|
|
||||||
ingestionPipeline as IngestionPipeline,
|
try {
|
||||||
updatedPipeline
|
const response = await putIngestionPipeline(
|
||||||
);
|
updatedPipelineData as CreateIngestionPipeline
|
||||||
if (jsonPatch.length) {
|
);
|
||||||
try {
|
handleIngestionDeploy(response.id);
|
||||||
const response = await patchIngestionPipeline(
|
} catch (error) {
|
||||||
ingestionPipeline?.id || '',
|
showErrorToast(
|
||||||
jsonPatch
|
error as AxiosError,
|
||||||
);
|
jsonData['api-error-messages']['update-ingestion-error']
|
||||||
handleIngestionDeploy(response.id);
|
);
|
||||||
} catch (error) {
|
|
||||||
showErrorToast(
|
|
||||||
error as AxiosError,
|
|
||||||
jsonData['api-error-messages']['update-ingestion-error']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,13 +203,16 @@ const TestSuitePipelineTab = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeployIngestion = async (id: string) => {
|
const handleDeployIngestion = async (id: string, reDeployed: boolean) => {
|
||||||
setCurrDeployId({ id, state: 'waiting' });
|
setCurrDeployId({ id, state: 'waiting' });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await deployIngestionPipelineById(id);
|
await deployIngestionPipelineById(id);
|
||||||
setCurrDeployId({ id, state: 'success' });
|
setCurrDeployId({ id, state: 'success' });
|
||||||
setTimeout(() => setCurrDeployId({ id: '', state: '' }), 1500);
|
setTimeout(() => setCurrDeployId({ id: '', state: '' }), 1500);
|
||||||
|
showSuccessToast(
|
||||||
|
`Pipeline ${reDeployed ? 'Re Deployed' : 'Deployed'} successfully`
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setCurrDeployId({ id: '', state: '' });
|
setCurrDeployId({ id: '', state: '' });
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
@ -222,25 +225,48 @@ const TestSuitePipelineTab = () => {
|
|||||||
const getTriggerDeployButton = (ingestion: IngestionPipeline) => {
|
const getTriggerDeployButton = (ingestion: IngestionPipeline) => {
|
||||||
if (ingestion.deployed) {
|
if (ingestion.deployed) {
|
||||||
return (
|
return (
|
||||||
<Tooltip title={editPermission ? 'Run' : NO_PERMISSION_FOR_ACTION}>
|
<>
|
||||||
<Button
|
<Tooltip title={editPermission ? 'Run' : NO_PERMISSION_FOR_ACTION}>
|
||||||
data-testid="run"
|
<Button
|
||||||
disabled={!editPermission}
|
data-testid="run"
|
||||||
type="link"
|
disabled={!editPermission}
|
||||||
onClick={() =>
|
type="link"
|
||||||
handleTriggerIngestion(ingestion.id as string, ingestion.name)
|
onClick={() =>
|
||||||
}>
|
handleTriggerIngestion(ingestion.id as string, ingestion.name)
|
||||||
{currTriggerId.id === ingestion.id ? (
|
}>
|
||||||
currTriggerId.state === 'success' ? (
|
{currTriggerId.id === ingestion.id ? (
|
||||||
<FontAwesomeIcon icon="check" />
|
currTriggerId.state === 'success' ? (
|
||||||
|
<FontAwesomeIcon icon="check" />
|
||||||
|
) : (
|
||||||
|
<Loader size="small" type="default" />
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<Loader size="small" type="default" />
|
'Run'
|
||||||
)
|
)}
|
||||||
) : (
|
</Button>
|
||||||
'Run'
|
</Tooltip>
|
||||||
)}
|
{separator}
|
||||||
</Button>
|
<Tooltip
|
||||||
</Tooltip>
|
title={editPermission ? 'Re Deploy' : NO_PERMISSION_FOR_ACTION}>
|
||||||
|
<Button
|
||||||
|
data-testid="re-deploy-btn"
|
||||||
|
disabled={!editPermission}
|
||||||
|
type="link"
|
||||||
|
onClick={() =>
|
||||||
|
handleDeployIngestion(ingestion.id as string, true)
|
||||||
|
}>
|
||||||
|
{currDeployId.id === ingestion.id ? (
|
||||||
|
currDeployId.state === 'success' ? (
|
||||||
|
<FontAwesomeIcon icon="check" />
|
||||||
|
) : (
|
||||||
|
<Loader size="small" type="default" />
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
'Re Deploy'
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
@ -249,7 +275,9 @@ const TestSuitePipelineTab = () => {
|
|||||||
data-testid="deploy"
|
data-testid="deploy"
|
||||||
disabled={!editPermission}
|
disabled={!editPermission}
|
||||||
type="link"
|
type="link"
|
||||||
onClick={() => handleDeployIngestion(ingestion.id as string)}>
|
onClick={() =>
|
||||||
|
handleDeployIngestion(ingestion.id as string, false)
|
||||||
|
}>
|
||||||
{currDeployId.id === ingestion.id ? (
|
{currDeployId.id === ingestion.id ? (
|
||||||
currDeployId.state === 'success' ? (
|
currDeployId.state === 'success' ? (
|
||||||
<FontAwesomeIcon icon="check" />
|
<FontAwesomeIcon icon="check" />
|
||||||
@ -507,7 +535,14 @@ const TestSuitePipelineTab = () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return column;
|
return column;
|
||||||
}, [airFlowEndPoint, isKillModalOpen, isLogsModalOpen, selectedPipeline]);
|
}, [
|
||||||
|
airFlowEndPoint,
|
||||||
|
isKillModalOpen,
|
||||||
|
isLogsModalOpen,
|
||||||
|
selectedPipeline,
|
||||||
|
currDeployId,
|
||||||
|
currTriggerId,
|
||||||
|
]);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user