Skip to content

Commit 1c21b76

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into move-alerts-to-siem
2 parents 1787b24 + 1006c31 commit 1c21b76

File tree

26 files changed

+1154
-181
lines changed

26 files changed

+1154
-181
lines changed

rfcs/text/0011_global_search.md

Lines changed: 591 additions & 0 deletions
Large diffs are not rendered by default.

src/cli/cluster/run_kbn_optimizer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function runKbnOptimizer(opts: Record<string, any>, config: LegacyConfig)
3535
repoRoot: REPO_ROOT,
3636
watch: true,
3737
includeCoreBundle: true,
38+
cache: !!opts.cache,
3839
oss: !!opts.oss,
3940
examples: !!opts.runExamples,
4041
pluginPaths: config.get('plugins.paths'),

src/cli/serve/serve.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export default function(program) {
218218
"Don't put a proxy in front of the dev server, which adds a random basePath"
219219
)
220220
.option('--no-watch', 'Prevents automatic restarts of the server in --dev mode')
221+
.option('--no-cache', 'Disable the kbn/optimizer cache')
221222
.option('--no-dev-config', 'Prevents loading the kibana.dev.yml file in --dev mode');
222223
}
223224

src/core/public/application/ui/app_container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export const AppContainer: FunctionComponent<Props> = ({
8787
})) || null;
8888
} catch (e) {
8989
// TODO: add error UI
90+
// eslint-disable-next-line no-console
91+
console.error(e);
9092
} finally {
9193
setShowSpinner(false);
9294
setIsMounting(false);

test/functional/apps/dashboard/dashboard_clone.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ export default function({ getService, getPageObjects }) {
4242
await PageObjects.dashboard.clickClone();
4343
await PageObjects.dashboard.confirmClone();
4444
await PageObjects.dashboard.gotoDashboardLandingPage();
45-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
46-
'dashboard',
47-
clonedDashboardName
48-
);
49-
50-
expect(countOfDashboards).to.equal(1);
45+
await listingTable.searchAndExpectItemsCount('dashboard', clonedDashboardName, 1);
5146
});
5247

5348
it('the copy should have all the same visualizations', async function() {
@@ -75,11 +70,7 @@ export default function({ getService, getPageObjects }) {
7570
await PageObjects.dashboard.cancelClone();
7671
await PageObjects.dashboard.gotoDashboardLandingPage();
7772

78-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
79-
'dashboard',
80-
dashboardName
81-
);
82-
expect(countOfDashboards).to.equal(1);
73+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1);
8374
});
8475

8576
it('Clones on confirm duplicate title warning', async function() {
@@ -92,11 +83,7 @@ export default function({ getService, getPageObjects }) {
9283
await PageObjects.dashboard.waitForRenderComplete();
9384
await PageObjects.dashboard.gotoDashboardLandingPage();
9485

95-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
96-
'dashboard',
97-
dashboardName + ' Copy'
98-
);
99-
expect(countOfDashboards).to.equal(2);
86+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName + ' Copy', 2);
10087
});
10188
});
10289
}

test/functional/apps/dashboard/dashboard_listing.js

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ export default function({ getService, getPageObjects }) {
4242
await PageObjects.dashboard.saveDashboard(dashboardName);
4343

4444
await PageObjects.dashboard.gotoDashboardLandingPage();
45-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
46-
'dashboard',
47-
dashboardName
48-
);
49-
expect(countOfDashboards).to.equal(1);
45+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1);
5046
});
5147

5248
it('is not shown when there is a dashboard', async function() {
@@ -55,11 +51,7 @@ export default function({ getService, getPageObjects }) {
5551
});
5652

5753
it('is not shown when there are no dashboards shown during a search', async function() {
58-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
59-
'dashboard',
60-
'gobeldeguck'
61-
);
62-
expect(countOfDashboards).to.equal(0);
54+
await listingTable.searchAndExpectItemsCount('dashboard', 'gobeldeguck', 0);
6355

6456
const promptExists = await PageObjects.dashboard.getCreateDashboardPromptExists();
6557
expect(promptExists).to.be(false);
@@ -78,11 +70,7 @@ export default function({ getService, getPageObjects }) {
7870

7971
await PageObjects.common.expectConfirmModalOpenState(false);
8072

81-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
82-
'dashboard',
83-
dashboardName
84-
);
85-
expect(countOfDashboards).to.equal(1);
73+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1);
8674
});
8775

8876
it('succeeds on confirmation press', async function() {
@@ -91,11 +79,7 @@ export default function({ getService, getPageObjects }) {
9179

9280
await PageObjects.common.clickConfirmOnModal();
9381

94-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
95-
'dashboard',
96-
dashboardName
97-
);
98-
expect(countOfDashboards).to.equal(0);
82+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 0);
9983
});
10084
});
10185

