Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/update esdocs datasource #59512

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
48dcefa
Initial Commit
maggieghamry Mar 5, 2020
361e8f2
Updates
maggieghamry Mar 6, 2020
6ea9917
Updates II
maggieghamry Mar 6, 2020
352213a
Merge branch 'master' of https://github.com/elastic/kibana into enhan…
maggieghamry Mar 6, 2020
cb85a63
Updates III
maggieghamry Mar 7, 2020
ef3032e
design tweaks
ryankeairns Mar 9, 2020
bc60acb
Merge pull request #2 from ryankeairns/enhancement/update-esdocs-data…
maggieghamry Mar 9, 2020
c1b4884
Adding lucene hyperlink
maggieghamry Mar 9, 2020
2062873
Consollidating datasources to sort
maggieghamry Mar 9, 2020
f4d0074
updates for i18n
maggieghamry Mar 9, 2020
fd77af2
Updates
maggieghamry Mar 17, 2020
b88fd32
Update ui.ts
maggieghamry Mar 17, 2020
6a37a62
Updates for datasource order
maggieghamry Mar 17, 2020
a55d3d8
Update datasource_component.js
maggieghamry Mar 17, 2020
bcecfcb
Update ui.ts
maggieghamry Mar 18, 2020
cd7e713
Update ui.ts
maggieghamry Mar 18, 2020
c96a4b0
Update to Timelion URL
maggieghamry Mar 18, 2020
80f646c
Update ui.ts
maggieghamry Mar 18, 2020
5779d30
Update ui.ts
maggieghamry Mar 18, 2020
f49e3ca
Update ui.ts
maggieghamry Mar 18, 2020
af4694d
Merge branch 'master' into enhancement/update-esdocs-datasource
elasticmachine Mar 18, 2020
7e458a5
i18n updates
maggieghamry Mar 18, 2020
aea06b4
Merge branch 'enhancement/update-esdocs-datasource' of https://github…
maggieghamry Mar 18, 2020
8840013
Merge branch 'master' into enhancement/update-esdocs-datasource
elasticmachine Mar 18, 2020
178704e
Updates
maggieghamry Mar 18, 2020
000ea33
Merge branch 'enhancement/update-esdocs-datasource' of https://github…
maggieghamry Mar 18, 2020
0f4fb1f
Update timelion.js
maggieghamry Mar 18, 2020
5bdb2c1
More i18n updates
maggieghamry Mar 18, 2020
e44347f
Update datasource_component.js
maggieghamry Mar 18, 2020
ba95628
Update ui.ts
maggieghamry Mar 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export const demodata = () => ({
name: 'demodata',
displayName: strings.getDisplayName(),
help: strings.getHelp(),
image: 'logoElasticStack',
image: 'training',
template: templateFromReactComponent(DemodataDatasource),
});
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export const essql = () => ({
name: 'essql',
displayName: strings.getDisplayName(),
help: strings.getHelp(),
// Replace this with a SQL logo when we have one in EUI
image: 'logoElasticsearch',
image: 'database',
template: templateFromReactComponent(EssqlDatasource),
});
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ export const timelion = () => ({
name: 'timelion',
displayName: TIMELION,
help: strings.getHelp(),
image: 'timelionApp',
image: 'visTimelion',
template: templateFromReactComponent(TimelionDatasource),
});
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/canvas/i18n/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const JS = 'JavaScript';
export const JSON = 'JSON';
export const KIBANA = 'Kibana';
export const LUCENE = 'Lucene';
export const LUCENE_QUERY_URL = 'https://www.elastic.co/guide/en/kibana/current/lucene-query.html';
export const MARKDOWN = 'Markdown';
export const MOMENTJS = 'MomentJS';
export const MOMENTJS_TIMEZONE_URL = 'https://momentjs.com/timezone/';
Expand Down
84 changes: 0 additions & 84 deletions x-pack/legacy/plugins/canvas/i18n/expression_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { i18n } from '@kbn/i18n';
import { LUCENE, ELASTICSEARCH } from './constants';

export const ArgTypesStrings = {
Color: {
Expand Down Expand Up @@ -143,86 +142,3 @@ export const ArgTypesStrings = {
}),
},
};

