Skip to content

Commit

Permalink
Merge branch 'master' into aad-field-aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 27, 2021
2 parents 379a3e5 + 017fcac commit e655b79
Show file tree
Hide file tree
Showing 33 changed files with 350 additions and 207 deletions.
2 changes: 1 addition & 1 deletion docs/api/dashboard-api.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[dashboard-api]]
== Import and export dashboard APIs

deprecated::[7.15.0,Both of these APIs have been deprecated in favor of <<saved-objects-api-import>> and <<saved-objects-api-export>>.]
deprecated::[7.15.0,These experimental APIs have been deprecated in favor of <<saved-objects-api-import>> and <<saved-objects-api-export>>.]

Import and export dashboards with the corresponding saved objects, such as visualizations, saved
searches, and index patterns.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/dashboard/export-dashboard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

deprecated::[7.15.0,Use <<saved-objects-api-export>> instead.]

Export dashboards and corresponding saved objects.
experimental[] Export dashboards and corresponding saved objects.

[[dashboard-api-export-request]]
==== Request
Expand Down
2 changes: 1 addition & 1 deletion docs/api/dashboard/import-dashboard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

deprecated::[7.15.0,Use <<saved-objects-api-import>> instead.]

Import dashboards and corresponding saved objects.
experimental[] Import dashboards and corresponding saved objects.

[[dashboard-api-import-request]]
==== Request
Expand Down
3 changes: 3 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ Enables the legacy charts library for timelion charts in Visualize.
**This setting is deprecated and will not be supported as of 8.0.**
Maps values to specific colors in charts using the *Compatibility* palette.

[[visualization-uselegacytimeaxis]]`visualization:useLegacyTimeAxis`::
Enables the legacy time axis for charts in Lens, Discover, Visualize and TSVB

[[visualization-heatmap-maxbuckets]]`visualization:heatmap:maxBuckets`::
The maximum number of buckets a datasource can return. High numbers can have a negative impact on your browser rendering performance.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/apm-rum": "^5.9.1",
"@elastic/apm-rum-react": "^1.3.1",
"@elastic/charts": "38.0.1",
"@elastic/charts": "38.1.0",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.35",
"@elastic/ems-client": "8.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ const { startES } = kbnTestServer.createTestServers({
});
let esServer: kbnTestServer.TestElasticsearchUtils;

