From e50452b22e3fe42afc6091d522f82dc67552839d Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Thu, 4 Dec 2025 15:20:49 +0530 Subject: [PATCH 01/15] feat: add ResourceConflictDeployDialog for handling resource ownership conflicts during redeployments --- .../ResourceConflictDeployDialog.tsx | 59 +++++ src/Shared/Components/CICDHistory/Sidebar.tsx | 53 +++-- .../Components/CICDHistory/TriggerDetails.tsx | 221 +++++++++++------- .../Components/CICDHistory/TriggerOutput.tsx | 23 +- .../Components/CICDHistory/constants.tsx | 2 + src/Shared/Components/CICDHistory/service.tsx | 8 + src/Shared/Components/CICDHistory/types.tsx | 22 ++ src/Shared/Components/CICDHistory/utils.tsx | 3 + 8 files changed, 267 insertions(+), 124 deletions(-) create mode 100644 src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx new file mode 100644 index 000000000..d96e4a18d --- /dev/null +++ b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx @@ -0,0 +1,59 @@ +import { useState } from 'react' +import { useHistory, useParams } from 'react-router-dom' + +import { URLS } from '@Common/Constants' +import { showError } from '@Common/Helper' +import { ToastManager, ToastVariantType } from '@Shared/Services' + +import { ConfirmationModal, ConfirmationModalVariantType } from '../ConfirmationModal' +import { resourceConflictRedeploy } from './service' +import { ResourceConflictDeployDialogProps, ResourceConflictDeployDialogURLParamsType } from './types' + +const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: ResourceConflictDeployDialogProps) => { + const history = useHistory() + const { appId, envId, pipelineId, triggerId } = useParams() + const [isLoading, setIsLoading] = useState(false) + + const handleDeploy = async () => { + setIsLoading(true) + try { + await resourceConflictRedeploy({ + pipelineId, + triggerId, + }) + ToastManager.showToast({ + variant: ToastVariantType.success, + title: 'Redeploy initiated', + description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, + }) + handleClose() + history.push(`${URLS.APP}/${appId}/details/${envId}`) + } catch (error) { + showError(error) + } finally { + setIsLoading(false) + } + } + + return ( + + ) +} + +export default ResourceConflictDeployDialog diff --git a/src/Shared/Components/CICDHistory/Sidebar.tsx b/src/Shared/Components/CICDHistory/Sidebar.tsx index 16e9e1cf7..11395f673 100644 --- a/src/Shared/Components/CICDHistory/Sidebar.tsx +++ b/src/Shared/Components/CICDHistory/Sidebar.tsx @@ -41,7 +41,12 @@ import { HistorySummaryCardType, SidebarType, } from './types' -import { getHistoryItemStatusIconFromWorkflowStages, getTriggerStatusIcon, getWorkflowNodeStatusTitle } from './utils' +import { + getHistoryItemStatusIconFromWorkflowStages, + getSortedTriggerHistory, + getTriggerStatusIcon, + getWorkflowNodeStatusTitle, +} from './utils' /** * @description To be shown on deployment history or when we don't have workflowExecutionStages @@ -378,30 +383,28 @@ const Sidebar = React.memo( {fetchIdData === FetchIdDataStatus.SUCCESS && ( )} - {Array.from(triggerHistory) - .sort(([a], [b]) => b - a) - .map(([triggerId, triggerDetails], index) => ( - - ))} + {getSortedTriggerHistory(triggerHistory).map(([triggerId, triggerDetails], index) => ( + + ))} {hasMore && (fetchIdData === FetchIdDataStatus.SUSPEND || !fetchIdData) && ( )} diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index ffd7738ca..6f3dc3a8c 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -34,15 +34,18 @@ import { GitTriggers } from '../../types' import { Button, ButtonStyleType, ButtonVariantType } from '../Button' import { ConfirmationModal, ConfirmationModalVariantType } from '../ConfirmationModal' import { Icon } from '../Icon' +import { InfoBlock } from '../InfoBlock' import { DEFAULT_CLUSTER_ID, DEFAULT_ENV, EXECUTION_FINISHED_TEXT_MAP, PROGRESSING_STATUS, PULSATING_STATUS_MAP, + RESOURCE_CONFLICT_DEPLOY_ERROR, statusColor as colorMap, TERMINAL_STATUS_COLOR_CLASS_MAP, } from './constants' +import ResourceConflictDeployDialog from './ResourceConflictDeployDialog' import { cancelCiTrigger, cancelPrePostCdTrigger } from './service' import { CurrentStatusIconProps, @@ -445,128 +448,172 @@ const TriggerDetails = memo( renderTargetConfigInfo, workflowExecutionStages, namespace, + isLatest, + appName, }: TriggerDetailsType) => { + const [showRedeployModal, setShowRedeployModal] = useState(false) + const executionInfo = useMemo( () => sanitizeWorkflowExecutionStages(workflowExecutionStages), [workflowExecutionStages], ) - return ( -
-
-
-
-
-
- {renderDetailsSuccessIconBlock()} -
-
+ const errorMessage = executionInfo?.workerDetails.message || message -
- -
-
+ const showResourceConflictInfoBlock = + isLatest && + (type === HistoryComponentType.CD || type === HistoryComponentType.GROUP_CD) && + stage === DeploymentStageType.DEPLOY && + errorMessage?.includes(RESOURCE_CONFLICT_DEPLOY_ERROR) + + const handleShowRedeployModal = () => { + setShowRedeployModal(true) + } + + const handleCloseRedeployModal = () => { + setShowRedeployModal(false) + } - {!!triggerMetadata && !!renderDeploymentHistoryTriggerMetaText && ( + return ( + <> +
+
- {renderBlockWithBorder()} - {renderDeploymentHistoryTriggerMetaText(triggerMetadata, true)} - {renderBlockWithBorder()} +
+ {renderDetailsSuccessIconBlock()}
- {renderDeploymentHistoryTriggerMetaText(triggerMetadata)} +
+ +
- )} - {isJobView && ( -
-
-
- {renderBlockWithBorder()} - - {renderBlockWithBorder()} + {!!triggerMetadata && !!renderDeploymentHistoryTriggerMetaText && ( +
+
+
+ {renderBlockWithBorder()} + {renderDeploymentHistoryTriggerMetaText(triggerMetadata, true)} + {renderBlockWithBorder()} +
+ + {renderDeploymentHistoryTriggerMetaText(triggerMetadata)}
+ )} + + {isJobView && ( +
+
+
+ {renderBlockWithBorder()} + + {renderBlockWithBorder()} +
+
-
- Env - - {environmentName !== '' ? environmentName : DEFAULT_ENV} - - {environmentName === '' && (Default)} +
+ Env + + {environmentName !== '' ? environmentName : DEFAULT_ENV} + + {environmentName === '' && (Default)} +
-
- )} + )} + + {!!executionInfo?.executionStartedOn && ( +
+
+
+ {renderBlockWithBorder()} + {renderDetailsSuccessIconBlock()} +
+
+ +
+

Execution started

+ +
+
+ )} - {!!executionInfo?.executionStartedOn && (
{renderBlockWithBorder()} - {renderDetailsSuccessIconBlock()} + + + +
-
-

Execution started

- -
+
- )} -
-
-
- {renderBlockWithBorder()} +
+ +
- + , + onClick: handleShowRedeployModal, + }} /> - -
-
- - -
- -
- + )}
-
+ + {showRedeployModal && ( + + )} + ) }, ) diff --git a/src/Shared/Components/CICDHistory/TriggerOutput.tsx b/src/Shared/Components/CICDHistory/TriggerOutput.tsx index f3929c229..7f5c94c14 100644 --- a/src/Shared/Components/CICDHistory/TriggerOutput.tsx +++ b/src/Shared/Components/CICDHistory/TriggerOutput.tsx @@ -47,8 +47,9 @@ import { statusSet, terminalStatus, TriggerOutputProps, + TriggerOutputURLParamsType, } from './types' -import { getTriggerOutputTabs } from './utils' +import { getSortedTriggerHistory, getTriggerOutputTabs } from './utils' import './cicdHistory.scss' @@ -250,12 +251,7 @@ const TriggerOutput = ({ renderTargetConfigInfo, appName, }: TriggerOutputProps) => { - const { appId, triggerId, envId, pipelineId } = useParams<{ - appId: string - triggerId: string - envId: string - pipelineId: string - }>() + const { appId, triggerId, envId, pipelineId } = useParams() const triggerDetails = triggerHistory.get(+triggerId) const [triggerDetailsLoading, triggerDetailsResult, triggerDetailsError, reloadTriggerDetails] = useAsync( () => getTriggerDetails({ appId, envId, pipelineId, triggerId, fetchIdData }), @@ -265,6 +261,7 @@ const TriggerOutput = ({ ) const targetPlatforms = sanitizeTargetPlatforms(triggerDetails?.targetPlatforms) + const artifactId = triggerDetailsResult?.result?.artifactId || triggerDetails?.artifactId // Function to sync the trigger details as trigger details is also fetched with another api const syncState = (syncTriggerId: number, syncTriggerDetail: History, syncTriggerDetailsError: ServerError) => { @@ -311,12 +308,10 @@ const TriggerOutput = ({ () => getTagDetails({ pipelineId, - artifactId: triggerDetailsResult?.result?.artifactId || triggerDetails?.artifactId, + artifactId, }), [pipelineId, triggerId], - areTagDetailsRequired && - !!pipelineId && - (!!triggerDetailsResult?.result?.artifactId || !!triggerDetails?.artifactId), + areTagDetailsRequired && !!pipelineId && !!artifactId, ) useEffect(() => { @@ -363,6 +358,8 @@ const TriggerOutput = ({ useInterval(reloadTriggerDetails, timeout) + const latestTriggerHistoryId = useMemo(() => getSortedTriggerHistory(triggerHistory)?.[0]?.[0], [triggerHistory]) + if ( (!areTagDetailsRequired && triggerDetailsLoading && !triggerDetails) || !triggerId || @@ -411,6 +408,8 @@ const TriggerOutput = ({ renderTargetConfigInfo={renderTargetConfigInfo} workflowExecutionStages={triggerDetails.workflowExecutionStages} namespace={triggerDetails.namespace} + isLatest={latestTriggerHistoryId === triggerDetails.id} + appName={appName} />
@@ -430,7 +429,7 @@ const TriggerOutput = ({ setFullScreenView={setFullScreenView} deploymentAppType={deploymentAppType} isBlobStorageConfigured={isBlobStorageConfigured} - artifactId={triggerDetailsResult?.result?.artifactId} + artifactId={artifactId} ciPipelineId={triggerDetailsResult?.result?.ciPipelineId} appReleaseTags={appReleaseTags} tagsEditable={tagsEditable} diff --git a/src/Shared/Components/CICDHistory/constants.tsx b/src/Shared/Components/CICDHistory/constants.tsx index 9d3d366f5..6cb82374f 100644 --- a/src/Shared/Components/CICDHistory/constants.tsx +++ b/src/Shared/Components/CICDHistory/constants.tsx @@ -170,3 +170,5 @@ export const FAILED_WORKFLOW_STAGE_STATUS_MAP: Record< } export const APP_HEALTH_DROP_DOWN_LIST = ['inprogress', 'failed', 'disconnect', 'timed_out'] + +export const RESOURCE_CONFLICT_DEPLOY_ERROR = 'cannot be imported into the current release: invalid ownership metadata;' diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index 6a130c68c..ad20efc2b 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -28,6 +28,7 @@ import { DeploymentStatusDetailsResponse, FetchIdDataStatus, ModuleConfigResponse, + ResourceConflictDeployDialogURLParamsType, TriggerDetailsResponseType, TriggerHistoryParamsType, } from './types' @@ -292,3 +293,10 @@ export const getTriggerHistory = async ({ export const getModuleConfigured = (moduleName: string): Promise => get(`${ROUTES.MODULE_CONFIGURED}?name=${moduleName}`) + +export const resourceConflictRedeploy = async ({ + pipelineId, + triggerId, +}: Pick) => + // TODO: Fix the route + get(`cd-pipeline/re-deploy/${pipelineId}/${triggerId}`) diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx index 7f6f8483f..d9a5e595c 100644 --- a/src/Shared/Components/CICDHistory/types.tsx +++ b/src/Shared/Components/CICDHistory/types.tsx @@ -35,6 +35,7 @@ import { DeploymentStageType } from '../../constants' import { AggregationKeys, AppDetails, + BaseURLParams, DeploymentStatusDetailsBreakdownDataType, DeploymentStatusDetailsType, DeploymentStatusTimelineType, @@ -331,8 +332,29 @@ export interface TriggerDetailsType workerPodName?: string triggerMetadata?: string renderDeploymentHistoryTriggerMetaText: (triggerMetaData: string, onlyRenderIcon?: boolean) => JSX.Element + /** + * Only present in case of CD trigger details as of now + */ + isLatest?: boolean + /** + * Only present in case of CD trigger details as of now + */ + appName?: string +} + +export interface ResourceConflictDeployDialogProps + extends Required> { + handleClose: () => void } +export interface TriggerOutputURLParamsType extends Pick { + triggerId: string + pipelineId: string +} + +export interface ResourceConflictDeployDialogURLParamsType + extends Pick {} + export type ProgressingStatusType = { stage: DeploymentStageType type: HistoryComponentType diff --git a/src/Shared/Components/CICDHistory/utils.tsx b/src/Shared/Components/CICDHistory/utils.tsx index be3071c7f..d24e486f4 100644 --- a/src/Shared/Components/CICDHistory/utils.tsx +++ b/src/Shared/Components/CICDHistory/utils.tsx @@ -460,3 +460,6 @@ export const getTriggerOutputTabs = ( ] : []), ] + +export const getSortedTriggerHistory = (triggerHistory: Map) => + Array.from(triggerHistory).sort(([a], [b]) => b - a) From c9f566fcbbe04b86d4374aa385dd45a67ad23fbc Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Thu, 4 Dec 2025 18:06:09 +0530 Subject: [PATCH 02/15] feat: implement ResourceConflictDetailsModal and ConflictedResourcesTable for managing resource conflicts --- .../CICDHistory/ConflictedResourcesTable.tsx | 47 +++++++ .../ResourceConflictDetailsModal.tsx | 121 ++++++++++++++++++ .../Components/CICDHistory/TriggerDetails.tsx | 57 +++++++-- .../Components/CICDHistory/constants.tsx | 43 ++++++- src/Shared/Components/CICDHistory/service.tsx | 58 ++++++++- src/Shared/Components/CICDHistory/types.tsx | 29 ++++- 6 files changed, 340 insertions(+), 15 deletions(-) create mode 100644 src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx create mode 100644 src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx diff --git a/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx new file mode 100644 index 000000000..3183b54e4 --- /dev/null +++ b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx @@ -0,0 +1,47 @@ +import { useMemo } from 'react' + +import { noop } from '@Common/Helper' + +import { FiltersTypeEnum, PaginationEnum, Table, TableViewWrapperProps } from '../Table' +import { RowsType } from '../Table/types' +import { CONFLICTED_RESOURCES_COLUMNS } from './constants' +import { ConflictedResourcesTableProps, ResourceConflictItemType } from './types' + +const Wrapper = ({ children }: TableViewWrapperProps) =>
{children}
+ +const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourcesTableProps) => { + const rows: RowsType = useMemo( + () => + (resourceConflictDetails || []).map[number]>((resource) => ({ + data: resource, + id: resource.id, + })), + [resourceConflictDetails], + ) + + return ( + + id="table__resource-conflict-details" + columns={CONFLICTED_RESOURCES_COLUMNS} + rows={rows} + emptyStateConfig={{ + noRowsConfig: { + title: 'No resource found', + }, + noRowsForFilterConfig: { + title: 'No results', + subTitle: "We couldn't find any matching results", + }, + }} + paginationVariant={PaginationEnum.NOT_PAGINATED} + additionalFilterProps={{ + initialSortKey: 'name' satisfies keyof ResourceConflictItemType, + }} + filtersVariant={FiltersTypeEnum.STATE} + ViewWrapper={Wrapper} + filter={noop} + /> + ) +} + +export default ConflictedResourcesTable diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx new file mode 100644 index 000000000..8206783b3 --- /dev/null +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -0,0 +1,121 @@ +import { useState } from 'react' +import { useHistory, useParams } from 'react-router-dom' + +import { useQuery } from '@Common/API' +import { URLS } from '@Common/Constants' +import { Drawer } from '@Common/Drawer' +import { showError, stopPropagation } from '@Common/Helper' +import { ComponentSizeType } from '@Shared/constants' +import { ToastManager, ToastVariantType } from '@Shared/Services' + +import { APIResponseHandler } from '../APIResponseHandler' +import { Button, ButtonStyleType, ButtonVariantType } from '../Button' +import { Icon } from '../Icon' +import ConflictedResourcesTable from './ConflictedResourcesTable' +import { getResourceConflictDetails, resourceConflictRedeploy } from './service' +import { ResourceConflictDeployDialogURLParamsType, ResourceConflictDetailsModalProps } from './types' + +const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: ResourceConflictDetailsModalProps) => { + const { appId, envId, pipelineId, triggerId } = useParams() + const history = useHistory() + + const { + isFetching: isLoadingResourceData, + data: resourceConflictDetails, + refetch: refetchResourceConflictDetails, + error: resourceConflictDetailsError, + } = useQuery({ + queryKey: ['getResourceConflictDetails'], + // TODO: Signal + queryFn: () => getResourceConflictDetails(), + select: (data) => data.result, + }) + + const [isDeploying, setIsDeploying] = useState(false) + + const handleDeploy = async () => { + setIsDeploying(true) + try { + await resourceConflictRedeploy({ + pipelineId, + triggerId, + }) + ToastManager.showToast({ + variant: ToastVariantType.success, + title: 'Redeploy initiated', + description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, + }) + handleClose() + history.push(`${URLS.APP}/${appId}/details/${envId}`) + } catch (error) { + showError(error) + } finally { + setIsDeploying(false) + } + } + + return ( + +
+
+
+

Resources with conflict

+ +
+ +
+ + + +
+
+ +
+
+
+
+ ) +} + +export default ResourceConflictDetailsModal diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index 6f3dc3a8c..034d038bb 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -46,6 +46,7 @@ import { TERMINAL_STATUS_COLOR_CLASS_MAP, } from './constants' import ResourceConflictDeployDialog from './ResourceConflictDeployDialog' +import ResourceConflictDetailsModal from './ResourceConflictDetailsModal' import { cancelCiTrigger, cancelPrePostCdTrigger } from './service' import { CurrentStatusIconProps, @@ -53,6 +54,7 @@ import { FinishedType, HistoryComponentType, ProgressingStatusType, + ResourceConflictModalType, StartDetailsType, TriggerDetailsType, WorkflowStageStatusType, @@ -451,7 +453,7 @@ const TriggerDetails = memo( isLatest, appName, }: TriggerDetailsType) => { - const [showRedeployModal, setShowRedeployModal] = useState(false) + const [resourceConflictModal, setResourceConflictModal] = useState(null) const executionInfo = useMemo( () => sanitizeWorkflowExecutionStages(workflowExecutionStages), @@ -467,11 +469,50 @@ const TriggerDetails = memo( errorMessage?.includes(RESOURCE_CONFLICT_DEPLOY_ERROR) const handleShowRedeployModal = () => { - setShowRedeployModal(true) + setResourceConflictModal(ResourceConflictModalType.DEPLOY_DIALOG) } const handleCloseRedeployModal = () => { - setShowRedeployModal(false) + setResourceConflictModal(null) + } + + const renderInfoBlockDescription = () => ( +
+
+ ) + + const renderDialogs = () => { + if (resourceConflictModal === ResourceConflictModalType.DEPLOY_DIALOG) { + return ( + + ) + } + + if (resourceConflictModal === ResourceConflictModalType.RESOURCE_DETAIL_MODAL) { + return ( + + ) + } + + return null } return ( @@ -593,7 +634,7 @@ const TriggerDetails = memo( {showResourceConflictInfoBlock && (
- {showRedeployModal && ( - - )} + {renderDialogs()} ) }, diff --git a/src/Shared/Components/CICDHistory/constants.tsx b/src/Shared/Components/CICDHistory/constants.tsx index 6cb82374f..52fb78d09 100644 --- a/src/Shared/Components/CICDHistory/constants.tsx +++ b/src/Shared/Components/CICDHistory/constants.tsx @@ -17,7 +17,8 @@ import { WorkflowStatusEnum } from '@Shared/types' import { multiSelectStyles } from '../../../Common/MultiSelectCustomization' -import { WorkflowStageStatusType } from './types' +import { FiltersTypeEnum, TableProps } from '../Table' +import { ResourceConflictItemType, WorkflowStageStatusType } from './types' export const HISTORY_LABEL = { APPLICATION: 'Application', @@ -172,3 +173,43 @@ export const FAILED_WORKFLOW_STAGE_STATUS_MAP: Record< export const APP_HEALTH_DROP_DOWN_LIST = ['inprogress', 'failed', 'disconnect', 'timed_out'] export const RESOURCE_CONFLICT_DEPLOY_ERROR = 'cannot be imported into the current release: invalid ownership metadata;' + +export const CONFLICTED_RESOURCES_COLUMNS: TableProps['columns'] = [ + { + field: 'name' satisfies keyof ResourceConflictItemType, + label: 'Name', + size: { + range: { + startWidth: 250, + maxWidth: 400, + minWidth: 120, + }, + }, + isSortable: true, + horizontallySticky: true, + }, + { + field: 'namespace' satisfies keyof ResourceConflictItemType, + label: 'Namespace', + size: { + range: { + startWidth: 150, + maxWidth: 400, + minWidth: 100, + }, + }, + isSortable: true, + }, + { + field: 'gvkTitle' satisfies keyof ResourceConflictItemType, + label: 'GVK', + size: { + range: { + startWidth: 250, + maxWidth: 400, + minWidth: 100, + }, + }, + isSortable: true, + }, +] diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index ad20efc2b..f8994a864 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -19,7 +19,7 @@ import moment from 'moment' import { get, getUrlWithSearchParams, ResponseType, ROUTES, sanitizeUserApprovalMetadata, trash } from '../../../Common' import { DATE_TIME_FORMAT_STRING, DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP, EXTERNAL_TYPES } from '../../constants' -import { decode, isNullOrUndefined } from '../../Helpers' +import { decode, getUniqueId, isNullOrUndefined } from '../../Helpers' import { ResourceKindType, ResourceVersionType } from '../../types' import { DeploymentHistoryDetail, @@ -29,6 +29,7 @@ import { FetchIdDataStatus, ModuleConfigResponse, ResourceConflictDeployDialogURLParamsType, + ResourceConflictItemType, TriggerDetailsResponseType, TriggerHistoryParamsType, } from './types' @@ -300,3 +301,58 @@ export const resourceConflictRedeploy = async ({ }: Pick) => // TODO: Fix the route get(`cd-pipeline/re-deploy/${pipelineId}/${triggerId}`) + +export const getResourceConflictDetails = async (): Promise> => ({ + code: 200, + result: [ + { + name: 'resource-1', + namespace: 'default', + gvk: { + Group: 'apps', + Version: 'v1', + Kind: 'Deployment', + }, + gvkTitle: 'Deployment', + clusterId: 1, + id: getUniqueId(), + }, + { + name: 'resource-2', + namespace: 'default', + gvk: { + Group: '', + Version: 'v1', + Kind: 'Service', + }, + gvkTitle: 'Service', + clusterId: 1, + id: getUniqueId(), + }, + { + name: 'resource-3', + namespace: 'default', + gvk: { + Group: 'apps', + Version: 'v1', + Kind: 'StatefulSet', + }, + gvkTitle: 'StatefulSet', + clusterId: 1, + id: getUniqueId(), + }, + { + name: 'resource-4', + namespace: 'default', + gvk: { + Group: 'batch', + Version: 'v1', + Kind: 'Job', + }, + gvkTitle: 'Job', + clusterId: 1, + id: getUniqueId(), + }, + ], + status: 'OK', +}) diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx index d9a5e595c..bd9adbf22 100644 --- a/src/Shared/Components/CICDHistory/types.tsx +++ b/src/Shared/Components/CICDHistory/types.tsx @@ -17,6 +17,7 @@ import { CSSProperties, MutableRefObject, ReactElement, ReactNode } from 'react' import { SupportedKeyboardKeysType } from '@Common/Hooks/UseRegisterShortcut/types' +import { GVKType } from '@Pages/ResourceBrowser' import { DeploymentAppTypes, @@ -342,11 +343,35 @@ export interface TriggerDetailsType appName?: string } -export interface ResourceConflictDeployDialogProps - extends Required> { +export enum ResourceConflictModalType { + DEPLOY_DIALOG = 'DEPLOY_DIALOG', + RESOURCE_DETAIL_MODAL = 'RESOURCE_DETAIL_MODAL', +} + +interface ResourceConflictDialogBaseProps extends Required> { handleClose: () => void } +export interface ResourceConflictDeployDialogProps extends ResourceConflictDialogBaseProps {} + +export interface ResourceConflictDetailsModalProps extends ResourceConflictDialogBaseProps {} + +export interface ResourceConflictItemType { + name: string + namespace: string + gvk: GVKType + gvkTitle: string + clusterId: number + /** + * Generated at ui + */ + id: string +} + +export interface ConflictedResourcesTableProps { + resourceConflictDetails: ResourceConflictItemType[] +} + export interface TriggerOutputURLParamsType extends Pick { triggerId: string pipelineId: string From 7f658c5a834d1d148ad9e95e0aeeb547a2c9a281 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 13:08:03 +0530 Subject: [PATCH 03/15] feat: enhance resource conflict handling with redeploy functionality and UI improvements --- .../ResourceConflictDeployDialog.tsx | 9 ++++- .../ResourceConflictDetailsModal.tsx | 3 +- .../Components/CICDHistory/TriggerDetails.tsx | 39 +++++++++++-------- .../Components/CICDHistory/WorkerStatus.tsx | 3 ++ src/Shared/Components/CICDHistory/service.tsx | 26 +++++++++---- src/Shared/Components/CICDHistory/types.tsx | 11 ++++++ 6 files changed, 64 insertions(+), 27 deletions(-) diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx index d96e4a18d..4ff391ea4 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx @@ -5,7 +5,9 @@ import { URLS } from '@Common/Constants' import { showError } from '@Common/Helper' import { ToastManager, ToastVariantType } from '@Shared/Services' +import { ButtonStyleType } from '../Button' import { ConfirmationModal, ConfirmationModalVariantType } from '../ConfirmationModal' +import { Icon } from '../Icon' import { resourceConflictRedeploy } from './service' import { ResourceConflictDeployDialogProps, ResourceConflictDeployDialogURLParamsType } from './types' @@ -20,6 +22,7 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: await resourceConflictRedeploy({ pipelineId, triggerId, + appId, }) ToastManager.showToast({ variant: ToastVariantType.success, @@ -27,7 +30,7 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, }) handleClose() - history.push(`${URLS.APP}/${appId}/details/${envId}`) + history.push(`${URLS.APPLICATION_MANAGEMENT_APP}/${appId}/details/${envId}`) } catch (error) { showError(error) } finally { @@ -37,7 +40,8 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: return ( } title="Take resource ownership and redeploy" subtitle={`Ensure the resources belong to the '${appName}' application and the '${environmentName}' environment to avoid destructive changes.`} handleClose={handleClose} @@ -50,6 +54,7 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: isLoading, text: 'Re-deploy', onClick: handleDeploy, + style: ButtonStyleType.warning, }, }} /> diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx index 8206783b3..1959e4ffa 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -39,6 +39,7 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: await resourceConflictRedeploy({ pipelineId, triggerId, + appId, }) ToastManager.showToast({ variant: ToastVariantType.success, @@ -46,7 +47,7 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, }) handleClose() - history.push(`${URLS.APP}/${appId}/details/${envId}`) + history.push(`${URLS.APPLICATION_MANAGEMENT_APP}/${appId}/details/${envId}`) } catch (error) { showError(error) } finally { diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index 034d038bb..c29852e9e 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -472,6 +472,10 @@ const TriggerDetails = memo( setResourceConflictModal(ResourceConflictModalType.DEPLOY_DIALOG) } + const handleShowResourceConflictDetailsModal = () => { + setResourceConflictModal(ResourceConflictModalType.RESOURCE_DETAIL_MODAL) + } + const handleCloseRedeployModal = () => { setResourceConflictModal(null) } @@ -483,8 +487,9 @@ const TriggerDetails = memo( text="Some Resources" variant={ButtonVariantType.text} size={ComponentSizeType.medium} + onClick={handleShowResourceConflictDetailsModal} /> - +   have ownership conflict. Take resource ownership and re-deploy @@ -628,22 +633,24 @@ const TriggerDetails = memo( clusterId={executionInfo?.workerDetails.clusterId || DEFAULT_CLUSTER_ID} workerPodName={workerPodName} namespace={namespace} - /> + > + {showResourceConflictInfoBlock && ( +
+ , + onClick: handleShowRedeployModal, + variant: ButtonVariantType.text, + size: ComponentSizeType.medium, + }} + /> +
+ )} +
- - {showResourceConflictInfoBlock && ( -
- , - onClick: handleShowRedeployModal, - }} - /> -
- )}
diff --git a/src/Shared/Components/CICDHistory/WorkerStatus.tsx b/src/Shared/Components/CICDHistory/WorkerStatus.tsx index ccf7c79fa..69ce4d7bd 100644 --- a/src/Shared/Components/CICDHistory/WorkerStatus.tsx +++ b/src/Shared/Components/CICDHistory/WorkerStatus.tsx @@ -41,6 +41,7 @@ const WorkerStatus = memo( titleClassName = 'cn-9 fs-13 fw-4 lh-20', viewWorkerPodClassName = 'fs-13', hideShowMoreMessageButton = false, + children, }: WorkerStatusType): JSX.Element | null => { if (!message && !podStatus) { return null @@ -98,6 +99,8 @@ const WorkerStatus = memo( hideShowMore={hideShowMoreMessageButton} /> )} + + {children}
) diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index f8994a864..ae3508fa8 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -17,7 +17,15 @@ /* eslint-disable dot-notation */ import moment from 'moment' -import { get, getUrlWithSearchParams, ResponseType, ROUTES, sanitizeUserApprovalMetadata, trash } from '../../../Common' +import { + get, + getUrlWithSearchParams, + post, + ResponseType, + ROUTES, + sanitizeUserApprovalMetadata, + trash, +} from '../../../Common' import { DATE_TIME_FORMAT_STRING, DEPLOYMENT_HISTORY_CONFIGURATION_LIST_MAP, EXTERNAL_TYPES } from '../../constants' import { decode, getUniqueId, isNullOrUndefined } from '../../Helpers' import { ResourceKindType, ResourceVersionType } from '../../types' @@ -28,8 +36,9 @@ import { DeploymentStatusDetailsResponse, FetchIdDataStatus, ModuleConfigResponse, - ResourceConflictDeployDialogURLParamsType, ResourceConflictItemType, + ResourceConflictRedeployParamsType, + ResourceConflictRedeployPayloadType, TriggerDetailsResponseType, TriggerHistoryParamsType, } from './types' @@ -295,12 +304,13 @@ export const getTriggerHistory = async ({ export const getModuleConfigured = (moduleName: string): Promise => get(`${ROUTES.MODULE_CONFIGURED}?name=${moduleName}`) -export const resourceConflictRedeploy = async ({ - pipelineId, - triggerId, -}: Pick) => - // TODO: Fix the route - get(`cd-pipeline/re-deploy/${pipelineId}/${triggerId}`) +export const resourceConflictRedeploy = async ({ pipelineId, triggerId, appId }: ResourceConflictRedeployParamsType) => + post(ROUTES.CD_TRIGGER_POST, { + pipelineId: +pipelineId, + wfrId: +triggerId, + appId: +appId, + redeployHelmReleaseWithTakeOwnership: true, + }) export const getResourceConflictDetails = async (): Promise> => ({ code: 200, diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx index bd9adbf22..44a008c1e 100644 --- a/src/Shared/Components/CICDHistory/types.tsx +++ b/src/Shared/Components/CICDHistory/types.tsx @@ -409,6 +409,7 @@ export interface WorkerStatusType * @default false */ hideShowMoreMessageButton?: boolean + children?: ReactNode } export type FinishedType = { artifact: string; type: HistoryComponentType } & ( @@ -903,3 +904,13 @@ export interface CIPipelineSourceConfigInterface { primaryBranchAfterRegex?: string rootClassName?: string } + +export interface ResourceConflictRedeployParamsType + extends Pick {} + +export interface ResourceConflictRedeployPayloadType { + pipelineId: number + appId: number + wfrId: number + redeployHelmReleaseWithTakeOwnership: true +} From 60936efdb04e7039882658488176088761a665a9 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 14:53:47 +0530 Subject: [PATCH 04/15] feat: add resource conflict management components and enhance related functionality --- src/Common/API/reactQueryHooks.ts | 14 +- src/Common/Constants.ts | 1 + .../CICDHistory/ConflictedResourcesTable.scss | 9 ++ .../CICDHistory/ConflictedResourcesTable.tsx | 7 +- .../ResourceConflictDeployDialog.tsx | 2 +- .../ResourceConflictDetailsModal.tsx | 62 +++++---- .../Components/CICDHistory/TriggerDetails.tsx | 5 +- .../Components/CICDHistory/constants.tsx | 4 + src/Shared/Components/CICDHistory/service.tsx | 127 +++++++++++------- src/Shared/Components/CICDHistory/types.tsx | 62 ++++++--- src/Shared/Helpers.tsx | 23 +++- 11 files changed, 212 insertions(+), 104 deletions(-) create mode 100644 src/Shared/Components/CICDHistory/ConflictedResourcesTable.scss diff --git a/src/Common/API/reactQueryHooks.ts b/src/Common/API/reactQueryHooks.ts index 43d6fad14..4b1ceed8d 100644 --- a/src/Common/API/reactQueryHooks.ts +++ b/src/Common/API/reactQueryHooks.ts @@ -28,8 +28,18 @@ import { import { ServerErrors } from '@Common/ServerError' import { ResponseType } from '@Common/Types' -export const useQuery = ( - options: UseQueryOptions, ServerErrors, TData, TQueryKey>, +export const useQuery = < + TQueryFnData = unknown, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, + WrapWithResponseType extends boolean = true, +>( + options: UseQueryOptions< + WrapWithResponseType extends true ? ResponseType : TQueryFnData, + ServerErrors, + TData, + TQueryKey + >, ): UseQueryResult => rqUseQuery(options) export const useMutation = ( diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index ce392ca05..2436e2b84 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -162,6 +162,7 @@ export const ROUTES = { LICENSE_DATA: 'license/data', ENV: 'env', APP_METADATA: 'app-metadata', + RESOURCE_CONFLICTS_LIST: 'app/template/helm-ownership-conflicts', } as const export enum KEY_VALUE { diff --git a/src/Shared/Components/CICDHistory/ConflictedResourcesTable.scss b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.scss new file mode 100644 index 000000000..73ac26c03 --- /dev/null +++ b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.scss @@ -0,0 +1,9 @@ +[id*="table__resource-conflict-details"] { + .generic-table__row { + .generic-table__cell { + display: flex; + align-items: center; + padding: 10px 0; + } + } +} \ No newline at end of file diff --git a/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx index 3183b54e4..b8bd44ac6 100644 --- a/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx +++ b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx @@ -1,13 +1,14 @@ import { useMemo } from 'react' -import { noop } from '@Common/Helper' - import { FiltersTypeEnum, PaginationEnum, Table, TableViewWrapperProps } from '../Table' import { RowsType } from '../Table/types' import { CONFLICTED_RESOURCES_COLUMNS } from './constants' import { ConflictedResourcesTableProps, ResourceConflictItemType } from './types' +import './ConflictedResourcesTable.scss' + const Wrapper = ({ children }: TableViewWrapperProps) =>
{children}
+const filter = () => true const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourcesTableProps) => { const rows: RowsType = useMemo( @@ -39,7 +40,7 @@ const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourc }} filtersVariant={FiltersTypeEnum.STATE} ViewWrapper={Wrapper} - filter={noop} + filter={filter} /> ) } diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx index 4ff391ea4..7ff71c212 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx @@ -30,7 +30,7 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, }) handleClose() - history.push(`${URLS.APPLICATION_MANAGEMENT_APP}/${appId}/details/${envId}`) + history.push(`${URLS.APP}/${appId}/details/${envId}`) } catch (error) { showError(error) } finally { diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx index 1959e4ffa..85a4e7e30 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -13,7 +13,11 @@ import { Button, ButtonStyleType, ButtonVariantType } from '../Button' import { Icon } from '../Icon' import ConflictedResourcesTable from './ConflictedResourcesTable' import { getResourceConflictDetails, resourceConflictRedeploy } from './service' -import { ResourceConflictDeployDialogURLParamsType, ResourceConflictDetailsModalProps } from './types' +import { + ResourceConflictDeployDialogURLParamsType, + ResourceConflictDetailsModalProps, + ResourceConflictItemType, +} from './types' const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: ResourceConflictDetailsModalProps) => { const { appId, envId, pipelineId, triggerId } = useParams() @@ -24,11 +28,9 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: data: resourceConflictDetails, refetch: refetchResourceConflictDetails, error: resourceConflictDetailsError, - } = useQuery({ - queryKey: ['getResourceConflictDetails'], - // TODO: Signal - queryFn: () => getResourceConflictDetails(), - select: (data) => data.result, + } = useQuery({ + queryKey: ['getResourceConflictDetails', pipelineId, triggerId, appId], + queryFn: ({ signal }) => getResourceConflictDetails({ pipelineId, triggerId, appId, signal }), }) const [isDeploying, setIsDeploying] = useState(false) @@ -47,7 +49,7 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, }) handleClose() - history.push(`${URLS.APPLICATION_MANAGEMENT_APP}/${appId}/details/${envId}`) + history.push(`${URLS.APP}/${appId}/details/${envId}`) } catch (error) { showError(error) } finally { @@ -77,7 +79,7 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: />
-
+
-
-
diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index c29852e9e..52532acd3 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -491,7 +491,7 @@ const TriggerDetails = memo( />   - have ownership conflict. Take resource ownership and re-deploy + have ownership conflicts. Resolve by taking ownership and redeploying.
) @@ -635,8 +635,9 @@ const TriggerDetails = memo( namespace={namespace} > {showResourceConflictInfoBlock && ( -
+
> => ({ - code: 200, - result: [ - { - name: 'resource-1', - namespace: 'default', - gvk: { - Group: 'apps', - Version: 'v1', - Kind: 'Deployment', +export const getResourceConflictDetails = async ({ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + appId, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + pipelineId, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + triggerId, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + signal, +}: GetResourceConflictDetailsParamsType): Promise => { + // const { result } = await post( + // ROUTES.RESOURCE_CONFLICTS_LIST, + // { + // appId: +appId, + // pipelineId: +pipelineId, + // wfrId: +triggerId, + // }, + // { signal }, + // ) + + const MOCK_RESULT: ResourceConflictListItemDTO = { + clusterId: 1, + conflictingResources: [ + { + name: 'resource-1', + namespace: 'default', + groupVersionKind: { + Group: 'apps', + Version: 'v1', + Kind: 'Deployment', + }, }, - gvkTitle: 'Deployment', - clusterId: 1, - id: getUniqueId(), - }, - { - name: 'resource-2', - namespace: 'default', - gvk: { - Group: '', - Version: 'v1', - Kind: 'Service', + { + name: 'resource-2', + namespace: 'default', + groupVersionKind: { + Group: '', + Version: 'v1', + Kind: 'Service', + }, }, - gvkTitle: 'Service', - clusterId: 1, - id: getUniqueId(), - }, - { - name: 'resource-3', - namespace: 'default', - gvk: { - Group: 'apps', - Version: 'v1', - Kind: 'StatefulSet', + { + name: 'resource-3', + namespace: 'default', + groupVersionKind: { + Group: 'apps', + Version: 'v1', + Kind: 'StatefulSet', + }, }, - gvkTitle: 'StatefulSet', - clusterId: 1, - id: getUniqueId(), - }, - { - name: 'resource-4', - namespace: 'default', - gvk: { - Group: 'batch', - Version: 'v1', - Kind: 'Job', + { + name: 'resource-4', + namespace: 'default', + groupVersionKind: { + Group: 'batch', + Version: 'v1', + Kind: 'Job', + }, }, - gvkTitle: 'Job', - clusterId: 1, - id: getUniqueId(), + ], + } + + return (MOCK_RESULT?.conflictingResources || []).map((resource) => ({ + name: resource.name || '', + namespace: resource.namespace || '', + gvk: { + Group: resource.groupVersionKind.Group || K8S_EMPTY_GROUP, + Version: resource.groupVersionKind.Version || '', + Kind: resource.groupVersionKind.Kind || ('' as GVKType['Kind']), }, - ], - status: 'OK', -}) + gvkTitle: getGVKTitle(resource.groupVersionKind), + clusterId: MOCK_RESULT.clusterId, + id: getUniqueId(), + })) +} diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx index 44a008c1e..56beb9d31 100644 --- a/src/Shared/Components/CICDHistory/types.tsx +++ b/src/Shared/Components/CICDHistory/types.tsx @@ -356,30 +356,11 @@ export interface ResourceConflictDeployDialogProps extends ResourceConflictDialo export interface ResourceConflictDetailsModalProps extends ResourceConflictDialogBaseProps {} -export interface ResourceConflictItemType { - name: string - namespace: string - gvk: GVKType - gvkTitle: string - clusterId: number - /** - * Generated at ui - */ - id: string -} - -export interface ConflictedResourcesTableProps { - resourceConflictDetails: ResourceConflictItemType[] -} - export interface TriggerOutputURLParamsType extends Pick { triggerId: string pipelineId: string } -export interface ResourceConflictDeployDialogURLParamsType - extends Pick {} - export type ProgressingStatusType = { stage: DeploymentStageType type: HistoryComponentType @@ -905,6 +886,25 @@ export interface CIPipelineSourceConfigInterface { rootClassName?: string } +export interface ResourceConflictItemType { + name: string + namespace: string + gvk: GVKType + gvkTitle: string + clusterId: number + /** + * Generated at ui + */ + id: string +} + +export interface ConflictedResourcesTableProps { + resourceConflictDetails: ResourceConflictItemType[] +} + +export interface ResourceConflictDeployDialogURLParamsType + extends Pick {} + export interface ResourceConflictRedeployParamsType extends Pick {} @@ -914,3 +914,27 @@ export interface ResourceConflictRedeployPayloadType { wfrId: number redeployHelmReleaseWithTakeOwnership: true } + +export interface GetResourceConflictDetailsParamsType + extends Pick { + signal: AbortSignal +} + +export interface GetResourceListItemPayloadType { + pipelineId: number + appId: number + wfrId: number +} + +export interface ResourceConflictListItemDTO { + clusterId: number + conflictingResources: { + name: string + namespace: string + groupVersionKind: { + Group: string + Version: string + Kind: NodeType + } + }[] +} diff --git a/src/Shared/Helpers.tsx b/src/Shared/Helpers.tsx index cfad6edf5..5863e920f 100644 --- a/src/Shared/Helpers.tsx +++ b/src/Shared/Helpers.tsx @@ -51,7 +51,7 @@ import { UserApprovalInfo, ZERO_TIME_STRING, } from '../Common' -import { getAggregator } from '../Pages' +import { getAggregator, GVKType } from '../Pages' import { AggregatedNodes, PodMetadatum } from './Components' import { CUBIC_BEZIER_CURVE, UNSAVED_CHANGES_PROMPT_MESSAGE } from './constants' import { @@ -727,3 +727,24 @@ export const getGroupVersionFromApiVersion = (apiVersion: string): Pick { + if (!gvk) { + return '' + } + + let title: string = '' + if (gvk.Group) { + title += gvk.Group + } + + if (gvk.Version) { + title += title ? ` / ${gvk.Version}` : gvk.Version + } + + if (gvk.Kind) { + title += title ? ` / ${gvk.Kind}` : gvk.Kind + } + + return title +} From 2236a28212060e9ae7ac69651ace2e1d71cc8b65 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 15:13:22 +0530 Subject: [PATCH 05/15] feat: enhance ConflictedResourcesTable styling and improve resource conflict details fetching --- .../CICDHistory/ConflictedResourcesTable.tsx | 4 +- src/Shared/Components/CICDHistory/service.tsx | 69 +++---------------- 2 files changed, 14 insertions(+), 59 deletions(-) diff --git a/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx index b8bd44ac6..238293eae 100644 --- a/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx +++ b/src/Shared/Components/CICDHistory/ConflictedResourcesTable.tsx @@ -7,7 +7,9 @@ import { ConflictedResourcesTableProps, ResourceConflictItemType } from './types import './ConflictedResourcesTable.scss' -const Wrapper = ({ children }: TableViewWrapperProps) =>
{children}
+const Wrapper = ({ children }: TableViewWrapperProps) => ( +
{children}
+) const filter = () => true const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourcesTableProps) => { diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index 73cc71af2..91d458157 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -38,7 +38,6 @@ import { DeploymentStatusDetailsResponse, FetchIdDataStatus, GetResourceConflictDetailsParamsType, - // eslint-disable-next-line @typescript-eslint/no-unused-vars GetResourceListItemPayloadType, ModuleConfigResponse, ResourceConflictItemType, @@ -319,68 +318,22 @@ export const resourceConflictRedeploy = async ({ pipelineId, triggerId, appId }: }) export const getResourceConflictDetails = async ({ - // eslint-disable-next-line @typescript-eslint/no-unused-vars appId, - // eslint-disable-next-line @typescript-eslint/no-unused-vars pipelineId, - // eslint-disable-next-line @typescript-eslint/no-unused-vars triggerId, - // eslint-disable-next-line @typescript-eslint/no-unused-vars signal, }: GetResourceConflictDetailsParamsType): Promise => { - // const { result } = await post( - // ROUTES.RESOURCE_CONFLICTS_LIST, - // { - // appId: +appId, - // pipelineId: +pipelineId, - // wfrId: +triggerId, - // }, - // { signal }, - // ) - - const MOCK_RESULT: ResourceConflictListItemDTO = { - clusterId: 1, - conflictingResources: [ - { - name: 'resource-1', - namespace: 'default', - groupVersionKind: { - Group: 'apps', - Version: 'v1', - Kind: 'Deployment', - }, - }, - { - name: 'resource-2', - namespace: 'default', - groupVersionKind: { - Group: '', - Version: 'v1', - Kind: 'Service', - }, - }, - { - name: 'resource-3', - namespace: 'default', - groupVersionKind: { - Group: 'apps', - Version: 'v1', - Kind: 'StatefulSet', - }, - }, - { - name: 'resource-4', - namespace: 'default', - groupVersionKind: { - Group: 'batch', - Version: 'v1', - Kind: 'Job', - }, - }, - ], - } + const { result } = await post( + ROUTES.RESOURCE_CONFLICTS_LIST, + { + appId: +appId, + pipelineId: +pipelineId, + wfrId: +triggerId, + }, + { signal }, + ) - return (MOCK_RESULT?.conflictingResources || []).map((resource) => ({ + return (result?.conflictingResources || []).map((resource) => ({ name: resource.name || '', namespace: resource.namespace || '', gvk: { @@ -389,7 +342,7 @@ export const getResourceConflictDetails = async ({ Kind: resource.groupVersionKind.Kind || ('' as GVKType['Kind']), }, gvkTitle: getGVKTitle(resource.groupVersionKind), - clusterId: MOCK_RESULT.clusterId, + clusterId: result.clusterId, id: getUniqueId(), })) } From 13407fd56a035ef78d26dc37ba83ce16d53fe954 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 15:14:14 +0530 Subject: [PATCH 06/15] fix: update alignment of content in ResourceConflictDetailsModal --- .../Components/CICDHistory/ResourceConflictDetailsModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx index 85a4e7e30..3562020b6 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -97,7 +97,7 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }:
-
+
From ddf9e212b707b4e9e48e0abdeee331530ed39360 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 16:35:17 +0530 Subject: [PATCH 07/15] fix: disable deploy button when no resource conflict details are available --- .../Components/CICDHistory/ResourceConflictDetailsModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx index 3562020b6..be01fc32a 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -119,7 +119,11 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: text="Re-deploy" startIcon={} isLoading={isDeploying} - disabled={!!resourceConflictDetailsError || isLoadingResourceData} + disabled={ + !!resourceConflictDetailsError || + isLoadingResourceData || + resourceConflictDetails?.length === 0 + } onClick={handleDeploy} />
From b907e3f0a085987d2bb3f1e6081ed7962b2d665d Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 16:51:12 +0530 Subject: [PATCH 08/15] fix: rename wfrId to wfrIdForDeploymentWithSpecificTrigger in redeploy payload --- src/Shared/Components/CICDHistory/service.tsx | 2 +- src/Shared/Components/CICDHistory/types.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index 91d458157..12e140f9d 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -312,7 +312,7 @@ export const getModuleConfigured = (moduleName: string): Promise post(ROUTES.CD_TRIGGER_POST, { pipelineId: +pipelineId, - wfrId: +triggerId, + wfrIdForDeploymentWithSpecificTrigger: +triggerId, appId: +appId, redeployHelmReleaseWithTakeOwnership: true, }) diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx index 56beb9d31..c3f476c03 100644 --- a/src/Shared/Components/CICDHistory/types.tsx +++ b/src/Shared/Components/CICDHistory/types.tsx @@ -911,7 +911,7 @@ export interface ResourceConflictRedeployParamsType export interface ResourceConflictRedeployPayloadType { pipelineId: number appId: number - wfrId: number + wfrIdForDeploymentWithSpecificTrigger: number redeployHelmReleaseWithTakeOwnership: true } From 2bb1aede0f5bdb3a3ae3fd46248b5037b523a80f Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Mon, 8 Dec 2025 17:38:06 +0530 Subject: [PATCH 09/15] fix: remove toast notifications from redeploy functions and update artifactId handling --- .../CICDHistory/ResourceConflictDeployDialog.tsx | 7 ------- .../CICDHistory/ResourceConflictDetailsModal.tsx | 13 +------------ .../Components/CICDHistory/TriggerDetails.tsx | 4 ++-- .../Components/CICDHistory/TriggerOutput.tsx | 9 +++++---- src/Shared/Components/CICDHistory/service.tsx | 16 ++++++++++++++-- 5 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx index 7ff71c212..f9a9ec421 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx @@ -3,7 +3,6 @@ import { useHistory, useParams } from 'react-router-dom' import { URLS } from '@Common/Constants' import { showError } from '@Common/Helper' -import { ToastManager, ToastVariantType } from '@Shared/Services' import { ButtonStyleType } from '../Button' import { ConfirmationModal, ConfirmationModalVariantType } from '../ConfirmationModal' @@ -24,12 +23,6 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: triggerId, appId, }) - ToastManager.showToast({ - variant: ToastVariantType.success, - title: 'Redeploy initiated', - description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, - }) - handleClose() history.push(`${URLS.APP}/${appId}/details/${envId}`) } catch (error) { showError(error) diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx index be01fc32a..461240e24 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -6,7 +6,6 @@ import { URLS } from '@Common/Constants' import { Drawer } from '@Common/Drawer' import { showError, stopPropagation } from '@Common/Helper' import { ComponentSizeType } from '@Shared/constants' -import { ToastManager, ToastVariantType } from '@Shared/Services' import { APIResponseHandler } from '../APIResponseHandler' import { Button, ButtonStyleType, ButtonVariantType } from '../Button' @@ -43,12 +42,6 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: triggerId, appId, }) - ToastManager.showToast({ - variant: ToastVariantType.success, - title: 'Redeploy initiated', - description: `Redeployment for application '${appName}' in environment '${environmentName}' has been initiated successfully.`, - }) - handleClose() history.push(`${URLS.APP}/${appId}/details/${envId}`) } catch (error) { showError(error) @@ -119,11 +112,7 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: text="Re-deploy" startIcon={} isLoading={isDeploying} - disabled={ - !!resourceConflictDetailsError || - isLoadingResourceData || - resourceConflictDetails?.length === 0 - } + disabled={!resourceConflictDetails?.length} onClick={handleDeploy} />
diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index 52532acd3..b3c59649f 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -468,7 +468,7 @@ const TriggerDetails = memo( stage === DeploymentStageType.DEPLOY && errorMessage?.includes(RESOURCE_CONFLICT_DEPLOY_ERROR) - const handleShowRedeployModal = () => { + const handleShowRedeployDialog = () => { setResourceConflictModal(ResourceConflictModalType.DEPLOY_DIALOG) } @@ -643,7 +643,7 @@ const TriggerDetails = memo( dataTestId: 'resource-conflict-re-deploy', text: 'Re-deploy', startIcon: , - onClick: handleShowRedeployModal, + onClick: handleShowRedeployDialog, variant: ButtonVariantType.text, size: ComponentSizeType.medium, }} diff --git a/src/Shared/Components/CICDHistory/TriggerOutput.tsx b/src/Shared/Components/CICDHistory/TriggerOutput.tsx index 7f5c94c14..df565dcae 100644 --- a/src/Shared/Components/CICDHistory/TriggerOutput.tsx +++ b/src/Shared/Components/CICDHistory/TriggerOutput.tsx @@ -261,7 +261,6 @@ const TriggerOutput = ({ ) const targetPlatforms = sanitizeTargetPlatforms(triggerDetails?.targetPlatforms) - const artifactId = triggerDetailsResult?.result?.artifactId || triggerDetails?.artifactId // Function to sync the trigger details as trigger details is also fetched with another api const syncState = (syncTriggerId: number, syncTriggerDetail: History, syncTriggerDetailsError: ServerError) => { @@ -308,10 +307,12 @@ const TriggerOutput = ({ () => getTagDetails({ pipelineId, - artifactId, + artifactId: triggerDetailsResult?.result?.artifactId || triggerDetails?.artifactId, }), [pipelineId, triggerId], - areTagDetailsRequired && !!pipelineId && !!artifactId, + areTagDetailsRequired && + !!pipelineId && + (!!triggerDetailsResult?.result?.artifactId || !!triggerDetails?.artifactId), ) useEffect(() => { @@ -429,7 +430,7 @@ const TriggerOutput = ({ setFullScreenView={setFullScreenView} deploymentAppType={deploymentAppType} isBlobStorageConfigured={isBlobStorageConfigured} - artifactId={artifactId} + artifactId={triggerDetailsResult?.result?.artifactId} ciPipelineId={triggerDetailsResult?.result?.ciPipelineId} appReleaseTags={appReleaseTags} tagsEditable={tagsEditable} diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index 12e140f9d..48b710908 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -17,6 +17,7 @@ /* eslint-disable dot-notation */ import moment from 'moment' +import { ToastManager, ToastVariantType } from '@Shared/Services' import { GVKType, K8S_EMPTY_GROUP } from '@Pages/ResourceBrowser' import { @@ -309,14 +310,25 @@ export const getTriggerHistory = async ({ export const getModuleConfigured = (moduleName: string): Promise => get(`${ROUTES.MODULE_CONFIGURED}?name=${moduleName}`) -export const resourceConflictRedeploy = async ({ pipelineId, triggerId, appId }: ResourceConflictRedeployParamsType) => - post(ROUTES.CD_TRIGGER_POST, { +export const resourceConflictRedeploy = async ({ + pipelineId, + triggerId, + appId, +}: ResourceConflictRedeployParamsType) => { + await post(ROUTES.CD_TRIGGER_POST, { pipelineId: +pipelineId, wfrIdForDeploymentWithSpecificTrigger: +triggerId, appId: +appId, redeployHelmReleaseWithTakeOwnership: true, }) + ToastManager.showToast({ + variant: ToastVariantType.success, + title: 'Redeployment initiated', + description: 'Redeployment for application has been successfully initiated.', + }) +} + export const getResourceConflictDetails = async ({ appId, pipelineId, From d8f791135c33f52ede53473bd96577b998037ffe Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Wed, 10 Dec 2025 18:22:39 +0530 Subject: [PATCH 10/15] fix: update resource conflict routes and payload structure for redeployment --- src/Common/Constants.ts | 2 +- src/Shared/Components/CICDHistory/service.tsx | 17 ++++++++--------- src/Shared/Components/CICDHistory/types.tsx | 8 +------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index 2436e2b84..39127a5a9 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -162,7 +162,7 @@ export const ROUTES = { LICENSE_DATA: 'license/data', ENV: 'env', APP_METADATA: 'app-metadata', - RESOURCE_CONFLICTS_LIST: 'app/template/helm-ownership-conflicts', + RESOURCE_CONFLICTS_LIST: 'app/:appId/cd-pipeline/:pipelineId/history/:wfrId/helm-ownership-conflicts', } as const export enum KEY_VALUE { diff --git a/src/Shared/Components/CICDHistory/service.tsx b/src/Shared/Components/CICDHistory/service.tsx index 48b710908..1a85c464d 100644 --- a/src/Shared/Components/CICDHistory/service.tsx +++ b/src/Shared/Components/CICDHistory/service.tsx @@ -15,6 +15,7 @@ */ /* eslint-disable dot-notation */ +import { generatePath } from 'react-router-dom' import moment from 'moment' import { ToastManager, ToastVariantType } from '@Shared/Services' @@ -39,7 +40,6 @@ import { DeploymentStatusDetailsResponse, FetchIdDataStatus, GetResourceConflictDetailsParamsType, - GetResourceListItemPayloadType, ModuleConfigResponse, ResourceConflictItemType, ResourceConflictListItemDTO, @@ -319,7 +319,7 @@ export const resourceConflictRedeploy = async ({ pipelineId: +pipelineId, wfrIdForDeploymentWithSpecificTrigger: +triggerId, appId: +appId, - redeployHelmReleaseWithTakeOwnership: true, + helmRedeploymentRequest: true, }) ToastManager.showToast({ @@ -335,13 +335,12 @@ export const getResourceConflictDetails = async ({ triggerId, signal, }: GetResourceConflictDetailsParamsType): Promise => { - const { result } = await post( - ROUTES.RESOURCE_CONFLICTS_LIST, - { - appId: +appId, - pipelineId: +pipelineId, - wfrId: +triggerId, - }, + const { result } = await get( + generatePath(ROUTES.RESOURCE_CONFLICTS_LIST, { + appId, + pipelineId, + wfrId: triggerId, + }), { signal }, ) diff --git a/src/Shared/Components/CICDHistory/types.tsx b/src/Shared/Components/CICDHistory/types.tsx index c3f476c03..58a299b95 100644 --- a/src/Shared/Components/CICDHistory/types.tsx +++ b/src/Shared/Components/CICDHistory/types.tsx @@ -912,7 +912,7 @@ export interface ResourceConflictRedeployPayloadType { pipelineId: number appId: number wfrIdForDeploymentWithSpecificTrigger: number - redeployHelmReleaseWithTakeOwnership: true + helmRedeploymentRequest: true } export interface GetResourceConflictDetailsParamsType @@ -920,12 +920,6 @@ export interface GetResourceConflictDetailsParamsType signal: AbortSignal } -export interface GetResourceListItemPayloadType { - pipelineId: number - appId: number - wfrId: number -} - export interface ResourceConflictListItemDTO { clusterId: number conflictingResources: { From c4c75154f23233634303c60de748cedd1b120a92 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Thu, 11 Dec 2025 13:24:24 +0530 Subject: [PATCH 11/15] fix: update version to 1.21.0-beta-4 in package.json and package-lock.json --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index db4615668..9a3b93b6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.21.0", + "version": "1.21.0-beta-4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.21.0", + "version": "1.21.0-beta-4", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 8a89ce40c..16d2554b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.21.0", + "version": "1.21.0-beta-4", "description": "Supporting common component library", "type": "module", "main": "dist/index.js", From a45a0970d692a7e98085d6fb61746569a9665037 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Fri, 12 Dec 2025 16:40:39 +0530 Subject: [PATCH 12/15] fix: integrate useMainContext to conditionally display resource conflict info in TriggerDetails --- src/Shared/Components/CICDHistory/TriggerDetails.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index b3c59649f..f6077a595 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -26,6 +26,7 @@ import { ZERO_TIME_STRING } from '@Common/Constants' import { CommitChipCell } from '@Shared/Components/CommitChipCell' import { ImageChipCell } from '@Shared/Components/ImageChipCell' import { getHandleOpenURL } from '@Shared/Helpers' +import { useMainContext } from '@Shared/Providers' import { ToastManager, ToastVariantType } from '@Shared/Services' import { getDeploymentStageTitle } from '@Pages/Applications' @@ -453,6 +454,8 @@ const TriggerDetails = memo( isLatest, appName, }: TriggerDetailsType) => { + const { isFELibAvailable } = useMainContext() + const [resourceConflictModal, setResourceConflictModal] = useState(null) const executionInfo = useMemo( @@ -463,6 +466,7 @@ const TriggerDetails = memo( const errorMessage = executionInfo?.workerDetails.message || message const showResourceConflictInfoBlock = + isFELibAvailable && isLatest && (type === HistoryComponentType.CD || type === HistoryComponentType.GROUP_CD) && stage === DeploymentStageType.DEPLOY && From 87b59cc06ed1dd71040dd780e1cee89fca0eaea2 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Fri, 12 Dec 2025 16:41:34 +0530 Subject: [PATCH 13/15] fix: update version to 1.21.1 in package.json and package-lock.json --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a3b93b6f..f4bb8517d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.21.0-beta-4", + "version": "1.21.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.21.0-beta-4", + "version": "1.21.1", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 16d2554b7..e3506004c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.21.0-beta-4", + "version": "1.21.1", "description": "Supporting common component library", "type": "module", "main": "dist/index.js", From 4c73a760210a6402f7d9807a40d054f6c86a6785 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Fri, 12 Dec 2025 16:46:19 +0530 Subject: [PATCH 14/15] fix: streamline loading state handling in ResourceConflictDeployDialog and ResourceConflictDetailsModal --- .../Components/CICDHistory/ResourceConflictDeployDialog.tsx | 2 +- .../Components/CICDHistory/ResourceConflictDetailsModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx index f9a9ec421..7310d994e 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDeployDialog.tsx @@ -23,10 +23,10 @@ const ResourceConflictDeployDialog = ({ appName, environmentName, handleClose }: triggerId, appId, }) + setIsLoading(false) history.push(`${URLS.APP}/${appId}/details/${envId}`) } catch (error) { showError(error) - } finally { setIsLoading(false) } } diff --git a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx index 461240e24..8ca373b72 100644 --- a/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx +++ b/src/Shared/Components/CICDHistory/ResourceConflictDetailsModal.tsx @@ -42,10 +42,10 @@ const ResourceConflictDetailsModal = ({ appName, environmentName, handleClose }: triggerId, appId, }) + setIsDeploying(false) history.push(`${URLS.APP}/${appId}/details/${envId}`) } catch (error) { showError(error) - } finally { setIsDeploying(false) } } From 0f1d57f454dec0e1928b9f329679fadfc546bdf5 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Fri, 12 Dec 2025 16:49:45 +0530 Subject: [PATCH 15/15] fix: update button styles to warning in TriggerDetails component --- src/Shared/Components/CICDHistory/TriggerDetails.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Shared/Components/CICDHistory/TriggerDetails.tsx b/src/Shared/Components/CICDHistory/TriggerDetails.tsx index f6077a595..c6166c105 100644 --- a/src/Shared/Components/CICDHistory/TriggerDetails.tsx +++ b/src/Shared/Components/CICDHistory/TriggerDetails.tsx @@ -491,6 +491,7 @@ const TriggerDetails = memo( text="Some Resources" variant={ButtonVariantType.text} size={ComponentSizeType.medium} + style={ButtonStyleType.warning} onClick={handleShowResourceConflictDetailsModal} />   @@ -649,6 +650,7 @@ const TriggerDetails = memo( startIcon: , onClick: handleShowRedeployDialog, variant: ButtonVariantType.text, + style: ButtonStyleType.warning, size: ComponentSizeType.medium, }} />