From 985ef2fe44ea48d4d01f454dacd9f657180eb942 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Wed, 18 Jun 2025 15:31:20 +0530 Subject: [PATCH 1/5] feat: add new API status code and update types for resource recommendation --- src/Common/Constants.ts | 1 + src/Shared/Providers/types.ts | 11 +++++++++-- src/Shared/Services/types.ts | 1 + src/Shared/types.ts | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index a5a013b75..a8080ec25 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -381,6 +381,7 @@ export const API_STATUS_CODES = { NOT_FOUND: 404, REQUEST_TIMEOUT: 408, CONFLICT: 409, + PRE_CONDITION_FAILED: 412, EXPECTATION_FAILED: 417, UNPROCESSABLE_ENTITY: 422, LOCKED: 423, diff --git a/src/Shared/Providers/types.ts b/src/Shared/Providers/types.ts index c1d1cd9c9..0145ede6b 100644 --- a/src/Shared/Providers/types.ts +++ b/src/Shared/Providers/types.ts @@ -18,7 +18,13 @@ import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react' import { SERVER_MODE } from '../../Common' import { ServerInfo } from '../Components/Header/types' -import { DevtronLicenseInfo, IntelligenceConfig, LicenseInfoDialogType, ToastManager } from '..' +import { + DevtronLicenseInfo, + EnvironmentDataValuesDTO, + IntelligenceConfig, + LicenseInfoDialogType, + ToastManager, +} from '..' export interface ReloadVersionConfigTypes { bgUpdated: boolean @@ -48,6 +54,7 @@ type AIAgentContextType = { context: Record } +// Please make sure to make it optional if not required in gatekeeper type CommonMainContextProps = { setServerMode: (serverMode: SERVER_MODE) => void isHelpGettingStartedClicked: boolean @@ -90,7 +97,7 @@ type CommonMainContextProps = { setIntelligenceConfig: Dispatch> setAIAgentContext: (aiAgentContext: AIAgentContextType) => void setSidePanelConfig: Dispatch> -} +} & Pick export type MainContext = CommonMainContextProps & ( diff --git a/src/Shared/Services/types.ts b/src/Shared/Services/types.ts index 2d98e6c76..54ca9fc7c 100644 --- a/src/Shared/Services/types.ts +++ b/src/Shared/Services/types.ts @@ -60,4 +60,5 @@ export interface EnvironmentDataValuesDTO extends Pick & From 47b078d249b58986b168b99acdc357b8628910c7 Mon Sep 17 00:00:00 2001 From: AbhishekA1509 Date: Wed, 18 Jun 2025 16:26:28 +0530 Subject: [PATCH 2/5] feat: update button size handling in InfoBlock component --- .../Components/InfoBlock/InfoBlock.component.tsx | 10 +++++++--- src/Shared/Components/InfoBlock/constants.tsx | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx index 0f5309242..322542853 100644 --- a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx +++ b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx @@ -19,8 +19,9 @@ import { deriveBorderRadiusAndBorderClassFromConfig } from '@Shared/Helpers' import { Button } from '../Button' import { - CONTAINER_SIZE_TO_BUTTON_SIZE, CONTAINER_SIZE_TO_CLASS_MAP, + CONTAINER_SIZE_TO_ICON_BUTTON_SIZE, + CONTAINER_SIZE_TO_TEXT_BUTTON_SIZE, SIZE_TO_ICON_CLASS_MAP, VARIANT_TO_ICON_MAP, } from './constants' @@ -40,6 +41,9 @@ const InfoBlock = ({ const baseContainerClass = `${CONTAINER_SIZE_TO_CLASS_MAP[size]} ${VARIANT_TO_BG_MAP[variant]} ${VARIANT_TO_BORDER_MAP[variant]} ${deriveBorderRadiusAndBorderClassFromConfig({ borderConfig, borderRadiusConfig })} w-100 py-8 br-4 bw-1` const iconClass = `dc__no-shrink flex dc__fill-available-space ${SIZE_TO_ICON_CLASS_MAP[size]}` const icon = customIcon ?? VARIANT_TO_ICON_MAP[variant] + const buttonSize = buttonProps.icon + ? CONTAINER_SIZE_TO_ICON_BUTTON_SIZE[size] + : CONTAINER_SIZE_TO_TEXT_BUTTON_SIZE[size] const renderIcon = () => {icon} @@ -99,7 +103,7 @@ const InfoBlock = ({ {renderContent()} - {buttonProps &&