Skip to content

Commit 0babde6

Browse files
committed
Merge branch 'develop' into feat/replace-select-picker
2 parents 0eebfe3 + bdb65ca commit 0babde6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1324
-163
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* vivek@devtron.ai @vikramdevtron

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.2.24-beta-5",
3+
"version": "0.2.31-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/Icon/ic-arrow-right.svg

Lines changed: 7 additions & 0 deletions
Loading

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function ClipboardButton({
3434
content,
3535
copiedTippyText = 'Copied!',
3636
duration = 1000,
37-
trigger = false,
37+
trigger,
3838
setTrigger = noop,
3939
rootClassName = '',
4040
iconSize = 16,
@@ -45,6 +45,8 @@ export default function ClipboardButton({
4545
const handleTextCopied = () => {
4646
setCopied(true)
4747
}
48+
const isTriggerUndefined = typeof trigger === 'undefined'
49+
4850
const handleEnableTippy = () => setEnableTippy(true)
4951
const handleDisableTippy = () => setEnableTippy(false)
5052
const handleCopyContent = useCallback(
@@ -68,7 +70,7 @@ export default function ClipboardButton({
6870
}, [copied, duration, setTrigger])
6971

7072
useEffect(() => {
71-
if (trigger) {
73+
if (!isTriggerUndefined && trigger) {
7274
setCopied(true)
7375
handleCopyContent()
7476
}
@@ -86,7 +88,7 @@ export default function ClipboardButton({
8688
className={`dc__outline-none-imp p-0 flex dc__transparent--unstyled dc__no-border ${rootClassName}`}
8789
onMouseEnter={handleEnableTippy}
8890
onMouseLeave={handleDisableTippy}
89-
onClick={handleCopyContent}
91+
onClick={isTriggerUndefined && handleCopyContent}
9092
>
9193
{copied ? <Check className={iconClassName} /> : <ICCopy className={iconClassName} />}
9294
</button>

src/Common/Common.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616

1717
import moment from 'moment'
18+
import { RuntimeParamsAPIResponseType, RuntimeParamsListItemType } from '@Shared/types'
19+
import { getIsManualApprovalSpecific, sanitizeUserApprovalConfig, stringComparatorBySortOrder } from '@Shared/Helpers'
1820
import { get, post } from './Api'
1921
import { ROUTES } from './Constants'
2022
import { getUrlWithSearchParams, sortCallback } from './Helper'
@@ -41,7 +43,6 @@ import {
4143
CDMaterialListModalServiceUtilProps,
4244
} from './Types'
4345
import { ApiResourceType } from '../Pages'
44-
import { getIsManualApprovalSpecific, sanitizeUserApprovalConfig, stringComparatorBySortOrder } from '@Shared/Helpers'
4546
import { API_TOKEN_PREFIX } from '@Shared/constants'
4647
import { DefaultUserKey } from '@Shared/types'
4748

@@ -317,6 +318,11 @@ const processCDMaterialsApprovalInfo = (enableApproval: boolean, cdMaterialsResu
317318
}
318319
}
319320

321+
export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): RuntimeParamsListItemType[] =>
322+
Object.entries(response?.envVariables || {})
323+
.map(([key, value], index) => ({ key, value, id: index }))
324+
.sort((a, b) => stringComparatorBySortOrder(a.key, b.key))
325+
320326
const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
321327
if (!cdMaterialsResult) {
322328
return {
@@ -326,6 +332,7 @@ const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
326332
resourceFilters: [],
327333
totalCount: 0,
328334
requestedUserId: 0,
335+
runtimeParams: [],
329336
}
330337
}
331338

@@ -336,6 +343,7 @@ const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
336343
resourceFilters: cdMaterialsResult.resourceFilters ?? [],
337344
totalCount: cdMaterialsResult.totalCount ?? 0,
338345
requestedUserId: cdMaterialsResult.requestedUserId,
346+
runtimeParams: parseRuntimeParams(cdMaterialsResult.runtimeParams),
339347
}
340348
}
341349

src/Common/CustomInput/CustomInput.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { CustomInputProps } from './Types'
1818
import { ReactComponent as Info } from '../../Assets/Icon/ic-info-filled-override.svg'
1919
import { ReactComponent as ErrorIcon } from '../../Assets/Icon/ic-warning.svg'
20+
import { useEffect, useRef } from 'react'
2021

2122
export const CustomInput = ({
2223
name,
@@ -39,7 +40,6 @@ export const CustomInput = ({
3940
handleOnBlur,
4041
readOnly = false,
4142
noTrim = false,
42-
ref,
4343
onKeyPress,
4444
defaultValue,
4545
onKeyDown,
@@ -48,6 +48,17 @@ export const CustomInput = ({
4848
inputWrapClassName = '',
4949
inputProps = {},
5050
}: CustomInputProps) => {
51+
const inputRef = useRef<HTMLInputElement>()
52+
53+
useEffect(() => {
54+
setTimeout(() => {
55+
// Added timeout to ensure the autofocus code is executed post the re-renders
56+
if (inputRef.current && autoFocus) {
57+
inputRef.current.focus()
58+
}
59+
}, 100)
60+
}, [autoFocus])
61+
5162
function handleError(error: any): any[] {
5263
if (!Array.isArray(error)) {
5364
return [error]
@@ -68,9 +79,9 @@ export const CustomInput = ({
6879
}
6980

7081
const renderFormErrorWithIcon = (error: string) => (
71-
<div className="form__error" key={error}>
72-
<ErrorIcon className="form__icon form__icon--error" />
73-
{error}
82+
<div className="flex left mt-4 mb-4 dc__gap-4 cr-5 fs-11 lh-16 fw-4" key={error}>
83+
<ErrorIcon className="icon-dim-16 p-1 form__icon--error dc__align-self-start dc__no-shrink" />
84+
<span>{error}</span>
7485
{error && typeof additionalErrorInfo === 'function' && additionalErrorInfo()}
7586
</div>
7687
)
@@ -124,13 +135,13 @@ export const CustomInput = ({
124135
tabIndex={tabIndex}
125136
autoFocus={autoFocus}
126137
readOnly={readOnly}
127-
ref={ref}
128138
onKeyPress={onKeyPress}
129139
defaultValue={defaultValue}
130140
onKeyDown={onKeyDown}
131141
required={required}
132142
// Will be passing other props like other data attributes etc from inputProps
133143
{...inputProps}
144+
ref={inputRef}
134145
/>
135146

136147
{getInputError()}

src/Common/CustomInput/Types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export interface CustomInputProps {
3737
handleOnBlur?: (e) => void
3838
readOnly?: boolean
3939
noTrim?: boolean
40-
ref?: React.LegacyRef<HTMLInputElement>
4140
onKeyPress?: (e) => void
4241
defaultValue?: string | number | ReadonlyArray<string> | undefined
4342
onKeyDown?: (e) => void

src/Common/SearchBar/SearchBar.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const SearchBar = ({
136136
type="text"
137137
{...inputProps}
138138
defaultValue={initialSearchText}
139-
className={`search-bar__input dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 ${
139+
className={`search-bar__input dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 dc__left-0 ${
140140
showClearButton ? 'pr-30' : 'pr-10'
141141
} ${noBackgroundAndBorder ? 'dc__no-background' : 'bc-n50'}`}
142142
onChange={handleChange}

src/Common/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Tooltip = ({
2828
arrow={false}
2929
placement="top"
3030
{...rest}
31-
className={`default-tt ${wordBreak ? 'dc__word-break-all' : ''} dc__mxw-200 ${rest.className}`}
31+
className={`default-tt ${wordBreak ? 'dc__word-break-all' : ''} dc__mxw-200-imp ${rest.className}`}
3232
>
3333
{cloneElement(child, { ...child.props, ref: refCallback })}
3434
</TippyJS>

0 commit comments

Comments
 (0)