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

Render schema attributes if attributes object is passed in GET /schema/all #1763

Merged
3 changes: 2 additions & 1 deletion src/components/AddItemModal/SetAttributesStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const SetAttributesStep: FC<Props> = ({ handleSelectType, skipToStep, nod

const data = await getNodeType(nodeType)

const parsedData = parseJson(data)
const parsedData =
data.attributes && typeof data.attributes === 'object' ? parseJson(data.attributes) : parseJson(data)

const filteredAttributes = parsedData.filter((attr) => attr.key !== 'node_key')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export const FormInput = ({

const data = await getNodeType(parentParam as string)

parsedDataDefault = parseJson(data)
if (data.attributes && typeof data.attributes === 'object') {
parsedDataDefault = parseJson(data.attributes)
} else {
parsedDataDefault = parseJson(data)
}
}

parsedDataDefault = parsedDataDefault.filter((x) => x.key !== 'node_key')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react'
import { ClipLoader } from 'react-spinners'
import styled from 'styled-components'
import { AddEdgeNode } from '~/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode'
import { Flex } from '~/components/common/Flex'
import { Schema, getSchemaAll } from '~/network/fetchSourcesData'
import { useSchemaStore } from '~/stores/useSchemaStore'
Expand All @@ -9,7 +10,6 @@ import { SchemaWithChildren } from '../types'
import { Editor } from './Editor'
import { Graph } from './Graph'
import { Toolbar } from './Toolbar'
import { AddEdgeNode } from '~/components/ModalsContainer/BlueprintModal/Body/AddEdgeNode'

export type FormData = {
type: string
Expand Down
Loading