Skip to content

Commit

Permalink
Merge branch 'main' into index_management-ds_edit_data_retention
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 29, 2023
2 parents 1eb7855 + 7393bfe commit 3d6e055
Show file tree
Hide file tree
Showing 37 changed files with 610 additions and 723 deletions.
26 changes: 13 additions & 13 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
aiSearchDoc: `${ESRE_DOCS}`,
aiSearchHelp: `${ESRE_DOCS}help.html`,
apiKeys: `${KIBANA_DOCS}api-keys.html`,
behavioralAnalytics: `${ENTERPRISE_SEARCH_DOCS}analytics-overview.html`,
behavioralAnalyticsCORS: `${ENTERPRISE_SEARCH_DOCS}analytics-cors-proxy.html`,
behavioralAnalyticsEvents: `${ENTERPRISE_SEARCH_DOCS}analytics-events.html`,
behavioralAnalytics: `${ELASTICSEARCH_DOCS}behavioral-analytics-overview.html`,
behavioralAnalyticsCORS: `${ELASTICSEARCH_DOCS}behavioral-analytics-cors.html`,
behavioralAnalyticsEvents: `${ELASTICSEARCH_DOCS}behavioral-analytics-event.html`,
buildConnector: `${ENTERPRISE_SEARCH_DOCS}build-connector.html`,
bulkApi: `${ELASTICSEARCH_DOCS}docs-bulk.html`,
configuration: `${ENTERPRISE_SEARCH_DOCS}configuration.html`,
Expand Down Expand Up @@ -170,24 +170,24 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
crawlerOverview: `${ENTERPRISE_SEARCH_DOCS}crawler.html`,
deployTrainedModels: `${MACHINE_LEARNING_DOCS}ml-nlp-deploy-models.html`,
documentLevelSecurity: `${ELASTICSEARCH_DOCS}document-level-security.html`,
elser: `${ENTERPRISE_SEARCH_DOCS}elser-text-expansion.html`,
elser: `${ELASTICSEARCH_DOCS}semantic-search-elser.html`,
engines: `${ENTERPRISE_SEARCH_DOCS}engines.html`,
indexApi: `${ELASTICSEARCH_DOCS}docs-index_.html`,
ingestionApis: `${ENTERPRISE_SEARCH_DOCS}ingestion-apis.html`,
ingestPipelines: `${ENTERPRISE_SEARCH_DOCS}ingest-pipelines.html`,
ingestionApis: `${ELASTICSEARCH_DOCS}search-your-data.html`,
ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`,
knnSearch: `${ELASTICSEARCH_DOCS}knn-search.html`,
knnSearchCombine: `${ELASTICSEARCH_DOCS}knn-search.html#_combine_approximate_knn_with_other_features`,
languageAnalyzers: `${ELASTICSEARCH_DOCS}analysis-lang-analyzer.html`,
languageClients: `${ENTERPRISE_SEARCH_DOCS}programming-language-clients.html`,
licenseManagement: `${ENTERPRISE_SEARCH_DOCS}license-management.html`,
machineLearningStart: `${ENTERPRISE_SEARCH_DOCS}machine-learning-start.html`,
machineLearningStart: `${ELASTICSEARCH_DOCS}nlp-example.html`,
mailService: `${ENTERPRISE_SEARCH_DOCS}mailer-configuration.html`,
mlDocumentEnrichment: `${ENTERPRISE_SEARCH_DOCS}document-enrichment.html`,
mlDocumentEnrichmentUpdateMappings: `${ENTERPRISE_SEARCH_DOCS}document-enrichment.html#document-enrichment-update-mappings`,
searchApplicationsTemplates: `${ENTERPRISE_SEARCH_DOCS}search-applications-templates.html`,
searchApplicationsSearchApi: `${ENTERPRISE_SEARCH_DOCS}search-applications-safe-search.html`,
searchApplications: `${ENTERPRISE_SEARCH_DOCS}search-applications.html`,
searchApplicationsSearch: `${ENTERPRISE_SEARCH_DOCS}search-applications-search.html`,
mlDocumentEnrichment: `${ELASTICSEARCH_DOCS}ingest-pipeline-search-inference.html`,
mlDocumentEnrichmentUpdateMappings: `${ELASTICSEARCH_DOCS}ingest-pipeline-search-inference.html#ingest-pipeline-search-inference-update-mapping`,
searchApplicationsTemplates: `${ELASTICSEARCH_DOCS}search-application-api.html`,
searchApplicationsSearchApi: `${ELASTICSEARCH_DOCS}search-application-security.html`,
searchApplications: `${ELASTICSEARCH_DOCS}search-application-overview.html`,
searchApplicationsSearch: `${ELASTICSEARCH_DOCS}search-application-client.html`,
searchLabs: `${SEARCH_LABS_URL}`,
searchLabsRepo: `${SEARCH_LABS_REPO}`,
searchTemplates: `${ELASTICSEARCH_DOCS}search-template.html`,
Expand Down
107 changes: 93 additions & 14 deletions packages/kbn-search-connectors/types/native_connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ const MAX_CONCURRENT_DOWNLOADS_LABEL = i18n.translate(
}
);

