Skip to content

Commit

Permalink
[Rollups] Rollup support in Kibana, phase 1 (elastic#21117)
Browse files Browse the repository at this point in the history
Enabled:
- View/Manage/Create rollup jobs

Disabled:
- Create a rollup index pattern
- Create rollup visualizations
- Add rollup visualizations to dashboards
- View raw rollup documents in Discover
  • Loading branch information
cjcenizal committed Oct 25, 2018
1 parent c4534b6 commit 54e8136
Show file tree
Hide file tree
Showing 258 changed files with 12,108 additions and 364 deletions.
6 changes: 6 additions & 0 deletions src/core_plugins/kibana/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
},
"title": {
"type": "text"
},
"type": {
"type": "keyword"
},
"typeMeta": {
"type": "keyword"
}
}
},
Expand Down
14 changes: 10 additions & 4 deletions src/core_plugins/kibana/public/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,17 @@ function discoverController(
.setField('highlightAll', true)
.setField('version', true);

// Even when searching rollups, we want to use the default strategy so that we get back a
// document-like response.
$scope.searchSource.setPreferredSearchStrategyId('default');

// searchSource which applies time range
const timeRangeSearchSource = savedSearch.searchSource.create();
timeRangeSearchSource.setField('filter', () => {
return timefilter.createFilter($scope.indexPattern);
});
if(isDefaultTypeIndexPattern($scope.indexPattern)) {
timeRangeSearchSource.setField('filter', () => {
return timefilter.createFilter($scope.indexPattern);
});
}

$scope.searchSource.setParent(timeRangeSearchSource);

Expand Down Expand Up @@ -393,7 +399,7 @@ function discoverController(
$scope.opts = {
// number of records to fetch, then paginate through
sampleSize: config.get('discover:sampleSize'),
timefield: $scope.indexPattern.timeFieldName,
timefield: isDefaultTypeIndexPattern($scope.indexPattern) && $scope.indexPattern.timeFieldName,
savedSearch: savedSearch,
indexPatternList: $route.current.locals.ip.list,
};
Expand Down
1 change: 1 addition & 0 deletions src/core_plugins/kibana/public/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import 'uiExports/fieldFormatEditors';
import 'uiExports/navbarExtensions';
import 'uiExports/contextMenuActions';
import 'uiExports/managementSections';
import 'uiExports/indexManagement';
import 'uiExports/devTools';
import 'uiExports/docViews';
import 'uiExports/embeddableFactories';
Expand Down
5 changes: 3 additions & 2 deletions src/core_plugins/kibana/public/management/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

@import 'hacks';

// Core
// Core
@import 'management_app';
@import 'sections/settings/advanced_settings';
@import 'sections/settings/advanced_settings';
@import 'sections/indices/index';
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
exports[`CreateIndexPatternWizard defaults to the loading state 1`] = `
<div>
<Header
indexPatternName="name"
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<LoadingState />
</div>
Expand All @@ -13,8 +15,10 @@ exports[`CreateIndexPatternWizard defaults to the loading state 1`] = `
exports[`CreateIndexPatternWizard renders index pattern step when there are indices 1`] = `
<div>
<Header
indexPatternName="name"
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={
Expand All @@ -26,6 +30,16 @@ exports[`CreateIndexPatternWizard renders index pattern step when there are indi
}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
initialQuery=""
isIncludingSystemIndices={false}
savedObjectsClient={Object {}}
Expand All @@ -36,8 +50,10 @@ exports[`CreateIndexPatternWizard renders index pattern step when there are indi
exports[`CreateIndexPatternWizard renders the empty state when there are no indices 1`] = `
<div>
<Header
indexPatternName="name"
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<EmptyState
onRefresh={[Function]}
Expand All @@ -48,13 +64,25 @@ exports[`CreateIndexPatternWizard renders the empty state when there are no indi
exports[`CreateIndexPatternWizard renders time field step when step is set to 2 1`] = `
<div>
<Header
indexPatternName="name"
isIncludingSystemIndices={false}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepTimeField
createIndexPattern={[Function]}
goToPreviousStep={[Function]}
indexPattern=""
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
indexPatternsService={Object {}}
/>
</div>
Expand All @@ -63,8 +91,10 @@ exports[`CreateIndexPatternWizard renders time field step when step is set to 2
exports[`CreateIndexPatternWizard shows system indices even if there are no other indices if the include system indices is toggled 1`] = `
<div>
<Header
indexPatternName="name"
isIncludingSystemIndices={true}
onChangeIncludingSystemIndices={[Function]}
showSystemIndices={false}
/>
<StepIndexPattern
allIndices={
Expand All @@ -76,6 +106,16 @@ exports[`CreateIndexPatternWizard shows system indices even if there are no othe
}
esService={Object {}}
goToNextStep={[Function]}
indexPatternCreationType={
Object {
"checkIndicesForErrors": [Function],
"getIndexPatternMappings": [Function],
"getIndexPatternName": [Function],
"getIndexPatternType": [Function],
"getShowSystemIndices": [Function],
"renderPrompt": [Function],
}
}
initialQuery=""
isIncludingSystemIndices={true}
savedObjectsClient={Object {}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ import React from 'react';
import { shallow } from 'enzyme';

import { CreateIndexPatternWizard } from '../create_index_pattern_wizard';

const mockIndexPatternCreationType = {
getIndexPatternType: () => 'default',
getIndexPatternName: () => 'name',
checkIndicesForErrors: () => false,
getShowSystemIndices: () => false,
renderPrompt: () => {},
getIndexPatternMappings: () => { return {}; }
};
jest.mock('../components/step_index_pattern', () => ({ StepIndexPattern: 'StepIndexPattern' }));
jest.mock('../components/step_time_field', () => ({ StepTimeField: 'StepTimeField' }));
jest.mock('../components/header', () => ({ Header: 'Header' }));
Expand All @@ -44,6 +51,7 @@ const services = {
config: {},
changeUrl: () => {},
scopeApply: () => {},
indexPatternCreationType: mockIndexPatternCreationType,
};

describe('CreateIndexPatternWizard', () => {
Expand Down Expand Up @@ -154,6 +162,7 @@ describe('CreateIndexPatternWizard', () => {
cache: { clear }
},
changeUrl,
indexPatternCreationType: mockIndexPatternCreationType
}}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('CreateIndexPatternWizardRender', () => {
savedObjectsClient: {},
config: {},
changeUrl: () => {},
indexPatternCreationType: {},
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ exports[`Header should render normally 1`] = `
>
<h1>
<FormattedMessage
defaultMessage="Create index pattern"
defaultMessage="Create {indexPatternName}"
id="kbn.management.createIndexPatternHeader"
values={Object {}}
values={
Object {
"indexPatternName": undefined,
}
}
/>
</h1>
</EuiTitle>
Expand Down Expand Up @@ -46,23 +50,6 @@ exports[`Header should render normally 1`] = `
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiSwitch
checked={true}
id="checkboxShowSystemIndices"
label={
<FormattedMessage
defaultMessage="Include system indices"
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
values={Object {}}
/>
}
onChange={[Function]}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer
size="m"
Expand All @@ -80,9 +67,13 @@ exports[`Header should render without including system indices 1`] = `
>
<h1>
<FormattedMessage
defaultMessage="Create index pattern"
defaultMessage="Create {indexPatternName}"
id="kbn.management.createIndexPatternHeader"
values={Object {}}
values={
Object {
"indexPatternName": undefined,
}
}
/>
</h1>
</EuiTitle>
Expand Down Expand Up @@ -116,23 +107,6 @@ exports[`Header should render without including system indices 1`] = `
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiSwitch
checked={false}
id="checkboxShowSystemIndices"
label={
<FormattedMessage
defaultMessage="Include system indices"
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
values={Object {}}
/>
}
onChange={[Function]}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer
size="m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import React from 'react';
import React, { Fragment } from 'react';

import {
EuiSpacer,
Expand All @@ -32,6 +32,9 @@ import {
import { FormattedMessage } from '@kbn/i18n/react';

export const Header = ({
prompt,
indexPatternName,
showSystemIndices,
isIncludingSystemIndices,
onChangeIncludingSystemIndices,
}) => (
Expand All @@ -41,7 +44,10 @@ export const Header = ({
<h1>
<FormattedMessage
id="kbn.management.createIndexPatternHeader"
defaultMessage="Create index pattern"
defaultMessage="Create {indexPatternName}"
values={{
indexPatternName
}}
/>
</h1>
</EuiTitle>
Expand All @@ -58,18 +64,30 @@ export const Header = ({
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiSwitch
label={<FormattedMessage
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
defaultMessage="Include system indices"
/>}
id="checkboxShowSystemIndices"
checked={isIncludingSystemIndices}
onChange={onChangeIncludingSystemIndices}
/>
</EuiFlexItem>
{
showSystemIndices ? (
<EuiFlexItem grow={false}>
<EuiSwitch
label={<FormattedMessage
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
defaultMessage="Include system indices"
/>}
id="checkboxShowSystemIndices"
checked={isIncludingSystemIndices}
onChange={onChangeIncludingSystemIndices}
/>
</EuiFlexItem>
) : null
}
</EuiFlexGroup>
{
prompt ? (
<Fragment>
<EuiSpacer size="s" />
{prompt}
</Fragment>
) : null
}
<EuiSpacer size="m"/>
</div>
);
Loading

0 comments on commit 54e8136

Please sign in to comment.