Skip to content

Conversation

@jaaruizgu
Copy link
Collaborator

Create merge request with mergin the changes from the upstream

Copy link
Collaborator Author

@jaaruizgu jaaruizgu left a comment

Choose a reason for hiding this comment

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

Pre aprove changes

@bahner
Copy link

bahner commented Oct 20, 2022

Can we try the other way around and get your code merge into upstream? Seems like an obvious new feature.

dependabot bot and others added 28 commits January 4, 2025 02:29
Bumps [next](https://github.com/vercel/next.js) from 14.2.15 to 14.2.21.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](vercel/next.js@v14.2.15...v14.2.21)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.4...3.1.5)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [strawberry-graphql](https://github.com/strawberry-graphql/strawberry) from 0.243.1 to 0.257.0.
- [Release notes](https://github.com/strawberry-graphql/strawberry/releases)
- [Changelog](https://github.com/strawberry-graphql/strawberry/blob/main/CHANGELOG.md)
- [Commits](strawberry-graphql/strawberry@0.243.1...0.257.0)

---
updated-dependencies:
- dependency-name: strawberry-graphql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
…aphql-0.257.0

Bump strawberry-graphql from 0.243.1 to 0.257.0
Bumps [django](https://github.com/django/django) from 5.0.10 to 5.0.11.
- [Commits](django/django@5.0.10...5.0.11)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
…dalone/next-14.2.21

Bump next from 14.2.15 to 14.2.21 in /standalone
…-api

Closes #224 - Expose Proxbox configuration on Netbox API for CRUD operations.
emersonfelipesp and others added 30 commits April 9, 2025 18:11
…ee only backups related to the VM being accessed.
- Removed duplicate POST request to /netbox/endpoint
- Simplified logic flow by replacing nested if-else with cleaner structure
- Maintained core functionality while improving code efficiency
- Replaced broad exception handling with specific exceptions (requests.exceptions.RequestException and requests.exceptions.HTTPError) for better error clarity and debugging.
- Enhanced logging to provide more context and avoid logging sensitive information.
- Improved code readability and maintainability by making error handling more explicit.
This commit implements complete CRUD (Create, Read, Update, Delete) functionality
for VM backups in the NetBox ProxBox plugin. The changes include:

1. API Serializers:
   - Added VMBackupSerializer with proper field definitions
   - Implemented nested serialization for virtual_machine and tags
   - Added proper choice fields for subtype and format

2. Forms:
   - Created VMBackupForm with Meta class defining model and fields
   - Added DynamicModelChoiceField for virtual_machine selection
   - Implemented choice fields for subtype and format
   - Added proper field validation and help text

3. Models:
   - Defined VMBackup model with all necessary fields
   - Added proper Meta options for ordering and unique constraints
   - Implemented get_absolute_url method
   - Added proper field choices and defaults

4. URLs:
   - Configured proper URL patterns using get_model_urls
   - Added support for list, detail, edit, and delete views
   - Implemented proper URL namespacing

5. Views:
   - Implemented VMBackupListView with proper table and filters
   - Added VMBackupView for detail view
   - Created VMBackupEditView for editing backup information
   - Added VMBackupDeleteView for deletion
   - Implemented VMBackupBulkDeleteView for bulk operations
   - Added VMBackupTabView for virtual machine integration

6. Sync Process:
   - Updated sync process to handle VM backup operations
   - Added proper error handling and logging

The implementation follows NetBox's best practices and integrates seamlessly
with the existing plugin architecture. All views are properly decorated with
register_model_view and URLs are generated using get_model_urls.

This change allows users to:
- View all VM backups in a list view
- View detailed information about specific backups
- Edit backup information through the UI
- Delete individual or multiple backups
- View backups as a tab in virtual machine detail views
- Add SyncProcessAddView class to prevent adding sync processes through UI
- Follow same pattern as VMBackupAddView implementation
- Return error message and redirect to list view when accessed
- Fix NoReverseMatch error for 'syncprocess_add' URL pattern
- Maintain consistency with VMBackup implementation

This change ensures sync processes can only be created through the plugin backend,
preventing manual creation through the UI while maintaining proper URL routing.
- Remove custom SyncProcessJournalView implementation
- Let NetBox handle journal functionality natively
- Fix duplicate Journal tabs issue by removing conflicting custom implementation
- Maintain core journal functionality with proper permissions and UI integration

The change resolves the duplicate Journal tabs issue by leveraging NetBox's built-in journaling support instead of implementing a custom solution. This ensures consistent behavior with other NetBox models and proper integration with the core journaling system.
This commit standardizes all endpoint views (FastAPI, NetBox, and Proxmox) to follow NetBox's best practices for view registration and URL routing.

Changes made:
- Added @register_model_view decorators to all endpoint views:
  - FastAPIEndpoint views:
    - FastAPIEndpointView: Main object view
    - FastAPIEndpointListView: List view with proper path and detail settings
    - FastAPIEndpointEditView: Combined add/edit view with single instance logic
    - FastAPIEndpointDeleteView: Delete view

  - NetBoxEndpoint views:
    - NetBoxEndpointView: Main object view
    - NetBoxEndpointListView: List view with proper path and detail settings
    - NetBoxEndpointEditView: Combined add/edit view with single instance logic
    - NetBoxEndpointDeleteView: Delete view

  - ProxmoxEndpoint views:
    - ProxmoxEndpointView: Main object view
    - ProxmoxEndpointListView: List view with proper path and detail settings
    - ProxmoxEndpointEditView: Combined add/edit view
    - ProxmoxEndpointDeleteView: Delete view

- Updated URLs to use get_model_urls:
  - Replaced individual URL patterns with get_model_urls calls for all endpoints
  - Maintained existing URL structure under respective endpoint paths
  - Preserved all existing functionality including:
    - Single instance restriction for FastAPI and NetBox endpoints
    - Proper template and form configurations
    - Existing view logic and business rules

- Improved code organization:
  - Added proper docstrings to all view classes
  - Maintained consistent view registration patterns
  - Kept existing template and form configurations
  - Ensured proper inheritance from NetBox generic views

The changes ensure that all endpoint views are properly registered with NetBox's view registry while maintaining all existing functionality, including special cases like single instance restrictions for FastAPI and NetBox endpoints.
This commit adds proper journal entries support to the SyncProcess API endpoint,
fixing several issues with circular references and field name changes in NetBox 4.2.7.

Changes:
- Modified SyncProcessSerializer to handle journal entries properly
- Fixed circular reference issues by using SerializerMethodField
- Updated field names to match NetBox 4.2.7's GenericForeignKey structure:
  - Changed from object_type/object_id to assigned_object_type/assigned_object_id
  - Updated journal entries filtering to use correct field names
- Added proper serialization of journal entries with all relevant fields:
  - id
  - url
  - display
  - kind
  - comments
  - created
  - last_updated
- Improved error handling and documentation

File Changes:
- serializers.py: Updated SyncProcessSerializer with journal entries support and fixed GenericForeignKey field names
- urls.py: Added new API endpoints for journal entries under sync-processes
- views.py: Added view support for journal entries in sync processes
- filters.py: Created new file with SyncProcessFilterSet including journal entry filtering

Technical Details:
- The SyncProcess API endpoint (/api/plugins/proxbox/sync-processes/) now properly
  includes journal entries in its response
- Journal entries are filtered using the correct GenericForeignKey fields
- Each journal entry is serialized with a complete set of fields
- The implementation prevents circular references that were causing recursion errors
- The code is compatible with NetBox 4.2.7's journal entry model structure

This change allows users to:
- View journal entries associated with sync processes via the API
- Access detailed information about each journal entry
- Maintain proper relationships between sync processes and their journal entries
- Changed ProxBoxEndpointsView to inherit from APIRootView instead of APIView
- This fixes the TypeError when handling api_root_dict parameter
- Ensures proper API root functionality for the endpoints router
- Maintains consistent API hierarchy with /proxbox/endpoints/ structure
The SyncProcessSerializer was incorrectly implementing manual journal entries handling
through SerializerMethodField, which prevented NetBox's built-in journal entry functionality
from working. This fix:

- Removes the manual journal_entries field and get_journal_entries() method
- Lets NetBoxModelSerializer handle journal entries automatically
- Aligns SyncProcessSerializer with VMBackupSerializer's approach
- Maintains all essential functionality while fixing journal entry creation

This change allows SyncProcess to properly create journal entries like VMBackup does,
using NetBox's built-in functionality instead of a custom implementation.
- Fix journal entry creation for sync processes by using string format for assigned_object_type
- Remove content type lookup that was causing NoneType error
- Standardize journal entry creation across sync process and VM backup endpoints
- Add error handling and logging for journal entry creation failures

Modified files:
- netbox_proxbox/__init__.py
- netbox_proxbox/models/__init__.py
- netbox_proxbox/utils.py
- netbox_proxbox/views/sync.py
- netbox_proxbox/views/vm_backup.py

This change resolves the 'NoneType' object has no attribute 'build_absolute_uri' error
when creating journal entries for sync processes by using the consistent string format
'app_label.model_name' instead of content type ID lookup.
- Add optional query_params parameter to sync_resource function
- Pass query_params to requests.get calls
- Add delete_nonexistent_backup parameter for VM backups sync
Closes #274 - Implement Backup and Snapshot django modelling and integrate it with Proxmox.
Add a new FAILED status option to the SyncStatusChoices class to
properly handle and display failed synchronization operations. The
new status includes a red color indicator for visual distinction
from other sync states (not started, syncing, completed).
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.

3 participants