Skip to content

Commit b5dab7c

Browse files
Merge pull request #734 from devtron-labs/fix/target-platform-tooltip
fix: add logsRendererRef to fix target platform tippy clipping from search bar and other sticky divs
2 parents cd187d7 + 897b880 commit b5dab7c

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

src/Shared/Components/CICDHistory/LogStageAccordion.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const LogStageAccordion = ({
4343
fullScreenView,
4444
searchIndex,
4545
targetPlatforms,
46+
logsRendererRef,
4647
}: LogStageAccordionProps) => {
4748
const handleAccordionToggle = () => {
4849
if (isOpen) {
@@ -78,6 +79,8 @@ const LogStageAccordion = ({
7879
}
7980
}
8081

82+
const getLogsRendererReference = () => logsRendererRef.current
83+
8184
return (
8285
<div className="flexbox-col dc__gap-8">
8386
<button
@@ -103,7 +106,10 @@ const LogStageAccordion = ({
103106
<div className="flexbox dc__gap-8 dc__align-items-center">
104107
{!!targetPlatforms?.length && (
105108
<>
106-
<TargetPlatformListTooltip targetPlatforms={targetPlatforms}>
109+
<TargetPlatformListTooltip
110+
targetPlatforms={targetPlatforms}
111+
appendTo={getLogsRendererReference}
112+
>
107113
<div className="flexbox dc__gap-4 dc__align-items-center">
108114
<ICStack className="dc__no-shrink icon-stroke__white icon-dim-12" />
109115
<span className="text__white fs-13 fw-4 lh-20">

src/Shared/Components/CICDHistory/LogsRenderer.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ const useCIEventSource = (url: string, maxLength?: number): [string[], EventSour
179179

180180
const LogsRenderer = ({ triggerDetails, isBlobStorageConfigured, parentType, fullScreenView }: LogsRendererType) => {
181181
const { pipelineId, envId, appId } = useParams<DeploymentHistoryBaseParamsType>()
182+
const logsRendererRef = useRef<HTMLDivElement>(null)
183+
182184
const logsURL =
183185
parentType === HistoryComponentType.CI
184186
? `${Host}/${ROUTES.CI_CONFIG_GET}/${pipelineId}/workflow/${triggerDetails.id}/logs`
@@ -579,6 +581,7 @@ const LogsRenderer = ({ triggerDetails, isBlobStorageConfigured, parentType, ful
579581
isLoading={index === stageList.length - 1 && areEventsProgressing}
580582
fullScreenView={fullScreenView}
581583
searchIndex={searchResults[currentSearchIndex]}
584+
logsRendererRef={logsRendererRef}
582585
/>
583586
),
584587
)}
@@ -615,7 +618,10 @@ const LogsRenderer = ({ triggerDetails, isBlobStorageConfigured, parentType, ful
615618
}
616619

617620
return (
618-
<div className={`flexbox-col flex-grow-1 ${getComponentSpecificThemeClass(AppThemeType.dark)}`}>
621+
<div
622+
className={`flexbox-col flex-grow-1 ${getComponentSpecificThemeClass(AppThemeType.dark)}`}
623+
ref={logsRendererRef}
624+
>
619625
{triggerDetails.podStatus !== POD_STATUS.PENDING &&
620626
logsNotAvailable &&
621627
(!isBlobStorageConfigured || !triggerDetails.blobStorageEnabled)

src/Shared/Components/CICDHistory/types.tsx

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

17-
import { CSSProperties, ReactElement, ReactNode } from 'react'
17+
import { CSSProperties, MutableRefObject, ReactElement, ReactNode } from 'react'
1818

1919
import { SupportedKeyboardKeysType } from '@Common/Hooks/UseRegisterShortcut/types'
2020

@@ -834,6 +834,7 @@ export interface LogStageAccordionProps extends StageDetailType, Pick<LogsRender
834834
*/
835835
isLoading: boolean
836836
searchIndex: string
837+
logsRendererRef: MutableRefObject<HTMLDivElement>
837838
}
838839

839840
export interface CreateMarkupReturnType {

src/Shared/Components/TargetPlatforms/TargetPlatformListTooltip.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ const TooltipContent = ({ targetPlatforms }: Pick<TargetPlatformListTooltipProps
3333
</div>
3434
)
3535

36-
const TargetPlatformListTooltip = ({ targetPlatforms, children }: TargetPlatformListTooltipProps) => (
36+
const TargetPlatformListTooltip = ({ targetPlatforms, children, appendTo }: TargetPlatformListTooltipProps) => (
3737
<Tooltip
3838
content={<TooltipContent targetPlatforms={targetPlatforms} />}
3939
placement="right"
4040
alwaysShowTippyOnHover
4141
interactive
42+
appendTo={appendTo}
4243
>
4344
{children}
4445
</Tooltip>

src/Shared/Components/TargetPlatforms/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ import { TooltipProps } from '@Common/Tooltip/types'
1818
import { TargetPlatformsDTO } from '@Shared/types'
1919

2020
export interface TargetPlatformBadgeListProps extends Required<Pick<TargetPlatformsDTO, 'targetPlatforms'>> {}
21-
export interface TargetPlatformListTooltipProps extends Pick<TargetPlatformsDTO, 'targetPlatforms'> {
22-
children: TooltipProps['children']
23-
}
21+
export interface TargetPlatformListTooltipProps
22+
extends Pick<TargetPlatformsDTO, 'targetPlatforms'>,
23+
Pick<TooltipProps, 'children' | 'appendTo'> {}

0 commit comments

Comments
 (0)