Skip to content

Commit 0997a65

Browse files
committed
Merge branch 'main' into feat/commit-card-ui
2 parents 5139edd + 4b8deed commit 0997a65

19 files changed

+615
-58
lines changed

src/Assets/Icon/ic-caret-down.svg

Lines changed: 16 additions & 0 deletions
Loading

src/Assets/Icon/ic-exit-fullscreen.svg

Lines changed: 2 additions & 15 deletions
Loading

src/Assets/Icon/ic-fullscreen.svg

Lines changed: 2 additions & 2 deletions
Loading

src/Assets/Icon/ic-in-progress.svg

Lines changed: 10 additions & 0 deletions
Loading

src/Common/SearchBar/SearchBar.component.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
*/
1616

1717
import { ChangeEvent, useCallback, useRef, useState, KeyboardEvent, useEffect } from 'react'
18+
import { ComponentSizeType } from '@Shared/constants'
1819
import { ReactComponent as Search } from '@Icons/ic-search.svg'
1920
import { ReactComponent as Clear } from '@Icons/ic-error-cross.svg'
2021
import { SearchBarProps } from './types'
2122
import './searchBar.scss'
2223
import { debounce } from '../Helper'
24+
import { getSearchBarHeightFromSize } from './utils'
2325

2426
/**
2527
* Generic search input component with support for enter based and debounced search
@@ -65,6 +67,7 @@ const SearchBar = ({
6567
debounceTimeout = 300,
6668
dataTestId = 'search-bar',
6769
noBackgroundAndBorder = false,
70+
size = ComponentSizeType.medium,
6871
}: SearchBarProps) => {
6972
const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
7073
const inputRef = useRef<HTMLInputElement>()
@@ -116,7 +119,7 @@ const SearchBar = ({
116119
return (
117120
<div className={containerClassName}>
118121
<div
119-
className={`search-bar ${noBackgroundAndBorder ? 'dc__no-border dc__no-background dc__hover-n50' : 'bc-n50 en-2 dc__hover-border-n300'} focus-within-border-b5 dc__block w-100 min-w-200 dc__position-rel br-4 bw-1 h-32`}
122+
className={`search-bar ${noBackgroundAndBorder ? 'dc__no-border dc__no-background dc__hover-n50' : 'bc-n50 en-2 dc__hover-border-n300'} focus-within-border-b5 dc__block w-100 min-w-200 dc__position-rel br-4 bw-1 ${getSearchBarHeightFromSize(size)}`}
120123
>
121124
<Search className="search-bar__icon dc__position-abs icon-color-n6 icon-dim-16" />
122125
<input

src/Common/SearchBar/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { ComponentSizeType } from '@Shared/constants'
18+
1719
export interface SearchBarProps {
1820
/**
1921
* Initial search text
@@ -55,4 +57,10 @@ export interface SearchBarProps {
5557
* Hide the background and border of the search
5658
*/
5759
noBackgroundAndBorder?: boolean
60+
/**
61+
* Height of the searchbar
62+
*
63+
* @default 'ComponentSizeType.medium'
64+
*/
65+
size?: ComponentSizeType.medium | ComponentSizeType.large
5866
}

src/Common/SearchBar/utils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ComponentSizeType } from '@Shared/constants'
2+
import { SearchBarProps } from './types'
3+
4+
export const getSearchBarHeightFromSize = (size: SearchBarProps['size']): string => {
5+
switch (size) {
6+
case ComponentSizeType.large:
7+
return 'h-36'
8+
default:
9+
return 'h-32'
10+
}
11+
}

