Skip to content
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

feat: frontend: log pipelines preview #3706

Merged
merged 19 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ad6aee2
feat: add pipeline preview API
raj-k-singh Oct 10, 2023
a37b253
chore: separate PipelineActions and ProcessorActions components
raj-k-singh Oct 10, 2023
6cbcf74
feat: add pipeline preview action
raj-k-singh Oct 10, 2023
53ba6a8
chore: extract useSampleLogs hook and move SampleLogs to filter previ…
raj-k-singh Oct 10, 2023
edfd1fd
chore: extract SampleLogsResponseDisplay for reuse
raj-k-singh Oct 10, 2023
4cbc421
feat: bring together pipeline preview modal content
raj-k-singh Oct 10, 2023
e2df80b
chore: generalize SampleLogsResponse to LogsResponse
raj-k-singh Oct 10, 2023
67b2a04
feat: finish wiring up pipeline preview flow
raj-k-singh Oct 10, 2023
d1e45d8
chore: separate response models for useSampleLogs and usePipelinePreview
raj-k-singh Oct 10, 2023
377badc
chore: require explicit action for simulation after changing logs sam…
raj-k-singh Oct 10, 2023
ffb7e08
feat: error and empty state for pipeline simulation result
raj-k-singh Oct 10, 2023
d926807
chore: look for error in sample logs response data too
raj-k-singh Oct 10, 2023
5a006d7
chore: remove tests for deleted component & update snapshot for Pipel…
raj-k-singh Oct 10, 2023
f7fbdbf
chore: minor cleanup
raj-k-singh Oct 10, 2023
0565f28
chore: address feedback: move timestamp normalization out of api file
raj-k-singh Oct 11, 2023
3a02264
chore: address feedback: use axios directly in pipeline preview API call
raj-k-singh Oct 11, 2023
02ea034
chore: address feedback: use REACT_QUERY_KEY constant for useQuery key
raj-k-singh Oct 11, 2023
23d0fe0
chore: minor cleanup
raj-k-singh Oct 11, 2023
c5c9dc3
Merge branch 'develop' into feat/frontend-logpipelines-preview
palashgdev Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add pipeline preview action
  • Loading branch information
raj-k-singh committed Oct 11, 2023
commit 6cbcf749e250fb5c0e3a8b229f4fa52b0f652c8c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { EyeFilled } from '@ant-design/icons';
import { Divider, Modal } from 'antd';
import { useState } from 'react';
import { PipelineData } from 'types/api/pipeline/def';

import { iconStyle } from '../../../config';

function PreviewAction({ pipeline }: PreviewActionProps): JSX.Element | null {
const [previewKey, setPreviewKey] = useState<string | null>(null);
const isModalOpen = Boolean(previewKey);

const openModal = (): void => setPreviewKey(String(Math.random()));
const closeModal = (): void => setPreviewKey(null);

console.log(pipeline);

// Can only preview pipelines with some processors in them
if ((pipeline?.config?.length || 0) < 1) {
return null;
}

return (
<>
<EyeFilled style={iconStyle} onClick={openModal} />
<Modal
open={isModalOpen}
onCancel={closeModal}
centered
width={800}
footer={null}
title={`Logs processing preview for ${pipeline.name}`}
>
<Divider />
{/* isModalOpen && <PipelinePreview pipeline={pipeline} key={previewKey} /> */}
</Modal>
</>
);
}

export interface PreviewActionProps {
pipeline: PipelineData;
}
export default PreviewAction;
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import { IconListStyle } from '../styles';
import DeleteAction from './TableActions/DeleteAction';
import EditAction from './TableActions/EditAction';
import { PipelineData } from 'types/api/pipeline/def';

import { IconListStyle } from '../../styles';
import DeleteAction from '../TableActions/DeleteAction';
import EditAction from '../TableActions/EditAction';
import PreviewAction from './components/PreviewAction';

function PipelineActions({
pipeline,
editAction,
deleteAction,
}: PipelineActionsProps): JSX.Element {
return (
<IconListStyle>
<PreviewAction pipeline={pipeline} />
<EditAction editAction={editAction} isPipelineAction />
<DeleteAction deleteAction={deleteAction} isPipelineAction />
</IconListStyle>
);
}

export interface PipelineActionsProps {
pipeline: PipelineData;
editAction: VoidFunction;
deleteAction: VoidFunction;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ function PipelineListsView({
align: 'center',
render: (_value, record): JSX.Element => (
<PipelineActions
pipeline={record}
editAction={pipelineEditAction(record)}
deleteAction={pipelineDeleteAction(record)}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { render } from '@testing-library/react';
import PipelineActions from 'container/PipelinePage/PipelineListsView/TableComponents/PipelineActions';
import { I18nextProvider } from 'react-i18next';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router-dom';
import i18n from 'ReactI18';
import store from 'store';

import { pipelineMockData } from '../mocks/pipeline';
import PipelineActions from '../PipelineListsView/TableComponents/PipelineActions';

describe('PipelinePage container test', () => {
it('should render PipelineActions section', () => {
const { asFragment } = render(
<MemoryRouter>
<Provider store={store}>
<I18nextProvider i18n={i18n}>
<PipelineActions editAction={jest.fn()} deleteAction={jest.fn()} />
<PipelineActions
pipeline={pipelineMockData[0]}
editAction={jest.fn()}
deleteAction={jest.fn()}
/>
</I18nextProvider>
</Provider>
</MemoryRouter>,
Expand Down