[fix] Recent Commands row uses "created" timestamp for the "Modified" field
Issue
In commands.js, the getElement function builds the HTML for a new
command row inserted into "Recent Commands" after a command is submitted.
The Modified field incorrectly uses response.created instead of
response.modified:
openwisp_controller/connection/static/connection/js/commands.js ~line 506-510
<div class="form-row field-modified">
<div><label>Modified:</label><div class="readonly">${getFormattedDateTimeString(
response.created, // bug: should be response.modified
)}</div></div>
</div>
Screenshots :
Hi @pandafy , I have identified the fix, it is a pretty simple one.
The getElement function uses response.created for the Modified field instead of response.modified (line 508):
https://github.com/openwisp/openwisp-controller/blob/master/openwisp_controller/connection/static/connection/js/commands.js#L508
Verified via dev tools, modified is present in the API response but unused here. The WebSocket handler at line 565–567 already uses data.modified correctly, so this one-line fix makes the AJAX insertion consistent with it.
Would you like me to open a PR?
Hi, I'd like to work on this. The fix is straightforward: line 508 in commands.js passes response.created to getFormattedDateTimeString() for the Modified field, when it should be response.modified. The WebSocket handler at line 567 already uses data.modified correctly, so this is just an inconsistency in the AJAX insertion path. I'll submit a PR shortly.
Hi, I’d like to work on this issue.
I noticed that in commands.js, the "Modified" field uses response.created instead of response.modified. I’ll fix this and ensure it matches the WebSocket behavior.
Please let me know if that’s okay.
Hi, I have addressed all requested changes and all checks are now passing.
Could you please review again?