← Back to Pull requests

XLAB Add modal for default manual effort and automation creation time #3832

Closed
unknown closed this pull request without merging on Nov 16, 2026 21:52 UTC
View on GitHub
unknown unknown commented on Oct 28, 2026 08:55 UTC
Author

Summary

AAP-99277

Adds a Set template defaults action and a Set template default values modal to the Automation Dashboard. It sets the default "Time taken to manually execute" and "Time taken to create automation" and applies them to all job templates at once.

  • A new Set template defaults button in the main table card header, next to Export as CSV. It is shown only to superusers when the table has results, following the existing RBAC for template time editing. It is disabled with a tooltip while the report loads or required filters are invalid.

  • The modal has two required numeric fields, prefilled with the default values from dashboard_reports/template_metadata/defaults/ (minutes, integer, 1–1,000,000, same limits as the inline table inputs), help text that refers to the "Include time taken to create automation in calculations" toggle, and Apply to templates / Cancel actions.

  • Apply sends a single PATCH to dashboard_reports/template_metadata/. On success the modal closes, a success toast shows the number of updated templates, the table shows the new values right away, and the report (table + savings/ROI widgets) is reloaded.

  • Validation errors are shown under the fields (empty, non-numeric, non-integer, out of range). API errors are shown in the modal and the modal stays open.

  • In-flight inline table saves are awaited before the PATCH is sent, so a late per-template save cannot overwrite the bulk values. After a bulk update, unsaved or invalid inline edits are dropped.

  • The "Include automation creation time" toggle and the inline per-template editing are unchanged.

  • Refactors: DashboardExportButton is renamed to DashboardMainTableActions (it now holds both header actions, and the disabled export shows a tooltip explaining why). Number validation is shared in utils/numberInputValidation.ts, used by the inline inputs and the modal.
  • Points for review

  • Confirmation checkbox: I added a "Yes, I confirm that I want to overwrite the values of all templates, including templates hidden by the current filters." checkbox. Apply to templates stays disabled until it is ticked, like the existing delete confirmations. This is not in the ticket. I added it because the action cannot be undone: it overwrites the values of every template, including ones that are not visible in the current filtered table, and the previous values are not kept anywhere. If you do not agree with this, we can remove it.

  • Default values on open: When the modal opens, it loads the default values from GET dashboard_reports/template_metadata/defaults/ (time_taken_manually_execute_minutes, time_taken_create_automation_minutes) and prefills the fields. A spinner is shown while they load. If the request fails, a warning is shown and the fields stay empty, so the values can still be entered by hand. A missing or null value leaves its field empty.

  • Naming: The button is called "Set template defaults" and the modal "Set template default values", because the action stores new defaults. The modal description and confirmation checkbox state that applying them also overwrites the current values of all templates.
  • Type of Change

  • Bug fix

  • Enhancement

  • Tests

  • Documentation

  • Other (please specify)
  • Risk Analysis - REQUIRED

  • High — Broad platform impact (e.g., SWR config, shared framework components, authentication, routing, API wrappers, build/bundler config). Changes affect multiple workspaces or could cause widespread regressions.

  • Medium — Scoped but cross-cutting (e.g., shared utility functions, changes to multiple pages within one workspace, component library updates, test infrastructure). Limited blast radius but touches common code paths.

  • Low — Narrowly scoped (e.g., single page fix, styling tweak, documentation, test-only changes, copy/string updates). Minimal risk of unintended side effects.
  • All changes are in frontend/awx/analytics/automation-dashboard/.

    Shared Framework Scope

  • This PR does not mix shared framework/ changes with unrelated feature work or product rollout changes. If it does, split the work into a dedicated framework PR and follow-up PRs, or explain why splitting is not feasible.

  • If this PR changes framework/, it includes complete relevant framework test coverage and representative validation of affected consuming workspaces.

  • If this PR changes framework/, its description documents the compatibility impact, including affected consumers or supported behavior.
  • Dependencies

    Requires the backend bulk PATCH dashboard_reports/template_metadata/ endpoint (returns { "updated": <count> }) and GET dashboard_reports/template_metadata/defaults/.

    Testing

    Ephemeral E2E Tests

    Once PR is ready and preliminary checks pass, trigger tests by posting a comment /run-playwright on this PR.

    Tests run against a fresh AAP instance (version based on branch).

    Unit tests

  • useSetTemplateValuesDialog.test.tsx: modal content, prefilled default values (loading, missing value, load error), validation, confirmation checkbox, PATCH payload, API error handling, cancel/close, waiting for pending inline saves.

  • DashboardMainTableCard.setTemplateValues.test.tsx: button visibility (superuser / non-superuser / no results), disabled states, table update after apply.

  • DashboardMainTableActions.test.tsx, numberInputValidation.test.ts, useSerializedSave.test.ts (waitForIdle).
  • Manual Testing

    1. Log in as a superuser and open Analytics → Automation Dashboard, select a report with results.
    2. Click Set template defaults in the main table header. Check that the fields are prefilled with the default values.
    3. Check that Apply to templates is disabled until the confirmation checkbox is ticked.
    4. Enter invalid values (empty, 0, decimal, > 1,000,000) and check the validation messages.
    5. Enter valid values, tick the checkbox and apply. Check that the toast shows the number of updated templates, the table shows the new values and the savings/ROI widgets are updated.
    6. Change filters and check that templates that were hidden also have the new values.
    7. Log in as a non-superuser and check that the button is not shown.

    Screenshots

    <img width="1011" height="529" alt="image" src="https://github.com/user-attachments/assets/5cd91558-a022-48b7-8d43-57fc94d591fa" />

    <img width="857" height="619" alt="image" src="https://github.com/user-attachments/assets/7e153acb-b724-426b-9048-4ea0cea233f8" />

    <img width="857" height="619" alt="image" src="https://github.com/user-attachments/assets/086fd6a6-ee94-4552-9599-8c41086adf46" />

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: kcagran Review duration: 28137m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3832"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%