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 all commits
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
1 change: 0 additions & 1 deletion @xen-orchestra/lite/src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

"descending": "sestupně",
"description": "Popis",
"dhcp": "DHCP",
"disabled": "Zakázáno",
"display": "Zobrazení",
"dns": "DNS",
Expand Down
2 changes: 0 additions & 2 deletions @xen-orchestra/lite/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

"descending": "absteigend",
"description": "Beschreibung",
"dhcp": "DHCP",
"disabled": "deaktiviert",
"display": "Display",
"dns": "DNS",
Expand Down Expand Up @@ -118,7 +117,6 @@
"n-hosts-awaiting-patch": "Der Host {n} benötigt dieses Patch | Die Hosts {n} benötigen dieses Patch",
"n-missing": "{n} verbleibend",
"name": "Name",
"netmask": "Netzmaske",
"network-download": "Download",
"network-throughput": "Netzwerkdurchsatz",
"network-upload": "Upload",
Expand Down
5 changes: 0 additions & 5 deletions @xen-orchestra/lite/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"cpu-provisioning": "CPU provisioning",
"cpu-provisioning-warning": "The number of vCPUs allocated exceeds the number of physical CPUs available. System performance could be affected",
"cpu-usage": "CPU usage",
"delete": "Delete",
"delete-vms": "Delete 1 VM | Delete {n} VMs",
"deploy": "Deploy",
"deploy-xoa": "Deploy XOA",
Expand All @@ -59,10 +58,8 @@

"descending": "descending",
"description": "Description",
"dhcp": "DHCP",
"disabled": "Disabled",
"display": "Display",
"dns": "DNS",
"do-you-have-needs": "You have needs and/or expectations? Let us know",
"documentation": "Documentation",
"edit-config": "Edit config",
Expand Down Expand Up @@ -179,7 +176,6 @@
"n-hosts-awaiting-patch": "{n} host is awaiting this patch | {n} hosts are awaiting this patch",
"n-missing": "{n} missing",
"name": "Name",
"netmask": "Netmask",
"network-download": "Download",
"network-throughput": "Network throughput",
"network-upload": "Upload",
Expand Down Expand Up @@ -241,7 +237,6 @@
"start": "Start",
"start-on-host": "Start on specific host",
"static-ip": "Static IP",
"status": "Status",
"storage-usage": "Storage usage",
"support": "Support",
"suspend": "Suspend",
Expand Down
1 change: 0 additions & 1 deletion @xen-orchestra/lite/src/locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

"descending": "نزولی",
"description": "توصیف",
"dhcp": "DHCP",
"disabled": "غیر فعال",
"display": "نمایش",
"dns": "DNS",
Expand Down
5 changes: 0 additions & 5 deletions @xen-orchestra/lite/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"cpu-provisioning": "Provisionnement CPU",
"cpu-provisioning-warning": "Le nombre de vCPU alloués dépasse le nombre de CPU physique disponible. Les performances du système pourraient être affectées",
"cpu-usage": "Utilisation CPU",
"delete": "Supprimer",
"delete-vms": "Supprimer 1 VM | Supprimer {n} VMs",
"deploy": "Déployer",
"deploy-xoa": "Déployer XOA",
Expand All @@ -59,8 +58,6 @@

