forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Index Pipelines JSON Configurations (elastic#142609)
* [Enterprise Search] pipelines json configs tab Add the right panel with tabs for the Search Index Pipelines page, along with the JSON configurations tab. The index pipeliens get request was already returning the index specific ingest pipelines so I added the default pipeline to this result so we can get all the pipelines related to an index with a single call. * removed unnecessary listener The modal is closed from the pipelines logic and this createApiSuccess listener ended up being completely unnecessary.
- Loading branch information
1 parent
87c3b8b
commit 208e3e4
Showing
9 changed files
with
493 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
...ions/enterprise_search_content/components/search_index/pipelines/pipeline_json_badges.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* 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 { useValues } from 'kea'; | ||
|
||
import { EuiBadgeGroup, EuiBadge, EuiToolTip } from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
|
||
import { DEFAULT_PIPELINE_NAME } from '../../../../../../common/constants'; | ||
|
||
import { isManagedPipeline } from '../../../../shared/pipelines/is_managed'; | ||
|
||
import { IndexPipelinesConfigurationsLogic } from './pipelines_json_configurations_logic'; | ||
|
||
const ManagedPipelineBadge: React.FC = () => ( | ||
<EuiToolTip | ||
position="top" | ||
content={i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.managed.description', | ||
{ defaultMessage: 'This pipeline is managed and cannot be edited' } | ||
)} | ||
> | ||
<EuiBadge iconType="lock" color="warning"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.managed', | ||
{ defaultMessage: 'Managed' } | ||
)} | ||
</EuiBadge> | ||
</EuiToolTip> | ||
); | ||
|
||
const UnmanagedPipelineBadge: React.FC = () => ( | ||
<EuiToolTip | ||
position="top" | ||
content={ | ||
<FormattedMessage | ||
id="xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.unmanaged.description" | ||
defaultMessage="Edit this pipeline from {ingestPipelines} in Stack Management" | ||
values={{ | ||
ingestPipelines: ( | ||
<strong> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.ingestPipelines', | ||
{ defaultMessage: 'Ingest Pipelines' } | ||
)} | ||
</strong> | ||
), | ||
}} | ||
/> | ||
} | ||
> | ||
<EuiBadge iconType="lockOpen"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.unmanaged', | ||
{ defaultMessage: 'Unmanaged' } | ||
)} | ||
</EuiBadge> | ||
</EuiToolTip> | ||
); | ||
|
||
const SharedPipelineBadge: React.FC = () => ( | ||
<EuiToolTip | ||
position="top" | ||
content={i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.shared.description', | ||
{ defaultMessage: 'This pipeline is shared across all Enterprise Search ingestion methods' } | ||
)} | ||
> | ||
<EuiBadge iconType="logstashIf" color="hollow"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.shared', | ||
{ defaultMessage: 'Shared' } | ||
)} | ||
</EuiBadge> | ||
</EuiToolTip> | ||
); | ||
|
||
const IndexPipelineBadge: React.FC = () => ( | ||
<EuiToolTip | ||
position="top" | ||
content={i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.indexSpecific.description', | ||
{ defaultMessage: 'This pipeline contains configurations specific to this index only' } | ||
)} | ||
> | ||
<EuiBadge iconType="document" color="hollow"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.indexSpecific', | ||
{ defaultMessage: 'Index specific' } | ||
)} | ||
</EuiBadge> | ||
</EuiToolTip> | ||
); | ||
|
||
const MlInferenceBadge: React.FC = () => ( | ||
<EuiToolTip | ||
position="top" | ||
content={i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.mlInference.description', | ||
{ | ||
defaultMessage: | ||
'This pipeline references one or more ML Inference Pipelines for this index', | ||
} | ||
)} | ||
> | ||
<EuiBadge iconType="compute" color="hollow"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.mlInference', | ||
{ defaultMessage: 'ML Inference' } | ||
)} | ||
</EuiBadge> | ||
</EuiToolTip> | ||
); | ||
|
||
export const PipelineJSONBadges: React.FC = () => { | ||
const { | ||
indexName, | ||
selectedPipeline: pipeline, | ||
selectedPipelineId: pipelineName, | ||
} = useValues(IndexPipelinesConfigurationsLogic); | ||
if (!pipeline) { | ||
return <></>; | ||
} | ||
const badges: JSX.Element[] = []; | ||
if (isManagedPipeline(pipeline)) { | ||
badges.push(<ManagedPipelineBadge />); | ||
} else { | ||
badges.push(<UnmanagedPipelineBadge />); | ||
} | ||
if (pipelineName === DEFAULT_PIPELINE_NAME) { | ||
badges.push(<SharedPipelineBadge />); | ||
} | ||
if (pipelineName?.endsWith('@ml-inference')) { | ||
badges.push(<MlInferenceBadge />); | ||
} else if (pipelineName?.includes(indexName)) { | ||
badges.push(<IndexPipelineBadge />); | ||
} | ||
return <EuiBadgeGroup gutterSize="s">{badges}</EuiBadgeGroup>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
...rprise_search_content/components/search_index/pipelines/pipelines_json_configurations.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* | ||
* 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 { useActions, useValues } from 'kea'; | ||
|
||
import { | ||
EuiButtonEmpty, | ||
EuiCodeBlock, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiFormRow, | ||
EuiLink, | ||
EuiNotificationBadge, | ||
EuiSelect, | ||
EuiSpacer, | ||
} from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { DataPanel } from '../../../../shared/data_panel/data_panel'; | ||
import { docLinks } from '../../../../shared/doc_links'; | ||
import { HttpLogic } from '../../../../shared/http'; | ||
import { isManagedPipeline } from '../../../../shared/pipelines/is_managed'; | ||
|
||
import { PipelineJSONBadges } from './pipeline_json_badges'; | ||
import { IndexPipelinesConfigurationsLogic } from './pipelines_json_configurations_logic'; | ||
|
||
export const PipelinesJSONConfigurations: React.FC = () => { | ||
const { http } = useValues(HttpLogic); | ||
const { pipelineNames, selectedPipeline, selectedPipelineId, selectedPipelineJSON } = useValues( | ||
IndexPipelinesConfigurationsLogic | ||
); | ||
const { selectPipeline } = useActions(IndexPipelinesConfigurationsLogic); | ||
return ( | ||
<> | ||
<EuiSpacer /> | ||
<DataPanel | ||
hasBorder | ||
title={ | ||
<h2> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.title', | ||
{ defaultMessage: 'Pipeline configurations' } | ||
)} | ||
</h2> | ||
} | ||
subtitle={i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.subtitle', | ||
{ defaultMessage: 'View the JSON for your pipeline configurations on this index.' } | ||
)} | ||
footerDocLink={ | ||
<EuiLink href={docLinks.ingestPipelines} target="_blank" color="subdued"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.ingestionPipelines.docLink', | ||
{ | ||
defaultMessage: 'Learn more about how Enterprise Search uses ingest pipelines', | ||
} | ||
)} | ||
</EuiLink> | ||
} | ||
action={ | ||
pipelineNames.length > 0 && ( | ||
<EuiNotificationBadge size="m">{pipelineNames.length}</EuiNotificationBadge> | ||
) | ||
} | ||
iconType="visVega" | ||
> | ||
<EuiFormRow | ||
fullWidth | ||
label={i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.selectLabel', | ||
{ defaultMessage: 'Select an ingest pipeline to view' } | ||
)} | ||
> | ||
<EuiSelect | ||
fullWidth | ||
options={pipelineNames.map((name) => ({ text: name, value: name }))} | ||
value={selectedPipelineId} | ||
onChange={(e) => selectPipeline(e.target.value)} | ||
/> | ||
</EuiFormRow> | ||
<EuiSpacer size="m" /> | ||
{selectedPipeline && ( | ||
<> | ||
<EuiFlexGroup alignItems="center"> | ||
<EuiFlexItem> | ||
<PipelineJSONBadges /> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
{isManagedPipeline(selectedPipeline) ? ( | ||
<EuiButtonEmpty | ||
size="s" | ||
flush="both" | ||
iconType="eye" | ||
color="primary" | ||
href={http.basePath.prepend( | ||
`/app/management/ingest/ingest_pipelines/?pipeline=${selectedPipelineId}` | ||
)} | ||
> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.action.view', | ||
{ | ||
defaultMessage: 'View in Stack Management', | ||
} | ||
)} | ||
</EuiButtonEmpty> | ||
) : ( | ||
<EuiButtonEmpty | ||
size="s" | ||
flush="both" | ||
iconType="pencil" | ||
color="primary" | ||
href={http.basePath.prepend( | ||
`/app/management/ingest/ingest_pipelines/edit/${selectedPipelineId}` | ||
)} | ||
> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.pipelines.tabs.jsonConfigurations.action.edit', | ||
{ | ||
defaultMessage: 'Edit in Stack Management', | ||
} | ||
)} | ||
</EuiButtonEmpty> | ||
)} | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<EuiSpacer size="m" /> | ||
<EuiCodeBlock language="json" overflowHeight={300} isCopyable> | ||
{selectedPipelineJSON} | ||
</EuiCodeBlock> | ||
</> | ||
)} | ||
</DataPanel> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.