Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
J0ris-K committed Jan 24, 2025
1 parent 86b03c1 commit 398da8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions @xen-orchestra/lite/src/components/pif/PifRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</td>
<td class="typo p3-regular device text-ellipsis">{{ pif.device }}</td>
<td class="typo p3-regular status">
<VtsConnectionStatus :status />
<VtsConnectionStatus v-if="pifCarrier !== undefined" :status />
</td>
<td>
<UiButtonIcon size="small" accent="info" :icon="faAngleRight" />
Expand Down Expand Up @@ -36,12 +36,12 @@ const { getByOpaqueRef: getOpaqueRefHost } = useHostStore().subscribe()
const { getByOpaqueRef: getOpaqueRefMetricsHost } = useHostMetricsStore().subscribe()
const { getPifCarrier } = usePifMetricsStore().subscribe()
const pifCarrier = getPifCarrier(pif)
const pifCarrier = computed(() => getPifCarrier(pif))
const pifCurrentlyAttached = pif.currently_attached
const status = computed((): ConnectionStatus => {
if (pifCarrier && pifCurrentlyAttached) return 'connected'
if (!pifCarrier && pifCurrentlyAttached) return 'disconnected-from-physical-device'
if (pifCarrier.value && pifCurrentlyAttached) return 'connected'
if (!pifCarrier.value && pifCurrentlyAttached) return 'disconnected-from-physical-device'
return 'disconnected'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
<!-- VLAN -->
<VtsCardRowKeyValue>
<template #key>{{ $t('vlan') }}</template>
<template #value>{{ formatValue(getNetworkVlan(network)) }}</template>
<template #value>{{ formatValue(getNetworkVlan) }}</template>
<template #addons>
<UiButtonIcon
v-if="getNetworkVlan(network)"
v-if="getNetworkVlan"
v-tooltip="copied && $t('core.copied')"
accent="info"
size="medium"
:icon="faCopy"
@click="copy(String(getNetworkVlan(network)))"
@click="copy(String(getNetworkVlan))"
/>
</template>
</VtsCardRowKeyValue>
Expand Down Expand Up @@ -143,7 +143,6 @@

<script setup lang="ts">
import PifRow from '@/components/pif/PifRow.vue'
import type { XenApiNetwork } from '@/libs/xen-api/xen-api.types'
import { useNetworkStore } from '@/stores/xen-api/network.store'
import { usePifStore } from '@/stores/xen-api/pif.store'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
Expand All @@ -168,16 +167,19 @@ const network = computed(() => networks.value.find(network => network.uuid === n
const pifs = computed(() => (network.value ? pifsByNetwork.value.get(network.value.$ref) || [] : []))
const getNetworkVlan = computed(() => (network: XenApiNetwork): string | undefined => {
const networkPIFs = pifs.value.filter(pif => network.PIFs.includes(pif.$ref))
if (networkPIFs.length > 0) {
return networkPIFs[0].VLAN !== -1 ? networkPIFs[0].VLAN.toString() : ''
const getNetworkVlan = computed(() => {
if (pifs.value.length === 0) {
return ''
}
return pifs.value[0].VLAN !== -1 ? pifs.value[0].VLAN.toString() : ''
})
const pifsCount = computed(() => pifs.value.length.toString())
const formatValue = computed(() => (value?: string | number): string => {
return value ? String(value) : '-'
})
const { copy, copied } = useClipboard()
</script>

Expand Down
1 change: 1 addition & 0 deletions @xen-orchestra/lite/src/libs/xen-api/xen-api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type ObjectTypeToRecordMapping = {
message: XenApiMessage<any>
network: XenApiNetwork
pif: XenApiPif
pif_metrics: XenApiPifMetrics
pool: XenApiPool
sr: XenApiSr
vm: XenApiVm
Expand Down
1 change: 0 additions & 1 deletion @xen-orchestra/lite/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@

"task.estimated-end": "Estimated end",
"task.progress": "Progress",

"task.started": "Started",

"theme-auto": "Auto",
Expand Down

0 comments on commit 398da8b

Please sign in to comment.