@@ -32,7 +32,7 @@ import { ReactComponent as Down } from '../../../Assets/Icon/ic-arrow-forward.sv
3232import docker from '../../../Assets/Icon/ic-docker.svg'
3333import folder from '../../../Assets/Icon/ic-folder.svg'
3434import noartifact from '../../../Assets/Img/no-artifact@2x.png'
35- import { ArtifactType , CIListItemType , HistoryComponentType } from './types'
35+ import { ArtifactType , CIListItemType } from './types'
3636import { TERMINAL_STATUS_MAP } from './constants'
3737import { 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,
@@ -153,88 +151,96 @@ const Artifacts = ({
153151 if ( status . toLowerCase ( ) === TERMINAL_STATUS_MAP . RUNNING || status . toLowerCase ( ) === TERMINAL_STATUS_MAP . STARTING ) {
154152 return < CIProgressView />
155153 }
156- if (
157- status . toLowerCase ( ) === TERMINAL_STATUS_MAP . FAILED ||
158- status . toLowerCase ( ) === TERMINAL_STATUS_MAP . CANCELLED ||
159- status . toLowerCase ( ) === TERMINAL_STATUS_MAP . ERROR
160- ) {
161- if ( isJobCI ) {
154+ // If artifactId is not 0 image info is shown, if isArtifactUploaded is true reports are shown
155+ // In case both are not present empty state is shown
156+ // 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
159+ if ( ! isArtifactUploaded && ! artifactId ) {
160+ if (
161+ status . toLowerCase ( ) === TERMINAL_STATUS_MAP . FAILED ||
162+ status . toLowerCase ( ) === TERMINAL_STATUS_MAP . CANCELLED ||
163+ status . toLowerCase ( ) === TERMINAL_STATUS_MAP . ERROR
164+ ) {
162165 return (
163166 < GenericEmptyState
164- title = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . FailedToFetchArtifacts }
165- subTitle = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . FailedToFetchArtifactsError }
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+ }
166177 />
167178 )
168179 }
169180
170- return (
171- < GenericEmptyState
172- title = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . NoArtifactsGenerated }
173- subTitle = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . NoArtifactsError }
174- />
175- )
176- }
177- if ( ! artifactId && status . toLowerCase ( ) === TERMINAL_STATUS_MAP . SUCCEEDED ) {
178- return (
179- < GenericEmptyState
180- title = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . NoArtifactsFound }
181- subTitle = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . NoArtifactsFoundError }
182- image = { noartifact }
183- />
184- )
181+ if ( status . toLowerCase ( ) === TERMINAL_STATUS_MAP . SUCCEEDED ) {
182+ return (
183+ < GenericEmptyState
184+ title = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . NoArtifactsFound }
185+ subTitle = { EMPTY_STATE_STATUS . ARTIFACTS_EMPTY_STATE_TEXTS . NoArtifactsFoundError }
186+ image = { noartifact }
187+ />
188+ )
189+ }
185190 }
191+
186192 return (
187193 < >
188194 < div className = { `flex left column dc__gap-12 dc__content-start ${ rootClassName ?? '' } ` } >
189- < CIListItem
190- type = "artifact"
191- ciPipelineId = { ciPipelineId }
192- artifactId = { artifactId }
193- imageComment = { imageComment }
194- imageReleaseTags = { imageReleaseTags }
195- appReleaseTagNames = { appReleaseTagNames }
196- tagsEditable = { tagsEditable }
197- hideImageTaggingHardDelete = { hideImageTaggingHardDelete }
198- isSuperAdmin = { isSuperAdmin }
199- renderCIListHeader = { renderCIListHeader }
200- >
201- < div className = "flex column left hover-trigger" >
202- < div className = "cn-9 fs-14 flex left" data-testid = "artifact-text-visibility" >
203- { extractImage ( artifact ) }
204- < div className = "pl-4" >
205- < ClipboardButton content = { extractImage ( artifact ) } />
195+ { ! ! artifactId && (
196+ < CIListItem
197+ type = "artifact"
198+ ciPipelineId = { ciPipelineId }
199+ artifactId = { artifactId }
200+ imageComment = { imageComment }
201+ imageReleaseTags = { imageReleaseTags }
202+ appReleaseTagNames = { appReleaseTagNames }
203+ tagsEditable = { tagsEditable }
204+ hideImageTaggingHardDelete = { hideImageTaggingHardDelete }
205+ isSuperAdmin = { isSuperAdmin }
206+ renderCIListHeader = { renderCIListHeader }
207+ >
208+ < div className = "flex column left hover-trigger" >
209+ < div className = "cn-9 fs-14 flex left" data-testid = "artifact-text-visibility" >
210+ { extractImage ( artifact ) }
211+ < div className = "pl-4" >
212+ < ClipboardButton content = { extractImage ( artifact ) } />
213+ </ div >
206214 </ div >
207- </ div >
208- < div className = "cn-7 fs-12 flex left" data-testid = " artifact-image-text" >
209- { artifact }
210- < div className = "pl-4" >
211- < ClipboardButton content = { artifact } / >
215+ < div className = "cn-7 fs-12 flex left" data-testid = "artifact-image-text" >
216+ { artifact }
217+ < div className = "pl-4" >
218+ < ClipboardButton content = { artifact } / >
219+ </ div >
212220 </ div >
213221 </ div >
214- </ div >
215- </ CIListItem >
216- { blobStorageEnabled &&
217- downloadArtifactUrl &&
218- ( type === HistoryComponentType . CD || isArtifactUploaded || isJobView ) && (
219- < CIListItem
220- type = "report"
221- hideImageTaggingHardDelete = { hideImageTaggingHardDelete }
222- isSuperAdmin = { isSuperAdmin }
223- renderCIListHeader = { renderCIListHeader }
224- >
225- < div className = "flex column left" >
226- < div className = "cn-9 fs-14" > Reports.zip</ div >
227- < button
228- type = "button"
229- onClick = { handleArtifact }
230- className = "anchor p-0 cb-5 fs-12 flex left pointer"
231- >
232- Download
233- < Download className = "ml-5 icon-dim-16" />
234- </ button >
235- </ div >
236- </ CIListItem >
237- ) }
222+ </ CIListItem >
223+ ) }
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+ ) }
238244 </ div >
239245 { ! blobStorageEnabled && (
240246 < div className = "flexbox dc__position-abs-b-20 dc__content-center w-100" >
0 commit comments