Skip to content

Commit

Permalink
Merge branch 'main' into download_source/update_agent_policies
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Jul 8, 2022
2 parents 4e4d5ce + b57e8ce commit 8ce5c58
Show file tree
Hide file tree
Showing 31 changed files with 812 additions and 60 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('PartitionVisComponent', function () {
<PartitionVisComponent
{...{
...wrapperProps,
visType: ChartTypes.MOSAIC,
visType: ChartTypes.WAFFLE,
visParams: waffleVisParams,
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export const getLayers = (
groupByRollup: (d: Datum) => (col.id ? d[col.id] ?? EMPTY_SLICE : col.name),
showAccessor: (d: Datum) => d !== EMPTY_SLICE,
nodeLabel: (d: unknown) => getNodeLabel(d, col, formatters, formatter.deserialize),
fillLabel,
fillLabel:
layerIndex === 0 && chartType === ChartTypes.MOSAIC
? { ...fillLabel, minFontSize: 14, maxFontSize: 14, clipText: true }
: fillLabel,
sortPredicate,
shape: {
fillColor: (d) =>
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_types/heatmap/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const prepareGrid = (params: HeatmapVisParams) => {
const gridConfig = buildExpressionFunction('heatmap_grid', {
isCellLabelVisible: params.valueAxes?.[0].labels.show ?? false,
isXAxisLabelVisible: true,
isYAxisLabelVisible: true,
isYAxisTitleVisible: true,
isXAxisTitleVisible: true,
});
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/plugins/vis_types/xy/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
*/

import moment from 'moment';

import { Position } from '@elastic/charts';
import {
VisToExpressionAst,
getVisSchemas,
DateHistogramParams,
HistogramParams,
LegendSize,
} from '@kbn/visualizations-plugin/public';
import { buildExpression, buildExpressionFunction } from '@kbn/expressions-plugin/public';
import { BUCKET_TYPES } from '@kbn/data-plugin/public';
Expand Down Expand Up @@ -202,14 +203,19 @@ export const toExpressionAst: VisToExpressionAst<VisParams> = async (vis, params
}
}
});
let legendSize = vis.params.legendSize;

if (vis.params.legendPosition === Position.Top || vis.params.legendPosition === Position.Bottom) {
legendSize = LegendSize.AUTO;
}

const visTypeXy = buildExpressionFunction<VisTypeXyExpressionFunctionDefinition>(visName, {
type: vis.type.name as XyVisType,
chartType: vis.params.type,
addTimeMarker: vis.params.addTimeMarker,
truncateLegend: vis.params.truncateLegend,
maxLegendLines: vis.params.maxLegendLines,
legendSize: vis.params.legendSize,
legendSize,
addLegend: vis.params.addLegend,
addTooltip: vis.params.addTooltip,
legendPosition: vis.params.legendPosition,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "enterpriseSearch",
"version": "kibana",
"kibanaVersion": "kibana",
"requiredPlugins": ["features", "spaces", "security", "licensing", "data", "charts", "infra", "cloud"],
"requiredPlugins": ["features", "spaces", "security", "licensing", "data", "charts", "infra", "cloud", "esUiShared"],
"configPath": ["enterpriseSearch"],
"optionalPlugins": ["usageCollection", "home", "cloud", "customIntegrations"],
"server": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { createApiLogic } from '../../../shared/api_logic/create_api_logic';
import { HttpLogic } from '../../../shared/http';
import { ConnectorScheduling } from '../index/fetch_index_api_logic';

export interface UpdateConnectorSchedulingArgs {
connectorId: string;
scheduling: ConnectorScheduling;
}

export const updateConnectorScheduling = async ({
connectorId,
scheduling: { enabled, interval },
}: UpdateConnectorSchedulingArgs) => {
const route = `/internal/enterprise_search/connectors/${connectorId}/scheduling`;

await HttpLogic.values.http.post<undefined>(route, {
body: JSON.stringify({ enabled, interval }),
});
return { enabled, interval };
};

export const UpdateConnectorSchedulingApiLogic = createApiLogic(
['content', 'update_connector_scheduling_api_logic'],
updateConnectorScheduling
);
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export interface KeyValuePair {
}

export type ConnectorConfiguration = Record<string, KeyValuePair | undefined>;
export interface ConnectorScheduling {
enabled: boolean;
interval: string;
}

export interface Connector {
api_key_id: string | null;
Expand All @@ -25,10 +29,10 @@ export interface Connector {
last_synced: string | null;
scheduling: {
enabled: boolean;
interval: string | null; // crontab syntax
interval: string; // crontab syntax
};
service_type: string | null;
status: string | null;
status: string;
sync_error: string | null;
sync_now: boolean;
sync_status: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ import { ConnectorConfigurationApiLogic } from '../../../api/connector_package/u

import { ConnectorConfigurationLogic } from './connector_configuration_logic';

// jest.mock('../../api', () => ({
// AppLogic: { values: { isOrganization: true } },
// }));

const DEFAULT_VALUES = {
configState: { foo: 'bar' },
isEditing: false,
};

describe('ConnectorConfigurationLogic', () => {
const { mount } = new LogicMounter(ConnectorConfigurationLogic);
const { clearFlashMessages, flashAPIErrors } = mockFlashMessageHelpers;
const { clearFlashMessages, flashAPIErrors, flashSuccessToast } = mockFlashMessageHelpers;

beforeEach(() => {
jest.clearAllMocks();
Expand Down Expand Up @@ -94,5 +90,14 @@ describe('ConnectorConfigurationLogic', () => {
expect(flashAPIErrors).toHaveBeenCalledWith('error');
});
});
describe('apiSuccess', () => {
it('should call flashAPIError', () => {
ConnectorConfigurationLogic.actions.apiSuccess({
configuration: {},
indexName: 'name',
});
expect(flashSuccessToast).toHaveBeenCalledWith('Configuration successfully updated');
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

import { kea, MakeLogicType } from 'kea';

import { i18n } from '@kbn/i18n';

import { Actions } from '../../../../shared/api_logic/create_api_logic';
import { clearFlashMessages, flashAPIErrors } from '../../../../shared/flash_messages';
import {
clearFlashMessages,
flashAPIErrors,
flashSuccessToast,
} from '../../../../shared/flash_messages';

import {
ConnectorConfigurationApiLogic,
Expand Down Expand Up @@ -54,6 +60,13 @@ export const ConnectorConfigurationLogic = kea<
},
listeners: {
apiError: (error) => flashAPIErrors(error),
apiSuccess: () =>
flashSuccessToast(
i18n.translate(
'xpack.enterpriseSearch.content.indices.configurationConnector.configuration.successToast.title',
{ defaultMessage: 'Configuration successfully updated' }
)
),
makeRequest: () => clearFlashMessages(),
},
reducers: ({ props }) => ({
Expand Down
Loading

0 comments on commit 8ce5c58

Please sign in to comment.