Skip to content

feat(ui): add automatic version check notification to navigation#105

Open
clutester wants to merge 5 commits into
mitre:masterfrom
clutester:feature/version-checker
Open

feat(ui): add automatic version check notification to navigation#105
clutester wants to merge 5 commits into
mitre:masterfrom
clutester:feature/version-checker

Conversation

@clutester
Copy link
Copy Markdown
Contributor

Description

This PR introduces an automated, silent version checker to the Magma sidebar (Navigation.vue) that alerts users when a newer release of Caldera is available on GitHub.

Type of change

  • [*] New feature (non-breaking change which adds functionality)
    • Modified plugins/magma/src/components/Navigation.vue.
    • Added an asynchronous background fetch to the public GitHub API (api.github.com/repos/mitre/caldera/releases/latest) using the onMounted hook.
    • Evaluates the local version store against the latest GitHub release tag.
    • If an update exists, the static version span dynamically transforms into a clickable warning link (e.g., 5.3.0 (Update)).
    • Designed to maximize tight sidebar real-estate by reusing the version text rather than adding bulky icons.

Graceful Degradation (Offline Support)

  • The API call is wrapped in a try...catch block.
  • If the Caldera server is running in an air-gapped environment, behind a strict NAT, or if the GitHub API rate limit is hit, the network error is silently caught in the console.
  • The UI gracefully falls back to displaying the static local version number with zero workflow interruption for the user.

How Has This Been Tested?

  • Compiled locally via npm run build.
  • Hardcoded local state to force a version mismatch and verified the conditional UI renders correctly, matches Caldera's warning text styling, and links out accurately.
  • Simulated an offline environment to verify the catch block successfully intercepts the fetch failure and renders the standard static span.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an automatic “new version available” indicator to the left navigation by checking the latest Caldera GitHub release at runtime and turning the displayed version into an update link when appropriate.

Changes:

  • Adds a background GitHub API fetch on Navigation mount to retrieve releases/latest.
  • Compares local app version against the fetched release tag and conditionally renders an update link.
  • Introduces reactive state (hasUpdate, latestVersion, releaseUrl) to drive the UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/core/Navigation.vue Outdated
Comment thread src/components/core/Navigation.vue
Comment thread src/components/core/Navigation.vue
Comment on lines +63 to +65
onMounted(() => {
checkGitHubVersion();
});
clutester and others added 2 commits May 7, 2026 12:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@clutester
Copy link
Copy Markdown
Contributor Author

  • moved latest version URL to new Github location.
  • updated version check logic to only notify user of newer version
  • each user now only checks once every 24 hours using local browser storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants