Commit Graph

129 Commits

Author SHA1 Message Date
Jeremy Stretch
7375042f9e
Release v4.3-beta1 (#19172)
* Draft changelog for v4.3 release

* Add release notes summary & nav link

* Docs cleanup

* Update Python dependencies

* Update static assets

* Revert errant change to schema

* Fix minimum PostgreSQL version

* Misc cleanup

* Correct issue numbers in change log
2025-04-14 15:12:47 -04:00
Jeremy Stretch
5d7ed871f2
Fixes: #18783 Add a tag_id filter for all models which support tagging (#18889) (#19142) 2025-04-11 09:26:46 -07:00
Jeremy Stretch
fc0acb020f Merge main into feature 2025-04-10 17:17:21 -04:00
Jeremy Stretch
a00144026b
Closes #16630: Enable plugins to embed custom <head> content (#19055) 2025-04-01 14:09:49 -05:00
Renato Almeida de Oliveira
864db469ba
Fixes: #18305 make contacts mixin available for plugins (#19029) 2025-04-01 09:03:25 -04:00
Jeremy Stretch
c35f5f829a
Closes #7598: Enable custom field filtering for GraphQL (#18701) 2025-03-07 10:49:06 -08:00
Jeremy Stretch
ef89fc1264 Closes #18071: Remvoe legacy staged changes functionality 2025-02-20 16:50:37 -05:00
Jeremy Stretch
697610db94 Closes #18541: Document support for auth_required attribute on PluginMenuItem 2025-02-06 14:45:25 -05:00
Jeremy Stretch
75417c9cd5 Closes #17587: Add release_track attribute to PluginConfig 2025-02-03 13:54:52 -05:00
Jeremy Stretch
678d89d406 Update documentation for v4.2 2024-11-26 12:38:29 -05:00
Jeremy Stretch
3ee951b0d0 Fix missing/incorrect documentation links 2024-11-26 10:45:30 -05:00
Jeremy Stretch
64e56cd7c8 #16971: Improve example in documentation 2024-11-26 10:35:30 -05:00
Jeremy Stretch
a0b4b0afe0
Closes #18023: Employ register_model_view() for list views (#18029)
* Extend register_model_view() to enable registering list views

* Register circuits list views with register_model_view()

* Register core list views with register_model_view()

* Fix bulk_edit & bulk_delete URL paths

* Register dcim list views with register_model_view() (WIP)

* Register dcim list views with register_model_view()

* Register extras list views with register_model_view()

* Register ipam list views with register_model_view()

* Register tenancy list views with register_model_view()

* Register users list views with register_model_view()

* Register virtualization list views with register_model_view()

* Register vpn list views with register_model_view()

* Register wireless list views with register_model_view()

* Add change note for register_model_view()
2024-11-20 15:54:37 -05:00
Alexander Haase
4bba92617d
Closes #16971: Add system jobs (#17716)
* Fix check for existing jobs

If a job is to be enqueued once and no specific scheduled time is
specified, any scheduled time of existing jobs will be valid. Only if a
specific scheduled time is specified for 'enqueue_once()' can it be
evaluated.

* Allow system jobs to be registered

A new registry key allows background system jobs to be registered and
automatically scheduled when rqworker starts.

* Test scheduling of system jobs

* Fix plugins scheduled job documentation

The documentation reflected a non-production state of the JobRunner
framework left over from development. Now a more practical example
demonstrates the usage.

* Allow plugins to register system jobs

* Rename system job metadata

To clarify which meta-attributes belong to system jobs, each of them is
now prefixed with 'system_'.

* Add predefined job interval choices

* Remove 'system_enabled' JobRunner attribute

Previously, the 'system_enabled' attribute was used to control whether a
job should run or not. However, this can also be accomplished by
evaluating the job's interval.

* Fix test

* Use a decorator to register system jobs

* Specify interval when registering system job

* Update documentation

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-11-01 14:56:08 -04:00
Arthur Hanson
b9c6def8ab
15093 Allow plugins to register events pipeline (#17717)
* 15093 add events_pipeline registration to plugins

* 15093 use list

* 15093 add documentation

* Update docs/configuration/index.md

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update docs/configuration/miscellaneous.md

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* 15093 review changes

* 15093 review changes

* Formatting & readability

* 15093 review changes

* 15093 add test

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-10-18 12:47:16 -04:00
Jeremy Stretch
bc597c3c5d Closes #17472: Deprecate the staged changes API 2024-10-10 14:32:39 -04:00
Jeremy Stretch
10a74492f6 #17143: Update docs for nested serializer use 2024-08-30 10:18:29 -04:00
Jeremy Stretch
80fc9abb03 16927: Move JobRunner from utilities to netbox 2024-08-01 14:18:33 -04:00
Jeremy Stretch
28b867bde4 Documentation updates for v4.1 2024-07-31 16:26:21 -04:00
Jeremy Stretch
6e59db7310 #16886: Updated documentation for event types 2024-07-31 15:54:31 -04:00
Jeremy Stretch
d1e16013f0 #16886: Rename Event to EventType 2024-07-31 15:39:05 -04:00
Alexander Haase
d3a3a6ba46
15692: Introduce background jobs (#16927)
* Introduce reusable BackgroundJob framework

A new abstract class can be used to implement job function classes. It
handles the necessary logic for starting and stopping jobs, including
exception handling and rescheduling of recurring jobs.

This commit also includes the migration of data source jobs to the new
framework.

* Restore using import_string for jobs

Using the 'import_string()' utility from Django allows the job script
class to be simplified, as module imports no longer need to avoid loops.
This should make it easier to queue and maintain jobs.

* Use SyncDataSourceJob for management command

Instead of maintaining two separate job execution logics, the same job
is now used for both background and interactive execution.

* Implement BackgroundJob for running scripts

The independent implementations of interactive and background script
execution have been merged into a single BackgroundJob implementation.

* Fix documentation of model features

* Ensure consitent code style

* Introduce reusable ScheduledJob

A new abstract class can be used to implement job function classes that
specialize in scheduling. These use the same logic as regular
BackgroundJobs, but ensure that they are only scheduled once at any given
time.

* Introduce reusable SystemJob

A new abstract class can be used to implement job function classes that
specialize in system background tasks (e.g. synchronization or
housekeeping). In addition to the features of the BackgroundJob and
ScheduledJob classes, these implement additional logic to not need to be
bound to an existing NetBox object and to setup job schedules on plugin
load instead of an interactive request.

* Add documentation for jobs framework

* Revert "Use SyncDataSourceJob for management"

This partially reverts commit db591d4. The 'run_now' parameter of
'enqueue()' remains, as its being used by following commits.

* Merge enqueued status into JobStatusChoices

* Fix logger for ScriptJob

* Remove job name for scripts

Because scripts are already linked through the Job Instance field, the
name is displayed twice. Removing this reduces redundancy and opens up
the possibility of simplifying the BackgroundJob framework in future
commits.

* Merge ScheduledJob into BackgroundJob

Instead of using separate classes, the logic of ScheduledJob is now
merged into the generic BackgroundJob class. This allows reusing the
same logic, but dynamically deciding whether to enqueue the same job
once or multiple times.

* Add name attribute for BackgroundJob

Instead of defining individual names on enqueue, BackgroundJob classes
can now set a job name in their meta class. This is equivalent to other
Django classes and NetBox scripts.

* Drop enqueue_sync_job() method from DataSource

* Import ScriptJob directly

* Relax requirement for Jobs to reference a specific object

* Rename 'run_now' arg on Job.enqueue() to 'immediate'

* Fix queue lookup in Job enqueue

* Collapse SystemJob into BackgroundJob

* Remove legacy JobResultStatusChoices

ChoiceSet was moved to core in 40572b5.

* Use queue 'low' for system jobs by default

System jobs usually perform low-priority background tasks and therefore
can use a different queue than 'default', which is used for regular jobs
related to specific objects.

* Add test cases for BackgroundJob handling

* Fix enqueue interval jobs

As the job's name is set by enqueue(), it must not be passed in handle()
to avoid duplicate kwargs with the same name.

* Honor schedule_at for job's enqueue_once

Not only can a job's interval change, but so can the time at which it is
scheduled to run. If a specific scheduled time is set, it will also be
checked against the current job schedule. If there are any changes, the
job is rescheduled with the new time.

* Switch BackgroundJob to regular methods

Instead of using a class method for run(), a regular method is used for
this purpose. This gives the possibility to add more convenience methods
in the future, e.g. for interacting with the job object or for logging,
as implemented for scripts.

* Fix background tasks documentation

* Test enqueue in combination with enqueue_once

* Rename background jobs to tasks (to differentiate from RQ)

* Touch up docs

* Revert "Use queue 'low' for system jobs by default"

This reverts commit b17b2050df.

* Remove system background job

This commit reverts commits 4880d81 and 0b15ecf. Using the database
'connection_created' signal for job registration feels a little wrong at
this point, as it would trigger registration very often. However, the
background job framework is prepared for this use case and can be used
by plugins once the auto-registration of jobs is solved.

* Fix runscript management command

Defining names for background jobs was disabled with fb75389. The
preceeding changes in 257976d did forget the management command.

* Use regular imports for ScriptJob

* Rename BackgroundJob to JobRunner

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-30 13:31:21 -04:00
Jeremy Stretch
a12fdd6e2d Merge branch 'develop' into feature 2024-07-26 16:39:58 -04:00
Jeremy Stretch
44a9350986
Closes #16886: Dynamic event types (#16938)
* Initial work on #16886

* Restore GraphQL filter

* Remove namespace

* Add Event documentation

* Use MultipleChoiceField for event_types

* Fix event_types field class on EventRuleImportForm

* Fix tests

* Simplify event queue handling logic

* Misc cleanup
2024-07-22 08:12:04 -04:00
Eric Oswald
e216bebd41 Fix incorrect import in rest-api.md 2024-07-13 10:28:43 -04:00
Jeremy Stretch
1c2336be60
Closes #16776: Extend PluginTemplateExtension to render custom alerts for objects (#16889)
* Closes #16776: Extend PluginTemplateExtension to render custom alerts for objects

* Fix bug in _get_registered_content()
2024-07-12 09:52:07 -04:00
Jeremy Stretch
82d8de32df Closes #16726: Extend PluginTemplateExtension to allow registering multiple models 2024-07-01 15:25:27 -04:00
Arthur Hanson
52546608f6
15156 Add display_url to REST API (#16412)
* 15156 add display_url to REST API

* 15156 fix view name

* 15156 fix typo

* 15156 fix tests

* 15156 add url display_url to base class

* 15156 add url display_url to base class

* 15156 add url display_url to base class

* 15156 review changes

* 15156 review changes

* 15156 review changes

* 15156 review changes

* 15156 remove bogus code

* 15156 remove bogus code

* 15156 review changes

* 15156 review changes

* 15156 review changes

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-06-25 09:59:58 -04:00
Jeremy Stretch
50169365a9 Closes #16359: Add navbar() method to PluginTemplateExtension 2024-06-05 12:34:12 -04:00
Arthur
360f3bc01b 16284 fix plugin forms doc 2024-05-28 09:07:32 -04:00
Arthur Hanson
8d11f8aa7c
14121 update plugin development docs for pyproject.toml (#15952)
* 14121 update plugin development docs for pyproject.toml

* 14121 review feedback

* Update docs/plugins/development/index.md

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* 14121 remove setup.py references

* 14121 add cookiecutter reference

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-05-09 15:06:19 -04:00
Arthur Hanson
56ea7b8714
16014 Update incorrect django-graphene reference and add link to filtering docs. (#16015)
* 16014 change ref from django-graphene to django-strawberry

* 16014 add references to filtering syntax

* 16014 remove graphene reference

* 16014 remove graphene reference

* Remove obsolete reference to Graphene

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-05-08 14:29:54 -04:00
Jeremy Stretch
46bd62fdc9 Merge branch 'develop' into feature 2024-04-22 13:23:42 -04:00
Arthur Hanson
1eca1c3d17
15803 localize help_text (#15804) 2024-04-22 11:42:20 -04:00
Jeff Gehlbach
f4c8f5f5b6 Add link to plugin certification program details in Plugin module of docs. Fixes #15769 2024-04-19 08:49:13 -04:00
Markku Leiniö
4284028bb0 Closes #15727: Add tab template context variable in the plugin doc 2024-04-17 08:30:39 -04:00
Markku Leiniö
21db54ae2f
Closes #15740: Fix typos and deprecated List in docs (#15741)
* Fix typos in migration-v4.md

* Replace typing.List with list

typing.List is deprecated since Python 3.9

* Also replace typing.List with list in graphql-api.md
2024-04-17 08:28:03 -04:00
Jeremy Stretch
dda9381880 Remove old feature notifications 2024-04-02 14:14:58 -04:00
Jeremy Stretch
3ab2f25ee1
Closes #15043: Add v4.0 migration guide for plugins (#15477)
* Add v4.0 migration guide for plugins

* Note Python 3.12 support

* 15403 update GraphQL plugin conversion docs

* Add section on FieldSets

---------

Co-authored-by: Arthur <worldnomad@gmail.com>
2024-04-01 09:08:28 -04:00
Arthur Hanson
45c99e4477
9856 Replace graphene with Strawberry (#15141)
* 9856 base strawberry integration

* 9856 user and group

* 9856 user and circuits base

* 9856 extras and mixins

* 9856 fk

* 9856 update strawberry version

* 9856 update imports

* 9856 compatability fixes

* 9856 compatability fixes

* 9856 update strawberry types

* 9856 update strawberry types

* 9856 core schema

* 9856 dcim schema

* 9856 extras schema

* 9856 ipam and tenant schema

* 9856 virtualization, vpn, wireless schema

* 9856 fix old decorator

* 9856 cleanup

* 9856 cleanup

* 9856 fixes to circuits type specifiers

* 9856 fixes to circuits type specifiers

* 9856 update types

* 9856 GFK working

* 9856 GFK working

* 9856 _name

* 9856 misc fixes

* 9856 type updates

* 9856 _name to types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 update types

* 9856 GraphQLView

* 9856 GraphQLView

* 9856 fix OrganizationalObjectType

* 9856 single item query for schema

* 9856 circuits graphql tests working

* 9856 test fixes

* 9856 test fixes

* 9856 test fixes

* 9856 test fix vpn

* 9856 test fixes

* 9856 test fixes

* 9856 test fixes

* 9856 circuits test sans DjangoModelType

* 9856 core test sans DjangoModelType

* 9856 temp checkin

* 9856 fix extas FK

* 9856 fix tenancy FK

* 9856 fix virtualization FK

* 9856 fix vpn FK

* 9856 fix wireless FK

* 9856 fix ipam FK

* 9856 fix partial dcim FK

* 9856 fix dcim FK

* 9856 fix virtualization FK

* 9856 fix tests / remove debug code

* 9856 fix test imagefield

* 9856 cleanup graphene

* 9856 fix plugin schema

* 9856 fix requirements

* 9856 fix requirements

* 9856 fix docs

* 9856 fix docs

* 9856 temp fix tests

* 9856 first filterset

* 9856 first filterset

* 9856 fix tests

* 9856 fix tests

* 9856 working auto filter generation

* 9856 filter types

* 9856 filter types

* 9856 filter types

* 9856 fix graphiql test

* 9856 fix counter fields and merge feature

* 9856 temp fix tests

* 9856 fix tests

* 9856 fix tenancy, ipam filter definitions

* 9856 cleanup

* 9856 cleanup

* 9856 cleanup

* 9856 review changes

* 9856 review changes

* 9856 review changes

* 9856 fix base-requirements

* 9856 add wrapper to graphiql

* 9856 remove old graphiql debug toolbar

* 9856 review changes

* 9856 update strawberry

* 9856 remove superfluous check

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-03-22 12:56:30 -04:00
Jeremy Stretch
a9bb4c5c3e Move choice sets from utilities.choices to netbox.choices 2024-03-22 08:59:52 -04:00
Jeremy Stretch
89150f4b27 Add form rendering utilities to plugins dev docs 2024-03-19 13:34:13 -04:00
Jeremy Stretch
74e67afa41 Merge branch 'develop' into feature 2024-02-05 14:38:26 -05:00
Mattias L
ba755221bb
Improved docs for how to register dashboard widgets (#14913) 2024-01-26 14:15:28 -05:00
Jeremy Stretch
3aaf370d4a Closes #14889: Update source path for DataBackend class 2024-01-22 14:54:02 -05:00
Jeremy Stretch
7bedf48a97 Closes #14638: Drop support for Python 3.8 and 3.9 2024-01-03 13:33:00 -05:00
Jeremy Stretch
c1ff74894c #14036: Update import paths in example plugin code 2023-12-29 09:21:06 -05:00
Arthur Hanson
a38a38218b
14132 Add EventRule - change webhook and add in script processing to events (#14267)
---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2023-11-30 16:36:33 -05:00
Jeremy Stretch
8e7146cd06 v3.7 documentation updates 2023-11-28 13:11:30 -05:00
Jeremy Stretch
e767fec5cc
Closes #14173: Enable plugins to register columns on core tables (#14265)
* Closes #14173: Enable plugins to register columns on core tables

* Support translation for column name

* Document new registry store
2023-11-16 12:16:35 -05:00