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

fix: ephemeral error toast #2375

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions src/components/app/details/triggerView/ciMaterial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/components/v2/appDetails/appDetails.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export interface NodeTreeTabListProps extends LogSearchTermType {
isReloadResourceTreeInProgress: boolean
handleReloadResourceTree: () => void
tabRef?: MutableRefObject<HTMLDivElement>
appType?: string
appType?: AppType
isExternalApp?: boolean
}

Expand Down
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
Expand Up @@ -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'
Expand All @@ -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()
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ const EphemeralContainerDrawer = ({
setResourceContainers(_containers)
setShowEphemeralContainerDrawer(false)
switchSelectedContainer(containerName)
handleSuccess()
if (typeof handleSuccess === 'function') {
handleSuccess()
}
})
.catch((err) => {
showError(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const NodeDetailComponent = ({
}
}

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

export interface ResponsePayload {
Expand Down
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
}
}
Loading