diff --git a/src/core/pyros_django/api/serializers.py b/src/core/pyros_django/api/serializers.py index e2a73df..8675183 100644 --- a/src/core/pyros_django/api/serializers.py +++ b/src/core/pyros_django/api/serializers.py @@ -103,6 +103,12 @@ class AgentCmdSerializer(serializers.ModelSerializer): class Meta: model = AgentCmd fields = "__all__" + exec_time = serializers.SerializerMethodField() + def get_exec_time(self,obj): + try: + return obj.r_end_time - obj.r_start_time + except: + return "None" class AgentSurveySerializer(serializers.ModelSerializer): class Meta: diff --git a/src/core/pyros_django/api/views.py b/src/core/pyros_django/api/views.py index 21ae6e3..70a9f4d 100644 --- a/src/core/pyros_django/api/views.py +++ b/src/core/pyros_django/api/views.py @@ -278,7 +278,7 @@ class AgentCmdViewSet(viewsets.ModelViewSet): commands_sent_by_agent = AgentCmd.get_commands_sent_by_agent(agent_name) commands_recivied_by_agent = AgentCmd.get_commands_sent_to_agent(agent_name) agent_cmds = commands_sent_by_agent | commands_recivied_by_agent - agent_cmds = agent_cmds.exclude(full_name="get_specific_cmds") + #agent_cmds = agent_cmds.exclude(full_name="get_specific_cmds") agent_cmds = agent_cmds.order_by("-s_deposit_time") if number: number = int(number) diff --git a/src/core/pyros_django/dashboard/templates/dashboard/agent_detail.html b/src/core/pyros_django/dashboard/templates/dashboard/agent_detail.html index afebe54..cc6daa5 100644 --- a/src/core/pyros_django/dashboard/templates/dashboard/agent_detail.html +++ b/src/core/pyros_django/dashboard/templates/dashboard/agent_detail.html @@ -30,6 +30,9 @@ .table{ width:auto; } + .header{ + text-align: center; + } #overflowtable{ overflow-x: scroll; } @@ -76,7 +79,7 @@ {% endfor %} {% endcomment %}
{% comment %} {% endcomment %} - + {% comment %} {% else %} {% endcomment %} @@ -90,7 +93,7 @@ {% endcomment %}

-

{{ agent_name }} is not available.

+ {% endif %} {% if managed_agents != None %} @@ -165,12 +168,13 @@ Sender Recipient Status - Deposit (UTC) - Read (UTC) - Validity (s) - Timeout (s) - Exec start (UTC) - Exec end (UTC) + Deposit
(UTC) + Read
(UTC) + Validity
(s) + Timeout
(s) + Exec start
(UTC) + Exec end
(UTC) + Exec time
(s) Result @@ -190,6 +194,7 @@ [[ command.exec_timeout]] [[ command.r_start_time]] [[ command.r_end_time]] + [[ command.exec_time]] [[ command.result ]] @@ -302,6 +307,9 @@ if (data != null && typeof data != "String"){ for(var arg of data){ var arg_name = arg[0]; + if (arg_name == "<"){ + return null; + } var arg_type = arg[1]; if (arg_type == "str"){ var arg_type = "text"; @@ -309,13 +317,19 @@ else if(arg_type == "int"){ var arg_type = "number"; } - - $("").text(arg_name).appendTo("#additional_fields"); - $("") - .attr("id", arg_name) - .attr("name", arg_name) - .attr("type",arg_type) - .appendTo("#additional_fields"); + if (arg_name == "U"){ + $("

").text("This command isn't implemented").css("display","inline").appendTo("#additional_fields"); + $("#send_cmd_btn").hide() + }else{ + $("#send_cmd_btn").show() + $("").text(arg_name).appendTo("#additional_fields"); + + $("") + .attr("id", arg_name) + .attr("name", arg_name) + .attr("type",arg_type) + .appendTo("#additional_fields"); + } } } else{ @@ -333,10 +347,10 @@ } function display_form_cmd(status){ var cmdform = $("#cmdform") - var cmdform_exitiing = $("#cmdform_exiting") + var cmdform_exiting = $("#cmdform_exiting") if (status == "EXITING"){ if (cmdform.is(":visible")){ - cmdform_exitiing.show(); + cmdform_exiting.show(); cmdform.hide(); } } @@ -364,8 +378,8 @@ //$("#cmdform_running").append(""); }); } - if (cmdform_exitiing.is(":visible")){ - cmdform_exitiing.hide(); + if (cmdform_exiting.is(":visible")){ + cmdform_exiting.hide(); cmdform.show(); } } diff --git a/src/core/pyros_django/dashboard/views.py b/src/core/pyros_django/dashboard/views.py index fcef911..e1809e1 100644 --- a/src/core/pyros_django/dashboard/views.py +++ b/src/core/pyros_django/dashboard/views.py @@ -330,7 +330,7 @@ def agent_action(request): else: new_cmd = AgentCmd.send_cmd_from_to(request.user,agentsst,"do_restart_agent",recipient+ " hard") elif action == "stop": - new_cmd = AgentCmd.send_cmd_from_to(request.user,agentsst,"do_kill_agent",recipient) + new_cmd = AgentCmd.send_cmd_from_to(request.user,agentsst,"do_stop_agent",recipient) if new_cmd != None: messages.add_message(request, messages.INFO, f"Command sent !") else: -- libgit2 0.21.2