Skip to content

Commit

Permalink
Adding restriciton on AI Playground
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiul-TheSoccerFan committed Mar 5, 2024
1 parent 88c2b02 commit 55edc9c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export const EnterpriseSearchContent: React.FC<InitialAppData> = (props) => {
};

export const EnterpriseSearchContentConfigured: React.FC<Required<InitialAppData>> = () => {
const {
productFeatures: { showAIPlayground },
} = useValues(KibanaLogic);
return (
<Routes>
<Redirect exact from={ROOT_PATH} to={SEARCH_INDICES_PATH} />
Expand All @@ -93,9 +96,11 @@ export const EnterpriseSearchContentConfigured: React.FC<Required<InitialAppData
<Route path={SETTINGS_PATH}>
<Settings />
</Route>
<Route path={AI_PLAYGROUND_PATH}>
<AIPlayground />
</Route>
{showAIPlayground && (
<Route path={AI_PLAYGROUND_PATH}>
<AIPlayground />
</Route>
)}
<Route>
<NotFound />
</Route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,21 @@ export const useEnterpriseSearchNav = () => {
},
]
: []),
{
id: 'ai-playground',
name: i18n.translate('xpack.enterpriseSearch.nav.aiPlaygroundTitle', {
defaultMessage: 'AI Playground',
}),
...generateNavLink({
shouldNotCreateHref: true,
shouldShowActiveForSubroutes: true,
to: ENTERPRISE_SEARCH_CONTENT_PLUGIN.URL + AI_PLAYGROUND_PATH,
}),
},
...(productFeatures.showAIPlayground
? [
{
id: 'ai-playground',
name: i18n.translate('xpack.enterpriseSearch.nav.aiPlaygroundTitle', {
defaultMessage: 'AI Playground',
}),
...generateNavLink({
shouldNotCreateHref: true,
shouldShowActiveForSubroutes: true,
to: ENTERPRISE_SEARCH_CONTENT_PLUGIN.URL + AI_PLAYGROUND_PATH,
}),
},
]
: []),
],
name: i18n.translate('xpack.enterpriseSearch.nav.contentTitle', {
defaultMessage: 'Content',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ import { streamFactory } from '@kbn/ml-response-stream/server';

import { RouteDependencies } from '../../plugin';
import { elasticsearchErrorHandler } from '../../utils/elasticsearch_error_handler';
import { createApiKey } from '@kbn/enterprise-search-plugin/server/lib/analytics/create_api_key';

export function registerAIPlaygroundRoutes({ log, router }: RouteDependencies) {
export function registerAIPlaygroundRoutes({ log, router, config }: RouteDependencies) {
if (!config.showAIPlayground) {
return;
}

router.post(
{
path: '/internal/enterprise_search/ai_playground/query_source_fields',
Expand Down

0 comments on commit 55edc9c

Please sign in to comment.