Skip to content

Refresh abilities and adversaries dynamically in Adversary view#99

Open
deacon-mp wants to merge 1 commit into
masterfrom
fix/adversary-dynamic-ability-refresh
Open

Refresh abilities and adversaries dynamically in Adversary view#99
deacon-mp wants to merge 1 commit into
masterfrom
fix/adversary-dynamic-ability-refresh

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

Summary

  • AbilitySelection.vue: Re-fetch abilities from the API each time the ability picker modal opens, so newly created abilities are immediately visible without page reload
  • AdversariesView.vue: Refresh abilities, adversaries, and objectives on KeepAlive re-activation (onActivated) and refresh the adversary list when the selection dropdown opens
  • Companion to Add periodic file watcher for adversary YAML changes apache/caldera#3344 which adds server-side file watching for adversary YAML changes

Problem

In the Adversary view:

  1. New abilities created while editing an adversary were not visible in the ability picker until leaving and returning to the page
  2. Adversary YAML files updated on disk (by plugins, imports, or manual edits) were not reflected in the dropdown
  3. The ability list was fetched once on mount and cached for the component lifetime

Test plan

  • Open Adversary view, navigate to Abilities view, create a new ability, return to Adversary view — new ability should appear in picker
  • Open the ability picker modal, close it, create a new ability via API, reopen the picker — new ability should appear
  • Modify an adversary YAML on disk, open the adversary dropdown — updated adversary should appear
  • Verify no duplicate API calls on initial page load (onActivated does not fire on first mount)

The ability picker and adversary dropdown cached their data on initial
mount, so new abilities created while editing an adversary or adversary
YAML files updated on disk were not visible until a full page reload.

- AbilitySelection: re-fetch abilities from API when the modal opens
- AdversariesView: refresh all data on KeepAlive re-activation and
  refresh the adversary list when the selection dropdown opens
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

Updates the Adversary view and ability picker to refresh data dynamically so newly created/modified abilities and adversaries appear without requiring a page reload, especially when returning via KeepAlive.

Changes:

  • Refresh abilities/adversaries/objectives on KeepAlive re-activation in AdversariesView.vue
  • Refresh adversary list when the adversary dropdown opens
  • Re-fetch abilities whenever the ability picker modal opens in AbilitySelection.vue

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/views/AdversariesView.vue Adds KeepAlive onActivated refresh and dropdown-open refresh to keep adversary/ability/objective data current
src/components/abilities/AbilitySelection.vue Re-fetches abilities on modal open so newly created abilities appear immediately

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

Comment on lines +36 to +40
onActivated(async () => {
await abilityStore.getAbilities($api);
await adversaryStore.getAdversaries($api);
await objectiveStore.getObjectives($api);
});
Comment on lines +45 to +49
watch(isAdversaryDropdownOpen, async (isOpen) => {
if (isOpen) {
await adversaryStore.getAdversaries($api);
}
});
Comment on lines +49 to +53
watch(() => props.active, async (isActive) => {
if (isActive) {
await abilityStore.getAbilities($api);
}
});
@clutester
Copy link
Copy Markdown
Contributor

clutester commented May 5, 2026

  • Open Adversary view, navigate to Abilities view, create a new ability, return to Adversary view — new ability should appear in picker
  • Open the ability picker modal, close it, create a new ability via API, reopen the picker — new ability should appear
  • Modify an adversary YAML on disk, open the adversary dropdown — updated adversary should appear
    • This worked after changing adversary drop down to a different adversary then back.
  • Verify no duplicate API calls on initial page load (onActivated does not fire on first mount)
    Could not verify the last test, unsure how to validate the request. All other tests with original code worked well

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.

3 participants