@@ -109,38 +93,32 @@ export default function({ getService, getPageObjects }) {
10993

11094
it('matches on the first word', async function() {
11195
await listingTable.searchForItemWithName('Two');
112-
const countOfDashboards = await listingTable.getItemsCount('dashboard');
113-
expect(countOfDashboards).to.equal(1);
96+
await listingTable.expectItemsCount('dashboard', 1);
11497
});
11598

11699
it('matches the second word', async function() {
117100
await listingTable.searchForItemWithName('Words');
118-
const countOfDashboards = await listingTable.getItemsCount('dashboard');
119-
expect(countOfDashboards).to.equal(1);
101+
await listingTable.expectItemsCount('dashboard', 1);
120102
});
121103

122104
it('matches the second word prefix', async function() {
123105
await listingTable.searchForItemWithName('Wor');
124-
const countOfDashboards = await listingTable.getItemsCount('dashboard');
125-
expect(countOfDashboards).to.equal(1);
106+
await listingTable.expectItemsCount('dashboard', 1);
126107
});
127108

128109
it('does not match mid word', async function() {
129110
await listingTable.searchForItemWithName('ords');
130-
const countOfDashboards = await listingTable.getItemsCount('dashboard');
131-
expect(countOfDashboards).to.equal(0);
111+
await listingTable.expectItemsCount('dashboard', 0);
132112
});
133113

134114
it('is case insensitive', async function() {
135115
await listingTable.searchForItemWithName('two words');
136-
const countOfDashboards = await listingTable.getItemsCount('dashboard');
137-
expect(countOfDashboards).to.equal(1);
116+
await listingTable.expectItemsCount('dashboard', 1);
138117
});
139118

140119
it('is using AND operator', async function() {
141120
await listingTable.searchForItemWithName('three words');
142-
const countOfDashboards = await listingTable.getItemsCount('dashboard');
143-
expect(countOfDashboards).to.equal(0);
121+
await listingTable.expectItemsCount('dashboard', 0);
144122
});
145123
});
146124

test/functional/apps/dashboard/dashboard_save.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
import expect from '@kbn/expect';
21-
2220
export default function({ getPageObjects, getService }) {
2321
const PageObjects = getPageObjects(['dashboard', 'header']);
2422
const listingTable = getService('listingTable');
@@ -50,11 +48,7 @@ export default function({ getPageObjects, getService }) {
5048
await PageObjects.dashboard.cancelSave();
5149
await PageObjects.dashboard.gotoDashboardLandingPage();
5250

53-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
54-
'dashboard',
55-
dashboardName
56-
);
57-
expect(countOfDashboards).to.equal(1);
51+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1);
5852
});
5953

6054
it('Saves on confirm duplicate title warning', async function() {
@@ -73,11 +67,7 @@ export default function({ getPageObjects, getService }) {
7367
await PageObjects.header.waitUntilLoadingHasFinished();
7468
await PageObjects.dashboard.gotoDashboardLandingPage();
7569

76-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
77-
'dashboard',
78-
dashboardName
79-
);
80-
expect(countOfDashboards).to.equal(2);
70+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 2);
8171
});
8272

8373
it('Does not warn when you save an existing dashboard with the title it already has, and that title is a duplicate', async function() {
@@ -128,11 +118,7 @@ export default function({ getPageObjects, getService }) {
128118
await PageObjects.header.waitUntilLoadingHasFinished();
129119
await PageObjects.dashboard.gotoDashboardLandingPage();
130120

131-
const countOfDashboards = await listingTable.searchAndGetItemsCount(
132-
'dashboard',
133-
dashboardNameEnterKey
134-
);
135-
expect(countOfDashboards).to.equal(1);
121+
await listingTable.searchAndExpectItemsCount('dashboard', dashboardNameEnterKey, 1);
136122
});
137123
});
138124
}

test/functional/apps/visualize/_point_series_options.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,17 @@ export default function({ getService, getPageObjects }) {
341341
log.debug('close inspector');
342342
await inspector.close();
343343
});
344+
345+
after(async () => {
346+
const timezone = await kibanaServer.uiSettings.get('dateFormat:tz');
347+
348+
// make sure the timezone was set to default correctly to avoid further failures
349+
// for details see https://github.com/elastic/kibana/issues/63037
350+
if (timezone !== 'UTC') {
351+
log.debug("set 'dateFormat:tz': 'UTC'");
352+
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' });
353+
}
354+
});
344355
});
345356
});
346357
}

test/functional/apps/visualize/_visualize_listing.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
import expect from '@kbn/expect';
21-
2220
export default function({ getService, getPageObjects }) {
2321
const PageObjects = getPageObjects(['visualize', 'visEditor']);
2422
const listingTable = getService('listingTable');
@@ -37,21 +35,18 @@ export default function({ getService, getPageObjects }) {
3735
// type markdown is used for simplicity
3836
await PageObjects.visualize.createSimpleMarkdownViz(vizName);
3937
await PageObjects.visualize.gotoVisualizationLandingPage();
40-
const visCount = await listingTable.getItemsCount('visualize');
41-
expect(visCount).to.equal(1);
38+
await listingTable.expectItemsCount('visualize', 1);
4239
});
4340

