Skip to content

Commit

Permalink
[Obs AI Assistant] Hide insight components when license is incorrect …
Browse files Browse the repository at this point in the history
…or there are no configured connectors
  • Loading branch information
sorenlouv committed Apr 24, 2024
1 parent 15e5598 commit b01a7db
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import {
EuiCallOut,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { cloneDeep, isArray, last, once } from 'lodash';
import { cloneDeep, isArray, isEmpty, last, once } from 'lodash';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import useObservable from 'react-use/lib/useObservable';
import { ILicense } from '@kbn/licensing-plugin/public';
import { MessageRole, type Message } from '../../../common/types';
import { ObservabilityAIAssistantChatServiceContext } from '../../context/observability_ai_assistant_chat_service_context';
import { useAbortableAsync } from '../../hooks/use_abortable_async';
Expand Down Expand Up @@ -290,9 +292,20 @@ export function Insight({
};

const {
services: { http },
services: {
http,
plugins: {
start: { licensing },
},
},
} = useKibana();

const license = useObservable<ILicense | null>(licensing.license$);
const hasEnterpriseLicense = license?.hasAtLeast('enterprise');
if (isEmpty(connectors.connectors) || !hasEnterpriseLicense) {
return null;
}

let children: React.ReactNode = null;

if (
Expand Down

0 comments on commit b01a7db

Please sign in to comment.