mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-29 21:51:31 +00:00
perf: Translate
This commit is contained in:
@@ -271,7 +271,10 @@ class JobExecutionTaskDetail(APIView):
|
||||
execution = get_object_or_404(JobExecution, pk=task_id, creator=request.user)
|
||||
|
||||
return Response(data={
|
||||
'status': execution.status,
|
||||
'status': {
|
||||
'value': execution.status,
|
||||
'label': execution.get_status_display()
|
||||
},
|
||||
'is_finished': execution.is_finished,
|
||||
'is_success': execution.is_success,
|
||||
'time_cost': execution.time_cost,
|
||||
|
||||
@@ -247,6 +247,8 @@ class JobExecution(JMSOrgBaseModel):
|
||||
verbose_name=_("Material Type"))
|
||||
|
||||
# clean up zombie execution
|
||||
def get_status_display(self):
|
||||
return dict(JobStatus.choices).get(self.status, self.status)
|
||||
|
||||
@classmethod
|
||||
def clean_unexpected_execution(cls):
|
||||
|
||||
@@ -84,6 +84,14 @@ class JobExecutionSerializer(BulkOrgResourceModelSerializer):
|
||||
fields = read_only_fields + [
|
||||
"job", "parameters", "creator"
|
||||
]
|
||||
extra_kwargs = {
|
||||
"task_id": {
|
||||
"label": _("Task id"),
|
||||
},
|
||||
"job": {
|
||||
"label": _("Job"),
|
||||
}
|
||||
}
|
||||
|
||||
def validate_job(self, job_obj):
|
||||
if job_obj.creator != self.context['request'].user:
|
||||
|
||||
Reference in New Issue
Block a user