Skip to content

Commit

Permalink
Merge pull request #2376 from devtron-labs/fix/ephemeral-toast-error
Browse files Browse the repository at this point in the history
fix: ephemeral toast error
shivani170 authored Jan 16, 2025
2 parents 3df5b8f + 559395c commit 4ecae8b
Showing 8 changed files with 44 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/components/app/details/triggerView/ciMaterial.tsx
Original file line number Diff line number Diff line change
@@ -393,6 +393,10 @@ class CIMaterial extends Component<CIMaterialProps, CIMaterialState> {
const response = await savePipeline(payload, true)
if (response) {
await this.props.getWorkflows()

if (this.props.fromAppGrouping) {
this.context.onClickCIMaterial(this.props.pipelineId.toString(), this.props.pipelineName)
}
}
} catch (error) {
showError(error)
2 changes: 1 addition & 1 deletion src/components/v2/appDetails/appDetails.type.ts
Original file line number Diff line number Diff line change
@@ -405,7 +405,7 @@ export interface NodeTreeTabListProps extends LogSearchTermType {
isReloadResourceTreeInProgress: boolean
handleReloadResourceTree: () => void
tabRef?: MutableRefObject<HTMLDivElement>
appType?: string
appType?: AppType
isExternalApp?: boolean
}

6 changes: 6 additions & 0 deletions src/components/v2/appDetails/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum ApplicationsGAEvents {
REFRESH_DEVTRON_APP_RESOURCE_TREE = 'REFRESH_DEVTRON_APP_RESOURCE_TREE',
REFRESH_HELM_APP_RESOURCE_TREE = 'REFRESH_HELM_APP_RESOURCE_TREE',
REFRESH_ARGO_APP_RESOURCE_TREE = 'REFRESH_ARGO_APP_RESOURCE_TREE',
REFRESH_FLUX_APP_RESOURCE_TREE = 'REFRESH_FLUX_APP_RESOURCE_TREE',
}
14 changes: 12 additions & 2 deletions src/components/v2/appDetails/k8Resource/NodeTreeTabList.tsx
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@
* limitations under the License.
*/

import React from 'react'
import { NavLink, useHistory, useParams } from 'react-router-dom'
import ReactGA from 'react-ga4'
import { useSharedState } from '../../utils/useSharedState'
@@ -36,13 +35,15 @@ import {
ButtonComponentType
} from '@devtron-labs/devtron-fe-common-lib'
import './NodeTreeTabList.scss'
import { getApplicationsGAEvent } from './utils'

export default function NodeTreeTabList({
logSearchTerms,
setLogSearchTerms,
tabRef,
handleReloadResourceTree,
isReloadResourceTreeInProgress,
appType
}: NodeTreeTabListProps) {
const { nodeType } = useParams<{ nodeType: string }>()
const { push } = useHistory()
@@ -132,6 +133,15 @@ export default function NodeTreeTabList({
handleCloseTab(e, e.currentTarget.dataset.title)
}


const onClickReloadResourceTree = () => {
handleReloadResourceTree()
ReactGA.event({
category: getApplicationsGAEvent(appType),
action: getApplicationsGAEvent(appType),
})
}

return (
<div
data-testid="resource-tree-wrapper"
@@ -201,7 +211,7 @@ export default function NodeTreeTabList({
<Button
dataTestId="reload-resource-tree-button"
icon={<ICArrowClockwise className="scn-6" />}
onClick={handleReloadResourceTree}
onClick={onClickReloadResourceTree}
variant={ButtonVariantType.borderLess}
size={ComponentSizeType.small}
style={ButtonStyleType.neutral}
Original file line number Diff line number Diff line change
@@ -501,7 +501,9 @@ const EphemeralContainerDrawer = ({
setResourceContainers(_containers)
setShowEphemeralContainerDrawer(false)
switchSelectedContainer(containerName)
handleSuccess()
if (typeof handleSuccess === 'function') {
handleSuccess()
}
})
.catch((err) => {
showError(err)
Original file line number Diff line number Diff line change
@@ -254,7 +254,7 @@ const NodeDetailComponent = ({
}
}

if (result?.manifestResponse.ephemeralContainers) {
if (result?.manifestResponse?.ephemeralContainers) {
_resourceContainers.push(
...result.manifestResponse.ephemeralContainers.map((_container) => ({
name: _container.name,
@@ -646,7 +646,7 @@ const NodeDetailComponent = ({
setContainers={setContainers}
switchSelectedContainer={switchSelectedContainer}
selectedNamespaceByClickingPod={selectedResource?.namespace}
handleSuccess={getContainersFromManifest}
{...isResourceBrowserView ? {handleSuccess: getContainersFromManifest} : {}}
/>
)}
{isResourceBrowserView && showDeleteDialog && (
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ export interface EphemeralContainerDrawerType {
switchSelectedContainer: (string) => void
onClickShowLaunchEphemeral: () => void
selectedNamespaceByClickingPod?: string
handleSuccess: () => void
handleSuccess?: () => void
}

export interface ResponsePayload {
16 changes: 15 additions & 1 deletion src/components/v2/appDetails/k8Resource/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { Node, NodeFilters } from '@devtron-labs/devtron-fe-common-lib'
import { AppType, Node, NodeFilters } from '@devtron-labs/devtron-fe-common-lib'
import { ApplicationsGAEvents } from '../constants'

export const doesNodeSatisfiesFilter = (node: Node, filter: string) =>
node.health?.status.toLowerCase() === filter || (filter === NodeFilters.drifted && node.hasDrift)

export const getApplicationsGAEvent = (appType: AppType) => {
switch (appType) {
case AppType.DEVTRON_HELM_CHART:
return ApplicationsGAEvents.REFRESH_HELM_APP_RESOURCE_TREE
case AppType.EXTERNAL_ARGO_APP:
return ApplicationsGAEvents.REFRESH_ARGO_APP_RESOURCE_TREE
case AppType.EXTERNAL_FLUX_APP:
return ApplicationsGAEvents.REFRESH_FLUX_APP_RESOURCE_TREE
default:
return ApplicationsGAEvents.REFRESH_DEVTRON_APP_RESOURCE_TREE
}
}

0 comments on commit 4ecae8b

Please sign in to comment.