Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into implement/typ…
Browse files Browse the repository at this point in the history
…escript
  • Loading branch information
spalger committed May 17, 2018
2 parents e3231ee + 0ad665f commit bd0f4e1
Show file tree
Hide file tree
Showing 44 changed files with 576 additions and 161 deletions.
Binary file modified docs/images/tsvb-gauge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tsvb-markdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tsvb-metric.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tsvb-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tsvb-timeseries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tsvb-top-n.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion docs/visualize/time-series-visual-builder.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image:images/tsvb-screenshot.png["Time Series Visual Builder Interface"]

=== Featured Visualizations

Time Series Visual Build comes with 5 different visualization types. You can
Time Series Visual Build comes with 6 different visualization types. You can
switch between each visualization type using the tabbed picker at the top of the
interface.

Expand Down Expand Up @@ -65,6 +65,14 @@ template syntax to customize the Markdown with data based on a set of series.
image:images/tsvb-markdown.png["Markdown Visualization"]


==== Table

A table visualization allows you to display data from multiple time series.
You define which field group to show in the rows and what columns of data to display.

image:images/tsvb-table.png["Table Visualization"]


=== Interface Overview

The user interface for each visualization is compose of a "Data" tab and "Panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ function initContext(file, config) {
}

function tryNodeResolver(importRequest, file, config) {
return nodeResolver.resolve(importRequest, file, {
...config,
extensions: ['.js', '.json', '.ts', '.tsx'],
isFile,
});
return nodeResolver.resolve(
importRequest,
file,
// we use Object.assign so that this file is compatible with slightly older
// versions of node.js used by IDEs (eg. resolvers are run in the Electron
// process in Atom)
Object.assign({}, config, {
extensions: ['.js', '.json', '.ts', '.tsx'],
isFile,
})
);
}

exports.resolve = function resolveKibanaPath(importRequest, file, config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,6 @@ uiModules
self.searchSource.size(0);

return self.vis ? self._updateVis() : self._createVis();
})
.then(function () {
self.searchSource.onRequestStart((searchSource, searchRequest) => {
return self.vis.onSearchRequestStart(searchSource, searchRequest);
});

self.searchSource.aggs(function () {
return self.vis.aggs.toDsl();
});

return self;
});
};

Expand Down
1 change: 1 addition & 0 deletions src/ui/public/vis/editors/default/agg.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
aria-label="Disable aggregation"
tooltip="Disable aggregation"
tooltip-append-to-body="true"
data-test-subj="disableAggregationBtn"
type="button"
class="kuiButton kuiButton--basic kuiButton--small">
<i aria-hidden="true" class="fa fa-toggle-on"></i>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/vis/editors/default/agg_group.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<div ng-class="groupName" draggable-container="group" class="vis-editor-agg-group">
<!-- wrapper needed for nesting-indicator -->
<div ng-repeat="agg in group track by agg.id" draggable-item="agg" class="vis-editor-agg-wrapper">
<div ng-repeat="agg in group track by agg.id" data-test-subj="aggregationEditor{{agg.id}}" draggable-item="agg" class="vis-editor-agg-wrapper">
<!-- agg.html - controls for aggregation -->
<ng-form vis-editor-agg name="aggForm" class="vis-editor-agg"></ng-form>
</div>
Expand Down
12 changes: 10 additions & 2 deletions src/ui/public/vis/request_handlers/courier.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ const CourierRequestHandlerProvider = function (Private, courier, timefilter) {
}
});

requestSearchSource.aggs(function () {
return vis.getAggConfig().toDsl();
});

requestSearchSource.onRequestStart((searchSource, searchRequest) => {
return vis.onSearchRequestStart(searchSource, searchRequest);
});

