Skip to content

Dummy resource recommender develop #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: dummy-resource-recommender
Choose a base branch
from
Open
2 changes: 2 additions & 0 deletions src/Common/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const URLS = {
// NOTE: using appId since we are re-using AppConfig component
GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP_DETAIL: `${GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP}/detail/:appId`,
LICENSE_AUTH: '/license-auth',
GLOBAL_CONFIG_EDIT_CLUSTER: '/global-config/cluster-env/edit/:clusterId',
} as const

export const ROUTES = {
Expand Down Expand Up @@ -381,6 +382,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,
Expand Down
10 changes: 7 additions & 3 deletions src/Shared/Components/InfoBlock/InfoBlock.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 = () => <span className={iconClass}>{icon}</span>

Expand Down Expand Up @@ -99,7 +103,7 @@ const InfoBlock = ({
{renderContent()}
</div>

{buttonProps && <Button {...buttonProps} size={CONTAINER_SIZE_TO_BUTTON_SIZE[size]} />}
{buttonProps && <Button {...buttonProps} size={buttonSize} />}
</div>
)
}
Expand All @@ -112,7 +116,7 @@ const InfoBlock = ({
{renderIcon()}
</div>

{buttonProps && <Button {...buttonProps} size={CONTAINER_SIZE_TO_BUTTON_SIZE[size]} />}
{buttonProps && <Button {...buttonProps} size={buttonSize} />}
</div>
)
}
Expand Down
9 changes: 7 additions & 2 deletions src/Shared/Components/InfoBlock/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ export const SIZE_TO_ICON_CLASS_MAP: Record<InfoBlockProps['size'], string> = {
[ComponentSizeType.medium]: 'icon-dim-18',
}

export const CONTAINER_SIZE_TO_BUTTON_SIZE: Record<InfoBlockProps['size'], ButtonProps['size']> = {
export const CONTAINER_SIZE_TO_TEXT_BUTTON_SIZE: Record<InfoBlockProps['size'], ButtonProps['size']> = {
[ComponentSizeType.large]: ComponentSizeType.medium,
[ComponentSizeType.medium]: ComponentSizeType.small,
[ComponentSizeType.medium]: ComponentSizeType.xs,
}

export const CONTAINER_SIZE_TO_ICON_BUTTON_SIZE: Record<InfoBlockProps['size'], ButtonProps['size']> = {
[ComponentSizeType.large]: ComponentSizeType.xxs,
[ComponentSizeType.medium]: ComponentSizeType.xxs,
}
11 changes: 9 additions & 2 deletions src/Shared/Providers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,6 +54,7 @@ type AIAgentContextType = {
context: Record<string, string>
}

// Please make sure to make it optional if not required in gatekeeper
type CommonMainContextProps = {
setServerMode: (serverMode: SERVER_MODE) => void
isHelpGettingStartedClicked: boolean
Expand Down Expand Up @@ -90,7 +97,7 @@ type CommonMainContextProps = {
setIntelligenceConfig: Dispatch<SetStateAction<IntelligenceConfig>>
setAIAgentContext: (aiAgentContext: AIAgentContextType) => void
setSidePanelConfig: Dispatch<SetStateAction<SidePanelConfig>>
}
} & Pick<EnvironmentDataValuesDTO, 'isResourceRecommendationEnabled'>

export type MainContext = CommonMainContextProps &
(
Expand Down
1 change: 1 addition & 0 deletions src/Shared/Services/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ export interface EnvironmentDataValuesDTO extends Pick<MainContext, 'featureGitO
isManifestScanningEnabled: boolean
canOnlyViewPermittedEnvOrgLevel: boolean
devtronManagedLicensingEnabled: boolean
isResourceRecommendationEnabled?: boolean
}
9 changes: 9 additions & 0 deletions src/Shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,15 @@ interface CommonTabArgsType {
* @default false
*/
shouldRemainMounted?: boolean
/**
* @default false
* If true, tab would contain alpha as badge next to the title
*/
isAlpha?: boolean
/**
* On tab stop, i.e by pressing cross icon on alive tab [fixed tab expanding on click of tab and remains expanded on other tab click], tab will reset the tab to this default URL if provided
*/
defaultUrl?: string | null
}

export type InitTabType = Omit<CommonTabArgsType, 'type'> &
Expand Down