mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 01:16:10 +00:00
fix(computes): a bulk migration shows as one job on the host's page
The host's VM list showed every migration of a bulk migration as a job of its own (each holds the host), and kept a card for each when it ended: 20 VMs, 20 cards down the page. The migrations a bulk migration starts now name it as their parent, and a page leaves out a job whose parent is that page's own: the host page shows the bulk migration, with how many of its VMs are done as its progress; each migration still shows on its VM's page and the Jobs page. A page also shows the jobs it is the page of, not only those holding it: the bulk migration holds no claim on the host.
This commit is contained in:
parent
60c581e5e1
commit
25e3794cc9
6 changed files with 46 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from django.db.models import Q
|
||||
from django.http import Http404
|
||||
from django.utils import timezone
|
||||
from drf_spectacular.utils import OpenApiParameter, extend_schema
|
||||
|
|
@ -49,7 +50,9 @@ class OperationViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, viewset
|
|||
raise ValidationError({"key": "required"})
|
||||
if not visible(request.user, key):
|
||||
raise Http404
|
||||
active = list(Operation.objects.filter(claims__resource=key, state__in=SHOWN_STATES).distinct())
|
||||
# the jobs on the resource and the page's own; a job another one on this page started shows in that one
|
||||
active = list(Operation.objects.filter(Q(claims__resource=key) | Q(resource=key), state__in=SHOWN_STATES)
|
||||
.exclude(parent__resource=key).distinct())
|
||||
mine = [op for op in active if may_see(op, request.user)]
|
||||
others = [summary(op, request.user) for op in active if not may_see(op, request.user)]
|
||||
seen = last_seen()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue