Skip to content

Commit

Permalink
Merge pull request #6785 from TheThingsNetwork/fix/sentry-fixes-2312
Browse files Browse the repository at this point in the history
Fix various issues via sentry
  • Loading branch information
kschiffer authored Jan 8, 2024
2 parents 3703d20 + a266d52 commit 012f233
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/webui/components/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ const Form = props => {
const firstErrorNode = document.querySelectorAll('[data-needs-focus="true"]')[0]
if (firstErrorNode) {
scrollIntoView(firstErrorNode, { behavior: 'smooth' })
firstErrorNode.querySelector('input,textarea,canvas,video').focus({ preventScroll: true })
const errorInput = firstErrorNode.querySelector('input,textarea,canvas,video')
if (errorInput) {
errorInput.focus({ preventScroll: true })
} else if ('focus' in firstErrorNode) {
firstErrorNode.focus({ preventScroll: true })
}
}
}
}, [error, isSubmitting, isValid])
Expand Down
8 changes: 8 additions & 0 deletions pkg/webui/console/containers/device-importer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ const DeviceImporter = () => {

if (devices.length === 0) {
throw conversionError
} else {
const invalidEntries = devices.filter(device => !('end_device' in device))
if (devices.some(device => !('end_device' in device))) {
appendToLog('Invalid responses found:')
appendToLog(invalidEntries)

throw conversionError
}
}

setConvertedDevices(devices)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const validationSchema = Yup.object()
key: Yup.string()
.length(16 * 2, Yup.passValues(sharedMessages.validateLength)) // 16 Byte hex.
.test('is-not-all-zero-key', messages.validateSessionKey, isNonZeroSessionKey)
.default('')
.required(sharedMessages.validateRequired),
}),
s_nwk_s_int_key: Yup.lazy(() =>
Expand All @@ -104,6 +105,7 @@ const validationSchema = Yup.object()
messages.validateSessionKey,
isNonZeroSessionKey,
)
.default('')
.required(sharedMessages.validateRequired),
})
: Yup.object().strip(),
Expand All @@ -118,6 +120,7 @@ const validationSchema = Yup.object()
messages.validateSessionKey,
isNonZeroSessionKey,
)
.default('')
.required(sharedMessages.validateRequired),
})
: Yup.object().strip(),
Expand Down

0 comments on commit 012f233

Please sign in to comment.