src/Shared/Components/CICDHistory/History.components.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export const LogResizeButton = ({ fullScreenView, setFullScreenView }: LogResize
6161
>
6262
<div>
6363
{fullScreenView ? (
64-
<ZoomOut className="zoom zoom--out pointer" onClick={toggleFullScreen} />
64+
<ZoomOut className="zoom zoom--out pointer dc__zi-4" onClick={toggleFullScreen} />
6565
) : (
66-
<ZoomIn className="zoom zoom--in pointer" onClick={toggleFullScreen} />
66+
<ZoomIn className="zoom zoom--in pointer dc__zi-4" onClick={toggleFullScreen} />
6767
)}
6868
</div>
6969
</Tippy>
@@ -72,7 +72,7 @@ export const LogResizeButton = ({ fullScreenView, setFullScreenView }: LogResize
7272
}
7373

7474
export const Scroller = ({ scrollToTop, scrollToBottom, style }: ScrollerType): JSX.Element => (
75-
<div style={style} className="dc__element-scroller flex column top">
75+
<div style={style} className="dc__element-scroller flex column top br-4">
7676
<Tippy className="default-tt" arrow={false} content="Scroll to Top">
7777
<button
7878
className="flex"
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import DOMPurify from 'dompurify'
2+
import { getTimeDifference } from '@Shared/Helpers'
3+
import { LogStageAccordionProps } from './types'
4+
import { getStageStatusIcon } from './utils'
5+
import { ReactComponent as ICCaretDown } from '../../../Assets/Icon/ic-caret-down.svg'
6+
7+
const LogsItemContainer = ({ children }: { children: React.ReactNode }) => (
8+
<div className="display-grid dc__column-gap-10 dc__align-start logs-renderer__log-item">{children}</div>
9+
)
10+
11+
const LogStageAccordion = ({
12+
stage,
13+
isOpen,
14+
logs,
15+
endTime,
16+
startTime,
17+
status,
18+
handleStageClose,
19+
handleStageOpen,
20+
stageIndex,
21+
isLoading,
22+
}: LogStageAccordionProps) => {
23+
const handleAccordionToggle = () => {
24+
if (isOpen) {
25+
handleStageClose(stageIndex)
26+
} else {
27+
handleStageOpen(stageIndex)
28+
}
29+
}
30+
31+
const getFormattedTimeDifference = (): string => {
32+
const timeDifference = getTimeDifference(startTime, endTime)
33+
if (timeDifference === '0s') {
34+
return '< 1s'
35+
}
36+
return timeDifference
37+
}
38+
39+
return (
40+
<div className="flexbox-col dc__gap-8">
41+
<button
42+
className={`flexbox dc__transparent dc__content-space py-6 px-8 br-4 dc__align-items-center dc__select-text logs-renderer__stage-accordion ${
43+
isOpen ? 'logs-renderer__stage-accordion--open-stage' : ''
44+
} dc__position-sticky dc__zi-1 dc__top-44`}
45+
type="button"
46+
role="tab"
47+
onClick={handleAccordionToggle}
48+
>
49+
<div className="flexbox dc__gap-8 dc__transparent dc__align-items-center">
50+
<ICCaretDown
51+
className={`icon-dim-16 dc__no-shrink dc__transition--transform scn-0 ${!isOpen ? 'dc__flip-n90 dc__opacity-0_5' : ''}`}
52+
/>
53+
54+
<div className="flexbox dc__gap-12 dc__align-items-center">
55+
{getStageStatusIcon(status)}
56+
57+
<h3 className="m-0 cn-0 fs-13 fw-4 lh-20 dc__word-break">{stage}</h3>
58+
</div>
59+
</div>
60+
61+
{!!endTime && <span className="cn-0 fs-13 fw-4 lh-20">{getFormattedTimeDifference()}</span>}
62+
</button>
63+
64+
{isOpen && (
65+
<div className="flexbox-col dc__gap-4">
66+
{logs.map((log: string, logsIndex: number) => (
67+
<LogsItemContainer
68+
// eslint-disable-next-line react/no-array-index-key
69+
key={`logs-${stage}-${startTime}-${logsIndex}`}
70+
>
71+
<span className="cn-4 col-2 lh-20 dc__text-align-end dc__word-break mono fs-14">
72+
{logsIndex + 1}
73+
</span>
74+
<p
75+
className="mono fs-14 mb-0-imp cn-0 dc__word-break lh-20"
76+
// eslint-disable-next-line react/no-danger
77+
dangerouslySetInnerHTML={{
78+
__html: DOMPurify.sanitize(log),
79+
}}
80+
/>
81+
</LogsItemContainer>
82+
))}
83+
84+
{isLoading && (
85+
<LogsItemContainer>
86+
<span />
87+
<div className="dc__loading-dots cn-0" />
88+
</LogsItemContainer>
89+
)}
90+
</div>
91+
)}
92+
</div>
93+
)
94+
}
95+
96+
export default LogStageAccordion
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.logs-renderer-container {
2+
.logs-renderer {
3+
&__search-bar {
4+
.search-bar {
5+
background: transparent;
6+
border-radius: 0px;
7+
border: none !important;
8+
9+
input {
10+
color: var(--N0);
11+
12+
&::placeholder {
13+
color: var(--N500);
14+
}
15+
}
16+
17+
&:hover {
18+
border: none !important;
19+
background: transparent;
20+
}
21+
}
22+
23+
.search-bar:focus-within {
24+
border: none !important;
25+
}
26+
}
27+
28+
&__stage-accordion {
29+
background-color: #0C1021;
30+
31+
&:not(&--open-stage):hover {
32+
background-color: rgba(44, 51, 84, 0.5);
33+
}
34+
35+
&--open-stage {
36+
background-color: #2C3354;
37+
}
38+
39+
}
40+
41+
&__log-item {
42+
grid-template-columns: 34px auto;
43+
&:hover {
44+
background-color: rgba(255, 255, 255, 0.1);
45+
}
46+
}
47+
48+
&__filters-border-bottom {
49+
border-bottom: 1px solid #2C3354;
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)