File tree 3 files changed +28
-17
lines changed
web/src/components/pool/system
web-core/lib/components/enabled-state 3 files changed +28
-17
lines changed Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change 8
8
<VtsQuickInfoRow :label =" $t('username')" :value =" server?.username" />
9
9
<VtsQuickInfoRow :label =" $t('read-only')" >
10
10
<template #value >
11
- <UiInfo :accent =" server?.readOnly ? 'success' : 'muted'" >
12
- {{ server?.readOnly ? $t('enabled') : $t('disabled') }}
13
- </UiInfo >
11
+ <VtsEnabledState :enabled =" server?.readOnly" />
14
12
</template >
15
13
</VtsQuickInfoRow >
16
14
<VtsQuickInfoRow :label =" $t('self-signed-certificates')" >
17
15
<template #value >
18
- <UiInfo :accent =" server?.allowUnauthorized ? 'success' : 'muted'" >
19
- {{ server?.allowUnauthorized ? $t('enabled') : $t('disabled') }}
20
- </UiInfo >
16
+ <VtsEnabledState :enabled =" server?.allowUnauthorized" />
21
17
</template >
22
18
</VtsQuickInfoRow >
23
19
</UiCard >
26
22
<script setup lang="ts">
27
23
import { useServerStore } from ' @/stores/xo-rest-api/server.store'
28
24
import type { XoPool } from ' @/types/xo/pool.type'
25
+ import VtsEnabledState from ' @core/components/enabled-state/VtsEnabledState.vue'
29
26
import VtsQuickInfoRow from ' @core/components/quick-info-row/VtsQuickInfoRow.vue'
30
27
import UiCard from ' @core/components/ui/card/UiCard.vue'
31
- import UiInfo from ' @core/components/ui/info/UiInfo.vue'
32
28
import UiTitle from ' @core/components/ui/title/UiTitle.vue'
33
29
import { computed } from ' vue'
34
30
Original file line number Diff line number Diff line change 15
15
</VtsQuickInfoRow >
16
16
<VtsQuickInfoRow :label =" $t('auto-power')" >
17
17
<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" />
21
19
</template >
22
20
</VtsQuickInfoRow >
23
21
<VtsQuickInfoRow :label =" $t('high-availability')" >
24
22
<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" />
28
24
</template >
29
25
</VtsQuickInfoRow >
30
26
<VtsQuickInfoRow :label =" $t('migration-compression')" >
31
27
<template #value >
32
- <UiInfo :accent =" pool.migrationCompression ? 'success' : 'muted'" >
33
- {{ pool.migrationCompression ? $t('enabled') : $t('disabled') }}
34
- </UiInfo >
28
+ <VtsEnabledState :enabled =" pool.migrationCompression" />
35
29
</template >
36
30
</VtsQuickInfoRow >
37
31
</UiCard >
40
34
<script setup lang="ts">
41
35
import { useHostStore } from ' @/stores/xo-rest-api/host.store'
42
36
import type { XoPool } from ' @/types/xo/pool.type'
37
+ import VtsEnabledState from ' @core/components/enabled-state/VtsEnabledState.vue'
43
38
import VtsQuickInfoRow from ' @core/components/quick-info-row/VtsQuickInfoRow.vue'
44
39
import UiCard from ' @core/components/ui/card/UiCard.vue'
45
- import UiInfo from ' @core/components/ui/info/UiInfo.vue'
46
40
import UiLink from ' @core/components/ui/link/UiLink.vue'
47
41
import UiTitle from ' @core/components/ui/title/UiTitle.vue'
48
42
import { faServer } from ' @fortawesome/free-solid-svg-icons'
You can’t perform that action at this time.
0 commit comments