mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #3809: Filter platform by manufacturer when editing devices
This commit is contained in:
@ -11,6 +11,7 @@
|
|||||||
* [#3695](https://github.com/netbox-community/netbox/issues/3695) - Include A/Z termination sites for circuits in global search
|
* [#3695](https://github.com/netbox-community/netbox/issues/3695) - Include A/Z termination sites for circuits in global search
|
||||||
* [#3712](https://github.com/netbox-community/netbox/issues/3712) - Scrolling to target (hash) did not account for the header size
|
* [#3712](https://github.com/netbox-community/netbox/issues/3712) - Scrolling to target (hash) did not account for the header size
|
||||||
* [#3780](https://github.com/netbox-community/netbox/issues/3780) - Fix AttributeError exception in API docs
|
* [#3780](https://github.com/netbox-community/netbox/issues/3780) - Fix AttributeError exception in API docs
|
||||||
|
* [#3809](https://github.com/netbox-community/netbox/issues/3809) - Filter platform by manufacturer when editing devices
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -1339,7 +1339,8 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldForm):
|
|||||||
widget=APISelect(
|
widget=APISelect(
|
||||||
api_url="/api/dcim/manufacturers/",
|
api_url="/api/dcim/manufacturers/",
|
||||||
filter_for={
|
filter_for={
|
||||||
'device_type': 'manufacturer_id'
|
'device_type': 'manufacturer_id',
|
||||||
|
'platform': 'manufacturer_id'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1408,7 +1409,10 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldForm):
|
|||||||
),
|
),
|
||||||
'status': StaticSelect2(),
|
'status': StaticSelect2(),
|
||||||
'platform': APISelect(
|
'platform': APISelect(
|
||||||
api_url="/api/dcim/platforms/"
|
api_url="/api/dcim/platforms/",
|
||||||
|
additional_query_params={
|
||||||
|
"manufacturer_id": "null"
|
||||||
|
}
|
||||||
),
|
),
|
||||||
'primary_ip4': StaticSelect2(),
|
'primary_ip4': StaticSelect2(),
|
||||||
'primary_ip6': StaticSelect2(),
|
'primary_ip6': StaticSelect2(),
|
||||||
|
@ -184,7 +184,15 @@ $(document).ready(function() {
|
|||||||
$.each(element.attributes, function(index, attr){
|
$.each(element.attributes, function(index, attr){
|
||||||
if (attr.name.includes("data-additional-query-param-")){
|
if (attr.name.includes("data-additional-query-param-")){
|
||||||
var param_name = attr.name.split("data-additional-query-param-")[1];
|
var param_name = attr.name.split("data-additional-query-param-")[1];
|
||||||
parameters[param_name] = attr.value;
|
if (param_name in parameters) {
|
||||||
|
if (Array.isArray(parameters[param_name])) {
|
||||||
|
parameters[param_name].push(attr.value)
|
||||||
|
} else {
|
||||||
|
parameters[param_name] = [parameters[param_name], attr.value]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parameters[param_name] = attr.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user