Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
f828ca1
Merge branch 'chore/copyright' of github.com:devtron-labs/devtron-fe-…
eshankvaish Aug 8, 2024
565a02d
feat: add enum for image promotion
eshankvaish Aug 8, 2024
b459767
fix: add configuration menu position for select picker
eshankvaish Aug 8, 2024
0de46bc
fix: naming for descriptor typing
eshankvaish Aug 9, 2024
e522fd4
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Sep 26, 2024
ed6981f
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Oct 4, 2024
e0abda1
fix: update the policy kind type
eshankvaish Oct 4, 2024
12a15c0
feat: expose formatOptionLabel in select picker
eshankvaish Oct 4, 2024
513902c
feat: show the info icon based on prop in feature description modal
eshankvaish Oct 7, 2024
dc875ac
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Oct 8, 2024
f833d34
fix: icon re-rendering in select picker
eshankvaish Oct 8, 2024
d90dbe5
chore: bump common
eshankvaish Oct 8, 2024
cb65b13
feat: add flag for cd mandatory plugin
AbhishekA1509 Oct 8, 2024
670b6ca
feat: expose size for getPluginStoreData
eshankvaish Oct 9, 2024
c7eef17
fix: conditionally hide label for date time picker
eshankvaish Oct 9, 2024
77d7ebc
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 10, 2024
6d80311
feat: expose getOptionLabel in filter select picker
eshankvaish Oct 10, 2024
b98a365
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Oct 10, 2024
9b5df6e
feat: add validateDateAndTime validator
eshankvaish Oct 10, 2024
c6f8689
fix: styling for toast manager and button
eshankvaish Oct 14, 2024
c0dcb90
feat: update the value for policy kind type enum
eshankvaish Oct 14, 2024
acb396f
feat: hide start icon in option in case of multi select
eshankvaish Oct 14, 2024
3132227
feat: expose parentPluginIdentifier
eshankvaish Oct 14, 2024
bbc63db
feat: update DefinitionSourceType for v2
AbhishekA1509 Oct 14, 2024
64d65f8
feat: Add ProcessPluginDataParamsType for CI and CD pipelines
AbhishekA1509 Oct 14, 2024
27df864
feat: add ci-pipeline to resource kind
eshankvaish Oct 15, 2024
36553e5
feat: add type ALL query param to getParentPluginList
eshankvaish Oct 15, 2024
a03f125
feat: add shouldShowNoOptionsMessage in select picker
eshankvaish Oct 15, 2024
62a43fb
fix: optional arg for getParentPluginList
eshankvaish Oct 15, 2024
b53af78
doc: add js docs for consequence action
eshankvaish Oct 15, 2024
085837b
feat: pre cd and post cd
eshankvaish Oct 15, 2024
2994ec0
chore: Remove isMandatory property from StepType interface
AbhishekA1509 Oct 15, 2024
c6eb6c0
feat: Add TaskActionModalType and TaskActionModalStateType interfaces
AbhishekA1509 Oct 15, 2024
4dc9d3d
fix: handling for option comparison
eshankvaish Oct 16, 2024
50117b7
chore: version bump
eshankvaish Oct 16, 2024
d2ac10c
feat: add types related to mandatory plugin consequences
AbhishekA1509 Oct 16, 2024
47c151f
chore: remove dead code
AbhishekA1509 Oct 16, 2024
d85eb0d
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Oct 17, 2024
f0e0aa4
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 17, 2024
5e37188
fix: remove duplicated enums
AbhishekA1509 Oct 17, 2024
abf00c9
fix: add tooltip on filter chip truncation
eshankvaish Oct 18, 2024
92e7cc8
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Oct 18, 2024
723a29e
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 18, 2024
6d23d75
Update package version to 0.5.2-beta-6
AbhishekA1509 Oct 18, 2024
653aea6
fix: start and end icon size
eshankvaish Oct 18, 2024
176073f
chore: rename mandatory plugin types
AbhishekA1509 Oct 20, 2024
592f0c8
refactor: Update import statements in Policy.Types.ts
AbhishekA1509 Oct 20, 2024
f748a0f
fix: remove showOnTruncate
eshankvaish Oct 21, 2024
1f06094
fix: typing for consequence type
eshankvaish Oct 21, 2024
fdfebbb
fix: typing for ci block state
eshankvaish Oct 21, 2024
d3bd35f
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 21, 2024
2e4ccc5
Update version in package-lock.json and package.json
AbhishekA1509 Oct 21, 2024
fbbf8a2
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Oct 22, 2024
869458c
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 22, 2024
64f026b
Update version in package-lock.json and package.json
AbhishekA1509 Oct 22, 2024
ceb1f64
fix: button width issue in toast
eshankvaish Oct 22, 2024
89dc9f9
chore: add a comment for CDPipeline build stage
AbhishekA1509 Oct 23, 2024
463d2eb
fix: add prevent default on selection of plugin
eshankvaish Oct 23, 2024
840efff
fix: remove isLatest from plugin info due to volatile nature
AbhishekA1509 Oct 23, 2024
ed901b4
Merge pull request #355 from devtron-labs/feat/ci-pipeline-mandatory-…
AbhishekA1509 Oct 23, 2024
486034e
chore: update devtron-fe-common-lib version to 0.5.8-beta-4
AbhishekA1509 Oct 23, 2024
e3bb51b
chore: update devtron-fe-common-lib version to 0.5.8-beta-5
AbhishekA1509 Oct 23, 2024
5871194
fix: group env options by cluster
eshankvaish Oct 28, 2024
14f1913
Merge pull request #374 from devtron-labs/fix/plugin-policy-uat
eshankvaish Oct 28, 2024
bb122ac
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Nov 4, 2024
c117dbc
fix: formatting issues
eshankvaish Nov 4, 2024
b341c9e
fix: add sorting for parent plugin list and env list
eshankvaish Nov 4, 2024
0ebde91
chore: bump version to 0.6.1-beta-10
eshankvaish Nov 4, 2024
c6333b2
Merge branch 'fix/plugin-policy-qa' into feat/plugin-policy
eshankvaish Nov 4, 2024
9d23477
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Nov 4, 2024
0122713
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Nov 4, 2024
0b0d348
Merge branch 'develop' of https://github.com/devtron-labs/devtron-fe-…
arunjaindev Nov 5, 2024
58f92af
Merge pull request #385 from devtron-labs/chore/sync-persist-filters
arunjaindev Nov 5, 2024
8e47a1c
Merge pull request #392 from devtron-labs/release-candidate-v0.22.0
vivek-devtron Nov 7, 2024
cf8c413
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
eshankvaish Nov 7, 2024
f4e572b
Merge branch 'main' of github.com:devtron-labs/devtron-fe-common-lib …
eshankvaish Nov 7, 2024
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": "0.5.1",
"version": "0.5.1-beta-1",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
14 changes: 14 additions & 0 deletions src/Common/Policy.Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import { ResponseType } from './Types'
export enum ApplyPolicyToStage {
PRE_CI = 'PRE_CI',
POST_CI = 'POST_CI',
PRE_CD = 'PRE_CD',
POST_CD = 'POST_CD',
/**
* @deprecated in mandatory plugin policy v2
*/
PRE_OR_POST_CI = 'PRE_OR_POST_CI',
}

