diff --git a/package-lock.json b/package-lock.json index 1a5841757..947e85d82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.5.8-beta-1", + "version": "0.5.8-beta-2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.5.8-beta-1", + "version": "0.5.8-beta-2", "license": "ISC", "dependencies": { "@types/react-dates": "^21.8.6", diff --git a/package.json b/package.json index 11a8b0bd6..6b90aa90c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.5.8-beta-1", + "version": "0.5.8-beta-2", "description": "Supporting common component library", "type": "module", "main": "dist/index.js", diff --git a/src/Common/CIPipeline.Types.ts b/src/Common/CIPipeline.Types.ts index 86418dfde..ea92fb660 100644 --- a/src/Common/CIPipeline.Types.ts +++ b/src/Common/CIPipeline.Types.ts @@ -170,7 +170,6 @@ export interface StepType { inlineStepDetail?: InlineStepDetailType pluginRefStepDetail?: PluginRefStepDetailType triggerIfParentStageFail: boolean - isMandatory?: boolean } export interface BuildStageType { diff --git a/src/Common/Policy.Types.ts b/src/Common/Policy.Types.ts index 9741af7a6..b18617026 100644 --- a/src/Common/Policy.Types.ts +++ b/src/Common/Policy.Types.ts @@ -14,39 +14,35 @@ * limitations under the License. */ -import { PluginDataStoreType } from '../Shared' +import { PipelineFormType } from '@Pages/Applications' +import { PluginDataStoreType, PluginDetailPayloadType, ResourceKindType } from '../Shared' import { VariableType } from './CIPipeline.Types' import { ServerErrors } from './ServerError' -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', + PRE_CD = 'PRE_CD', + POST_CD = 'POST_CD', } +// FIXME: The name build is getting is used in CDPipeline. +// This enum is mapping values from BuildStageVariable export enum PluginRequiredStage { - PRE_CI = 'preBuildStage', - POST_CI = 'postBuildStage', - PRE_OR_POST_CI = 'PRE_OR_POST_CI', + PRE_STAGE = 'preBuildStage', + POST_STAGE = 'postBuildStage', + PRE_OR_POST_STAGE = 'PRE_OR_POST_CI', } export interface DefinitionSourceType { - projectName: string - isDueToProductionEnvironment: boolean - isDueToLinkedPipeline: boolean - policyName: string - appName?: string - clusterName?: string - environmentName?: string - branchNames?: string[] - ciPipelineName?: string + policyNames: string[] + linkedCIPipelineNames?: string[] } + export interface MandatoryPluginDetailType { id: number parentPluginId: number @@ -57,7 +53,7 @@ export interface MandatoryPluginDetailType { applied?: boolean inputVariables?: VariableType[] outputVariables?: VariableType[] - definitionSources?: DefinitionSourceType[] + definitionSources?: DefinitionSourceType } export interface MandatoryPluginDataType { pluginData: MandatoryPluginDetailType[] @@ -71,6 +67,37 @@ export interface ProcessPluginDataReturnType { mandatoryPluginsError?: ServerErrors } +export type ProcessPluginDataCIParamsType = { + resourceKind: ResourceKindType.ciPipeline + ciPipelineId: number + /** + * Comma separated branch names used for v1 api + * For v2 format is [branchName1],[branchName2] + */ + branchName?: string + + envName?: never +} + +export type ProcessPluginDataCDParamsType = { + resourceKind: ResourceKindType.cdPipeline + envName?: string + + ciPipelineId?: never + branchName?: never +} + +export type ProcessPluginDataParamsType = { + formData: PipelineFormType + pluginDataStoreState: PluginDataStoreType + appId: number + appName: string + /** + * Would be sent in case we have to get data for steps + */ + requiredPluginIds?: PluginDetailPayloadType['pluginId'] +} & (ProcessPluginDataCIParamsType | ProcessPluginDataCDParamsType) + export enum ConsequenceAction { /** * This is used if the policy is enforced immediately. @@ -104,7 +131,3 @@ export interface BlockedStateData { isCITriggerBlocked: boolean ciBlockState: ConsequenceType } - -export interface GetBlockedStateResponse extends ResponseType { - result?: BlockedStateData -} diff --git a/src/Common/Types.ts b/src/Common/Types.ts index c33dcac4d..f87e43f8f 100644 --- a/src/Common/Types.ts +++ b/src/Common/Types.ts @@ -18,8 +18,15 @@ import React, { ReactNode, CSSProperties, ReactElement } from 'react' import { Placement } from 'tippy.js' import { UserGroupDTO } from '@Pages/GlobalConfigurations' import { ImageComment, ReleaseTag } from './ImageTags.Types' -import { ACTION_STATE, ConsequenceType, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.' -import { RegistryType, RuntimeParamsListItemType, Severity } from '../Shared' +import { MandatoryPluginBaseStateType, RegistryType, RuntimeParamsListItemType, Severity } from '../Shared' +import { + ACTION_STATE, + ConsequenceType, + DEPLOYMENT_WINDOW_TYPE, + DockerConfigOverrideType, + SortingOrder, + TaskErrorObj, +} from '.' /** * Generic response type object with support for overriding the result type @@ -450,12 +457,12 @@ export interface ArtifactReleaseMappingType { } export interface CDMaterialListModalServiceUtilProps { - artifacts: any[], - offset: number, - artifactId?: number, - artifactStatus?: string, - disableDefaultSelection?: boolean, - userApprovalConfig?: UserApprovalConfigType, + artifacts: any[] + offset: number + artifactId?: number + artifactStatus?: string + disableDefaultSelection?: boolean + userApprovalConfig?: UserApprovalConfigType } export interface CDMaterialType { @@ -552,7 +559,7 @@ export interface DownstreamNodesEnvironmentsType { environmentName: string } -export interface CommonNodeAttr { +export interface CommonNodeAttr extends Pick { connectingCiPipelineId?: number parents: string | number[] | string[] x: number @@ -602,12 +609,10 @@ export interface CommonNodeAttr { approvalUsers?: string[] userApprovalConfig?: UserApprovalConfigType requestedUserId?: number - showPluginWarning?: boolean + showPluginWarning: boolean helmPackageName?: string isVirtualEnvironment?: boolean deploymentAppType?: DeploymentAppTypes - isCITriggerBlocked?: boolean - ciBlockState?: ConsequenceType appReleaseTagNames?: string[] tagsEditable?: boolean isGitOpsRepoNotConfigured?: boolean @@ -790,7 +795,7 @@ export interface CDStageConfigMapSecretNames { secrets: any[] } -export interface PrePostDeployStageType { +export interface PrePostDeployStageType extends MandatoryPluginBaseStateType { isValid: boolean steps: TaskErrorObj[] triggerType: string @@ -828,6 +833,8 @@ export interface CdPipeline { preDeployStage?: PrePostDeployStageType postDeployStage?: PrePostDeployStageType isProdEnv?: boolean + isGitOpsRepoNotConfigured?: boolean + isDeploymentBlocked?: boolean } export interface ExternalCiConfig { diff --git a/src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx b/src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx index 1af043d41..2306d7955 100644 --- a/src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx +++ b/src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx @@ -30,9 +30,11 @@ const InfoIconTippy = ({ placement = 'bottom', dataTestid = 'info-tippy-button', children, + headingInfo, }: InfoIconTippyProps) => ( { latestVersionId: MinimalPluginVersionDataDTO['id'] pluginVersions: MinimalPluginVersionDataDTO[] @@ -112,10 +112,7 @@ interface ParentPluginType interface DetailedPluginVersionType extends Pick, - Pick< - DetailedPluginVersionDTO, - 'tags' | 'isLatest' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink' - >, + Pick, Pick { parentPluginId: ParentPluginType['id'] } @@ -253,3 +250,20 @@ export interface PluginTagsContainerProps { export interface PluginImageContainerProps extends Pick { fallbackImageClassName?: string } + +export enum PipelineStageTaskActionModalType { + DELETE = 'DELETE', + MOVE_PLUGIN = 'MOVE_PLUGIN', +} + +export interface PipelineStageTaskActionModalStateType { + type: PipelineStageTaskActionModalType + pluginId: PluginDetailType['id'] + taskIndex: number +} + +export interface MandatoryPluginBaseStateType { + isOffendingMandatoryPlugin: boolean + isTriggerBlocked: boolean + pluginBlockState: ConsequenceType +} diff --git a/src/Shared/Components/Plugin/utils.tsx b/src/Shared/Components/Plugin/utils.tsx index e8b6c1b21..271939a7c 100644 --- a/src/Shared/Components/Plugin/utils.tsx +++ b/src/Shared/Components/Plugin/utils.tsx @@ -84,7 +84,6 @@ export const parsePluginDetailsDTOIntoPluginStore = (pluginData: ParentPluginDTO plugin.type === PluginCreationType.SHARED ? pluginVersionData.updatedBy : DEFAULT_PLUGIN_CREATED_BY, outputVariables: pluginVersionData.outputVariables || [], inputVariables: pluginVersionData.inputVariables || [], - isLatest: pluginVersionData.isLatest || false, tags: sortedUniqueTags, parentPluginId: plugin.id, icon: plugin.icon || '', diff --git a/src/Shared/types.ts b/src/Shared/types.ts index dc2ace734..3cd3a1fa8 100644 --- a/src/Shared/types.ts +++ b/src/Shared/types.ts @@ -439,8 +439,8 @@ export enum ResourceKindType { tenant = 'tenant', installation = 'installation', environment = 'environment', - ciPipeline = 'ci-pipeline', cdPipeline = 'cd-pipeline', + ciPipeline = 'ci-pipeline', project = 'project', } diff --git a/src/index.ts b/src/index.ts index 63ee96403..ee65a937d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -76,6 +76,7 @@ export interface customEnv { SYSTEM_CONTROLLER_LISTING_TIMEOUT?: number FEATURE_STEP_WISE_LOGS_ENABLE?: boolean FEATURE_IMAGE_PROMOTION_ENABLE?: boolean + FEATURE_CD_MANDATORY_PLUGINS_ENABLE?: boolean FEATURE_CONFIG_DRIFT_ENABLE: boolean } declare global {