Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(xo-6): add host network view #8198

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ad30871
feat(xo-6): implement network view
CzechSebastian Nov 15, 2024
c66fcee
feat(xo-6): Add css
CzechSebastian Nov 18, 2024
c7cddbb
feat(xo-6): add behavior
CzechSebastian Nov 18, 2024
5ba4762
feat(xo-6): add stores
CzechSebastian Nov 19, 2024
d2f47b8
feat(xo-6): remove locales
CzechSebastian Nov 19, 2024
e2f61dc
feat(xo-6): locales change
CzechSebastian Nov 19, 2024
bc1040c
feat(xo-6): locales migration
CzechSebastian Nov 19, 2024
fda6d12
feat(xo-6): PR feedback
CzechSebastian Nov 20, 2024
45fd76e
feat(xo6): feedback
CzechSebastian Nov 21, 2024
aab732d
feat(xo6): refactor store
CzechSebastian Nov 22, 2024
cf84b09
feat(xo6): refactor store
CzechSebastian Nov 25, 2024
d9aa25f
feat(xo-6): remove code not relevant of store
CzechSebastian Nov 27, 2024
d6bebdb
feat(xo-6): remove code not relevant of store
CzechSebastian Nov 27, 2024
a22fb2f
feat(xo-6): remove locale
CzechSebastian Nov 29, 2024
ba5c963
feat(xo-6): add locale
CzechSebastian Nov 29, 2024
a169de5
feat(xo-6): feedback
CzechSebastian Dec 4, 2024
85e6a35
feat(xo-6): implement network view
CzechSebastian Nov 15, 2024
dbcdd9e
feat(xo6): Update with checkbox composable
CzechSebastian Nov 25, 2024
a3a66f7
feat(xo6): remove duplicated
CzechSebastian Nov 25, 2024
eef4d02
feat(xo6): wip make pif table component
CzechSebastian Nov 25, 2024
4c51cb5
feat(xo-6): display table with filter
CzechSebastian Nov 26, 2024
0ee0348
feat(xo-6): css on table
CzechSebastian Nov 26, 2024
95284d3
feat(xo-6):handle fake store
CzechSebastian Nov 28, 2024
32e33d4
feat(xo-6):update info
CzechSebastian Nov 28, 2024
d296e7a
feat(xo-6):update with new card key component
CzechSebastian Nov 28, 2024
edcf124
feat(web-core): update css alignment, tooltip and ellipsis on text
CzechSebastian Nov 28, 2024
9e91081
feat(xo-6): add row selection
CzechSebastian Nov 29, 2024
d0f63fa
feat(web-core): add state for empty panel (wip)
CzechSebastian Nov 29, 2024
e85fdad
feat(web-core): wip
CzechSebastian Dec 2, 2024
ca79d92
feat(xo-6): add table scrolling bar
CzechSebastian Dec 2, 2024
2d205b7
feat(xo-6): add responsiveness for table
CzechSebastian Dec 2, 2024
1467416
feat(xo-6): update headers
CzechSebastian Dec 3, 2024
1c4e908
feat(xo-6): add no-selection panel
CzechSebastian Dec 3, 2024
224192e
feat(x0-6): typing
CzechSebastian Dec 5, 2024
1a132fd
feat(xo-6): remove classes
CzechSebastian Dec 5, 2024
b93e8aa
feat(xo-6): add store
CzechSebastian Dec 5, 2024
24b71fa
feat(xo-6): handle None values
CzechSebastian Dec 5, 2024
906bf3d
feat(xo-6): simplify functions
CzechSebastian Dec 5, 2024
3c61e25
feat(xo-6): handle header width
CzechSebastian Dec 6, 2024
539222e
feat(xo-6): update table container
CzechSebastian Dec 11, 2024
c714f7a
feat(xo-6): remove media queries
CzechSebastian Dec 11, 2024
c24b24e
feat(xo-6): add copyToClipboard function
CzechSebastian Dec 17, 2024
c2a5c07
feat(xo-6): add loader on table
CzechSebastian Dec 17, 2024
2682dfe
add connection status for pifs
CzechSebastian Dec 19, 2024
1021ed2
remove pifStatus
CzechSebastian Dec 19, 2024
ac125ac
add pagination
CzechSebastian Dec 19, 2024
8d9ed99
add locales
CzechSebastian Dec 19, 2024
4eae898
wip
CzechSebastian Dec 19, 2024
6f7d7d3
reactive pagination
CzechSebastian Dec 20, 2024
eb4ed38
update component
CzechSebastian Jan 6, 2025
907f423
add selction by id
CzechSebastian Jan 6, 2025
6a1ad05
add selction by id
CzechSebastian Jan 7, 2025
8183a77
feat(web-core): add reactivity to pagination
CzechSebastian Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(xo-6): handle None values
  • Loading branch information