// Failing: See https://github.com/elastic/kibana/issues/113697
describe.skip('migration actions', () => {
describe('migration actions', () => {
let client: ElasticsearchClient;

beforeAll(async () => {
Expand Down Expand Up @@ -1158,7 +1157,7 @@ describe.skip('migration actions', () => {
it('resolves left wait_for_task_completion_timeout when the task does not complete within the timeout', async () => {
const res = (await pickupUpdatedMappings(
client,
'existing_index_with_docs'
'.kibana_1'
)()) as Either.Right<UpdateByQueryResponse>;

const task = waitForPickupUpdatedMappingsTask({
Expand Down Expand Up @@ -1539,7 +1538,8 @@ describe.skip('migration actions', () => {
}
`);
});
it('resolves left request_entity_too_large_exception when the payload is too large', async () => {
// TODO: unskip after https://github.com/elastic/kibana/issues/116111
it.skip('resolves left request_entity_too_large_exception when the payload is too large', async () => {
const newDocs = new Array(10000).fill({
_source: {
title:
Expand Down
1 change: 1 addition & 0 deletions src/plugins/charts/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

export const COLOR_MAPPING_SETTING = 'visualization:colorMapping';
export const LEGACY_TIME_AXIS = 'visualization:useLegacyTimeAxis';

export {
CustomPaletteArguments,
Expand Down
17 changes: 16 additions & 1 deletion src/plugins/charts/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { i18n } from '@kbn/i18n';
import { schema } from '@kbn/config-schema';
import { CoreSetup, Plugin } from 'kibana/server';
import { COLOR_MAPPING_SETTING, palette, systemPalette } from '../common';
import { COLOR_MAPPING_SETTING, LEGACY_TIME_AXIS, palette, systemPalette } from '../common';
import { ExpressionsServerSetup } from '../../expressions/server';

interface SetupDependencies {
Expand Down Expand Up @@ -45,6 +45,21 @@ export class ChartsServerPlugin implements Plugin<object, object> {
category: ['visualization'],
schema: schema.string(),
},
[LEGACY_TIME_AXIS]: {
name: i18n.translate('charts.advancedSettings.visualization.useLegacyTimeAxis.name', {
defaultMessage: 'Legacy chart time axis',
}),
value: false,
description: i18n.translate(
'charts.advancedSettings.visualization.useLegacyTimeAxis.description',
{
defaultMessage:
'Enables the legacy time axis for charts in Lens, Discover, Visualize and TSVB',
}
),
category: ['visualization'],
schema: schema.boolean(),
},
});

return {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export function DiscoverChart({
onResetQuery={resetSavedSearch}
/>
</EuiFlexItem>

{showViewModeToggle && (
<EuiFlexItem grow={false}>
<DocumentViewModeToggle
Expand All @@ -124,7 +123,6 @@ export function DiscoverChart({
/>
</EuiFlexItem>
)}

{timefield && (
<EuiFlexItem className="dscResultCount__toggle" grow={false}>
<EuiPopover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import {
Settings,
TooltipType,
XYChartElementEvent,
GridLineStyle,
AxisStyle,
RecursivePartial,
} from '@elastic/charts';
import { IUiSettingsClient } from 'kibana/public';
import {
Expand All @@ -35,6 +38,7 @@ import { DataCharts$, DataChartsMessage } from '../../services/use_saved_search'
import { FetchStatus } from '../../../../types';
import { DiscoverServices } from '../../../../../build_services';
import { useDataState } from '../../utils/use_data_state';
import { LEGACY_TIME_AXIS } from '../../../../../../../charts/common';

export interface DiscoverHistogramProps {
savedSearchData$: DataCharts$;
Expand Down Expand Up @@ -179,6 +183,48 @@ export function DiscoverHistogram({

const xAxisFormatter = services.data.fieldFormats.deserialize(chartData.yAxisFormat);

const useLegacyTimeAxis = uiSettings.get(LEGACY_TIME_AXIS, false);
const gridLineStyle: RecursivePartial<GridLineStyle> = useLegacyTimeAxis
? {}
: { strokeWidth: 0.1, stroke: isDarkMode ? 'white' : 'black' };
const verticalAxisStyle: RecursivePartial<AxisStyle> = useLegacyTimeAxis
? {}
: {
axisLine: {
visible: false,
},
tickLabel: {
fontSize: 11,
},
};
const xAxisStyle: RecursivePartial<AxisStyle> = useLegacyTimeAxis
? {}
: {
axisLine: {
stroke: isDarkMode ? 'lightgray' : 'darkgray',
strokeWidth: 1,
},
tickLine: {
size: 12,
strokeWidth: 0.15,
stroke: isDarkMode ? 'white' : 'black',
padding: -10,
visible: true,
},
tickLabel: {
fontSize: 11,
padding: 0,
alignment: {
vertical: Position.Bottom,
horizontal: Position.Left,
},
offset: {
x: 1.5,
y: 0,
},
},
};

return (
<React.Fragment>
<div className="dscHistogram" data-test-subj="discoverChart" data-time-range={timeRangeText}>
Expand All @@ -195,15 +241,19 @@ export function DiscoverHistogram({
<Axis
id="discover-histogram-left-axis"
position={Position.Left}
ticks={5}
ticks={2}
integersOnly
tickFormat={(value) => xAxisFormatter.convert(value)}
gridLine={gridLineStyle}
style={verticalAxisStyle}
/>
<Axis
id="discover-histogram-bottom-axis"
position={Position.Bottom}
tickFormat={formatXValue}
ticks={10}
timeAxisLayerCount={useLegacyTimeAxis ? 0 : 2}
gridLine={gridLineStyle}
style={xAxisStyle}
/>
<CurrentTime isDarkMode={isDarkMode} domainEnd={domainEnd} />
<Endzones
Expand All @@ -222,6 +272,7 @@ export function DiscoverHistogram({
xAccessor="x"
yAccessors={['y']}
data={data}
yNice
timeZone={timeZone}
name={chartData.yAxisLabel}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'text',
_meta: { description: 'Non-default value of setting.' },
},
'visualization:useLegacyTimeAxis': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'visualization:regionmap:showWarnings': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface UsageStats {
'visualize:enableLabs': boolean;
'visualization:heatmap:maxBuckets': number;
'visualization:colorMapping': string;
'visualization:useLegacyTimeAxis': boolean;
'visualization:regionmap:showWarnings': boolean;
'visualization:tileMap:maxPrecision': number;
'csv:separator': string;
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7110,6 +7110,12 @@
"description": "Non-default value of setting."
}
},
"visualization:useLegacyTimeAxis": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"visualization:regionmap:showWarnings": {
"type": "boolean",
"_meta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { createFieldFormatter } from '../../lib/create_field_formatter';
import { checkIfSeriesHaveSameFormatters } from '../../lib/check_if_series_have_same_formatters';
import { TimeSeries } from '../../../visualizations/views/timeseries';
import { MarkdownSimple } from '../../../../../../../../plugins/kibana_react/public';
import { LEGACY_TIME_AXIS } from '../../../../../../../../plugins/charts/common';
import { replaceVars } from '../../lib/replace_vars';
import { getInterval } from '../../lib/get_interval';
import { createIntervalBasedFormatter } from '../../lib/create_interval_based_formatter';
Expand Down Expand Up @@ -272,6 +273,7 @@ class TimeseriesVisualization extends Component {
syncColors={syncColors}
palettesService={palettesService}
interval={interval}
useLegacyTimeAxis={getConfig(LEGACY_TIME_AXIS, false)}
isLastBucketDropped={Boolean(
model.drop_last_bucket ||
model.series.some((series) => series.series_drop_last_bucket)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const TimeSeries = ({
palettesService,
interval,
isLastBucketDropped,
useLegacyTimeAxis,
}) => {
// If the color isn't configured by the user, use the color mapping service
// to assign a color from the Kibana palette. Colors will be shared across the
Expand Down Expand Up @@ -138,6 +139,51 @@ export const TimeSeries = ({
},
[palettesService, series, syncColors]
);

const darkMode = uiSettings.get('theme:darkMode');
const gridLineStyle = !useLegacyTimeAxis
? {
visible: showGrid,
strokeWidth: 0.1,
stroke: darkMode ? 'white' : 'black',
}
: {
...GRID_LINE_CONFIG,
visible: showGrid,
};
const xAxisStyle = !useLegacyTimeAxis
? {
tickLabel: {
visible: true,
fontSize: 11,
padding: 0,
alignment: {
vertical: Position.Bottom,
horizontal: Position.Left,
},
offset: {
x: 1.5,
y: 0,
},
},
axisLine: {
stroke: darkMode ? 'lightgray' : 'darkgray',
strokeWidth: 1,
},
tickLine: {
size: 12,
strokeWidth: 0.15,
stroke: darkMode ? 'white' : 'black',
padding: -10,
visible: true,
},
axisTitle: {
visible: true,
padding: 0,
},
}
: {};

return (
<Chart ref={chartRef} renderer="canvas" className={classes}>
<Settings
Expand Down Expand Up @@ -328,10 +374,9 @@ export const TimeSeries = ({
position={Position.Bottom}
title={getAxisLabelString(interval)}
tickFormat={xAxisFormatter}
gridLine={{
...GRID_LINE_CONFIG,
visible: showGrid,
}}
gridLine={gridLineStyle}
style={xAxisStyle}
timeAxisLayerCount={useLegacyTimeAxis ? 0 : 3}
/>
</Chart>
);
Expand All @@ -357,4 +402,5 @@ TimeSeries.propTypes = {
annotations: PropTypes.array,
interval: PropTypes.number,
isLastBucketDropped: PropTypes.bool,
useLegacyTimeAxis: PropTypes.bool,
};
2 changes: 2 additions & 0 deletions src/plugins/vis_types/xy/public/components/xy_axis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const XYAxis: FC<XYAxisPros> = ({
domain,
style,
integersOnly,
timeAxisLayerCount,
}) => (
<Axis
id={`${id}__axis`}
Expand All @@ -40,5 +41,6 @@ export const XYAxis: FC<XYAxisPros> = ({
labelFormat={ticks?.labelFormatter}
showOverlappingLabels={ticks?.showOverlappingLabels}
showDuplicatedTicks={ticks?.showDuplicates}
timeAxisLayerCount={timeAxisLayerCount}
/>
);
Loading

0 comments on commit e655b79

Please sign in to comment.