@@ -32,7 +32,7 @@ import { ReactComponent as Down } from '../../../Assets/Icon/ic-arrow-forward.sv
32
32
import docker from '../../../Assets/Icon/ic-docker.svg'
33
33
import folder from '../../../Assets/Icon/ic-folder.svg'
34
34
import noartifact from '../../../Assets/Img/no-artifact@2x.png'
35
- import { ArtifactType , CIListItemType , HistoryComponentType } from './types'
35
+ import { ArtifactType , CIListItemType } from './types'
36
36
import { TERMINAL_STATUS_MAP } from './constants'
37
37
import { EMPTY_STATE_STATUS } from '../../constants'
38
38
@@ -124,11 +124,9 @@ const Artifacts = ({
124
124
downloadArtifactUrl,
125
125
ciPipelineId,
126
126
artifactId,
127
- isJobView,
128
127
isJobCI,
129
128
imageComment,
130
129
imageReleaseTags,
131
- type,
132
130
appReleaseTagNames,
133
131
tagsEditable,
134
132
hideImageTaggingHardDelete,
@@ -153,88 +151,96 @@ const Artifacts = ({
153
151
if ( status . toLowerCase ( ) === TERMINAL_STATUS_MAP . RUNNING || status . toLowerCase ( ) === TERMINAL_STATUS_MAP . STARTING ) {
154
152
return < CIProgressView />
155
153
}
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
+ ) {
162
165
return (
163
166
< 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
+ }
166
177
/>
167
178
)
168
179
}
169
180
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
+ }
185
190
}
191
+
186
192
return (
187
193
< >
188
194
< 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 >
206
214
</ 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 >
212
220
</ div >
213
221
</ 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
+ ) }
238
244
</ div >
239
245
{ ! blobStorageEnabled && (
240
246
< div className = "flexbox dc__position-abs-b-20 dc__content-center w-100" >
0 commit comments