From 305e3ed1b2ddaff2111fda0267ca806455e30225 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Wed, 23 Apr 2025 17:32:24 +0530 Subject: [PATCH 01/15] chore: icons for banner updated --- src/Assets/IconV2/ic-disconnect.svg | 3 +++ src/Assets/IconV2/ic-gift.svg | 3 +++ src/Assets/IconV2/ic-megaphone-left.svg | 3 +++ src/Assets/IconV2/ic-sparkle-color.svg | 21 +++++++++++++++++++++ src/Shared/Components/Icon/Icon.tsx | 8 ++++++++ 5 files changed, 38 insertions(+) create mode 100644 src/Assets/IconV2/ic-disconnect.svg create mode 100644 src/Assets/IconV2/ic-gift.svg create mode 100644 src/Assets/IconV2/ic-megaphone-left.svg create mode 100644 src/Assets/IconV2/ic-sparkle-color.svg diff --git a/src/Assets/IconV2/ic-disconnect.svg b/src/Assets/IconV2/ic-disconnect.svg new file mode 100644 index 000000000..7ca7adaab --- /dev/null +++ b/src/Assets/IconV2/ic-disconnect.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/Assets/IconV2/ic-gift.svg b/src/Assets/IconV2/ic-gift.svg new file mode 100644 index 000000000..5aea477d9 --- /dev/null +++ b/src/Assets/IconV2/ic-gift.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Assets/IconV2/ic-megaphone-left.svg b/src/Assets/IconV2/ic-megaphone-left.svg new file mode 100644 index 000000000..48001f96b --- /dev/null +++ b/src/Assets/IconV2/ic-megaphone-left.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Assets/IconV2/ic-sparkle-color.svg b/src/Assets/IconV2/ic-sparkle-color.svg new file mode 100644 index 000000000..38020b4db --- /dev/null +++ b/src/Assets/IconV2/ic-sparkle-color.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Shared/Components/Icon/Icon.tsx b/src/Shared/Components/Icon/Icon.tsx index 1b68f10d4..9e5575280 100644 --- a/src/Shared/Components/Icon/Icon.tsx +++ b/src/Shared/Components/Icon/Icon.tsx @@ -40,6 +40,7 @@ import { ReactComponent as ICDeleteLightning } from '@IconsV2/ic-delete-lightnin import { ReactComponent as ICDelhivery } from '@IconsV2/ic-delhivery.svg' import { ReactComponent as ICDevtron } from '@IconsV2/ic-devtron.svg' import { ReactComponent as ICDevtronHeaderLogo } from '@IconsV2/ic-devtron-header-logo.svg' +import { ReactComponent as ICDisconnect } from '@IconsV2/ic-disconnect.svg' import { ReactComponent as ICDockerhub } from '@IconsV2/ic-dockerhub.svg' import { ReactComponent as ICEcr } from '@IconsV2/ic-ecr.svg' import { ReactComponent as ICEnv } from '@IconsV2/ic-env.svg' @@ -48,6 +49,7 @@ import { ReactComponent as ICFailure } from '@IconsV2/ic-failure.svg' import { ReactComponent as ICFileKey } from '@IconsV2/ic-file-key.svg' import { ReactComponent as ICFolderUser } from '@IconsV2/ic-folder-user.svg' import { ReactComponent as ICGear } from '@IconsV2/ic-gear.svg' +import { ReactComponent as ICGift } from '@IconsV2/ic-gift.svg' import { ReactComponent as ICGit } from '@IconsV2/ic-git.svg' import { ReactComponent as ICGithub } from '@IconsV2/ic-github.svg' import { ReactComponent as ICGitlab } from '@IconsV2/ic-gitlab.svg' @@ -74,6 +76,7 @@ import { ReactComponent as ICLoginDevtronLogo } from '@IconsV2/ic-login-devtron- import { ReactComponent as ICLogout } from '@IconsV2/ic-logout.svg' import { ReactComponent as ICMediumDelete } from '@IconsV2/ic-medium-delete.svg' import { ReactComponent as ICMediumPaintbucket } from '@IconsV2/ic-medium-paintbucket.svg' +import { ReactComponent as ICMegaphoneLeft } from '@IconsV2/ic-megaphone-left.svg' import { ReactComponent as ICMicrosoft } from '@IconsV2/ic-microsoft.svg' import { ReactComponent as ICMissing } from '@IconsV2/ic-missing.svg' import { ReactComponent as ICMonitoring } from '@IconsV2/ic-monitoring.svg' @@ -93,6 +96,7 @@ import { ReactComponent as ICSlidersVertical } from '@IconsV2/ic-sliders-vertica import { ReactComponent as ICSortAscending } from '@IconsV2/ic-sort-ascending.svg' import { ReactComponent as ICSortDescending } from '@IconsV2/ic-sort-descending.svg' import { ReactComponent as ICSortable } from '@IconsV2/ic-sortable.svg' +import { ReactComponent as ICSparkleColor } from '@IconsV2/ic-sparkle-color.svg' import { ReactComponent as ICSpinny } from '@IconsV2/ic-spinny.svg' import { ReactComponent as ICStack } from '@IconsV2/ic-stack.svg' import { ReactComponent as ICStamp } from '@IconsV2/ic-stamp.svg' @@ -153,6 +157,7 @@ export const iconMap = { 'ic-delhivery': ICDelhivery, 'ic-devtron-header-logo': ICDevtronHeaderLogo, 'ic-devtron': ICDevtron, + 'ic-disconnect': ICDisconnect, 'ic-dockerhub': ICDockerhub, 'ic-ecr': ICEcr, 'ic-env': ICEnv, @@ -161,6 +166,7 @@ export const iconMap = { 'ic-file-key': ICFileKey, 'ic-folder-user': ICFolderUser, 'ic-gear': ICGear, + 'ic-gift': ICGift, 'ic-git': ICGit, 'ic-github': ICGithub, 'ic-gitlab': ICGitlab, @@ -187,6 +193,7 @@ export const iconMap = { 'ic-logout': ICLogout, 'ic-medium-delete': ICMediumDelete, 'ic-medium-paintbucket': ICMediumPaintbucket, + 'ic-megaphone-left': ICMegaphoneLeft, 'ic-microsoft': ICMicrosoft, 'ic-missing': ICMissing, 'ic-monitoring': ICMonitoring, @@ -206,6 +213,7 @@ export const iconMap = { 'ic-sort-ascending': ICSortAscending, 'ic-sort-descending': ICSortDescending, 'ic-sortable': ICSortable, + 'ic-sparkle-color': ICSparkleColor, 'ic-spinny': ICSpinny, 'ic-stack': ICStack, 'ic-stamp': ICStamp, From 836e9036acb29cf554e4f7a554674cb6e5e0a54a Mon Sep 17 00:00:00 2001 From: shivani170 Date: Fri, 25 Apr 2025 15:32:40 +0530 Subject: [PATCH 02/15] chore: button variant added for white and n0 --- src/Assets/IconV2/ic-disconnect.svg | 6 ++-- src/Shared/Components/Button/button.scss | 24 ++++++++++++++-- src/Shared/Components/Button/types.ts | 2 ++ .../InfoBlock/InfoBlock.component.tsx | 5 ++-- src/Shared/Components/InfoBlock/constants.tsx | 9 ------ src/Shared/constants.tsx | 28 +++++++++++++++++++ src/index.ts | 3 ++ 7 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/Assets/IconV2/ic-disconnect.svg b/src/Assets/IconV2/ic-disconnect.svg index 7ca7adaab..1ad7ac9c1 100644 --- a/src/Assets/IconV2/ic-disconnect.svg +++ b/src/Assets/IconV2/ic-disconnect.svg @@ -1,3 +1,3 @@ - - - + + + \ No newline at end of file diff --git a/src/Shared/Components/Button/button.scss b/src/Shared/Components/Button/button.scss index fd05f8390..bfe89e7f1 100644 --- a/src/Shared/Components/Button/button.scss +++ b/src/Shared/Components/Button/button.scss @@ -79,7 +79,7 @@ @if ($color) { color: $color; - + @include svg-styles($color); } } @@ -216,6 +216,14 @@ &--neutral { @include button-variant-styles($background, var(--N700), $border-color); } + + &--neutral-n0 { + @include button-variant-styles($background, var(--N0), $border-color); + } + + &--neutral-white { + @include button-variant-styles($background, var(--white), $border-color); + } } // Pseudo states for border-less button @@ -243,6 +251,14 @@ &--neutral { @include pseudo-states(var(--N100), var(--N200)); } + + &--neutral-n0 { + @include pseudo-states(var(--N000), var(--N100)); + } + + &--neutral-white { + @include pseudo-states(var(--white), var(--N100)); + } } // Overrides for text button @@ -253,7 +269,9 @@ &--negative-grey, &--positive, &--warning, - &--neutral { + &--neutral, + &--neutral-n0, + &--neutral-white { padding: 0 !important; min-width: 0 !important; border: none; @@ -279,4 +297,4 @@ text-decoration: none; } } -} +} \ No newline at end of file diff --git a/src/Shared/Components/Button/types.ts b/src/Shared/Components/Button/types.ts index 4c6128377..5ed004be5 100644 --- a/src/Shared/Components/Button/types.ts +++ b/src/Shared/Components/Button/types.ts @@ -35,6 +35,8 @@ export enum ButtonStyleType { positive = 'positive', warning = 'warning', neutral = 'neutral', + neutralN0 = 'neutral-n0', + neutralWhite = 'neutral-white', } export enum ButtonComponentType { diff --git a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx index e87831c04..0f5309242 100644 --- a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx +++ b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ComponentSizeType } from '@Shared/constants' +import { ComponentSizeType, VARIANT_TO_BG_MAP, VARIANT_TO_BORDER_MAP } from '@Shared/constants' import { deriveBorderRadiusAndBorderClassFromConfig } from '@Shared/Helpers' import { Button } from '../Button' @@ -22,7 +22,6 @@ import { CONTAINER_SIZE_TO_BUTTON_SIZE, CONTAINER_SIZE_TO_CLASS_MAP, SIZE_TO_ICON_CLASS_MAP, - VARIANT_TO_BG_MAP, VARIANT_TO_ICON_MAP, } from './constants' import { InfoBlockProps } from './types' @@ -38,7 +37,7 @@ const InfoBlock = ({ borderRadiusConfig, borderConfig, }: InfoBlockProps) => { - const baseContainerClass = `${CONTAINER_SIZE_TO_CLASS_MAP[size]} ${VARIANT_TO_BG_MAP[variant]} ${deriveBorderRadiusAndBorderClassFromConfig({ borderConfig, borderRadiusConfig })} w-100 py-8 br-4 bw-1` + 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] diff --git a/src/Shared/Components/InfoBlock/constants.tsx b/src/Shared/Components/InfoBlock/constants.tsx index 7d6867861..be243e5aa 100644 --- a/src/Shared/Components/InfoBlock/constants.tsx +++ b/src/Shared/Components/InfoBlock/constants.tsx @@ -20,15 +20,6 @@ import { ButtonProps } from '../Button' import { Icon } from '../Icon' import { InfoBlockProps } from './types' -export const VARIANT_TO_BG_MAP: Record = { - error: 'bcr-1 er-2', - help: 'bcv-1 ev-2', - information: 'bcb-1 eb-2', - success: 'bcg-1 eg-2', - warning: 'bcy-1 ey-2', - neutral: 'bcn-1 en-2', -} - export const VARIANT_TO_ICON_MAP: Record = { error: , help: , diff --git a/src/Shared/constants.tsx b/src/Shared/constants.tsx index ae2c2d9be..5c1cfa907 100644 --- a/src/Shared/constants.tsx +++ b/src/Shared/constants.tsx @@ -16,6 +16,7 @@ import { OptionType } from '@Common/Types' +import { InfoBlockProps } from './Components' import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType } from './types' export const ARTIFACT_STATUS = { @@ -553,3 +554,30 @@ export const Routes = { export const ENTERPRISE_SUPPORT_LINK = 'enterprise@devtron.ai' export const INVALID_LICENSE_KEY = 'inValid' + +export const VARIANT_TO_BG_MAP: Record = { + error: 'bcr-1', + help: 'bcv-1', + information: 'bcb-1', + success: 'bcg-1', + warning: 'bcy-1', + neutral: 'bcn-1', +} + +export const VARIANT_TO_ICON_COLOR_MAP: Record = { + error: 'R500', + help: 'V500', + information: 'B500', + success: 'G500', + warning: 'Y700', + neutral: 'N500', +} + +export const VARIANT_TO_BORDER_MAP: Record = { + error: 'er-2', + help: 'ev-2', + information: 'eb-2', + success: 'eg-2', + warning: 'ey-2', + neutral: 'en-2', +} diff --git a/src/index.ts b/src/index.ts index f582c59a3..5d269ff71 100644 --- a/src/index.ts +++ b/src/index.ts @@ -57,6 +57,9 @@ export interface customEnv { ENABLE_SCOPED_VARIABLES?: boolean DEFAULT_CI_TRIGGER_TYPE_MANUAL: boolean ANNOUNCEMENT_BANNER_MSG?: string + ANNOUNCEMENT_BANNER_TYPE?: string + ANNOUNCEMENT_BANNER_BUTTON_TEXT?: string + ANNOUNCEMENT_BANNER_BUTTON_LINK?: string HIDE_DEFAULT_CLUSTER?: boolean GLOBAL_API_TIMEOUT?: number TRIGGER_API_TIMEOUT?: number From a2a86fc4f4d765ec80bf22d6be348c9a06ec08e0 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Fri, 25 Apr 2025 18:56:06 +0530 Subject: [PATCH 03/15] chore: announcement removed from page header --- src/Shared/Components/Header/PageHeader.tsx | 3 --- src/Shared/Components/Header/types.ts | 1 - 2 files changed, 4 deletions(-) diff --git a/src/Shared/Components/Header/PageHeader.tsx b/src/Shared/Components/Header/PageHeader.tsx index b31e9034f..6ad4ca278 100644 --- a/src/Shared/Components/Header/PageHeader.tsx +++ b/src/Shared/Components/Header/PageHeader.tsx @@ -26,7 +26,6 @@ import { ReactComponent as ICMediumPaintBucket } from '@IconsV2/ic-medium-paintb import { getAlphabetIcon, TippyCustomized, TippyTheme } from '../../../Common' import { MAX_LOGIN_COUNT, POSTHOG_EVENT_ONBOARDING } from '../../../Common/Constants' import { useMainContext, useTheme, useUserEmail } from '../../Providers' -import AnnouncementBanner from '../AnnouncementBanner/AnnouncementBanner' import GettingStartedCard from '../GettingStartedCard/GettingStarted' import { InfoIconTippy } from '../InfoIconTippy' import LogoutCard from '../LogoutCard' @@ -49,7 +48,6 @@ const PageHeader = ({ showCloseButton = false, onClose, markAsBeta, - showAnnouncementHeader, tippyProps, }: PageHeaderType) => { const { @@ -313,7 +311,6 @@ const PageHeader = ({ {renderLogoutHelpSection()} )} - {showAnnouncementHeader && } ) } diff --git a/src/Shared/Components/Header/types.ts b/src/Shared/Components/Header/types.ts index dc352b95a..51a12814e 100644 --- a/src/Shared/Components/Header/types.ts +++ b/src/Shared/Components/Header/types.ts @@ -35,7 +35,6 @@ export interface PageHeaderType { showCloseButton?: boolean onClose?: () => void markAsBeta?: boolean - showAnnouncementHeader?: boolean tippyProps?: Pick & { isTippyCustomized?: boolean tippyRedirectLink?: string From da26e174e56d63c0b8efeab6820d415978795057 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Mon, 28 Apr 2025 18:53:21 +0530 Subject: [PATCH 04/15] chore: type strict VARIANT_TO_ICON_COLOR_MAP --- src/Shared/constants.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shared/constants.tsx b/src/Shared/constants.tsx index 5c1cfa907..82ce37183 100644 --- a/src/Shared/constants.tsx +++ b/src/Shared/constants.tsx @@ -17,7 +17,7 @@ import { OptionType } from '@Common/Types' import { InfoBlockProps } from './Components' -import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType } from './types' +import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType, IconBaseColorType } from './types' export const ARTIFACT_STATUS = { PROGRESSING: 'Progressing', @@ -564,7 +564,7 @@ export const VARIANT_TO_BG_MAP: Record = { neutral: 'bcn-1', } -export const VARIANT_TO_ICON_COLOR_MAP: Record = { +export const VARIANT_TO_ICON_COLOR_MAP: Record = { error: 'R500', help: 'V500', information: 'B500', From 593f7ea2069051aca5c9893635dd97d1b201c0aa Mon Sep 17 00:00:00 2001 From: shivani170 Date: Mon, 28 Apr 2025 19:11:42 +0530 Subject: [PATCH 05/15] chore: InfoBlockVariant type separate out --- .../InfoBlock/InfoBlock.component.tsx | 4 +- src/Shared/Components/InfoBlock/constants.tsx | 16 +++---- src/Shared/Components/InfoBlock/types.ts | 10 ++++- src/Shared/constants.tsx | 44 +++++++++---------- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx index 0f5309242..6e26c6418 100644 --- a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx +++ b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx @@ -24,11 +24,11 @@ import { SIZE_TO_ICON_CLASS_MAP, VARIANT_TO_ICON_MAP, } from './constants' -import { InfoBlockProps } from './types' +import { InfoBlockProps, InfoBlockVariant } from './types' const InfoBlock = ({ layout = 'row', - variant = 'information', + variant = InfoBlockVariant.INFORMATION, size = ComponentSizeType.large, customIcon, buttonProps, diff --git a/src/Shared/Components/InfoBlock/constants.tsx b/src/Shared/Components/InfoBlock/constants.tsx index be243e5aa..1137c8b3d 100644 --- a/src/Shared/Components/InfoBlock/constants.tsx +++ b/src/Shared/Components/InfoBlock/constants.tsx @@ -18,15 +18,15 @@ import { ComponentSizeType } from '@Shared/constants' import { ButtonProps } from '../Button' import { Icon } from '../Icon' -import { InfoBlockProps } from './types' +import { InfoBlockProps, InfoBlockVariant } from './types' -export const VARIANT_TO_ICON_MAP: Record = { - error: , - help: , - information: , - success: , - warning: , - neutral: , +export const VARIANT_TO_ICON_MAP: Record = { + [InfoBlockVariant.ERROR]: , + [InfoBlockVariant.HELP]: , + [InfoBlockVariant.INFORMATION]: , + [InfoBlockVariant.SUCCESS]: , + [InfoBlockVariant.WARNING]: , + [InfoBlockVariant.NEUTRAL]: , } export const CONTAINER_SIZE_TO_CLASS_MAP: Record = { diff --git a/src/Shared/Components/InfoBlock/types.ts b/src/Shared/Components/InfoBlock/types.ts index 776488e81..6ac7d9938 100644 --- a/src/Shared/Components/InfoBlock/types.ts +++ b/src/Shared/Components/InfoBlock/types.ts @@ -21,6 +21,14 @@ import { BorderConfigType, ComponentLayoutType } from '@Shared/types' import { ButtonComponentType, ButtonProps } from '../Button' +export enum InfoBlockVariant { + ERROR = 'error', + HELP = 'help', + INFORMATION = 'information', + SUCCESS = 'success', + WARNING = 'warning', + NEUTRAL = 'neutral', +} export type InfoBlockProps = { /** * @default 'row' @@ -29,7 +37,7 @@ export type InfoBlockProps = { /** * @default 'information' */ - variant?: 'error' | 'help' | 'information' | 'success' | 'warning' | 'neutral' + variant?: InfoBlockVariant /** * @default ComponentSizeType.large */ diff --git a/src/Shared/constants.tsx b/src/Shared/constants.tsx index 82ce37183..51d8092b5 100644 --- a/src/Shared/constants.tsx +++ b/src/Shared/constants.tsx @@ -16,7 +16,7 @@ import { OptionType } from '@Common/Types' -import { InfoBlockProps } from './Components' +import { InfoBlockVariant } from './Components' import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType, IconBaseColorType } from './types' export const ARTIFACT_STATUS = { @@ -555,29 +555,29 @@ export const ENTERPRISE_SUPPORT_LINK = 'enterprise@devtron.ai' export const INVALID_LICENSE_KEY = 'inValid' -export const VARIANT_TO_BG_MAP: Record = { - error: 'bcr-1', - help: 'bcv-1', - information: 'bcb-1', - success: 'bcg-1', - warning: 'bcy-1', - neutral: 'bcn-1', +export const VARIANT_TO_BG_MAP: Record = { + [InfoBlockVariant.ERROR]: 'bcr-1', + [InfoBlockVariant.HELP]: 'bcv-1', + [InfoBlockVariant.INFORMATION]: 'bcb-1', + [InfoBlockVariant.SUCCESS]: 'bcg-1', + [InfoBlockVariant.WARNING]: 'bcy-1', + [InfoBlockVariant.NEUTRAL]: 'bcn-1', } -export const VARIANT_TO_ICON_COLOR_MAP: Record = { - error: 'R500', - help: 'V500', - information: 'B500', - success: 'G500', - warning: 'Y700', - neutral: 'N500', +export const VARIANT_TO_ICON_COLOR_MAP: Record = { + [InfoBlockVariant.ERROR]: 'R500', + [InfoBlockVariant.HELP]: 'V500', + [InfoBlockVariant.INFORMATION]: 'B500', + [InfoBlockVariant.SUCCESS]: 'G500', + [InfoBlockVariant.WARNING]: 'Y700', + [InfoBlockVariant.NEUTRAL]: 'N500', } -export const VARIANT_TO_BORDER_MAP: Record = { - error: 'er-2', - help: 'ev-2', - information: 'eb-2', - success: 'eg-2', - warning: 'ey-2', - neutral: 'en-2', +export const VARIANT_TO_BORDER_MAP: Record = { + [InfoBlockVariant.ERROR]: 'er-2', + [InfoBlockVariant.HELP]: 'ev-2', + [InfoBlockVariant.INFORMATION]: 'eb-2', + [InfoBlockVariant.SUCCESS]: 'eg-2', + [InfoBlockVariant.WARNING]: 'ey-2', + [InfoBlockVariant.NEUTRAL]: 'en-2', } From ccc9899e7b91125ecc088c1e6e8e1095f9ed4370 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Mon, 28 Apr 2025 19:25:07 +0530 Subject: [PATCH 06/15] chore: added InfoBlockVariant --- src/Shared/Components/InfoBlock/types.ts | 11 ++++++++++- src/Shared/constants.tsx | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Shared/Components/InfoBlock/types.ts b/src/Shared/Components/InfoBlock/types.ts index 6ac7d9938..4adf67832 100644 --- a/src/Shared/Components/InfoBlock/types.ts +++ b/src/Shared/Components/InfoBlock/types.ts @@ -29,6 +29,15 @@ export enum InfoBlockVariant { WARNING = 'warning', NEUTRAL = 'neutral', } + +export type InfoBlockVariantType = + | InfoBlockVariant.ERROR + | InfoBlockVariant.HELP + | InfoBlockVariant.INFORMATION + | InfoBlockVariant.SUCCESS + | InfoBlockVariant.WARNING + | InfoBlockVariant.NEUTRAL + export type InfoBlockProps = { /** * @default 'row' @@ -37,7 +46,7 @@ export type InfoBlockProps = { /** * @default 'information' */ - variant?: InfoBlockVariant + variant?: InfoBlockVariantType /** * @default ComponentSizeType.large */ diff --git a/src/Shared/constants.tsx b/src/Shared/constants.tsx index 51d8092b5..71772a967 100644 --- a/src/Shared/constants.tsx +++ b/src/Shared/constants.tsx @@ -16,7 +16,7 @@ import { OptionType } from '@Common/Types' -import { InfoBlockVariant } from './Components' +import { InfoBlockProps, InfoBlockVariant } from './Components' import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType, IconBaseColorType } from './types' export const ARTIFACT_STATUS = { @@ -555,7 +555,7 @@ export const ENTERPRISE_SUPPORT_LINK = 'enterprise@devtron.ai' export const INVALID_LICENSE_KEY = 'inValid' -export const VARIANT_TO_BG_MAP: Record = { +export const VARIANT_TO_BG_MAP: Record = { [InfoBlockVariant.ERROR]: 'bcr-1', [InfoBlockVariant.HELP]: 'bcv-1', [InfoBlockVariant.INFORMATION]: 'bcb-1', @@ -564,7 +564,7 @@ export const VARIANT_TO_BG_MAP: Record = { [InfoBlockVariant.NEUTRAL]: 'bcn-1', } -export const VARIANT_TO_ICON_COLOR_MAP: Record = { +export const VARIANT_TO_ICON_COLOR_MAP: Record = { [InfoBlockVariant.ERROR]: 'R500', [InfoBlockVariant.HELP]: 'V500', [InfoBlockVariant.INFORMATION]: 'B500', @@ -573,7 +573,7 @@ export const VARIANT_TO_ICON_COLOR_MAP: Record = { +export const VARIANT_TO_BORDER_MAP: Record = { [InfoBlockVariant.ERROR]: 'er-2', [InfoBlockVariant.HELP]: 'ev-2', [InfoBlockVariant.INFORMATION]: 'eb-2', From 5cd065f8981159b95408fa4f3d83bedd9f563bcd Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 29 Apr 2025 08:52:02 +0530 Subject: [PATCH 07/15] chore: info block variant type fix --- .../InfoBlock/InfoBlock.component.tsx | 4 ++-- src/Shared/Components/InfoBlock/constants.tsx | 4 ++-- src/Shared/Components/InfoBlock/types.ts | 19 +------------------ src/Shared/constants.tsx | 13 ++++++++++++- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx index 6e26c6418..0f5309242 100644 --- a/src/Shared/Components/InfoBlock/InfoBlock.component.tsx +++ b/src/Shared/Components/InfoBlock/InfoBlock.component.tsx @@ -24,11 +24,11 @@ import { SIZE_TO_ICON_CLASS_MAP, VARIANT_TO_ICON_MAP, } from './constants' -import { InfoBlockProps, InfoBlockVariant } from './types' +import { InfoBlockProps } from './types' const InfoBlock = ({ layout = 'row', - variant = InfoBlockVariant.INFORMATION, + variant = 'information', size = ComponentSizeType.large, customIcon, buttonProps, diff --git a/src/Shared/Components/InfoBlock/constants.tsx b/src/Shared/Components/InfoBlock/constants.tsx index 1137c8b3d..037ad7b23 100644 --- a/src/Shared/Components/InfoBlock/constants.tsx +++ b/src/Shared/Components/InfoBlock/constants.tsx @@ -14,11 +14,11 @@ * limitations under the License. */ -import { ComponentSizeType } from '@Shared/constants' +import { ComponentSizeType, InfoBlockVariant } from '@Shared/constants' import { ButtonProps } from '../Button' import { Icon } from '../Icon' -import { InfoBlockProps, InfoBlockVariant } from './types' +import { InfoBlockProps } from './types' export const VARIANT_TO_ICON_MAP: Record = { [InfoBlockVariant.ERROR]: , diff --git a/src/Shared/Components/InfoBlock/types.ts b/src/Shared/Components/InfoBlock/types.ts index 4adf67832..53009853f 100644 --- a/src/Shared/Components/InfoBlock/types.ts +++ b/src/Shared/Components/InfoBlock/types.ts @@ -16,28 +16,11 @@ import { ReactElement, ReactNode } from 'react' -import { ComponentSizeType } from '@Shared/constants' +import { ComponentSizeType, InfoBlockVariantType } from '@Shared/constants' import { BorderConfigType, ComponentLayoutType } from '@Shared/types' import { ButtonComponentType, ButtonProps } from '../Button' -export enum InfoBlockVariant { - ERROR = 'error', - HELP = 'help', - INFORMATION = 'information', - SUCCESS = 'success', - WARNING = 'warning', - NEUTRAL = 'neutral', -} - -export type InfoBlockVariantType = - | InfoBlockVariant.ERROR - | InfoBlockVariant.HELP - | InfoBlockVariant.INFORMATION - | InfoBlockVariant.SUCCESS - | InfoBlockVariant.WARNING - | InfoBlockVariant.NEUTRAL - export type InfoBlockProps = { /** * @default 'row' diff --git a/src/Shared/constants.tsx b/src/Shared/constants.tsx index 71772a967..90b26ff12 100644 --- a/src/Shared/constants.tsx +++ b/src/Shared/constants.tsx @@ -16,7 +16,7 @@ import { OptionType } from '@Common/Types' -import { InfoBlockProps, InfoBlockVariant } from './Components' +import { InfoBlockProps } from './Components' import { CDMaterialSidebarType, ConfigKeysWithLockType, ConfigurationType, IconBaseColorType } from './types' export const ARTIFACT_STATUS = { @@ -555,6 +555,17 @@ export const ENTERPRISE_SUPPORT_LINK = 'enterprise@devtron.ai' export const INVALID_LICENSE_KEY = 'inValid' +export enum InfoBlockVariant { + ERROR = 'error', + HELP = 'help', + INFORMATION = 'information', + SUCCESS = 'success', + WARNING = 'warning', + NEUTRAL = 'neutral', +} + +export type InfoBlockVariantType = 'error' | 'help' | 'information' | 'success' | 'warning' | 'neutral' + export const VARIANT_TO_BG_MAP: Record = { [InfoBlockVariant.ERROR]: 'bcr-1', [InfoBlockVariant.HELP]: 'bcv-1', From 41b4689311a915a8808f1a0d92919197ce08306b Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 29 Apr 2025 13:57:58 +0530 Subject: [PATCH 08/15] chore: removed announcement banner component --- .../AnnouncementBanner/AnnouncementBanner.tsx | 101 ------------------ .../Components/AnnouncementBanner/index.ts | 18 ---- src/Shared/Components/index.ts | 1 - 3 files changed, 120 deletions(-) delete mode 100644 src/Shared/Components/AnnouncementBanner/AnnouncementBanner.tsx delete mode 100644 src/Shared/Components/AnnouncementBanner/index.ts diff --git a/src/Shared/Components/AnnouncementBanner/AnnouncementBanner.tsx b/src/Shared/Components/AnnouncementBanner/AnnouncementBanner.tsx deleted file mode 100644 index 131c4670e..000000000 --- a/src/Shared/Components/AnnouncementBanner/AnnouncementBanner.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2024. Devtron Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { useState } from 'react' -import DOMPurify from 'dompurify' - -import { ReactComponent as Close } from '../../../Assets/Icon/ic-close.svg' -import { ReactComponent as MegaphoneIcon } from '../../../Assets/Icon/ic-megaphone.svg' -import { InfoColourBar } from '../../../Common' -import { getDateInMilliseconds, setActionWithExpiry } from '../Header/utils' - -interface AnnouncementBannerType { - parentClassName?: string - isCDMaterial?: boolean -} - -const AnnouncementBanner = ({ parentClassName = '', isCDMaterial = false }: AnnouncementBannerType) => { - const rawMessage = window?._env_?.ANNOUNCEMENT_BANNER_MSG - const message = rawMessage ? DOMPurify.sanitize(rawMessage) : null - const showAnnouncementBanner = (): boolean => { - const expiryDateOfHidingAnnouncementBanner: string = - typeof Storage !== 'undefined' && - localStorage.getItem( - // it will store date and time of next day i.e, it will hide banner until this date - 'expiryDateOfHidingAnnouncementBanner', - ) - const showAnnouncementBannerNextDay: boolean = - typeof Storage !== 'undefined' && - getDateInMilliseconds(localStorage.getItem('dashboardLoginTime')) > - getDateInMilliseconds(expiryDateOfHidingAnnouncementBanner) - - if (showAnnouncementBannerNextDay && !expiryDateOfHidingAnnouncementBanner) { - return true - } - - return getDateInMilliseconds(new Date().valueOf()) > getDateInMilliseconds(expiryDateOfHidingAnnouncementBanner) - } - - const [showAnouncementBanner, setshowAnouncementBanner] = useState(message ? showAnnouncementBanner() : false) - - if (!message) { - return null - } - - const onClickCloseAnnouncememtBanner = () => { - setshowAnouncementBanner(false) - if (typeof Storage !== 'undefined') { - setActionWithExpiry('expiryDateOfHidingAnnouncementBanner', 1) - } - } - - const renderAnnouncementBanner = () => ( -
-
- {isCDMaterial ? null : ( - - )} -
- ) - - return showAnouncementBanner || isCDMaterial ? ( -
- -
- ) : null -} - -export default AnnouncementBanner diff --git a/src/Shared/Components/AnnouncementBanner/index.ts b/src/Shared/Components/AnnouncementBanner/index.ts deleted file mode 100644 index 2da2ff104..000000000 --- a/src/Shared/Components/AnnouncementBanner/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2024. Devtron Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// eslint-disable-next-line import/prefer-default-export -export { default as AnnouncementBanner } from './AnnouncementBanner' diff --git a/src/Shared/Components/index.ts b/src/Shared/Components/index.ts index 14503779c..1b2d063ca 100644 --- a/src/Shared/Components/index.ts +++ b/src/Shared/Components/index.ts @@ -18,7 +18,6 @@ export * from './ActionMenu' export * from './ActivityIndicator' export * from './AnimatedDeployButton' export * from './AnimatedTimer' -export * from './AnnouncementBanner' export * from './APIResponseHandler' export * from './ArtifactInfoModal' export * from './Backdrop' From af1610ee8f634a619e2b27c50c7b88869e61c67d Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 29 Apr 2025 18:51:00 +0530 Subject: [PATCH 09/15] chore: sparkle icon updated --- src/Assets/IconV2/ic-sparkle-color.svg | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/Assets/IconV2/ic-sparkle-color.svg b/src/Assets/IconV2/ic-sparkle-color.svg index 38020b4db..a2aa5c5d3 100644 --- a/src/Assets/IconV2/ic-sparkle-color.svg +++ b/src/Assets/IconV2/ic-sparkle-color.svg @@ -1,21 +1 @@ - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file From 1cc3ec03f0c17ec4d7d9d43398350541811f2b6b Mon Sep 17 00:00:00 2001 From: shivani170 Date: Mon, 5 May 2025 17:12:06 +0530 Subject: [PATCH 10/15] chore: main context type added --- src/Shared/Providers/types.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Shared/Providers/types.ts b/src/Shared/Providers/types.ts index 68af58238..0d4bee2ae 100644 --- a/src/Shared/Providers/types.ts +++ b/src/Shared/Providers/types.ts @@ -18,7 +18,7 @@ import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react' import { SERVER_MODE } from '../../Common' import { ServerInfo } from '../Components/Header/types' -import { DevtronLicenseInfo, LicenseInfoDialogType } from '..' +import { DevtronLicenseInfo, LicenseInfoDialogType, ToastManager } from '..' export interface MainContext { serverMode: SERVER_MODE @@ -66,6 +66,12 @@ export interface MainContext { licenseData: DevtronLicenseInfo setLicenseData: Dispatch> canFetchHelmAppStatus: boolean + bgUpdated: boolean + handleAppUpdate: () => void + doesNeedRefresh: boolean + updateServiceWorker: (reloadPage?: boolean) => Promise + handleControllerChange: () => void + updateToastRef: MutableRefObject> } export interface MainContextProviderProps { From 0872e3d2b0d45ba1c2614674233aaf15ebd346ec Mon Sep 17 00:00:00 2001 From: shivani170 Date: Mon, 5 May 2025 18:13:52 +0530 Subject: [PATCH 11/15] chore: ReloadVersionConfigTypes types updated --- src/Shared/Providers/index.ts | 2 +- src/Shared/Providers/types.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Shared/Providers/index.ts b/src/Shared/Providers/index.ts index 3e07be345..1ba004223 100644 --- a/src/Shared/Providers/index.ts +++ b/src/Shared/Providers/index.ts @@ -17,5 +17,5 @@ export * from './ImageSelectionUtility' export * from './MainContextProvider' export * from './ThemeProvider' -export type { MainContext } from './types' +export type { MainContext, ReloadVersionConfigTypes } from './types' export * from './UserEmailProvider' diff --git a/src/Shared/Providers/types.ts b/src/Shared/Providers/types.ts index 0d4bee2ae..750e029a9 100644 --- a/src/Shared/Providers/types.ts +++ b/src/Shared/Providers/types.ts @@ -20,6 +20,14 @@ import { SERVER_MODE } from '../../Common' import { ServerInfo } from '../Components/Header/types' import { DevtronLicenseInfo, LicenseInfoDialogType, ToastManager } from '..' +export interface ReloadVersionConfigTypes { + bgUpdated: boolean + handleAppUpdate: () => void + doesNeedRefresh: boolean + updateServiceWorker: () => Promise + handleControllerChange: () => void + updateToastRef: MutableRefObject> | null +} export interface MainContext { serverMode: SERVER_MODE setServerMode: (serverMode: SERVER_MODE) => void @@ -66,12 +74,7 @@ export interface MainContext { licenseData: DevtronLicenseInfo setLicenseData: Dispatch> canFetchHelmAppStatus: boolean - bgUpdated: boolean - handleAppUpdate: () => void - doesNeedRefresh: boolean - updateServiceWorker: (reloadPage?: boolean) => Promise - handleControllerChange: () => void - updateToastRef: MutableRefObject> + reloadVersionConfig: ReloadVersionConfigTypes } export interface MainContextProviderProps { From 2eab36420554f43da126c23c1d5f68294cbae57f Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 6 May 2025 12:37:28 +0530 Subject: [PATCH 12/15] chore: refreshing prop type adding to context --- src/Shared/Providers/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Shared/Providers/types.ts b/src/Shared/Providers/types.ts index 750e029a9..5b458b062 100644 --- a/src/Shared/Providers/types.ts +++ b/src/Shared/Providers/types.ts @@ -27,6 +27,7 @@ export interface ReloadVersionConfigTypes { updateServiceWorker: () => Promise handleControllerChange: () => void updateToastRef: MutableRefObject> | null + isRefreshing: boolean } export interface MainContext { serverMode: SERVER_MODE From d723a82505fafb3af2cb4cd4476498e4c417da96 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 6 May 2025 13:33:26 +0530 Subject: [PATCH 13/15] UAT: misc css fixes --- src/Assets/IconV2/ic-gitlab.svg | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Assets/IconV2/ic-gitlab.svg b/src/Assets/IconV2/ic-gitlab.svg index ae6ed4f8c..1b4df0aaa 100644 --- a/src/Assets/IconV2/ic-gitlab.svg +++ b/src/Assets/IconV2/ic-gitlab.svg @@ -16,16 +16,16 @@ - + - - - - - - - - + + + + + + + + From 533945e5b785d60125ad3acc2f94df6b2219f079 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 6 May 2025 18:49:29 +0530 Subject: [PATCH 14/15] chore: version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 51f54834c..b45b91f19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.12.0-pre-9", + "version": "1.12.0-pre-10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.12.0-pre-9", + "version": "1.12.0-pre-10", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index f08782d6a..b60749b2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.12.0-pre-9", + "version": "1.12.0-pre-10", "description": "Supporting common component library", "type": "module", "main": "dist/index.js", From b79df4a6ba2d600c49a6277a7e293bfc397f9c39 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Fri, 9 May 2025 13:19:22 +0530 Subject: [PATCH 15/15] Merge branch 'develop' into feat/banner --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11a9c4e70..ed6c61b06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0-pre-0", + "version": "1.13.0-pre-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0-pre-0", + "version": "1.13.0-pre-1", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 897a8a4e9..e81850c89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "1.13.0-pre-0", + "version": "1.13.0-pre-1", "description": "Supporting common component library", "type": "module", "main": "dist/index.js",