Skip to content

Commit

Permalink
Merge branch 'main' into observability-remove-timeline-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko authored Oct 19, 2022
2 parents e206ebc + 9adcbe7 commit 7541979
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ export const InferencePipelineCard: React.FC<InferencePipeline> = (pipeline) =>
</EuiToolTip>
</EuiFlexItem>
)}
{(modelType.length > 0 ? [modelType] : modelTypes).map((type) => (
<EuiFlexItem grow={false} key={type}>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem>
<EuiBadge color="hollow">{type}</EuiBadge>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
))}
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem>
<span>
<EuiBadge color="hollow">{modelType}</EuiBadge>
</span>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ export const CustomPipelineItem: React.FC<{
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge color="hollow">
{i18n.translate(
'xpack.enterpriseSearch.content.indices.pipelines.ingestPipelinesCard.processorsDescription',
{
defaultMessage: '{processorsCount} Processors',
values: { processorsCount },
}
)}
</EuiBadge>
<span>
<EuiBadge color="hollow">
{i18n.translate(
'xpack.enterpriseSearch.content.indices.pipelines.ingestPipelinesCard.processorsDescription',
{
defaultMessage: '{processorsCount} Processors',
values: { processorsCount },
}
)}
</EuiBadge>
</span>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ export const DefaultPipelineItem: React.FC<{
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiBadge color="hollow">
{i18n.translate(
'xpack.enterpriseSearch.content.indices.pipelines.ingestPipelinesCard.managedBadge.label',
{ defaultMessage: 'Managed' }
)}
</EuiBadge>
<span>
<EuiBadge color="hollow">
{i18n.translate(
'xpack.enterpriseSearch.content.indices.pipelines.ingestPipelinesCard.managedBadge.label',
{ defaultMessage: 'Managed' }
)}
</EuiBadge>
</span>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
EuiFormRow,
EuiLink,
EuiSelect,
EuiSuperSelect,
EuiSuperSelectOption,
EuiSpacer,
EuiText,
} from '@elastic/eui';
Expand All @@ -29,6 +31,9 @@ import { docLinks } from '../../../../../shared/doc_links';
import { IndexViewLogic } from '../../index_view_logic';

import { MLInferenceLogic } from './ml_inference_logic';
import { MlModelSelectOption } from './model_select_option';

const MODEL_SELECT_PLACEHOLDER_VALUE = 'model_placeholder$$';

const NoSourceFieldsError: React.FC = () => (
<FormattedMessage
Expand Down Expand Up @@ -62,6 +67,22 @@ export const ConfigurePipeline: React.FC = () => {
const nameError = formErrors.pipelineName !== undefined && pipelineName.length > 0;
const emptySourceFields = (sourceFields?.length ?? 0) === 0;

const modelOptions: Array<EuiSuperSelectOption<string>> = [
{
disabled: true,
inputDisplay: i18n.translate(
'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.configure.model.placeholder',
{ defaultMessage: 'Select a model' }
),
value: MODEL_SELECT_PLACEHOLDER_VALUE,
},
...models.map((model) => ({
dropdownDisplay: <MlModelSelectOption model={model} />,
inputDisplay: model.model_id,
value: model.model_id,
})),
];

return (
<>
<EuiText color="subdued">
Expand Down Expand Up @@ -134,27 +155,19 @@ export const ConfigurePipeline: React.FC = () => {
)}
fullWidth
>
<EuiSelect
<EuiSuperSelect
data-telemetry-id={`entSearchContent-${ingestionMethod}-pipelines-configureInferencePipeline-selectTrainedModel`}
fullWidth
value={modelID}
options={[
{
disabled: true,
text: i18n.translate(
'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.configure.model.placeholder',
{ defaultMessage: 'Select a model' }
),
value: '',
},
...models.map((m) => ({ text: m.model_id, value: m.model_id })),
]}
onChange={(e) =>
hasDividers
itemLayoutAlign="top"
onChange={(value) =>
setInferencePipelineConfiguration({
...configuration,
modelID: e.target.value,
modelID: value,
})
}
options={modelOptions}
valueOfSelected={modelID === '' ? MODEL_SELECT_PLACEHOLDER_VALUE : modelID}
/>
</EuiFormRow>
<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ interface MLInferenceProcessorsValues {
mappingData: typeof MappingsApiLogic.values.data;
mappingStatus: Status;
mlInferencePipeline?: MlInferencePipeline;
mlModelsData: typeof MLModelsApiLogic.values.data;
mlModelsData: TrainedModelConfigResponse[];
mlModelsStatus: Status;
simulatePipelineData: typeof SimulateMlInterfacePipelineApiLogic.values.data;
simulatePipelineErrors: string[];
simulatePipelineResult: IngestSimulateResponse;
simulatePipelineStatus: Status;
sourceFields: string[] | undefined;
supportedMLModels: typeof MLModelsApiLogic.values.data;
supportedMLModels: TrainedModelConfigResponse[];
}

export const MLInferenceLogic = kea<
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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 React from 'react';

import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiTextColor, EuiTitle } from '@elastic/eui';
import { TrainedModelConfigResponse } from '@kbn/ml-plugin/common/types/trained_models';

import { getMlModelTypesForModelConfig } from '../../../../../../../common/ml_inference_pipeline';
import { getMLType, getModelDisplayTitle } from '../../../shared/ml_inference/utils';

export interface MlModelSelectOptionProps {
model: TrainedModelConfigResponse;
}
export const MlModelSelectOption: React.FC<MlModelSelectOptionProps> = ({ model }) => {
const type = getMLType(getMlModelTypesForModelConfig(model));
const title = getModelDisplayTitle(type);
return (
<EuiFlexGroup direction="column" gutterSize="xs">
<EuiFlexItem>
<EuiTitle size="xs">
<h4>{title ?? model.model_id}</h4>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s" alignItems="center" justifyContent="flexEnd">
{title && (
<EuiFlexItem>
<EuiTextColor color="subdued">{model.model_id}</EuiTextColor>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<span>
<EuiBadge color="hollow">{type}</EuiBadge>
</span>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,19 @@ export default ({ getService }: FtrProviderContext): void => {
auth: { user: superUser, space: 'space1' },
});

const [_, caseWithDeleteAssignee1, caseWithDeleteAssignee2] = await Promise.all([
createCase(supertest, postCaseReq),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
),
]);
await createCase(supertest, postCaseReq);
const caseWithDeleteAssignee1 = await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
);
const caseWithDeleteAssignee2 = await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
);

const cases = await findCases({
supertest,
Expand All @@ -202,21 +200,19 @@ export default ({ getService }: FtrProviderContext): void => {
auth: { user: superUser, space: 'space1' },
});

const [_, caseWithDeleteAssignee1, caseWithDeleteAssignee2] = await Promise.all([
createCase(supertest, postCaseReq),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[0].uid }],
})
),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[1].uid }],
})
),
]);
await createCase(supertest, postCaseReq);
const caseWithDeleteAssignee1 = await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[0].uid }],
})
);
const caseWithDeleteAssignee2 = await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[1].uid }],
})
);

const cases = await findCases({
supertest,
Expand All @@ -242,21 +238,20 @@ export default ({ getService }: FtrProviderContext): void => {
auth: { user: superUser, space: 'space1' },
});

const [caseWithNoAssignees] = await Promise.all([
createCase(supertest, postCaseReq),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
),
]);
const caseWithNoAssignees = await createCase(supertest, postCaseReq);
await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
);

await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profile[0].uid }],
})
);

const cases = await findCases({
supertest,
Expand All @@ -282,21 +277,20 @@ export default ({ getService }: FtrProviderContext): void => {
auth: { user: superUser, space: 'space1' },
});

const [caseWithNoAssignees, caseWithDeleteAssignee1] = await Promise.all([
createCase(supertest, postCaseReq),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[0].uid }],
})
),
createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[1].uid }],
})
),
]);
const caseWithNoAssignees = await createCase(supertest, postCaseReq);
const caseWithDeleteAssignee1 = await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[0].uid }],
})
);

await createCase(
supertest,
getPostCaseRequest({
assignees: [{ uid: profileUidsToFilter[1].uid }],
})
);

const cases = await findCases({
supertest,
Expand Down

0 comments on commit 7541979

Please sign in to comment.