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

[Ingest pipelines] Fix duplicate tab states #79501

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const i18nTexts = {
defaultMessage: 'Documents:',
}
),
addDocumentsButtonLabel: i18n.translate(
editDocumentsButtonLabel: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.testPipeline.documentsDropdown.editDocumentsButtonLabel',
{
defaultMessage: 'Edit documents',
Expand Down Expand Up @@ -124,7 +124,7 @@ export const DocumentsDropdown: FunctionComponent<Props> = ({
}}
data-test-subj="editDocumentsButton"
>
{i18nTexts.addDocumentsButtonLabel}
{i18nTexts.editDocumentsButtonLabel}
</EuiButton>
</EuiPopoverFooter>
</EuiPopover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const TestPipelineActions: FunctionComponent = () => {
{openTestPipelineFlyout && (
<TestPipelineFlyout
activeTab={activeFlyoutTab}
setActiveTab={setActiveFlyoutTab}
processors={{
processors: processors.state.processors,
onFailure: processors.state.onFailure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { TestPipelineFlyoutTab } from './test_pipeline_tabs';

export interface Props {
activeTab: TestPipelineFlyoutTab;
setActiveTab: (tab: TestPipelineFlyoutTab) => void;
onClose: () => void;
processors: DeserializeResult;
}
Expand All @@ -35,6 +36,7 @@ export interface TestPipelineFlyoutForm {
export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
onClose,
activeTab,
setActiveTab,
processors,
}) => {
const { services } = useKibana();
Expand All @@ -56,8 +58,6 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
},
});

const [selectedTab, setSelectedTab] = useState<TestPipelineFlyoutTab>(activeTab);

const [isRunningTest, setIsRunningTest] = useState<boolean>(false);
const [testingError, setTestingError] = useState<any>(null);
const [testOutput, setTestOutput] = useState<any>(undefined);
Expand Down Expand Up @@ -155,7 +155,7 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
});

if (isSuccessful) {
setSelectedTab('output');
setActiveTab('output');
}
};

Expand Down Expand Up @@ -184,8 +184,8 @@ export const TestPipelineFlyout: React.FunctionComponent<Props> = ({
testOutput={testOutput}
form={form}
validateAndTestPipeline={validateAndTestPipeline}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
selectedTab={activeTab}
setSelectedTab={setActiveTab}
testingError={testingError}
onClose={onClose}
/>
Expand Down