-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect all routes ending with add and edit to legacyUI #3804
Conversation
….com/nautobot/nautobot into u/timizuoebideri1-redirect-to-legacy
a thought I had this morning - for the time being, we should probably invert the scope of the logic - instead of redirecting add/edit specifically to the legacy UI, we should use the legacy UI for all routes except home, list, and detail views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this over the weekend, I think having a new BaseView
is unnecessary. This BaseView
seems to only support model views and we have many non-model views, especially in plugins.
I'm not opposed to a ModelBaseView
but I think that's unnecessary at this time. Instead if the check in context_processors
assumes a view doesn't support use_new_ui
if it's not declared should be sufficient.
0a5ceb4
to
2d412eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the tests pass, looks good to me.
nautobot/core/views/mixins.py
Outdated
@@ -593,6 +596,7 @@ class ObjectListViewMixin(NautobotViewSetMixin, mixins.ListModelMixin): | |||
"per_page", # used by get_paginate_count | |||
"sort", # table sorting | |||
) | |||
use_new_ui = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this result in all of NautobotUIVIewSet
(e.g. the Circuits views) getting use_new_ui=True
(even for its create/edit/delete views)? It seems like it would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, this is for ObjectListViewMixin
which is the list
view.
instance = self.get_object() | ||
serializer = self.get_serializer(instance) | ||
|
||
context = serializer.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeps the existing behavior with DRF: https://github.com/encode/django-rest-framework/blob/376a5cbbba3f8df9c9db8c03a7c8fa2a6e6c05f4/rest_framework/mixins.py#L51-L58
* Redirect on Add * Update nautobot/ui/src/components/ObjectListTable.js * add change logs * use class * remove print * Fix prettier * reverse use new ui logic * Resolve git comments * Switch to function aware context processor for NautobotUIViewSet case * Update context_processors.py --------- Co-authored-by: Bryan Culver <me@bryanculver.com> Co-authored-by: Bryan Culver <31187+bryanculver@users.noreply.github.com>
…rtual_machine"), to `Service` model. (#3863) * Added two uniqueness constraints, (name, device) and (name, virtual_machine), to Service model. * check-schema * Revised all IPAM model tests to support Namespaces (#3844) * Revised all IPAM model tests to support Namespaces - Also made sure that every object created that requires it has a proper `status` field and `namespace` - Got rid of all `expectedFailure` and `skip` decorations for test cases. - Revised assertions for `Prefix.get_utilization()` testing because of proper parenting now to child prefixes if they exist. - Fixed a bug in `Prefix.reparent_ips()` that was too greedy in reparenting IP addresses when child prefixes were deeply nested (such as a /31) * Make pylint happy. * Fix #3437 - add missing unique_together on TaggedItem and associated migrations (#3813) Co-authored-by: Bryan Culver <bryan.culver@networktocode.com> * Improve API `sort` Test Behavior (#3841) * Improve API sort detection behavior * Update nautobot/core/testing/api.py Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com> --------- Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com> * Catch FileNotFoundError if Apps index.js not found (#3853) * catch file not found error * Update nautobot/core/management/commands/build_ui.py Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com> * add changelogs --------- Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com> * Make status fields non-nullable and fixup any existing invalid nulls (#3785) * Make status fields non-nullable and fixup any existing invalid nulls; remove unneeded mixins * Change fragment * Fix role migration * Start fixing tests * Fix some DCIM tests * Fix remaining DCIM tests * Enhance migrations * Fix core tests * Fix remaining ipam tests * Black * Fix extras tests * Fix pylint * Fix tenancy tests * Fix virtualization tests * Fix integration tests * Add deprecation notice for StatusModel subclasses * isolate_apps :magic: * Fix migration order * Fix test failures --------- Co-authored-by: Bryan Culver <bryan.culver@networktocode.com> Co-authored-by: Bryan Culver <me@bryanculver.com> * Redirect all routes ending with add and edit to legacyUI (#3804) * Redirect on Add * Update nautobot/ui/src/components/ObjectListTable.js * add change logs * use class * remove print * Fix prettier * reverse use new ui logic * Resolve git comments * Switch to function aware context processor for NautobotUIViewSet case * Update context_processors.py --------- Co-authored-by: Bryan Culver <me@bryanculver.com> Co-authored-by: Bryan Culver <31187+bryanculver@users.noreply.github.com> * Added two uniqueness constraints, (name, device) and (name, virtual_machine), to Service model. * check-schema * fix unittests and added CreateView for Service Model * changed ServiceForm to allow editing of device/vm and added unittests for Service model clean() * changelog and migration file changes * address PR feedback --------- Co-authored-by: Hanlin Miao <hanlinmiao@Hanlins-MBP-2.home> Co-authored-by: Jathan McCollum <jathan@gmail.com> Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com> Co-authored-by: Bryan Culver <bryan.culver@networktocode.com> Co-authored-by: Bryan Culver <31187+bryanculver@users.noreply.github.com> Co-authored-by: Timizuo <94907097+timizuoebideri1@users.noreply.github.com> Co-authored-by: Bryan Culver <me@bryanculver.com>
Closes: #3798
What's Changed
TODO