feat(campaigns): delete campaign button + defer Jira to Activate
- Backend: add DELETE /campaigns/{id}?delete_tests=bool endpoint
- Backend: add delete_campaign() service — handles draft-only restriction,
optional test deletion, nullifies child campaign FKs
- Backend: remove early Jira ticket creation from POST /campaigns,
POST /campaigns/{id}/tests, and POST /campaigns/from-threat-actor
- Backend: activate endpoint now creates campaign Jira ticket if missing,
then creates test tickets (all deferred from creation to activation)
- Frontend: add deleteCampaign() API function to campaigns.ts
- Frontend: two-step confirmation dialog on CampaignDetailPage —
first confirms deletion, then asks whether to also delete associated tests
This commit is contained in:
@@ -184,6 +184,16 @@ export async function scheduleCampaign(
|
||||
return data;
|
||||
}
|
||||
|
||||
/** Delete a campaign. Only draft campaigns can be deleted (admins can delete any). */
|
||||
export async function deleteCampaign(
|
||||
campaignId: string,
|
||||
deleteTests: boolean = false,
|
||||
): Promise<void> {
|
||||
await client.delete(`/campaigns/${campaignId}`, {
|
||||
params: { delete_tests: deleteTests },
|
||||
});
|
||||
}
|
||||
|
||||
/** Get execution history (child campaigns) for a recurring campaign. */
|
||||
export async function getCampaignHistory(campaignId: string): Promise<{
|
||||
campaign_id: string;
|
||||
|
||||
Reference in New Issue
Block a user