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

Update object change context manager to be aware of the change source #2035

Merged
merged 12 commits into from
Jul 12, 2022

Conversation

gsnider2195
Copy link
Contributor

@gsnider2195 gsnider2195 commented Jul 11, 2022

Closes: #1876

What's Changed

  • Add new fields to ObjectChange model
    • change_context
    • change_context_detail
  • Add ObjectChangeEventContextChoices to nautobot.extras.choices for ObjectChange.change_context field choices
  • Update objectchange template to add change_context and change_context_detail to the object detail view
  • Add new ChangeContext class to be used as input to the change_logging context manager. This class stores the user, change context, change context detail and unique id for the change
  • Add ChangeContext convenience subclasses for:
    • JobChangeContext
    • WebChangeContext
    • ORMChangeContext
  • Update web_request_context context manager to use ORMChangeContext
  • Update run_job to use JobChangeContext
  • Update handle_changed_object and handle_deleted_object signals to use ChangeContext instead of a WSGIRequest

image
image

TODO

  • Explanation of Change(s)
  • 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

Copy link
Contributor

@glennmatthews glennmatthews left a comment

Choose a reason for hiding this comment

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

This looks really promising! Nice work.

nautobot/extras/jobs.py Outdated Show resolved Hide resolved
nautobot/extras/models/change_logging.py Outdated Show resolved Hide resolved
nautobot/extras/templates/extras/objectchange.html Outdated Show resolved Hide resolved
@bryanculver bryanculver added the type: feature Introduction of new or enhanced functionality to the application label Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Introduction of new or enhanced functionality to the application
Projects
No open projects
Archived in project
4 participants