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): add store
  • Loading branch information
CzechSebastian committed Dec 19, 2024
commit b93e8aa4a1dd8dc4d89f7b713372f6b7af9e0251
33 changes: 23 additions & 10 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>
{{ props.pif.name_label }}
{{ getNetworkData(pif, 'name_label') }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand Down Expand Up @@ -78,7 +78,7 @@
</template>
<template #value>
<div class="tags">
<UiTag v-for="tag in pif.tags" :key="tag" accent="info" variant="secondary">
<UiTag v-for="tag in getTags(pif)" :key="tag" accent="info" variant="secondary">
{{ tag }}
</UiTag>
</div>
Expand Down Expand Up @@ -183,7 +183,7 @@
{{ $t('network-block-device') }}
</template>
<template #value>
{{ $t(`${props.pif.nbd}`) }}
{{ $t(`${getNetworkData(pif, 'nbd')}`) }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -194,7 +194,7 @@
{{ $t('default-locking-mode') }}
</template>
<template #value>
{{ $t(`${props.pif.defaultIsLocked}`) }}
{{ $t(`${getNetworkData(pif, 'defaultIsLocked')}`) }}
</template>
<template #addons>
<UiButtonIcon :icon="faCopy" size="medium" accent="info" />
Expand All @@ -207,10 +207,9 @@

<script setup lang="ts">
import PifStatus from '@/components/pif/PifStatus.vue'
// import { useNetworkStore } from '@/stores/xo-rest-api/network.store'
// import { usePifStore } from '@/stores/xo-rest-api/pif.store'
// import type { XoNetwork } from '@/types/xo/network.type'
// import type { XoPif } from '@/types/xo/pif.type'
import { useNetworkStore } from '@/stores/xo-rest-api/network.store'
import type { XoNetwork } from '@/types/xo/network.type'
import type { XoPif } from '@/types/xo/pif.type'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import UiButton from '@core/components/ui/button/UiButton.vue'
Expand All @@ -223,14 +222,28 @@ import { vTooltip } from '@core/directives/tooltip.directive'
import { faCircle, faCopy, faEdit, faEllipsis, faStar, faTrash } from '@fortawesome/free-solid-svg-icons'
import { computed } from 'vue'

// TODO: Replace mocked data by store and type values
const props = defineProps<{
pif: object | null | undefined
pif: XoPif
}>()

const { get } = useNetworkStore().subscribe()

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 getTags = (pif: XoPif) => {
const network: XoNetwork = get(pif.$network)!
return network.tags.length > 0 ? network.tags : []
}
</script>

<style scoped lang="postcss">
Expand Down
35 changes: 22 additions & 13 deletions @xen-orchestra/web/src/components/pif/PifTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="pif-table">
<div v-if="isReady" class="pif-table">
<UiTitle type="h4" class="header">
<slot>{{ $t('pifs') }}</slot>
<template #actions>
Expand Down Expand Up @@ -61,7 +61,7 @@
<VtsIcon :icon="faNetworkWired" accent="current" />
<VtsIcon accent="success" :icon="faCircle" :overlay-icon="faCheck" />
</UiComplexIcon>
<p v-tooltip class="text-ellipsis">{{ row.value.name_label }}</p>
<p v-tooltip class="text-ellipsis">{{ getNetworkName(row.value) }}</p>
</div>
<div v-if="column.id === 'device'" v-tooltip class="text-ellipsis">{{ row.value.device }}</div>
<div v-if="column.id === 'status'" v-tooltip>
Expand Down Expand Up @@ -90,6 +90,9 @@

<script setup lang="ts">
import PifStatus from '@/components/pif/PifStatus.vue'
import { useNetworkStore } from '@/stores/xo-rest-api/network.store'
import type { XoNetwork } from '@/types/xo/network.type'
import type { XoPif } from '@/types/xo/pif.type'
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import ColumnTitle from '@core/components/table/ColumnTitle.vue'
import VtsTable from '@core/components/table/VtsTable.vue'
Expand All @@ -105,7 +108,6 @@ import UiTopBottomTable from '@core/components/ui/top-bottom-table/UiTopBottomTa
import useMultiSelect from '@core/composables/table/multi-select.composable'
import { useTable } from '@core/composables/table.composable'
import { vTooltip } from '@core/directives/tooltip.directive'

import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import {
faAlignLeft,
Expand All @@ -123,13 +125,20 @@ import {
import { computed, ref } from 'vue'

const props = defineProps<{
pifs: object[]
pifs: XoPif[]
}>()

const emit = defineEmits<{
rowSelect: [value: string]
rowSelect: [value: XoPif['id']]
}>()

const { get, isReady } = useNetworkStore().subscribe()

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

const searchQuery = ref('')

const filteredPifs = computed(() => {
Expand All @@ -150,13 +159,13 @@ const { visibleColumns, rows } = useTable('pifs', filteredPifs, {
rowId: record => record.id,
columns: define => [
define('checkbox', () => '', { label: '', isHideable: false }),
define('network', () => '', { label: 'Network', isHideable: true }),
define('device', () => '', { label: 'Device', isHideable: true }),
define('network', record => record.$network, { label: 'Network', isHideable: true }),
define('device', record => record.device, { label: 'Device', isHideable: true }),
define('status', () => '', { label: 'Status', isHideable: true }),
define('vlan', () => '', { label: 'Vlan', isHideable: true }),
define('ip', () => '', { label: 'IP Addresses', isHideable: true }),
define('mac', () => '', { label: 'MAC address', isHideable: true }),
define('mode', () => '', { label: 'IP mode', isHideable: true }),
define('vlan', record => record.vlan, { label: 'Vlan', isHideable: true }),
define('ip', record => record.ip, { label: 'IP Addresses', isHideable: true }),
define('mac', record => record.mac, { label: 'MAC address', isHideable: true }),
define('mode', record => record.mode, { label: 'IP mode', isHideable: true }),
define('more', () => '', { label: '', isHideable: false }),
],
})
Expand All @@ -178,9 +187,9 @@ const getHeaderIcon = (status: pifHeader) => {
return headerIcon[status].icon
}

const selectedRowId = ref('')
const selectedRowId = ref<XoPif['id']>()

const selectRow = (rowId: string) => {
const selectRow = (rowId: XoPif['id']) => {
selectedRowId.value = rowId
emit('rowSelect', rowId)
}
Expand Down
8 changes: 0 additions & 8 deletions @xen-orchestra/web/src/fakeGetNetwork.ts

This file was deleted.

Loading