openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

Fix Modified timestamp in commands.js

Open k-sumayya opened this issue 8 months ago โ€ข 3 comments

Fixes #1263

Description

The "Modified" field in Recent Commands was incorrectly using response.created, which caused it to display the creation timestamp instead of the last modification time.

This PR updates the implementation to use response.modified, ensuring consistency with the API response and WebSocket handler.

Changes

  • Replaced response.created with response.modified in commands.js

Testing

  • Set up OpenWISP locally
  • Reproduced the issue where "Modified" showed incorrect timestamp
  • Applied the fix
  • Verified that the Modified field now shows correct updated timestamp

Impact

  • Fixes incorrect UI behavior
  • Aligns frontend with backend data

k-sumayya avatar Mar 24 '26 11:03 k-sumayya

๐Ÿ“ Walkthrough

Walkthrough

This PR advances the openwisp-controller submodule pointer and applies two small fixes: (1) AbstractVpnClient._get_common_name no longer mutates the device's name when truncating it (uses a local name variable and passes it into the CN formatting), and (2) the Recent Commands UI now uses response.modified for the "Modified" field instead of response.created.

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

Possibly related issues

  • #1263: Fixes the Recent Commands row using created for the "Modified" field โ€” this PR changes the UI to use response.modified.
  • #1284: Related to AbstractVpnClient._get_common_name mutating device name โ€” this PR prevents mutation by using a local truncated name.

[!CAUTION]

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • [ ] Ignore

โŒ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check โŒ Error The PR contains changes to openwisp-controller submodule and vpn.py that are unrelated to the primary objective of fixing the Modified timestamp in commands.js. Remove unrelated changes (submodule commit and vpn.py mutation fix) or clarify their relationship to issue #1263 in the description.
Title check โš ๏ธ Warning The title lacks the required type prefix (e.g., [fix], [change]). It should follow the format '[type] Descriptive title'. Update the title to '[fix] Modified timestamp in commands.js' to comply with the required format.
โœ… Passed checks (3 passed)
Check name Status Explanation
Description check โœ… Passed The description is comprehensive and mostly follows the template, covering reference to issue #1263, clear description of changes, testing performed, and impact assessment.
Linked Issues check โœ… Passed The PR successfully addresses issue #1263 by replacing response.created with response.modified in commands.js to fix the Modified timestamp display in Recent Commands.
Bug Fixes โœ… Passed One-line fix replaces response.created with response.modified for Modified field, directly addressing bug #1263 root cause.
โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Mar 24 '26 11:03 coderabbitai[bot]

Commit Message Format Failure

Hello @k-sumayya, (Analysis for commit c40911a)

The commit message is not in the correct format. The issue number referenced in the title must also be included in the body.

Example of correct format:

[fix] Fix incorrect Modified timestamp in Recent Commands #1263

This commit addresses an issue where the Modified timestamp was not being
updated correctly for recent commands.

Fixes #1263

openwisp-companion avatar Mar 24 '26 12:03 openwisp-companion

Coverage Status

coverage: 98.658%. remained the same when pulling 4dc5fc141c6217f49d0a51125e0043b1fb961632 on k-sumayya:fix-modified-timestamp into d4d013f39eafc701089f287785c3aed81c07f7bd on openwisp:master.

coveralls avatar Mar 24 '26 13:03 coveralls

Closing this due to inactivity.

This PR is superseded by https://github.com/openwisp/openwisp-controller/pull/1305

pandafy avatar Sep 03 '26 10:09 pandafy