Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Sep 28, 2020
1 parent 39c7d79 commit f5205b8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const EditProcessorForm: FunctionComponent<Props> = ({
handleSubmit,
resetProcessors,
}) => {
const { testPipelineData, setCurrentTestPipelineData } = useTestPipelineContext();
const { testPipelineData, testPipelineDataDispatch } = useTestPipelineContext();
const {
testOutputPerProcessor,
config: { selectedDocumentIndex, documents },
Expand All @@ -117,7 +117,7 @@ export const EditProcessorForm: FunctionComponent<Props> = ({
testOutputPerProcessor[selectedDocumentIndex][processor.id];

const updateSelectedDocument = (index: number) => {
setCurrentTestPipelineData({
testPipelineDataDispatch({
type: 'updateActiveDocument',
payload: {
config: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ const i18nTexts = {
defaultMessage: 'Edit documents',
}
),
resetButtonLabel: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.testPipeline.documentsDropdown.resetButtonLabel',
{
defaultMessage: 'Reset',
}
),
popoverTitle: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.testPipeline.documentsDropdown.popoverTitle',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const i18nTexts = {
};

export const TestPipelineActions: FunctionComponent = () => {
const { testPipelineData, setCurrentTestPipelineData } = useTestPipelineContext();
const { testPipelineData, testPipelineDataDispatch } = useTestPipelineContext();

const {
state: { processors },
Expand All @@ -39,7 +39,7 @@ export const TestPipelineActions: FunctionComponent = () => {
const [activeFlyoutTab, setActiveFlyoutTab] = useState<TestPipelineFlyoutTab>('documents');

const updateSelectedDocument = (index: number) => {
setCurrentTestPipelineData({
testPipelineDataDispatch({
type: 'updateActiveDocument',
payload: {
config: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({

const {
testPipelineData,
setCurrentTestPipelineData,
testPipelineDataDispatch,
updateTestOutputPerProcessor,
} = useTestPipelineContext();

Expand Down Expand Up @@ -86,7 +86,7 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
// reset the per-processor output
// this is needed in the scenario where the pipeline has already executed,
// but you modified the sample documents and there was an error on re-execution
setCurrentTestPipelineData({
testPipelineDataDispatch({
type: 'updateOutputPerProcessor',
payload: {
isExecutingPipeline: false,
Expand All @@ -97,7 +97,7 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
return { isSuccessful: false };
}

setCurrentTestPipelineData({
testPipelineDataDispatch({
type: 'updateConfig',
payload: {
config: {
Expand Down Expand Up @@ -131,7 +131,7 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
processors,
services.api,
services.notifications.toasts,
setCurrentTestPipelineData,
testPipelineDataDispatch,
updateTestOutputPerProcessor,
]
);
Expand All @@ -156,7 +156,7 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
};

const resetTestOutput = () => {
setCurrentTestPipelineData({
testPipelineDataDispatch({
type: 'reset',
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type Action =

export interface TestPipelineContext {
testPipelineData: TestPipelineData;
setCurrentTestPipelineData: (data: Action) => void;
testPipelineDataDispatch: (data: Action) => void;
updateTestOutputPerProcessor: (
documents: Document[] | undefined,
processors: DeserializeResult
Expand All @@ -72,7 +72,7 @@ const DEFAULT_TEST_PIPELINE_CONTEXT = {
},
isExecutingPipeline: false,
},
setCurrentTestPipelineData: () => {},
testPipelineDataDispatch: () => {},
updateTestOutputPerProcessor: () => {},
};

Expand Down Expand Up @@ -200,7 +200,7 @@ export const TestPipelineContextProvider = ({ children }: { children: React.Reac
<TestPipelineContext.Provider
value={{
testPipelineData: state,
setCurrentTestPipelineData: dispatch,
testPipelineDataDispatch: dispatch,
updateTestOutputPerProcessor,
}}
>
Expand Down

0 comments on commit f5205b8

Please sign in to comment.