Skip to content

Commit

Permalink
fix(yamlCodeBlock): disabled fields are missing from yaml configs [KH…
Browse files Browse the repository at this point in the history
…CP-11409] (#1347)
  • Loading branch information
mptap authored Apr 19, 2024
1 parent 378462f commit adee099
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const props = defineProps({
const yamlContent = computed((): string => {
// filter out null values, empty strings, and empty arrays since decK doesn't accept them [KHCP-10642]
const filteredRecord = Object.fromEntries(Object.entries(props.yamlRecord).filter(([, value]) => value && (Array.isArray(value) ? value.length !== 0 : true)))
const filteredRecord = Object.fromEntries(Object.entries(props.yamlRecord).filter(([, value]) => value !== null && value !== '' && (Array.isArray(value) ? value.length !== 0 : true)))
// if empty object, display empty yaml, else convert to yaml and remove any trailing whitespace
return (Object.keys(filteredRecord).length === 0 && filteredRecord.constructor === Object) ? '' : yaml.dump(filteredRecord).trim()
})
Expand Down

0 comments on commit adee099

Please sign in to comment.