From af6ff4947980a2035e1f8ddc1e20d17ac8d93893 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 25 Feb 2025 16:49:57 +0530 Subject: [PATCH 1/2] chore: remove cluster install modal from cluster --- src/components/cluster/Cluster.tsx | 55 +-------- .../cluster/ClusterComponentModal.tsx | 109 ------------------ .../cluster/ClusterInstallStatus.tsx | 79 ------------- src/components/cluster/cluster.service.ts | 5 - 4 files changed, 1 insertion(+), 247 deletions(-) delete mode 100644 src/components/cluster/ClusterComponentModal.tsx delete mode 100644 src/components/cluster/ClusterInstallStatus.tsx diff --git a/src/components/cluster/Cluster.tsx b/src/components/cluster/Cluster.tsx index 265b9f06e8..a619b17426 100644 --- a/src/components/cluster/Cluster.tsx +++ b/src/components/cluster/Cluster.tsx @@ -41,7 +41,6 @@ import { getClusterList, getEnvironmentList, getCluster, - retryClusterInstall, deleteEnvironment, } from './cluster.service' import { ReactComponent as Add } from '@Icons/ic-add.svg' @@ -50,10 +49,8 @@ import { ReactComponent as PencilEdit } from '@Icons/ic-pencil.svg' import { ReactComponent as Trash } from '@Icons/ic-delete-interactive.svg' import { ReactComponent as VirtualClusterIcon } from '@Icons/ic-virtual-cluster.svg' import { ReactComponent as VirtualEnvIcon } from '@Icons/ic-environment-temp.svg' -import { ClusterComponentModal } from './ClusterComponentModal' -import { ClusterInstallStatus } from './ClusterInstallStatus' import { POLLING_INTERVAL, ClusterListProps, AuthenticationType } from './cluster.type' -import { DOCUMENTATION, SERVER_MODE, ViewType, URLS, CONFIGURATION_TYPES, AppCreationType } from '../../config' +import { DOCUMENTATION, ViewType, CONFIGURATION_TYPES, AppCreationType } from '../../config' import { getEnvName } from './cluster.util' import ClusterForm from './ClusterForm' import { ClusterEnvironmentDrawer } from '@Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer' @@ -276,7 +273,6 @@ export default class ClusterList extends Component { {...cluster} reload={this.initialise} key={cluster.id || Math.random().toString(36).substr(2, 5)} - serverMode={this.props.serverMode} showEditCluster={this.state.showEditCluster} toggleShowAddCluster={this.toggleShowEditCluster} toggleCheckTlsConnection={this.toggleCheckTlsConnection} @@ -337,7 +333,6 @@ const Cluster = ({ proxyUrl, toConnectWithSSHTunnel, sshTunnelConfig, - serverMode, isTlsConnection, toggleShowAddCluster, toggleCheckTlsConnection, @@ -349,7 +344,6 @@ const Cluster = ({ const [environment, setEnvironment] = useState(null) const [config, setConfig] = useState(defaultConfig) const [prometheusAuth, setPrometheusAuth] = useState(undefined) - const [showClusterComponentModal, toggleClusterComponentModal] = useState(false) const [showWindow, setShowWindow] = useState(false) const [confirmation, setConfirmation] = useState(false) const [prometheusToggleEnabled] = useState(!!prometheus_url) @@ -491,34 +485,6 @@ const Cluster = ({ } } - function redirectToChartDeployment(appId, envId): void { - history.push(`${URLS.APP}/${URLS.DEVTRON_CHARTS}/deployments/${appId}/env/${envId}`) - } - - async function callRetryClusterInstall() { - try { - const payload = {} - const { result } = await retryClusterInstall(clusterId, payload) - if (result) { - ToastManager.showToast({ - variant: ToastVariantType.success, - description: 'Successfully triggered', - }) - } - reload() - } catch (error) { - showError(error) - } - } - - async function clusterInstallStatusOnclick(e) { - if (agentInstallationStage === 3) { - callRetryClusterInstall() - } else { - toggleClusterComponentModal(!showClusterComponentModal) - } - } - const hideClusterDrawer = (e) => { setShowWindow(false) } @@ -695,25 +661,6 @@ const Cluster = ({ )} - {!isVirtualCluster && serverMode !== SERVER_MODE.EA_ONLY && !window._env_.K8S_CLIENT && clusterId && ( - - )} - {showClusterComponentModal && ( - { - toggleClusterComponentModal(!showClusterComponentModal) - }} - /> - )} {!window._env_.K8S_CLIENT && Array.isArray(newEnvs) && newEnvs.length > 1 ? (
diff --git a/src/components/cluster/ClusterComponentModal.tsx b/src/components/cluster/ClusterComponentModal.tsx deleted file mode 100644 index 1c4b756ef6..0000000000 --- a/src/components/cluster/ClusterComponentModal.tsx +++ /dev/null @@ -1,109 +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 { VisibleModal } from '@devtron-labs/devtron-fe-common-lib' -import React, { Component } from 'react' -import { ReactComponent as Close } from '../../assets/icons/ic-close.svg' -import { ClusterComponentModalProps } from './cluster.type' - -export class ClusterComponentModal extends Component { - renderStatus() { - if (this.props.agentInstallationStage === 0) { - return ( -

- Not Triggered - -

- ) - } - if (this.props.agentInstallationStage === 1) { - return

In progress...

- } - if (this.props.agentInstallationStage === 2) { - return

Installed

- } - if (this.props.agentInstallationStage === 3) { - return ( -

- Failed - -

- ) - } - } - - renderWithBackdrop(list) { - return ( - -
e.stopPropagation()} - > -
-
-

- Installing Devtron Agent on {this.props.environmentName} -

- {this.renderStatus()} -
- -
-
- {list} -
-
- ) - } - - render() { - const list = ( -
    - {this.props.components?.map((c) => { - const status = c.status.toLowerCase().replace('_', '-') - return ( -
  • this.props.redirectToChartDeployment(c.installedAppId, c.envId)} - > -
    - -
    -
    -

    {c.name}

    -

    {c.status}

    -
    -
  • - ) - })} -
- ) - return this.renderWithBackdrop(list) - } -} diff --git a/src/components/cluster/ClusterInstallStatus.tsx b/src/components/cluster/ClusterInstallStatus.tsx deleted file mode 100644 index dcf46dadb5..0000000000 --- a/src/components/cluster/ClusterInstallStatus.tsx +++ /dev/null @@ -1,79 +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 { ClusterInstallStatusProps } from './cluster.type' -import { ReactComponent as NotDeployed } from '../../assets/icons/ic-info-filled.svg' - -export class ClusterInstallStatus extends Component { - render() { - const classes = 'cluster-create-status' - if (this.props.agentInstallationStage === 0) { - return ( -
- - -

- Devtron agent is not installed{this.props.envName && ` on env: ${this.props.envName}`}. -

- -
- ) - } - if (this.props.agentInstallationStage === 1) { - return ( -
- -

- Devtron agent installing{this.props.envName && ` on env: ${this.props.envName}`}. -

- -
- ) - } - if (this.props.agentInstallationStage === 2) { - return ( -
- -

- Devtron agent running{this.props.envName && ` on env: ${this.props.envName}`}. -

- -
- ) - } - if (this.props.agentInstallationStage === 3) { - return ( -
- -

- Devtron agent installation failed{this.props.envName && ` on env: ${this.props.envName}`}. -

- -
- ) - } - return null - } -} diff --git a/src/components/cluster/cluster.service.ts b/src/components/cluster/cluster.service.ts index 90379514e2..e9168a417c 100644 --- a/src/components/cluster/cluster.service.ts +++ b/src/components/cluster/cluster.service.ts @@ -47,11 +47,6 @@ export function updateCluster(request) { return put(URL, request) } -export function retryClusterInstall(id: number, payload): Promise { - const URL = `${Routes.CHART_AVAILABLE}/cluster-component/install/${id}` - return post(URL, payload) -} - export const getEnvironment = (id: number): Promise => { const URL = `${Routes.ENVIRONMENT}?id=${id}` return get(URL) From 3261edd4f74a82a9013555c87d30e583329345d7 Mon Sep 17 00:00:00 2001 From: shivani170 Date: Tue, 25 Feb 2025 17:02:43 +0530 Subject: [PATCH 2/2] chore: server mode removed from props --- src/components/cluster/Cluster.tsx | 6 ------ src/components/globalConfigurations/GlobalConfiguration.tsx | 1 - 2 files changed, 7 deletions(-) diff --git a/src/components/cluster/Cluster.tsx b/src/components/cluster/Cluster.tsx index a619b17426..32fde852f0 100644 --- a/src/components/cluster/Cluster.tsx +++ b/src/components/cluster/Cluster.tsx @@ -94,12 +94,6 @@ export default class ClusterList extends Component { } } - componentDidUpdate(prevProps) { - if (this.props.serverMode !== prevProps.serverMode) { - this.initialise() - } - } - initialise() { if (this.timerRef) { clearInterval(this.timerRef) diff --git a/src/components/globalConfigurations/GlobalConfiguration.tsx b/src/components/globalConfigurations/GlobalConfiguration.tsx index bcb1194e66..fed5ef3bc7 100644 --- a/src/components/globalConfigurations/GlobalConfiguration.tsx +++ b/src/components/globalConfigurations/GlobalConfiguration.tsx @@ -591,7 +591,6 @@ const Body = ({ getHostURLConfig, checkList, serverMode, handleChecklistUpdate, return ( )