Skip to content

Commit

Permalink
Merge pull request #2195 from MahtabBukhari/Parent_source_and_destina…
Browse files Browse the repository at this point in the history
…tion_node_types_in_dropdown_should_be_unique

[BluePrint] - Parent , source and destination node types in dropdown should be unique ( for safety we should put check on frontend side too )
  • Loading branch information
Rassl authored Oct 27, 2024
2 parents da36774 + 8f02059 commit 4060195
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ export const ToNode: FC<Props> = ({ onSelect, dataTestId, edgeLink, hideSelectAl
const schemaOptions = data.schemas
.filter((schema) => !schema.is_deleted && schema.type)
.map((schema) =>
schema?.type === 'thing'
schema.type === 'thing'
? { label: 'No Parent', value: schema.type }
: {
label: capitalizeFirstLetter(schema.type),
value: schema.type,
},
)
.filter((option, index, self) => index === self.findIndex((o) => o.value === option.value))

const allOption = { label: 'Select all', value: 'all' }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ const fetchAndSetOptions = async (
(schema) => !schema.is_deleted && schema.type && (!filterFunc || filterFunc(schema)),
)

const options = filteredSchemas.map((schema) =>
schema.type === 'thing'
? { label: 'No Parent', value: schema.type }
: { label: capitalizeFirstLetter(schema.type), value: schema.type },
)
const options = filteredSchemas
.map((schema) =>
schema.type === 'thing'
? { label: 'No Parent', value: schema.type }
: { label: capitalizeFirstLetter(schema.type), value: schema.type },
)
.filter((option, index, self) => index === self.findIndex((o) => o.value === option.value))

setOptions(options)
} catch (error) {
Expand Down

0 comments on commit 4060195

Please sign in to comment.