// Add the explicit passed timeRange as a filter to the requestSearchSource.
requestSearchSource.filter(() => {
return timefilter.get(searchSource.index(), timeRange);
Expand All @@ -77,7 +85,7 @@ const CourierRequestHandlerProvider = function (Private, courier, timefilter) {
if (!searchSource.lastQuery || vis.reload) return true;
if (!_.isEqual(_.cloneDeep(searchSource.get('filter')), searchSource.lastQuery.filter)) return true;
if (!_.isEqual(_.cloneDeep(searchSource.get('query')), searchSource.lastQuery.query)) return true;
if (!_.isEqual(calculateObjectHash(vis.aggs.getRequestAggs()), searchSource.lastQuery.aggs)) return true;
if (!_.isEqual(calculateObjectHash(vis.getAggConfig()), searchSource.lastQuery.aggs)) return true;
if (!_.isEqual(_.cloneDeep(timeRange), searchSource.lastQuery.timeRange)) return true;

return false;
Expand All @@ -90,7 +98,7 @@ const CourierRequestHandlerProvider = function (Private, courier, timefilter) {
searchSource.lastQuery = {
filter: _.cloneDeep(searchSource.get('filter')),
query: _.cloneDeep(searchSource.get('query')),
aggs: calculateObjectHash(vis.aggs.getRequestAggs()),
aggs: calculateObjectHash(vis.getAggConfig()),
timeRange: _.cloneDeep(timeRange)
};

Expand Down
23 changes: 21 additions & 2 deletions test/functional/apps/visualize/_vertical_bar_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function ({ getService, getPageObjects }) {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

beforeEach(function () {
const initBarChart = () => {
log.debug('navigateToApp visualize');
return PageObjects.common.navigateToUrl('visualize', 'new')
.then(function () {
Expand Down Expand Up @@ -45,11 +45,13 @@ export default function ({ getService, getPageObjects }) {
.then(function waitForVisualization() {
return PageObjects.visualize.waitForVisualization();
});
});
};

describe('vertical bar chart', function indexPatternCreation() {
const vizName1 = 'Visualization VerticalBarChart';

before(initBarChart);

it('should save and load', function () {
return PageObjects.visualize.saveVisualization(vizName1)
.then(() => {
Expand Down Expand Up @@ -120,6 +122,8 @@ export default function ({ getService, getPageObjects }) {
});

describe('vertical bar with split series', function () {
before(initBarChart);

it('should show correct series', async function () {
await PageObjects.visualize.toggleOpenEditor(2, 'false');
await PageObjects.visualize.clickAddBucket();
Expand All @@ -139,6 +143,8 @@ export default function ({ getService, getPageObjects }) {
});

describe('vertical bar with multiple splits', function () {
before(initBarChart);

it('should show correct series', async function () {
await PageObjects.visualize.toggleOpenEditor(2, 'false');
await PageObjects.visualize.clickAddBucket();
Expand Down Expand Up @@ -166,9 +172,21 @@ export default function ({ getService, getPageObjects }) {
const legendEntries = await PageObjects.visualize.getLegendEntries();
expect(legendEntries).to.eql(expectedEntries);
});

it('should show correct series when disabling first agg', async function () {
await PageObjects.visualize.toggleDisabledAgg(3);
await PageObjects.visualize.clickGo();
await PageObjects.header.waitUntilLoadingHasFinished();

const expectedEntries = [ 'win 8', 'win xp', 'ios', 'osx', 'win 7' ];
const legendEntries = await PageObjects.visualize.getLegendEntries();
expect(legendEntries).to.eql(expectedEntries);
});
});

describe('vertical bar with derivative', function () {
before(initBarChart);

it('should show correct series', async function () {
await PageObjects.visualize.toggleOpenEditor(2, 'false');
await PageObjects.visualize.toggleOpenEditor(1);
Expand All @@ -186,6 +204,7 @@ export default function ({ getService, getPageObjects }) {
const legendEntries = await PageObjects.visualize.getLegendEntries();
expect(legendEntries).to.eql(expectedEntries);
});

});
});
}
4 changes: 4 additions & 0 deletions test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
await input.type(newValue);
}

async toggleDisabledAgg(agg) {
await testSubjects.click(`aggregationEditor${agg} disableAggregationBtn`);
}

async toggleOtherBucket() {
return await find.clickByCssSelector('input[name="showOther"]');
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import 'plugins/ml/explorer';
import 'plugins/ml/timeseriesexplorer';
import 'plugins/ml/components/form_label';
import 'plugins/ml/components/json_tooltip';
import 'plugins/ml/components/tooltip';
import 'plugins/ml/components/confirm_modal';
import 'plugins/ml/components/nav_menu';
import 'plugins/ml/components/loading_indicator';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<div class="ml-field-data-card">
<div class="euiText title-bar" ng-class="card.fieldName===undefined ? 'document_count': card.isUnsupportedType===true ? 'type-other' : card.type">
<ml-field-type-icon
type="card.type"
tooltip="{{ card.type }}"
tooltip-placement="left"
tooltip-append-to-body="true">
</ml-field-type-icon>
type="card.type"
tooltip-enabled="true"
/>
<div
class="field-name"
tooltip="{{ mlEscape(card.fieldName) || 'document count' }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FieldTypeIcon render component inside tooltip wrapper 1`] = `
<EuiToolTip
content="keyword"
position="left"
>
<span>
<FieldTypeIconContainer
ariaLabel="Aggregatable string field"
className="field-type-icon"
iconChar="t"
/>
</span>
</EuiToolTip>
`;

exports[`FieldTypeIcon render component when type matches a field type 1`] = `
<FieldTypeIconContainer
ariaLabel="Aggregatable string field"
className="field-type-icon"
iconChar="t"
/>
`;

exports[`FieldTypeIcon update component 1`] = `
<FieldTypeIconContainer
ariaLabel="Aggregatable string field"
className="field-type-icon"
iconChar="t"
/>
`;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,38 @@



import template from './field_type_icon.html';
import { ML_JOB_FIELD_TYPES } from 'plugins/ml/../common/constants/field_types';
import React from 'react';
import ReactDOM from 'react-dom';

import { FieldTypeIcon } from './field_type_icon_view.js';

import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/ml');

module.directive('mlFieldTypeIcon', function () {
return {
restrict: 'E',
replace: true,
replace: false,
scope: {
tooltipEnabled: '=',
type: '='
},
template,
controller: function ($scope) {
$scope.ML_JOB_FIELD_TYPES = ML_JOB_FIELD_TYPES;
link: function (scope, element) {
scope.$watch('type', updateComponent);

updateComponent();

function updateComponent() {
const props = {
tooltipEnabled: scope.tooltipEnabled,
type: scope.type
};

ReactDOM.render(
React.createElement(FieldTypeIcon, props),
element[0]
);
}
}
};
});
Loading

0 comments on commit bd0f4e1

Please sign in to comment.