Skip to content

Commit

Permalink
fix: hide irrelevant permissions fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaquiery committed Jun 26, 2024
1 parent e47157b commit f508425
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Components/prettify/PrettyObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,17 @@ export default function PrettyObject<
"read_access_level", "edit_access_level", "delete_access_level"
]
for (const key of access_level_keys) {
if (get_metadata(key)) {
const metadata = get_metadata(key)
if (Object.keys(metadata).length > 0) {
let v = _value[key]?._value
if (v === undefined) {
v = Number(get_metadata(key).default ?? "null") // Number(null) is 0
v = Number(metadata.default ?? "null") // Number(null) is 0
if (isNaN(v)) {
if (
get_metadata(key).api_type === 'choice' &&
get_metadata(key).choices !== null
metadata.api_type === 'choice' &&
metadata.choices !== null
) {
const choices = Object.keys(get_metadata(key).choices!)
const choices = Object.keys(metadata.choices!)
v = choices[choices.length - 1]
} else
v = ''
Expand Down

0 comments on commit f508425

Please sign in to comment.