Skip to content

Commit 84de299

Browse files
Merge branch 'master' into dev/search-server-session-wip
2 parents 14f47c3 + 51f75a5 commit 84de299

93 files changed

Lines changed: 1849 additions & 804 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/developer/plugin/migrating-legacy-plugins-examples.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,9 @@ The most significant changes on the Kibana side for the consumers are the follow
902902
===== User client accessor
903903
Internal /current user client accessors has been renamed and are now
904904
properties instead of functions:
905-
** `callAsInternalUser('ping')` -> `asInternalUser.ping()`
906-
** `callAsCurrentUser('ping')` -> `asCurrentUser.ping()`
905+
906+
* `callAsInternalUser('ping')` -> `asInternalUser.ping()`
907+
* `callAsCurrentUser('ping')` -> `asCurrentUser.ping()`
907908
* the API now reflects the `Client`’s instead of leveraging the
908909
string-based endpoint names the `LegacyAPICaller` was using.
909910

src/cli/cluster/cluster_manager.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ export class ClusterManager {
7373
this.inReplMode = !!opts.repl;
7474
this.basePathProxy = basePathProxy;
7575

76+
if (!this.basePathProxy) {
77+
this.log.warn(
78+
'===================================================================================================='
79+
);
80+
this.log.warn(
81+
'no-base-path',
82+
'Running Kibana in dev mode with --no-base-path disables several useful features and is not recommended'
83+
);
84+
this.log.warn(
85+
'===================================================================================================='
86+
);
87+
}
88+
7689
// run @kbn/optimizer and write it's state to kbnOptimizerReady$
7790
if (opts.disableOptimizer) {
7891
this.kbnOptimizerReady$.next(true);

src/core/server/http/base_path_proxy_server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,13 @@ export class BasePathProxyServer {
199199
const isGet = request.method === 'get';
200200
const isBasepathLike = oldBasePath.length === 3;
201201

202+
const newUrl = Url.format({
203+
pathname: `${this.httpConfig.basePath}/${kbnPath}`,
204+
query: request.query,
205+
});
206+
202207
return isGet && isBasepathLike && shouldRedirectFromOldBasePath(kbnPath)
203-
? responseToolkit.redirect(`${this.httpConfig.basePath}/${kbnPath}`)
208+
? responseToolkit.redirect(newUrl)
204209
: responseToolkit.response('Not Found').code(404);
205210
},
206211
method: '*',

src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ kibana_vars=(
166166
xpack.code.security.gitProtocolWhitelist
167167
xpack.encryptedSavedObjects.encryptionKey
168168
xpack.encryptedSavedObjects.keyRotation.decryptionOnlyKeys
169+
xpack.fleet.agents.elasticsearch.host
170+
xpack.fleet.agents.kibana.host
171+
xpack.fleet.agents.tlsCheckDisabled
169172
xpack.graph.enabled
170173
xpack.graph.canEditDrillDownUrls
171174
xpack.graph.savePolicy

src/plugins/dashboard/public/application/actions/add_to_library_action.test.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,17 @@ test('Add to library is not compatible when embeddable is not in a dashboard con
137137
test('Add to library replaces embeddableId and retains panel count', async () => {
138138
const dashboard = embeddable.getRoot() as IContainer;
139139
const originalPanelCount = Object.keys(dashboard.getInput().panels).length;
140+
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
140141

141142
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
142143
await action.execute({ embeddable });
143144
expect(Object.keys(container.getInput().panels).length).toEqual(originalPanelCount);
144-
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
145-
const newPanel = container.getInput().panels[embeddable.id!];
145+
146+
const newPanelId = Object.keys(container.getInput().panels).find(
147+
(key) => !originalPanelKeySet.has(key)
148+
);
149+
expect(newPanelId).toBeDefined();
150+
const newPanel = container.getInput().panels[newPanelId!];
146151
expect(newPanel.type).toEqual(embeddable.type);
147152
});
148153

@@ -158,10 +163,15 @@ test('Add to library returns reference type input', async () => {
158163
mockedByReferenceInput: { savedObjectId: 'testSavedObjectId', id: embeddable.id },
159164
mockedByValueInput: { attributes: complicatedAttributes, id: embeddable.id } as EmbeddableInput,
160165
});
166+
const dashboard = embeddable.getRoot() as IContainer;
167+
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
161168
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
162169
await action.execute({ embeddable });
163-
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
164-
const newPanel = container.getInput().panels[embeddable.id!];
170+
const newPanelId = Object.keys(container.getInput().panels).find(
171+
(key) => !originalPanelKeySet.has(key)
172+
);
173+
expect(newPanelId).toBeDefined();
174+
const newPanel = container.getInput().panels[newPanelId!];
165175
expect(newPanel.type).toEqual(embeddable.type);
166176
expect(newPanel.explicitInput.attributes).toBeUndefined();
167177
expect(newPanel.explicitInput.savedObjectId).toBe('testSavedObjectId');

src/plugins/dashboard/public/application/actions/add_to_library_action.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import { i18n } from '@kbn/i18n';
2121
import _ from 'lodash';
22-
import uuid from 'uuid';
2322
import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
2423
import { ViewMode, PanelState, IEmbeddable } from '../../embeddable_plugin';
2524
import {
@@ -89,9 +88,9 @@ export class AddToLibraryAction implements ActionByType<typeof ACTION_ADD_TO_LIB
8988

9089
const newPanel: PanelState<EmbeddableInput> = {
9190
type: embeddable.type,
92-
explicitInput: { ...newInput, id: uuid.v4() },
91+
explicitInput: { ...newInput },
9392
};
94-
dashboard.replacePanel(panelToReplace, newPanel);
93+
dashboard.replacePanel(panelToReplace, newPanel, true);
9594

9695
const title = i18n.translate('dashboard.panel.addToLibrary.successMessage', {
9796
defaultMessage: `Panel '{panelTitle}' was added to the visualize library`,

src/plugins/dashboard/public/application/actions/unlink_from_library_action.test.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,16 @@ test('Unlink is not compatible when embeddable is not in a dashboard container',
135135
test('Unlink replaces embeddableId and retains panel count', async () => {
136136
const dashboard = embeddable.getRoot() as IContainer;
137137
const originalPanelCount = Object.keys(dashboard.getInput().panels).length;
138+
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
138139
const action = new UnlinkFromLibraryAction({ toasts: coreStart.notifications.toasts });
139140
await action.execute({ embeddable });
140141
expect(Object.keys(container.getInput().panels).length).toEqual(originalPanelCount);
141-
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
142-
const newPanel = container.getInput().panels[embeddable.id!];
142+
143+
const newPanelId = Object.keys(container.getInput().panels).find(
144+
(key) => !originalPanelKeySet.has(key)
145+
);
146+
expect(newPanelId).toBeDefined();
147+
const newPanel = container.getInput().panels[newPanelId!];
143148
expect(newPanel.type).toEqual(embeddable.type);
144149
});
145150

@@ -159,10 +164,15 @@ test('Unlink unwraps all attributes from savedObject', async () => {
159164
mockedByReferenceInput: { savedObjectId: 'testSavedObjectId', id: embeddable.id },
160165
mockedByValueInput: { attributes: complicatedAttributes, id: embeddable.id },
161166
});
167+
const dashboard = embeddable.getRoot() as IContainer;
168+
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
162169
const action = new UnlinkFromLibraryAction({ toasts: coreStart.notifications.toasts });
163170
await action.execute({ embeddable });
164-
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
165-
const newPanel = container.getInput().panels[embeddable.id!];
171+
const newPanelId = Object.keys(container.getInput().panels).find(
172+
(key) => !originalPanelKeySet.has(key)
173+
);
174+
expect(newPanelId).toBeDefined();
175+
const newPanel = container.getInput().panels[newPanelId!];
166176
expect(newPanel.type).toEqual(embeddable.type);
167177
expect(newPanel.explicitInput.attributes).toEqual(complicatedAttributes);
168178
});

src/plugins/dashboard/public/application/actions/unlink_from_library_action.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import { i18n } from '@kbn/i18n';
2121
import _ from 'lodash';
22-
import uuid from 'uuid';
2322
import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
2423
import { ViewMode, PanelState, IEmbeddable } from '../../embeddable_plugin';
2524
import {
@@ -88,9 +87,9 @@ export class UnlinkFromLibraryAction implements ActionByType<typeof ACTION_UNLIN
8887

8988
const newPanel: PanelState<EmbeddableInput> = {
9089
type: embeddable.type,
91-
explicitInput: { ...newInput, id: uuid.v4() },
90+
explicitInput: { ...newInput },
9291
};
93-
dashboard.replacePanel(panelToReplace, newPanel);
92+
dashboard.replacePanel(panelToReplace, newPanel, true);
9493

9594
const title = embeddable.getTitle()
9695
? i18n.translate('dashboard.panel.unlinkFromLibrary.successMessageWithTitle', {

src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,30 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
173173

174174
public replacePanel(
175175
previousPanelState: DashboardPanelState<EmbeddableInput>,
176-
newPanelState: Partial<PanelState>
176+
newPanelState: Partial<PanelState>,
177+
generateNewId?: boolean
177178
) {
178-
// Because the embeddable type can change, we have to operate at the container level here
179-
return this.updateInput({
180-
panels: {
179+
let panels;
180+
if (generateNewId) {
181+
// replace panel can be called with generateNewId in order to totally destroy and recreate the embeddable
182+
panels = { ...this.input.panels };
183+
delete panels[previousPanelState.explicitInput.id];
184+
const newId = uuid.v4();
185+
panels[newId] = {
186+
...previousPanelState,
187+
...newPanelState,
188+
gridData: {
189+
...previousPanelState.gridData,
190+
i: newId,
191+
},
192+
explicitInput: {
193+
...newPanelState.explicitInput,
194+
id: newId,
195+
},
196+
};
197+
} else {
198+
// Because the embeddable type can change, we have to operate at the container level here
199+
panels = {
181200
...this.input.panels,
182201
[previousPanelState.explicitInput.id]: {
183202
...previousPanelState,
@@ -190,7 +209,11 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
190209
id: previousPanelState.explicitInput.id,
191210
},
192211
},
193-
},
212+
};
213+
}
214+
215+
return this.updateInput({
216+
panels,
194217
lastReloadRequestTime: new Date().getTime(),
195218
});
196219
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
260260
if (!_.isEqual(newStatePartial, oldStatePartial)) {
261261
$scope.$evalAsync(async () => {
262262
if (oldStatePartial.index !== newStatePartial.index) {
263-
//in case of index switch the route has currently to be reloaded, legacy
263+
//in case of index pattern switch the route has currently to be reloaded, legacy
264+
$route.reload();
264265
return;
265266
}
266267

@@ -305,8 +306,7 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
305306
$scope.state.sort,
306307
config.get(MODIFY_COLUMNS_ON_SWITCH)
307308
);
308-
await replaceUrlAppState(nextAppState);
309-
$route.reload();
309+
await setAppState(nextAppState);
310310
}
311311
};
312312

0 commit comments

Comments
 (0)