Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into alerting/intr…
Browse files Browse the repository at this point in the history
…o-alerting-plugin
  • Loading branch information
mikecote committed May 6, 2019
2 parents c5f48ef + fe2cd66 commit 75c0145
Show file tree
Hide file tree
Showing 73 changed files with 626 additions and 447 deletions.
10 changes: 4 additions & 6 deletions docs/dashboard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ Kibana home page.
. In the side navigation, click *Dashboard*.
. Click *Create new dashboard.*
. Click *Add*.

[[adding-visualizations-to-a-dashboard]]
. Use *Add Panels* to add visualizations and saved searches to the dashboard.
If you have a large number of visualizations, you can filter the lists.
. [[adding-visualizations-to-a-dashboard]]Use *Add Panels* to add visualizations
and saved searches to the dashboard. If you have a large number of
visualizations, you can filter the lists.
+
[role="screenshot"]
image:images/Dashboard_add_visualization.png[Example add visualization to dashboard]

[[saving-dashboards]]
. When you're finished adding and arranging the panels,
. [[saving-dashboards]]When you're finished adding and arranging the panels,
go to the menu bar and click *Save*.

. In *Save Dashboard*, enter a dashboard title and optionally a description.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import { setupUsers, DEFAULT_SUPERUSER_PASS } from './auth';
export async function runElasticsearch({ config, options }) {
const { log, esFrom } = options;
const license = config.get('esTestCluster.license');
const isTrialLicense = config.get('esTestCluster.license') === 'trial';
const esArgs = config.get('esTestCluster.serverArgs');
const isSecurityEnabled = esArgs.includes('xpack.security.enabled=true');

const cluster = createEsTestCluster({
port: config.get('servers.elasticsearch.port'),
password: isTrialLicense
password: isSecurityEnabled
? DEFAULT_SUPERUSER_PASS
: config.get('servers.elasticsearch.password'),
license,
Expand All @@ -40,11 +41,9 @@ export async function runElasticsearch({ config, options }) {
dataArchive: config.get('esTestCluster.dataArchive'),
});

const esArgs = config.get('esTestCluster.serverArgs');

await cluster.start(esArgs);

if (isTrialLicense) {
if (isSecurityEnabled) {
await setupUsers(log, config.get('servers.elasticsearch.port'), [
config.get('servers.elasticsearch'),
config.get('servers.kibana'),
Expand Down
4 changes: 4 additions & 0 deletions src/legacy/server/status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export function statusMixin(kbnServer, server, config) {
});
oppsy.start(config.get('ops.interval'));

server.events.on('stop', () => {
oppsy.stop();
});

// init routes
registerStatusPage(kbnServer, server, config);
registerStatusApi(kbnServer, server, config);
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/dashboard/create_and_add_embeddables.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.clickNewSearch();
await PageObjects.visualize.saveVisualizationExpectSuccess('visualization from add new link');

return retry.try(async () => {
await retry.try(async () => {
const panelCount = await PageObjects.dashboard.getPanelCount();
expect(panelCount).to.eql(originalPanelCount + 1);
});
await PageObjects.dashboard.waitForRenderComplete();
});

it('saves the saved visualization url to the app link', async () => {
Expand Down
7 changes: 2 additions & 5 deletions test/functional/apps/dashboard/dashboard_clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.clickClone();

await PageObjects.dashboard.confirmClone();
await PageObjects.dashboard.expectDuplicateTitleWarningDisplayed({ displayed: true });
await PageObjects.dashboard.confirmClone();

// This is important since saving a new dashboard will cause a refresh of the page. We have to
// wait till it finishes reloading or it might reload the url after simulating the
// dashboard landing page click.
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.dashboard.waitForRenderComplete();

const countOfDashboards =
await PageObjects.dashboard.getDashboardCountWithName(dashboardName + ' Copy');
Expand Down
6 changes: 5 additions & 1 deletion test/functional/page_objects/common_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,11 @@ export function CommonPageProvider({ getService, getPageObjects }) {
}

async getBodyText() {
const el = await find.byCssSelector('body>pre');
if (await find.existsByCssSelector('a[id=rawdata-tab]')) {
// Firefox has 3 tabs and requires navigation to see Raw output
await find.clickByCssSelector('a[id=rawdata-tab]');
}
const el = await find.byCssSelector('body pre');
return await el.getVisibleText();
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/functional/page_objects/settings_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
}

async clickIndexPatternLogstash() {
await find.clickByPartialLinkText('logstash-*');
const indexLink = await find.byXPath(`//a[descendant::*[text()='logstash-*']]`);
await indexLink.click();
}

async createIndexPattern(indexPatternName, timefield = '@timestamp') {
Expand Down
11 changes: 5 additions & 6 deletions test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,12 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
}

async getGaugeValue() {
const elements = await find.allByCssSelector('[data-test-subj="visualizationLoader"] .chart svg');
const elements = await find.allByCssSelector('[data-test-subj="visualizationLoader"] .chart svg text');
const values = await Promise.all(elements.map(async element => {
const text = await element.getVisibleText();
return text.split('\n');
return text;
}));
// .flat() replacement
return values.reduce((acc, val) => [...acc, ...val], []);
return values.filter(item => item.length > 0);
}

async clickMetricEditor() {
Expand Down Expand Up @@ -678,10 +677,10 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
const lastRow = await table.findByCssSelector('tr:last-child');
const fromCell = await lastRow.findByCssSelector('td:first-child input');
await fromCell.clearValue();
await fromCell.type(`${from}`);
await fromCell.type(`${from}`, { charByChar: true });
const toCell = await lastRow.findByCssSelector('td:nth-child(2) input');
await toCell.clearValue();
await toCell.type(`${to}`);
await toCell.type(`${to}`, { charByChar: true });
}

async clickYAxisOptions(axisId) {
Expand Down
8 changes: 8 additions & 0 deletions test/functional/services/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ export async function FindProvider({ getService }: FtrProviderContext) {
return wrap(await driver.wait(until.elementLocated(By.css(selector)), timeout));
}

public async byXPath(
selector: string,
timeout: number = defaultFindTimeout
): Promise<WebElementWrapper> {
log.debug(`Find.byXPath('${selector}') with timeout=${timeout}`);
return wrap(await driver.wait(until.elementLocated(By.xpath(selector)), timeout));
}

public async byClassName(
selector: string,
timeout: number = defaultFindTimeout
Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/test_subjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function TestSubjectsProvider({ getService }: FtrProviderContext) {
log.debug(`TestSubjects.doubleClick(${selector})`);
const element = await this.find(selector, timeout);
await element.moveMouseTo();
await browser.doubleClick();
await browser.doubleClick(element);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { get, map } from 'lodash';
// @ts-ignore untyped Elastic library
import { getType } from '@kbn/interpreter/common';
import { Style, Ticks, DatatableColumn, AxisConfig, isAxisConfig } from '../../types';
import { Style, Ticks, AxisConfig, isAxisConfig, PointSeriesColumns } from '../../types';

type Position = 'bottom' | 'top' | 'left' | 'right';
interface Config {
Expand All @@ -22,7 +22,7 @@ interface Config {
}

interface Options {
columns?: DatatableColumn[];
columns?: PointSeriesColumns;
ticks?: Ticks;
font?: Style | {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import { get, sortBy } from 'lodash';
import { DatatableColumn, DatatableRow, DatatableColumnType, Ticks } from '../../types';
import { PointSeriesColumns, DatatableRow, Ticks } from '../../types';

export const getTickHash = (columns: DatatableColumn[], rows: DatatableRow[]) => {
export const getTickHash = (columns: PointSeriesColumns, rows: DatatableRow[]) => {
const ticks: Ticks = {
x: {
hash: {},
Expand All @@ -19,7 +19,7 @@ export const getTickHash = (columns: DatatableColumn[], rows: DatatableRow[]) =>
},
};

if (get<DatatableColumn[], DatatableColumnType>(columns, 'x.type') === 'string') {
if (get(columns, 'x.type') === 'string') {
sortBy(rows, ['x']).forEach(row => {
if (!ticks.x.hash[row.x]) {
ticks.x.hash[row.x] = ticks.x.counter++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
Style,
Palette,
Legend,
DatatableColumn,
} from '../../types';

interface Arguments {
Expand Down Expand Up @@ -110,16 +109,8 @@ export function plot(): ContextFunction<'plot', PointSeries, Arguments, Render<a
text?: string;
} = {};

const x =
get<DatatableColumn[], DatatableColumn['type']>(context.columns, 'x.type') ===
'string'
? ticks.x.hash[point.x]
: point.x;
const y =
get<DatatableColumn[], DatatableColumn['type']>(context.columns, 'y.type') ===
'string'
? ticks.y.hash[point.y]
: point.y;
const x = get(context.columns, 'x.type') === 'string' ? ticks.x.hash[point.x] : point.x;
const y = get(context.columns, 'y.type') === 'string' ? ticks.y.hash[point.y] : point.y;

if (point.size != null) {
attrs.size = point.size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
*/

import { sortBy } from 'lodash';
// @ts-ignore
import { queryDatatable } from '../../../../common/lib/datatable/query';
// @ts-ignore
import { getDemoRows } from './get_demo_rows';
import { ContextFunction, Filter, Datatable, DatatableColumn, DatatableRow } from '../../types';

export function demodata() {
interface Arguments {
type: string | null;
}

export function demodata(): ContextFunction<'demodata', Filter, Arguments, Datatable> {
return {
name: 'demodata',
aliases: [],
Expand All @@ -29,7 +36,8 @@ export function demodata() {
fn: (context, args) => {
const demoRows = getDemoRows(args.type);

let set = {};
let set = {} as { columns: DatatableColumn[]; rows: DatatableRow[] };

if (args.type === 'ci') {
set = {
columns: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

// @ts-ignore untyped local
import { demodata } from './demodata';
import { escount } from './escount';
import { esdocs } from './esdocs';
// @ts-ignore untyped local
import { pointseries } from './pointseries';
import { server } from './server';
import { essql } from './essql';
Expand Down
Loading

0 comments on commit 75c0145

Please sign in to comment.