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

[serverless] Create Search Serverless plugin #156037

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ packages/kbn-server-http-tools @elastic/kibana-core
packages/kbn-server-route-repository @elastic/apm-ui
x-pack/plugins/serverless @elastic/appex-sharedux
packages/serverless/project_switcher @elastic/appex-sharedux
x-pack/plugins/serverless_search @elastic/appex-sharedux
clintandrewhall marked this conversation as resolved.
Show resolved Hide resolved
clintandrewhall marked this conversation as resolved.
Show resolved Hide resolved
packages/serverless/storybook/config @elastic/appex-sharedux
packages/serverless/types @elastic/appex-sharedux
test/plugin_functional/plugins/session_notifications @elastic/kibana-core
Expand Down
13 changes: 13 additions & 0 deletions config/serverless.es.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# Search Project Config

## Disable APM and Uptime, enable Enterprise Search
xpack.apm.enabled: false
xpack.uptime.enabled: false
enterpriseSearch.enabled: true

## Enable the Serverless Search plugin
xpack.serverless.search.enabled: true

## Set the home route
uiSettings.overrides.defaultRoute: /app/enterprise_search/content/search_indices

## Set the dev project switcher current type
xpack.serverless.plugin.developer.projectSwitcher.currentType: 'search'
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ Kibana.
|


|{kib-repo}blob/{branch}/x-pack/plugins/serverless_search/README.mdx[serverlessSearch]
|This plugin contains configuration and code used to create a Serverless Search project. It leverages universal configuration and other APIs in the serverless plugin to configure Kibana.


|{kib-repo}blob/{branch}/x-pack/plugins/session_view/README.md[sessionView]
|Session View is meant to provide a visualization into what is going on in a particular Linux environment where the agent is running. It looks likes a terminal emulator; however, it is a tool for introspecting process activity and understanding user and service behaviour in your Linux servers and infrastructure. It is a time-ordered series of process executions displayed in a tree over time.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@
"@kbn/server-route-repository": "link:packages/kbn-server-route-repository",
"@kbn/serverless": "link:x-pack/plugins/serverless",
"@kbn/serverless-project-switcher": "link:packages/serverless/project_switcher",
"@kbn/serverless-search": "link:x-pack/plugins/serverless_search",
"@kbn/serverless-types": "link:packages/serverless/types",
"@kbn/session-notifications-plugin": "link:test/plugin_functional/plugins/session_notifications",
"@kbn/session-view-plugin": "link:x-pack/plugins/session_view",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pageLoadAssetSize:
security: 65433
securitySolution: 66738
serverless: 16573
serverlessSearch: 17548
sessionView: 77750
share: 71239
snapshotRestore: 79032
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,8 @@
"@kbn/serverless/*": ["x-pack/plugins/serverless/*"],
"@kbn/serverless-project-switcher": ["packages/serverless/project_switcher"],
"@kbn/serverless-project-switcher/*": ["packages/serverless/project_switcher/*"],
"@kbn/serverless-search": ["x-pack/plugins/serverless_search"],
"@kbn/serverless-search/*": ["x-pack/plugins/serverless_search/*"],
"@kbn/serverless-storybook-config": ["packages/serverless/storybook/config"],
"@kbn/serverless-storybook-config/*": ["packages/serverless/storybook/config/*"],
"@kbn/serverless-types": ["packages/serverless/types"],
Expand Down
60 changes: 39 additions & 21 deletions x-pack/plugins/enterprise_search/public/applications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,55 +37,73 @@ import { mountLicensingLogic } from './shared/licensing';

