Skip to content

Commit

Permalink
Add reload button
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Apr 8, 2020
1 parent 4804b65 commit 58a4deb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const PipelinesList: React.FunctionComponent = () => {
services.metric.trackUiMetric(UIM_PIPELINES_LIST_LOAD);
}, [services.metric]);

const { data, isLoading, error } = services.api.useLoadPipelines();
const { data, isLoading, error, sendRequest } = services.api.useLoadPipelines();

let content: React.ReactNode;

Expand All @@ -54,6 +54,9 @@ export const PipelinesList: React.FunctionComponent = () => {
} else if (data?.length) {
content = (
<PipelineTable
onReloadClick={() => {
sendRequest();
}}
onEditPipelineClick={() => {}}
onDeletePipelineClick={() => {}}
onViewPipelineClick={setSelectedPipeline}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,35 @@
*/
import React, { FunctionComponent } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiInMemoryTable, EuiLink } from '@elastic/eui';
import { EuiInMemoryTable, EuiLink, EuiButton } from '@elastic/eui';

import { Pipeline } from '../../../../common/types';

export interface Props {
pipelines: Pipeline[];
onReloadClick: () => void;
onEditPipelineClick: (pipeline: Pipeline) => void;
onDeletePipelineClick: (pipeline: Pipeline) => void;
onViewPipelineClick: (pipeline: Pipeline) => void;
}

export const PipelineTable: FunctionComponent<Props> = ({
pipelines,
onReloadClick,
onEditPipelineClick,
onDeletePipelineClick,
onViewPipelineClick,
}) => {
return (
<EuiInMemoryTable
search={{
toolsRight: (
<EuiButton iconType="refresh" color="secondary" onClick={onReloadClick}>
{i18n.translate('xpack.ingestPipelines.list.table.reloadButtonLabel', {
defaultMessage: 'Reload',
})}
</EuiButton>
),
box: {
incremental: true,
},
Expand Down

0 comments on commit 58a4deb

Please sign in to comment.