mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 15:11:27 +00:00
feat: 增加运行的内置变量,优化self资源的代码
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
from rest_framework import viewsets
|
||||
from rest_framework_bulk import BulkModelViewSet
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from rest_framework.response import Response
|
||||
|
||||
from common.mixins import CommonApiMixin
|
||||
from ops.api.base import SelfBulkModelViewSet
|
||||
from ops.models import Job, JobExecution
|
||||
from ops.serializers.job import JobSerializer, JobExecutionSerializer
|
||||
|
||||
__all__ = ['JobViewSet', 'JobExecutionViewSet']
|
||||
__all__ = ['JobViewSet', 'JobExecutionViewSet', 'JobRunVariableHelpAPIView']
|
||||
|
||||
from ops.tasks import run_ops_job_execution
|
||||
from ops.variables import JMS_JOB_VARIABLE_HELP
|
||||
|
||||
|
||||
def set_task_to_serializer_data(serializer, task):
|
||||
@@ -64,3 +65,11 @@ class JobExecutionViewSet(SelfBulkModelViewSet):
|
||||
if job_id:
|
||||
query_set = query_set.filter(job_id=job_id)
|
||||
return query_set
|
||||
|
||||
|
||||
class JobRunVariableHelpAPIView(APIView):
|
||||
rbac_perms = ()
|
||||
permission_classes = ()
|
||||
|
||||
def get(self, request, **kwargs):
|
||||
return Response(data=JMS_JOB_VARIABLE_HELP)
|
||||
|
Reference in New Issue
Block a user