Skip to content

Commit

Permalink
rename doc button and refactor type map const name
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Jun 17, 2020
1 parent 4f6c7c1 commit 2ee721c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Props {
docLink: string;
}

export const LearnMoreFormButton: FunctionComponent<Props> = ({ processorLabel, docLink }) => {
export const DocumentationButton: FunctionComponent<Props> = ({ processorLabel, docLink }) => {
return (
<EuiButtonEmpty size="s" flush="right" href={docLink} target="_blank" iconType="help">
{i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface FieldsFormDescriptor {
label: string;
}

const mapProcessorTypeToFormOrDocPath: Record<string, FieldsFormDescriptor> = {
const mapProcessorTypeToFormDescriptor: Record<string, FieldsFormDescriptor> = {
append: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/append-processor.html',
Expand Down Expand Up @@ -262,12 +262,12 @@ const mapProcessorTypeToFormOrDocPath: Record<string, FieldsFormDescriptor> = {
},
};

export const types = Object.keys(mapProcessorTypeToFormOrDocPath).sort();
export const types = Object.keys(mapProcessorTypeToFormDescriptor).sort();

export type ProcessorType = keyof typeof mapProcessorTypeToFormOrDocPath;
export type ProcessorType = keyof typeof mapProcessorTypeToFormDescriptor;

export const getProcessorFormDescriptor = (
type: ProcessorType | string
): FieldsFormDescriptor | undefined => {
return mapProcessorTypeToFormOrDocPath[type as ProcessorType];
return mapProcessorTypeToFormDescriptor[type as ProcessorType];
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Form, useForm, FormDataProvider } from '../../../../../shared_imports';
import { usePipelineProcessorsContext } from '../../context';
import { ProcessorInternal } from '../../types';

import { LearnMoreFormButton } from './learn_more_form_button';
import { DocumentationButton } from './documentation_button';
import { ProcessorSettingsFromOnSubmitArg } from './processor_settings_form.container';
import { getProcessorFormDescriptor } from './map_processor_type_to_form';
import { CommonProcessorFields, ProcessorTypeField } from './processors/common_fields';
Expand Down Expand Up @@ -83,7 +83,7 @@ export const ProcessorSettingsForm: FunctionComponent<Props> = memo(

if (formDescriptor) {
return (
<LearnMoreFormButton
<DocumentationButton
processorLabel={formDescriptor.label}
docLink={esDocsBasePath + formDescriptor.docLinkPath}
/>
Expand Down

0 comments on commit 2ee721c

Please sign in to comment.