-
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.
Refactor list and address PR feedback
Refactored the list into smaller pieces and assemble in main.tsx Also addressed feedback on copy, removed unused notifications dep
- Loading branch information
1 parent
466f690
commit 86f50c8
Showing
8 changed files
with
258 additions
and
171 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
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/details.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,22 @@ | ||
/* | ||
* 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 } from 'react'; | ||
import { EuiFlyout, EuiFlyoutHeader, EuiFlyoutBody } from '@elastic/eui'; | ||
import { Pipeline } from '../../../../common/types'; | ||
|
||
export interface Props { | ||
visible: boolean; | ||
pipeline: Pipeline; | ||
} | ||
|
||
export const PipelineDetails: FunctionComponent<Props> = ({ pipeline, visible }) => { | ||
if (!visible) { | ||
return null; | ||
} | ||
|
||
return; | ||
}; |
33 changes: 33 additions & 0 deletions
33
x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/empty_list.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,33 @@ | ||
/* | ||
* 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 } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; | ||
|
||
interface Props { | ||
onClick: () => void; | ||
} | ||
|
||
export const EmptyList: FunctionComponent<Props> = ({ onClick }) => ( | ||
<EuiEmptyPrompt | ||
iconType="managementApp" | ||
titleSize="xs" | ||
title={ | ||
<h1> | ||
{i18n.translate('xpack.ingestPipelines.list.table.emptyPromptTitle', { | ||
defaultMessage: 'Create your first pipeline', | ||
})} | ||
</h1> | ||
} | ||
actions={ | ||
<EuiButton onClick={onClick}> | ||
{i18n.translate('xpack.ingestPipelines.list.table.emptyPrompt.createButtonLabel', { | ||
defaultMessage: 'Create pipeline', | ||
})} | ||
</EuiButton> | ||
} | ||
/> | ||
); |
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
114 changes: 114 additions & 0 deletions
114
x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_list/main.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,114 @@ | ||
/* | ||
* 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, { useEffect } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
import { | ||
EuiPageBody, | ||
EuiPageContent, | ||
EuiTitle, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiButtonEmpty, | ||
EuiCallOut, | ||
EuiLoadingSpinner, | ||
} from '@elastic/eui'; | ||
|
||
import { EuiSpacer, EuiText } from '@elastic/eui'; | ||
|
||
import { useKibana } from '../../../shared_imports'; | ||
import { UIM_PIPELINES_LIST_LOAD } from '../../constants'; | ||
|
||
import { EmptyList } from './empty_list'; | ||
import { PipelineTable } from './table'; | ||
|
||
export const PipelinesList: React.FunctionComponent = () => { | ||
const { services } = useKibana(); | ||
|
||
// Track component loaded | ||
useEffect(() => { | ||
services.metric.trackUiMetric(UIM_PIPELINES_LIST_LOAD); | ||
}, [services.metric]); | ||
|
||
const { data, isLoading, error } = services.api.useLoadPipelines(); | ||
|
||
let content: React.ReactNode; | ||
|
||
if (isLoading) { | ||
content = ( | ||
<EuiFlexGroup justifyContent="spaceAround"> | ||
<EuiFlexItem grow={false}> | ||
<EuiLoadingSpinner size="xl" /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
} else if (data?.length) { | ||
content = ( | ||
<PipelineTable | ||
onEditPipelineClick={() => {}} | ||
onDeletePipelineClick={() => {}} | ||
pipelines={data} | ||
/> | ||
); | ||
} else { | ||
content = <EmptyList onClick={() => {}} />; | ||
} | ||
|
||
return ( | ||
<EuiPageBody> | ||
<EuiPageContent> | ||
<EuiTitle size="l"> | ||
<EuiFlexGroup alignItems="center"> | ||
<EuiFlexItem> | ||
<h1 data-test-subj="appTitle"> | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.list.listTitle" | ||
defaultMessage="Ingest Pipelines" | ||
/> | ||
</h1> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty | ||
href={services.documentation.getIngestNodeUrl()} | ||
target="_blank" | ||
iconType="help" | ||
> | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.list.pipelinesDocsLinkText" | ||
defaultMessage="Ingest Pipelines docs" | ||
/> | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiTitle> | ||
<EuiSpacer size="s" /> | ||
<EuiTitle size="s"> | ||
<EuiText color="subdued"> | ||
<FormattedMessage | ||
id="xpack.ingestPipelines.list.pipelinesDescription" | ||
defaultMessage="Use ingest node pipelines to pre-process documents before indexing." | ||
/> | ||
</EuiText> | ||
</EuiTitle> | ||
<EuiSpacer size="m" /> | ||
{/* Error call out or pipeline table */} | ||
{error ? ( | ||
<EuiCallOut | ||
iconType="faceSad" | ||
color="danger" | ||
title={i18n.translate('xpack.ingestPipelines.list.loadErrorTitle', { | ||
defaultMessage: 'Cannot load pipelines, please refresh the page to try again.', | ||
})} | ||
/> | ||
) : ( | ||
content | ||
)} | ||
</EuiPageContent> | ||
</EuiPageBody> | ||
); | ||
}; |
166 changes: 0 additions & 166 deletions
166
...ck/plugins/ingest_pipelines/public/application/sections/pipelines_list/pipelines_list.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.