Skip to content

Commit 70eadfb

Browse files
committed
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-lib into feat/manifest-config-diff
2 parents eb450ce + bdb65ca commit 70eadfb

File tree

15 files changed

+103
-20
lines changed

15 files changed

+103
-20
lines changed

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.28-beta-1",
3+
"version": "0.2.30",
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/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
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { getDeploymentStageTitle } from './utils'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { DeploymentStageType } from '@Shared/constants'
2+
3+
export const getDeploymentStageTitle = (stage: DeploymentStageType) => {
4+
switch (stage) {
5+
case DeploymentStageType.PRE:
6+
return 'pre-deployment'
7+
case DeploymentStageType.POST:
8+
return 'post-deployment'
9+
case DeploymentStageType.DEPLOY:
10+
return 'deployment'
11+
default:
12+
return '-'
13+
}
14+
}

src/Pages/App/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './AppConfigurations'

src/Pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
export * from './GlobalConfigurations'
1818
export * from './ResourceBrowser'
1919
export * from './CDPipeline'
20+
export * from './App'

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { ImageChipCell } from '@Shared/Components/ImageChipCell'
2424
import { CommitChipCell } from '@Shared/Components/CommitChipCell'
2525
import { ReactComponent as ICLines } from '@Icons/ic-lines.svg'
2626
import { ReactComponent as ICPulsateStatus } from '@Icons/ic-pulsate-status.svg'
27+
import { ReactComponent as ICArrowRight } from '@Icons/ic-arrow-right.svg'
28+
import { getDeploymentStageTitle } from '@Pages/App'
2729
import {
2830
ConfirmationDialog,
2931
DATE_TIME_FORMATS,
@@ -284,16 +286,33 @@ const StartDetails = ({
284286
isJobView,
285287
triggerMetadata,
286288
renderDeploymentHistoryTriggerMetaText,
289+
renderTargetConfigInfo,
290+
stage,
287291
}: StartDetailsType): JSX.Element => {
288292
const { url } = useRouteMatch()
289293
const { pathname } = useLocation()
290294

291295
return (
292296
<div className="w-100 pr-20 flex column left dc__border-bottom-n1">
293297
<div className="flexbox dc__gap-8 dc__align-items-center pb-12">
294-
<span className="cn-9 fs-13 fw-6 lh-20" data-testid="deployment-history-start-heading">
295-
Start
296-
</span>
298+
<div className="flex left dc__gap-4 cn-9 fs-13 fw-6 lh-20">
299+
<div className="flex left dc__no-shrink dc__gap-4" data-testid="deployment-history-start-heading">
300+
<div>Start</div>
301+
{stage && (
302+
<>
303+
<div className="dc__bullet" />
304+
<div className="dc__first-letter-capitalize">{getDeploymentStageTitle(stage)}</div>
305+
</>
306+
)}
307+
</div>
308+
{environmentName && (
309+
<>
310+
<ICArrowRight className="icon-dim-14 scn-9 dc__no-shrink" />
311+
<span className="dc__truncate">{environmentName}</span>
312+
</>
313+
)}
314+
{renderTargetConfigInfo?.()}
315+
</div>
297316

298317
<time className="cn-7 fs-13">
299318
{moment(startedOn, 'YYYY-MM-DDTHH:mm:ssZ').format(DATE_TIME_FORMATS.TWELVE_HOURS_FORMAT)}
@@ -417,6 +436,7 @@ export const TriggerDetails = React.memo(
417436
workerPodName,
418437
triggerMetadata,
419438
renderDeploymentHistoryTriggerMetaText,
439+
renderTargetConfigInfo,
420440
}: TriggerDetailsType): JSX.Element => (
421441
<div className="trigger-details flexbox-col pb-12">
422442
<div className="display-grid trigger-details__grid py-12">
@@ -436,6 +456,8 @@ export const TriggerDetails = React.memo(
436456
isJobView={isJobView}
437457
triggerMetadata={triggerMetadata}
438458
renderDeploymentHistoryTriggerMetaText={renderDeploymentHistoryTriggerMetaText}
459+
renderTargetConfigInfo={renderTargetConfigInfo}
460+
stage={stage}
439461
/>
440462

441463
<CurrentStatus
@@ -657,6 +679,7 @@ const TriggerOutput = ({
657679
resourceId,
658680
scrollToTop,
659681
scrollToBottom,
682+
renderTargetConfigInfo,
660683
}: TriggerOutputProps) => {
661684
const { appId, triggerId, envId, pipelineId } = useParams<{
662685
appId: string
@@ -686,12 +709,15 @@ const TriggerOutput = ({
686709
const appliedFiltersTimestamp = triggerHistory.get(syncTriggerId)?.appliedFiltersTimestamp
687710
const promotionApprovalMetadata = triggerHistory.get(syncTriggerId)?.promotionApprovalMetadata
688711
const runSource = triggerHistory.get(syncTriggerId)?.runSource
712+
const targetConfig = triggerHistory.get(syncTriggerId)?.targetConfig
713+
689714
// These changes are not subject to change after refresh, add data which will not change
690715
const additionalDataObject = {
691716
...(appliedFilters.length ? { appliedFilters } : {}),
692717
...(appliedFiltersTimestamp ? { appliedFiltersTimestamp } : {}),
693718
...(promotionApprovalMetadata ? { promotionApprovalMetadata } : {}),
694719
...(runSource ? { runSource } : {}),
720+
...(targetConfig ? { targetConfig } : {}),
695721
}
696722
setTriggerHistory((newTriggerHistory) => {
697723
newTriggerHistory.set(syncTriggerId, { ...syncTriggerDetail, ...additionalDataObject })
@@ -808,6 +834,8 @@ const TriggerOutput = ({
808834
artifact={triggerDetails.artifact}
809835
triggerMetadata={triggerDetails.triggerMetadata}
810836
renderDeploymentHistoryTriggerMetaText={renderDeploymentHistoryTriggerMetaText}
837+
environmentName={selectedEnvironmentName}
838+
renderTargetConfigInfo={renderTargetConfigInfo}
811839
/>
812840
<ul className="pl-50 pr-20 pt-8 tab-list tab-list--nodes dc__border-bottom dc__position-sticky dc__top-0 bcn-0 dc__zi-3">
813841
{triggerDetails.stage === 'DEPLOY' && deploymentAppType !== DeploymentAppTypes.HELM && (

src/Shared/Components/CICDHistory/types.tsx

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

17-
import { CSSProperties } from 'react'
17+
import { CSSProperties, ReactElement } from 'react'
1818
import {
1919
OptionType,
2020
UserApprovalMetadataType,
@@ -82,6 +82,17 @@ export interface CICDSidebarFilterOptionType extends OptionType {
8282
deploymentAppDeleteRequest?: boolean
8383
}
8484

85+
// The values can be undefined because of old data
86+
export interface TargetConfigType {
87+
tenantIcon?: string
88+
tenantId?: string
89+
tenantName?: string
90+
installationId?: string
91+
installationName?: string
92+
releaseChannelId?: string
93+
releaseChannelName?: string
94+
}
95+
8596
export interface History {
8697
id: number
8798
name: string
@@ -116,6 +127,7 @@ export interface History {
116127
promotionApprovalMetadata?: PromotionApprovalMetadataType
117128
triggerMetadata?: string
118129
runSource?: RunSourceType
130+
targetConfig?: TargetConfigType
119131
}
120132

121133
export interface DeploymentHistoryResultObject {
@@ -199,9 +211,14 @@ export interface StartDetailsType {
199211
isJobView?: boolean
200212
triggerMetadata?: string
201213
renderDeploymentHistoryTriggerMetaText: (triggerMetaData: string) => JSX.Element
214+
/**
215+
* Callback handler for showing the target config
216+
*/
217+
renderTargetConfigInfo?: () => ReactElement
218+
stage: DeploymentStageType
202219
}
203220

204-
export interface TriggerDetailsType {
221+
export interface TriggerDetailsType extends Pick<StartDetailsType, 'renderTargetConfigInfo'> {
205222
status: string
206223
startedOn: string
207224
finishedOn: string
@@ -356,7 +373,7 @@ export interface VirtualHistoryArtifactProps {
356373
workflowId: number
357374
}
358375
}
359-
export interface TriggerOutputProps extends RenderRunSourceType {
376+
export interface TriggerOutputProps extends RenderRunSourceType, Pick<TriggerDetailsType, 'renderTargetConfigInfo'> {
360377
fullScreenView: boolean
361378
triggerHistory: Map<number, History>
362379
setFullScreenView: React.Dispatch<React.SetStateAction<boolean>>

src/Shared/Components/FilterChips/FilterChips.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const FilterChip = ({
4949
{showRemoveIcon && (
5050
<button
5151
type="button"
52-
className="flex p-0 dc__transparent dc__hover-n50 br-4"
52+
className="flex p-0 dc__transparent dc__hover-remove-btn"
5353
onClick={removeFilter}
5454
aria-label="Remove filter"
5555
>

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export const SelectPickerOption = <OptionValue, IsMulti extends boolean>({
122122
selectProps: { isMulti },
123123
selectOption,
124124
isDisabled,
125+
isSelected,
125126
} = props
126127
const { description, startIcon, endIcon } = data ?? {}
127128
const showDescription = !!description
@@ -141,7 +142,7 @@ export const SelectPickerOption = <OptionValue, IsMulti extends boolean>({
141142
<Checkbox
142143
onChange={noop}
143144
onClick={handleChange}
144-
isChecked={props.isSelected || false}
145+
isChecked={isSelected || false}
145146
value={CHECKBOX_VALUE.CHECKED}
146147
rootClassName="mb-0 w-20 p-2 dc__align-self-start dc__no-shrink"
147148
disabled={isDisabled}

src/Shared/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ export enum ResourceKindType {
434434
cluster = 'cluster',
435435
release = 'release',
436436
releaseTrack = 'release-track',
437+
releaseChannel = 'release-channel',
437438
tenant = 'tenant',
438439
installation = 'installation',
439440
environment = 'environment',

0 commit comments

Comments
 (0)