-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/ingest-node-pipelines' of github.com:elastic/ki…
…bana into ingest-node-pipelines/privileges * 'feature/ingest-node-pipelines' of github.com:elastic/kibana: [Ingest Node Pipelines] Clone Pipeline (#64049) # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/app.tsx
- Loading branch information
Showing
8 changed files
with
194 additions
and
16 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
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
7 changes: 7 additions & 0 deletions
7
x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_clone/index.ts
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,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { PipelinesClone } from './pipelines_clone'; |
59 changes: 59 additions & 0 deletions
59
.../plugins/ingest_pipelines/public/application/sections/pipelines_clone/pipelines_clone.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,59 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { FunctionComponent, useEffect } from 'react'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
import { SectionLoading, useKibana } from '../../../shared_imports'; | ||
|
||
import { PipelinesCreate } from '../pipelines_create'; | ||
|
||
export interface ParamProps { | ||
sourceName: string; | ||
} | ||
|
||
/** | ||
* This section is a wrapper around the create section where we receive a pipeline name | ||
* to load and set as the source pipeline for the {@link PipelinesCreate} form. | ||
*/ | ||
export const PipelinesClone: FunctionComponent<RouteComponentProps<ParamProps>> = props => { | ||
const { sourceName } = props.match.params; | ||
const { services } = useKibana(); | ||
|
||
const { error, data: pipeline, isLoading, isInitialRequest } = services.api.useLoadPipeline( | ||
decodeURIComponent(sourceName) | ||
); | ||
|
||
useEffect(() => { | ||
if (error && !isLoading) { | ||
services.notifications!.toasts.addError(error, { | ||
title: i18n.translate('xpack.ingestPipelines.clone.loadSourcePipelineErrorTitle', { | ||
defaultMessage: 'Cannot load {name}.', | ||
values: { name: sourceName }, | ||
}), | ||
}); | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [error, isLoading]); | ||
|
||
if (isLoading && isInitialRequest) { | ||
return ( | ||
<SectionLoading> | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.clone.loadingPipelinesDescription" | ||
defaultMessage="Loading pipeline…" | ||
/> | ||
</SectionLoading> | ||
); | ||
} else { | ||
// We still show the create form even if we were not able to load the | ||
// latest pipeline data. | ||
const sourcePipeline = pipeline ? { ...pipeline, name: `${pipeline.name}-copy` } : undefined; | ||
return <PipelinesCreate {...props} sourcePipeline={sourcePipeline} />; | ||
} | ||
}; |
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
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
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
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