Skip to content

Closes: #157 - Modernize Lifecycle Plugin#158

Open
DanSheps wants to merge 8 commits into
mainfrom
close-157
Open

Closes: #157 - Modernize Lifecycle Plugin#158
DanSheps wants to merge 8 commits into
mainfrom
close-157

Conversation

@DanSheps
Copy link
Copy Markdown
Owner

Closes: #157 - Modernize Lifecycle Plugin to take advantage of new NetBox UI elements and functions

  • Update plugin views and template code to use Panels
  • Update plugin filtersets to register filtersets for advanced filtering
  • Update plugin url generation to utilize registered urls only

@DanSheps DanSheps requested a review from jsenecal May 12, 2026 03:52
@DanSheps DanSheps self-assigned this May 12, 2026
@DanSheps DanSheps added the enhancement New feature or request label May 12, 2026
@DanSheps
Copy link
Copy Markdown
Owner Author

@jsenecal Going to get you to review this since I know you did some of these changes originally. I think I captured everything but just to make sure.

Copy link
Copy Markdown
Collaborator

@jsenecal jsenecal left a comment

Choose a reason for hiding this comment

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

I noticed that this PR removes the four-state tabbed display introduced in #127 and replaces it with two flat ObjectsTablePanels driven by a boolean expired filter. Beyond the filter_expired bug I flagged in the code review, the design itself loses behavior worth calling out:

  • SupportContractAssignment.status distinguishes four states :

    • FUTURE (contract.start > today),
    • ACTIVE,
    • UNSPECIFIED (end_date IS NULL),
    • EXPIRED.

    A boolean filter only carves out EXPIRED, so FUTURE contracts end up in the "Active Contracts" panel. A contract that hasn't started yet shouldn't render as active.

  • The lazy-load-on-click behavior on the Expired tab is gone. Devices with long expired-contract histories used to defer that query until a user clicked the tab; the new panel renders both tables eagerly on every device/VM detail page load.

If the simplification away from tabs is intentional, two minimal changes would preserve correctness without bringing the tabs back:

  1. In _render_contract_card, drop future contracts from the Active panel:
    filters={..., 'status': 'active'}  # or status__in=['active', 'unspecified']
  2. Replace the BooleanFilter expired with a ChoiceFilter status driven by the existing CONTRACT_STATUS_* constants, so the panel asks for what it wants instead of relying on the inverse-of-expired heuristic.

If the four-state breakdown is meant to come back later, building on ChoiceFilter makes that a one-line addition rather than another filter rewrite.

Comment thread netbox_lifecycle/template_content.py Outdated
Comment thread netbox_lifecycle/template_content.py Outdated
Comment thread netbox_lifecycle/filtersets/contract.py Outdated
Co-authored-by: Jonathan Senecal <jonathan.senecal@metrooptic.com>
Comment thread netbox_lifecycle/filtersets/contract.py Outdated
Co-authored-by: Jonathan Senecal <contact@jonathansenecal.com>
Co-authored-by: Daniel Sheppard <dans@dansheps.com>
@DanSheps
Copy link
Copy Markdown
Owner Author

I noticed that this PR removes the four-state tabbed display introduced in #127 and replaces it with two flat ObjectsTablePanels driven by a boolean expired filter. Beyond the filter_expired bug I flagged in the code review, the design itself loses behavior worth calling out:

This was somewhat unintentional, I didn't realise there were multiple tabs that showed as on a cursory look it appears to be 1-2 tabs. I wonder if I could build a custom panel for nesting panels and just have that show as two tabs.

If the simplification away from tabs is intentional, two minimal changes would preserve correctness without bringing the tabs back:

Should be back now, can you give it a check?

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Housekeeping: Modernize Lifecycle Plugin

2 participants