Skip to content

Commit

Permalink
chore: rename getValidationClass to getMaxSeverity
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Mar 27, 2024
1 parent 68a867f commit 2c88d93
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/components/controls/ValidationErrorsOverview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
expanded = true
}
function getValidationClass(errors: ValidationError[]): string {
function getMaxSeverity(errors: ValidationError[]): ValidationSeverity | null {
if (errors.some((e) => e.severity === ValidationSeverity.error)) {
return 'error'
return ValidationSeverity.error
} else if (errors.some((e) => e.severity === ValidationSeverity.warning)) {
return 'warning'
return ValidationSeverity.warning
} else if (errors.some((e) => e.severity === ValidationSeverity.info)) {
return 'info'
return ValidationSeverity.info
}
return ''
return null
}
</script>

Expand Down Expand Up @@ -90,7 +91,7 @@
{:else}
<table class="jse-validation-errors-overview-collapsed">
<tbody>
<tr class="jse-validation-{getValidationClass(validationErrors)}" on:click={expand}>
<tr class="jse-validation-{getMaxSeverity(validationErrors)}" on:click={expand}>
<td class="jse-validation-error-icon">
<Icon data={faExclamationTriangle} />
</td>
Expand Down

0 comments on commit 2c88d93

Please sign in to comment.