Skip to content

Commit

Permalink
Merge branch 'main' into fix-osquery-no-response-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
szwarckonrad authored Sep 26, 2023
2 parents 203c9db + 9198475 commit a8a26ef
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .buildkite/scripts/steps/check_types_commits.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set -euo pipefail

if [[ "${CI-}" == "true" ]]; then
.buildkite/scripts/bootstrap.sh
sha1="${GITHUB_PR_TARGET_BRANCH-}"

sha1=$(git merge-base $GITHUB_PR_TARGET_BRANCH $GITHUB_PR_TRIGGERED_SHA)
sha2="${GITHUB_PR_TRIGGERED_SHA-}"
else
# Script take between 0 and 2 arguments representing two commit SHA's:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export const mockKibanaValues = {
setDocTitle: jest.fn(),
share: sharePluginMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
user: {},
};

jest.mock('../../shared/kibana', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React from 'react';
import React, { useEffect, useState } from 'react';

import { useValues } from 'kea';

Expand All @@ -21,6 +21,8 @@ import { Chat } from '@kbn/cloud-chat-plugin/public';
import { i18n } from '@kbn/i18n';
import { WelcomeBanner } from '@kbn/search-api-panels';

import { AuthenticatedUser } from '@kbn/security-plugin/common';

import { ErrorStateCallout } from '../../../shared/error_state';
import { HttpLogic } from '../../../shared/http';
import { KibanaLogic } from '../../../shared/kibana';
Expand All @@ -40,8 +42,24 @@ import { IngestionSelector } from './ingestion_selector';
import './product_selector.scss';

export const ProductSelector: React.FC = () => {
const { config, user } = useValues(KibanaLogic);
const { config } = useValues(KibanaLogic);
const { errorConnectingMessage } = useValues(HttpLogic);
const { security } = useValues(KibanaLogic);

const [user, setUser] = useState<AuthenticatedUser | null>(null);

useEffect(() => {
try {
security.authc
.getCurrentUser()
.then(setUser)
.catch(() => {
setUser(null);
});
} catch {
setUser(null);
}
}, [security.authc]);

const showErrorConnecting = !!(config.host && errorConnectingMessage);
// The create index flow does not work without ent-search, when content is updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const renderApp = (
const { history } = params;
const { application, chrome, http, uiSettings } = core;
const { capabilities, navigateToUrl } = application;
const { charts, cloud, guidedOnboarding, lens, security, share, user } = plugins;
const { charts, cloud, guidedOnboarding, lens, security, share } = plugins;

const entCloudHost = getCloudEnterpriseSearchHost(plugins.cloud);
externalUrl.enterpriseSearchUrl = publicUrl || entCloudHost || config.host || '';
Expand Down Expand Up @@ -108,7 +108,6 @@ export const renderApp = (
setDocTitle: chrome.docTitle.change,
share,
uiSettings,
user,
});
const unmountLicensingLogic = mountLicensingLogic({
canManageLicense: core.application.capabilities.management?.stack?.license_management,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { AuthenticatedUser } from '@kbn/security-plugin/common';
import { SecurityPluginStart } from '@kbn/security-plugin/public';
import { SharePluginStart } from '@kbn/share-plugin/public';

Expand Down Expand Up @@ -54,7 +53,6 @@ interface KibanaLogicProps {
setDocTitle(title: string): void;
share: SharePluginStart;
uiSettings: IUiSettingsClient;
user: AuthenticatedUser | null;
}

export interface KibanaValues extends Omit<KibanaLogicProps, 'cloud'> {
Expand Down Expand Up @@ -95,7 +93,6 @@ export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
setDocTitle: [props.setDocTitle, {}],
share: [props.share, {}],
uiSettings: [props.uiSettings, {}],
user: [props.user, {}],
}),
selectors: ({ selectors }) => ({
isCloud: [() => [selectors.cloud], (cloud?: Partial<CloudSetup>) => !!cloud?.isCloudEnabled],
Expand Down
5 changes: 1 addition & 4 deletions x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/publi
import type { HomePublicPluginSetup } from '@kbn/home-plugin/public';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { LicensingPluginStart } from '@kbn/licensing-plugin/public';
import { AuthenticatedUser } from '@kbn/security-plugin/common';
import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/public';
import { SharePluginStart } from '@kbn/share-plugin/public';

Expand Down Expand Up @@ -66,7 +65,6 @@ export interface PluginsStart {
licensing: LicensingPluginStart;
security: SecurityPluginStart;
share: SharePluginStart;
user: AuthenticatedUser;
}

export class EnterpriseSearchPlugin implements Plugin {
Expand Down Expand Up @@ -102,8 +100,7 @@ export class EnterpriseSearchPlugin implements Plugin {
cloudSetup && (pluginsStart as PluginsStart).cloud
? { ...cloudSetup, ...(pluginsStart as PluginsStart).cloud }
: undefined;
const user = (await (pluginsStart as PluginsStart).security.authc.getCurrentUser()) || null;
const plugins = { ...pluginsStart, cloud, user } as PluginsStart;
const plugins = { ...pluginsStart, cloud } as PluginsStart;

coreStart.chrome
.getChromeStyle$()
Expand Down

0 comments on commit a8a26ef

Please sign in to comment.