Skip to content

Commit 563526a

Browse files
Merge branch 'master' into adding-space-aware-jobs
2 parents 35a981a + a49473b commit 563526a

File tree

15 files changed

+105
-78
lines changed

15 files changed

+105
-78
lines changed

src/plugins/discover/kibana.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"urlForwarding",
1313
"navigation",
1414
"uiActions",
15-
"visualizations",
1615
"savedObjects"
1716
],
1817
"optionalPlugins": ["home", "share"],

src/plugins/discover/public/application/angular/discover.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ const {
6565
timefilter,
6666
toastNotifications,
6767
uiSettings: config,
68-
visualizations,
6968
} = getServices();
7069

7170
import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../helpers/breadcrumbs';
@@ -874,11 +873,11 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
874873
inspectorRequest.stats(getResponseInspectorStats(resp, $scope.searchSource)).ok({ json: resp });
875874

876875
if (getTimeField()) {
877-
const tabifiedData = tabifyAggResponse($scope.vis.data.aggs, resp);
876+
const tabifiedData = tabifyAggResponse($scope.opts.chartAggConfigs, resp);
878877
$scope.searchSource.rawResponse = resp;
879878
$scope.histogramData = discoverResponseHandler(
880879
tabifiedData,
881-
getDimensions($scope.vis.data.aggs.aggs, $scope.timeRange)
880+
getDimensions($scope.opts.chartAggConfigs.aggs, $scope.timeRange)
882881
);
883882
$scope.updateTime();
884883
}
@@ -1045,27 +1044,19 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
10451044
},
10461045
},
10471046
];
1048-
1049-
$scope.vis = await visualizations.createVis('histogram', {
1050-
title: savedSearch.title,
1051-
params: {
1052-
addLegend: false,
1053-
addTimeMarker: true,
1054-
},
1055-
data: {
1056-
aggs: visStateAggs,
1057-
searchSource: $scope.searchSource.getSerializedFields(),
1058-
},
1059-
});
1047+
$scope.opts.chartAggConfigs = data.search.aggs.createAggConfigs(
1048+
$scope.indexPattern,
1049+
visStateAggs
1050+
);
10601051

10611052
$scope.searchSource.onRequestStart((searchSource, options) => {
1062-
if (!$scope.vis) return;
1063-
return $scope.vis.data.aggs.onSearchRequestStart(searchSource, options);
1053+
if (!$scope.opts.chartAggConfigs) return;
1054+
return $scope.opts.chartAggConfigs.onSearchRequestStart(searchSource, options);
10641055
});
10651056

10661057
$scope.searchSource.setField('aggs', function () {
1067-
if (!$scope.vis) return;
1068-
return $scope.vis.data.aggs.toDsl();
1058+
if (!$scope.opts.chartAggConfigs) return;
1059+
return $scope.opts.chartAggConfigs.toDsl();
10691060
});
10701061
}
10711062

src/plugins/discover/public/application/angular/discover_legacy.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
top-nav-menu="topNavMenu"
3131
update-query="handleRefresh"
3232
update-saved-query-id="updateSavedQueryId"
33-
vis="vis"
3433
>
3534
</discover-legacy>
3635
</discover-app>

src/plugins/discover/public/application/components/create_discover_legacy_directive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,5 @@ export function createDiscoverLegacyDirective(reactDirective: any) {
5151
['topNavMenu', { watchDepth: 'reference' }],
5252
['updateQuery', { watchDepth: 'reference' }],
5353
['updateSavedQueryId', { watchDepth: 'reference' }],
54-
['vis', { watchDepth: 'reference' }],
5554
]);
5655
}

src/plugins/discover/public/application/components/discover_legacy.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ import {
3939
Query,
4040
IndexPatternAttributes,
4141
DataPublicPluginStart,
42+
AggConfigs,
4243
} from '../../../../data/public';
4344
import { Chart } from '../angular/helpers/point_series';
4445
import { AppState } from '../angular/discover_state';
4546
import { SavedSearch } from '../../saved_searches';
4647

