Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D/2023 06 14 global drift #166710

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f14587c
global drift wip
Dosant Jun 14, 2023
1a92275
fix ts configs
Dosant Jun 14, 2023
55a08db
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Jun 14, 2023
741bf1d
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine Jun 14, 2023
1de509b
try to fix react import issue
Dosant Jun 14, 2023
8a0ca6a
Merge branch 'd/2023-06-14-global-drift' of github.com:Dosant/kibana …
Dosant Jun 14, 2023
78d62f5
fix import
Dosant Jun 14, 2023
d219cb3
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Jun 27, 2023
0b0ec7d
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Jun 27, 2023
21cb0af
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Jul 3, 2023
cafddaf
global drift poc wip
Dosant Jul 5, 2023
67596f5
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Jul 5, 2023
0fb7fd6
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Aug 22, 2023
02ac5e3
merge
Dosant Aug 22, 2023
ab4fcb1
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Sep 18, 2023
46cc24b
wip global drift
Dosant Sep 19, 2023
eff2c56
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Sep 19, 2023
d89218f
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Sep 19, 2023
355296a
clean up
Dosant Sep 19, 2023
391aa67
Merge branch 'd/2023-06-14-global-drift' of github.com:Dosant/kibana …
Dosant Sep 19, 2023
7556d23
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Sep 19, 2023
5e53791
clean i18n
Dosant Sep 19, 2023
83f8d4e
Merge branch 'd/2023-06-14-global-drift' of github.com:Dosant/kibana …
Dosant Sep 19, 2023
4e7290a
wip
Dosant Sep 20, 2023
be5581e
wip
Dosant Sep 21, 2023
2fdff0d
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Sep 21, 2023
6514dce
improve position
Dosant Sep 21, 2023
1e7fcac
adjust tests
Dosant Sep 21, 2023
fe8a978
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Sep 21, 2023
f7c59c5
improve
Dosant Sep 21, 2023
bc17f11
wip
Dosant Sep 22, 2023
0bd2b73
Merge branch 'main' of github.com:elastic/kibana into d/2023-06-14-gl…
Dosant Sep 22, 2023
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: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ packages/kbn-ci-stats-reporter @elastic/kibana-operations
packages/kbn-ci-stats-shipper-cli @elastic/kibana-operations
packages/kbn-cli-dev-mode @elastic/kibana-operations
x-pack/plugins/cloud_integrations/cloud_chat @elastic/kibana-core
x-pack/plugins/cloud_integrations/cloud_chat_provider @elastic/kibana-core
x-pack/plugins/cloud_integrations/cloud_data_migration @elastic/platform-onboarding
x-pack/plugins/cloud_defend @elastic/kibana-cloud-security-posture
x-pack/plugins/cloud_integrations/cloud_experiments @elastic/kibana-core
Expand Down
4 changes: 0 additions & 4 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,6 @@ for inventory and topology purposes.
|Integrates with DriftChat in order to provide live support to our Elastic Cloud users. This plugin should only run on Elastic Cloud.


|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_chat_provider/README.md[cloudChatProvider]
|This plugin exists as a workaround for using cloudChat plugin in plugins which can't have a direct dependency on security plugin.


|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_data_migration/README.md[cloudDataMigration]
|Static migration page where self-managed users can see text/copy about migrating to Elastic Cloud

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
"@kbn/chart-icons": "link:packages/kbn-chart-icons",
"@kbn/charts-plugin": "link:src/plugins/charts",
"@kbn/cloud-chat-plugin": "link:x-pack/plugins/cloud_integrations/cloud_chat",
"@kbn/cloud-chat-provider-plugin": "link:x-pack/plugins/cloud_integrations/cloud_chat_provider",
"@kbn/cloud-data-migration-plugin": "link:x-pack/plugins/cloud_integrations/cloud_data_migration",
"@kbn/cloud-defend-plugin": "link:x-pack/plugins/cloud_defend",
"@kbn/cloud-experiments-plugin": "link:x-pack/plugins/cloud_integrations/cloud_experiments",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pageLoadAssetSize:
charts: 55000
cloud: 21076
cloudChat: 19894
cloudChatProvider: 17114
cloudDataMigration: 19170
cloudDefend: 18697
cloudExperiments: 59358
Expand Down
18 changes: 3 additions & 15 deletions src/plugins/home/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,8 @@
"id": "home",
"server": true,
"browser": true,
"requiredPlugins": [
"dataViews",
"share",
"urlForwarding"
],
"optionalPlugins": [
"usageCollection",
"customIntegrations",
"cloud",
"guidedOnboarding",
"cloudChatProvider"
],
"requiredBundles": [
"kibanaReact"
]
"requiredPlugins": ["dataViews", "share", "urlForwarding"],
"optionalPlugins": ["usageCollection", "customIntegrations", "cloud", "guidedOnboarding"],
"requiredBundles": ["kibanaReact"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ const skipText = i18n.translate('home.guidedOnboarding.gettingStarted.skip.butto
});

