Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove cluster install modal from cluster #2495

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 1 addition & 60 deletions src/components/cluster/Cluster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
getClusterList,
getEnvironmentList,
getCluster,
retryClusterInstall,
deleteEnvironment,
} from './cluster.service'
import { ReactComponent as Add } from '@Icons/ic-add.svg'
Expand All @@ -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'
Expand Down Expand Up @@ -97,12 +94,6 @@ export default class ClusterList extends Component<ClusterListProps, any> {
}
}

componentDidUpdate(prevProps) {
if (this.props.serverMode !== prevProps.serverMode) {
this.initialise()
}
}

initialise() {
if (this.timerRef) {
clearInterval(this.timerRef)
Expand Down Expand Up @@ -276,7 +267,6 @@ export default class ClusterList extends Component<ClusterListProps, any> {
{...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}
Expand Down Expand Up @@ -337,7 +327,6 @@ const Cluster = ({
proxyUrl,
toConnectWithSSHTunnel,
sshTunnelConfig,
serverMode,
isTlsConnection,
toggleShowAddCluster,
toggleCheckTlsConnection,
Expand All @@ -349,7 +338,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)
Expand Down Expand Up @@ -491,34 +479,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)
}
Expand Down Expand Up @@ -695,25 +655,6 @@ const Cluster = ({
</Tippy>
)}
</List>
{!isVirtualCluster && serverMode !== SERVER_MODE.EA_ONLY && !window._env_.K8S_CLIENT && clusterId && (
<ClusterInstallStatus
agentInstallationStage={agentInstallationStage}
envName={envName}
onClick={clusterInstallStatusOnclick}
/>
)}
{showClusterComponentModal && (
<ClusterComponentModal
agentInstallationStage={agentInstallationStage}
components={defaultClusterComponent}
environmentName={envName}
callRetryClusterInstall={callRetryClusterInstall}
redirectToChartDeployment={redirectToChartDeployment}
close={(e) => {
toggleClusterComponentModal(!showClusterComponentModal)
}}
/>
)}
{!window._env_.K8S_CLIENT && Array.isArray(newEnvs) && newEnvs.length > 1 ? (
<div className="pb-8">
<div className="cluster-env-list_table fs-12 pt-6 pb-6 fw-6 flex left lh-20 pl-20 pr-20 dc__border-top dc__border-bottom-n1">
Expand Down
109 changes: 0 additions & 109 deletions src/components/cluster/ClusterComponentModal.tsx

This file was deleted.

79 changes: 0 additions & 79 deletions src/components/cluster/ClusterInstallStatus.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/components/cluster/cluster.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ export function updateCluster(request) {
return put(URL, request)
}

export function retryClusterInstall(id: number, payload): Promise<ResponseType> {
const URL = `${Routes.CHART_AVAILABLE}/cluster-component/install/${id}`
return post(URL, payload)
}

export const getEnvironment = (id: number): Promise<any> => {
const URL = `${Routes.ENVIRONMENT}?id=${id}`
return get(URL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ const Body = ({ getHostURLConfig, checkList, serverMode, handleChecklistUpdate,
return (
<ClusterList
{...props}
serverMode={serverMode}
isSuperAdmin={isSuperAdmin || window._env_.K8S_CLIENT}
/>
)
Expand Down