-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Ingest Node Pipelines] Clone Pipeline #64049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jloleysens
merged 7 commits into
elastic:feature/ingest-node-pipelines
from
jloleysens:ingest-node-pipelines/clone
Apr 22, 2020
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5302def
First iteration of clone functionality
jloleysens cf675d9
satisfy eslint
jloleysens 8bc1b59
Turn on sorting for the list table
jloleysens 031523b
Clean up const declarations
jloleysens 2ffa535
Address PR feedback
jloleysens 07c07f4
Mark edit and delete as primary actions in list table
jloleysens db6dc93
Handle URI encoded chars in pipeline name when cloning
jloleysens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.