Skip to content

Commit 4444d86

Browse files
committed

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<UiInfo :accent="state.accent">
3+
{{ state.label }}
4+
</UiInfo>
5+
</template>
6+
7+
<script setup lang="ts">
8+
import UiInfo, { type InfoAccent } from '@core/components/ui/info/UiInfo.vue'
9+
import { computed } from 'vue'
10+
import { useI18n } from 'vue-i18n'
11+
type StatesMap = Record<'enabled' | 'disabled', { label: string; accent: InfoAccent }>
12+
const { enabled = false } = defineProps<{
13+
enabled?: boolean
14+
}>()
15+
const { t } = useI18n()
16+
const statesMap: StatesMap = {
17+
enabled: { label: t('enabled'), accent: 'success' },
18+
disabled: { label: t('disabled'), accent: 'muted' },
19+
}
20+
const state = computed(() => (enabled ? statesMap.enabled : statesMap.disabled))
21+
</script>

@xen-orchestra/web/src/components/pool/system/PoolConnections.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@
88
<VtsQuickInfoRow :label="$t('username')" :value="server?.username" />
99
<VtsQuickInfoRow :label="$t('read-only')">
1010
<template #value>
11-
<UiInfo :accent="server?.readOnly ? 'success' : 'muted'">
12-
{{ server?.readOnly ? $t('enabled') : $t('disabled') }}
13-
</UiInfo>
11+
<VtsEnabledState :enabled="server?.readOnly" />
1412
</template>
1513
</VtsQuickInfoRow>
1614
<VtsQuickInfoRow :label="$t('self-signed-certificates')">
1715
<template #value>
18-
<UiInfo :accent="server?.allowUnauthorized ? 'success' : 'muted'">
19-
{{ server?.allowUnauthorized ? $t('enabled') : $t('disabled') }}
20-
</UiInfo>
16+
<VtsEnabledState :enabled="server?.allowUnauthorized" />
2117
</template>
2218
</VtsQuickInfoRow>
2319
</UiCard>
@@ -26,9 +22,9 @@
2622
<script setup lang="ts">
2723
import { useServerStore } from '@/stores/xo-rest-api/server.store'
2824
import type { XoPool } from '@/types/xo/pool.type'
25+
import VtsEnabledState from '@core/components/enabled-state/VtsEnabledState.vue'
2926
import VtsQuickInfoRow from '@core/components/quick-info-row/VtsQuickInfoRow.vue'
3027
import UiCard from '@core/components/ui/card/UiCard.vue'
31-
import UiInfo from '@core/components/ui/info/UiInfo.vue'
3228
import UiTitle from '@core/components/ui/title/UiTitle.vue'
3329
import { computed } from 'vue'
3430

@xen-orchestra/web/src/components/pool/system/PoolManagement.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,17 @@
1515
</VtsQuickInfoRow>
1616
<VtsQuickInfoRow :label="$t('auto-power')">
1717
<template #value>
18-
<UiInfo :accent="pool.auto_poweron ? 'success' : 'muted'">
19-
{{ pool.auto_poweron ? $t('enabled') : $t('disabled') }}
20-
</UiInfo>
18+
<VtsEnabledState :enabled="pool.auto_poweron" />
2119
</template>
2220
</VtsQuickInfoRow>
2321
<VtsQuickInfoRow :label="$t('high-availability')">
2422
<template #value>
25-
<UiInfo :accent="pool.HA_enabled ? 'success' : 'muted'">
26-
{{ pool.HA_enabled ? $t('enabled') : $t('disabled') }}
27-
</UiInfo>
23+
<VtsEnabledState :enabled="pool.migrationCompression" />
2824
</template>
2925
</VtsQuickInfoRow>
3026
<VtsQuickInfoRow :label="$t('migration-compression')">
3127
<template #value>
32-
<UiInfo :accent="pool.migrationCompression ? 'success' : 'muted'">
33-
{{ pool.migrationCompression ? $t('enabled') : $t('disabled') }}
34-
</UiInfo>
28+
<VtsEnabledState :enabled="pool.migrationCompression" />
3529
</template>
3630
</VtsQuickInfoRow>
3731
</UiCard>
@@ -40,9 +34,9 @@
4034
<script setup lang="ts">
4135
import { useHostStore } from '@/stores/xo-rest-api/host.store'
4236
import type { XoPool } from '@/types/xo/pool.type'
37+
import VtsEnabledState from '@core/components/enabled-state/VtsEnabledState.vue'
4338
import VtsQuickInfoRow from '@core/components/quick-info-row/VtsQuickInfoRow.vue'
4439
import UiCard from '@core/components/ui/card/UiCard.vue'
45-
import UiInfo from '@core/components/ui/info/UiInfo.vue'
4640
import UiLink from '@core/components/ui/link/UiLink.vue'
4741
import UiTitle from '@core/components/ui/title/UiTitle.vue'
4842
import { faServer } from '@fortawesome/free-solid-svg-icons'

0 commit comments

Comments
 (0)