Skip to content

Commit 87a5401

Browse files
authored
Merge pull request #1247 from devtron-labs/feat-helm-install-async
feat: handled release status for helm installed charts
2 parents e23c616 + 1275b56 commit 87a5401

File tree

12 files changed

+93
-39
lines changed

12 files changed

+93
-39
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ export const processDeploymentStatusDetailsData = (
698698
deploymentData.deploymentStatusText = 'Failed'
699699
deploymentData.deploymentStatusBreakdown.APP_HEALTH.displaySubText = 'Failed'
700700
} else if (data?.wfrStatus === 'Progressing') {
701-
deploymentData.deploymentStatus = DEPLOYMENT_STATUS.PROGRESSING
701+
deploymentData.deploymentStatus = DEPLOYMENT_STATUS.INPROGRESS
702702
deploymentData.deploymentStatusText = 'In progress'
703703
}
704704
}

src/components/external-apps/ExternalAppService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export interface ChartMetadata {
8181
notes?: string
8282
}
8383

84-
interface HelmReleaseStatus {
84+
export interface HelmReleaseStatus {
8585
status: string,
8686
message: string,
8787
description: string

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from '../../app/details/appDetails/appDetails.type'
2222
import { processDeploymentStatusDetailsData } from '../../app/details/appDetails/utils'
2323
import { useSharedState } from '../utils/useSharedState'
24+
import ReleaseStatusEmptyState from './ReleaseStatusEmptyState'
2425

2526
let deploymentStatusTimer = null
2627
const VirtualAppDetailsEmptyState = importComponentFromFELibrary('VirtualAppDetailsEmptyState')
@@ -150,6 +151,27 @@ const AppDetailsComponent = ({
150151
if (isVirtualEnv.current && VirtualAppDetailsEmptyState) {
151152
return <VirtualAppDetailsEmptyState environmentName={appDetails.environmentName} />
152153
}
154+
if (
155+
appDetails &&
156+
!appDetails.resourceTree?.nodes?.length &&
157+
appDetails.deploymentAppType === DeploymentAppTypes.HELM &&
158+
appDetails.helmReleaseStatus &&
159+
appDetails.helmReleaseStatus.status &&
160+
(appDetails.helmReleaseStatus.status.toLowerCase() === DEPLOYMENT_STATUS.FAILED ||
161+
appDetails.helmReleaseStatus.status.toLowerCase() === DEPLOYMENT_STATUS.PROGRESSING ||
162+
appDetails.helmReleaseStatus.status.toLowerCase() === DEPLOYMENT_STATUS.UNKNOWN)
163+
) {
164+
return (
165+
<ReleaseStatusEmptyState
166+
message={appDetails.helmReleaseStatus.message}
167+
description={
168+
appDetails.helmReleaseStatus.status.toLowerCase() === DEPLOYMENT_STATUS.UNKNOWN
169+
? ''
170+
: appDetails.helmReleaseStatus.description
171+
}
172+
/>
173+
)
174+
}
153175
return (
154176
<NodeTreeDetailTab
155177
appDetails={appDetails}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react'
2+
import { ReactComponent as InfoIcon } from '../../../assets/icons/info-filled.svg'
3+
function ReleaseStatusEmptyState({ message, description }) {
4+
return (
5+
<div className="bcn-0 flex h-100">
6+
<div className="flex column h-100 w-50">
7+
<InfoIcon className="icon-dim-24 info-icon-n6" />
8+
<span className="mt-8 cn-9 fs-13 fw-6 lh-20 dc__text-center">{message}</span>
9+
{description && <p className="mt-4 cn-7 fs-13 fw-4 lh-20 dc__text-justify">{description}</p>}
10+
</div>
11+
</div>
12+
)
13+
}
14+
15+
export default ReleaseStatusEmptyState

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ExternalLink, OptionTypeWithIcon } from '../../externalLinks/ExternalLi
33
import { iLink } from '../utils/tabUtils/link.type'
44
import { DeploymentAppTypes, OptionType } from '@devtron-labs/devtron-fe-common-lib'
55
import { EphemeralForm, EphemeralFormAdvancedType } from './k8Resource/nodeDetail/nodeDetail.type'
6+
import { HelmReleaseStatus } from '../../external-apps/ExternalAppService'
67

78
export interface ApplicationObject extends iLink {
89
selectedNode: string
@@ -180,7 +181,7 @@ export interface AppDetails {
180181
otherEnvironment?: OtherEnvironment[]
181182
projectName?: string
182183
appType?: AppType
183-
additionalData?: any
184+
helmReleaseStatus?: HelmReleaseStatus
184185
clusterId?: number
185186
notes?: string
186187
deploymentAppType?: DeploymentAppTypes

src/components/v2/appDetails/ea/EAAppDetail.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function ExternalAppDetail({ appId, appName, isExternalApp }) {
8080
},
8181
appStoreAppName: helmAppDetail.chartMetadata.chartName,
8282
appStoreAppVersion: helmAppDetail.chartMetadata.chartVersion,
83-
additionalData: helmAppDetail.releaseStatus,
83+
helmReleaseStatus: helmAppDetail.releaseStatus,
8484
clusterId: helmAppDetail.environmentDetails.clusterId,
8585
notes: helmAppDetail.chartMetadata.notes,
8686
}

src/components/v2/appDetails/sourceInfo/environmentStatus/EnvironmentStatus.component.tsx

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { importComponentFromFELibrary, useAsync } from '../../../../common'
1717
import { DeploymentAppTypes, noop } from '@devtron-labs/devtron-fe-common-lib'
1818
import DeploymentStatusCard from '../../../../app/details/appDetails/DeploymentStatusCard'
1919
import { EnvironmentStatusComponentType } from '../environment.type'
20+
import HelmAppConfigApplyStatusCard from './HelmAppConfigApplyStatusCard'
2021

2122
const AppDetailsDownloadCard = importComponentFromFELibrary('AppDetailsDownloadCard')
2223

@@ -78,7 +79,7 @@ function EnvironmentStatusComponent({
7879
}
7980

8081
const renderStatusBlock = () => {
81-
return (
82+
return status ? (
8283
<div
8384
className="app-status-card bcn-0 mr-12 br-8 p-16 cursor "
8485
onClick={loadingResourceTree ? noop : handleShowAppStatusDetail}
@@ -112,45 +113,22 @@ function EnvironmentStatusComponent({
112113
</>
113114
)}
114115
</div>
115-
)
116+
) : null
116117
}
117118

118119
const onClickShowNotes = () => {
119120
setShowNotes(true)
120121
}
121122

122123
const renderHelmConfigApplyStatusBlock = () => {
123-
return (
124-
appDetails?.appType == AppType.EXTERNAL_HELM_CHART && (
125-
<div className="app-status-card bcn-0 mr-12 br-8 p-16 ">
126-
<div className="cn-9 flex left">
127-
<span>Config apply status</span>
128-
<Tippy
129-
className="default-tt cursor"
130-
arrow={false}
131-
content={'Whether or not your last helm install was successful'}
132-
>
133-
<Question className="cursor icon-dim-16 ml-4" />
134-
</Tippy>
135-
</div>
136-
<div
137-
className={`f-${appDetails.additionalData[
138-
'status'
139-
].toLowerCase()} dc__capitalize fw-6 fs-14 flex left`}
140-
>
141-
<span>{appDetails.additionalData['status']}</span>
142-
<figure
143-
className={`${appDetails.additionalData[
144-
'status'
145-
].toLowerCase()} dc__app-summary__icon ml-8 icon-dim-20`}
146-
></figure>
147-
</div>
148-
<div className="cn-9 flex left">
149-
<span>{appDetails.additionalData['message']}</span>
150-
</div>
151-
</div>
152-
)
153-
)
124+
if (
125+
appDetails?.appType === AppType.EXTERNAL_HELM_CHART ||
126+
(appDetails?.deploymentAppType === DeploymentAppTypes.HELM &&
127+
appDetails?.appType === AppType.DEVTRON_HELM_CHART)
128+
) {
129+
return <HelmAppConfigApplyStatusCard releaseStatus={appDetails.helmReleaseStatus} />
130+
}
131+
return null
154132
}
155133

156134
const renderGeneratedManifestDownloadCard = (): JSX.Element => {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react'
2+
import Tippy from '@tippyjs/react'
3+
import { ReactComponent as Question } from '../../../assets/icons/ic-question.svg'
4+
5+
function HelmAppConfigApplyStatusCard({ releaseStatus }) {
6+
return releaseStatus ? (
7+
<div className="app-status-card bcn-0 mr-12 br-8 p-16 ">
8+
<div className="cn-9 flex left">
9+
<span>Config apply status</span>
10+
<Tippy
11+
className="default-tt cursor"
12+
arrow={false}
13+
content={'Whether or not your last helm install was successful'}
14+
>
15+
<Question className="cursor icon-dim-16 ml-4" />
16+
</Tippy>
17+
</div>
18+
<div className={`f-${releaseStatus['status'].toLowerCase()} dc__capitalize fw-6 fs-14 flex left`}>
19+
<span>{releaseStatus['status']}</span>
20+
<figure
21+
className={`${releaseStatus['status'].toLowerCase()} dc__app-summary__icon ml-8 icon-dim-20`}
22+
></figure>
23+
</div>
24+
<div className="cn-9 flex left">
25+
<span>{releaseStatus['message']}</span>
26+
</div>
27+
</div>
28+
) : null
29+
}
30+
31+
export default HelmAppConfigApplyStatusCard

src/components/v2/chartDeploymentHistory/ChartDeploymentHistory.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ function ChartDeploymentHistory({
272272
return (
273273
<>
274274
{deploymentHistoryArr.map((deployment, index) => {
275+
const helmDeploymentStatus: string = deployment?.status ? deployment.status.toLowerCase() : 'succeeded'
275276
return (
276277
<React.Fragment key={deployment.version}>
277278
<div
@@ -299,7 +300,7 @@ function ChartDeploymentHistory({
299300
: ''
300301
} ${
301302
installedAppInfo?.deploymentType === DeploymentAppTypes.HELM
302-
? 'succeeded'
303+
? helmDeploymentStatus
303304
: ''
304305
}`}
305306
></div>

src/components/v2/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function RouterComponent({ envType }) {
9494
appDetailsRef.current = {
9595
...appDetailsRef.current,
9696
...response.result,
97+
helmReleaseStatus: response.result?.releaseStatus || appDetailsRef.current?.helmReleaseStatus
9798
}
9899
IndexStore.publishAppDetails(appDetailsRef.current, AppType.DEVTRON_HELM_CHART)
99100
setErrorResponseCode(undefined)

0 commit comments

Comments
 (0)