Page title + favicon in API pages #5113

Closed
opened 2025-12-29 19:24:25 +01:00 by adam · 6 comments
Owner

Originally created by @sdktr on GitHub (Jul 28, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0-beta1

Feature type

Change to existing functionality

Proposed functionality

Add a favicon to both GraphiQL workspace and REST API. Plus add a page title to the GraphiQL playground.

Use case

When testing Netbox API calls the tabs in a browser do not stand out very recognizable. The page title for the REST API pages reflects the path one is on. The GraphiQL playground has no title so it renders the full query URL in the tab title.

Database changes

N/A

External dependencies

N/A

Originally created by @sdktr on GitHub (Jul 28, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0-beta1 ### Feature type Change to existing functionality ### Proposed functionality Add a favicon to both GraphiQL workspace and REST API. Plus add a page title to the GraphiQL playground. ### Use case When testing Netbox API calls the tabs in a browser do not stand out very recognizable. The page title for the REST API pages reflects the path one is on. The GraphiQL playground has no title so it renders the full query URL in the tab title. ### Database changes N/A ### External dependencies N/A
adam added the status: acceptedtype: featurebeta labels 2025-12-29 19:24:25 +01:00
adam closed this issue 2025-12-29 19:24:25 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

@sdktr want to try taking this on? I'm not really sure how involved it would be.

@jeremystretch commented on GitHub (Jul 29, 2021): @sdktr want to try taking this on? I'm not really sure how involved it would be.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

While we're at it we should see if it's feasible to serve the GraphiQL UI's static resources locally (as opposed to via a CDN), to better support isolated NetBox deployments.

@jeremystretch commented on GitHub (Jul 29, 2021): While we're at it we should see if it's feasible to serve the GraphiQL UI's static resources locally (as opposed to via a CDN), to better support isolated NetBox deployments.
Author
Owner

@kkthxbye-code commented on GitHub (Jul 29, 2021):

@jeremystretch - I'm not sure there is a clean solution for that other than creating a pull request for graphene-django or forking it. Maybe it's possible to overwrite the path to the template and having a local version with the changes (local resources, favicon and title).

e7f7d8da07/graphene_django/views.py (L58)

But from my quick look any solution (including the above) would require monkey patching which seems like a bad idea.

@kkthxbye-code commented on GitHub (Jul 29, 2021): @jeremystretch - I'm not sure there is a clean solution for that other than creating a pull request for graphene-django or forking it. Maybe it's possible to overwrite the path to the template and having a local version with the changes (local resources, favicon and title). https://github.com/graphql-python/graphene-django/blob/e7f7d8da07ba1020f9916153f17e97b0ec037712/graphene_django/views.py#L58 But from my quick look any solution (including the above) would require monkey patching which seems like a bad idea.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

We're already subclassing the stock GraphQLView, so it should be pretty easy to swap in our own template. The template actually looks pretty minimal; should be easy to tweak. We just need to ensure we keep resources in sync for future releases; that will be the more tricky part.

@jeremystretch commented on GitHub (Jul 29, 2021): We're already [subclassing the stock GraphQLView](https://github.com/netbox-community/netbox/blob/22d160b1da32e46399a5cd20858b34c9ea4ffa2d/netbox/netbox/graphql/views.py#L11), so it should be pretty easy to swap in our own template. The [template](https://github.com/graphql-python/graphene-django/blob/main/graphene_django/templates/graphene/graphiql.html) actually looks pretty minimal; should be easy to tweak. We just need to ensure we keep resources in sync for future releases; that will be the more tricky part.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

Ok, I've got the title and favicon sorted in #6847, and we should be able to bundle the necessary static resources using our existing workflow. Just need to sync with @thatmattlove to confirm.

@jeremystretch commented on GitHub (Jul 29, 2021): Ok, I've got the title and favicon sorted in #6847, and we should be able to bundle the necessary static resources using our existing workflow. Just need to sync with @thatmattlove to confirm.
Author
Owner

@jeremystretch commented on GitHub (Jul 30, 2021):

#6847 addressed the original issues above. I've opened #6855 to cover serving GraphiQL's static assets locally.

@jeremystretch commented on GitHub (Jul 30, 2021): #6847 addressed the original issues above. I've opened #6855 to cover serving GraphiQL's static assets locally.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5113