Skip to content
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ FEATURE_LINK_EXTERNAL_FLUX_ENABLE=false
FEATURE_CANARY_ROLLOUT_PROGRESS_ENABLE=true
COMMAND_BAR_REFETCH_INTERVAL=3600
FEATURE_STORAGE_ENABLE=false
FEATURE_ATHENA_DEBUG_MODE_ENABLE=false
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "1.22.0-beta-4",
"@devtron-labs/devtron-fe-common-lib": "1.22.0-beta-5",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand Down
14 changes: 13 additions & 1 deletion src/Pages/App/Details/ExternalFlux/ExternalFluxAppDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useParams } from 'react-router-dom'

import {
abortPreviousRequests,
AIAgentContextSourceType,
AppType,
DeploymentAppTypes,
ERROR_STATUS_CODE,
Expand All @@ -42,7 +43,7 @@ let initTimer = null

const ExternalFluxAppDetails = () => {
const { clusterId, appName, namespace, templateType } = useParams<ExternalFluxAppDetailParams>()
const { isSuperAdmin } = useMainContext()
const { isSuperAdmin, setAIAgentContext } = useMainContext()
const isKustomization = templateType === FluxCDTemplateType.KUSTOMIZATION
const [initialLoading, setInitialLoading] = useState(true)
const [isReloadResourceTreeInProgress, setIsReloadResourceTreeInProgress] = useState(true)
Expand All @@ -53,6 +54,7 @@ const ExternalFluxAppDetails = () => {
useEffect(
() => () => {
abortControllerRef.current.abort()
setAIAgentContext(null)
},
[],
)
Expand All @@ -65,6 +67,16 @@ const ExternalFluxAppDetails = () => {
fluxTemplateType: templateType,
}

setAIAgentContext({
source: AIAgentContextSourceType.APP_DETAILS,
data: {
appType: 'externalFluxApp',
appName: genericAppDetail.appName,
clusterId: genericAppDetail.clusterId,
namespace: genericAppDetail.namespace,
fluxAppDeploymentType: genericAppDetail.fluxTemplateType,
},
})
IndexStore.publishAppDetails(genericAppDetail, AppType.EXTERNAL_FLUX_APP)
setAppDetailsError(null)
}
Expand Down
174 changes: 0 additions & 174 deletions src/components/ResourceBrowser/ResourceList/EventList.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ import {
highlightSearchText,
Icon,
IconName,
MainContext,
Nodes,
noop,
RESOURCE_BROWSER_ROUTES,
ResourceBrowserActionMenuEnum,
TableSignalEnum,
Tooltip,
useMainContext,
} from '@devtron-labs/devtron-fe-common-lib'

import { ReactComponent as ICErrorExclamation } from '@Icons/ic-error-exclamation.svg'
Expand Down Expand Up @@ -72,6 +74,7 @@ const K8sResourceListTableCellComponent = ({
const isNodeUnschedulable = isNodeListing && !!resourceData.unschedulable
const nameButtonRef = useRef<HTMLButtonElement>(null)
const contextMenuRef = useRef<HTMLButtonElement>(null)
const { aiAgentContext } = useMainContext()

const [showCreateEnvironmentDrawer, setShowCreateEnvironmentDrawer] = useState(false)

Expand Down Expand Up @@ -216,16 +219,42 @@ const K8sResourceListTableCellComponent = ({
)
}

const eventDetails = {
const baseEventDetails = {
message: resourceData.message as string,
namespace: resourceData.namespace as string,
object: resourceData[EVENT_LIST.dataKeys.involvedObject] as string,
source: resourceData.source as string,
count: resourceData.count as number,
age: resourceData.age as string,
lastSeen: resourceData[EVENT_LIST.dataKeys.lastSeen] as string,
}

const eventDetails = {
...baseEventDetails,
object: resourceData[EVENT_LIST.dataKeys.involvedObject] as string,
}

const eventIntelligentConfig: MainContext['intelligenceConfig'] = {
clusterId: +clusterId,
metadata: eventDetails,
prompt: JSON.stringify(eventDetails),
analyticsCategory: getAIAnalyticsEvents('RB_RESOURCE'),
}

const eventDebugAgentContext = aiAgentContext
? ({
...aiAgentContext,
prompt: `Explain why the event occurred with the following details:<div class="flexbox-col dc__gap-4 mt-16">${Object.entries(
baseEventDetails,
)
.map(([key, value]) => `<div>**${key}**: \`${value}\`</div>`)
.join('')}</div>`,
data: {
...aiAgentContext.data,
...baseEventDetails,
},
} as MainContext['debugAgentContext'])
: null

if (columnName === 'cpu.usagePercentage') {
return (
<K8sResourceListTableUsageCell
Expand Down Expand Up @@ -348,12 +377,8 @@ const K8sResourceListTableCellComponent = ({
isEventListing &&
resourceData.type === 'Warning' && (
<ExplainWithAIButton
intelligenceConfig={{
clusterId,
metadata: eventDetails,
prompt: JSON.stringify(eventDetails),
analyticsCategory: getAIAnalyticsEvents('RB_RESOURCE'),
}}
intelligenceConfig={eventIntelligentConfig}
debugAgentContext={eventDebugAgentContext}
/>
)}
<span>
Expand All @@ -380,6 +405,21 @@ const K8sResourceListTableCellComponent = ({
prompt: `Debug what's wrong with ${resourceData.name}/${selectedResource?.gvk?.Kind} of ${resourceData.namespace}`,
analyticsCategory: getAIAnalyticsEvents('RB__RESOURCE'),
}}
debugAgentContext={
aiAgentContext
? {
...aiAgentContext,
prompt: `Why is ${selectedResource?.gvk?.Kind} '${resourceData.name}' of '${resourceData.namespace}' namespace in ${resourceData.status}?`,
data: {
...aiAgentContext.data,
kind: selectedResource?.gvk?.Kind,
name: resourceData.name,
namespace: resourceData.namespace,
status: resourceData.status ?? '',
},
}
: null
}
/>
</div>
)}
Expand Down
9 changes: 0 additions & 9 deletions src/components/ResourceBrowser/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
GVKType,
K8SObjectBaseType,
K8sResourceDetailDataType,
K8sResourceDetailType,
OptionType,
ResourceDetail,
ResourceRecommenderActionMenuProps,
Expand Down Expand Up @@ -172,14 +171,6 @@ export interface ResourceListEmptyStateType {
actionHandler?: () => void
}

export interface EventListType {
listRef: React.MutableRefObject<HTMLDivElement>
filteredData: K8sResourceDetailType['data']
handleResourceClick: (e: React.MouseEvent<HTMLButtonElement>) => void
searchText: string
clusterId: string
}

export interface ConnectingToClusterStateProps {
loader: boolean
errorMsg: string
Expand Down
8 changes: 4 additions & 4 deletions src/components/app/details/appDetails/AppDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ const Details: React.FC<DetailsType> = ({

useEffect(() => {
// This check is here since we don't clear appDetails on env/app change for some reason :/ and this will cause data mismatch
if (appDetails?.environmentId === +params.envId && appDetails?.appId === +params.appId) {
if (appDetails?.environmentId === +params.envId && appDetails.appId === +params.appId) {
setAIAgentContext({
source: AIAgentContextSourceType.APP_DETAILS,
data: {
appId: +params.appId,
envId: +params.envId,
clusterId: appDetails?.clusterId,
envName: appDetails?.environmentName,
appName: appDetails?.appName,
clusterId: appDetails.clusterId,
envName: appDetails.environmentName,
appName: appDetails.appName,
appType: 'devtronApp',
},
})
Expand Down
Loading