forked from SigNoz/signoz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: fe: logs pipelines timestamp parsing processor (SigNoz#4106)
* chore: add processor config for time parsing processor * chore: add select input and processor fields with enumerated options * feat: set timestamp layout to default value when layout_type is changed * chore: minor cleanup * chore: some more cleanup * chore: some more cleanup * chore: get jest passing * chore: normalize ts in pipelines previews input and output * chore: some cleanup * fix: set correct field id for timestamp format input
- Loading branch information
1 parent
d6f0559
commit fc5f0fb
Showing
6 changed files
with
217 additions
and
14 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/ProcessorForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Form, Input, Select } from 'antd'; | ||
import { ModalFooterTitle } from 'container/PipelinePage/styles'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { formValidationRules } from '../config'; | ||
import { processorFields, ProcessorFormField } from './config'; | ||
import { | ||
Container, | ||
FormWrapper, | ||
PipelineIndexIcon, | ||
StyledSelect, | ||
} from './styles'; | ||
|
||
function ProcessorFieldInput({ | ||
fieldData, | ||
}: ProcessorFieldInputProps): JSX.Element | null { | ||
const { t } = useTranslation('pipeline'); | ||
|
||
// Watch form values so we can evaluate shouldRender on | ||
// conditional fields when form values are updated. | ||
const form = Form.useFormInstance(); | ||
Form.useWatch(fieldData?.dependencies || [], form); | ||
|
||
if (fieldData.shouldRender && !fieldData.shouldRender(form)) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Container> | ||
<PipelineIndexIcon size="small"> | ||
{Number(fieldData.id) + 1} | ||
</PipelineIndexIcon> | ||
<FormWrapper> | ||
<Form.Item | ||
required={false} | ||
label={<ModalFooterTitle>{fieldData.fieldName}</ModalFooterTitle>} | ||
key={fieldData.id} | ||
name={fieldData.name} | ||
initialValue={fieldData.initialValue} | ||
rules={fieldData.rules ? fieldData.rules : formValidationRules} | ||
dependencies={fieldData.dependencies || []} | ||
> | ||
{fieldData?.options ? ( | ||
<StyledSelect> | ||
{fieldData.options.map(({ value, label }) => ( | ||
<Select.Option key={value + label} value={value}> | ||
{label} | ||
</Select.Option> | ||
))} | ||
</StyledSelect> | ||
) : ( | ||
<Input placeholder={t(fieldData.placeholder)} /> | ||
)} | ||
</Form.Item> | ||
</FormWrapper> | ||
</Container> | ||
); | ||
} | ||
|
||
interface ProcessorFieldInputProps { | ||
fieldData: ProcessorFormField; | ||
} | ||
|
||
function ProcessorForm({ processorType }: ProcessorFormProps): JSX.Element { | ||
return ( | ||
<div> | ||
{processorFields[processorType]?.map((fieldData: ProcessorFormField) => ( | ||
<ProcessorFieldInput key={fieldData.id} fieldData={fieldData} /> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
interface ProcessorFormProps { | ||
processorType: string; | ||
} | ||
|
||
export default ProcessorForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/utils.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters