diff --git a/package.json b/package.json index e798945637..88d5c4ff8c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "homepage": "/dashboard", "dependencies": { - "@devtron-labs/devtron-fe-common-lib": "1.18.1-pre-6", + "@devtron-labs/devtron-fe-common-lib": "1.19.0-pre-1", "@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/CDPipelineDeploymentAppType/CDPipelineDeploymentAppType.tsx b/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/CDPipelineDeploymentAppType.tsx index 155e6fc22f..13aaef28a7 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/CDPipelineDeploymentAppType.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/CDPipelineDeploymentAppType.tsx @@ -1,3 +1,19 @@ +/* + * 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 { DeploymentAppTypes } from '@devtron-labs/devtron-fe-common-lib' import { DeploymentAppRadioGroup } from '@Components/v2/values/chartValuesDiff/ChartValuesView.component' diff --git a/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/index.ts b/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/index.ts index 8f0f8dc943..714fa69999 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/index.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/index.ts @@ -1 +1,17 @@ +/* + * 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. + */ + export * from './CDPipelineDeploymentAppType' diff --git a/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/types.ts b/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/types.ts index 780c02a6c8..040d76b00c 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/types.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CDPipelineDeploymentAppType/types.ts @@ -1,3 +1,19 @@ +/* + * 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 { DeploymentAppRadioGroupType } from '@Components/v2/values/chartValuesDiff/ChartValuesView.type' export interface CDPipelineDeploymentAppTypeProps diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CDStepperContent.tsx b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CDStepperContent.tsx index b715fb574b..11003a92da 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CDStepperContent.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CDStepperContent.tsx @@ -1,3 +1,19 @@ +/* + * 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 { ChangeEvent, useState } from 'react' import { useHistory } from 'react-router-dom' diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CICDStepper.tsx b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CICDStepper.tsx index 8d09327c61..a2d4353772 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CICDStepper.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CICDStepper.tsx @@ -1,3 +1,19 @@ +/* + * 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 { Icon } from '@devtron-labs/devtron-fe-common-lib' import { CICDStepperProps } from './types' diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx index 422be77097..50ff3f5578 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CIStepperContent.tsx @@ -1,3 +1,19 @@ +/* + * 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 { ChangeEvent, Fragment } from 'react' import { diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/ConfigureWebhookWrapper.tsx b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/ConfigureWebhookWrapper.tsx index d29fe7a70d..b4e9b5137e 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/ConfigureWebhookWrapper.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/ConfigureWebhookWrapper.tsx @@ -1,3 +1,19 @@ +/* + * 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 { ConfigureWebhook } from '@Components/ciPipeline/ConfigureWebhook' import { ConfigureWebhookWrapperProps } from './types' diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CreateCICDPipeline.tsx b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CreateCICDPipeline.tsx index 39a839b357..060e5e9f86 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CreateCICDPipeline.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CreateCICDPipeline.tsx @@ -1,3 +1,19 @@ +/* + * 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 { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react' import { diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/constants.ts b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/constants.ts index 7c9ad64c4d..af92d7cd54 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/constants.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/constants.ts @@ -1,3 +1,19 @@ +/* + * 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. + */ + export const CREATE_CI_CD_PIPELINE_TOAST_MESSAGES = { CREATE_WORKFLOW_SUCCESS: 'Workflow created', CREATE_WORKFLOW_FAILED: 'Failed to create workflow. Please retry again.', diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/createCICDPipeline.scss b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/createCICDPipeline.scss index 8df79c4126..eb61074024 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/createCICDPipeline.scss +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/createCICDPipeline.scss @@ -1,3 +1,19 @@ +/* + * 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. + */ + .ci-cd-pipeline { $stepper-gap: 16px; $stepper-connector-left: 18px; diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/index.ts b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/index.ts index 7bb01b5772..58b823ea96 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/index.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/index.ts @@ -1 +1,17 @@ +/* + * 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. + */ + export * from './CreateCICDPipeline' diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/service.ts b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/service.ts index 13aa6fb0e0..bc9e39a009 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/service.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/service.ts @@ -1,3 +1,19 @@ +/* + * 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 { DeploymentAppTypes, DeploymentStrategy, diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/types.ts b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/types.ts index 985565236a..7d1a042297 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/types.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/types.ts @@ -1,3 +1,19 @@ +/* + * 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 { Dispatch, ReactNode, SetStateAction } from 'react' import { diff --git a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/utils.ts b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/utils.ts index a7081fef15..399cffb78e 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/utils.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/utils.ts @@ -1,3 +1,19 @@ +/* + * 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 { DeploymentAppTypes, MaterialType, diff --git a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/SourceMaterialsSelector.tsx b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/SourceMaterialsSelector.tsx index 4e3b926b48..9222e27cd9 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/SourceMaterialsSelector.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/SourceMaterialsSelector.tsx @@ -1,3 +1,19 @@ +/* + * 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 { ComponentSizeType, CustomInput, Icon, SelectPicker } from '@devtron-labs/devtron-fe-common-lib' import { SourceMaterialsSelectorProps } from './types' diff --git a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/index.ts b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/index.ts index d3d1225ed1..e616c40e53 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/index.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/index.ts @@ -1 +1,17 @@ +/* + * 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. + */ + export * from './SourceMaterialsSelector' diff --git a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts index 3374c24842..629e213c50 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/SourceMaterialsSelector/types.ts @@ -1,3 +1,19 @@ +/* + * 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 { CustomInputProps, SelectPickerProps } from '@devtron-labs/devtron-fe-common-lib' export interface SourceMaterialsSelectorProps { diff --git a/src/Pages/App/Configurations/WorkflowEditor/index.ts b/src/Pages/App/Configurations/WorkflowEditor/index.ts index 281cc566d4..deb4b6897a 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/index.ts +++ b/src/Pages/App/Configurations/WorkflowEditor/index.ts @@ -1,3 +1,19 @@ +/* + * 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. + */ + export * from './CDPipelineDeploymentAppType' export * from './CreateCICDPipeline' export * from './SourceMaterialsSelector' diff --git a/src/Pages/App/Configurations/WorkflowEditor/utils.tsx b/src/Pages/App/Configurations/WorkflowEditor/utils.tsx index 2907e7e1a7..067b11f733 100644 --- a/src/Pages/App/Configurations/WorkflowEditor/utils.tsx +++ b/src/Pages/App/Configurations/WorkflowEditor/utils.tsx @@ -1,3 +1,19 @@ +/* + * 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 { Dispatch, SetStateAction } from 'react' import { Link } from 'react-router-dom' diff --git a/src/Pages/App/Configurations/index.ts b/src/Pages/App/Configurations/index.ts index 40e4fbc448..2feaf6d149 100644 --- a/src/Pages/App/Configurations/index.ts +++ b/src/Pages/App/Configurations/index.ts @@ -1 +1,17 @@ +/* + * 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. + */ + export * from './WorkflowEditor' diff --git a/src/Pages/App/CreateAppModal/AppClone/AppCloneList.tsx b/src/Pages/App/CreateAppModal/AppClone/AppCloneList.tsx index 0debca6013..dd31a2782c 100644 --- a/src/Pages/App/CreateAppModal/AppClone/AppCloneList.tsx +++ b/src/Pages/App/CreateAppModal/AppClone/AppCloneList.tsx @@ -1,3 +1,19 @@ +/* + * 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 { Button, ComponentSizeType, diff --git a/src/Pages/App/CreateAppModal/AppClone/index.ts b/src/Pages/App/CreateAppModal/AppClone/index.ts index 40234bde4d..5be9ce120c 100644 --- a/src/Pages/App/CreateAppModal/AppClone/index.ts +++ b/src/Pages/App/CreateAppModal/AppClone/index.ts @@ -1,2 +1,18 @@ +/* + * 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. + */ + export * from './AppCloneList' export { useDevtronCloneList } from './useDevtronCloneList' diff --git a/src/Pages/App/CreateAppModal/AppClone/types.ts b/src/Pages/App/CreateAppModal/AppClone/types.ts index 892afa2f2e..e489b45091 100644 --- a/src/Pages/App/CreateAppModal/AppClone/types.ts +++ b/src/Pages/App/CreateAppModal/AppClone/types.ts @@ -1,3 +1,19 @@ +/* + * 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 { BaseAppMetaData, GenericInfoCardListingProps } from '@devtron-labs/devtron-fe-common-lib' import { APP_TYPE } from '@Config/constants' diff --git a/src/Pages/App/CreateAppModal/AppClone/useDevtronCloneList.tsx b/src/Pages/App/CreateAppModal/AppClone/useDevtronCloneList.tsx index 6c01e19245..9914884f93 100644 --- a/src/Pages/App/CreateAppModal/AppClone/useDevtronCloneList.tsx +++ b/src/Pages/App/CreateAppModal/AppClone/useDevtronCloneList.tsx @@ -1,3 +1,19 @@ +/* + * 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. + */ + /* * Copyright (c) 2024. Devtron Inc. */ diff --git a/src/Pages/App/CreateAppModal/CloneApplicationSelectionList.tsx b/src/Pages/App/CreateAppModal/CloneApplicationSelectionList.tsx index b8ab09ddd4..37090c51b4 100644 --- a/src/Pages/App/CreateAppModal/CloneApplicationSelectionList.tsx +++ b/src/Pages/App/CreateAppModal/CloneApplicationSelectionList.tsx @@ -1,3 +1,19 @@ +/* + * 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 { BaseAppMetaData, Button, diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetails.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetails.tsx index 64d18daa39..9bf6a4581c 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetails.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetails.tsx @@ -1,3 +1,19 @@ +/* + * 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 { useEffect, useMemo, useState } from 'react' import { Route, Switch, useRouteMatch } from 'react-router-dom' diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetailsAbout.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetailsAbout.tsx index 883186750b..bf4805cf45 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetailsAbout.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetailsAbout.tsx @@ -1,3 +1,19 @@ +/* + * 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 { useMemo } from 'react' import { useRouteMatch } from 'react-router-dom' import moment from 'moment' diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetailsDeploy.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetailsDeploy.tsx index 1b1b81db84..72763ff68d 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetailsDeploy.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetailsDeploy.tsx @@ -1,3 +1,19 @@ +/* + * 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 { useMemo } from 'react' import { useParams } from 'react-router-dom' diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetailsDeployments.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetailsDeployments.tsx index dfdb0814bf..6b266ee0a6 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetailsDeployments.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetailsDeployments.tsx @@ -1,3 +1,19 @@ +/* + * 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 { useMemo, useState } from 'react' import { useParams } from 'react-router-dom' diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetailsPresetValues.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetailsPresetValues.tsx index 646cc83d56..93ac604345 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetailsPresetValues.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetailsPresetValues.tsx @@ -1,3 +1,19 @@ +/* + * 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 { useMemo, useState } from 'react' import { generatePath, useRouteMatch } from 'react-router-dom' diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetailsReadme.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetailsReadme.tsx index a90a92a8b5..df4526cf5f 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetailsReadme.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetailsReadme.tsx @@ -1,3 +1,19 @@ +/* + * 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 { APIResponseHandler, Button, diff --git a/src/Pages/ChartStore/ChartDetails/ChartDetailsTableComponents.tsx b/src/Pages/ChartStore/ChartDetails/ChartDetailsTableComponents.tsx index ee77329db6..42cc48812c 100644 --- a/src/Pages/ChartStore/ChartDetails/ChartDetailsTableComponents.tsx +++ b/src/Pages/ChartStore/ChartDetails/ChartDetailsTableComponents.tsx @@ -1,3 +1,19 @@ +/* + * 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 { generatePath, Link, useRouteMatch } from 'react-router-dom' import moment from 'moment' diff --git a/src/Pages/ChartStore/ChartDetails/chartDetails.scss b/src/Pages/ChartStore/ChartDetails/chartDetails.scss index 6b3b036ae6..068e52d76e 100644 --- a/src/Pages/ChartStore/ChartDetails/chartDetails.scss +++ b/src/Pages/ChartStore/ChartDetails/chartDetails.scss @@ -1,3 +1,19 @@ +/* + * 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. + */ + .chart-details { display: grid; grid-template-columns: minmax(auto, 1000px) 300px; diff --git a/src/Pages/ChartStore/ChartDetails/constants.ts b/src/Pages/ChartStore/ChartDetails/constants.ts index aabc335aa8..8f2815490d 100644 --- a/src/Pages/ChartStore/ChartDetails/constants.ts +++ b/src/Pages/ChartStore/ChartDetails/constants.ts @@ -1,3 +1,19 @@ +/* + * 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 { SegmentedControlProps } from '@devtron-labs/devtron-fe-common-lib' import { ChartDetailsSegment } from './types' diff --git a/src/Pages/ChartStore/ChartDetails/index.ts b/src/Pages/ChartStore/ChartDetails/index.ts index ae298f0e4e..a1ffb468d5 100644 --- a/src/Pages/ChartStore/ChartDetails/index.ts +++ b/src/Pages/ChartStore/ChartDetails/index.ts @@ -1 +1,17 @@ +/* + * 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. + */ + export * from './ChartDetails' diff --git a/src/Pages/ChartStore/ChartDetails/services.ts b/src/Pages/ChartStore/ChartDetails/services.ts index 9ad5e735e5..89a9905093 100644 --- a/src/Pages/ChartStore/ChartDetails/services.ts +++ b/src/Pages/ChartStore/ChartDetails/services.ts @@ -1,3 +1,19 @@ +/* + * 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 { get, showError, diff --git a/src/Pages/ChartStore/ChartDetails/types.ts b/src/Pages/ChartStore/ChartDetails/types.ts index 0ad04e1907..bbb5467c33 100644 --- a/src/Pages/ChartStore/ChartDetails/types.ts +++ b/src/Pages/ChartStore/ChartDetails/types.ts @@ -1,3 +1,19 @@ +/* + * 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 { FiltersTypeEnum, SelectPickerOptionType, diff --git a/src/Pages/ChartStore/ChartDetails/utils.tsx b/src/Pages/ChartStore/ChartDetails/utils.tsx index a15a3498e2..0ebeccd8d8 100644 --- a/src/Pages/ChartStore/ChartDetails/utils.tsx +++ b/src/Pages/ChartStore/ChartDetails/utils.tsx @@ -1,3 +1,19 @@ +/* + * 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 { SelectPickerProps } from '@devtron-labs/devtron-fe-common-lib' import { ChartDetailsSearchParams, ChartDetailsSegment, ChartSelectorOptionType } from './types' diff --git a/src/Pages/ChartStore/index.ts b/src/Pages/ChartStore/index.ts index ae298f0e4e..a1ffb468d5 100644 --- a/src/Pages/ChartStore/index.ts +++ b/src/Pages/ChartStore/index.ts @@ -1 +1,17 @@ +/* + * 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. + */ + export * from './ChartDetails' diff --git a/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.components.tsx b/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.components.tsx index 350e69d2d1..c186c628d9 100644 --- a/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.components.tsx +++ b/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.components.tsx @@ -1,4 +1,20 @@ -import { FunctionComponent } from 'react' +/* + * 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 { FunctionComponent, useEffect, useRef } from 'react' import { generatePath, Link, useHistory, useLocation, useParams } from 'react-router-dom' import { @@ -18,6 +34,7 @@ import { noop, stopPropagation, TableCellComponentProps, + TableSignalEnum, Tooltip, URLS as COMMON_URLS, } from '@devtron-labs/devtron-fe-common-lib' @@ -26,6 +43,7 @@ import { importComponentFromFELibrary } from '@Components/common' import { URLS } from '@Config/routes' import { + Cluster, ClusterEnvTabs, ClusterListFields, ClusterRowData, @@ -199,7 +217,26 @@ export const ClusterListCellComponent: FunctionComponent< data: { clusterId, clusterName, clusterType, envCount, serverUrl, clusterCategory, isVirtualCluster, status }, }, isRowActive, + signals, }: TableCellComponentProps) => { + const linkRef = useRef(null) + + useEffect(() => { + const handleEnter = ({ detail: { activeRowData } }) => { + if (activeRowData.data.clusterId === clusterId) { + linkRef.current?.click() + } + } + + if (isRowActive) { + signals.addEventListener(TableSignalEnum.ENTER_PRESSED, handleEnter) + } + + return () => { + signals.removeEventListener(TableSignalEnum.ENTER_PRESSED, handleEnter) + } + }, [isRowActive]) + switch (field) { case ClusterListFields.ICON: return ( @@ -210,6 +247,7 @@ export const ClusterListCellComponent: FunctionComponent< case ClusterListFields.CLUSTER_NAME: return ( void - handleClose + handleClose: () => void }) => { const { clusterId } = useParams<{ clusterId?: string }>() @@ -271,6 +309,29 @@ export const AddEnvironment = ({ ) } +export const AddEnvironmentFromClusterName = ({ + reloadEnvironments, + handleClose, + clusterList, +}: { + clusterList: Cluster[] + reloadEnvironments: () => void + handleClose: () => void +}) => { + const { clusterName } = useParams<{ clusterName?: string }>() + + const clusterId = clusterList.find((c) => c.clusterName === clusterName)?.clusterId + + return ( + + ) +} + export const EditCluster = ({ clusterList, reloadClusterList, handleClose }: EditDeleteClusterProps) => { const { clusterId } = useParams<{ clusterId: string }>() const cluster = clusterList.find((c) => c.clusterId === +clusterId) diff --git a/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx b/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx index 536f75ac9a..1542ecad0d 100644 --- a/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx +++ b/src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterList.tsx @@ -69,6 +69,7 @@ import { import { parseClusterEnvSearchParams } from './cluster.util' import { AddEnvironment, + AddEnvironmentFromClusterName, ClusterEnvLoader, ClusterListCellComponent, DeleteCluster, @@ -103,6 +104,10 @@ const ClusterList = () => { initialSortKey: EnvListSortableKeys.ENV_NAME, }) + const clearSearch = () => { + handleSearch('') + } + const [clusterListLoading, clusterListResult, clusterListError, reloadClusterList] = useAsync( getClusterList, [], @@ -262,7 +267,7 @@ const ClusterList = () => { const handleChangeTab = (selectedSegment: OptionType) => { updateSearchParams({ selectedTab: selectedSegment.value, clusterId: null }) if (searchKey) { - handleSearch('') + clearSearch() } if (showUnmappedEnvs) { setShowUnmappedEnvs(false) @@ -287,6 +292,13 @@ const ClusterList = () => { } if (isEnvironmentsView) { + const allEnvsList = Object.values(clusterIdVsEnvMap).flat() + + // In case no cluster is selected on env list page and no env is found, show global empty state + if (!filterClusterId && allEnvsList.filter((env) => env.environmentName.includes(searchKey)).length === 0) { + return + } + return ( { } if (searchKey && !filteredClusterList.length) { - return handleSearch('')} /> + return } return ( <> - - id="table__cluster-list" - columns={tableColumns} - rows={tableRows} - filtersVariant={FiltersTypeEnum.STATE} - paginationVariant={PaginationEnum.NOT_PAGINATED} - emptyStateConfig={null} - filter={() => true} - additionalFilterProps={{ - initialSortKey: 'clusterName', - }} - /> +
+ + id="table__cluster-list" + columns={tableColumns} + rows={tableRows} + filtersVariant={FiltersTypeEnum.STATE} + paginationVariant={PaginationEnum.NOT_PAGINATED} + emptyStateConfig={null} + filter={() => true} + additionalFilterProps={{ + initialSortKey: 'clusterName', + }} + /> +
) } @@ -377,6 +391,7 @@ const ClusterList = () => { }} handleEnter={handleSearch} size={ComponentSizeType.medium} + keyboardShortcut="/" /> {ManageCategoryButton && } + ) + + const renderExcludedCommitsOption = () => ( + + ), + variant: ButtonVariantType.borderLess, + style: ButtonStyleType.neutral, + }} + /> + ) + + const uploadFile = ({ + file, + allowedExtensions, + maxUploadSize, + }: Pick[0], 'file' | 'allowedExtensions' | 'maxUploadSize'>) => + uploadCIPipelineFile({ + file, + allowedExtensions, + maxUploadSize, + appId: +appId, + ciPipelineId: +nodeId, + envId: isJobView && selectedEnv ? +selectedEnv.id : null, + }) + + const renderHeader = () => { + if (isWebhookCI) { + return ( +
+ + +
+ Showing results matching + + . +
+
+ ) + } + + const excludeIncludeEnv = !window._env_.HIDE_EXCLUDE_INCLUDE_GIT_COMMITS + return ( +
+
+ + + + + {selectedMaterial.value} + + + + + {selectedMaterial.regex && ( +
+ + {!selectedMaterial.isRepoError && !selectedMaterial.isBranchError && ( +
+ + + {excludeIncludeEnv && renderExcludedCommitsOption()} +
+ )} +
+ ) + } + + const getRuntimeParametersHeading = () => { + const headingPrefix = 'Runtime parameters' + const headingSuffix = selectedApp ? `for '${selectedApp.name}'` : '' + return `${headingPrefix} ${headingSuffix}` + } + + const selectCommit = (commitId: string) => { + setMaterialList((prevMaterialList) => + prevMaterialList.map((material) => { + if (material.id === selectedMaterial.id) { + const updatedHistory = material.history.map((commitHistory) => { + if (commitHistory.excluded) { + return { + ...commitHistory, + isSelected: false, + } + } + + if (isWebhookCI) { + return { + ...commitHistory, + isSelected: + !!commitHistory?.webhookData?.id && + String(commitHistory.webhookData.id) === String(commitId), + } + } + + return { + ...commitHistory, + isSelected: commitHistory.commit === commitId, + } + }) + + return { + ...material, + history: updatedHistory, + } + } + + return material + }), + ) + } + + const renderMissingPluginBlockState = () => ( + + ) + + const renderMaterialHistory = () => { + if (MissingPluginBlockState && isCITriggerBlocked && isBulkTrigger) { + return renderMissingPluginBlockState() + } + + if (isBulkTrigger) { + if (selectedApp.node.type === WorkflowNodeType.WEBHOOK) { + return ( + + ) + } + + if (selectedApp.node.isLinkedCI) { + return ( + + ) + } + + if (selectedApp.node.isLinkedCD) { + return ( + + ) + } + + if (selectedApp.materialInitialError || selectedApp.runtimeParamsInitialError) { + return ( + + ) + } + } + + const areCommitsPresent = selectedMaterial.history?.length > 0 + const materialError = + selectedMaterial.isMaterialLoading || + selectedMaterial.isRepoError || + selectedMaterial.isBranchError || + selectedMaterial.noSearchResult + + const showHeader = + currentSidebarTab === CIMaterialSidebarType.CODE_SOURCE && + !(node.type === WorkflowNodeType.WEBHOOK || node.isLinkedCI || node.isLinkedCD) + + if (materialError || !areCommitsPresent) { + return ( +
+ {showHeader && renderHeader()} + +
+ ) + } + + if (RuntimeParameters && currentSidebarTab === CIMaterialSidebarType.PARAMETERS) { + return ( +
+ +
+ ) + } + + return ( +
+ {showHeader && renderHeader()} +
+ +
+
+ ) + } + + const renderBody = () => { + if (showWebhookModal) { + return ( + + ) + } + + return ( +
+ + + {renderMaterialHistory()} +
+ ) + } + + return ( + <> + {MissingPluginBlockState && isCITriggerBlocked && !isBulkTrigger + ? renderMissingPluginBlockState() + : renderBody()} + + {showRegexBranchChangeModal && ( + + )} + + ) +} + +export default GitInfoMaterial diff --git a/src/components/app/details/triggerView/BuildImageModal/TriggerBuildSidebar.tsx b/src/components/app/details/triggerView/BuildImageModal/TriggerBuildSidebar.tsx new file mode 100644 index 0000000000..3a8962ad96 --- /dev/null +++ b/src/components/app/details/triggerView/BuildImageModal/TriggerBuildSidebar.tsx @@ -0,0 +1,231 @@ +import { + Checkbox, + CHECKBOX_VALUE, + CIMaterialSidebarType, + ConsequenceAction, + Icon, + Tooltip, + WorkflowNodeType, +} from '@devtron-labs/devtron-fe-common-lib' + +import { BulkCIDetailType } from '@Components/ApplicationGroup/AppGroup.types' +import { BULK_CI_MESSAGING } from '@Components/ApplicationGroup/Constants' +import { getCIPipelineURL, importComponentFromFELibrary } from '@Components/common' +import { BUILD_STATUS } from '@Config/constants' + +import MaterialSource from '../MaterialSource' +import { TriggerBuildSidebarProps } from './types' +import { getCanNodeHaveMaterial } from './utils' + +const RuntimeParamTabs = importComponentFromFELibrary('RuntimeParamTabs', null, 'function') +const PolicyEnforcementMessage = importComponentFromFELibrary('PolicyEnforcementMessage') + +const SIDEBAR_TABS = Object.values(CIMaterialSidebarType).map((tabValue) => ({ + value: tabValue, + label: tabValue, +})) + +const tippyContent = (tippyTile: string, tippyDescription: string): JSX.Element => ( +
+
{tippyTile}
+
{tippyDescription}
+
+) + +const renderTippy = (infoText: string, tippyTile: string, tippyDescription: string): JSX.Element | null => ( + +
+ + {infoText} +
+
+) + +const TriggerBuildSidebar = ({ + currentSidebarTab, + handleSidebarTabChange, + runtimeParamsErrorState, + materialList, + selectMaterial, + clearSearch, + refreshMaterial, + appId, + appList, + handleAppChange, + isBlobStorageConfigured, + toggleSelectedAppIgnoreCache, +}: TriggerBuildSidebarProps) => { + const getHandleAppChange = (newAppId: number) => (e: React.MouseEvent | React.KeyboardEvent) => { + if ('key' in e && e.key !== 'Enter' && e.key !== ' ') { + return + } + + if (handleAppChange) { + handleAppChange(newAppId) + } + } + + const getErrorMessageFromAppDetails = (appDetails: (typeof appList)[number]): string | null => { + const materialListError = appDetails.materialInitialError + ? appDetails.materialInitialError.errors?.[0].userMessage || 'Error fetching material list' + : null + + const runtimeParamsInitialError = appDetails.runtimeParamsInitialError + ? appDetails.runtimeParamsInitialError.errors?.[0].userMessage || 'Error fetching runtime parameters' + : null + + const runtimeParamsDataError = !appDetails.runtimeParamsErrorState?.isValid + ? 'Invalid runtime parameters' + : null + + return appDetails.errorMessage || materialListError || runtimeParamsInitialError || runtimeParamsDataError + } + + const renderAppName = (appDetails: (typeof appList)[number]): JSX.Element | null => ( +
+ {appDetails.name} + {appDetails.warningMessage && ( + + + {appDetails.warningMessage} + + )} + {appDetails.appId !== appId && !!getErrorMessageFromAppDetails(appDetails) && ( + + + + {getErrorMessageFromAppDetails(appDetails)} + + + )} + {appDetails.node?.pluginBlockState && + appDetails.node.pluginBlockState.action !== ConsequenceAction.ALLOW_FOREVER && + PolicyEnforcementMessage && ( + + )} +
+ ) + + const renderMaterialSource = () => ( + + ) + + const renderCacheSection = (currentAppDetails: BulkCIDetailType): JSX.Element | null => { + if (getCanNodeHaveMaterial(currentAppDetails.node)) { + if (currentAppDetails.node.status?.toLowerCase() === BUILD_STATUS.NOT_TRIGGERED) { + return renderTippy( + BULK_CI_MESSAGING.isFirstTrigger.infoText, + BULK_CI_MESSAGING.isFirstTrigger.title, + BULK_CI_MESSAGING.isFirstTrigger.subTitle, + ) + } + if (!currentAppDetails.node.storageConfigured) { + return renderTippy( + BULK_CI_MESSAGING.cacheNotAvailable.infoText, + BULK_CI_MESSAGING.cacheNotAvailable.title, + BULK_CI_MESSAGING.cacheNotAvailable.subTitle, + ) + } + if (isBlobStorageConfigured) { + return ( +
+ + Ignore cache + +
+ ) + } + } + return null + } + + const renderSelectedAppMaterial = (currentAppDetails: BulkCIDetailType): JSX.Element | null => { + if (appId === currentAppDetails.appId && !!materialList.length) { + return ( + <> + {renderMaterialSource()} + {renderCacheSection(currentAppDetails)} + + ) + } + return null + } + + const renderContent = () => { + if (!appList) { + return renderMaterialSource() + } + + return appList.map((app) => ( +
+ {renderAppName(app)} + {renderSelectedAppMaterial(app)} +
+ )) + } + + return ( +
+ {RuntimeParamTabs ? ( +
+ +
+ ) : ( +
+ {appList ? 'Applications' : 'Git Repository'} +
+ )} + +
{renderContent()}
+
+ ) +} + +export default TriggerBuildSidebar diff --git a/src/components/app/details/triggerView/BuildImageModal/index.ts b/src/components/app/details/triggerView/BuildImageModal/index.ts new file mode 100644 index 0000000000..19489d8158 --- /dev/null +++ b/src/components/app/details/triggerView/BuildImageModal/index.ts @@ -0,0 +1,2 @@ +export { default as BuildImageModal } from './BuildImageModal' +export { default as BulkBuildImageModal } from './BulkBuildImageModal' diff --git a/src/components/app/details/triggerView/BuildImageModal/service.ts b/src/components/app/details/triggerView/BuildImageModal/service.ts new file mode 100644 index 0000000000..b8c68d3d14 --- /dev/null +++ b/src/components/app/details/triggerView/BuildImageModal/service.ts @@ -0,0 +1,105 @@ +import { + API_STATUS_CODES, + ServerErrors, + showError, + TOAST_ACCESS_DENIED, + ToastManager, + ToastVariantType, +} from '@devtron-labs/devtron-fe-common-lib' + +import { getCIMaterialList, triggerCINode } from '@Components/app/service' +import { handleSourceNotConfigured } from '@Components/ApplicationGroup/AppGroup.utils' +import { NO_TASKS_CONFIGURED_ERROR } from '@Config/constantMessaging' + +import { GetCIMaterialsProps, TriggerBuildProps } from './types' + +export const triggerBuild = async ({ payload, redirectToCIPipeline, showToast = true }: TriggerBuildProps) => { + try { + await triggerCINode(payload) + + if (showToast) { + ToastManager.showToast({ + variant: ToastVariantType.success, + description: 'Pipeline Triggered', + }) + } + } catch (errors) { + if (!showToast) { + throw errors + } + + if (errors.code === API_STATUS_CODES.PERMISSION_DENIED) { + ToastManager.showToast({ + variant: ToastVariantType.notAuthorized, + description: TOAST_ACCESS_DENIED.SUBTITLE, + }) + } else if ( + errors instanceof ServerErrors && + Array.isArray(errors.errors) && + errors.code === API_STATUS_CODES.CONFLICT + ) { + errors.errors.map((err) => + ToastManager.showToast({ + variant: ToastVariantType.error, + description: err.internalMessage, + }), + ) + } else { + errors.errors = errors.errors.filter((error) => { + const isNoTaskConfiguredError = redirectToCIPipeline && error.userMessage === NO_TASKS_CONFIGURED_ERROR + + if (isNoTaskConfiguredError) { + ToastManager.showToast({ + variant: ToastVariantType.error, + title: 'Nothing to execute', + description: error.userMessage, + buttonProps: { + text: 'Edit Pipeline', + dataTestId: 'edit-pipeline-btn', + onClick: redirectToCIPipeline, + }, + }) + } + + return !isNoTaskConfiguredError + }) + + if (errors.errors.length) { + showError(errors) + } + } + throw errors + } +} + +export const getCIMaterials = async ({ + ciNodeId, + abortControllerRef, + isCINodePresent, + selectedWorkflow, +}: GetCIMaterialsProps) => { + const { result: materialListResponse } = await getCIMaterialList( + { + pipelineId: ciNodeId, + }, + abortControllerRef, + ) + + const configuredMaterialList = new Map>() + if (isCINodePresent) { + const gitMaterials = new Map() + materialListResponse?.forEach((material) => { + gitMaterials[material.gitMaterialId] = [material.gitMaterialName.toLowerCase(), material.value] + }) + + configuredMaterialList[selectedWorkflow.name] = new Set() + + handleSourceNotConfigured( + configuredMaterialList, + selectedWorkflow, + materialListResponse || [], + !gitMaterials[selectedWorkflow.ciConfiguredGitMaterialId], + ) + } + return materialListResponse +} diff --git a/src/components/app/details/triggerView/BuildImageModal/types.ts b/src/components/app/details/triggerView/BuildImageModal/types.ts new file mode 100644 index 0000000000..2f283f804b --- /dev/null +++ b/src/components/app/details/triggerView/BuildImageModal/types.ts @@ -0,0 +1,149 @@ +import { ChangeEvent } from 'react' + +import { + APIOptions, + ApiQueuingWithBatchResponseItem, + CIMaterialSidebarType, + CIMaterialType, + CommonNodeAttr, + RuntimeParamsTriggerPayloadType, + RuntimePluginVariables, + WorkflowType, +} from '@devtron-labs/devtron-fe-common-lib' + +import { BulkCIDetailType } from '@Components/ApplicationGroup/AppGroup.types' +import { CIPipelineBuildType } from '@Components/ciPipeline/types' +import { EnvironmentWithSelectPickerType } from '@Components/CIPipelineN/types' + +import { + BuildImageModalProps, + CIPipelineMaterialDTO, + FilteredCIPipelineMapType, + HandleRuntimeParamChange, + MaterialSourceProps, + RuntimeParamsErrorState, + TriggerViewState, +} from '../types' + +export interface TriggerBuildSidebarProps { + currentSidebarTab: CIMaterialSidebarType + handleSidebarTabChange: (e: ChangeEvent) => void + runtimeParamsErrorState: RuntimeParamsErrorState + materialList: CIMaterialType[] + clearSearch: () => void + selectMaterial: (materialId: string) => void + refreshMaterial: MaterialSourceProps['refreshMaterial'] + // For Bulk Trigger + appId?: number + appList?: BulkCIDetailType[] + handleAppChange?: (appId: number) => void + isBlobStorageConfigured?: boolean + toggleSelectedAppIgnoreCache?: () => void +} + +type SetMaterialCBType = (prevMaterialList: CIMaterialType[]) => CIMaterialType[] + +export type GitInfoMaterialProps = Pick & { + workflowId: string + node: CommonNodeAttr + setMaterialList: (cb: SetMaterialCBType) => void + runtimeParamsErrorState: RuntimeParamsErrorState + materialList: CIMaterialType[] + showWebhookModal: boolean + reloadCompleteMaterialList: () => void + handleRuntimeParamChange: HandleRuntimeParamChange + handleRuntimeParamError: (errorState: RuntimeParamsErrorState) => void + runtimeParams: RuntimePluginVariables[] + handleDisplayWebhookModal: () => void + selectedCIPipeline: TriggerViewState['filteredCIPipelines'][number] + handleReloadWithWorkflows: () => Promise + appId: number + /** + * Only required for isJobView + */ + selectedEnv?: EnvironmentWithSelectPickerType +} & ( + | { + isBulkTrigger: true + appList: BulkCIDetailType[] + handleAppChange: (appId: number) => void + isBlobStorageConfigured: boolean + toggleSelectedAppIgnoreCache: () => void + } + | { + isBulkTrigger?: false + appList?: never + handleAppChange?: never + isBlobStorageConfigured?: never + toggleSelectedAppIgnoreCache?: never + } + ) + +export interface BulkBuildImageModalProps + extends Pick { + filteredCIPipelineMap: FilteredCIPipelineMapType +} + +export interface BuildImageHeaderProps { + showWebhookModal: boolean + handleWebhookModalBack: () => void + pipelineName: string + handleClose: () => void + /** + * @default false + */ + isJobView?: boolean + /** + * @default false + */ + isBulkTrigger?: boolean +} + +export interface GetTriggerBuildPayloadProps { + ciConfiguredGitMaterialId: number + materialList: CIMaterialType[] + runtimeParams: RuntimePluginVariables[] + selectedEnv: EnvironmentWithSelectPickerType + isJobCI: boolean + invalidateCache: boolean + ciNodeId: number +} + +export interface TriggerBuildPayloadType { + pipelineId: number + ciPipelineMaterials: CIPipelineMaterialDTO[] + invalidateCache: boolean + pipelineType: CIPipelineBuildType.CI_JOB | CIPipelineBuildType.CI_BUILD + environmentId?: number + runtimeParamsPayload?: RuntimeParamsTriggerPayloadType +} + +export interface TriggerBuildProps { + payload: TriggerBuildPayloadType + /** + * Only need in case of job + */ + redirectToCIPipeline?: () => void + /** + * @default true + */ + showToast?: boolean +} + +export interface GetCIMaterialsProps extends Pick { + ciNodeId: string + selectedWorkflow: WorkflowType + isCINodePresent: boolean +} + +export interface GetBulkCIDataPromiseGetterListProps { + ciMaterialPromiseList: (() => Promise)[] + runtimeParamsPromiseList: (() => Promise)[] +} + +export interface ParseBulkCIResponseIntoBulkCIDetailProps { + validWorkflows: WorkflowType[] + ciMaterialList: ApiQueuingWithBatchResponseItem[] + runtimeParamsList: ApiQueuingWithBatchResponseItem[] + filteredCIPipelineMap: FilteredCIPipelineMapType +} diff --git a/src/components/app/details/triggerView/BuildImageModal/utils.ts b/src/components/app/details/triggerView/BuildImageModal/utils.ts new file mode 100644 index 0000000000..7d73b9ec82 --- /dev/null +++ b/src/components/app/details/triggerView/BuildImageModal/utils.ts @@ -0,0 +1,318 @@ +import { + APIOptions, + CIMaterialType, + CommonNodeAttr, + PromiseAllStatusType, + SourceTypeMap, + WorkflowNodeType, + WorkflowType, +} from '@devtron-labs/devtron-fe-common-lib' + +import { BulkCIDetailType, ResponseRowType } from '@Components/ApplicationGroup/AppGroup.types' +import { + BulkResponseStatus, + SKIPPED_RESOURCES_MESSAGE, + SKIPPED_RESOURCES_STATUS_TEXT, +} from '@Components/ApplicationGroup/Constants' +import { CIPipelineBuildType } from '@Components/ciPipeline/types' +import { importComponentFromFELibrary } from '@Components/common' +import { CI_CONFIGURED_GIT_MATERIAL_ERROR } from '@Config/constantMessaging' +import { DEFAULT_GIT_BRANCH_VALUE } from '@Config/constants' + +import { CI_MATERIAL_EMPTY_STATE_MESSAGING } from '../Constants' +import { BuildImageModalProps, CIPipelineMaterialDTO } from '../types' +import { getCIMaterials, triggerBuild } from './service' +import { + GetBulkCIDataPromiseGetterListProps, + GetTriggerBuildPayloadProps, + ParseBulkCIResponseIntoBulkCIDetailProps, + TriggerBuildPayloadType, +} from './types' + +const getRuntimeParamsPayload = importComponentFromFELibrary('getRuntimeParamsPayload', null, 'function') +const getRuntimeParams = importComponentFromFELibrary('getRuntimeParams', null, 'function') + +export const getIsRegexBranchNotAvailable = ( + selectedCIPipeline: BuildImageModalProps['filteredCIPipelines'][number], + materialList: CIMaterialType[], +) => + !!selectedCIPipeline?.ciMaterial?.some( + (material) => + material.isRegex && + materialList.some((_mat) => _mat.gitMaterialId === material.gitMaterialId && !_mat.value), + ) + +export const getTriggerBuildPayload = ({ + materialList, + ciConfiguredGitMaterialId, + runtimeParams, + selectedEnv, + invalidateCache, + isJobCI, + ciNodeId, +}: GetTriggerBuildPayloadProps): TriggerBuildPayloadType | string => { + const gitMaterials = new Map() + const ciPipelineMaterials: CIPipelineMaterialDTO[] = [] + + materialList.forEach((material) => { + gitMaterials[material.gitMaterialId] = [material.gitMaterialName.toLowerCase(), material.value] + + if (material.value === DEFAULT_GIT_BRANCH_VALUE) { + return + } + + const history = material.history.filter((historyItem) => historyItem.isSelected) + if (!history.length) { + history.push(material.history[0]) + } + + history.forEach((element) => { + const historyItem: CIPipelineMaterialDTO = { + Id: material.id, + GitCommit: { + Commit: element.commit, + }, + } + if (!element.commit) { + historyItem.GitCommit.WebhookData = { + id: element.webhookData.id, + } + } + ciPipelineMaterials.push(historyItem) + }) + }) + + if (gitMaterials[ciConfiguredGitMaterialId][1] === DEFAULT_GIT_BRANCH_VALUE) { + const description = CI_CONFIGURED_GIT_MATERIAL_ERROR.replace( + '$GIT_MATERIAL_ID', + `"${gitMaterials[ciConfiguredGitMaterialId][0]}"`, + ) + return description + } + + const envId = selectedEnv && selectedEnv.id !== 0 ? selectedEnv.id : undefined + const runtimeParamsPayload = getRuntimeParamsPayload?.(runtimeParams ?? []) + + return { + pipelineId: +ciNodeId, + ciPipelineMaterials, + invalidateCache, + environmentId: envId, + pipelineType: isJobCI ? CIPipelineBuildType.CI_JOB : CIPipelineBuildType.CI_BUILD, + ...(getRuntimeParamsPayload ? runtimeParamsPayload : {}), + } +} + +export const getCanNodeHaveMaterial = (node: CommonNodeAttr): boolean => + !!node && node.type !== WorkflowNodeType.WEBHOOK && !node.isLinkedCD && !node.isLinkedCI + +const getBulkCIWarningMessage = (ciNode: CommonNodeAttr): string => { + if (ciNode.isLinkedCD) { + return 'Uses another environment as image source' + } + + if (ciNode.isLinkedCI) { + return 'Has linked build pipeline' + } + + if (ciNode.type === WorkflowNodeType.WEBHOOK) { + return 'Has webhook build pipeline' + } + + return '' +} + +export const getBulkCIErrorMessage = ( + _appId: number, + _ciNode: CommonNodeAttr, + filteredCIPipelines: BulkCIDetailType['filteredCIPipelines'], + materialList: CIMaterialType[], +): string => { + const selectedCIPipeline = filteredCIPipelines?.find((_ci) => _ci.id === +_ciNode.id) + + if (materialList?.length > 0) { + if (getIsRegexBranchNotAvailable(selectedCIPipeline, materialList)) { + return 'Primary branch is not set' + } + + if (selectedCIPipeline?.ciMaterial) { + const invalidInputMaterial = materialList.find( + (_mat) => + _mat.isBranchError || + _mat.isRepoError || + _mat.isDockerFileError || + _mat.isMaterialSelectionError || + (_mat.type === SourceTypeMap.WEBHOOK && _mat.history.length === 0), + ) + + if (invalidInputMaterial) { + if (invalidInputMaterial.isRepoError) { + return invalidInputMaterial.repoErrorMsg + } + if (invalidInputMaterial.isDockerFileError) { + return invalidInputMaterial.dockerFileErrorMsg + } + if (invalidInputMaterial.isBranchError) { + return invalidInputMaterial.branchErrorMsg + } + if (invalidInputMaterial.isMaterialSelectionError) { + return invalidInputMaterial.materialSelectionErrorMsg + } + return CI_MATERIAL_EMPTY_STATE_MESSAGING.NoMaterialFound + } + } + } + return '' +} + +export const getBulkCIDataPromiseGetterList = ( + validWorkflows: WorkflowType[], + initialDataAbortControllerRef: APIOptions['abortControllerRef'], +): GetBulkCIDataPromiseGetterListProps => + validWorkflows.reduce( + (acc, workflow) => { + const currentNode = workflow.nodes.find( + (node) => node.type === WorkflowNodeType.CI || node.type === WorkflowNodeType.WEBHOOK, + ) + + if (currentNode.isTriggerBlocked || !getCanNodeHaveMaterial(currentNode)) { + acc.ciMaterialPromiseList.push(() => []) + acc.runtimeParamsPromiseList.push(() => []) + + return acc + } + + acc.ciMaterialPromiseList.push(() => + getCIMaterials({ + ciNodeId: currentNode.id, + abortControllerRef: initialDataAbortControllerRef, + isCINodePresent: !!currentNode, + selectedWorkflow: workflow, + }), + ) + + if (getRuntimeParams) { + acc.runtimeParamsPromiseList.push(() => getRuntimeParams(currentNode.id)) + } else { + acc.runtimeParamsPromiseList.push(() => []) + } + + return acc + }, + { ciMaterialPromiseList: [], runtimeParamsPromiseList: [] }, + ) + +export const parseBulkCIResponseIntoBulkCIDetail = ({ + validWorkflows, + ciMaterialList, + runtimeParamsList, + filteredCIPipelineMap, +}: ParseBulkCIResponseIntoBulkCIDetailProps): Record => + validWorkflows.reduce>((acc, workflow, index) => { + const node = workflow.nodes.find( + (currentNode) => currentNode.type === WorkflowNodeType.CI || currentNode.type === WorkflowNodeType.WEBHOOK, + ) + + if (!node) { + return acc + } + + const currentMaterial = + (ciMaterialList[index].status === PromiseAllStatusType.FULFILLED ? ciMaterialList[index].value : []) || [] + const runtimeParams = + runtimeParamsList[index].status === PromiseAllStatusType.FULFILLED ? runtimeParamsList[index].value : [] + + const filteredCIPipelines = filteredCIPipelineMap.get(workflow.appId) || [] + + acc[workflow.appId] = { + workflowId: workflow.id, + appId: workflow.appId, + name: workflow.name, + node, + material: currentMaterial, + materialInitialError: + ciMaterialList[index].status === PromiseAllStatusType.REJECTED ? ciMaterialList[index].reason : null, + runtimeParams: runtimeParams || [], + runtimeParamsInitialError: + runtimeParamsList[index].status === PromiseAllStatusType.REJECTED + ? runtimeParamsList[index].reason + : null, + runtimeParamsErrorState: { + isValid: runtimeParamsList[index].status !== PromiseAllStatusType.REJECTED, + cellError: {}, + }, + warningMessage: getBulkCIWarningMessage(node), + errorMessage: getBulkCIErrorMessage(workflow.appId, node, filteredCIPipelines, currentMaterial), + filteredCIPipelines, + ignoreCache: false, + ciConfiguredGitMaterialId: workflow.ciConfiguredGitMaterialId, + } + + return acc + }, {}) + +const getPayloadFromAppDetails = (appDetails: BulkCIDetailType) => + getTriggerBuildPayload({ + materialList: appDetails.material, + ciConfiguredGitMaterialId: appDetails.ciConfiguredGitMaterialId, + runtimeParams: appDetails.runtimeParams, + invalidateCache: appDetails.ignoreCache, + isJobCI: appDetails.node?.isJobCI, + ciNodeId: +(appDetails.node?.id || 0), + selectedEnv: null, + }) + +export const getTriggerCIPromiseListAndSkippedResources = ( + appList: BulkCIDetailType[], + appsToRetry: Record, +) => { + const skippedResourceList: ResponseRowType[] = [] + const appsToTrigger = appList.filter((appDetails) => { + if (appsToRetry && !appsToRetry[appDetails.appId]) { + return false + } + + if (!getCanNodeHaveMaterial(appDetails.node)) { + skippedResourceList.push({ + appId: appDetails.appId, + appName: appDetails.name, + statusText: SKIPPED_RESOURCES_STATUS_TEXT, + status: BulkResponseStatus.SKIP, + message: SKIPPED_RESOURCES_MESSAGE, + }) + + return false + } + + const payload = getPayloadFromAppDetails(appDetails) + + if (typeof payload === 'string') { + skippedResourceList.push({ + appId: appDetails.appId, + appName: appDetails.name, + statusText: SKIPPED_RESOURCES_STATUS_TEXT, + status: BulkResponseStatus.SKIP, + message: payload, + }) + + return false + } + + return true + }) + + const promiseList = appsToTrigger.map((appDetails) => { + const payload = getPayloadFromAppDetails(appDetails) as Exclude< + ReturnType, + string + > + + return () => triggerBuild({ payload, showToast: false }) + }) + + return { + promiseList, + skippedResourceList, + appsToTrigger, + } +} diff --git a/src/components/app/details/triggerView/CIMaterialModal.tsx b/src/components/app/details/triggerView/CIMaterialModal.tsx deleted file mode 100644 index e3690582a1..0000000000 --- a/src/components/app/details/triggerView/CIMaterialModal.tsx +++ /dev/null @@ -1,115 +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 { useEffect, useMemo } from 'react' -import { useParams } from 'react-router-dom' - -import { - Button, - ButtonStyleType, - ButtonVariantType, - ComponentSizeType, - Progressing, - stopPropagation, - uploadCIPipelineFile, - usePrompt, - VisibleModal, -} from '@devtron-labs/devtron-fe-common-lib' - -import { ReactComponent as CloseIcon } from '../../../../assets/icons/ic-close.svg' -import CIMaterial from './ciMaterial' -import { CIMaterialModalProps, CIMaterialRouterProps } from './types' - -export const CIMaterialModal = ({ - loader, - closeCIModal, - isLoading, - abortController, - resetAbortController, - ...props -}: CIMaterialModalProps) => { - const { ciNodeId } = useParams>() - const selectedCIPipeline = useMemo( - () => props.filteredCIPipelines?.find((_ciPipeline) => _ciPipeline?.id === props.pipelineId), - [props.filteredCIPipelines, props.pipelineId], - ) - - const uploadFile = ({ file, allowedExtensions, maxUploadSize }) => - uploadCIPipelineFile({ - file, - allowedExtensions, - maxUploadSize, - appId: +props.appId, - ciPipelineId: +props.pipelineId, - envId: props.isJobView && props.selectedEnv ? +props.selectedEnv : null, - }) - - usePrompt({ shouldPrompt: isLoading }) - - useEffect( - () => () => { - abortController.abort() - resetAbortController() - }, - [], - ) - - useEffect(() => { - if (props.isJobView && props.environmentLists?.length > 0 && selectedCIPipeline?.environmentId) { - const envId = selectedCIPipeline?.environmentId - const _selectedEnv = props.environmentLists.find((env) => env.id === envId) - props.setSelectedEnv(_selectedEnv) - } - }, [selectedCIPipeline]) - - const renderBranchCIModal = () => ( - -
- {loader ? ( - <> -
-
- - - ) : ( - - )} -
-
- ) - - return renderBranchCIModal() -} - -export default CIMaterialModal diff --git a/src/components/app/details/triggerView/CiWebhookDebuggingModal.tsx b/src/components/app/details/triggerView/CiWebhookDebuggingModal.tsx index 408ab01173..3e7f405319 100644 --- a/src/components/app/details/triggerView/CiWebhookDebuggingModal.tsx +++ b/src/components/app/details/triggerView/CiWebhookDebuggingModal.tsx @@ -14,116 +14,89 @@ * limitations under the License. */ -import { useCallback, useEffect, useState } from 'react' -import { NavLink, useHistory, useLocation, useRouteMatch } from 'react-router-dom' +import { useState } from 'react' import moment from 'moment' import { Button, + ButtonComponentType, ButtonStyleType, ButtonVariantType, CodeEditor, ComponentSizeType, + ErrorScreenManager, + GenericEmptyState, getFormattedSchema, - getUrlWithSearchParams, Icon, MODES, Progressing, showError, sortCallback, Tooltip, - useSearchString, + useAsync, } from '@devtron-labs/devtron-fe-common-lib' import { ReactComponent as Edit } from '@Icons/ic-pencil.svg' -import { Moment12HourFormat, URLS } from '../../../../config' +import { Moment12HourFormat } from '../../../../config' import { getCIPipelineURL } from '../../../common' -import { getCIWebhookPayload } from './ciWebhook.service' -import { CiWebhookModalProps, CIWebhookPayload, WebhookPayload, WebhookReceivedFiltersType } from './types' +import { getCIWebhookPayload, getCIWebhookRes } from './ciWebhook.service' +import { + CiWebhookModalProps, + CIWebhookPayload, + WebhookPayload, + WebhookPayloadType, + WebhookReceivedFiltersType, +} from './types' -import './triggerView.scss' +import './TriggerWebhook.scss' export const CiWebhookModal = ({ - webhookPayloads, ciPipelineMaterialId, + gitMaterialUrl, ciPipelineId, - isWebhookPayloadLoading, workflowId, - fromAppGrouping, isJobView, appId, + isJobCI, }: CiWebhookModalProps) => { const [isPayloadLoading, setIsPayloadLoading] = useState(false) const [webhookIncomingPayload, setWebhookIncomingPayload] = useState(null) - const [selectedPassedCountRatio, setSelectedPassedCountRatio] = useState('') - const location = useLocation() - const history = useHistory() - const { url } = useRouteMatch() + const [selectedWebhookPayload, setSelectedWebhookPayload] = useState(null) - const getCIWebhookPayloadRes = async (pipelineMaterialId: number, webhookPayload: WebhookPayload) => { + const getCIWebhookPayloadRes = async (webhookPayload: WebhookPayload) => { setIsPayloadLoading(true) - const totalFilters = webhookPayload.matchedFiltersCount + webhookPayload.failedFiltersCount - setSelectedPassedCountRatio(`${webhookPayload.matchedFiltersCount}/${totalFilters}`) + setSelectedWebhookPayload(webhookPayload) + try { - const response = await getCIWebhookPayload(pipelineMaterialId, webhookPayload.parsedDataId) - setWebhookIncomingPayload(response.result) + const { result } = await getCIWebhookPayload(ciPipelineMaterialId, webhookPayload.parsedDataId) + setWebhookIncomingPayload(result) } catch (err) { showError(err) } finally { setIsPayloadLoading(false) } } - - const { queryParams, searchParams } = useSearchString() - - useEffect(() => { - if (webhookPayloads?.payloads && webhookPayloads.payloads[0]?.parsedDataId) { - // to redirect to the first payload if the payload id is not present in the URL - const flatMap = webhookPayloads.payloads.flatMap((payload) => `${payload.parsedDataId}`) - const payloadIdInSearchParam = searchParams[URLS.WEBHOOK_RECEIVED_PAYLOAD_ID] - queryParams.set( - URLS.WEBHOOK_RECEIVED_PAYLOAD_ID, - payloadIdInSearchParam && flatMap.includes(payloadIdInSearchParam) - ? searchParams[URLS.WEBHOOK_RECEIVED_PAYLOAD_ID] - : webhookPayloads.payloads[0].parsedDataId.toString(), - ) - history.replace({ search: queryParams.toString() }) + const getCIWebhookDetails = async () => { + const { result } = await getCIWebhookRes(ciPipelineMaterialId) + if (result?.payloads?.length) { + await getCIWebhookPayloadRes(result.payloads[0]) } - }, [webhookPayloads]) + return result + } - useEffect(() => { - if (ciPipelineMaterialId && webhookPayloads?.payloads?.[0]) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - getCIWebhookPayloadRes(ciPipelineMaterialId, webhookPayloads?.payloads[0]) - } - }, [ciPipelineMaterialId, webhookPayloads]) + const [isWebhookPayloadLoading, webhookPayloads, webhookPayloadsError, reloadWebhookPayloads] = + useAsync(getCIWebhookDetails, [ciPipelineMaterialId], !!ciPipelineMaterialId) const renderSelectedPassedCountRatio = (matchedFiltersCount: number, failedFiltersCount: number): string => { const totalFilters = matchedFiltersCount + failedFiltersCount return `${matchedFiltersCount}/${totalFilters}` } - const renderPassedText = useCallback( - (passedCount: string) =>
Passed {passedCount} filters
, - [], + const renderPassedText = (passedCount: string) => ( +
Passed {passedCount} filters
) - const onEditShowEditableCiModal = (_ciPipelineId: number, _workflowId: string) => { - if (fromAppGrouping) { - window.open( - window.location.href.replace( - location.pathname, - getCIPipelineURL(appId, _workflowId, true, _ciPipelineId, isJobView, false, false), - ), - '_blank', - 'noreferrer', - ) - } else { - history.push(`/app/${appId}/edit/workflow/${_workflowId}/ci-pipeline/${_ciPipelineId}`) - } - } - const renderWebhookPayloadLoader = () => (
{/* NOTE: Wrapped Loader in a div to prevent the 'loader' class from enforcing full height */} @@ -137,6 +110,10 @@ export const CiWebhookModal = ({
) + const getOnWebhookPayloadClick = (webhookPayload: WebhookPayload) => async () => { + await getCIWebhookPayloadRes(webhookPayload) + } + const renderSidebar = () => (
Received webhooks @@ -144,58 +121,57 @@ export const CiWebhookModal = ({ {webhookPayloads?.payloads?.map((webhookPayload: WebhookPayload) => { const isPassed = webhookPayload.matchedFiltersCount > 0 && webhookPayload.failedFiltersCount === 0 const webhookPayloadId = webhookPayload.parsedDataId - const isActive = searchParams[URLS.WEBHOOK_RECEIVED_PAYLOAD_ID] === String(webhookPayloadId) + const isActive = selectedWebhookPayload?.parsedDataId === webhookPayloadId + return ( -
- getCIWebhookPayloadRes(ciPipelineMaterialId, webhookPayload)} - > -
- -
- - {moment(webhookPayload.eventTime).format(Moment12HourFormat)} - -
- {renderPassedText( - renderSelectedPassedCountRatio( - webhookPayload.matchedFiltersCount, - webhookPayload.failedFiltersCount, - ), - )} -
+
+ +
+ + {moment(webhookPayload.eventTime).format(Moment12HourFormat)} + +
+ {renderPassedText( + renderSelectedPassedCountRatio( + webhookPayload.matchedFiltersCount, + webhookPayload.failedFiltersCount, + ), + )}
-
- -
+
+
+ ) })}
) + const webhookRepoName = (webhookPayloads?.repositoryUrl ?? gitMaterialUrl)?.replace('.git', '').split('/').pop() + const renderIncomingPayloadTitle = () => (
- {renderPassedText(selectedPassedCountRatio)}. Webhook received from  + {renderPassedText( + renderSelectedPassedCountRatio( + selectedWebhookPayload.matchedFiltersCount, + selectedWebhookPayload.failedFiltersCount, + ), + )} + . Webhook received from 
- /{webhookPayloads?.repositoryUrl.replace('.git', '').split('/').pop()} + /{webhookRepoName}
{/* Here the CI model requires the CiPipelineId not the CiPipelineMaterialId */} @@ -206,13 +182,16 @@ export const CiWebhookModal = ({ style={ButtonStyleType.neutral} dataTestId="show-approvers-info-button" size={ComponentSizeType.xs} - onClick={() => onEditShowEditableCiModal(ciPipelineId, workflowId.toString())} + component={ButtonComponentType.anchor} + anchorProps={{ + href: `${window.__BASE_URL__}${getCIPipelineURL(appId, String(workflowId), true, ciPipelineId, isJobView, isJobCI, false)}`, + }} />
) const getWebhookIncomingPayload = () => - webhookIncomingPayload?.selectorsData?.sort((a, b) => sortCallback('selectorName', a, b)) || [] + structuredClone(webhookIncomingPayload?.selectorsData)?.sort((a, b) => sortCallback('selectorName', a, b)) || [] const renderFilterTableContent = () => (
@@ -276,14 +255,42 @@ export const CiWebhookModal = ({ renderTimeStampDetailedDescription() ) + const renderNoWebhook = () => ( +
+ No webhook received from + + /{webhookRepoName} + +
+ ) + if (isWebhookPayloadLoading) { return ( -
+
) } + if (webhookPayloadsError) { + return + } + + if (!webhookPayloads?.payloads?.length) { + return ( + + ) + } + return (
{renderSidebar()} diff --git a/src/components/app/details/triggerView/EmptyStateCIMaterial.tsx b/src/components/app/details/triggerView/EmptyStateCIMaterial.tsx index 1a7d154df5..a2f17e19ac 100644 --- a/src/components/app/details/triggerView/EmptyStateCIMaterial.tsx +++ b/src/components/app/details/triggerView/EmptyStateCIMaterial.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { GenericEmptyState } from '@devtron-labs/devtron-fe-common-lib' +import { Button, ButtonVariantType, GenericEmptyState } from '@devtron-labs/devtron-fe-common-lib' import ErrorImage from '../../../../assets/img/ic-empty-error@2x.png' import EmptyStateImage from '../../../../assets/img/app-not-deployed.svg' import NoEligibleCommit from '../../../../assets/gif/ic-no-eligible-commit.svg' @@ -23,7 +23,6 @@ import { ReactComponent as NextIcon } from '../../../../assets/icons/ic-arrow-ri import { EmptyStateCIMaterialProps } from './types' import { CI_MATERIAL_EMPTY_STATE_MESSAGING } from './Constants' import { DOCKER_FILE_ERROR_MESSAGE, SOURCE_NOT_CONFIGURED_MESSAGE } from '../../../../config' -import { ReceivedWebhookRedirectButton } from '@Components/common/helpers/GitInfoMaterialCard/ReceivedWebhookRedirectButton' export default function EmptyStateCIMaterial({ isRepoError, @@ -43,6 +42,7 @@ export default function EmptyStateCIMaterial({ handleGoToWorkFlowEditor, showAllCommits, toggleExclude, + handleDisplayWebhookModal, }: EmptyStateCIMaterialProps) { const getData = () => { if (isRepoError) { @@ -107,7 +107,7 @@ export default function EmptyStateCIMaterial({ link: null, } } - if (!anyCommit && !showAllCommits) { + if (!anyCommit && !showAllCommits && !window._env_.HIDE_EXCLUDE_INCLUDE_GIT_COMMITS) { return { img: NoEligibleCommit, title:

{CI_MATERIAL_EMPTY_STATE_MESSAGING.NoCommitEligibleCommit}

, @@ -146,13 +146,26 @@ export default function EmptyStateCIMaterial({ } } - const handleMaterialLoadingButton = () => { + const handleMaterialLoadingButton = () => ( +
- ) - } - - const renderNoWebhook = () => ( -
- No webhook received from - - /{webhookRepoName} - -
- ) - - const renderWebhookModal = () => { - if (!webhookPayloads?.payloads?.length) { - return ( - - ) - } - return ( -
- -
- ) - } - - return ( - -
- {renderWebhookMaterialHeader()} - {renderWebhookModal()} -
-
- ) -} diff --git a/src/components/app/details/triggerView/ciMaterial.tsx b/src/components/app/details/triggerView/ciMaterial.tsx deleted file mode 100644 index 4b8d27902a..0000000000 --- a/src/components/app/details/triggerView/ciMaterial.tsx +++ /dev/null @@ -1,431 +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 React, { Component } from 'react' -import { Prompt } from 'react-router-dom' -import { - Checkbox, - CIMaterialSidebarType, - ModuleNameMap, - ToastManager, - ToastVariantType, - Button, - ComponentSizeType, - CIMaterialType, - showError, - SourceTypeMap, - CommonNodeAttr, - noop, - Tooltip, - DEFAULT_ROUTE_PROMPT_MESSAGE, - savePipeline, - DocLink, -} from '@devtron-labs/devtron-fe-common-lib' -import { CIMaterialProps, CIMaterialState, RegexValueType } from './types' -import { ReactComponent as ICInfoOutline } from '@Icons/ic-info-outline-grey.svg' -import { ReactComponent as Play } from '@Icons/ic-play-outline.svg' -import { ReactComponent as Info } from '../../../../assets/icons/info-filled.svg' -import { ReactComponent as Storage } from '../../../../assets/icons/ic-storage.svg' -import { getCIPipelineURL, importComponentFromFELibrary } from '../../../common' -import { SOURCE_NOT_CONFIGURED } from '../../../../config' -import { getModuleConfigured } from '../appDetails/appDetails.service' -import { TriggerViewContext } from './config' -import { IGNORE_CACHE_INFO } from './Constants' -import { EnvironmentList } from '../../../CIPipelineN/EnvironmentList' -import { GitInfoMaterial } from '@Components/common/helpers/GitInfoMaterialCard/GitInfoMaterial' -import BranchRegexModal from './BranchRegexModal' - -const AllowedWithWarningTippy = importComponentFromFELibrary('AllowedWithWarningTippy') -const validateRuntimeParameters = importComponentFromFELibrary( - 'validateRuntimeParameters', - () => ({ isValid: true, cellError: {} }), - 'function', -) - -class CIMaterial extends Component { - static contextType: React.Context = TriggerViewContext - - constructor(props) { - super(props) - const regexValue: Record = {} - this.props.material.forEach((mat) => { - regexValue[mat.gitMaterialId] = { - value: mat.value, - isInvalid: mat.regex && !new RegExp(mat.regex).test(mat.value), - } - }) - this.state = { - regexValue, - savingRegexValue: false, - isBlobStorageConfigured: false, - currentSidebarTab: CIMaterialSidebarType.CODE_SOURCE, - runtimeParamsErrorState: { - isValid: true, - cellError: {}, - }, - } - } - - selectedCIPipeline = this.props.filteredCIPipelines?.find((_ciPipeline) => _ciPipeline?.id == this.props.pipelineId) - - componentDidMount() { - this.getSecurityModuleStatus() - if (this.props.isJobView && this.props.environmentLists?.length > 0) { - const envId = this.selectedCIPipeline?.environmentId || 0 - const _selectedEnv = this.props.environmentLists.find((env) => env.id == envId) - this.props.setSelectedEnv(_selectedEnv) - } - } - - async getSecurityModuleStatus(): Promise { - try { - const { result } = await getModuleConfigured(ModuleNameMap.BLOB_STORAGE) - if (result?.enabled) { - this.setState({ isBlobStorageConfigured: true }) - } - } catch (error) {} - } - - handleRuntimeParamError = (updatedRuntimeParamsErrorState: typeof this.state.runtimeParamsErrorState) => { - this.setState({ - runtimeParamsErrorState: updatedRuntimeParamsErrorState, - }) - } - - handleSidebarTabChange = (e: React.ChangeEvent) => { - this.setState({ - currentSidebarTab: e.target.value as CIMaterialSidebarType, - }) - } - - onClickStopPropagation = (e): void => { - e.stopPropagation() - } - - renderIgnoreCache = () => { - if (this.props.isFirstTrigger) { - return ( -
- -
-
{IGNORE_CACHE_INFO.FirstTrigger.title}
-
{IGNORE_CACHE_INFO.FirstTrigger.infoText}
-
-
- ) - } - if (!this.state.isBlobStorageConfigured) { - return ( -
- -
-
{IGNORE_CACHE_INFO.BlobStorageNotConfigured.title}
-
- {IGNORE_CACHE_INFO.BlobStorageNotConfigured.infoText}  - -
-
-
- ) - } - if (!this.props.isCacheAvailable) { - return ( -
- -
-
{IGNORE_CACHE_INFO.CacheNotAvailable.title}
-
{IGNORE_CACHE_INFO.CacheNotAvailable.infoText}
-
-
- ) - } - return ( - -
-
{IGNORE_CACHE_INFO.IgnoreCache.title}
- -
- {IGNORE_CACHE_INFO.IgnoreCache.infoText} - - - {/* NOTE: need to wrap react elements with html elements when passing as children to tooltip */} -
- -
-
-
-
-
- ) - } - - renderEnvironments = () => { - return ( - - ) - } - - handleStartBuildAction = (e) => { - const runtimeParamsErrorState = validateRuntimeParameters(this.props.runtimeParams) - this.handleRuntimeParamError(runtimeParamsErrorState) - - if (!runtimeParamsErrorState.isValid) { - ToastManager.showToast({ - variant: ToastVariantType.error, - description: 'Please resolve all the errors before starting the build', - }) - return - } - - e.stopPropagation() - this.context.onClickTriggerCINode() - } - - redirectToCIPipeline = () => { - this.props.history.push( - getCIPipelineURL( - this.props.appId, - this.props.workflowId.toString(), - true, - this.props.pipelineId, - false, - this.props.isJobCI, - false, - ), - ) - } - - renderCTAButtonWithIcon = (canTrigger, isCTAActionable: boolean = true) => ( -
- ) - } - - const handleFilterChanges = (_searchText: string): void => { - triggerViewContext.getMaterialByCommit( - +pipelineId, - selectedMaterial.id, - selectedMaterial.gitMaterialId, - _searchText, - ) - handleSearch(_searchText) - } - - function renderMaterialSource() { - const refreshMaterial = { - refresh: triggerViewContext.refreshMaterial, - pipelineId: Number(pipelineId), - } - const sidebarTabs = Object.values(CIMaterialSidebarType).map((tabValue) => ({ - value: tabValue, - label: tabValue, - })) - - return ( -
- {RuntimeParamTabs ? ( -
- -
- ) : ( -
- Git Repository -
- )} - - -
- ) - } - - const onClickHeader = (e): void => { - stopPropagation(e) - if (selectedMaterial.regex) { - onClickShowBranchRegexModal() - } - } - - const renderBranchChangeHeader = (_selectedMaterial: CIMaterialType): JSX.Element => ( -
- - -
{_selectedMaterial.value}
-
- {_selectedMaterial.regex && ( -
- ) - - const goToWorkFlowEditor = () => { - const ciPipelineURL = getCIPipelineURL( - appId, - workflowId.toString(), - true, - pipelineId, - isJobView, - isJobCI, - false, - ) - if (fromAppGrouping) { - window.open(window.location.href.replace(location.pathname, ciPipelineURL), '_blank', 'noreferrer') - } else { - push(ciPipelineURL) - } - } - - const renderSearch = (): JSX.Element => ( - - ) - - const onRetry = (e) => { - e.stopPropagation() - triggerViewContext.onClickCIMaterial(pipelineId, pipelineName) - } - - const toggleShowExcludePopUp = () => { - setShowExcludePopUp(not) - } - - const toggleExclude = (e): void => { - if (fromBulkCITrigger) { - stopPropagation(e) - } - setShowAllCommits(!showAllCommits) - clearFilters() - triggerViewContext.getFilteredMaterial(+pipelineId, selectedMaterial.gitMaterialId, !showAllCommits) - } - - const renderExcludedCommitsOption = () => { - const hideShowIconClass = 'icon-dim-16 scn-8 mr-10 dc__no-shrink' - - return ( -
-
- {showAllCommits ? ( - - ) : ( - - )} -
- {showExcludePopUp && ( -
- {showAllCommits ? ( - <> - - Hide excluded commits - - ) : ( - <> - - Show excluded commits - - )} -
- )} -
- ) - } - - const renderMaterialHistoryHeader = (_selectedMaterial: CIMaterialType) => { - const excludeIncludeEnv = !window._env_.HIDE_EXCLUDE_INCLUDE_GIT_COMMITS - - return ( -
- {renderBranchChangeHeader(_selectedMaterial)} - {!_selectedMaterial.isRepoError && !_selectedMaterial.isBranchError && ( -
- {renderSearch()} - {excludeIncludeEnv && renderExcludedCommitsOption()} -
- )} -
- ) - } - - const getRuntimeParametersHeading = () => { - const headingPrefix = 'Runtime parameters' - const headingSuffix = appName ? `for '${appName}'` : '' - return `${headingPrefix} ${headingSuffix}` - } - - const renderWebhookHeader = () => - selectedMaterial.type === SourceTypeMap.WEBHOOK && ( -
- -
- Showing results matching - - . - -
-
- ) - - function renderMaterialHistory(_selectedMaterial: CIMaterialType) { - const anyCommit = _selectedMaterial.history?.length > 0 - const isWebhook = _selectedMaterial.type === SourceTypeMap.WEBHOOK - const materialError = - _selectedMaterial.isMaterialLoading || - _selectedMaterial.isRepoError || - _selectedMaterial.isBranchError || - _selectedMaterial.noSearchResult - const showHeader = !isWebhook && !hideSearchHeader && currentSidebarTab === CIMaterialSidebarType.CODE_SOURCE - - if (materialError || !anyCommit) { - return ( -
- {showHeader && renderMaterialHistoryHeader(_selectedMaterial)} - -
- ) - } - - if (RuntimeParameters && currentSidebarTab === CIMaterialSidebarType.PARAMETERS) { - return ( -
- -
- ) - } - - return ( -
- {showHeader && renderMaterialHistoryHeader(selectedMaterial)} - {renderWebhookHeader()} -
- -
-
- ) - } - const nodeType: CommonNodeAttr['type'] = 'CI' - - const renderWebhookContent = () => ( - - ) - - const renderBody = () => - isBulkCIWebhook ? ( - renderWebhookContent() - ) : ( -
- {!fromBulkCITrigger && renderMaterialSource()} - {renderMaterialHistory(selectedMaterial)} -
- ) - - return ( - <> - {!fromBulkCITrigger && renderMaterialHeader()} - {MissingPluginBlockState && isCITriggerBlocked ? ( - - ) : ( - renderBody() - )} - - ) -} diff --git a/src/components/common/helpers/GitInfoMaterialCard/ReceivedWebhookRedirectButton.tsx b/src/components/common/helpers/GitInfoMaterialCard/ReceivedWebhookRedirectButton.tsx deleted file mode 100644 index 661a6a6809..0000000000 --- a/src/components/common/helpers/GitInfoMaterialCard/ReceivedWebhookRedirectButton.tsx +++ /dev/null @@ -1,45 +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 { useRouteMatch } from 'react-router-dom' - -import { Button, ButtonComponentType, ButtonVariantType, noop } from '@devtron-labs/devtron-fe-common-lib' - -import { CI_MATERIAL_EMPTY_STATE_MESSAGING } from '@Components/app/details/triggerView/Constants' -import { URLS } from '@Config/routes' - -import { ReceivedWebhookRedirectButtonType } from './types' - -export const ReceivedWebhookRedirectButton = ({ setIsWebhookBulkCI, isBulk }: ReceivedWebhookRedirectButtonType) => { - const { url } = useRouteMatch() - - const handleClick = () => { - setIsWebhookBulkCI(true) - } - - return ( -
-
+