Skip to content

Commit 30c1684

Browse files
committed
Merge branch 'kubecon-2024' into feat/rb-sync-cluster
2 parents 98604c3 + 46e5186 commit 30c1684

File tree

9 files changed

+43
-19
lines changed

9 files changed

+43
-19
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.6.0-patch-1-beta-10",
3+
"version": "0.6.0-patch-1-beta-13",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/DraggableWrapper/DraggableWrapper.tsx

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

17-
import React, { useEffect, useRef, useState } from 'react'
17+
import { useEffect, useRef, useState } from 'react'
1818
import Draggable, { ControlPosition, DraggableData } from 'react-draggable'
1919
import { DraggableWrapperProps, DraggablePositionVariant } from './types'
2020
import { useWindowSize } from '../Hooks'
@@ -71,6 +71,12 @@ export default function DraggableWrapper({
7171
const y = baseY - nodeRefHeight - boundaryGap
7272
return { x, y }
7373
}
74+
case DraggablePositionVariant.SCREEN_BOTTOM_RIGHT: {
75+
const x = windowSize.width - parentRect.left - nodeRefWidth - boundaryGap
76+
const y = windowSize.height - parentRect.top - nodeRefHeight - boundaryGap
77+
78+
return { x, y }
79+
}
7480
// Add more cases for other variants if needed
7581
default: {
7682
// Since need node to be in center of screen so subtracting width/2 by left of parentRect it will start the node from center but want node's midpoint at center so subtracting node's width from it.

src/Common/DraggableWrapper/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { HTMLAttributes, ReactNode, RefObject } from 'react'
1919
export enum DraggablePositionVariant {
2020
PARENT_BOTTOM_CENTER = 'PARENT_BOTTOM_CENTER',
2121
SCREEN_BOTTOM_CENTER = 'SCREEN_BOTTOM_CENTER',
22+
SCREEN_BOTTOM_RIGHT = 'SCREEN_BOTTOM_RIGHT',
2223
// Can add more based on requirement
2324
}
2425

src/Common/Helper.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import React, { SyntheticEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'
1818
import DOMPurify from 'dompurify'
1919
import { JSONPath, JSONPathOptions } from 'jsonpath-plus'
20-
import { compare as compareJSON, applyPatch } from 'fast-json-patch'
20+
import { compare as compareJSON, applyPatch, unescapePathComponent } from 'fast-json-patch'
2121
import { components } from 'react-select'
2222
import * as Sentry from '@sentry/browser'
2323
import moment from 'moment'
@@ -595,7 +595,7 @@ const buildObjectFromPathTokens = (index: number, tokens: string[], value: any)
595595
const isKeyNumber = !Number.isNaN(numberKey)
596596
return isKeyNumber
597597
? [...Array(numberKey).fill(null), buildObjectFromPathTokens(index + 1, tokens, value)]
598-
: { [key]: buildObjectFromPathTokens(index + 1, tokens, value) }
598+
: { [unescapePathComponent(key)]: buildObjectFromPathTokens(index + 1, tokens, value) }
599599
}
600600

601601
/**
@@ -644,10 +644,7 @@ export const powerSetOfSubstringsFromStart = (strings: string[], regex: RegExp)
644644
})
645645

646646
export const convertJSONPointerToJSONPath = (pointer: string) =>
647-
pointer
648-
.replace(/\/([\*0-9]+)\//g, '[$1].')
649-
.replace(/\//g, '.')
650-
.replace(/\./, '$.')
647+
unescapePathComponent(pointer.replace(/\/([\*0-9]+)\//g, '[$1].').replace(/\//g, '.').replace(/\./, '$.'))
651648

652649
export const flatMapOfJSONPaths = (
653650
paths: string[],

src/Common/Types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,3 +993,13 @@ export interface EnvironmentHelmResult {
993993
}
994994

995995
export type EnvironmentListHelmResponse = ResponseType<EnvironmentListHelmResult[]>
996+
997+
export interface WidgetEventDetails {
998+
message: string
999+
namespace: string
1000+
object: string
1001+
source: string
1002+
count: number
1003+
age: string
1004+
lastSeen: string
1005+
}

src/Shared/Components/CollapsibleList/CollapsibleList.component.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Fragment } from 'react'
22
import { NavLink, useLocation } from 'react-router-dom'
33
import Tippy, { TippyProps } from '@tippyjs/react'
44
import { ConditionalWrap } from '@Common/Helper'
5+
import { Tooltip } from '@Common/Tooltip'
56
import { ReactComponent as ICExpand } from '@Icons/ic-expand.svg'
67

78
import { Collapse } from '../Collapse'
@@ -31,7 +32,9 @@ export const CollapsibleList = ({ config, onCollapseBtnClick }: CollapsibleListP
3132
className="icon-dim-20 fcn-6 dc__no-shrink cursor rotate"
3233
style={{ ['--rotateBy' as string]: isExpanded ? '0deg' : '-90deg' }}
3334
/>
34-
<span className="flex-grow-1 dc__align-left dc__truncate">{header}</span>
35+
<Tooltip content={header} placement="right">
36+
<span className="flex-grow-1 dc__align-left dc__truncate">{header}</span>
37+
</Tooltip>
3538
</button>
3639
{headerIconConfig && (
3740
<ConditionalWrap
@@ -60,7 +63,7 @@ export const CollapsibleList = ({ config, onCollapseBtnClick }: CollapsibleListP
6063
</span>
6164
</div>
6265
) : (
63-
items.map(({ title, strikeThrough, href, iconConfig, subtitle, onClick }) => (
66+
items.map(({ title, strikeThrough, href, iconConfig, subtitle, onClick, isActive }) => (
6467
<NavLink
6568
key={title}
6669
to={href}
@@ -72,15 +75,20 @@ export const CollapsibleList = ({ config, onCollapseBtnClick }: CollapsibleListP
7275
}
7376
onClick?.(e)
7477
}}
78+
isActive={isActive}
7579
>
7680
<div className="flexbox-col flex-grow-1 mw-none">
77-
<span
78-
className={`collapsible__item__title dc__truncate fs-13 lh-20 ${strikeThrough ? 'dc__strike-through' : ''}`}
79-
>
80-
{title}
81-
</span>
81+
<Tooltip content={title} placement="right">
82+
<span
83+
className={`collapsible__item__title dc__truncate fs-13 lh-20 ${strikeThrough ? 'dc__strike-through' : ''}`}
84+
>
85+
{title}
86+
</span>
87+
</Tooltip>
8288
{subtitle && (
83-
<span className="dc__truncate fw-4 lh-1-5 cn-7">{subtitle}</span>
89+
<Tooltip content={subtitle} placement="right">
90+
<span className="dc__truncate fw-4 lh-1-5 cn-7">{subtitle}</span>
91+
</Tooltip>
8492
)}
8593
</div>
8694
{iconConfig && (

src/Shared/Components/CollapsibleList/CollapsibleList.types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react'
22
import { TippyProps } from '@tippyjs/react'
3+
import { NavLinkProps } from 'react-router-dom'
34

4-
export interface CollapsibleListItem {
5+
export interface CollapsibleListItem extends Pick<NavLinkProps, 'isActive'> {
56
/**
67
* The title of the list item.
78
*/

src/Shared/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export enum Nodes {
120120
Namespace = 'Namespace',
121121
Overview = 'Overview',
122122
MonitoringDashboard = 'MonitoringDashboard',
123+
UpgradeCluster = 'UpgradeCluster',
123124
}
124125

125126
// FIXME: This should be `typeof Nodes[keyof typeof Nodes]` instead since the key and values are not the same. Same to be removed from duplications in dashboard

0 commit comments

Comments
 (0)