"descending": "descendant",
"description": "Description",
"dhcp": "DHCP",
"dns": "DNS",
"disabled": "Désactivé",
"display": "Affichage",
"do-you-have-needs": "Vous avez des besoins et/ou des attentes ? Faites le nous savoir",
Expand Down Expand Up @@ -179,7 +176,6 @@
"n-hosts-awaiting-patch": "{n} hôte attend ce patch | {n} hôtes attendent ce patch",
"n-missing": "{n} manquant | {n} manquants",
"name": "Nom",
"netmask": "Masque réseau",
"network-download": "Descendant",
"network-throughput": "Débit du réseau",
"network-upload": "Montant",
Expand Down Expand Up @@ -241,7 +237,6 @@
"start": "Démarrer",
"start-on-host": "Démarrer sur un hôte spécifique",
"static-ip": "IP statique",
"status": "Statut",
"storage-usage": "Utilisation du stockage",
"support": "Support",
"suspend": "Suspendre",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ const slots = defineSlots<{
<style lang="postcss" scoped>
.vts-card-row-key-value {
display: flex;
align-items: center;
gap: 0.8rem;

.key {
min-width: 12rem;
max-width: 12rem;
overflow-wrap: break-word;
color: var(--color-neutral-txt-secondary);
}
Expand Down
7 changes: 4 additions & 3 deletions @xen-orchestra/web-core/lib/components/table/ColumnTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<MenuList :disabled placement="bottom-start" border>
<template #trigger="{ open, isOpen }">
<th
:class="{ interactive, disabled, focus: isOpen }"
:class="[headerClass, { interactive, disabled, focus: isOpen }]"
class="column-header"
@click="ev => (interactive ? open(ev) : noop())"
>
<div class="content">
<span class="label">
<div class="content text-ellipsis">
<span v-tooltip class="label">
<VtsIcon :icon accent="current" />
<slot />
</span>
Expand Down Expand Up @@ -58,6 +58,7 @@ const props = withDefaults(
icon?: IconDefinition
interactive?: boolean
disabled?: boolean
headerClass?: string
}>(),
{
disabled: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const props = withDefaults(
{ disabled: undefined }
)

const checkboxModel = defineModel<boolean | undefined>({ default: undefined })
const checkboxModel = defineModel<boolean | undefined | string[]>({ default: undefined })

const slots = defineSlots<{
default?(): any
Expand Down
1 change: 0 additions & 1 deletion @xen-orchestra/web-core/lib/components/ui/info/UiInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const icon = computed(() => iconByAccent[accent])

<style lang="postcss" scoped>
.ui-info {
align-items: start;
display: flex;
gap: 0.8rem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const labelAccent = computed(() => (accent === 'info' ? 'neutral' : accent))
.ui-input {
position: relative;
display: flex;
flex: 1;
flex-direction: column;
gap: 0.4rem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const slots = defineSlots<{
flex-direction: column;
padding: 0.8rem;
gap: 0.8rem;
cursor: default;
}

&.error {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- v2 -->
<template>
<div class="ui-table-pagination">
<div class="buttons-container">
Expand All @@ -12,7 +11,7 @@
</span>
<span class="typo p3-regular label show">{{ $t('core.show-by') }}</span>
<div class="dropdown-wrapper">
<select v-model="pageSize" :disabled class="dropdown typo c3-regular" @change="goToFirstPage">
<select v-model="localPageSize" :disabled="disabled" class="dropdown typo c3-regular" @change="goToFirstPage">
<option v-for="option in pageSizeOptions" :key="option" :value="option" class="typo p2-medium">
{{ option }}
</option>
Expand All @@ -33,7 +32,7 @@ import {
faAngleRight,
} from '@fortawesome/free-solid-svg-icons'
import { useOffsetPagination } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
import { computed, ref, watch, watchEffect } from 'vue'

export type PaginationPayload = {
currentPage: number
Expand All @@ -42,17 +41,42 @@ export type PaginationPayload = {
endIndex: number
}

const { totalItems, disabled = false } = defineProps<{
const {
totalItems,
disabled = false,
currPage,
perPage,
startIndex,
endIndex,
} = defineProps<{
totalItems: number
disabled?: boolean
currPage: number
perPage: number
startIndex: number
endIndex: number
}>()

const emit = defineEmits<{
change: [payload: PaginationPayload]
'update:currPage': [value: number]
'update:per-page': [value: number]
'update:start-index': [value: number]
'update:end-index': [value: number]
}>()

const pageSize = ref(50)
const localPageSize = ref(perPage)
const localCurrentPage = ref(currPage)
const pageSizeOptions = [10, 50, 100, 150, 200]

watch([() => perPage, () => currPage], ([newPerPage, newCurrPage], [oldPerPage, oldCurrPage]) => {
if (newPerPage !== oldPerPage) {
localPageSize.value = newPerPage
}
if (newCurrPage !== oldCurrPage) {
localCurrentPage.value = newCurrPage
}
})
const {
currentPage,
currentPageSize,
Expand All @@ -63,10 +87,11 @@ const {
next: goToNextPage,
} = useOffsetPagination({
total: () => totalItems,
pageSize,
pageSize: localPageSize,
page: localCurrentPage,
})
const startIndex = computed(() => (currentPage.value - 1) * currentPageSize.value + 1)
const endIndex = computed(() => Math.min(currentPage.value * currentPageSize.value, totalItems))
const localStartIndex = computed(() => (currentPage.value - 1) * currentPageSize.value + 1)
const localEndIndex = computed(() => Math.min(currentPage.value * currentPageSize.value, totalItems))

const goToFirstPage = () => {
currentPage.value = 1
Expand All @@ -75,12 +100,19 @@ const goToLastPage = () => {
currentPage.value = pageCount.value
}

watchEffect(() => {
emit('update:currPage', localCurrentPage.value)
emit('update:per-page', localPageSize.value)
emit('update:start-index', localStartIndex.value)
emit('update:end-index', localEndIndex.value)
})

watch([currentPage, currentPageSize], ([newPage, newPageSize]) => {
emit('change', {
currentPage: newPage,
pageSize: newPageSize,
startIndex: startIndex.value,
endIndex: endIndex.value,
startIndex: localStartIndex.value,
endIndex: localEndIndex.value,
})
})
</script>
Expand Down
33 changes: 33 additions & 0 deletions @xen-orchestra/web-core/lib/composables/multi-select.composable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# useMultiSelect composable

```vue
<template>
<table>
<thead>
<tr>
<th>
<input type="checkbox" v-model="areAllSelected" />
</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items">
<td>
<input type="checkbox" :value="item.id" v-model="selected" />
</td>
<td>{{ item.name }}</td>
</tr>
</tbody>
</table>

<!-- You can use something else than a "Select All" checkbox -->
<button @click="areAllSelected = !areAllSelected">Toggle all selected</button>
</template>

<script lang="ts" setup>
import useMultiSelect from './multi-select.composable'

const { selected, areAllSelected } = useMultiSelect()
</script>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { computed, ref, unref, type MaybeRef, type Ref } from 'vue'

export default function useMultiSelect<T>(usableIds: MaybeRef<T[]>, selectableIds?: MaybeRef<T[]>) {
const $selected = ref(new Set()) as Ref<Set<T>>

const selected = computed({
get() {
return unref(usableIds).filter(usableId => $selected.value.has(usableId))
},
set(ids: T[]) {
$selected.value = new Set(ids)
},
})

const areAllSelected = computed({
get() {
return (unref(selectableIds) ?? unref(usableIds)).every(id => $selected.value.has(id))
},
set(value: boolean) {
if (value) {
$selected.value = new Set(unref(selectableIds) ?? unref(usableIds))
} else {
$selected.value = new Set()
}
},
})

return {
selected,
areAllSelected,
}
}
2 changes: 2 additions & 0 deletions @xen-orchestra/web-core/lib/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dark-mode.auto": "Automatischer Dunkelmodus",

"dashboard": "Dashboard",
"dhcp": "DHCP",
"documentation-name": "{name} Dokumentation",
"error-no-data": "Fehler beim Datenabruf.",
"fullscreen": "Vollbild",
Expand All @@ -28,6 +29,7 @@
"log-out": "Abmelden",
"master": "Primärer Host",
"n-vms": "1 VM | {n} VMs",
"netmask": "Netzmaske",
"network": "Netzwerk",
"object-not-found": "Objekt {id} wurde nicht gefunden…",
"open-console-in-new-tab": "Konsole in neuem Reiter öffnen",
Expand Down
Loading
Loading