PluginTable: title_long column drops plugin icon #11575

Closed
opened 2025-12-29 21:47:03 +01:00 by adam · 3 comments
Owner

Originally created by @pheus on GitHub (Sep 5, 2025).

Originally assigned to: @pheus on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.4.0

Python Version

3.10

Steps to Reproduce

The title_long column drops plugin icon because render_title_long() overrides TemplateColumn.

  1. Install and enable any plugin that sets a non‑empty icon in its PluginConfig.
  2. Open the list view for plugins and observe the title_long column.

Expected Behavior

The title_long column should render via PLUGIN_NAME_TEMPLATE, including the plugin’s icon.

Observed Behavior

Although title_long is declared as a TemplateColumn referencing PLUGIN_NAME_TEMPLATE, it is overridden by render_title_long(), which omits the icon. As a result, the plugin icon is not displayed next to the name.

Originally created by @pheus on GitHub (Sep 5, 2025). Originally assigned to: @pheus on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.4.0 ### Python Version 3.10 ### Steps to Reproduce The `title_long` column drops plugin icon because `render_title_long()` overrides `TemplateColumn`. 1. Install and enable any plugin that sets a non‑empty `icon` in its `PluginConfig`. 2. Open the list view for plugins and observe the `title_long` column. ### Expected Behavior The `title_long` column should render via `PLUGIN_NAME_TEMPLATE`, including the plugin’s icon. ### Observed Behavior Although `title_long` is declared as a `TemplateColumn` referencing `PLUGIN_NAME_TEMPLATE`, it is overridden by `render_title_long()`, which omits the icon. As a result, the plugin icon is not displayed next to the name.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:47:03 +01:00
adam closed this issue 2025-12-29 21:47:04 +01:00
Author
Owner

@pheus commented on GitHub (Sep 5, 2025):

While looking into #19744, I noticed a small, related issue: the title_long column is declared as a TemplateColumn using PLUGIN_NAME_TEMPLATE, but it’s overridden by render_title_long(), which omits the plugin icon. This drops the icon in list views.

Proposed fix

Two equivalent ways to deduplicate and restore the icon:

Option A: keep the template path

  • Remove render_title_long().
  • Keep title_long = tables.TemplateColumn(PLUGIN_NAME_TEMPLATE, ...).
  • Move PLUGIN_NAME_TEMPLATE into template_code.py for consistency with other shared template snippets.

Option B: keep the render method

  • Change title_long to a plain tables.Column(...) (not TemplateColumn).
  • Update render_title_long() to prepend the plugin icon markup (mirroring what PLUGIN_NAME_TEMPLATE renders), and drop the template constant.

Either approach restores the icon and avoids duplication. I’m happy to follow up with a PR in whichever direction is preferred.

@pheus commented on GitHub (Sep 5, 2025): While looking into #19744, I noticed a small, related issue: the `title_long` column is declared as a `TemplateColumn` using `PLUGIN_NAME_TEMPLATE`, but it’s overridden by `render_title_long()`, which omits the plugin icon. This drops the icon in list views. **Proposed fix** Two equivalent ways to deduplicate and restore the icon: **Option A: keep the template path** - Remove `render_title_long()`. - Keep `title_long = tables.TemplateColumn(PLUGIN_NAME_TEMPLATE, ...)`. - Move `PLUGIN_NAME_TEMPLATE` into `template_code.py` for consistency with other shared template snippets. **Option B: keep the render method** - Change `title_long` to a plain `tables.Column(...)` (not `TemplateColumn`). - Update `render_title_long()` to prepend the plugin icon markup (mirroring what `PLUGIN_NAME_TEMPLATE` renders), and drop the template constant. Either approach restores the icon and avoids duplication. I’m happy to follow up with a PR in whichever direction is preferred.
Author
Owner

@pheus commented on GitHub (Sep 5, 2025):

Small addendum: I’ve noticed that the order_by for the title_long column references an unknown field name. It should point to title_long instead. If that sounds good, I’ll include this fix in the same change set.

@pheus commented on GitHub (Sep 5, 2025): Small addendum: I’ve noticed that the `order_by` for the `title_long` column references an unknown field `name`. It should point to `title_long` instead. If that sounds good, I’ll include this fix in the same change set.
Author
Owner

@bctiemann commented on GitHub (Sep 5, 2025):

Thanks @pheus ! I think I lean toward option A; seems more consistent and easier to debug.

@bctiemann commented on GitHub (Sep 5, 2025): Thanks @pheus ! I think I lean toward option A; seems more consistent and easier to debug.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11575