Skip to content
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

Merged
merged 12 commits into from
Jun 6, 2023

Conversation

timizuoebideri1
Copy link
Contributor

Closes: #3798

What's Changed

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • Example Plugin Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@bryanculver bryanculver linked an issue May 24, 2023 that may be closed by this pull request
@glennmatthews
Copy link
Contributor

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.

nautobot/core/context_processors.py Outdated Show resolved Hide resolved
nautobot/core/views/mixins.py Outdated Show resolved Hide resolved
nautobot/ui/src/components/ObjectListTable.js Show resolved Hide resolved
nautobot/core/context_processors.py Outdated Show resolved Hide resolved
nautobot/core/views/generic.py Show resolved Hide resolved
Copy link
Member

@bryanculver bryanculver left a 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.

@timizuoebideri1 timizuoebideri1 force-pushed the u/timizuoebideri1-redirect-to-legacy branch from 0a5ceb4 to 2d412eb Compare June 5, 2023 15:24
Copy link
Member

@bryanculver bryanculver left a 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.

@@ -593,6 +596,7 @@ class ObjectListViewMixin(NautobotViewSetMixin, mixins.ListModelMixin):
"per_page", # used by get_paginate_count
"sort", # table sorting
)
use_new_ui = True
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines +585 to +588
instance = self.get_object()
serializer = self.get_serializer(instance)

context = serializer.data
Copy link
Member

Choose a reason for hiding this comment

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

@bryanculver bryanculver mentioned this pull request Jun 6, 2023
6 tasks
@bryanculver bryanculver merged commit aed468e into next Jun 6, 2023
19 checks passed
@bryanculver bryanculver deleted the u/timizuoebideri1-redirect-to-legacy branch June 6, 2023 14:42
HanlinMiao pushed a commit that referenced this pull request Jun 6, 2023
* 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>
HanlinMiao added a commit that referenced this pull request Jun 8, 2023
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI 2.0: Redirect to Legacy View for Create/Edit Views
4 participants