Skip to content

Commit a8fe5a2

Browse files
committed
feat: cosmetic changes in design
1 parent f0d634d commit a8fe5a2

File tree

9 files changed

+89
-8
lines changed

9 files changed

+89
-8
lines changed

src/components/ApplicationGroup/Details/EnvCIDetails/EnvCIDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { getTriggerHistory } from '../../../app/service'
1717
import { asyncWrap, mapByKey, useAsync, useInterval } from '../../../common'
1818
import { getCIConfigList } from '../../AppGroup.service'
1919
import { AppGroupDetailDefaultType } from '../../AppGroup.types'
20+
import { CIPipelineBuildType } from '../../../ciPipeline/types'
2021

2122
export default function EnvCIDetails({ filteredAppIds }: AppGroupDetailDefaultType) {
2223
const { envId, pipelineId, buildId } = useParams<{
@@ -181,7 +182,7 @@ export default function EnvCIDetails({ filteredAppIds }: AppGroupDetailDefaultTy
181182
replace(generatePath(path, { buildId: triggerHistory.entries().next().value[0], envId, pipelineId }))
182183
}
183184
const pipelineOptions: CICDSidebarFilterOptionType[] = (pipelineList || []).map((item) => {
184-
return { value: `${item.id}`, label: item.appName, pipelineId: item.id }
185+
return { value: `${item.id}`, label: item.appName, pipelineId: item.id, pipelineType: item.pipelineType }
185186
})
186187
const pipelinesMap = mapByKey(pipelineList, 'id')
187188
const pipeline = pipelinesMap.get(+pipelineId)
@@ -205,6 +206,7 @@ export default function EnvCIDetails({ filteredAppIds }: AppGroupDetailDefaultTy
205206
tagsEditable={tagsEditable}
206207
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
207208
fetchIdData={fetchBuildIdData}
209+
isJobCI={pipeline.pipelineType === CIPipelineBuildType.CI_JOB}
208210
/>
209211
</Route>
210212
)

src/components/CIPipelineN/CIPipeline.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,16 @@ export default function CIPipeline({
182182
) {
183183
localStorage.removeItem('takeMeThereClicked')
184184
}
185-
}, [location.pathname])
185+
// redirect to ci-job based on pipeline type
186+
if (
187+
location.pathname.includes(`/${URLS.APP_CI_CONFIG}/`) &&
188+
ciPipelineId &&
189+
ciPipeline.pipelineType === CIPipelineBuildType.CI_JOB
190+
) {
191+
const editCIPipelineURL: string = location.pathname.replace(`/${URLS.APP_CI_CONFIG}/`, `/${URLS.APP_JOB_CI_CONFIG}/`)
192+
window.location.href = editCIPipelineURL
193+
}
194+
}, [location.pathname, ciPipeline.pipelineType])
186195