export const GettingStarted = () => {
const { application, trackUiMetric, chrome, guidedOnboardingService, cloud, cloudChat } =
getServices();
const { application, trackUiMetric, chrome, guidedOnboardingService, cloud } = getServices();

const [guidesState, setGuidesState] = useState<GuideState[]>([]);
const [isLoading, setIsLoading] = useState<boolean>(false);
Expand Down Expand Up @@ -227,7 +226,6 @@ export const GettingStarted = () => {
{skipText}
</EuiLink>
</div>
{cloudChat?.Chat && <cloudChat.Chat />}
</EuiPageTemplate.Section>
</KibanaPageTemplate>
);
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/home/public/application/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { DataViewsContract } from '@kbn/data-views-plugin/public';
import { SharePluginSetup } from '@kbn/share-plugin/public';
import { GuidedOnboardingApi } from '@kbn/guided-onboarding-plugin/public';
import { CloudSetup } from '@kbn/cloud-plugin/public';
import { CloudChatProviderPluginStart } from '@kbn/cloud-chat-provider-plugin/public';
import { TutorialService } from '../services/tutorials';
import { AddDataService } from '../services/add_data';
import { FeatureCatalogueRegistry } from '../services/feature_catalogue';
Expand Down Expand Up @@ -54,7 +53,6 @@ export interface HomeKibanaServices {
welcomeService: WelcomeService;
guidedOnboardingService?: GuidedOnboardingApi;
cloud?: CloudSetup;
cloudChat?: CloudChatProviderPluginStart;
}

let services: HomeKibanaServices | null = null;
Expand Down
9 changes: 2 additions & 7 deletions src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/
import { AppNavLinkStatus } from '@kbn/core/public';
import { SharePluginSetup } from '@kbn/share-plugin/public';
import type { CloudSetup } from '@kbn/cloud-plugin/public';
import type { CloudChatProviderPluginStart } from '@kbn/cloud-chat-provider-plugin/public';
import { PLUGIN_ID, HOME_APP_BASE_PATH } from '../common/constants';
import { setServices } from './application/kibana_services';
import { ConfigSchema } from '../config';
Expand All @@ -43,7 +42,6 @@ export interface HomePluginStartDependencies {
dataViews: DataViewsPublicPluginStart;
urlForwarding: UrlForwardingStart;
guidedOnboarding: GuidedOnboardingPluginStart;
cloudChatProvider?: CloudChatProviderPluginStart;
}

export interface HomePluginSetupDependencies {
Expand Down Expand Up @@ -82,10 +80,8 @@ export class HomePublicPlugin
const trackUiMetric = usageCollection
? usageCollection.reportUiCounter.bind(usageCollection, 'Kibana_home')
: () => {};
const [
coreStart,
{ dataViews, urlForwarding: urlForwardingStart, guidedOnboarding, cloudChatProvider },
] = await core.getStartServices();
const [coreStart, { dataViews, urlForwarding: urlForwardingStart, guidedOnboarding }] =
await core.getStartServices();
setServices({
share,
trackUiMetric,
Expand All @@ -110,7 +106,6 @@ export class HomePublicPlugin
welcomeService: this.welcomeService,
guidedOnboardingService: guidedOnboarding.guidedOnboardingApi,
cloud,
cloudChat: cloudChatProvider,
});
coreStart.chrome.docTitle.change(
i18n.translate('home.pageTitle', { defaultMessage: 'Home' })
Expand Down
1 change: 0 additions & 1 deletion src/plugins/home/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@kbn/ebt-tools",
"@kbn/core-analytics-server",
"@kbn/storybook",
"@kbn/cloud-chat-provider-plugin",
"@kbn/shared-ux-router",
"@kbn/core-http-common",
],
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@
"@kbn/cli-dev-mode/*": ["packages/kbn-cli-dev-mode/*"],
"@kbn/cloud-chat-plugin": ["x-pack/plugins/cloud_integrations/cloud_chat"],
"@kbn/cloud-chat-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_chat/*"],
"@kbn/cloud-chat-provider-plugin": ["x-pack/plugins/cloud_integrations/cloud_chat_provider"],
"@kbn/cloud-chat-provider-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_chat_provider/*"],
"@kbn/cloud-data-migration-plugin": ["x-pack/plugins/cloud_integrations/cloud_data_migration"],
"@kbn/cloud-data-migration-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_data_migration/*"],
"@kbn/cloud-defend-plugin": ["x-pack/plugins/cloud_defend"],
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/cloud_integrations/cloud_chat/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
"chat"
],
"requiredPlugins": [
"cloud",
"cloudChatProvider"
"cloud"
],
"requiredBundles": [
"kibanaReact"
],
"optionalPlugins": [
"security"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,88 +5,68 @@
* 2.0.
*/

import React, { useRef, useState } from 'react';
import { css } from '@emotion/react';

import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButtonEmpty } from '@elastic/eui';
import { euiThemeVars } from '@kbn/ui-theme';

