Skip to content

Commit ce2759d

Browse files
Merge pull request #741 from devtron-labs/feat/redfish-node-ui-rc
feat: redfish node ui
2 parents 9baa102 + 3e250dc commit ce2759d

File tree

11 files changed

+53
-17
lines changed

11 files changed

+53
-17
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": "1.13.0-pre-7",
3+
"version": "1.13.0-pre-8",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/IconV2/ic-terminal.svg

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/Common/SegmentedBarChart/SegmentedBarChart.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { Entity, SegmentedBarChartProps } from './types'
2323
import './styles.scss'
2424

2525
const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
26+
hideLegend,
2627
entities: userEntities = [FALLBACK_ENTITY],
2728
rootClassName,
2829
countClassName,
@@ -36,7 +37,7 @@ const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
3637
const total = entities.reduce((sum, entity) => entity.value + sum, 0)
3738
const filteredEntities = entities.filter((entity) => !!entity.value)
3839

39-
const calcSegmentWidth = (entity: Entity) => `${(entity.value / total) * 100}%`
40+
const calcSegmentWidth = (entityValue: Entity['value']) => `${(entityValue / total) * 100}%`
4041

4142
const renderLabel = (label: Entity['label']) =>
4243
isLoading ? (
@@ -88,11 +89,17 @@ const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
8889
))
8990
}
9091

91-
const renderLegend = () => (
92-
<div className={`flexbox flex-wrap dc__row-gap-4 ${isProportional ? 'dc__gap-24' : 'dc__gap-16'}`}>
93-
{renderContent()}
94-
</div>
95-
)
92+
const renderLegend = () => {
93+
if (hideLegend) {
94+
return null
95+
}
96+
97+
return (
98+
<div className={`flexbox flex-wrap dc__row-gap-4 ${isProportional ? 'dc__gap-24' : 'dc__gap-16'}`}>
99+
{renderContent()}
100+
</div>
101+
)
102+
}
96103

97104
const renderBar = () => (
98105
<motion.div
@@ -112,7 +119,7 @@ const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
112119
className={`h-8 ${index === 0 ? 'dc__left-radius-4' : ''} ${
113120
index === map.length - 1 ? 'dc__right-radius-4' : ''
114121
} ${isLoading ? 'shimmer' : ''}`}
115-
style={{ backgroundColor: entity.color, width: calcSegmentWidth(entity) }}
122+
style={{ backgroundColor: entity.color, width: calcSegmentWidth(entity.value) }}
116123
/>
117124
))}
118125
</motion.div>

src/Common/SegmentedBarChart/types.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ export type Entity = {
2020
value: number
2121
}
2222

23-
export interface SegmentedBarChartProps {
24-
entities: NonNullable<Entity[]>
23+
type EntityPropType =
24+
| {
25+
hideLegend?: false
26+
entities: NonNullable<Entity[]>
27+
}
28+
| {
29+
hideLegend: true
30+
entities: NonNullable<Omit<Entity, 'label'> & { label?: never }>[]
31+
}
32+
33+
export type SegmentedBarChartProps = {
2534
rootClassName?: string
2635
countClassName?: string
2736
labelClassName?: string
2837
isProportional?: boolean
2938
swapLegendAndBar?: boolean
3039
showAnimationOnBar?: boolean
3140
isLoading?: boolean
32-
}
41+
} & EntityPropType

src/Pages/ResourceBrowser/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import { Dispatch, ReactElement, SetStateAction } from 'react'
1818

19+
import { TabProps } from '@Shared/Components'
1920
import { InstallationClusterType } from '@Shared/types'
2021

2122
import { NodeActionRequest } from './ResourceBrowser.Types'
@@ -113,6 +114,11 @@ export interface AdditionalConfirmationModalOptionsProps<T = unknown> {
113114
children?: ReactElement
114115
}
115116

117+
export type NodeDetailTabsInfoType = (Pick<TabProps, 'label' | 'icon'> & {
118+
id: string
119+
renderComponent: () => JSX.Element
120+
})[]
121+
116122
export interface InstallationClusterStepType {
117123
lastTransitionTime: string
118124
lastProbeTime: string

src/Shared/Components/BulkOperations/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { ReactNode } from 'react'
1818

1919
import { APIOptions, DrawerProps } from '@Common/index'
20-
import { SegmentedBarChartProps } from '@Common/SegmentedBarChart'
20+
import { Entity } from '@Common/SegmentedBarChart/types'
2121

2222
import { ConfirmationModalProps } from '../ConfirmationModal/types'
2323
import { getProgressingStateForStatus } from '../Security'
@@ -64,7 +64,7 @@ export interface OperationResultStoreType {
6464
getResults: (
6565
sortComparator: (a: BulkOperationResultType, b: BulkOperationResultType) => number,
6666
) => BulkOperationResultWithIdType[]
67-
getBarChartEntities: () => SegmentedBarChartProps['entities']
67+
getBarChartEntities: () => NonNullable<Entity[]>
6868
getResultsStatusCount: () => Record<BulkOperationResultType['status'], number>
6969
getSize: () => number
7070
updateResultStatus: (

src/Shared/Components/Icon/Icon.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ import { ReactComponent as ICStamp } from '@IconsV2/ic-stamp.svg'
138138
import { ReactComponent as ICSuccess } from '@IconsV2/ic-success.svg'
139139
import { ReactComponent as ICSuspended } from '@IconsV2/ic-suspended.svg'
140140
import { ReactComponent as ICTata1mg } from '@IconsV2/ic-tata1mg.svg'
141+
import { ReactComponent as ICTerminal } from '@IconsV2/ic-terminal.svg'
141142
import { ReactComponent as ICTerminalFill } from '@IconsV2/ic-terminal-fill.svg'
143+
import { ReactComponent as ICThermometer } from '@IconsV2/ic-thermometer.svg'
142144
import { ReactComponent as ICThumbDown } from '@IconsV2/ic-thumb-down.svg'
143145
import { ReactComponent as ICThumbUp } from '@IconsV2/ic-thumb-up.svg'
144146
import { ReactComponent as ICTimeoutDash } from '@IconsV2/ic-timeout-dash.svg'
@@ -296,6 +298,8 @@ export const iconMap = {
296298
'ic-suspended': ICSuspended,
297299
'ic-tata1mg': ICTata1mg,
298300
'ic-terminal-fill': ICTerminalFill,
301+
'ic-terminal': ICTerminal,
302+
'ic-thermometer': ICThermometer,
299303
'ic-thumb-down': ICThumbDown,
300304
'ic-thumb-up': ICThumbUp,
301305
'ic-timeout-dash': ICTimeoutDash,

src/Shared/Components/Security/SecurityModal/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import React from 'react'
1818

19-
import { SegmentedBarChartProps } from '@Common/SegmentedBarChart'
19+
import { Entity } from '@Common/SegmentedBarChart/types'
2020
import { ServerErrors } from '@Common/ServerError'
2121
import { GenericEmptyStateType } from '@Common/Types'
2222
import { LastExecutionResultType, Nodes, NodeType } from '@Shared/types'
@@ -103,7 +103,7 @@ export interface StatusType {
103103
}
104104

105105
export interface InfoCardPropsType extends Pick<StatusType, 'scanToolName' | 'scanToolUrl'> {
106-
entities: SegmentedBarChartProps['entities']
106+
entities: NonNullable<Entity[]>
107107
lastScanTimeString?: string
108108
}
109109

0 commit comments

Comments
 (0)