Expand Down Expand Up @@ -67,8 +72,17 @@ export interface ProcessPluginDataReturnType {
}

export enum ConsequenceAction {
/**
* This is used if the policy is enforced immediately.
*/
BLOCK = 'BLOCK',
/**
* This is used if the policy will be enforced after a certain timestamp.
*/
ALLOW_UNTIL_TIME = 'ALLOW_UNTIL_TIME',
/**
* This is used if the policy is not enforced yet (just to show waring).
*/
ALLOW_FOREVER = 'ALLOW_FOREVER',
}

Expand Down
4 changes: 2 additions & 2 deletions src/Pages/GlobalConfigurations/BuildInfra/Descriptor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { DescriptorProps } from './types'
import { BuildInfraDescriptorProps } from './types'
import { BreadCrumb, DOCUMENTATION } from '../../../Common'
import { BUILD_INFRA_TEXT } from './constants'
import { InfoIconTippy } from '../../../Shared'
Expand All @@ -25,7 +25,7 @@ const Descriptor = ({
children,
tippyInfoText,
tippyAdditionalContent,
}: DescriptorProps) => (
}: BuildInfraDescriptorProps) => (
<div className={`flexbox dc__content-space dc__align-items-center w-100 ${additionalContainerClasses ?? ''}`}>
<div className="flexbox dc__align-items-center dc__gap-4">
<BreadCrumb breadcrumbs={breadCrumbs} />
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/GlobalConfigurations/BuildInfra/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export enum BuildInfraProfileVariants {
CUSTOM = 'CUSTOM',
}

export interface DescriptorProps {
export interface BuildInfraDescriptorProps {
/**
* In case we want to restrict the max-width
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/Components/Button/Button.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const Button = ({
<ButtonElement
{...props}
disabled={isDisabled}
className={`br-4 flex cursor dc__tab-focus dc__position-rel dc__capitalize ${getButtonDerivedClass({ size, variant, style, isLoading, icon })} ${isDisabled ? 'dc__disabled' : ''}`}
className={`br-4 flex cursor dc__tab-focus dc__position-rel dc__capitalize ${getButtonDerivedClass({ size, variant, style, isLoading, icon })} ${isDisabled ? 'dc__disabled' : ''} dc__w-fit-content`}
data-testid={dataTestId}
aria-label={ariaLabel}
>
Expand Down
8 changes: 5 additions & 3 deletions src/Shared/Components/DatePicker/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ const DateTimePicker = ({

return (
<div className="date-time-picker">
<label className={`form__label ${required ? 'dc__required-field' : ''}`} htmlFor={id}>
{label}
</label>
{label && (
<label className={`form__label ${required ? 'dc__required-field' : ''}`} htmlFor={id}>
{label}
</label>
)}
<div className="flex left dc__gap-8">
<SingleDatePicker
id={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const FeatureTitleWithInfo = ({
docLinkText = 'View Documentation',
dataTestId = 'feature-title-with-info',
additionalContent,
showInfoIcon = false,
}: DescriptorProps) => {
const [showFeatureDescriptionModal, setShowFeatureDescriptionModal] = useState(false)
const onClickInfoIcon = () => {
Expand Down Expand Up @@ -64,10 +65,14 @@ const FeatureTitleWithInfo = ({
</div>
)
}
if (breadCrumbs?.length > 0) {
if (breadCrumbs?.length > 0 || showInfoIcon) {
return (
<div className="flexbox dc__align-items-center dc__gap-4">
<BreadCrumb breadcrumbs={breadCrumbs} />
{showInfoIcon && breadCrumbs?.length === 0 ? (
<span className="fs-16 fw-6 cn-9 lh-32">{title}</span>
) : (
<BreadCrumb breadcrumbs={breadCrumbs} />
)}
<ICHelpOutline className={`${iconClassName} icon-dim-20 cursor fcn-6`} onClick={onClickInfoIcon} />
</div>
)
Expand Down
1 change: 1 addition & 0 deletions src/Shared/Components/FeatureDescription/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

export * from './FeatureDescriptionModal'
export { default as FeatureTitleWithInfo } from './FeatureTitleWithInfo'
export * from './types'
6 changes: 6 additions & 0 deletions src/Shared/Components/FeatureDescription/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ export interface DescriptorProps extends FeatureDescriptionModalProps {
docLinkText?: string
dataTestId?: string
additionalContent?: ReactNode
/**
* If true, the info icon is displayed which when clicked shows the feature description modal
*
* @default false
*/
showInfoIcon?: boolean
}
5 changes: 4 additions & 1 deletion src/Shared/Components/Plugin/PluginImageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import { ImageWithFallback } from '../ImageWithFallback'
const PluginImageContainer = ({ imageProps, fallbackImageClassName }: PluginImageContainerProps) => (
<ImageWithFallback
fallbackImage={<ICLegoBlock className={`dc__no-shrink ${fallbackImageClassName}`} />}
imageProps={imageProps}
imageProps={{
loading: 'lazy',
...imageProps,
}}
/>
)

Expand Down
10 changes: 6 additions & 4 deletions src/Shared/Components/Plugin/service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ export const getPluginsDetail = async ({
pluginIds,
signal,
shouldShowError = true,
parentPluginIdentifiers,
}: PluginDetailServiceParamsType): Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>> => {
try {
const payload: PluginDetailPayloadType = {
appId,
parentPluginId: parentPluginIds,
pluginId: pluginIds,
parentPluginIdentifier: parentPluginIdentifiers ? `${parentPluginIdentifiers}` : null,
}

const { result } = await get<PluginDetailDTO>(
Expand Down Expand Up @@ -115,7 +117,7 @@ export const getAvailablePluginTags = async (appId: number): Promise<string[]> =
}
}

export const getParentPluginList = async (appId?: number): Promise<ResponseType<MinParentPluginDTO[]>> => {
const queryParams: GetParentPluginListPayloadType = { appId }
return get<MinParentPluginDTO[]>(getUrlWithSearchParams(ROUTES.PLUGIN_LIST_MIN, queryParams))
}
export const getParentPluginList = async (
params?: Partial<GetParentPluginListPayloadType>,
): Promise<ResponseType<MinParentPluginDTO[]>> =>
get<MinParentPluginDTO[]>(getUrlWithSearchParams(ROUTES.PLUGIN_LIST_MIN, params))
8 changes: 6 additions & 2 deletions src/Shared/Components/Plugin/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export interface PluginAPIBaseQueryParamsType {
}

export interface GetPluginTagsPayloadType extends PluginAPIBaseQueryParamsType {}
export interface GetParentPluginListPayloadType extends PluginAPIBaseQueryParamsType {}
export interface GetParentPluginListPayloadType extends PluginAPIBaseQueryParamsType {
type?: 'ALL'
}

export interface PluginTagNamesDTO {
tagNames: string[]
Expand Down Expand Up @@ -73,7 +75,7 @@ export interface ParentPluginDTO {
pluginIdentifier: string
}

export interface MinParentPluginDTO extends Pick<ParentPluginDTO, 'id' | 'name' | 'icon'> {}
export interface MinParentPluginDTO extends Pick<ParentPluginDTO, 'id' | 'name' | 'icon' | 'pluginIdentifier'> {}

export interface PluginDetailDTO {
parentPlugins: ParentPluginDTO[]
Expand All @@ -84,6 +86,7 @@ export interface PluginDetailServiceParamsType {
appId: number
pluginIds?: number[]
parentPluginIds?: number[]
parentPluginIdentifiers?: string[]
/**
* @default true
*/
Expand All @@ -94,6 +97,7 @@ export interface PluginDetailServiceParamsType {
export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsType, 'appId'> {
pluginId?: PluginDetailServiceParamsType['pluginIds']
parentPluginId?: PluginDetailServiceParamsType['parentPluginIds']
parentPluginIdentifier?: PluginDetailServiceParamsType['parentPluginIdentifiers'][number]
}

export interface PluginListFiltersType extends Pick<BaseFilterQueryParams<unknown>, 'searchKey'> {
Expand Down
32 changes: 13 additions & 19 deletions src/Shared/Components/SelectPicker/SelectPicker.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
* limitations under the License.
*/

import {
ControlProps,
GroupHeadingProps,
MultiValueProps,
OptionProps,
ValueContainerProps,
MenuPlacement,
} from 'react-select'
import { GroupHeadingProps, MultiValueProps, OptionProps, ValueContainerProps, MenuPlacement } from 'react-select'
import CreatableSelect from 'react-select/creatable'
import { ReactElement, useCallback, useMemo } from 'react'

Expand Down Expand Up @@ -213,9 +206,10 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
isCreatable = false,
onCreateOption,
closeMenuOnSelect = false,
shouldShowNoOptionsMessage = true,
...props
}: SelectPickerProps<OptionValue, IsMulti>) => {
const { inputId, required, isDisabled, controlShouldRenderValue = true, value, options } = props
const { inputId, required, isDisabled, controlShouldRenderValue = true, value, options, getOptionValue } = props
const { isGroupHeadingSelectable = false, getIsOptionValid = () => true } = multiSelectProps

// Only large variant is supported for multi select picker
Expand Down Expand Up @@ -252,18 +246,12 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
value as SelectPickerOptionType<OptionValue>[],
trimmedInput as OptionValue,
null,
getOptionValue,
) &&
!getSelectPickerOptionByValue<OptionValue>(options, trimmedInput as OptionValue, null)
!getSelectPickerOptionByValue<OptionValue>(options, trimmedInput as OptionValue, null, getOptionValue)
)
}

const renderControl = useCallback(
(controlProps: ControlProps<SelectPickerOptionType<OptionValue>>) => (
<SelectPickerControl {...controlProps} icon={icon} showSelectedOptionIcon={shouldShowSelectedOptionIcon} />
),
[icon, shouldShowSelectedOptionIcon],
)

const renderValueContainer = useCallback(
(valueContainerProps: ValueContainerProps<SelectPickerOptionType<OptionValue>>) => (
<SelectPickerValueContainer
Expand Down Expand Up @@ -298,7 +286,11 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
return <GenericSectionErrorState reload={reloadOptionList} />
}

return <p className="m-0 cn-7 fs-13 fw-4 lh-20 py-6 px-8">No options</p>
if (shouldShowNoOptionsMessage) {
return <p className="m-0 cn-7 fs-13 fw-4 lh-20 py-6 px-8">No options</p>
}

return null
}

const renderDisabledTippy = (children: ReactElement) => (
Expand Down Expand Up @@ -381,7 +373,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
IndicatorSeparator: null,
LoadingIndicator: SelectPickerLoadingIndicator,
DropdownIndicator: SelectPickerDropdownIndicator,
Control: renderControl,
Control: SelectPickerControl,
Option: renderOption,
MenuList: SelectPickerMenuList,
ClearIndicator: SelectPickerClearIndicator,
Expand All @@ -399,6 +391,8 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
renderMenuListFooter={!optionListError && renderMenuListFooter}
inputValue={inputValue}
onInputChange={onInputChange}
icon={icon}
showSelectedOptionIcon={shouldShowSelectedOptionIcon}
/>
</div>
</ConditionalWrap>
Expand Down
18 changes: 9 additions & 9 deletions src/Shared/Components/SelectPicker/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ export const SelectPickerClearIndicator = <OptionValue,>(
</components.ClearIndicator>
)

export const SelectPickerControl = <OptionValue, IsMulti extends boolean>({
icon,
showSelectedOptionIcon,
...props
}: ControlProps<SelectPickerOptionType<OptionValue>> &
Pick<SelectPickerProps<OptionValue, IsMulti>, 'icon' | 'showSelectedOptionIcon'>) => {
const { children, getValue } = props
export const SelectPickerControl = <OptionValue,>(props: ControlProps<SelectPickerOptionType<OptionValue>>) => {
const {
children,
getValue,
selectProps: { icon, showSelectedOptionIcon },
} = props
const { startIcon, endIcon } = getValue()?.[0] ?? {}

let iconToDisplay: SelectPickerOptionType<OptionValue>['startIcon'] = icon
Expand Down Expand Up @@ -149,7 +148,8 @@ export const SelectPickerOption = <OptionValue, IsMulti extends boolean>({
/>
)}
<div className={`flex left ${showDescription ? 'top' : ''} dc__gap-8`}>
{startIcon && (
{/* startIcon is not to be shown in option in case of multi select */}
{!isMulti && startIcon && (
<div className="dc__no-shrink icon-dim-20 flex dc__fill-available-space">{startIcon}</div>
)}
<div className="flex-grow-1">
Expand Down Expand Up @@ -201,7 +201,7 @@ export const SelectPickerMultiValueLabel = <OptionValue, IsMulti extends boolean
Pick<SelectPickerProps<OptionValue, IsMulti>['multiSelectProps'], 'getIsOptionValid'>) => {
const { data, selectProps } = props
const isOptionValid = getIsOptionValid(data)
const iconToDisplay = isOptionValid ? data.startIcon || data.endIcon : <ICErrorExclamation />
const iconToDisplay = isOptionValid ? (data.startIcon || data.endIcon) ?? null : <ICErrorExclamation />

return (
<div className="flex dc__gap-4 mw-0 dc__truncate">
Expand Down
Loading