const USE_TEXT_EXTRACTION_SERVICE_LABEL = i18n.translate(
'searchConnectors.nativeConnectors.textExtractionService.label',
{
defaultMessage: 'Use text extraction service',
}
);

const USE_TEXT_EXTRACTION_SERVICE_TOOLTIP = i18n.translate(
'searchConnectors.nativeConnectors.textExtractionService.tooltip',
{
defaultMessage:
'Requires a separate deployment of the Elastic Data Extraction Service. ' +
'Also requires that pipeline settings disable text extraction.',
}
);

const DATABASE_LABEL = i18n.translate('searchConnectors.nativeConnectors.databaseLabel', {
defaultMessage: 'Database',
});
Expand Down Expand Up @@ -157,6 +173,21 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
],
value: 100,
},
use_text_extraction_service: {
default_value: false,
depends_on: [],
display: DisplayType.TOGGLE,
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 6,
required: true,
sensitive: false,
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
type: FieldType.BOOLEAN,
ui_restrictions: ['advanced'],
validations: [],
value: false,
},
},
features: {
[FeatureName.SYNC_RULES]: {
Expand Down Expand Up @@ -398,6 +429,21 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
],
value: 50,
},
use_text_extraction_service: {
default_value: false,
depends_on: [],
display: DisplayType.TOGGLE,
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 12,
required: true,
sensitive: false,
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
type: FieldType.BOOLEAN,
ui_restrictions: ['advanced'],
validations: [],
value: false,
},
},
features: {
[FeatureName.SYNC_RULES]: {
Expand Down Expand Up @@ -503,6 +549,21 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
validations: [],
value: 100,
},
use_text_extraction_service: {
default_value: false,
depends_on: [],
display: DisplayType.TOGGLE,
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 7,
required: true,
sensitive: false,
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
type: FieldType.BOOLEAN,
ui_restrictions: ['advanced'],
validations: [],
value: false,
},
},
features: {
[FeatureName.SYNC_RULES]: {
Expand Down Expand Up @@ -741,6 +802,21 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
],
value: 100,
},
use_text_extraction_service: {
default_value: false,
depends_on: [],
display: DisplayType.TOGGLE,
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 12,
required: true,
sensitive: false,
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
type: FieldType.BOOLEAN,
ui_restrictions: ['advanced'],
validations: [],
value: false,
},
},
features: {
[FeatureName.SYNC_RULES]: {
Expand Down Expand Up @@ -1655,6 +1731,21 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
validations: [],
value: 10,
},
use_text_extraction_service: {
default_value: false,
depends_on: [],
display: DisplayType.TOGGLE,
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 7,
required: true,
sensitive: false,
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
type: FieldType.BOOLEAN,
ui_restrictions: ['advanced'],
validations: [],
value: false,
},
},
features: {
[FeatureName.SYNC_RULES]: {
Expand Down Expand Up @@ -1780,24 +1871,12 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
default_value: false,
depends_on: [],
display: DisplayType.TOGGLE,
label: i18n.translate(
'searchConnectors.nativeConnectors.sharepoint_online.configuration.textExtractionServiceLabel',
{
defaultMessage: 'Use text extraction service',
}
),
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 6,
required: true,
sensitive: false,
tooltip: i18n.translate(
'searchConnectors.nativeConnectors.sharepoint_online.configuration.textExtractionServiceTooltip',
{
defaultMessage:
'Requires a separate deployment of the Elastic Data Extraction Service. ' +
'Also requires that pipeline settings disable text extraction.',
}
),
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
type: FieldType.BOOLEAN,
ui_restrictions: ['advanced'],
validations: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import type { PaletteOutput, PaletteDefinition } from '@kbn/coloring';
import { chartPluginMock } from '@kbn/charts-plugin/public/mocks';
import { Datatable } from '@kbn/expressions-plugin/common';
import { byDataColorPaletteMap, SimplifiedArrayNode } from './get_color';
import type { SeriesLayer } from '@kbn/coloring';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
Expand All @@ -21,29 +20,28 @@ import { ChartTypes } from '../../../common/types';
import { getDistinctSeries } from '..';

describe('#byDataColorPaletteMap', () => {
let datatable: Datatable;
let paletteDefinition: PaletteDefinition;
let palette: PaletteOutput;
const columnId = 'foo';
const visData = createMockVisData();
const defaultFormatter = jest.fn((...args) => fieldFormatsMock.deserialize(...args));
const formatters = generateFormatters(visData, defaultFormatter);

beforeEach(() => {
datatable = {
rows: [
{
[columnId]: '1',
},
{
[columnId]: '2',
},
],
} as unknown as Datatable;
paletteDefinition = chartPluginMock.createPaletteRegistry().get('default');
palette = { type: 'palette' } as PaletteOutput;
});

it('should create byDataColorPaletteMap', () => {
expect(byDataColorPaletteMap(datatable.rows, columnId, paletteDefinition, palette))
.toMatchInlineSnapshot(`
expect(
byDataColorPaletteMap(
visData.rows,
visData.columns[0],
paletteDefinition,
palette,
formatters,
fieldFormatsMock
)
).toMatchInlineSnapshot(`
Object {
"getColor": [Function],
}
Expand All @@ -52,46 +50,52 @@ describe('#byDataColorPaletteMap', () => {

it('should get color', () => {
const colorPaletteMap = byDataColorPaletteMap(
datatable.rows,
columnId,
visData.rows,
visData.columns[0],
paletteDefinition,
palette
palette,
formatters,
fieldFormatsMock
);

expect(colorPaletteMap.getColor('1')).toBe('black');
expect(colorPaletteMap.getColor('Logstash Airways')).toBe('black');
});

it('should return undefined in case if values not in datatable', () => {
const colorPaletteMap = byDataColorPaletteMap(
datatable.rows,
columnId,
visData.rows,
visData.columns[0],
paletteDefinition,
palette
palette,
formatters,
fieldFormatsMock
);

expect(colorPaletteMap.getColor('wrong')).toBeUndefined();
});

it('should increase rankAtDepth for each new value', () => {
const colorPaletteMap = byDataColorPaletteMap(
datatable.rows,
columnId,
visData.rows,
visData.columns[0],
paletteDefinition,
palette
palette,
formatters,
fieldFormatsMock
);
colorPaletteMap.getColor('1');
colorPaletteMap.getColor('2');
colorPaletteMap.getColor('Logstash Airways');
colorPaletteMap.getColor('JetBeats');

expect(paletteDefinition.getCategoricalColor).toHaveBeenNthCalledWith(
1,
[{ name: '1', rankAtDepth: 0, totalSeriesAtDepth: 2 }],
[{ name: 'Logstash Airways', rankAtDepth: 0, totalSeriesAtDepth: 4 }],
{ behindText: false },
undefined
);

expect(paletteDefinition.getCategoricalColor).toHaveBeenNthCalledWith(
2,
[{ name: '2', rankAtDepth: 1, totalSeriesAtDepth: 2 }],
[{ name: 'JetBeats', rankAtDepth: 1, totalSeriesAtDepth: 4 }],
{ behindText: false },
undefined
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ const isTreemapOrMosaicChart = (shape: ChartTypes) =>

export const byDataColorPaletteMap = (
rows: Datatable['rows'],
columnId: string,
column: Partial<BucketColumns>,
paletteDefinition: PaletteDefinition,
{ params }: PaletteOutput
{ params }: PaletteOutput,
formatters: Record<string, FieldFormat | undefined>,
formatter: FieldFormatsStart
) => {
const colorMap = new Map<string, string | undefined>(
rows.map((item) => [String(item[columnId]), undefined])
rows.map((item) => {
const formattedName = getNodeLabel(
item[column.id ?? ''],
column,
formatters,
formatter.deserialize
);
return [formattedName, undefined];
})
);
let rankAtDepth = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ export const getLayers = (
if (!syncColors && columns[1]?.id && palettes && visParams.palette) {
byDataPalette = byDataColorPaletteMap(
rows,
columns[1].id,
columns[1],
palettes?.get(visParams.palette.name),
visParams.palette
visParams.palette,
formatters,
formatter
);
}

Expand Down

This file was deleted.

Loading

0 comments on commit 3d6e055

Please sign in to comment.