Commit Graph

183 Commits

Author SHA1 Message Date
Jeremy Stretch
a777850702 Merge branch 'develop' into feature 2024-09-03 11:59:59 -04:00
Daniel Sheppard
4fead1c85f
Fixes: #17310 - Properly restrict GraphQL related object queries (#17312)
* Fixes: #17310 - Fix GraphQL restriction of related objects

* Fix some failing tests

* Fix test
2024-08-30 14:22:58 -04:00
Jeremy Stretch
6f7bf5baf4 Merge branch 'develop' into feature 2024-08-29 10:51:38 -04:00
Daniel Sheppard
0464dacf7e
Fixes: #16292 - Properly restrict GraphQL queries for querys with pk set (#17244)
* Fixes: #16292 - Properly restrict GraphQL queries for querys with pk set

* Update netbox/netbox/settings.py

* Apply schema adaptations across all apps

* Extend GraphQL API tests

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-28 12:23:25 -04:00
Arthur Hanson
d23b9370f6
17219 fix custom validator display if function (#17247)
* 17219 fix custom validator display if function

* 17219 fix custom validator display if function

* 17219 use custom json encoder

* Fix system config export

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-27 14:19:16 -04:00
Arthur Hanson
4f225b4e56
16670 fix OpenAPI schema generation with nested serializers (#17078)
* 16670 fix OpenAPI schema generation with nested serializers

* 16670 fix comment

* Add comment; misc cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-27 12:57:14 -04:00
Arthur Hanson
fb6c7d7619
17174 add version to plugin catalog (#17192)
* 17174 add version to plugin catalog

* Retain the created & updated columns for optional use

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-19 12:01:54 -04:00
Jeremy Stretch
b6071a80d9 Closes #16574: Add last_synced time to REST API serializer for data sources 2024-08-15 10:20:21 -04:00
Arthur Hanson
93a13ce311
17169 use config_name for matching in plugin catalog (#17172)
* 17169 use config_name for matching

* 17169 remove cache buster
2024-08-15 10:18:34 -04:00
Jeremy Stretch
e3d681be54 Closes #17143: Deprecate the use of dedicated nested API serializers 2024-08-15 08:00:33 -04:00
Jeremy Stretch
8b91fb8d2d Merge branch 'develop' into feature 2024-08-14 10:54:31 -04:00
Arthur Hanson
34d20fccd5
17036 international messages (#17041)
* 17036 international messages

* 17036 fix typo

* 17036 fix _

* Misc cleanup & fixes

* More cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-10 11:47:06 -04:00
Jeremy Stretch
57fe2071a4 #15621: Support notifications for deletion of a subscribed object 2024-08-02 11:34:56 -04:00
Jeremy Stretch
472fbdc654
Closes #17051: Introduce the ISOLATED_DEPLOYMENT config parameter (#17067)
* Closes #17051: Introduce ISOLATED_DEPLOYMENT config parameter

* Revert omission of external footer links
2024-08-02 08:05:08 -04:00
Jeremy Stretch
80fc9abb03 16927: Move JobRunner from utilities to netbox 2024-08-01 14:18:33 -04:00
Jeremy Stretch
8e6987edbf #16388: Move change logging signal handlers into core 2024-08-01 12:58:11 -04:00
Arthur Hanson
e32cfdf88c
17034 Add error handling to Plugins Catalog API (#17035)
* 17034 add error handling to plugins catalog API

* 17034 refactor from review feedback

* 17034 refactor from review feedback

* Misc cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-08-01 10:30:41 -04:00
Jeremy Stretch
bf17485290 Fix export of system data & include plugins 2024-08-01 09:36:23 -04:00
Jeremy Stretch
149c80a10e Merge branch 'develop' into feature 2024-08-01 09:16:01 -04:00
Arthur Hanson
dc173a5508 17038 fix export system data 2024-08-01 08:47:26 -04:00
Jeremy Stretch
c51e91dddd Closes #17048: Replace all calls to get_user_model() with direct imports of User 2024-08-01 08:17:51 -04:00
Arthur Hanson
77d0e9032a fix internationalization for string 2024-08-01 13:12:58 +07:00
Jeremy Stretch
d1e16013f0 #16886: Rename Event to EventType 2024-07-31 15:39:05 -04:00
Jeremy Stretch
845888c24e #14731: Misc cleanup 2024-07-30 15:11:35 -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
Arthur Hanson
1d6987bca0
14731 plugins catalog (#16763)
* 14731 plugin catalog

* 14731 detal page

* 14731 plugin table

* 14731 cleanup

* 14731 cache API results

* 14731 fix install name

* 14731 filtering

* 14731 filtering

* 14731 fix detail view

* 14731 fix detail view

* 14731 sort / status

* 14731 sort / status

* 14731 cleanup detail view

* 14731 htmx plugin list

* 14731 align quicksearch

* 14731 remove pytz

* 14731 change to table

* 14731 change to table

* 14731 remove status from table

* 14731 quick search

* 14731 cleanup

* 14731 cleanup

* Employ datetime_from_timestamp() to parse timestamps

* 14731 review changes

* 14731 move to plugins.py file

* 14731 use dataclasses

* 14731 review changes

* Tweak table columns

* Use is_staff (for now) to evaluate user permission for plugin views

* Use table for ordering

* 7025 change to api fields

* 14731 tweaks

* Remove filtering for is_netboxlabs_supported

* Misc cleanup

* Update logic for determining whether to display plugin installation instructions

* 14731 review changes

* 14731 review changes

* 14731 review changes

* 14731 add user agent string, proxy settings

* Clean up templates

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-25 14:58:48 -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
Jeremy Stretch
424dda5be6 Closes #16933: Enable toggling true/false marks on BooleanColumn 2024-07-19 07:54:41 -04:00
Jeremy Stretch
965e78125a Closes #16884: Remove ID column from ObjectChangeTable defaults 2024-07-18 21:44:12 -04:00
Jeremy Stretch
b0e7294bc1
Closes #15621: User notifications (#16800)
* Initial work on #15621

* Signal receiver should ignore models which don't support notifications

* Flesh out NotificationGroup functionality

* Add NotificationGroup filters for users & groups

* Separate read & dimiss actions

* Enable one-click dismissals from notifications list

* Include total notification count in dropdown

* Drop 'kind' field from Notification model

* Register event types in the registry; add colors & icons

* Enable event rules to target notification groups

* Define dynamic choices for Notification.event_name

* Move event registration to core

* Add more job events

* Misc cleanup

* Misc cleanup

* Correct absolute URLs for notifications & subscriptions

* Optimize subscriber notifications

* Use core event types when queuing events

* Standardize queued event attribute to event_type; change content_type to object_type

* Rename Notification.event_name to event_type

* Restore NotificationGroupBulkEditView

* Add API tests

* Add view & filterset tests

* Add model documentation

* Fix tests

* Update notification bell when notifications have been cleared

* Ensure subscribe button appears only on relevant models

* Notifications/subscriptions cannot be ordered by object

* Misc cleanup

* Add event icon & type to notifications table

* Adjust icon sizing

* Mute color of read notifications

* Misc cleanup
2024-07-15 14:24:11 -04:00
the.friendly.net
f2e1de027f
Fixes #16760: datasource git on local file system fails (#16872)
* Fixes #16760: datasource git on local file system fails

* Fixes #16760: datasource git on local file system fails

* Set depth & quiet parameters only if using a remote URL

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-10 09:10:28 -04:00
Jeremy Stretch
02ae91589d Merge branch 'develop' into feature 2024-07-09 15:16:05 -04:00
Tobias Genannt
a896b14c08 Fixes #16689: Load correct configuration
Loads the the current configuration if no ConfigRevisions are saved to
the database.
2024-06-30 15:20:26 -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
08ac5cd52c Merge branch 'develop' into feature 2024-06-24 15:40:43 -04:00
Jeremy Stretch
853d990c03
Closes #16388: Move change logging resources from extras to core (#16545)
* Initial work on #16388

* Misc cleanup
2024-06-17 08:03:06 -04:00
Alexander Haase
5353f83710
15794 Make "related objects" dynamic (#15876)
* Closes #15794: Make "related objects" dynamic

Instead of hardcoding relationships between models for the detail view,
they are now dynamically generated.

* Fix related models call

* Remove extra related models hook

Instead of providing a rarely used hook method, additional related
models can now be passed directly to the lookup method.

* Fix relations view for ASNs

ASNs have ManyToMany relationships and therefore can't used automatic
resolving. Explicit relations have been restored as before.

* Add method call keywords for clarification

* Cleanup related models

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-06-12 09:46:41 -04:00
Jeremy Stretch
c6bd714a04
Closes #15908: Establish canonical & local sources for release info (#16420)
* Closes #15908: Establish canonical & local sources for release info

* Update references to settings.VERSION
2024-06-07 13:41:48 -04:00
Julio Oliveira at Encora
b10fb67ce9
Fixed error when the active Config is deleted and rest only one to restore. (#16408) 2024-06-05 12:23:36 -07:00
Sami Tahri
79b9ef7d0c fix: SerializedPKRelatedField schema now use nested serializer or response 2024-05-17 16:16:21 -04:00
Jeremy Stretch
8e1c2ecd92
Closes #15915: Replace plugins list with an overall system status view (#15950)
* Replace plugins list with an overall system status view

* Enable export of system status data
2024-05-03 17:26:19 -04:00
Jeremy Stretch
46bd62fdc9 Merge branch 'develop' into feature 2024-04-22 13:23:42 -04:00
Markku Leiniö
b6e38b2ebe
Closes #14690: Pretty-format JSON fields in the config form (#15623)
* Closes #14690: Pretty-format JSON fields in the config form

* Revert changes

* Use our own JSONField for config parameters for pretty editor outputs

* Compare identity instead of equality
2024-04-22 09:25:16 -04:00
Jeremy Stretch
77a4300888
Closes #15618: Always use ISO 8601 date & time formatting (#15737)
* Introduce the isodate(), isotime(), and isodatetime() template filters

* Display the relative time on mouse hover

* Render journal entry times in ISO 8601 format

* Use ISO 8601 format when displaying dates & times in a table

* Standardize the use of DateTimeColumn across all tables
2024-04-17 11:46:47 -04:00
Arthur Hanson
b8cedfcc08
15582 check permissions on specific object when sync request (#15704)
* 15582 check permissions on specific object when sync request

* 15582 move permission check

* Enable translation of error message

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-04-17 10:09:50 -04:00
Javier de la Puente
c5ae89ad03 Use endpoint_url in S3Backend 2024-04-17 09:59:39 -04:00
Arthur Hanson
8767577ecd
15553 change graphql sub-queries from functions to types (#15557)
* 15553 change graphql list to types

* 15553 review changes
2024-03-29 14:54:31 -04:00
Jeremy Stretch
eaa3bc6576 Fixes #15570: Remove omission of M2M relations when generating writable serializers for OpenAPI schema 2024-03-28 16:17:12 -04:00
Jeremy Stretch
744be59a4d
Closes #14736: Enable HTMX navigation globally (#15158)
* Enable HTMX boosting

* Refactor HTMX properties for tables

* Fix dashboard object list widget

* Disable scrolling to page content

* Fix initialization of TomSelect dropdowns after HTMX loading

* Replace formaction properties with hx-post

* Fix quick search field on object list view

* Reinitialize copy-to-clipboard buttons upon HTMX load

* Disable scrolling effect for intra-page navigation

* Introduce user preference for toggling HTMX navigation

* Enable HTMX navigation only when selected by user

* Pass htmx_navigation context

* Fix display of confirmation form when deleting an object

* Disable HTMX boosting for rack elevation SVG downloads

* Fix dyanmic form rendering

* Introduce htmx_boost template tag; enable HTMX for user menu

* Use out-of-band sap to update footer stamp

* Fix display of toasts after form submission

* Fix user preference selection

* Misc cleanup

* Rename render_partial() to htmx_partial()

* Add docstring to htmx_boost template tag

* Disable HTMX for user preferences form to force a full page refresh on changes
2024-03-28 11:51:38 -04:00