export const ExpressionDataSourceStrings = {
ESDocs: {
getDisplayName: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocsTitle', {
defaultMessage: 'Elasticsearch raw documents',
}),
getHelp: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocsLabel', {
defaultMessage: 'Pull back raw documents from elasticsearch',
}),
getWarningTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.warningTitle', {
defaultMessage: 'Query with caution',
}),
getWarning: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.warningDescription', {
defaultMessage: `
This datasource pulls directly from {elasticsearch}
without the use of aggregations. It is best used with low volume datasets and in
situations where you need to view raw documents or plot exact, non-aggregated values on a
chart.`,
values: {
elasticsearch: ELASTICSEARCH,
},
}),
getIndexTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.indexTitle', {
defaultMessage: 'Index',
}),
getIndexLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.indexLabel', {
defaultMessage: 'Enter an index name or select an index pattern',
}),
getQueryTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.queryTitle', {
defaultMessage: 'Query',
}),
getQueryLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.queryLabel', {
defaultMessage: '{lucene} query string syntax',
values: {
lucene: LUCENE,
},
}),
getSortFieldTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortFieldTitle', {
defaultMessage: 'Sort Field',
}),
getSortFieldLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortFieldLabel', {
defaultMessage: 'Document sort field',
}),
getSortOrderTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortOrderTitle', {
defaultMessage: 'Sort Order',
}),
getSortOrderLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortOrderLabel', {
defaultMessage: 'Document sort order',
}),
getFieldsTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.fieldsTitle', {
defaultMessage: 'Fields',
}),
getFieldsLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.fieldsLabel', {
defaultMessage: 'The fields to extract. Kibana scripted fields are not currently available',
}),
getFieldsWarningLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.fieldsWarningLabel', {
defaultMessage: 'This datasource performs best with 10 or fewer fields',
}),
getAscendingOption: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.ascendingDropDown', {
defaultMessage: 'Ascending',
}),
getDescendingOption: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.descendingDropDown', {
defaultMessage: 'Descending',
}),
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DemoRows } from '../../../canvas_plugin_src/functions/server/demodata/g
export const help: FunctionHelp<FunctionFactory<typeof demodata>> = {
help: i18n.translate('xpack.canvas.functions.demodataHelpText', {
defaultMessage:
'A mock data set that includes project {ci} times with usernames, countries, and run phases.',
'A sample data set that includes project {ci} times with usernames, countries, and run phases.',
maggieghamry marked this conversation as resolved.
Show resolved Hide resolved
values: {
ci: 'CI',
},
Expand Down
89 changes: 83 additions & 6 deletions x-pack/legacy/plugins/canvas/i18n/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export const ArgumentStrings = {
};

export const DataSourceStrings = {
// Demo data source
maggieghamry marked this conversation as resolved.
Show resolved Hide resolved
DemoData: {
getDisplayName: () =>
i18n.translate('xpack.canvas.uis.dataSources.demoDataTitle', {
Expand All @@ -319,7 +320,7 @@ export const DataSourceStrings = {
}),
getHelp: () =>
i18n.translate('xpack.canvas.uis.dataSources.demoDataLabel', {
defaultMessage: 'Mock data set with usernames, prices, projects, countries, and phases',
defaultMessage: 'Sample data set used to populate default elements',
}),
getDescription: () =>
i18n.translate('xpack.canvas.uis.dataSources.demoDataDescription', {
Expand All @@ -330,6 +331,82 @@ export const DataSourceStrings = {
},
}),
},
// Elasticsearch documents datasource
ESDocs: {
getDisplayName: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocsTitle', {
defaultMessage: 'Elasticsearch documents',
}),
getHelp: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocsLabel', {
defaultMessage: 'Select an index and field(s) to retrieve non-aggregated data',
}),
getWarningTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.warningTitle', {
defaultMessage: 'Query with caution',
}),
getWarning: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.warningDescription', {
defaultMessage: `
The Elasticsearch basic data source only retrieves non-aggregated data. Use with low volume data sets`,
}),
getIndexTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.indexTitle', {
defaultMessage: 'Index',
}),
getIndexLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.indexLabel', {
defaultMessage: 'Enter an index name or select an index pattern',
}),
getQueryTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.queryTitle', {
defaultMessage: 'Query',
}),
getQueryLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.queryLabel', {
defaultMessage: 'Lucene query string syntax',
values: {
lucene: LUCENE,
},
}),
getSortFieldTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortFieldTitle', {
defaultMessage: 'Sort field',
}),
getSortFieldLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortFieldLabel', {
defaultMessage: 'Document sort field',
}),
getSortOrderTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortOrderTitle', {
defaultMessage: 'Sort order',
}),
getSortOrderLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.sortOrderLabel', {
defaultMessage: 'Document sort order',
}),
getFieldsTitle: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.fieldsTitle', {
defaultMessage: 'Fields',
}),
getFieldsLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.fieldsLabel', {
defaultMessage: 'Scripted fields are unavailable',
}),
getFieldsWarningLabel: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.fieldsWarningLabel', {
defaultMessage: 'This datasource performs best with 10 or fewer fields',
}),
getAscendingOption: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.ascendingDropDown', {
defaultMessage: 'Ascending',
}),
getDescendingOption: () =>
i18n.translate('xpack.canvas.expressionTypes.datasources.esdocs.descendingDropDown', {
defaultMessage: 'Descending',
}),
},
// Elasticsearch SQL data source
Essql: {
getDisplayName: () =>
i18n.translate('xpack.canvas.uis.dataSources.essqlTitle', {
Expand All @@ -341,7 +418,7 @@ export const DataSourceStrings = {
}),
getHelp: () =>
i18n.translate('xpack.canvas.uis.dataSources.essqlLabel', {
defaultMessage: 'Use {elasticsearch} {sql} to get a data table',
defaultMessage: 'Write an Elasticsearch SQL query to retrieve data',
values: {
elasticsearch: ELASTICSEARCH,
sql: SQL,
Expand All @@ -353,26 +430,26 @@ export const DataSourceStrings = {
}),
getLabelAppend: () =>
i18n.translate('xpack.canvas.uis.dataSources.essql.queryTitleAppend', {
defaultMessage: 'Learn {elasticsearchShort} {sql} syntax',
defaultMessage: 'Learn Elasticsearch SQL query syntax',
values: {
elasticsearchShort: ELASTICSEARCH_SHORT,
sql: SQL,
},
}),
},
// Timelion datasource
Timelion: {
getAbout: () =>
i18n.translate('xpack.canvas.uis.dataSources.timelion.aboutDetail', {
defaultMessage:
'Use {timelion} queries to pull back timeseries data that can be used with {canvas} elements.',
defaultMessage: 'Use Timelion syntax to retrieve timeseries data',
values: {
timelion: TIMELION,
canvas: CANVAS,
},
}),
getHelp: () =>
i18n.translate('xpack.canvas.uis.dataSources.timelionLabel', {
defaultMessage: 'Use {timelion} syntax to retrieve a timeseries',
defaultMessage: 'Use Timelion syntax to retrieve timeseries data',
values: {
timelion: TIMELION,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
padding: 0 $euiSizeS;
}

.canvasDataSource__section {
padding: $euiSizeM;
.canvasDataSource__section,
.canvasDataSource__list {
padding: $euiSizeM $euiSizeM 0;
}

.canvasDataSource__sectionFooter {
padding: 0 $euiSizeM;
}

.canvasDataSource__triggerButton {
Expand All @@ -19,10 +24,6 @@
margin-right: $euiSizeS;
}

.canvasDataSource__list {
padding: $euiSizeM;
}

.canvasDataSource__card .euiCard__content {
padding-top: 0 !important; // sass-lint:disable-line no-important
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,20 @@ export class DatasourceComponent extends PureComponent {
) : (
datasourceRender
)}
<EuiHorizontalRule margin="m" />
<EuiFlexGroup justifyContent="flexEnd" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButtonEmpty size="s" onClick={() => setPreviewing(true)}>
{strings.getPreviewButtonLabel()}
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton disabled={isInvalid} size="s" onClick={this.save} fill color="secondary">
{strings.getSaveButtonLabel()}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</div>
<EuiHorizontalRule margin="m" />
<EuiFlexGroup justifyContent="flexEnd" className="canvasDataSource__sectionFooter">
<EuiFlexItem grow={false}>
<EuiButtonEmpty size="s" onClick={() => setPreviewing(true)}>
{strings.getPreviewButtonLabel()}
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton disabled={isInvalid} size="s" onClick={this.save} fill color="secondary">
{strings.getSaveButtonLabel()}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>

{datasourcePreview}
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const DatasourceSelector = ({ onSelect, datasources, current }) => (
key={d.name}
title={d.displayName}
titleElement="h5"
titleSize="xs"
icon={<EuiIcon type={d.image} size="l" />}
description={d.help}
layout="horizontal"
Expand Down
Loading