-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35058b1
commit 9bc4132
Showing
4 changed files
with
153 additions
and
33 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
86 changes: 86 additions & 0 deletions
86
x-pack/plugins/ingest_pipelines/public/application/components/pipeline_request_flyout.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,86 @@ | ||
/* | ||
* 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 from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
import { | ||
EuiButtonEmpty, | ||
EuiCodeBlock, | ||
EuiFlyout, | ||
EuiFlyoutBody, | ||
EuiFlyoutFooter, | ||
EuiFlyoutHeader, | ||
EuiSpacer, | ||
EuiText, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
|
||
import { Pipeline } from '../../../common/types'; | ||
|
||
interface Props { | ||
pipeline: Pipeline; | ||
closeFlyout: () => void; | ||
} | ||
|
||
export const PipelineRequestFlyout: React.FunctionComponent<Props> = ({ | ||
closeFlyout, | ||
pipeline, | ||
}) => { | ||
const { name, ...pipelineBody } = pipeline; | ||
const endpoint = `PUT _ingest/pipeline/${name || '<pipelineName>'}`; | ||
const payload = JSON.stringify(pipelineBody, null, 2); | ||
const request = `${endpoint}\n${payload}`; | ||
|
||
return ( | ||
<EuiFlyout maxWidth={480} onClose={closeFlyout}> | ||
<EuiFlyoutHeader> | ||
<EuiTitle> | ||
<h2> | ||
{name ? ( | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.requestFlyout.namedTitle" | ||
defaultMessage="Request for '{name}'" | ||
values={{ name }} | ||
/> | ||
) : ( | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.requestFlyout.unnamedTitle" | ||
defaultMessage="Request" | ||
/> | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
|
||
<EuiFlyoutBody> | ||
<EuiText> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.requestFlyout.descriptionText" | ||
defaultMessage="This Elasticsearch request will create or update this pipeline." | ||
/> | ||
</p> | ||
</EuiText> | ||
|
||
<EuiSpacer /> | ||
|
||
<EuiCodeBlock language="json" isCopyable> | ||
{request} | ||
</EuiCodeBlock> | ||
</EuiFlyoutBody> | ||
|
||
<EuiFlyoutFooter> | ||
<EuiButtonEmpty iconType="cross" onClick={closeFlyout} flush="left"> | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.requestFlyout.closeButtonLabel" | ||
defaultMessage="Close" | ||
/> | ||
</EuiButtonEmpty> | ||
</EuiFlyoutFooter> | ||
</EuiFlyout> | ||
); | ||
}; |
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