187196
const getEnvironments = (envId) => {
188197
envId = envId || 0

src/components/app/details/cIDetails/CIDetails.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import LogsRenderer from '../cicdHistory/LogsRenderer'
2222
import { EMPTY_STATE_STATUS } from '../../../../config/constantMessaging'
2323
import { ReactComponent as NoVulnerability } from '../../../../assets/img/ic-vulnerability-not-found.svg'
2424
import { ScannedByToolModal } from '../../../common/security/ScannedByToolModal'
25+
import { CIPipelineBuildType } from '../../../ciPipeline/types'
2526

2627
const terminalStatus = new Set(['succeeded', 'failed', 'error', 'cancelled', 'nottriggered', 'notbuilt'])
2728
let statusSet = new Set(['starting', 'running', 'pending'])
@@ -156,7 +157,7 @@ export default function CIDetails({ isJobView }: { isJobView?: boolean }) {
156157
replace(generatePath(path, { appId, pipelineId: pipelines[0].id }))
157158
}
158159
const pipelineOptions: CICDSidebarFilterOptionType[] = (pipelines || []).map((item) => {
159-
return { value: `${item.id}`, label: item.name, pipelineId: item.id }
160+
return { value: `${item.id}`, label: item.name, pipelineId: item.id, pipelineType: item.pipelineType}
160161
})
161162
const pipelinesMap = mapByKey(pipelines, 'id')
162163
const pipeline = pipelinesMap.get(+pipelineId)
@@ -221,6 +222,7 @@ export default function CIDetails({ isJobView }: { isJobView?: boolean }) {
221222
appReleaseTags={appReleaseTags}
222223
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
223224
fetchIdData={fetchBuildIdData}
225+
isJobCI={pipeline.pipelineType === CIPipelineBuildType.CI_JOB}
224226
/>
225227
</Route>
226228
) : pipeline.parentCiPipeline || pipeline.pipelineType === 'LINKED' ? (
@@ -259,12 +261,14 @@ export const Details = ({
259261
isSecurityModuleInstalled,
260262
isBlobStorageConfigured,
261263
isJobView,
264+
isJobCI,
262265
appIdFromParent,
263266
tagsEditable,
264267
appReleaseTags,
265268
hideImageTaggingHardDelete,
266269
fetchIdData,
267270
}: BuildDetails) => {
271+
const isJobCard: boolean = isJobView || isJobCI
268272
const { pipelineId, appId, buildId } = useParams<{ appId: string; buildId: string; pipelineId: string }>()
269273
const triggerDetails = triggerHistory.get(+buildId)
270274
const [triggerDetailsLoading, triggerDetailsResult, triggerDetailsError, reloadTriggerDetails] = useAsync(
@@ -403,7 +407,7 @@ export const Details = ({
403407
Artifacts
404408
</NavLink>
405409
</li>
406-
{!isJobView && isSecurityModuleInstalled && (
410+
{!isJobCard && isSecurityModuleInstalled && (
407411
<li className="tab-list__tab">
408412
<NavLink
409413
replace
@@ -425,6 +429,7 @@ export const Details = ({
425429
triggerDetails={triggerDetails}
426430
isBlobStorageConfigured={isBlobStorageConfigured}
427431
isJobView={isJobView}
432+
isJobCI={isJobCI}
428433
appIdFromParent={appIdFromParent}
429434
appReleaseTags={appReleaseTags}
430435
tagsEditable={tagsEditable}
@@ -438,12 +443,14 @@ const HistoryLogs = ({
438443
triggerDetails,
439444
isBlobStorageConfigured,
440445
isJobView,
446+
isJobCI,
441447
appIdFromParent,
442448
appReleaseTags,
443449
tagsEditable,
444450
hideImageTaggingHardDelete,
445451
}: HistoryLogsType) => {
446452
let { path } = useRouteMatch()
453+
const isJobCard: boolean = isJobCI || isJobView
447454
const { pipelineId, buildId } = useParams<{ buildId: string; pipelineId: string }>()
448455
const [ref, scrollToTop, scrollToBottom] = useScrollable({
449456
autoBottomScroll: triggerDetails.status.toLowerCase() !== 'succeeded',
@@ -479,6 +486,7 @@ const HistoryLogs = ({
479486
getArtifactPromise={_getArtifactPromise}
480487
isArtifactUploaded={triggerDetails.isArtifactUploaded}
481488
isJobView={isJobView}
489+
isJobCI={isJobCI}
482490
imageComment={triggerDetails.imageComment}
483491
imageReleaseTags={triggerDetails.imageReleaseTags}
484492
ciPipelineId={triggerDetails.ciPipelineId}
@@ -489,7 +497,7 @@ const HistoryLogs = ({
489497
type={HistoryComponentType.CI}
490498
/>
491499
</Route>
492-
{!isJobView && (
500+
{!isJobCard && (
493501
<Route path={`${path}/security`}>
494502
<SecurityTab
495503
ciPipelineId={triggerDetails.ciPipelineId}

src/components/app/details/cIDetails/types.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface BuildDetails {
1414
isSecurityModuleInstalled: boolean
1515
isBlobStorageConfigured: boolean
1616
isJobView?: boolean
17+
isJobCI?: boolean
1718
appIdFromParent?: string
1819
appReleaseTags?: []
1920
tagsEditable: boolean
@@ -25,6 +26,7 @@ export interface HistoryLogsType {
2526
triggerDetails: History
2627
isBlobStorageConfigured?: boolean
2728
isJobView?: boolean
29+
isJobCI?: boolean
2830
appIdFromParent?: string
2931
appReleaseTags?: []
3032
tagsEditable: boolean

src/components/app/details/cicdHistory/Artifacts.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default function Artifacts({
2929
ciPipelineId,
3030
artifactId,
3131
isJobView,
32+
isJobCI,
3233
imageComment,
3334
imageReleaseTags,
3435
type,
@@ -94,12 +95,29 @@ export default function Artifacts({
9495
status.toLowerCase() === TERMINAL_STATUS_MAP.FAILED ||
9596
status.toLowerCase() === TERMINAL_STATUS_MAP.CANCELLED
9697
) {
98+
if (isJobCI) {
99+
return (
100+
<GenericEmptyState
101+
title={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.FailedToFetchArtifacts}
102+
subTitle={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.FailedToFetchArtifactsError}
103+
/>
104+
)
105+
}
106+
97107
return (
98108
<GenericEmptyState
99109
title={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsGenerated}
100110
subTitle={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsError}
101111
/>
102112
)
113+
} else if (!artifactId && status.toLowerCase() === TERMINAL_STATUS_MAP.SUCCEEDED) {
114+
return (
115+
<GenericEmptyState
116+
title={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsFound}
117+
subTitle={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.NoArtifactsFoundError}
118+
image={noartifact}
119+
/>
120+
)
103121
} else {
104122
return (
105123
<div className="flex left column p-16">

src/components/app/details/cicdHistory/Sidebar.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useEffect, useRef } from 'react'
22
import { ConditionalWrap, createGitCommitUrl } from '../../../common'
33
import { useRouteMatch, useParams, useHistory, generatePath, useLocation } from 'react-router'
4-
import ReactSelect from 'react-select'
5-
import { Option, DropdownIndicator } from '../../../v2/common/ReactSelect.utils'
4+
import ReactSelect, { components } from 'react-select'
5+
import { DropdownIndicator, getCustomOptionSelectionStyle } from '../../../v2/common/ReactSelect.utils'
66
import moment from 'moment'
77
import { Moment12HourFormat, SourceTypeMap } from '../../../../config'
88
import { CiPipelineSourceConfig } from '../../../ciPipeline/CiPipelineSourceConfig'
@@ -87,6 +87,27 @@ const Sidebar = React.memo(
8787
return HISTORY_LABEL.ENVIRONMENT
8888
}
8989
}
90+
91+
const containerRegistryOption = (props): JSX.Element => {
92+
props.selectProps.styles.option = getCustomOptionSelectionStyle()
93+
console.log(props.data.pipelineType?.toLowerCase())
94+
return (
95+
<components.Option {...props}>
96+
<div style={{ display: 'flex' }}>
97+
{(type === HistoryComponentType.CI || type === HistoryComponentType.GROUP_CI) && (
98+
<div
99+
className={
100+
'dc__ci-pipeline-type-icon mr-5 ' +
101+
props.data.pipelineType?.toLowerCase() || ''
102+
}
103+
></div>
104+
)}
105+
{props.label}
106+
</div>
107+
</components.Option>
108+
)
109+
}
110+
90111
return (
91112
<>
92113
<div
@@ -109,8 +130,8 @@ const Sidebar = React.memo(
109130
onChange={handleFilterChange}
110131
components={{
111132
IndicatorSeparator: null,
133+
Option: containerRegistryOption,
112134
DropdownIndicator,
113-
Option,
114135
}}
115136
styles={FILTER_STYLE}
116137
menuPortalTarget={document.body}

src/components/app/details/cicdHistory/types.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export interface ArtifactType {
7474
isArtifactUploaded?: boolean
7575
getArtifactPromise?: () => Promise<any>
7676
isJobView?: boolean
77+
isJobCI?: boolean
7778
type: HistoryComponentType
7879
ciPipelineId?: number
7980
artifactId?: number
@@ -247,6 +248,7 @@ export interface StartDetailsType {
247248

248249
export interface CICDSidebarFilterOptionType extends OptionType {
249250
pipelineId: number
251+
pipelineType?: string
250252
deploymentAppDeleteRequest?: boolean
251253
}
252254

src/config/constantMessaging.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ export const EMPTY_STATE_STATUS = {
210210
NoFilesGenerated: 'No files were generated by the job pipeline.',
211211
NoArtifactsGenerated: 'No artifacts generated',
212212
NoArtifactsError: 'Errr..!! We couldn’t build your code.',
213+
FailedToFetchArtifacts: 'Fail to find artifacts',
214+
FailedToFetchArtifactsError: 'Errr..!! The pipeline execution failed',
215+
NoArtifactsFound: 'No new artifacts found',
216+
NoArtifactsFoundError: 'No new artifacts were found',
213217
},
214218
CI_BUILD_HISTORY_PIPELINE_TRIGGER: {
215219
TITLE: 'pipeline not triggered',

src/css/base.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,6 +2170,21 @@ button.anchor {
21702170
}
21712171
}
21722172

2173+
.dc__ci-pipeline-type-icon {
2174+
width: 20px;
2175+
height: 20px;
2176+
background-size: contain;
2177+
background-image: url('../assets/icons/ic-CI.svg');
2178+
2179+
&.normal {
2180+
background-image: url('../assets/icons/ic-CI.svg');
2181+
}
2182+
2183+
&.ci_job {
2184+
background-image: url('../assets/icons/ic-job-node.svg');
2185+
}
2186+
}
2187+
21732188
.dc__environment-icon {
21742189
width: 18px;
21752190
height: 18px;

0 commit comments

Comments
 (0)