import { useChatConfig } from './use_chat_config';
import { WhenIdle } from './when_idle';
import { useChatConfig, ChatApi } from './use_chat_config';
export type { ChatApi } from './use_chat_config';

export interface Props {
/** Handler invoked when chat is hidden by someone. */
onHide?: () => void;
/** Handler invoked when the chat widget signals it is ready. */
onReady?: () => void;
onReady?: (chatApi: ChatApi) => void;
/** Handler invoked when the chat widget signals to be resized. */
onResize?: () => void;
/** Handler invoked when the playbook is fired. */
onPlaybookFired?: () => void;
/** The offset from the top of the page to the chat widget. */
topOffset?: number;
}

/**
* A component that will display a trigger that will allow the user to chat with a human operator,
* when the service is enabled; otherwise, it renders nothing.
*/
export const Chat = ({ onHide = () => {}, onReady, onResize }: Props) => {
const config = useChatConfig({ onReady, onResize });
const ref = useRef<HTMLDivElement>(null);
const [isClosed, setIsClosed] = useState(false);
export const Chat = ({
onHide = () => {},
onReady,
onResize,
onPlaybookFired,
topOffset = 0,
}: Props) => {
const config = useChatConfig({ onReady, onResize, onPlaybookFired });

if (!config.enabled || isClosed) {
if (!config.enabled) {
return null;
}

const { isReady, isResized, style } = config;
const { right } = style;

const buttonCSS = css`
bottom: ${euiThemeVars.euiSizeXS};
position: fixed;
right: calc(${right} + ${euiThemeVars.euiSizeXS});
visibility: ${isReady && isResized ? 'visible' : 'hidden'};
`;

const button = (
<EuiButtonEmpty
css={buttonCSS}
data-test-subj="cloud-chat-hide"
name="cloudChatHide"
onClick={() => {
onHide();
setIsClosed(true);
}}
size="xs"
>
{i18n.translate('xpack.cloudChat.hideChatButtonLabel', {
defaultMessage: 'Hide chat',
})}
</EuiButtonEmpty>
);

const containerCSS = css`
bottom: ${euiThemeVars.euiSizeXL};
position: fixed;
right: ${euiThemeVars.euiSizeXL};
z-index: ${euiThemeVars.euiZMaskBelowHeader - 1};

&:focus [name='cloudChatHide'],
&:hover [name='cloudChatHide'] {
visibility: visible;
}
`;

return (
<div css={containerCSS} ref={ref} data-test-subj="cloud-chat">
{button}
<WhenIdle>
<iframe
data-test-subj="cloud-chat-frame"
title={i18n.translate('xpack.cloudChat.chatFrameTitle', {
defaultMessage: 'Chat',
})}
src={config.src}
ref={config.ref}
style={config.style}
style={
config.isReady
? {
position: 'fixed',
...config.style,
// reset default button positioning
bottom: 'auto',
inset: 'initial',
// force position to the top and of the page
top: topOffset,
right: 0,
// TODO: if the page height is smaller than widget height + topOffset,
// the widget will be cut off from the bottom.
}
: { display: 'none' }
}
/>
</div>
</WhenIdle>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React, { Suspense } from 'react';
import { EuiErrorBoundary } from '@elastic/eui';
import type { Props } from './chat';
export type { ChatApi, Props } from './chat';

/**
* A suspense-compatible version of the Chat component.
*/
export const LazyChat = React.lazy(() => import('./chat').then(({ Chat }) => ({ default: Chat })));

/**
* A lazily-loaded component that will display a trigger that will allow the user to chat with a
* human operator when the service is enabled; otherwise, it renders nothing.
*/
export const Chat = (props: Props) => (
<EuiErrorBoundary>
<Suspense fallback={<></>}>
<LazyChat {...props} />
</Suspense>
</EuiErrorBoundary>
);
Loading