diff --git a/package.json b/package.json index 22c3b8b80b..21dc405320 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "homepage": "/dashboard", "dependencies": { - "@devtron-labs/devtron-fe-common-lib": "1.19.0-pre-5", + "@devtron-labs/devtron-fe-common-lib": "1.19.4-pre-0", "@esbuild-plugins/node-globals-polyfill": "0.2.3", "@rjsf/core": "^5.13.3", "@rjsf/utils": "^5.13.3", diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx index 50ff3f5578..a87d98e29c 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx @@ -162,7 +162,7 @@ export const CIStepperContent = ({ )} {materials.map((material, index) => { - const { id, name, type, isRegex, value, regex, gitMaterialId } = material + const { id, name, type, isRegex, value, regex, gitMaterialId, url } = material const isBranchRegex = type === SourceTypeMap.BranchRegex || isRegex const isBranchFixed = type === SourceTypeMap.BranchFixed && !isRegex @@ -183,6 +183,7 @@ export const CIStepperContent = ({ (
{repoName && (
- +

{repoName}

)} diff --git a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts index 629e213c50..d2616b6d6d 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts @@ -14,10 +14,9 @@ * limitations under the License. */ -import { CustomInputProps, SelectPickerProps } from '@devtron-labs/devtron-fe-common-lib' +import { CustomInputProps, MaterialType, SelectPickerProps } from '@devtron-labs/devtron-fe-common-lib' -export interface SourceMaterialsSelectorProps { - repoName?: string +type CommonSourceTypeProps = { sourceTypePickerProps: Omit< SelectPickerProps, 'required' | 'isClearable' | 'closeMenuOnSelect' | 'size' @@ -26,3 +25,13 @@ export interface SourceMaterialsSelectorProps { hideInput?: boolean } } + +export type SourceMaterialsSelectorProps = + | (CommonSourceTypeProps & { + repoName: string + gitURL: MaterialType['url'] + }) + | (CommonSourceTypeProps & { + repoName?: never + gitURL?: never + }) diff --git a/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx b/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx index 1542ecad0d..fd374b7b19 100644 --- a/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx +++ b/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx @@ -33,7 +33,6 @@ import { GenericFilterEmptyState, getSelectPickerOptionByValue, Icon, - noop, numberComparatorBySortOrder, OptionType, PaginationEnum, @@ -55,6 +54,7 @@ import { importComponentFromFELibrary } from '@Components/common' import { URLS } from '@Config/routes' import CreateCluster from '@Pages/GlobalConfigurations/ClustersAndEnvironments/CreateCluster/CreateCluster.component' import { CreateClusterTypeEnum } from '@Pages/GlobalConfigurations/ClustersAndEnvironments/CreateCluster/types' +import { UpgradeToEnterpriseDialog } from '@Pages/Shared/UpgradeToEnterprise' import { getClusterList, getEnvironmentList } from './cluster.service' import { @@ -84,8 +84,9 @@ const PodSpreadModal = importComponentFromFELibrary('PodSpreadModal', null, 'fun const HibernationRulesModal = importComponentFromFELibrary('HibernationRulesModal', null, 'function') const ClusterList = () => { - const { isSuperAdmin } = useMainContext() + const { isSuperAdmin, licenseData } = useMainContext() const isK8sClient = window._env_.K8S_CLIENT + const isFreemium = licenseData?.isFreemium ?? false const { push } = useHistory() const { search } = useLocation() @@ -121,6 +122,7 @@ const ClusterList = () => { ) const [showUnmappedEnvs, setShowUnmappedEnvs] = useState(false) + const [showUpgradeToEnterprise, setShowUpgradeToEnterprise] = useState(false) const clusterIdVsEnvMap: Record = useMemo( () => @@ -244,6 +246,8 @@ const ClusterList = () => { const isEnvironmentsView = selectedTab === ClusterEnvTabs.ENVIRONMENTS const isClusterEnvListLoading = clusterListLoading || envListLoading + const isClusterAdditionAllowed = + !isFreemium || clusterListResult?.length < licenseData?.moduleLimits.maxAllowedClusters // Early return for non super admin users if (!isK8sClient && !isSuperAdmin) { @@ -338,15 +342,76 @@ const ClusterList = () => { ) } + const handleOpenUpgradeDialog = () => { + setShowUpgradeToEnterprise(true) + } + + const handleCloseUpgradeDialog = () => { + setShowUpgradeToEnterprise(false) + } + + const renderAddEnvButton = () => ( +
{licenseData.licenseStatusError && - licenseData.licenseStatusError.code !== LicensingErrorCodes.LicenseExpired ? ( + licenseData.licenseStatusError.code !== LicensingErrorCodes.LicenseExpired && + licenseData.licenseStatusError.code !== LicensingErrorCodes.ClusterLimitExceeded ? ( { licenseStatus={licenseData.licenseStatus} isTrial={licenseData.isTrial} licenseSuffix={licenseData.licenseSuffix} + isFreemium={licenseData.isFreemium} appTheme={appTheme} + licenseStatusError={licenseData.licenseStatusError} /> )}
diff --git a/src/Pages/Shared/UpgradeToEnterprise/UpgradeToEnterpriseDialog.tsx b/src/Pages/Shared/UpgradeToEnterprise/UpgradeToEnterpriseDialog.tsx new file mode 100644 index 0000000000..e8f27a0619 --- /dev/null +++ b/src/Pages/Shared/UpgradeToEnterprise/UpgradeToEnterpriseDialog.tsx @@ -0,0 +1,99 @@ +import { + Button, + ButtonComponentType, + ButtonStyleType, + ButtonVariantType, + ComponentSizeType, + CONTACT_SALES_LINK, + GenericModal, + Icon, +} from '@devtron-labs/devtron-fe-common-lib' + +const ENTERPRISE_PLAN_OFFERINGS = [ + 'Unlimited clusters', + 'Managed Devtron installation', + 'Priority support', + 'Contribute to our roadmap', + 'Early access to enterprise features & more…', +] + +const UpgradeToEnterpriseDialog = ({ open, handleClose }: { open: boolean; handleClose: () => void }) => ( + + +
+
+
+ +
+
+

Upgrade to Enterprise Plan

+
+ + Freemium plan allows managing the Devtron host cluster along with one additional + cluster. + + Switch to Enterprise plan to scale without limits. +
+
+
+
+
+ What’s included +
+ {ENTERPRISE_PLAN_OFFERINGS.map((description) => ( +
+ + {description} +
+ ))} +
+
+
+
+
+ Unlock Devtron's Full Potential + + Scale your infrastructure, accelerate your teams, and get the resources you need to + grow. + +
+
+
+
+ + +) + +export default UpgradeToEnterpriseDialog diff --git a/src/Pages/Shared/UpgradeToEnterprise/index.ts b/src/Pages/Shared/UpgradeToEnterprise/index.ts new file mode 100644 index 0000000000..901be71fc1 --- /dev/null +++ b/src/Pages/Shared/UpgradeToEnterprise/index.ts @@ -0,0 +1 @@ +export { default as UpgradeToEnterpriseDialog } from './UpgradeToEnterpriseDialog' diff --git a/src/components/CIPipelineN/Build.tsx b/src/components/CIPipelineN/Build.tsx index 2230457a55..bc951302ff 100644 --- a/src/components/CIPipelineN/Build.tsx +++ b/src/components/CIPipelineN/Build.tsx @@ -55,12 +55,14 @@ export const Build = ({ ...mat, value: '', regex: event.target.value, + gitURL: mat?.url, } } return { ...mat, regex: '', value: event.target.value, + gitURL: mat?.url, } } return mat diff --git a/src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx b/src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx index f3fe72409e..4af37d6f37 100644 --- a/src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx +++ b/src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx @@ -78,7 +78,7 @@ const ClusterSelectionBody: React.FC = ({ image={NoClusterEmptyState} title="No clusters found" subTitle="Add a cluster to view and debug Kubernetes resources in the cluster" - renderButton={renderNewClusterButton(refreshData)} + renderButton={renderNewClusterButton(refreshData, 0)} /> ) } diff --git a/src/components/ResourceBrowser/PageHeader.buttons.tsx b/src/components/ResourceBrowser/PageHeader.buttons.tsx index 6a0ccb2e69..58918308f8 100644 --- a/src/components/ResourceBrowser/PageHeader.buttons.tsx +++ b/src/components/ResourceBrowser/PageHeader.buttons.tsx @@ -30,6 +30,7 @@ import { CreateClusterProps, CreateClusterTypeEnum, } from '@Pages/GlobalConfigurations/ClustersAndEnvironments/CreateCluster/types' +import { UpgradeToEnterpriseDialog } from '@Pages/Shared/UpgradeToEnterprise' import { ReactComponent as Add } from '../../assets/icons/ic-add.svg' import { URLS } from '../../config' @@ -70,9 +71,24 @@ export const renderCreateResourceButton = (clusterId: string, callback: CreateRe ) -export const NewClusterButton = ({ handleReloadClusterList }: Pick) => { +export const NewClusterButton = ({ + handleReloadClusterList, + clusterCount, +}: Pick & { clusterCount: number }) => { const { replace } = useHistory() - const { isSuperAdmin } = useMainContext() + const { isSuperAdmin, licenseData } = useMainContext() + const isFreemium = licenseData?.isFreemium ?? false + const isClusterAdditionAllowed = !isFreemium || clusterCount < licenseData?.moduleLimits?.maxAllowedClusters + + const [showUpgradeToEnterprise, setShowUpgradeToEnterprise] = useState(false) + + const handleOpenUpgradeDialog = () => { + setShowUpgradeToEnterprise(true) + } + + const handleCloseUpgradeDialog = () => { + setShowUpgradeToEnterprise(false) + } const handleCloseCreateClusterModal = () => { replace(URLS.RESOURCE_BROWSER) @@ -86,28 +102,39 @@ export const NewClusterButton = ({ handleReloadClusterList }: Pick} - linkProps={{ - to: generatePath(URLS.RESOURCE_BROWSER_CREATE_CLUSTER, { - type: CreateClusterTypeEnum.CONNECT_CLUSTER, - }), - }} + {...(isClusterAdditionAllowed + ? { + component: ButtonComponentType.link, + linkProps: { + to: generatePath(URLS.RESOURCE_BROWSER_CREATE_CLUSTER, { + type: CreateClusterTypeEnum.CONNECT_CLUSTER, + }), + }, + } + : { + component: ButtonComponentType.button, + onClick: handleOpenUpgradeDialog, + })} />
- - - + {isClusterAdditionAllowed && ( + + + + )} + + ) ) } -export const renderNewClusterButton = (handleReloadClusterList: () => void) => () => ( - +export const renderNewClusterButton = (handleReloadClusterList: () => void, clusterCount: number) => () => ( + ) diff --git a/src/components/ResourceBrowser/ResourceBrowser.tsx b/src/components/ResourceBrowser/ResourceBrowser.tsx index 273dde223e..c8f6720330 100644 --- a/src/components/ResourceBrowser/ResourceBrowser.tsx +++ b/src/components/ResourceBrowser/ResourceBrowser.tsx @@ -49,13 +49,18 @@ const ResourceBrowser: React.FC = () => { ) const sortedClusterList: ClusterDetail[] = useMemo( + () => sortObjectArrayAlphabetically(detailClusterList || clusterListMinData || [], 'name'), + [detailClusterList, clusterListMinData], + ) + + const filteredSortedCluserList = useMemo( () => - sortObjectArrayAlphabetically(detailClusterList || clusterListMinData || [], 'name').filter( + sortedClusterList.filter( (option) => !(window._env_.HIDE_DEFAULT_CLUSTER && option.id === DEFAULT_CLUSTER_ID) && !option.isVirtualCluster, ), - [detailClusterList, clusterListMinData], + [sortedClusterList], ) const renderContent = () => { @@ -66,7 +71,7 @@ const ResourceBrowser: React.FC = () => { return ( { {renderContent()}
diff --git a/src/components/app/details/appDetails/DeployedCommitCard.tsx b/src/components/app/details/appDetails/DeployedCommitCard.tsx index d591d923d0..a7821e414c 100644 --- a/src/components/app/details/appDetails/DeployedCommitCard.tsx +++ b/src/components/app/details/appDetails/DeployedCommitCard.tsx @@ -20,7 +20,6 @@ import { getCITriggerInfo, getParsedCIMaterialInfo, GitProviderIcon, - GitProviderType, Icon, LoadingCard, useQuery, @@ -77,9 +76,7 @@ const DeployedCommitCard = ({ cardLoading, showCommitInfoDrawer, envId, ciArtifa - - {/* @TODO: This should be dynamic, dependent on the source */} - {/* */} +
diff --git a/src/components/ciPipeline/SourceMaterials.tsx b/src/components/ciPipeline/SourceMaterials.tsx index bb724e3816..12dc4f81a1 100644 --- a/src/components/ciPipeline/SourceMaterials.tsx +++ b/src/components/ciPipeline/SourceMaterials.tsx @@ -141,6 +141,7 @@ export const SourceMaterials = ({ ).message, autoFocus: index === 0, }} + gitURL={mat?.url} /> {isBranchRegex && ( diff --git a/src/components/ciPipeline/ciPipeline.service.ts b/src/components/ciPipeline/ciPipeline.service.ts index eb7398aea1..fc9b01448a 100644 --- a/src/components/ciPipeline/ciPipeline.service.ts +++ b/src/components/ciPipeline/ciPipeline.service.ts @@ -135,7 +135,7 @@ function getPipelineBaseMetaConfiguration( isTemplateView: AppConfigProps['isTemplateView'], ): Promise { return getSourceConfig(appId, queryParams, isTemplateView).then((response) => { - const materials = response?.result?.material?.map((mat) => { + const materials: MaterialType[] = response?.result?.material?.map((mat: MaterialType) => { return { id: 0, gitMaterialId: mat.id, @@ -146,6 +146,7 @@ function getPipelineBaseMetaConfiguration( gitMaterialName: mat.name, gitProviderId: mat.gitProviderId, gitHostId: 0, + url: mat.url, } }) const _baseCiPipelineSourceTypeOptions = CiPipelineSourceTypeBaseOptions.map((obj) => ({ ...obj })) @@ -348,8 +349,6 @@ export function deleteCIPipeline( gitMaterials, appId: number, workflowId: number, - isExternalCI: boolean, - webhookConditionList, isTemplateView: AppConfigProps['isTemplateView'], ) { const updatedCI = { @@ -456,6 +455,7 @@ function createMaterialList(ciPipeline, gitMaterials: MaterialType[], gitHost: G gitHostId: gitHost ? gitHost.id : 0, regex: mat.source.regex, isRegex: mat.isRegex, + url: mat.url || gitMaterials?.[0].url, // Required BE support till then will be getting url from another api } }) || [] } @@ -477,6 +477,7 @@ function createMaterialList(ciPipeline, gitMaterials: MaterialType[], gitHost: G gitHostId: mat.gitHostId, gitProviderId: mat.gitProviderId, isRegex: mat.isRegex, + url: mat.url, }) } } @@ -563,7 +564,7 @@ function migrateOldData( function parseCIResponse( responseCode: number, ciPipeline, - gitMaterials, + gitMaterials: MaterialType[], gitHost, webhookEvents, ciPipelineSourceTypeOptions, diff --git a/src/components/gitProvider/GitProvider.tsx b/src/components/gitProvider/GitProvider.tsx index bc660808b5..247d3c1d11 100644 --- a/src/components/gitProvider/GitProvider.tsx +++ b/src/components/gitProvider/GitProvider.tsx @@ -30,7 +30,6 @@ import { ToastManager, SelectPicker, ComponentSizeType, - renderMaterialIcon, ERROR_STATUS_CODE, Button, ButtonStyleType, @@ -42,6 +41,7 @@ import { InfoBlock, DTSwitchProps, DTSwitch, + GitProviderIcon, } from '@devtron-labs/devtron-fe-common-lib' import Tippy from '@tippyjs/react' import { @@ -325,9 +325,7 @@ const CollapsedList = ({ > {id && ( -
- {renderMaterialIcon(url)} -
+ )} {!id && collapsed && }
@@ -472,7 +470,6 @@ const GitForm = ({ }, }) - const [deleting, setDeleting] = useState(false) const [confirmation, setConfirmation] = useState(false) const isTLSInitiallyConfigured = id && enableTLSVerification diff --git a/src/components/material/MaterialView.tsx b/src/components/material/MaterialView.tsx index 11799e6baf..845398e9ae 100644 --- a/src/components/material/MaterialView.tsx +++ b/src/components/material/MaterialView.tsx @@ -37,6 +37,7 @@ import { ButtonComponentType, Icon, InfoBlock, + GitProviderIcon, } from '@devtron-labs/devtron-fe-common-lib' import Tippy from '@tippyjs/react' import { MaterialViewProps, MaterialViewState } from './material.types' @@ -605,7 +606,7 @@ export class MaterialView extends Component, }) handleGitProviderChange: SelectPickerProps['onChange'] = (selected) => { diff --git a/src/components/workflowEditor/Workflow.tsx b/src/components/workflowEditor/Workflow.tsx index a26a881d7f..a485e06b6f 100644 --- a/src/components/workflowEditor/Workflow.tsx +++ b/src/components/workflowEditor/Workflow.tsx @@ -15,7 +15,7 @@ */ import { Component } from 'react' -import { RouteComponentProps, Link, generatePath } from 'react-router-dom' +import { Link, generatePath } from 'react-router-dom' import Tippy from '@tippyjs/react' import { CINode } from './nodes/CINode' import { CDNode } from './nodes/CDNode' @@ -40,19 +40,15 @@ import { noop, WorkflowNodeType, PipelineType, - AddPipelineType, - SelectedNode, ConditionalWrap, ChangeCIPayloadType, - CIPipelineNodeType, URLS as CommonURLS, - AppConfigProps, } from '@devtron-labs/devtron-fe-common-lib' import { ReactComponent as ICInput } from '../../assets/icons/ic-input.svg' import { ReactComponent as ICMoreOption } from '../../assets/icons/ic-more-option.svg' import { ReactComponent as ICDelete } from '../../assets/icons/ic-delete-interactive.svg' import { ReactComponent as ICEdit } from '../../assets/icons/ic-pencil.svg' -import { WorkflowPositionState } from './types' +import { WorkflowProps, WorkflowState } from './types' import { CHANGE_CI_TOOLTIP } from './constants' const ApprovalNodeEdge = importComponentFromFELibrary('ApprovalNodeEdge') @@ -63,55 +59,6 @@ const getParsedPluginPolicyConsequenceData = importComponentFromFELibrary( 'function', ) -export interface WorkflowProps - extends RouteComponentProps<{ appId: string; workflowId?: string; ciPipelineId?: string; cdPipelineId?: string }>, - Required> { - nodes: CommonNodeAttr[] - id: number - name: string - startX: number - startY: number - width: number | string - height: number | string - showDeleteDialog: (workflowId: number) => void - handleCDSelect: ( - workflowId: number | string, - ciPipelineId: number | string, - parentPipelineType: string, - parentPipelineId: number | string, - isWebhookCD?: boolean, - childPipelineId?: number | string, - addType?: AddPipelineType, - ) => void - openEditWorkflow: (event, workflowId: number) => string - handleCISelect: (workflowId: string | number, type: CIPipelineNodeType) => void - addCIPipeline: (type: CIPipelineNodeType) => void - addWebhookCD: (workflowId?: number | string) => void - cdWorkflowList?: any[] - showWebhookTippy?: boolean - hideWebhookTippy?: () => void - isJobView?: boolean - envList?: any[] - filteredCIPipelines?: any[] - addNewPipelineBlocked?: boolean - handleChangeCI?: (changeCIPayload: ChangeCIPayloadType) => void - selectedNode?: SelectedNode - handleSelectedNodeChange?: (selectedNode: SelectedNode) => void - appName?: string - getWorkflows?: () => void - refreshParentWorkflows?: () => void - reloadEnvironments?: () => void - workflowPositionState?: WorkflowPositionState - handleDisplayLoader?: () => void - isOffendingPipelineView?: boolean -} - -interface WorkflowState { - top: number - left: number - showCIMenu: boolean -} - export class Workflow extends Component { constructor(props) { super(props) diff --git a/src/components/workflowEditor/nodes/CINode.tsx b/src/components/workflowEditor/nodes/CINode.tsx index 4ce2ee3b41..401aa98dd0 100644 --- a/src/components/workflowEditor/nodes/CINode.tsx +++ b/src/components/workflowEditor/nodes/CINode.tsx @@ -17,13 +17,11 @@ import { Component, ReactElement } from 'react' import { WorkflowNodeType, - SelectedNode, - CommonNodeAttr, ConditionalWrap, Icon, } from '@devtron-labs/devtron-fe-common-lib' import Tippy from '@tippyjs/react' -import { Link, RouteComponentProps } from 'react-router-dom' +import { Link } from 'react-router-dom' import ToggleCDSelectButton from '../ToggleCDSelectButton' import { ReactComponent as Warning } from '../../../assets/icons/ic-warning.svg' import { ReactComponent as ICLinkedCINode } from '../../../assets/icons/ic-node-build-linked.svg' @@ -31,40 +29,7 @@ import { ReactComponent as IcLink } from '../../../assets/icons/ic-link.svg' import { DEFAULT_ENV } from '../../app/details/triggerView/Constants' import { URLS } from '../../../config' import { getLinkedCITippyContent } from '../../../Pages/Shared/LinkedCIDetailsModal/utils' -import { WorkflowProps } from '../Workflow' - -export interface CINodeProps extends RouteComponentProps<{}>, Pick { - x: number - y: number - width: number - height: number - id: number - title: string - type: string - description: string - workflowId: number - triggerType: string - isLinkedCI: boolean - isExternalCI: boolean - isJobCI: boolean - isTrigger: boolean - linkedCount: number - downstreams: CommonNodeAttr[] - to: string - toggleCDMenu: () => void - configDiffView?: boolean - hideWebhookTippy?: () => void - isJobView?: boolean - showPluginWarning?: boolean - envList?: any[] - filteredCIPipelines?: any[] - addNewPipelineBlocked?: boolean - handleSelectedNodeChange?: (selectedNode: SelectedNode) => void - selectedNode?: SelectedNode - isLastNode?: boolean - appId: string - getWorkflows: () => void -} +import { CINodeProps } from './types' export class CINode extends Component { handleLinkedCIWorkflowChipClick = (e) => { diff --git a/src/components/workflowEditor/nodes/StaticNode.tsx b/src/components/workflowEditor/nodes/StaticNode.tsx index e5058dd083..3b394521b1 100644 --- a/src/components/workflowEditor/nodes/StaticNode.tsx +++ b/src/components/workflowEditor/nodes/StaticNode.tsx @@ -14,28 +14,10 @@ * limitations under the License. */ -import React, { Component } from 'react' +import { Component } from 'react' import { GIT_BRANCH_NOT_CONFIGURED } from '../../../config' import { CiPipelineSourceConfig, GitProviderIcon, GitProviderType } from '@devtron-labs/devtron-fe-common-lib' - -export interface StaticNodeProps { - x: number - y: number - branch: string - icon: string - id: string - url: string - title: string - height: number - width: number - downstreams: any[] - sourceType: string - regex?: string - primaryBranchAfterRegex?: string - to?: string - handleGoToWorkFlowEditor?: (e?: any) => void -} - +import { StaticNodeProps } from './types' export class StaticNode extends Component { renderCardContent() { return ( diff --git a/src/components/workflowEditor/nodes/types.ts b/src/components/workflowEditor/nodes/types.ts new file mode 100644 index 0000000000..7691a452c4 --- /dev/null +++ b/src/components/workflowEditor/nodes/types.ts @@ -0,0 +1,58 @@ +import { RouteComponentProps } from 'react-router-dom' + +import { CommonNodeAttr, SelectedNode } from '@devtron-labs/devtron-fe-common-lib' + +import { WorkflowProps } from '../types' + +export interface StaticNodeProps { + x: number + y: number + branch: string + icon: string + id: string + url: string + title: string + height: number + width: number + downstreams: any[] + sourceType: string + regex?: string + primaryBranchAfterRegex?: string + to?: string + handleGoToWorkFlowEditor?: (e?: any) => void +} + +export interface CINodeProps + extends RouteComponentProps<{}>, + Pick { + x: number + y: number + width: number + height: number + id: number + title: string + type: string + description: string + workflowId: number + triggerType: string + isLinkedCI: boolean + isExternalCI: boolean + isJobCI: boolean + isTrigger: boolean + linkedCount: number + downstreams: CommonNodeAttr[] + to: string + toggleCDMenu: () => void + configDiffView?: boolean + hideWebhookTippy?: () => void + isJobView?: boolean + showPluginWarning?: boolean + envList?: any[] + filteredCIPipelines?: any[] + addNewPipelineBlocked?: boolean + handleSelectedNodeChange?: (selectedNode: SelectedNode) => void + selectedNode?: SelectedNode + isLastNode?: boolean + appId: string + getWorkflows: () => void +} diff --git a/src/components/workflowEditor/types.ts b/src/components/workflowEditor/types.ts index fcbe8d02e2..1a64b2ae4c 100644 --- a/src/components/workflowEditor/types.ts +++ b/src/components/workflowEditor/types.ts @@ -17,6 +17,7 @@ import { RouteComponentProps } from 'react-router-dom' import { + AddPipelineType, AppConfigProps, ChangeCIPayloadType, CiPipeline, @@ -40,7 +41,6 @@ import { CdPipelineResult } from '../app/details/triggerView/types' import { InputVariablesFromInputListType } from '../cdPipeline/cdPipeline.types' import { DeleteDialogType, ForceDeleteMessageType } from '../cdPipeline/types' import { LoadingState } from '../ciConfig/types' -import { WorkflowProps } from './Workflow' export interface BlackListedCI { [key: number]: CiPipeline @@ -352,3 +352,52 @@ export interface ToggleCDSelectButtonProps extends Required void hideDeleteButton?: boolean } + +export interface WorkflowProps + extends RouteComponentProps<{ appId: string; workflowId?: string; ciPipelineId?: string; cdPipelineId?: string }>, + Required> { + nodes: CommonNodeAttr[] + id: number + name: string + startX: number + startY: number + width: number | string + height: number | string + showDeleteDialog: (workflowId: number) => void + handleCDSelect: ( + workflowId: number | string, + ciPipelineId: number | string, + parentPipelineType: string, + parentPipelineId: number | string, + isWebhookCD?: boolean, + childPipelineId?: number | string, + addType?: AddPipelineType, + ) => void + openEditWorkflow: (event, workflowId: number) => string + handleCISelect: (workflowId: string | number, type: CIPipelineNodeType) => void + addCIPipeline: (type: CIPipelineNodeType) => void + addWebhookCD: (workflowId?: number | string) => void + cdWorkflowList?: any[] + showWebhookTippy?: boolean + hideWebhookTippy?: () => void + isJobView?: boolean + envList?: any[] + filteredCIPipelines?: any[] + addNewPipelineBlocked?: boolean + handleChangeCI?: (changeCIPayload: ChangeCIPayloadType) => void + selectedNode?: SelectedNode + handleSelectedNodeChange?: (selectedNode: SelectedNode) => void + appName?: string + getWorkflows?: () => void + refreshParentWorkflows?: () => void + reloadEnvironments?: () => void + workflowPositionState?: WorkflowPositionState + handleDisplayLoader?: () => void + isOffendingPipelineView?: boolean +} + +export interface WorkflowState { + top: number + left: number + showCIMenu: boolean +} diff --git a/src/css/icons.scss b/src/css/icons.scss index 13ff02169d..b2c8795828 100644 --- a/src/css/icons.scss +++ b/src/css/icons.scss @@ -212,6 +212,11 @@ height: 50px; } +.icon-dim-64 { + width: 64px; + height: 64px; +} + .icon-dim-72 { width: 72px; height: 72px; diff --git a/yarn.lock b/yarn.lock index b4e3bc1428..e2227066d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1722,9 +1722,9 @@ __metadata: languageName: node linkType: hard -"@devtron-labs/devtron-fe-common-lib@npm:1.19.0-pre-5": - version: 1.19.0-pre-5 - resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.19.0-pre-5" +"@devtron-labs/devtron-fe-common-lib@npm:1.19.4-pre-0": + version: 1.19.4-pre-0 + resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.19.4-pre-0" dependencies: "@codemirror/autocomplete": "npm:6.18.6" "@codemirror/lang-json": "npm:6.0.1" @@ -1774,7 +1774,7 @@ __metadata: react-select: 5.8.0 rxjs: ^7.8.1 yaml: ^2.4.1 - checksum: 10c0/3a3548f036acf58e55b0887c14f5d288707d65f07eca21b210d48636c77f77a17721bcc124a72a44bfdcac55d5221a3465a5634585e05e6c5a0b0454a690e97d + checksum: 10c0/47a2fe19d51cd77611eda22cf16c151e18e8dee9fad2888912af0053245d5f0aa0d30f934192c8249883f5aeb7ecf30c1802c6eb31f34afb2cac28237d5d74a3 languageName: node linkType: hard @@ -5721,7 +5721,7 @@ __metadata: version: 0.0.0-use.local resolution: "dashboard@workspace:." dependencies: - "@devtron-labs/devtron-fe-common-lib": "npm:1.19.0-pre-5" + "@devtron-labs/devtron-fe-common-lib": "npm:1.19.4-pre-0" "@esbuild-plugins/node-globals-polyfill": "npm:0.2.3" "@playwright/test": "npm:^1.32.1" "@rjsf/core": "npm:^5.13.3"