Commit Graph

14983 Commits

Author SHA1 Message Date
Arthur
1a2fd1d243 cleanup 2026-04-01 12:50:20 -07:00
Arthur
edf9b1c1d0 cleanup 2026-04-01 12:43:50 -07:00
Arthur
77bebe7eed cleanup 2026-04-01 12:20:01 -07:00
Arthur
6a9ebdacca cleanup 2026-04-01 12:19:48 -07:00
Arthur
7f8dfa4427 change to scripts/upload api 2026-04-01 10:24:11 -07:00
Arthur
280bca81ef cleanup 2026-03-31 13:22:57 -07:00
Arthur
0d2b275335 cleanup 2026-03-31 12:03:26 -07:00
Arthur
b45fc8835f cleanup 2026-03-31 12:00:22 -07:00
Arthur
3284c83597 keep only upload functionality 2026-03-31 11:56:28 -07:00
Arthur
e8a29f105a cleanup 2026-03-31 11:33:20 -07:00
Arthur
0c04f1efec cleanup 2026-03-31 11:08:50 -07:00
Arthur
a694b240ff cleanup 2026-03-31 11:06:16 -07:00
Arthur
e7164093c5 cleanup 2026-03-31 11:02:54 -07:00
Arthur
78b9d18afb cleanup 2026-03-31 10:51:17 -07:00
Arthur
b71dc77167 restore file 2026-03-31 10:40:10 -07:00
Arthur
39faea6ef2 cleanup 2026-03-31 10:34:34 -07:00
Arthur
f1518d9ad9 update docs 2026-03-31 08:30:55 -07:00
Arthur
400fa8ed5f change to ScriptModule 2026-03-31 08:12:10 -07:00
Arthur
8437ae142a change to ScriptModule 2026-03-31 08:10:19 -07:00
Arthur
92f99910ee change to ScriptModule 2026-03-31 08:09:43 -07:00
Arthur
37be38b582 cleanup 2026-03-30 17:28:19 -07:00
Arthur
9954a9e8a9 cleanup 2026-03-30 17:07:04 -07:00
Arthur
bb99c19342 cleanup 2026-03-30 16:53:34 -07:00
Arthur
8d04f31314 cleanup 2026-03-30 16:45:13 -07:00
Arthur
a50941410e review feedback: 2026-03-30 16:33:56 -07:00
Arthur
4dc6564a17 destroy() deletes ScriptModule, not Script
DELETE /api/extras/scripts/<pk>/ now deletes the entire ScriptModule
(matching the UI's delete view), including modules with no Script
children (e.g. sync hasn't run yet). Permission check updated to
delete_scriptmodule. The queryset restriction for destroy is removed
since the module is deleted via script.module, not super().destroy().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:53:35 -07:00
Arthur
a128b7de55 Run source/file conflict checks before super().validate() / full_clean()
super().validate() calls full_clean() on the model instance, which raises
a unique-constraint error for (file_root, file_path) when file_path is
empty (e.g. data_source-only requests). Move the conflict guards above the
super() call so they produce clear, actionable error messages before
full_clean() has a chance to surface confusing database-level errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:41:31 -07:00
Arthur
83fb0a6379 Align API validation messages with UI; restore complete checks
- Match UI error messages for upload+data_file conflict and no-source case
- Keep API-only guards for upload+data_source and data_source-without-data_file
- Restore test_upload_with_data_source_fails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:40:14 -07:00
Arthur
cf41c45a26 Revert "Align ManagedFileForm validation with API serializer rules"
This reverts commit f0ac7c3bd2.
2026-03-30 15:38:38 -07:00
Arthur
f0ac7c3bd2 Align ManagedFileForm validation with API serializer rules
Add the missing checks to ManagedFileForm.clean():
- upload_file + data_source is rejected (matches API)
- data_source without data_file is rejected with a specific message
- Update the 'nothing provided' error to mention data source + data file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:37:58 -07:00
Arthur
f9af8e2068 Require data_file when data_source is specified
data_source alone is not a valid creation payload — a data_file must
also be provided to identify which file within the source to sync.
Add the corresponding validation error and a test to cover the case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:36:51 -07:00
Arthur
3bd2dbea86 Validate upload_file + data_source conflict for multipart requests
DRF 3.16 Serializer.get_value() uses parse_html_dict() or empty for all
HTML/multipart input. A flat key like data_source=2 produces an empty
dict ({}), which is falsy, so it falls back to empty and the nested
field is silently skipped. data.get('data_source') is therefore always
None in multipart requests, bypassing the conflict check.

Fix: also check self.initial_data for data_source and data_file in all
three guards in validate(), so the raw submitted value is detected even
when DRF's HTML parser drops the deserialized object.

Add test_upload_with_data_source_fails to cover the multipart conflict
path explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:35:28 -07:00
Arthur
c5d911c48b Return 400 instead of 500 on duplicate script module upload
Catch IntegrityError from the unique (file_root, file_path) constraint
and re-raise as a ValidationError so the API returns a 400 with a clear
message rather than a 500.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 15:20:38 -07:00
Arthur
c4077bf0eb Fix permission check, perform_create delegation, and test mock setup
- destroy() now checks extras.delete_script (queryset is Script.objects.all())
- create() delegates to self.perform_create() instead of calling serializer.save() directly
- Add comment explaining why update/partial_update intentionally return 405
- Fix test_upload_script_module: set mock_storage.save.return_value so file_path
  receives a real string after the _save_upload return-value fix; add DB existence check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 14:55:52 -07:00
Arthur
40f31205f2 review feedback: 2026-03-30 14:32:03 -07:00
Arthur
ad2dd3cc85 review feedback: 2026-03-30 14:21:31 -07:00
Arthur
df216cc0f1 review feedback: 2026-03-30 14:05:13 -07:00
Arthur
2a2f36c1ba Merge branch 'main' into 21701-script 2026-03-30 13:58:15 -07:00
bctiemann
e54ed87863 Merge pull request #21778 from netbox-community/21763-m2m-form-fields
Fixes #21763: Replace M2M selection field with separate add/remove fields
2026-03-30 11:23:36 -04:00
Jeremy Stretch
55daf4c52f Add/fix tests 2026-03-30 10:02:38 -04:00
Jeremy Stretch
a45e8571da Revert changes to ASNForm 2026-03-30 09:29:08 -04:00
Jeremy Stretch
0154a09856 Limit 'add' field choices to objects not already assigned 2026-03-30 09:22:56 -04:00
Jeremy Stretch
757c4f69d2 Annotate current number of assignments if >100 2026-03-30 09:15:35 -04:00
Jeremy Stretch
d5f37d7a87 Use add/remove fields only when assignment count is 100+ 2026-03-30 09:07:15 -04:00
Jeremy Stretch
f30786d8fe Fixes #21763: Replace M2M selection field with separate add/remove fields 2026-03-27 16:45:36 -04:00
github-actions
bb73601d80 Update source translation strings 2026-03-27 05:31:05 +00:00
Arthur Hanson
99e9d96787 #20923: Migrate IPAM views to declarative layouts (#21695)
* #20923: Migrate IPAM views to declarative layouts

* #20923: Migrate IPAM views to declarative layouts

* fix VRF view

* fix Route Target view

* fix addressing details modal

* fix add prefix button

* fix add aggregate button

* fix add VLAN button

* fix breadcrumb on Application Service

* fix breadcrumb on ANS

* move attrs to separate file

* review feedback

* review feedback

* review feedback

* review feedback
2026-03-26 16:55:12 -04:00
bctiemann
f5c97e367c Merge pull request #21754 from netbox-community/20923-core-ui-layouts
#20923: Migrate core app to the new UI layouts
2026-03-26 13:53:20 -04:00
Arthur
4fa31f93ca ruff fix 2026-03-26 09:57:11 -07:00
Arthur
57128e539a change to use Script api endpoint 2026-03-26 09:44:18 -07:00