Skip to content

Commit

Permalink
Merge pull request #1763 from Shoaibdev7/Render-schema-attributes-if-…
Browse files Browse the repository at this point in the history
…attributes-object

Render schema attributes if attributes object is passed in `GET /schema/all`
  • Loading branch information
Rassl authored Jul 24, 2024
2 parents 1c20e5c + 593ed01 commit a2991c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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

0 comments on commit a2991c2

Please sign in to comment.