4441
it('delete all viz', async function() {
4542
await PageObjects.visualize.createSimpleMarkdownViz(vizName + '1');
4643
await PageObjects.visualize.createSimpleMarkdownViz(vizName + '2');
4744
await PageObjects.visualize.gotoVisualizationLandingPage();
4845

49-
let visCount = await listingTable.getItemsCount('visualize');
50-
expect(visCount).to.equal(3);
46+
await listingTable.expectItemsCount('visualize', 3);
5147

5248
await PageObjects.visualize.deleteAllVisualizations();
53-
visCount = await listingTable.getItemsCount('visualize');
54-
expect(visCount).to.equal(0);
49+
await listingTable.expectItemsCount('visualize', 0);
5550
});
5651
});
5752

@@ -69,38 +64,32 @@ export default function({ getService, getPageObjects }) {
6964

7065
it('matches on the first word', async function() {
7166
await listingTable.searchForItemWithName('Hello');
72-
const itemCount = await listingTable.getItemsCount('visualize');
73-
expect(itemCount).to.equal(1);
67+
await listingTable.expectItemsCount('visualize', 1);
7468
});
7569

7670
it('matches the second word', async function() {
7771
await listingTable.searchForItemWithName('World');
78-
const itemCount = await listingTable.getItemsCount('visualize');
79-
expect(itemCount).to.equal(1);
72+
await listingTable.expectItemsCount('visualize', 1);
8073
});
8174

8275
it('matches the second word prefix', async function() {
8376
await listingTable.searchForItemWithName('Wor');
84-
const itemCount = await listingTable.getItemsCount('visualize');
85-
expect(itemCount).to.equal(1);
77+
await listingTable.expectItemsCount('visualize', 1);
8678
});
8779

8880
it('does not match mid word', async function() {
8981
await listingTable.searchForItemWithName('orld');
90-
const itemCount = await listingTable.getItemsCount('visualize');
91-
expect(itemCount).to.equal(0);
82+
await listingTable.expectItemsCount('visualize', 0);
9283
});
9384

9485
it('is case insensitive', async function() {
9586
await listingTable.searchForItemWithName('hello world');
96-
const itemCount = await listingTable.getItemsCount('visualize');
97-
expect(itemCount).to.equal(1);
87+
await listingTable.expectItemsCount('visualize', 1);
9888
});
9989

10090
it('is using AND operator', async function() {
10191
await listingTable.searchForItemWithName('hello banana');
102-
const itemCount = await listingTable.getItemsCount('visualize');
103-
expect(itemCount).to.equal(0);
92+
await listingTable.expectItemsCount('visualize', 0);
10493
});
10594
});
10695
});

test/functional/services/listing_table.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919

20+
import expect from '@kbn/expect';
2021
import { FtrProviderContext } from '../ftr_provider_context';
2122

2223
export function ListingTableProvider({ getService, getPageObjects }: FtrProviderContext) {
@@ -85,11 +86,13 @@ export function ListingTableProvider({ getService, getPageObjects }: FtrProvider
8586
* Returns items count on landing page
8687
* @param appName 'visualize' | 'dashboard'
8788
*/
88-
public async getItemsCount(appName: 'visualize' | 'dashboard'): Promise<number> {
89-
const elements = await find.allByCssSelector(
90-
`[data-test-subj^="${prefixMap[appName]}ListingTitleLink"]`
91-
);
92-
return elements.length;
89+
public async expectItemsCount(appName: 'visualize' | 'dashboard', count: number) {
90+
await retry.try(async () => {
91+
const elements = await find.allByCssSelector(
92+
`[data-test-subj^="${prefixMap[appName]}ListingTitleLink"]`
93+
);
94+
expect(elements.length).to.equal(count);
95+
});
9396
}
9497

9598
/**
@@ -116,12 +119,18 @@ export function ListingTableProvider({ getService, getPageObjects }: FtrProvider
116119
* @param appName 'visualize' | 'dashboard'
117120
* @param name item name
118121
*/
119-
public async searchAndGetItemsCount(appName: 'visualize' | 'dashboard', name: string) {
122+
public async searchAndExpectItemsCount(
123+
appName: 'visualize' | 'dashboard',
124+
name: string,
125+
count: number
126+
) {
120127
await this.searchForItemWithName(name);
121-
const links = await testSubjects.findAll(
122-
`${prefixMap[appName]}ListingTitleLink-${name.replace(/ /g, '-')}`
123-
);
124-
return links.length;
128+
await retry.try(async () => {
129+
const links = await testSubjects.findAll(
130+
`${prefixMap[appName]}ListingTitleLink-${name.replace(/ /g, '-')}`
131+
);
132+
expect(links.length).to.equal(count);
133+
});
125134
}
126135

127136
public async clickDeleteSelected() {

0 commit comments

Comments
 (0)