Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "1.13.0",
"version": "1.13.0-redfish-preview-beta-1",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-terminal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/IconV2/ic-thermometer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 14 additions & 7 deletions src/Common/SegmentedBarChart/SegmentedBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { Entity, SegmentedBarChartProps } from './types'
import './styles.scss'

const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
hideLegend,
entities: userEntities = [FALLBACK_ENTITY],
rootClassName,
countClassName,
Expand All @@ -36,7 +37,7 @@ const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
const total = entities.reduce((sum, entity) => entity.value + sum, 0)
const filteredEntities = entities.filter((entity) => !!entity.value)

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

const renderLabel = (label: Entity['label']) =>
isLoading ? (
Expand Down Expand Up @@ -88,11 +89,17 @@ const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
))
}

const renderLegend = () => (
<div className={`flexbox flex-wrap dc__row-gap-4 ${isProportional ? 'dc__gap-24' : 'dc__gap-16'}`}>
{renderContent()}
</div>
)
const renderLegend = () => {
if (hideLegend) {
return null
}

return (
<div className={`flexbox flex-wrap dc__row-gap-4 ${isProportional ? 'dc__gap-24' : 'dc__gap-16'}`}>
{renderContent()}
</div>
)
}

const renderBar = () => (
<motion.div
Expand All @@ -112,7 +119,7 @@ const SegmentedBarChart: React.FC<SegmentedBarChartProps> = ({
className={`h-8 ${index === 0 ? 'dc__left-radius-4' : ''} ${
index === map.length - 1 ? 'dc__right-radius-4' : ''
} ${isLoading ? 'shimmer' : ''}`}
style={{ backgroundColor: entity.color, width: calcSegmentWidth(entity) }}
style={{ backgroundColor: entity.color, width: calcSegmentWidth(entity.value) }}
/>
))}
</motion.div>
Expand Down
15 changes: 12 additions & 3 deletions src/Common/SegmentedBarChart/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ export type Entity = {
value: number
}

export interface SegmentedBarChartProps {
entities: NonNullable<Entity[]>
type EntityPropType =
| {
hideLegend?: false
entities: NonNullable<Entity[]>
}
| {
hideLegend: true
entities: NonNullable<Omit<Entity, 'label'> & { label?: never }>[]
}

export type SegmentedBarChartProps = {
rootClassName?: string
countClassName?: string
labelClassName?: string
isProportional?: boolean
swapLegendAndBar?: boolean
showAnimationOnBar?: boolean
isLoading?: boolean
}
} & EntityPropType
7 changes: 7 additions & 0 deletions src/Pages/ResourceBrowser/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

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

import { TabProps } from '@Shared/Components'

import { NodeActionRequest } from './ResourceBrowser.Types'

export enum ClusterFiltersType {
Expand Down Expand Up @@ -99,3 +101,8 @@ export interface AdditionalConfirmationModalOptionsProps<T = unknown> {
setOptionsData: Dispatch<SetStateAction<T>>
children?: ReactElement
}

export type NodeDetailTabsInfoType = (Pick<TabProps, 'label' | 'icon'> & {
id: string
renderComponent: () => JSX.Element
})[]
4 changes: 2 additions & 2 deletions src/Shared/Components/BulkOperations/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { ReactNode } from 'react'

import { APIOptions, DrawerProps } from '@Common/index'
import { SegmentedBarChartProps } from '@Common/SegmentedBarChart'
import { Entity } from '@Common/SegmentedBarChart/types'

import { ConfirmationModalProps } from '../ConfirmationModal/types'
import { getProgressingStateForStatus } from '../Security'
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface OperationResultStoreType {
getResults: (
sortComparator: (a: BulkOperationResultType, b: BulkOperationResultType) => number,
) => BulkOperationResultWithIdType[]
getBarChartEntities: () => SegmentedBarChartProps['entities']
getBarChartEntities: () => NonNullable<Entity[]>
getResultsStatusCount: () => Record<BulkOperationResultType['status'], number>
getSize: () => number
updateResultStatus: (
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/Components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ import { ReactComponent as ICStamp } from '@IconsV2/ic-stamp.svg'
import { ReactComponent as ICSuccess } from '@IconsV2/ic-success.svg'
import { ReactComponent as ICSuspended } from '@IconsV2/ic-suspended.svg'
import { ReactComponent as ICTata1mg } from '@IconsV2/ic-tata1mg.svg'
import { ReactComponent as ICTerminal } from '@IconsV2/ic-terminal.svg'
import { ReactComponent as ICTerminalFill } from '@IconsV2/ic-terminal-fill.svg'
import { ReactComponent as ICThermometer } from '@IconsV2/ic-thermometer.svg'
import { ReactComponent as ICThumbDown } from '@IconsV2/ic-thumb-down.svg'
import { ReactComponent as ICThumbUp } from '@IconsV2/ic-thumb-up.svg'
import { ReactComponent as ICTimeoutDash } from '@IconsV2/ic-timeout-dash.svg'
Expand Down Expand Up @@ -231,6 +233,8 @@ export const iconMap = {
'ic-suspended': ICSuspended,
'ic-tata1mg': ICTata1mg,
'ic-terminal-fill': ICTerminalFill,
'ic-terminal': ICTerminal,
'ic-thermometer': ICThermometer,
'ic-thumb-down': ICThumbDown,
'ic-thumb-up': ICThumbUp,
'ic-timeout-dash': ICTimeoutDash,
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/Components/Security/SecurityModal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React from 'react'

import { SegmentedBarChartProps } from '@Common/SegmentedBarChart'
import { Entity } from '@Common/SegmentedBarChart/types'
import { ServerErrors } from '@Common/ServerError'
import { GenericEmptyStateType } from '@Common/Types'
import { LastExecutionResultType, Nodes, NodeType } from '@Shared/types'
Expand Down Expand Up @@ -103,7 +103,7 @@ export interface StatusType {
}

export interface InfoCardPropsType extends Pick<StatusType, 'scanToolName' | 'scanToolUrl'> {
entities: SegmentedBarChartProps['entities']
entities: NonNullable<Entity[]>
lastScanTimeString?: string
}

Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ export interface customEnv {
* @default false
*/
FEATURE_APPLICATION_TEMPLATES_ENABLE?: boolean
/**
* @default false
*/
FEATURE_REDFISH_NODE_ENABLE?: boolean
GATEKEEPER_URL?: string
FEATURE_AI_INTEGRATION_ENABLE?: boolean
LOGIN_PAGE_IMAGE?: string
Expand Down