From 243106d836e7858e694a880664c2169059cf9188 Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Sat, 18 Apr 2020 21:38:14 -0400 Subject: [PATCH 1/2] polish details panel and empty list --- .../sections/pipelines_list/details.tsx | 95 ++++++++++--------- .../pipelines_list/details_json_block.tsx | 32 ++++--- .../sections/pipelines_list/empty_list.tsx | 4 +- 3 files changed, 71 insertions(+), 60 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx index 798b9153a1644..2e14216ece5ad 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx @@ -12,6 +12,8 @@ import { EuiFlyoutBody, EuiTitle, EuiDescriptionList, + EuiDescriptionListTitle, + EuiDescriptionListDescription, EuiSpacer, EuiFlyoutFooter, EuiFlexGroup, @@ -35,24 +37,6 @@ export const PipelineDetails: FunctionComponent = ({ onEditClick, onDeleteClick, }) => { - const descriptionListItems = [ - { - title: i18n.translate('xpack.ingestPipelines.list.pipelineDetails.descriptionTitle', { - defaultMessage: 'Description', - }), - description: pipeline.description ?? '', - }, - ]; - - if (pipeline.version) { - descriptionListItems.push({ - title: i18n.translate('xpack.ingestPipelines.list.pipelineDetails.versionTitle', { - defaultMessage: 'Version', - }), - description: String(pipeline.version), - }); - } - return ( = ({ - + + {/* Pipeline description */} + + {i18n.translate('xpack.ingestPipelines.list.pipelineDetails.descriptionTitle', { + defaultMessage: 'Description', + })} + + + {pipeline.description ?? ''} + - + {/* Pipeline version */} + {pipeline.version && ( + <> + + {i18n.translate('xpack.ingestPipelines.list.pipelineDetails.versionTitle', { + defaultMessage: 'Version', + })} + + + {String(pipeline.version)} + + + )} - + {/* Processors JSON */} + + {i18n.translate('xpack.ingestPipelines.list.pipelineDetails.processorsTitle', { + defaultMessage: 'Processors JSON', + })} + + + + - {/* On Failure Processor JSON */} - {pipeline.on_failure?.length && ( - <> - - - - )} - {/* End On Failure Processor JSON */} + {/* On Failure Processor JSON */} + {pipeline.on_failure?.length && ( + <> + + {i18n.translate( + 'xpack.ingestPipelines.list.pipelineDetails.failureProcessorsTitle', + { + defaultMessage: 'On failure processors JSON', + } + )} + + + + + + )} + diff --git a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details_json_block.tsx b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details_json_block.tsx index b648d2445b271..6c44336c7547d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details_json_block.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details_json_block.tsx @@ -4,24 +4,28 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { FunctionComponent } from 'react'; -import { EuiCodeBlock, EuiText } from '@elastic/eui'; +import React, { FunctionComponent, useRef } from 'react'; +import { EuiCodeBlock } from '@elastic/eui'; export interface Props { - htmlForId: string; - label: string; json: Record; } -export const PipelineDetailsJsonBlock: FunctionComponent = ({ label, htmlForId, json }) => ( - <> - - - - +export const PipelineDetailsJsonBlock: FunctionComponent = ({ json }) => { + // Hack so copied-to-clipboard value updates as content changes + // Related issue: https://github.com/elastic/eui/issues/3321 + const uuid = useRef(0); + uuid.current++; + + return ( + 0 ? 300 : undefined} + isCopyable + key={uuid.current} + > {JSON.stringify(json, null, 2)} - -); + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/empty_list.tsx b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/empty_list.tsx index 45c09a944a74f..ef64fb33a6a55 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/empty_list.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/empty_list.tsx @@ -14,12 +14,12 @@ export const EmptyList: FunctionComponent = () => ( title={

{i18n.translate('xpack.ingestPipelines.list.table.emptyPromptTitle', { - defaultMessage: 'Create your first pipeline', + defaultMessage: 'Start by creating a pipeline', })}

} actions={ - + {i18n.translate('xpack.ingestPipelines.list.table.emptyPrompt.createButtonLabel', { defaultMessage: 'Create a pipeline', })} From e527d4a95c1bee9cb312660f37851fb84fee7061 Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Sun, 19 Apr 2020 21:39:51 -0400 Subject: [PATCH 2/2] remove unused import --- .../public/application/sections/pipelines_list/details.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx index 2e14216ece5ad..a3e47cb59860d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.tsx @@ -14,7 +14,6 @@ import { EuiDescriptionList, EuiDescriptionListTitle, EuiDescriptionListDescription, - EuiSpacer, EuiFlyoutFooter, EuiFlexGroup, EuiFlexItem,