Skip to content

Commit ba36288

Browse files
committed
refactor: clean up deployment status handling and remove deprecated constants
1 parent ca2d42b commit ba36288

File tree

8 files changed

+27
-101
lines changed

8 files changed

+27
-101
lines changed

src/components/app/details/appDetails/AppDetails.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import {
2626
Button,
2727
ButtonComponentType,
2828
DeploymentAppTypes,
29+
DeploymentStatusDetailsBreakdownDataType,
30+
DeploymentStatusDetailsType,
2931
GenericEmptyState,
3032
getAppDetailsURL,
3133
getAppsInfoForEnv,
@@ -51,12 +53,10 @@ import noGroups from '@Images/[email protected]'
5153

5254
import {
5355
DEFAULT_STATUS,
54-
DEFAULT_STATUS_TEXT,
5556
DEPLOYMENT_STATUS,
5657
DEPLOYMENT_STATUS_QUERY_PARAM,
5758
DOCUMENTATION,
5859
getAppTriggerURL,
59-
HELM_DEPLOYMENT_STATUS_TEXT,
6060
RESOURCES_NOT_FOUND,
6161
} from '../../../../config'
6262
import { APP_DETAILS, ERROR_EMPTY_SCREEN } from '../../../../config/constantMessaging'
@@ -84,8 +84,6 @@ import { getDeploymentStatusDetail } from './appDetails.service'
8484
import {
8585
AppDetailProps,
8686
DeletedAppComponentType,
87-
DeploymentStatusDetailsBreakdownDataType,
88-
DeploymentStatusDetailsType,
8987
DetailsType,
9088
ErrorItem,
9189
HibernationModalTypes,
@@ -288,7 +286,6 @@ const Details: React.FC<DetailsType> = ({
288286
? processVirtualEnvironmentDeploymentData()
289287
: processDeploymentStatusDetailsData()),
290288
deploymentStatus: DEFAULT_STATUS,
291-
deploymentStatusText: DEFAULT_STATUS_TEXT,
292289
})
293290
const isConfigDriftEnabled: boolean = window._env_.FEATURE_CONFIG_DRIFT_ENABLE && !!ConfigDriftModal
294291
const isExternalToolAvailable: boolean =
@@ -487,10 +484,7 @@ const Details: React.FC<DetailsType> = ({
487484
...deploymentStatusDetailsBreakdownData,
488485
deploymentStatus:
489486
DEPLOYMENT_STATUS[deploymentStatusDetailRes.result.wfrStatus?.toUpperCase()],
490-
deploymentStatusText:
491-
deploymentStatusDetailRes.result.wfrStatus === HELM_DEPLOYMENT_STATUS_TEXT.PROGRESSING
492-
? HELM_DEPLOYMENT_STATUS_TEXT.INPROGRESS
493-
: deploymentStatusDetailRes.result.wfrStatus,
487+
// TODO: Need to confirm while review why we parse progressing to in progress?
494488
deploymentTriggerTime: deploymentStatusDetailRes.result.deploymentStartedOn,
495489
deploymentEndTime: deploymentStatusDetailRes.result.deploymentFinishedOn,
496490
triggeredBy: deploymentStatusDetailRes.result.triggeredBy,

src/components/app/details/appDetails/DeploymentStatusCard.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ import React from 'react'
1818
import { useHistory } from 'react-router-dom'
1919
import Tippy from '@tippyjs/react'
2020

21+
import { DEPLOYMENT_STATUS_TEXT_MAP, PROGRESSING_DEPLOYMENT_STATUS } from '@devtron-labs/devtron-fe-common-lib'
22+
2123
import { ReactComponent as CD } from '../../../../assets/icons/ic-CD.svg'
2224
import { ReactComponent as ICHelpOutline } from '../../../../assets/icons/ic-help-outline.svg'
2325
import { ReactComponent as Rocket } from '../../../../assets/icons/ic-paper-rocket.svg'
24-
import { DEPLOYMENT_STATUS, DEPLOYMENT_STATUS_QUERY_PARAM } from '../../../../config'
26+
import { DEPLOYMENT_STATUS_QUERY_PARAM } from '../../../../config'
2527
import { DeploymentStatusCardType } from './appDetails.type'
2628
import LoadingCard from './LoadingCard'
2729
import { validateMomentDate } from './utils'
@@ -41,16 +43,9 @@ const DeploymentStatusCard = ({
4143
search: DEPLOYMENT_STATUS_QUERY_PARAM,
4244
})
4345
}
44-
const ProgressingStateList: string[] = [
45-
DEPLOYMENT_STATUS.INPROGRESS,
46-
DEPLOYMENT_STATUS.PROGRESSING,
47-
DEPLOYMENT_STATUS.STARTING,
48-
DEPLOYMENT_STATUS.INITIATING,
49-
DEPLOYMENT_STATUS.CHECKING,
50-
]
46+
5147
const renderDeploymentStatus = () => {
52-
const { triggeredBy, deploymentStatus, deploymentTriggerTime, deploymentStatusText } =
53-
deploymentStatusDetailsBreakdownData
48+
const { triggeredBy, deploymentStatus, deploymentTriggerTime } = deploymentStatusDetailsBreakdownData
5449
return (
5550
<>
5651
<div className="app-details-info-card__top-container flex">
@@ -73,10 +68,10 @@ const DeploymentStatusCard = ({
7368
<span
7469
data-testid="deployment-status-name"
7570
className={`app-summary__status-name fs-13 mr-8 fw-6 f-${deploymentStatus?.toLowerCase()} ${
76-
ProgressingStateList.includes(deploymentStatus) ? 'dc__loading-dots' : ''
71+
PROGRESSING_DEPLOYMENT_STATUS.includes(deploymentStatus) ? 'dc__loading-dots' : ''
7772
}`}
7873
>
79-
{deploymentStatusText}
74+
{DEPLOYMENT_STATUS_TEXT_MAP[deploymentStatus] || deploymentStatus}
8075
</span>
8176
</div>
8277
</div>

src/components/app/details/appDetails/appDetails.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { get, getUrlWithSearchParams, ResponseType, trash } from '@devtron-labs/devtron-fe-common-lib'
17+
import {
18+
DeploymentStatusDetailsResponse,
19+
get,
20+
getUrlWithSearchParams,
21+
ResponseType,
22+
trash,
23+
} from '@devtron-labs/devtron-fe-common-lib'
1824

1925
import { Routes } from '../../../../config'
2026
import { fetchWithFullRoute } from '../../../../services/fetchWithFullRoute'
@@ -24,7 +30,6 @@ import {
2430
DataSourceDetailsDTO,
2531
DataSourceDetailsQueryParams,
2632
DataSourceDetailsType,
27-
DeploymentStatusDetailsResponse,
2833
ModuleConfigResponse,
2934
} from './appDetails.type'
3035

src/components/app/details/appDetails/appDetails.type.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import {
1818
ACTION_STATE,
1919
AppEnvironment,
20+
DeploymentStatusDetailsBreakdownDataType,
2021
EnvAppsMetaDTO,
2122
ResponseType,
2223
ScanResultDTO,
@@ -83,48 +84,6 @@ export interface DeploymentStatusDetailsTimelineType {
8384
resourceDetails?: SyncStageResourceDetail[]
8485
}
8586

86-
export interface DeploymentStatusDetailsType {
87-
deploymentFinishedOn: string
88-
deploymentStartedOn: string
89-
triggeredBy: string
90-
statusFetchCount: number
91-
statusLastFetchedAt: string
92-
timelines: DeploymentStatusDetailsTimelineType[]
93-
wfrStatus?: string
94-
}
95-
96-
export interface DeploymentStatusDetailsResponse extends ResponseType {
97-
result?: DeploymentStatusDetailsType
98-
}
99-
100-
interface DeploymentStatusDetailRow {
101-
icon: string
102-
displayText: string
103-
displaySubText: string
104-
time: string
105-
resourceDetails?: any
106-
isCollapsed?: boolean
107-
kubeList?: { icon: any; message: string }[]
108-
timelineStatus?: string
109-
}
110-
export interface DeploymentStatusDetailsBreakdownDataType {
111-
deploymentStatus: string
112-
deploymentStatusText: string
113-
deploymentTriggerTime: string
114-
deploymentEndTime: string
115-
deploymentError: string
116-
triggeredBy: string
117-
nonDeploymentError: string
118-
deploymentStatusBreakdown: {
119-
DEPLOYMENT_INITIATED: DeploymentStatusDetailRow
120-
GIT_COMMIT?: DeploymentStatusDetailRow
121-
ARGOCD_SYNC?: DeploymentStatusDetailRow
122-
KUBECTL_APPLY?: DeploymentStatusDetailRow
123-
APP_HEALTH?: DeploymentStatusDetailRow
124-
HELM_PACKAGE_GENERATED?: DeploymentStatusDetailRow
125-
}
126-
}
127-
12887
export interface ModuleConfigResponse extends ResponseType {
12988
result?: {
13089
enabled: boolean

src/components/app/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ import {
2929
TagsTableColumnsType,
3030
DynamicDataTableCellErrorType,
3131
BaseAppMetaData,
32+
DeploymentStatusDetailsBreakdownDataType,
3233
} from '@devtron-labs/devtron-fe-common-lib'
33-
import { DeploymentStatusDetailsBreakdownDataType, DetailsType, ErrorItem, HibernationModalTypes } from './details/appDetails/appDetails.type'
34+
import { DetailsType, ErrorItem, HibernationModalTypes } from './details/appDetails/appDetails.type'
3435
import { GroupFilterType } from '../ApplicationGroup/AppGroup.types'
3536
import { APP_TYPE } from '@Config/constants'
3637
import { CreateAppFormStateType } from '@Pages/App/CreateAppModal/types'

src/components/v2/appDetails/AppDetails.component.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@ import {
2121
AppStatusModal,
2222
AppStatusModalTabType,
2323
DeploymentAppTypes,
24+
DeploymentStatusDetailsBreakdownDataType,
25+
DeploymentStatusDetailsType,
2426
noop,
2527
processDeploymentStatusDetailsData,
2628
Progressing,
2729
} from '@devtron-labs/devtron-fe-common-lib'
2830

2931
import { ClusterMetaDataBar } from '@Components/common/ClusterMetaDataBar/ClusterMetaDataBar'
3032

31-
import { DEFAULT_STATUS, DEFAULT_STATUS_TEXT, DEPLOYMENT_STATUS, DEPLOYMENT_STATUS_QUERY_PARAM } from '../../../config'
33+
import { DEFAULT_STATUS, DEPLOYMENT_STATUS, DEPLOYMENT_STATUS_QUERY_PARAM } from '../../../config'
3234
import { getDeploymentStatusDetail } from '../../app/details/appDetails/appDetails.service'
33-
import {
34-
DeploymentStatusDetailsBreakdownDataType,
35-
DeploymentStatusDetailsType,
36-
} from '../../app/details/appDetails/appDetails.type'
3735
import { importComponentFromFELibrary } from '../../common'
3836
import { AppLevelExternalLinks } from '../../externalLinks/ExternalLinks.component'
3937
import { useSharedState } from '../utils/useSharedState'
@@ -84,7 +82,6 @@ const AppDetailsComponent = ({
8482
? processVirtualEnvironmentDeploymentData()
8583
: processDeploymentStatusDetailsData()),
8684
deploymentStatus: DEFAULT_STATUS,
87-
deploymentStatusText: DEFAULT_STATUS_TEXT,
8885
})
8986

9087
useEffect(() => {

src/components/v2/appDetails/sourceInfo/environment.type.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
import React from 'react'
1818

19-
import { AppEnvironment as BaseAppEnvironmentType } from '@devtron-labs/devtron-fe-common-lib'
19+
import {
20+
AppEnvironment as BaseAppEnvironmentType,
21+
DeploymentStatusDetailsBreakdownDataType,
22+
} from '@devtron-labs/devtron-fe-common-lib'
2023

21-
import { DeploymentStatusDetailsBreakdownDataType } from '../../../app/details/appDetails/appDetails.type'
2224
import { HelmReleaseStatus } from '../../../external-apps/ExternalAppService'
2325
import { AppDetails } from '../appDetails.type'
2426

src/config/constants.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
RegistryCredentialsType,
2525
} from '@devtron-labs/devtron-fe-common-lib'
2626
export const DEFAULT_STATUS = 'checking'
27-
export const DEFAULT_STATUS_TEXT = 'Checking Status'
2827
export const DEFAULTK8SVERSION = 'v1.16.0'
2928
export const TOKEN_COOKIE_NAME = 'argocd.token'
3029
export const DEVTRON_DEFAULT_RELEASE_NAME = 'devtron'
@@ -696,32 +695,6 @@ export const CHART_REPO_LABEL = [
696695
{ value: 'PRIVATE', label: 'Private repository' },
697696
]
698697

699-
/**
700-
* @deprecated - use from fe-common
701-
*/
702-
export enum TIMELINE_STATUS {
703-
DEPLOYMENT_INITIATED = 'DEPLOYMENT_INITIATED',
704-
GIT_COMMIT = 'GIT_COMMIT',
705-
GIT_COMMIT_FAILED = 'GIT_COMMIT_FAILED',
706-
ARGOCD_SYNC = 'ARGOCD_SYNC',
707-
ARGOCD_SYNC_FAILED = 'ARGOCD_SYNC_FAILED',
708-
KUBECTL_APPLY = 'KUBECTL_APPLY',
709-
KUBECTL_APPLY_STARTED = 'KUBECTL_APPLY_STARTED',
710-
KUBECTL_APPLY_SYNCED = 'KUBECTL_APPLY_SYNCED',
711-
HEALTHY = 'HEALTHY',
712-
APP_HEALTH = 'APP_HEALTH',
713-
DEPLOYMENT_FAILED = 'FAILED',
714-
FETCH_TIMED_OUT = 'TIMED_OUT',
715-
UNABLE_TO_FETCH_STATUS = 'UNABLE_TO_FETCH_STATUS',
716-
DEGRADED = 'DEGRADED',
717-
DEPLOYMENT_SUPERSEDED = 'DEPLOYMENT_SUPERSEDED',
718-
ABORTED = 'ABORTED',
719-
INPROGRESS = 'INPROGRESS',
720-
HELM_PACKAGE_GENERATED = 'HELM_PACKAGE_GENERATED',
721-
HELM_MANIFEST_PUSHED_TO_HELM_REPO = 'HELM_MANIFEST_PUSHED_TO_HELM_REPO',
722-
HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED = 'HELM_MANIFEST_PUSHED_TO_HELM_REPO_FAILED',
723-
}
724-
725698
/**
726699
* @deprecated - use from fe-common
727700
*/

0 commit comments

Comments
 (0)