Skip to content

Commit 8d9c306

Browse files
committed
feat: add AIChat in devtron app details
1 parent 37e1564 commit 8d9c306

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ FEATURE_DEFAULT_AUTHENTICATED_VIEW_ENABLE=false
6969
GATEKEEPER_URL=https://license.devtron.ai/dashboard
7070
FEATURE_AI_INTEGRATION_ENABLE=false
7171
LOGIN_PAGE_IMAGE=
72+
FEATURE_AI_APP_DETAILS_ENABLE=false

src/components/app/details/main.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { lazy, Suspense, useEffect, useState } from 'react'
17+
import { lazy, Suspense, useEffect, useRef, useState } from 'react'
1818
import { Switch, Route, Redirect, useParams, useRouteMatch } from 'react-router-dom'
1919
import {
2020
showError,
@@ -35,6 +35,7 @@ import { MultiValue } from 'react-select'
3535
import {
3636
ErrorBoundary,
3737
getAndSetAppGroupFilters,
38+
importComponentFromFELibrary,
3839
setAppGroupFilterInLocalStorage,
3940
sortOptionsByLabel,
4041
} from '../../common'
@@ -59,6 +60,8 @@ const CIDetails = lazy(() => import('./cIDetails/CIDetails'))
5960
const AppDetails = lazy(() => import('./appDetails/AppDetails'))
6061
const CDDetails = lazy(() => import('./cdDetails/CDDetails'))
6162

63+
const AIChat = importComponentFromFELibrary('AIChat', null, 'function')
64+
6265
export default function AppDetailsPage() {
6366
const { path } = useRouteMatch()
6467
const { appId } = useParams<{ appId }>()
@@ -81,6 +84,8 @@ export default function AppDetailsPage() {
8184
const [apiError, setApiError] = useState(null)
8285
const [initLoading, setInitLoading] = useState<boolean>(false)
8386

87+
const parentRef = useRef<HTMLDivElement>(null)
88+
8489
const { fetchRecentlyVisitedParsedApps } = useUserPreferences({})
8590

8691
const getAppMetaInfoRes = async (shouldResetAppName: boolean = false): Promise<AppMetaInfo> => {
@@ -344,7 +349,7 @@ export default function AppDetailsPage() {
344349
const _filteredEnvIds = selectedAppList.length > 0 ? selectedAppList.map((app) => +app.value).join(',') : null
345350

346351
return (
347-
<div className="app-details-page flexbox-col w-100 h-100 dc__overflow-auto">
352+
<div ref={parentRef} className="app-details-page flexbox-col w-100 h-100 dc__overflow-auto">
348353
<AppHeader
349354
appName={appName}
350355
appMetaInfo={appMetaInfo}
@@ -380,6 +385,8 @@ export default function AppDetailsPage() {
380385
/>
381386
)}
382387

388+
{AIChat && window._env_?.FEATURE_AI_APP_DETAILS_ENABLE && (<AIChat parentRef={parentRef} />)}
389+
383390
<ErrorBoundary>
384391
<Suspense fallback={<Progressing pageLoader />}>
385392
<Switch>

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,9 @@ if (!window || !window._env_) {
170170
FEATURE_APPLICATION_TEMPLATES_ENABLE: true,
171171
FEATURE_DEFAULT_AUTHENTICATED_VIEW_ENABLE: false,
172172
GATEKEEPER_URL: 'https://license.devtron.ai/dashboard',
173-
FEATURE_AI_INTEGRATION_ENABLE: false,
173+
FEATURE_AI_INTEGRATION_ENABLE: true,
174174
LOGIN_PAGE_IMAGE: '',
175+
FEATURE_AI_APP_DETAILS_ENABLE: false,
175176
}
176177
}
177178

0 commit comments

Comments
 (0)