4748
import { SavedObject } from '../../../../../core/types';
48-
import { Vis } from '../../../../visualizations/public';
4949
import { TopNavMenuData } from '../../../../navigation/public';
5050

5151
export interface DiscoverLegacyProps {
@@ -66,14 +66,15 @@ export interface DiscoverLegacyProps {
6666
onSkipBottomButtonClick: () => void;
6767
onSort: (sort: string[][]) => void;
6868
opts: {
69-
savedSearch: SavedSearch;
69+
chartAggConfigs?: AggConfigs;
7070
config: IUiSettingsClient;
71+
data: DataPublicPluginStart;
72+
fixedScroll: (el: HTMLElement) => void;
7173
indexPatternList: Array<SavedObject<IndexPatternAttributes>>;
72-
timefield: string;
7374
sampleSize: number;
74-
fixedScroll: (el: HTMLElement) => void;
75+
savedSearch: SavedSearch;
7576
setHeaderActionMenu: (menuMount: MountPoint | undefined) => void;
76-
data: DataPublicPluginStart;
77+
timefield: string;
7778
};
7879
resetQuery: () => void;
7980
resultState: string;
@@ -87,7 +88,6 @@ export interface DiscoverLegacyProps {
8788
topNavMenu: TopNavMenuData[];
8889
updateQuery: (payload: { dateRange: TimeRange; query?: Query }, isUpdate?: boolean) => void;
8990
updateSavedQueryId: (savedQueryId?: string) => void;
90-
vis?: Vis;
9191
}
9292

9393
export function DiscoverLegacy({
@@ -119,12 +119,11 @@ export function DiscoverLegacy({
119119
topNavMenu,
120120
updateQuery,
121121
updateSavedQueryId,
122-
vis,
123122
}: DiscoverLegacyProps) {
124123
const [isSidebarClosed, setIsSidebarClosed] = useState(false);
125124
const { TopNavMenu } = getServices().navigation.ui;
126125
const { savedSearch, indexPatternList } = opts;
127-
const bucketAggConfig = vis?.data?.aggs?.aggs[1];
126+
const bucketAggConfig = opts.chartAggConfigs?.aggs[1];
128127
const bucketInterval =
129128
bucketAggConfig && search.aggs.isDateHistogramBucketAggConfig(bucketAggConfig)
130129
? bucketAggConfig.buckets?.getInterval()
@@ -242,7 +241,7 @@ export function DiscoverLegacy({
242241
})}
243242
className="dscTimechart"
244243
>
245-
{vis && rows.length !== 0 && (
244+
{opts.chartAggConfigs && rows.length !== 0 && (
246245
<div className="dscHistogram" data-test-subj="discoverChart">
247246
<DiscoverHistogram
248247
chartData={histogramData}

src/plugins/discover/public/build_services.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/public';
3737
import { SharePluginStart } from 'src/plugins/share/public';
3838
import { ChartsPluginStart } from 'src/plugins/charts/public';
39-
import { VisualizationsStart } from 'src/plugins/visualizations/public';
4039

4140
import { DiscoverStartPlugins } from './plugin';
4241
import { createSavedSearchesLoader, SavedSearch } from './saved_searches';
@@ -68,7 +67,6 @@ export interface DiscoverServices {
6867
getSavedSearchUrlById: (id: string) => Promise<string>;
6968
getEmbeddableInjector: any;
7069
uiSettings: IUiSettingsClient;
71-
visualizations: VisualizationsStart;
7270
}
7371

7472
export async function buildServices(
@@ -108,6 +106,5 @@ export async function buildServices(
108106
timefilter: plugins.data.query.timefilter.timefilter,
109107
toastNotifications: core.notifications.toasts,
110108
uiSettings: core.uiSettings,
111-
visualizations: plugins.visualizations,
112109
};
113110
}

src/plugins/discover/public/plugin.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { EmbeddableStart, EmbeddableSetup } from 'src/plugins/embeddable/public'
3535
import { ChartsPluginStart } from 'src/plugins/charts/public';
3636
import { NavigationPublicPluginStart as NavigationStart } from 'src/plugins/navigation/public';
3737
import { SharePluginStart, SharePluginSetup, UrlGeneratorContract } from 'src/plugins/share/public';
38-
import { VisualizationsStart, VisualizationsSetup } from 'src/plugins/visualizations/public';
3938
import { KibanaLegacySetup, KibanaLegacyStart } from 'src/plugins/kibana_legacy/public';
4039
import { UrlForwardingSetup, UrlForwardingStart } from 'src/plugins/url_forwarding/public';
4140
import { HomePublicPluginSetup } from 'src/plugins/home/public';
@@ -123,7 +122,6 @@ export interface DiscoverSetupPlugins {
123122
kibanaLegacy: KibanaLegacySetup;
124123
urlForwarding: UrlForwardingSetup;
125124
home?: HomePublicPluginSetup;
126-
visualizations: VisualizationsSetup;
127125
data: DataPublicPluginSetup;
128126
}
129127

@@ -140,7 +138,6 @@ export interface DiscoverStartPlugins {
140138
kibanaLegacy: KibanaLegacyStart;
141139
urlForwarding: UrlForwardingStart;
142140
inspector: InspectorPublicPluginStart;
143-
visualizations: VisualizationsStart;
144141
savedObjects: SavedObjectsStart;
145142
}
146143

x-pack/plugins/ingest_manager/common/constants/epm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export const requiredPackages = {
1414
Endpoint: 'endpoint',
1515
} as const;
1616

17+
export const agentAssetTypes = {
18+
Input: 'input',
19+
} as const;
20+
1721
export const dataTypes = {
1822
Logs: 'logs',
1923
Metrics: 'metrics',

x-pack/plugins/ingest_manager/common/types/models/epm.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// Follow pattern from https://github.com/elastic/kibana/pull/52447
88
// TODO: Update when https://github.com/elastic/kibana/issues/53021 is closed
99
import { SavedObject, SavedObjectAttributes, SavedObjectReference } from 'src/core/public';
10-
import { dataTypes, requiredPackages } from '../../constants';
10+
import { agentAssetTypes, dataTypes, requiredPackages } from '../../constants';
11+
import { ValueOf } from '../../types';
1112

1213
export enum InstallationStatus {
1314
installed = 'installed',
@@ -27,7 +28,8 @@ export type EpmPackageInstallStatus = 'installed' | 'installing';
2728

2829
export type DetailViewPanelName = 'overview' | 'usages' | 'settings';
2930
export type ServiceName = 'kibana' | 'elasticsearch';
30-
export type AssetType = KibanaAssetType | ElasticsearchAssetType | AgentAssetType;
31+
export type AgentAssetType = typeof agentAssetTypes;
32+
export type AssetType = KibanaAssetType | ElasticsearchAssetType | ValueOf<AgentAssetType>;
3133

3234
export enum KibanaAssetType {
3335
dashboard = 'dashboard',
@@ -47,10 +49,6 @@ export enum ElasticsearchAssetType {
4749

4850
export type DataType = typeof dataTypes;
4951

50-
export enum AgentAssetType {
51-
input = 'input',
52-
}
53-
5452
export type RegistryRelease = 'ga' | 'beta' | 'experimental';
5553

5654
// Fields common to packages that come from direct upload and the registry

x-pack/plugins/lens/public/app_plugin/mounter.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ export async function mountApp(
151151
trackUiEvent('loaded_404');
152152
return <FormattedMessage id="xpack.lens.app404" defaultMessage="404 Not Found" />;
153153
}
154+
// dispatch synthetic hash change event to update hash history objects
155+
// this is necessary because hash updates triggered by using popState won't trigger this event naturally.
156+
const unlistenParentHistory = params.history.listen(() => {
157+
window.dispatchEvent(new HashChangeEvent('hashchange'));
158+
});
154159

155160
params.element.classList.add('lnsAppWrapper');
156161
render(
@@ -171,5 +176,6 @@ export async function mountApp(
171176
return () => {
172177
instance.unmount();
173178
unmountComponentAtNode(params.element);
179+
unlistenParentHistory();
174180
};
175181
}

0 commit comments

Comments
 (0)