Skip to content

Commit 9cb68f0

Browse files
committed
feat: update check for showing reports
1 parent 7572457 commit 9cb68f0

File tree

6 files changed

+38
-42
lines changed

6 files changed

+38
-42
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.3.19-beta-1",
3+
"version": "0.3.19-beta-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/ArtifactInfoModal/ArtifactInfoModal.component.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { getArtifactInfo, getCITriggerInfo } from '../../Services/app.service'
1919
import { APIResponseHandler } from '../APIResponseHandler'
2020
import { ReactComponent as ICClose } from '../../../Assets/Icon/ic-close.svg'
2121
import { ReactComponent as ICArrowDown } from '../../../Assets/Icon/ic-arrow-down.svg'
22-
import { Artifacts, HistoryComponentType } from '../CICDHistory'
22+
import { Artifacts } from '../CICDHistory'
2323
import MaterialHistory from '../MaterialHistory/MaterialHistory.component'
2424
import { ArtifactInfoModalProps } from './types'
2525

@@ -118,8 +118,6 @@ const ArtifactInfoModal = ({
118118
artifact={artifactInfo.image}
119119
blobStorageEnabled
120120
isArtifactUploaded={false}
121-
isJobView={false}
122-
type={HistoryComponentType.CI}
123121
imageReleaseTags={artifactInfo.imageReleaseTags}
124122
imageComment={artifactInfo.imageComment}
125123
ciPipelineId={artifactInfo.ciPipelineId}

src/Shared/Components/CICDHistory/Artifacts.tsx

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { ReactComponent as Down } from '../../../Assets/Icon/ic-arrow-forward.sv
3232
import docker from '../../../Assets/Icon/ic-docker.svg'
3333
import folder from '../../../Assets/Icon/ic-folder.svg'
3434
import noartifact from '../../../Assets/Img/no-artifact@2x.png'
35-
import { ArtifactType, CIListItemType, HistoryComponentType } from './types'
35+
import { ArtifactType, CIListItemType } from './types'
3636
import { TERMINAL_STATUS_MAP } from './constants'
3737
import { EMPTY_STATE_STATUS } from '../../constants'
3838

@@ -124,11 +124,9 @@ const Artifacts = ({
124124
downloadArtifactUrl,
125125
ciPipelineId,
126126
artifactId,
127-
isJobView,
128127
isJobCI,
129128
imageComment,
130129
imageReleaseTags,
131-
type,
132130
appReleaseTagNames,
133131
tagsEditable,
134132
hideImageTaggingHardDelete,
@@ -156,21 +154,26 @@ const Artifacts = ({
156154
// If artifactId is not 0 image info is shown, if isArtifactUploaded is true reports are shown
157155
// In case both are not present empty state is shown
158156
// isArtifactUploaded can be true even if status is failed
157+
158+
// NOTE: This means there are no reports and no image artifacts i.e. empty state
159159
if (!isArtifactUploaded && !artifactId) {
160160
if (
161161
status.toLowerCase() === TERMINAL_STATUS_MAP.FAILED ||
162162
status.toLowerCase() === TERMINAL_STATUS_MAP.CANCELLED ||
163163
status.toLowerCase() === TERMINAL_STATUS_MAP.ERROR
164164
) {
165-
return isJobCI ? (
166-
<GenericEmptyState
167-
title={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.FailedToFetchArtifacts}
168-
subTitle={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.FailedToFetchArtifactsError}
169-
/>
170-
) : (
165+
return (
171166
<GenericEmptyState
172-
title={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsGenerated}
173-
subTitle={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsError}
167+
title={
168+
isJobCI
169+
? EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.FailedToFetchArtifacts
170+
: EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsGenerated
171+
}
172+
subTitle={
173+
isJobCI
174+
? EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.FailedToFetchArtifactsError
175+
: EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsError
176+
}
174177
/>
175178
)
176179
}
@@ -218,28 +221,26 @@ const Artifacts = ({
218221
</div>
219222
</CIListItem>
220223
)}
221-
{blobStorageEnabled &&
222-
downloadArtifactUrl &&
223-
(type === HistoryComponentType.CD || isArtifactUploaded || isJobView) && (
224-
<CIListItem
225-
type="report"
226-
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
227-
isSuperAdmin={isSuperAdmin}
228-
renderCIListHeader={renderCIListHeader}
229-
>
230-
<div className="flex column left">
231-
<div className="cn-9 fs-14">Reports.zip</div>
232-
<button
233-
type="button"
234-
onClick={handleArtifact}
235-
className="anchor p-0 cb-5 fs-12 flex left pointer"
236-
>
237-
Download
238-
<Download className="ml-5 icon-dim-16" />
239-
</button>
240-
</div>
241-
</CIListItem>
242-
)}
224+
{blobStorageEnabled && downloadArtifactUrl && isArtifactUploaded && (
225+
<CIListItem
226+
type="report"
227+
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
228+
isSuperAdmin={isSuperAdmin}
229+
renderCIListHeader={renderCIListHeader}
230+
>
231+
<div className="flex column left">
232+
<div className="cn-9 fs-14">Reports.zip</div>
233+
<button
234+
type="button"
235+
onClick={handleArtifact}
236+
className="anchor p-0 cb-5 fs-12 flex left pointer"
237+
>
238+
Download
239+
<Download className="ml-5 icon-dim-16" />
240+
</button>
241+
</div>
242+
</CIListItem>
243+
)}
243244
</div>
244245
{!blobStorageEnabled && (
245246
<div className="flexbox dc__position-abs-b-20 dc__content-center w-100">

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ const HistoryLogs: React.FC<HistoryLogsProps> = ({
634634
appReleaseTagNames={appReleaseTags}
635635
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
636636
downloadArtifactUrl={CDBuildReportUrl}
637-
type={HistoryComponentType.CD}
638637
renderCIListHeader={renderCIListHeader}
639638
rootClassName="p-16 flex-grow-1"
640639
/>

src/Shared/Components/CICDHistory/types.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,7 @@ export interface ArtifactType {
608608
blobStorageEnabled: boolean
609609
isArtifactUploaded?: boolean
610610
downloadArtifactUrl?: string
611-
isJobView?: boolean
612611
isJobCI?: boolean
613-
type: HistoryComponentType
614612
ciPipelineId?: number
615613
artifactId?: number
616614
imageComment?: ImageComment

0 commit comments

Comments
 (0)