CzechSebastian committed Dec 19, 2024
commit 24b71fa0fe58c8c6bce31af3f6e582175efc6cc2
2 changes: 2 additions & 0 deletions @xen-orchestra/web-core/lib/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"network-block-device": "Network block device",
"network-information": "Network Information",
"no-data": "No data",
"none": "None",
"object-not-found": "Object {id} can't be found…",
"off": "Off",
"on": "On",
Expand Down Expand Up @@ -118,6 +119,7 @@

"total": "Total",
"total-cpus": "Total CPUs",
"unknown": "Unknown",
"uuid": "Uuid",
"vlan": "VLAN",
"vms": "VMs"
Expand Down
2 changes: 2 additions & 0 deletions @xen-orchestra/web-core/lib/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"network-block-device": "Appareil de blocage réseau",
"network-information": "Information du réseau",
"no-data": "Aucune donnée",
"none": "Aucun",
"object-not-found": "L'objet {id} est introuvable…",
"off": "Éteint",
"on": "Allumé",
Expand Down Expand Up @@ -117,6 +118,7 @@

"total": "Total",
"total-cpus": "Total CPUs",
"unknown": "Inconnu",
"uuid": "Uuid",
"vlan": "VLAN",
"vms": "VMs"
Expand Down
52 changes: 31 additions & 21 deletions @xen-orchestra/web/src/components/pif/PifPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{{ $t('network') }}
</template>
<template #value>
{{ getNetworkData(pif, 'name_label') }}
{{ getNetworkData('name_label') }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -50,23 +50,23 @@
{{ $t('pif-status') }}
</template>
<template #value>
<PifStatus :icon="faCircle" :pif="props.pif" card />
<PifStatus :pif="props.pif" card />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>
{{ $t('physical-interface-status') }}
</template>
<template #value>
<PifStatus :icon="faCircle" :pif="props.pif" card />
<PifStatus :pif="props.pif" card />
</template>
</VtsCardRowKeyValue>
<VtsCardRowKeyValue>
<template #key>
{{ $t('vlan') }}
</template>
<template #value>
{{ props.pif.vlan }}
{{ getPifData('vlan') }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -77,8 +77,9 @@
{{ $t('tags') }}
</template>
<template #value>
<div class="tags">
<UiTag v-for="tag in getTags(pif)" :key="tag" accent="info" variant="secondary">
<div v-if="!Array.isArray(getNetworkData('tags'))">{{ getNetworkData('tags') }}</div>
<div v-else class="tags">
<UiTag v-for="tag in getNetworkData('tags')" :key="tag" accent="info" variant="secondary">
{{ tag }}
</UiTag>
</div>
Expand All @@ -95,7 +96,8 @@
{{ $t('ip-addresses') }}
</template>
<template #value>
<p v-for="ip in allIps" :key="ip" v-tooltip class="ip-address text-ellipsis">{{ ip }}</p>
<p v-for="ip in allIps" :key="ip" v-tooltip class="ip-address text-ellipsis">{{ getPifData('ip') }}</p>
<p v-if="!allIps.length">{{ getPifData('ip') }}</p>
</template>
<template #addons>
<UiButtonIcon v-if="allIps.length > 1" :icon="faEllipsis" size="medium" accent="info" />
Expand All @@ -118,7 +120,7 @@
{{ $t('netmask') }}
</template>
<template #value>
{{ props.pif.netmask }}
{{ getPifData('netmask') }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -129,7 +131,7 @@
{{ $t('dns') }}
</template>
<template #value>
{{ props.pif.dns }}
{{ getPifData('dns') }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -140,7 +142,7 @@
{{ $t('gateway') }}
</template>
<template #value>
{{ props.pif.gateway }}
{{ getPifData('gateway') }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand Down Expand Up @@ -183,7 +185,7 @@
{{ $t('network-block-device') }}
</template>
<template #value>
{{ $t(`${getNetworkData(pif, 'nbd')}`) }}
{{ $t(`${getNetworkData('nbd')}`) }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -194,7 +196,7 @@
{{ $t('default-locking-mode') }}
</template>
<template #value>
{{ $t(`${getNetworkData(pif, 'defaultIsLocked')}`) }}
{{ $t(`${getNetworkData('defaultIsLocked')}`) }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand Down Expand Up @@ -232,17 +234,25 @@ const allIps = computed(() => {
return [props.pif.ip, ...props.pif.ipv6].filter(ip => ip)
})

const getNetworkData = (pif: XoPif, type: keyof XoNetwork) => {
const network: XoNetwork = get(pif.$network)!
if (type === 'name_label') {
return network.name_label ? network.name_label : 'Unknown'
} else if (type === 'nbd' || type === 'defaultIsLocked') {
return network[type] ? 'on' : 'off'
const getNetworkData = (type: keyof XoNetwork) => {
const network: XoNetwork = get(props.pif.$network)!

switch (type) {
case 'name_label':
return network.name_label || '-'
case 'nbd':
case 'defaultIsLocked':
return network[type] ? 'on' : 'off'
case 'tags':
return network.tags.length ? network.tags : '-'
default:
return undefined
}
}
const getTags = (pif: XoPif) => {
const network: XoNetwork = get(pif.$network)!
return network.tags.length > 0 ? network.tags : []

const getPifData = (type: keyof XoPif) => {
const value = type === 'vlan' ? props.pif.vlan : props.pif[type]
return value === -1 || value === '' ? '-' : value
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions @xen-orchestra/web/src/components/pif/PifStatus.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<UiInfo class="pif-status text-ellipsis" :accent="getStatusProps(status).accent">
<p class="text-ellipsis">{{ getStatusProps(status).text }}</p>
<p class="text-ellipsis" :class="{ card }">{{ getStatusProps(status).text }}</p>
</UiInfo>
</template>

Expand Down Expand Up @@ -41,7 +41,7 @@ const getStatusProps = (status: NetworkStatus) => states.value[status as Network
</script>

<style scoped lang="postcss">
.pif-status p {
p:not(.card) {
font-size: 1.4rem !important;
}
</style>
19 changes: 15 additions & 4 deletions @xen-orchestra/web/src/components/pif/PifTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
>
<td v-for="column of row.visibleColumns" :key="column.id" class="typo p2-regular">
<UiCheckbox v-if="column.id === 'checkbox'" v-model="selected" accent="info" :value="row.id" />
<div v-if="column.id === 'network'" class="network">
<div v-if="column.id === 'network' && getNetworkName(row.value)" class="network">
<UiComplexIcon size="medium">
<VtsIcon :icon="faNetworkWired" accent="current" />
<VtsIcon accent="success" :icon="faCircle" :overlay-icon="faCheck" />
Expand All @@ -65,9 +65,11 @@
</div>
<div v-if="column.id === 'device'" v-tooltip class="text-ellipsis">{{ row.value.device }}</div>
<div v-if="column.id === 'status'" v-tooltip>
<PifStatus :pif="row.value" />
<PifStatus class="status" :pif="row.value" />
</div>
<div v-if="column.id === 'vlan'" v-tooltip class="text-ellipsis">
{{ getPifData(row.value, 'vlan') }}
</div>
<div v-if="column.id === 'vlan'" v-tooltip class="text-ellipsis">{{ row.value.vlan }}</div>
<div v-if="column.id === 'ip'" v-tooltip class="text-ellipsis">{{ row.value.ip }}</div>
<div v-if="column.id === 'mac'" v-tooltip class="text-ellipsis">{{ row.value.mac }}</div>
<div v-if="column.id === 'mode'" v-tooltip class="text-ellipsis">{{ row.value.mode }}</div>
Expand Down Expand Up @@ -136,7 +138,12 @@ const { get, isReady } = useNetworkStore().subscribe()

const getNetworkName = (pif: XoPif) => {
const network: XoNetwork = get(pif.$network)!
return network.name_label ? network.name_label : 'Unknown'
return network.name_label ? network.name_label : ''
}

const getPifData = (pif: XoPif, type: keyof XoPif) => {
const value = type === 'vlan' ? pif.vlan : pif[type]
return value === -1 || value === '' ? '' : value
}

const searchQuery = ref('')
Expand Down Expand Up @@ -263,6 +270,10 @@ const selectRow = (rowId: XoPif['id']) => {
display: flex;
gap: 1.6rem;
}

.status {
font-size: 8.4rem !important;
}
}

@media (max-width: 1500px) {
Expand Down