Skip to content

Commit

Permalink
Merge branch 'main' into 159076-snooze-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jcger authored Aug 11, 2023
2 parents 046e5e2 + a98dfa1 commit da684e2
Show file tree
Hide file tree
Showing 118 changed files with 1,492 additions and 469 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
"@dnd-kit/core": "^3.1.1",
"@dnd-kit/sortable": "^4.0.0",
"@dnd-kit/utilities": "^2.0.0",
"@elastic/apm-rum": "^5.13.0",
"@elastic/apm-rum-react": "^1.4.3",
"@elastic/apm-rum": "^5.14.0",
"@elastic/apm-rum-react": "^1.4.4",
"@elastic/charts": "59.1.0",
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
connectorsServiceNow: `${ENTERPRISE_SEARCH_DOCS}connectors-servicenow.html`,
connectorsSharepoint: `${ENTERPRISE_SEARCH_DOCS}connectors-sharepoint.html`,
connectorsSharepointOnline: `${ENTERPRISE_SEARCH_DOCS}connectors-sharepoint-online.html`,
connectorsWorkplaceSearch: `${ENTERPRISE_SEARCH_DOCS}connectors.html#connectors-workplace-search`,
connectorsWorkplaceSearch: `${ENTERPRISE_SEARCH_DOCS}workplace-search-connectors.html`,
crawlerExtractionRules: `${ENTERPRISE_SEARCH_DOCS}crawler-extraction-rules.html`,
crawlerManaging: `${ENTERPRISE_SEARCH_DOCS}crawler-managing.html`,
crawlerOverview: `${ENTERPRISE_SEARCH_DOCS}crawler.html`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ export const guideCards: GuideCardConstants[] = [
defaultMessage: 'Collect and analyze my logs',
}),
navigateTo: {
appId: 'integrations',
path: '/browse?q=log',
appId: 'observabilityOnboarding',
},
telemetryId: 'onboarding--observability--logs',
order: 2,
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/visualizations/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"home",
"share",
"spaces",
"savedObjectsTaggingOss"
"savedObjectsTaggingOss",
"serverless"
],
"requiredBundles": [
"kibanaUtils",
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/visualizations/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import type { SpacesPluginStart } from '@kbn/spaces-plugin/public';
import type { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';
import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public';
import type { SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/public';
import type { ServerlessPluginStart } from '@kbn/serverless/public';
import {
ContentManagementPublicSetup,
ContentManagementPublicStart,
Expand Down Expand Up @@ -164,6 +165,7 @@ export interface VisualizationsStartDeps {
usageCollection: UsageCollectionStart;
savedObjectsManagement: SavedObjectsManagementPluginStart;
contentManagement: ContentManagementPublicStart;
serverless?: ServerlessPluginStart;
}

/**
Expand Down Expand Up @@ -327,6 +329,7 @@ export class VisualizationsPlugin
visEditorsRegistry,
listingViewRegistry,
unifiedSearch: pluginsStart.unifiedSearch,
serverless: pluginsStart.serverless,
};

params.element.classList.add('visAppWrapper');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export const VisualizeListing = () => {
uiSettings,
kbnUrlStateStorage,
listingViewRegistry,
serverless,
},
} = useKibana<VisualizeServices>();
const { pathname } = useLocation();
Expand Down Expand Up @@ -298,13 +299,20 @@ export const VisualizeListing = () => {
useMount(() => {
// Reset editor state for all apps if the visualize listing page is loaded.
stateTransferService.clearEditorState();
chrome.setBreadcrumbs([
{
text: i18n.translate('visualizations.visualizeListingBreadcrumbsTitle', {
defaultMessage: 'Visualize Library',
}),
},
]);
if (serverless?.setBreadcrumbs) {
// reset any deeper context breadcrumbs
// "Visualization" breadcrumb is set automatically by the serverless navigation
serverless.setBreadcrumbs([]);
} else {
chrome.setBreadcrumbs([
{
text: i18n.translate('visualizations.visualizeListingBreadcrumbsTitle', {
defaultMessage: 'Visualize Library',
}),
},
]);
}

chrome.docTitle.change(
i18n.translate('visualizations.listingPageTitle', { defaultMessage: 'Visualize Library' })
);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/visualizations/public/visualize_app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/
import type { SpacesPluginStart } from '@kbn/spaces-plugin/public';
import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public';
import type { SavedSearch, SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/public';
import type { ServerlessPluginStart } from '@kbn/serverless/public';
import type {
Vis,
VisualizeEmbeddableContract,
Expand Down Expand Up @@ -115,6 +116,7 @@ export interface VisualizeServices extends CoreStart {
visEditorsRegistry: VisEditorsRegistry;
listingViewRegistry: ListingViewRegistry;
unifiedSearch: UnifiedSearchPublicPluginStart;
serverless?: ServerlessPluginStart;
}

export interface VisInstance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ export function getCreateBreadcrumbs({
];
}

export function getCreateServerlessBreadcrumbs({
byValue,
originatingAppName,
redirectToOrigin,
}: {
byValue?: boolean;
originatingAppName?: string;
redirectToOrigin?: () => void;
}) {
// TODO: https://github.com/elastic/kibana/issues/163488
// for now, serverless breadcrumbs only set the title,
// the rest of the breadcrumbs are handled by the serverless navigation
// the serverless navigation is not yet aware of the byValue/originatingApp context
return [
{
text: i18n.translate('visualizations.editor.createBreadcrumb', {
defaultMessage: 'Create',
}),
},
];
}

export function getEditBreadcrumbs(
{
byValue,
Expand All @@ -65,3 +87,26 @@ export function getEditBreadcrumbs(
},
];
}

export function getEditServerlessBreadcrumbs(
{
byValue,
originatingAppName,
redirectToOrigin,
}: {
byValue?: boolean;
originatingAppName?: string;
redirectToOrigin?: () => void;
},
title: string = defaultEditText
) {
// TODO: https://github.com/elastic/kibana/issues/163488
// for now, serverless breadcrumbs only set the title,
// the rest of the breadcrumbs are handled by the serverless navigation
// the serverless navigation is not yet aware of the byValue/originatingApp context
return [
{
text: title,
},
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
VisualizeEditorVisInstance,
} from '../types';
import { VisualizeConstants } from '../../../common/constants';
import { getEditBreadcrumbs } from './breadcrumbs';
import { getEditBreadcrumbs, getEditServerlessBreadcrumbs } from './breadcrumbs';
import { VISUALIZE_APP_LOCATOR, VisualizeLocatorParams } from '../../../common/locator';
import { getUiActions } from '../../services';
import { VISUALIZE_EDITOR_TRIGGER, AGG_BASED_VISUALIZATION_TRIGGER } from '../../triggers';
Expand Down Expand Up @@ -117,6 +117,7 @@ export const getTopNavConfig = (
savedObjectsTagging,
presentationUtil,
getKibanaVersion,
serverless,
}: VisualizeServices
) => {
const { vis, embeddableHandler } = visInstance;
Expand Down Expand Up @@ -202,7 +203,11 @@ export const getTopNavConfig = (
stateTransfer.clearEditorState(VisualizeConstants.APP_ID);
}
chrome.docTitle.change(savedVis.lastSavedTitle);
chrome.setBreadcrumbs(getEditBreadcrumbs({}, savedVis.lastSavedTitle));
if (serverless?.setBreadcrumbs) {
serverless.setBreadcrumbs(getEditServerlessBreadcrumbs({}, savedVis.lastSavedTitle));
} else {
chrome.setBreadcrumbs(getEditBreadcrumbs({}, savedVis.lastSavedTitle));
}

if (id !== visualizationIdFromUrl) {
history.replace({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import { parse } from 'query-string';
import { i18n } from '@kbn/i18n';

import { getVisualizationInstance } from '../get_visualization_instance';
import { getEditBreadcrumbs, getCreateBreadcrumbs } from '../breadcrumbs';
import {
getEditBreadcrumbs,
getCreateBreadcrumbs,
getCreateServerlessBreadcrumbs,
getEditServerlessBreadcrumbs,
} from '../breadcrumbs';
import { SavedVisInstance, VisualizeServices, IEditorController } from '../../types';
import { VisualizeConstants } from '../../../../common/constants';
import { getTypes } from '../../../services';
Expand Down Expand Up @@ -46,6 +51,7 @@ export const useSavedVisInstance = (
stateTransferService,
visEditorsRegistry,
application: { navigateToApp },
serverless,
} = services;
const getSavedVisInstance = async () => {
try {
Expand Down Expand Up @@ -104,18 +110,35 @@ export const useSavedVisInstance = (
const redirectToOrigin = originatingApp ? () => navigateToApp(originatingApp) : undefined;

if (savedVis.id) {
chrome.setBreadcrumbs(
getEditBreadcrumbs({ originatingAppName, redirectToOrigin }, savedVis.title)
);
if (serverless?.setBreadcrumbs) {
serverless.setBreadcrumbs(
getEditServerlessBreadcrumbs({ originatingAppName, redirectToOrigin }, savedVis.title)
);
} else {
chrome.setBreadcrumbs(
getEditBreadcrumbs({ originatingAppName, redirectToOrigin }, savedVis.title)
);
}

chrome.docTitle.change(savedVis.title);
} else {
chrome.setBreadcrumbs(
getCreateBreadcrumbs({
byValue: Boolean(originatingApp),
originatingAppName,
redirectToOrigin,
})
);
if (serverless?.setBreadcrumbs) {
serverless.setBreadcrumbs(
getCreateServerlessBreadcrumbs({
byValue: Boolean(originatingApp),
originatingAppName,
redirectToOrigin,
})
);
} else {
chrome.setBreadcrumbs(
getCreateBreadcrumbs({
byValue: Boolean(originatingApp),
originatingAppName,
redirectToOrigin,
})
);
}
}

let visEditorController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useEffect, useRef, useState } from 'react';
import { VisualizeInput } from '../../..';
import { ByValueVisInstance, VisualizeServices, IEditorController } from '../../types';
import { getVisualizationInstanceFromInput } from '../get_visualization_instance';
import { getEditBreadcrumbs } from '../breadcrumbs';
import { getEditBreadcrumbs, getEditServerlessBreadcrumbs } from '../breadcrumbs';

export const useVisByValue = (
services: VisualizeServices,
Expand All @@ -33,6 +33,7 @@ export const useVisByValue = (
application: { navigateToApp },
stateTransferService,
visEditorsRegistry,
serverless,
} = services;
const getVisInstance = async () => {
if (!valueInput || loaded.current || !visEditorRef.current) {
Expand All @@ -59,9 +60,16 @@ export const useVisByValue = (
const redirectToOrigin = originatingApp
? () => navigateToApp(originatingApp, { path: originatingPath })
: undefined;
chrome?.setBreadcrumbs(
getEditBreadcrumbs({ byValue: true, originatingAppName, redirectToOrigin })
);

if (serverless?.setBreadcrumbs) {
serverless.setBreadcrumbs(
getEditServerlessBreadcrumbs({ byValue: true, originatingAppName, redirectToOrigin })
);
} else {
chrome?.setBreadcrumbs(
getEditBreadcrumbs({ byValue: true, originatingAppName, redirectToOrigin })
);
}

loaded.current = true;
setState({
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/visualizations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"@kbn/content-management-table-list-view-table",
"@kbn/content-management-tabbed-table-list-view",
"@kbn/content-management-table-list-view",
"@kbn/content-management-utils"
"@kbn/content-management-utils",
"@kbn/serverless"
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { apmLabsButton } from '@kbn/observability-plugin/common';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { ObservabilityAIAssistantActionMenuItem } from '@kbn/observability-ai-assistant-plugin/public';
import { getAlertingCapabilities } from '../../../alerting/utils/get_alerting_capabilities';
import { getLegacyApmHref } from '../../../shared/links/apm/apm_link';
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
Expand Down Expand Up @@ -96,6 +97,7 @@ export function ApmHeaderActionMenu() {
})}
</EuiHeaderLink>
<InspectorHeaderLink />
<ObservabilityAIAssistantActionMenuItem />
</EuiHeaderLinks>
);
}
Loading

0 comments on commit da684e2

Please sign in to comment.