Commit 4bc760b91fffb9abe7bd2e4862637daf81d50092

Authored by Alexis Koralewski
1 parent 888d6d8e
Exists in dev

UI changes on agent detail & Handling badly nammed commands

CHANGELOG
  1 +21-10-2022 (AKo): v0.6.3.0
  2 + - UI changes on agent detail
  3 + - Handling badly nammed commands
  4 +
1 5 20-10-2022 (AKo): v0.6.2.1
2 6 - Add new field in cmd list (exec_time), fix issues with get_specific_cmds, try to improve performance of js script in agent_detail view
3 7 - Change import of agents
... ...
VERSION
1   -0.6.2.1
2 1 \ No newline at end of file
  2 +0.6.3.0
3 3 \ No newline at end of file
... ...
src/core/pyros_django/api/serializers.py
... ... @@ -106,9 +106,9 @@ class AgentCmdSerializer(serializers.ModelSerializer):
106 106 exec_time = serializers.SerializerMethodField()
107 107 def get_exec_time(self,obj):
108 108 try:
109   - return obj.r_end_time - obj.r_start_time
  109 + return round((obj.r_end_time - obj.r_start_time).total_seconds(),2)
110 110 except:
111   - return "None"
  111 + return ""
112 112  
113 113 class AgentSurveySerializer(serializers.ModelSerializer):
114 114 class Meta:
... ...
src/core/pyros_django/api/views.py
... ... @@ -278,7 +278,7 @@ class AgentCmdViewSet(viewsets.ModelViewSet):
278 278 commands_sent_by_agent = AgentCmd.get_commands_sent_by_agent(agent_name)
279 279 commands_recivied_by_agent = AgentCmd.get_commands_sent_to_agent(agent_name)
280 280 agent_cmds = commands_sent_by_agent | commands_recivied_by_agent
281   - #agent_cmds = agent_cmds.exclude(full_name="get_specific_cmds")
  281 + agent_cmds = agent_cmds.exclude(full_name="get_specific_cmds")
282 282 agent_cmds = agent_cmds.order_by("-s_deposit_time")
283 283 if number:
284 284 number = int(number)
... ...
src/core/pyros_django/dashboard/templates/dashboard/agent_detail.html
... ... @@ -30,9 +30,17 @@
30 30 .table{
31 31 width:auto;
32 32 }
33   - .header{
  33 + th{
  34 + max-width: 15vw;
  35 + vertical-align:top;
34 36 text-align: center;
35 37 }
  38 + .theader{
  39 + text-align: center;
  40 + min-width:7vw;
  41 + max-width: 12vw;
  42 + vertical-align:top;
  43 + }
36 44 #overflowtable{
37 45 overflow-x: scroll;
38 46 }
... ... @@ -164,18 +172,18 @@
164 172 class="table table-bordered tablesorter" id="cmdtable">
165 173 <thead>
166 174 <tr>
167   - <th>Command</th>
168   - <th>Sender</th>
169   - <th>Recipient</th>
170   - <th>Status </th>
171   - <th>Deposit<br> (UTC)</th>
172   - <th>Read<br> (UTC)</th>
173   - <th>Validity<br> (s)</th>
174   - <th>Timeout<br> (s)</th>
175   - <th>Exec start <br>(UTC)</th>
176   - <th>Exec end <br>(UTC)</th>
177   - <th>Exec time <br>(s)</th>
178   - <th>Result</th>
  175 + <th class="theader align-top">Command</th>
  176 + <th class="theader align-top">Sender</th>
  177 + <th class="theader align-top">Recipient</th>
  178 + <th class="theader align-top">Status </th>
  179 + <th class="theader align-top">Deposit<br> (UTC)</th>
  180 + <th class="theader align-top">Read<br> (UTC)</th>
  181 + <th class="theader align-top">Validity<br> (s)</th>
  182 + <th class="theader align-top">Timeout<br> (s)</th>
  183 + <th class="theader align-top">Exec start <br>(UTC)</th>
  184 + <th class="theader align-top">Exec end <br>(UTC)</th>
  185 + <th class="theader align-top">Exec time <br>(s)</th>
  186 + <th class="theader align-top">Result</th>
179 187 </tr>
180 188 </thead>
181 189 <tbody>
... ... @@ -320,7 +328,11 @@
320 328 if (arg_name == "U"){
321 329 $("<p></p>").text("This command isn't implemented").css("display","inline").appendTo("#additional_fields");
322 330 $("#send_cmd_btn").hide()
323   - }else{
  331 + }else if (arg_name == "I"){
  332 + $("<p></p>").text("This command is badly nammed. A command must start with \"do/get/set\"").css("display","inline").appendTo("#additional_fields");
  333 + $("#send_cmd_btn").hide()
  334 + }
  335 + else{
324 336 $("#send_cmd_btn").show()
325 337 $("<label></label>").text(arg_name).appendTo("#additional_fields");
326 338  
... ...