export const renderApp = (
App: React.FC<InitialAppData>,
{ params, core, plugins }: { params: AppMountParameters; core: CoreStart; plugins: PluginsStart },
{
params,
core,
plugins,
isSidebarEnabled,
}: {
core: CoreStart;
isSidebarEnabled: boolean;
params: AppMountParameters;
plugins: PluginsStart;
},
{ config, data }: { config: ClientConfigType; data: ClientData }
) => {
const { publicUrl, errorConnectingMessage, ...initialData } = data;
const { access, features, publicUrl, errorConnectingMessage, readOnlyMode, ...initialData } =
data;
const { history } = params;
const { application, chrome, http, uiSettings } = core;
const { capabilities, navigateToUrl } = application;
const { charts, cloud, guidedOnboarding, lens, security } = plugins;

const entCloudHost = getCloudEnterpriseSearchHost(plugins.cloud);
externalUrl.enterpriseSearchUrl = publicUrl || entCloudHost || config.host || '';

const noProductAccess: ProductAccess = {
hasAppSearchAccess: false,
hasWorkplaceSearchAccess: false,
};
const productAccess = data.access || noProductAccess;
const productFeatures = data.features ?? { ...DEFAULT_PRODUCT_FEATURES };

const productAccess = access || noProductAccess;
const productFeatures = features ?? { ...DEFAULT_PRODUCT_FEATURES };

const EmptyContext: FC = ({ children }) => <>{children}</>;
const CloudContext = plugins.cloud?.CloudContextProvider || EmptyContext;
const CloudContext = cloud?.CloudContextProvider || EmptyContext;

resetContext({ createStore: true });
const store = getContext().store;

const unmountKibanaLogic = mountKibanaLogic({
application: core.application,
capabilities: core.application.capabilities,
application,
capabilities,
charts,
cloud,
config,
data: plugins.data,
lens: plugins.lens,
guidedOnboarding,
history,
isSidebarEnabled,
lens,
navigateToUrl,
productAccess,
productFeatures,
charts: plugins.charts,
cloud: plugins.cloud,
uiSettings: core.uiSettings,
guidedOnboarding: plugins.guidedOnboarding,
history: params.history,
navigateToUrl: core.application.navigateToUrl,
security: plugins.security,
setBreadcrumbs: core.chrome.setBreadcrumbs,
setChromeIsVisible: core.chrome.setIsVisible,
setDocTitle: core.chrome.docTitle.change,
renderHeaderActions: (HeaderActions) =>
params.setHeaderActionMenu((el) => renderHeaderActions(HeaderActions, store, el)),
security,
setBreadcrumbs: chrome.setBreadcrumbs,
setChromeIsVisible: chrome.setIsVisible,
setDocTitle: chrome.docTitle.change,
uiSettings,
});
const unmountLicensingLogic = mountLicensingLogic({
license$: plugins.licensing.license$,
canManageLicense: core.application.capabilities.management?.stack?.license_management,
license$: plugins.licensing.license$,
});
const unmountHttpLogic = mountHttpLogic({
http: core.http,
errorConnectingMessage,
readOnlyMode: initialData.readOnlyMode,
http,
readOnlyMode,
});
const unmountFlashMessagesLogic = mountFlashMessagesLogic();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,26 @@ type RequiredFieldsOnly<T> = {
};
interface KibanaLogicProps {
application: ApplicationStart;
config: ClientConfigType;
productAccess: ProductAccess;
productFeatures: ProductFeatures;
// Kibana core
capabilities: Capabilities;
charts: ChartsPluginStart;
cloud?: CloudSetup;
config: ClientConfigType;
data: DataPublicPluginStart;
guidedOnboarding: GuidedOnboardingPluginStart;
history: ScopedHistory;
isSidebarEnabled: boolean;
lens: LensPublicStart;
navigateToUrl: RequiredFieldsOnly<ApplicationStart['navigateToUrl']>;
productAccess: ProductAccess;
productFeatures: ProductFeatures;
renderHeaderActions(HeaderActions: FC): void;
security: SecurityPluginStart;
setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void;
setChromeIsVisible(isVisible: boolean): void;
setDocTitle(title: string): void;
renderHeaderActions(HeaderActions: FC): void;
// Required plugins
charts: ChartsPluginStart;
guidedOnboarding: GuidedOnboardingPluginStart;
security: SecurityPluginStart;
uiSettings: IUiSettingsClient;
// Optional plugins
cloud?: CloudSetup;
}

export interface KibanaValues extends Omit<KibanaLogicProps, 'cloud'> {
cloud: Partial<CloudSetup>;
data: DataPublicPluginStart;
Expand All @@ -73,6 +72,7 @@ export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
data: [props.data, {}],
guidedOnboarding: [props.guidedOnboarding, {}],
history: [props.history, {}],
isSidebarEnabled: [props.isSidebarEnabled, {}],
lens: [props.lens, {}],
navigateToUrl: [
(url: string, options?: CreateHrefOptions) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import { KibanaLogic } from '../kibana';
import { generateNavLink } from './nav_link_helpers';

export const useEnterpriseSearchNav = () => {
const { productAccess, productFeatures } = useValues(KibanaLogic);
const { isSidebarEnabled, productAccess, productFeatures } = useValues(KibanaLogic);

if (!isSidebarEnabled) return undefined;

const navItems: Array<EuiSideNavItemType<unknown>> = [
{
Expand Down Expand Up @@ -174,6 +176,7 @@ export const useEnterpriseSearchNav = () => {

export const useEnterpriseSearchEngineNav = (engineName?: string, isEmptyState?: boolean) => {
const navItems = useEnterpriseSearchNav();
if (!navItems) return undefined;
if (!engineName) return navItems;
const applicationsItem = navItems.find((item) => item.id === 'applications');
if (!applicationsItem || !applicationsItem.items) return navItems;
Expand Down Expand Up @@ -255,6 +258,9 @@ export const useEnterpriseSearchAnalyticsNav = (
}
) => {
const navItems = useEnterpriseSearchNav();

if (!navItems) return undefined;

const applicationsNav = navItems.find((item) => item.id === 'applications');
const analyticsNav = applicationsNav?.items?.find((item) => item.id === 'analyticsCollections');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import './page_template.scss';

export type PageTemplateProps = KibanaPageTemplateProps & {
customPageSections?: boolean; // If false, automatically wraps children in an EuiPageSection
emptyState?: React.ReactNode;
hideFlashMessages?: boolean;
isLoading?: boolean;
emptyState?: React.ReactNode;
setPageChrome?: React.ReactNode;
// Used by product-specific page templates
pageChrome?: BreadcrumbTrail;
pageViewTelemetry?: string;
setPageChrome?: React.ReactNode;
};

export const EnterpriseSearchPageTemplateWrapper: React.FC<PageTemplateProps> = ({
Expand Down Expand Up @@ -73,7 +73,11 @@ export const EnterpriseSearchPageTemplateWrapper: React.FC<PageTemplateProps> =
),
}}
isEmptyState={isEmptyState && !isLoading}
solutionNav={solutionNav ? { icon: 'logoEnterpriseSearch', ...solutionNav } : undefined}
solutionNav={
solutionNav && solutionNav.items
? { icon: 'logoEnterpriseSearch', ...solutionNav }
: undefined
}
>
{setPageChrome}
{readOnlyMode && (
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/enterprise_search/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ import { EnterpriseSearchPlugin } from './plugin';
export const plugin = (initializerContext: PluginInitializerContext) => {
return new EnterpriseSearchPlugin(initializerContext);
};

export type { EnterpriseSearchPublicSetup, EnterpriseSearchPublicStart } from './plugin';
Loading