Repository navigation
feat(lite): add ability to forget a PIF from the network table - #10239
amouillard-vates wants to merge 15 commits into
Conversation
| @@ -0,0 +1,11 @@ | |||
| import { useOverlay } from '@core/packages/overlay/use-overlay.ts' | |||
There was a problem hiding this comment.
Same remark as for the modal
MathieuRA
left a comment
There was a problem hiding this comment.
There is something strange about your screenshot.
In the table, it shows "status: disconnected," but in the side panel, it shows a "connected" status.
I have only reviewed the pif-operation.ts, so, that maybe a normal behavior, but at first glance, it looks like a bug.
| forget: (pifs: MaybeArray<XenApiPif>) => | ||
| Promise.all( | ||
| toArray(pifs).map(async pif => { | ||
| if (pif.VLAN_master_of !== 'OpaqueRef:NULL') { |
There was a problem hiding this comment.
use OPAQUE_REF.EMPTY from vates/types/common.mts instead
There was a problem hiding this comment.
The table status column was cut in the screenshot but is displaying "Disconnected from physical device", which is the physical interface status in the sidepanel. Both statuses are combined in one column.
|
Remember to explain in the PR description why the card says "delete PIF" while the PR uses "forget PIF" throughout. |
| @@ -0,0 +1,48 @@ | |||
| <template> | |||
| <UiModal accent="warning" icon="status:warning-picto" @confirm="emit('confirm')" @dismiss="emit('cancel')"> | |||
There was a problem hiding this comment.
| <UiModal accent="warning" icon="status:warning-picto" @confirm="emit('confirm')" @dismiss="emit('cancel')"> | |
| <UiModal accent="danger" icon="status:warning-picto" @confirm="emit('confirm')" @dismiss="emit('cancel')"> |
Since the button is red? I'm not sure we're keeping that logic.
|
Add in changelog unreleased :
|
| @@ -0,0 +1,52 @@ | |||
| import type { XenApiPif } from '@/libs/xen-api/xen-api.types.ts' | |||
There was a problem hiding this comment.
File name : use-pif-forget.composable.ts
To stay consistent with the project's conventions (cf. use-vif-connection.composable, use-sr-delete.composable)
| import type { MaybeRefOrGetter } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
|
|
||
| export function usePifForgetModal(rawPifs: MaybeRefOrGetter<XenApiPif[]>) { |
There was a problem hiding this comment.
| export function usePifForgetModal(rawPifs: MaybeRefOrGetter<XenApiPif[]>) { | |
| export function usePifForget(rawPifs: MaybeRefOrGetter<XenApiPif[]>) { |
0660861 to
f2dd6c2
Compare
|
|
||
| const { run, canRun, isRunning, errorMessage } = usePifForgetJob(pifs) | ||
|
|
||
| const { open: openForgetModal } = useOverlay({ |
There was a problem hiding this comment.
| const { open: openForgetModal } = useOverlay({ | |
| const { open } = useOverlay({ |
| }, | ||
| }) | ||
|
|
||
| function openModal() { |
There was a problem hiding this comment.
| function openModal() { | |
| function forgetPifs() { |
| function openModal() { | ||
| const count = pifs.value.length | ||
|
|
||
| return openForgetModal({ |
There was a problem hiding this comment.
| return openForgetModal({ | |
| return open({ |
|
|
||
| const selectedPifId = useRouteQuery('id') | ||
|
|
||
| const { run, canRun, isRunning, errorMessage } = usePifForgetJob(pifs) |
There was a problem hiding this comment.
| const { run, canRun, isRunning, errorMessage } = usePifForgetJob(pifs) | |
| const { | |
| run: runForget, | |
| canRun: canForgetPifs, | |
| isRunning: isForgettingPifs, | |
| errorMessage: forgetPifsErrorMessage, | |
| } = usePifForgetJob(pifs) |
| events: { | ||
| onConfirm: async () => { | ||
| try { | ||
| await run() |
There was a problem hiding this comment.
| await run() | |
| await runForget() |
| "confirm-cancel?": "Êtes-vous sûr de vouloir annuler ?", | ||
| "confirm-delete": "Vous êtes sur le point de supprimer {name}", | ||
| "confirm-disconnect": "Vous êtes sur le point de déconnecter {0}", | ||
| "confirm-forget": "Vous êtes sur le point d'oublier {0}", |
There was a problem hiding this comment.
| "confirm-forget": "Vous êtes sur le point d'oublier {0}", | |
| "confirm-forget": "Vous êtes sur le point d'oublier {name}", |
| "confirm-cancel?": "Are you sure you want to cancel?", | ||
| "confirm-delete": "You're about to delete {name}", | ||
| "confirm-disconnect": "You're about to disconnect {0}", | ||
| "confirm-forget": "You're about to forget {0}", |
There was a problem hiding this comment.
| "confirm-forget": "You're about to forget {0}", | |
| "confirm-forget": "You're about to forget {name}", |
| :busy="isForgettingPif" | ||
| :disabled="!canForgetPif" | ||
| :tooltip="!canForgetPif && forgetPifErrorMessage" | ||
| @click="openPifForgetModal()" |
There was a problem hiding this comment.
| :busy="isForgettingPif" | |
| :disabled="!canForgetPif" | |
| :tooltip="!canForgetPif && forgetPifErrorMessage" | |
| @click="openPifForgetModal()" | |
| :busy="isForgettingPifs" | |
| :disabled="!canForgetPifs" | |
| :tooltip="!canForgetPifs && forgetPifsErrorMessage" | |
| @click="forgetPifs()" |
|
You can change screenshots too |
Description
Adds ability to forget a PIF from the host > network > PIFs table / sidepanel on xo-lite
("delete" has been renamed "forget")
Checklist
Fixes #007,See xoa-support#42,See https://...)Introduced byCHANGELOG.unreleased.mdReview process
If you are an external contributor, you can skip this part. Simply create the pull request, and we'll get back to you as soon as possible.
Notes: