Skip to content

Commit

Permalink
feat: Add itemcount in project job overview & item job detail
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquingx committed Oct 27, 2024
1 parent 5da817d commit 4f68543
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion estela-api/api/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
ProjectUsageSerializer,
UsageRecordSerializer,
)
from api.utils import update_env_vars
from api.utils import update_env_vars, update_stats_from_redis
from core.models import (
Activity,
DataStatus,
Expand Down Expand Up @@ -242,6 +242,9 @@ def jobs(self, request, *args, **kwargs):
spider_set = Spider.objects.filter(project=kwargs["pid"])
sid_set = spider_set.values_list("pk", flat=True)
jobs_set = SpiderJob.objects.filter(spider__in=sid_set)
for job in jobs_set:
if job.status == SpiderJob.RUNNING_STATUS:
update_stats_from_redis(job)
paginator_result = Paginator(jobs_set, page_size)
page_result = paginator_result.page(page)
results = SpiderJobSerializer(page_result, many=True)
Expand Down
7 changes: 7 additions & 0 deletions estela-web/src/pages/JobDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ export class JobDetailPage extends Component<RouteComponentProps<RouteParams>, J
spiderName,
totalResponseBytes,
items,
itemsCount,
status,
storageSize,
} = this.state;
Expand Down Expand Up @@ -932,6 +933,12 @@ export class JobDetailPage extends Component<RouteComponentProps<RouteParams>, J
)}
</Col>
</Row>
<Row className="grid grid-cols-3 bg-estela-blue-low py-1 px-2">
<Col>
<Text className="font-bold">Item Count</Text>
</Col>
<Col className="col-span-2 px-2">{itemsCount}</Col>
</Row>
</Card>
</Content>
<Content className="my-2 grid lg:grid-cols-12 grid-cols-12 gap-1 items-start lg:w-full">
Expand Down

0 comments on commit 4f68543

Please sign in to comment.