fix: update ColorVariant => DEFAULT_STATUS_ICON

This commit is contained in:
axolotle 2024-07-25 17:39:17 +02:00
parent 3c6f4f3e3c
commit a875d6f74e
3 changed files with 12 additions and 7 deletions

View file

@ -1,4 +1,5 @@
<script setup lang="ts">
import type { ColorVariant } from 'bootstrap-vue-next'
import { computed } from 'vue'
import { DEFAULT_STATUS_ICON } from '@/helpers/yunohostArguments'
@ -6,7 +7,7 @@ import { DEFAULT_STATUS_ICON } from '@/helpers/yunohostArguments'
const props = withDefaults(
defineProps<{
alert?: boolean
variant?: keyof typeof DEFAULT_STATUS_ICON
variant?: ColorVariant
icon?: string
}>(),
{
@ -30,7 +31,7 @@ const icon = computed(() => {
:class="{ ['alert alert-' + variant]: !alert }"
class="yuno-alert d-flex flex-column flex-md-row align-items-center"
>
<YIcon :iname="icon" class="me-md-3 mb-md-0 mb-2 md" />
<YIcon v-if="icon" :iname="icon" class="me-md-3 mb-md-0 mb-2 md" />
<div class="w-100">
<slot name="default" />

View file

@ -12,12 +12,14 @@ import type { AdressModelValue, FileModelValue } from '@/types/form'
import { isAdressModelValue, isFileModelValue } from '@/types/form'
export const DEFAULT_STATUS_ICON = {
[null]: null,
danger: 'times',
error: 'times',
info: 'info',
primary: null,
secondary: null,
success: 'check',
danger: 'times',
warning: 'warning',
info: 'info',
light: null,
dark: null,
}
// FORMAT FROM CORE

View file

@ -32,7 +32,6 @@ function onQueriesResponse(_: any, reportsData: any) {
for (const item of report.items) {
const status = (item.variant = item.status.toLowerCase())
item.icon = DEFAULT_STATUS_ICON[status]
item.issue = false
if (item.ignored) {
@ -50,6 +49,9 @@ function onQueriesResponse(_: any, reportsData: any) {
report.errors++
}
}
item.icon =
DEFAULT_STATUS_ICON[item.variant as 'success' | 'warning' | 'danger']
}
report.noIssues = report.warnings + report.errors === 0