Skip to content

Commit f94c1e9

Browse files
committed
Merge branch 'develop' into feature
2 parents b43980d + b7129e1 commit f94c1e9

File tree

13 files changed

+98
-25
lines changed

13 files changed

+98
-25
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
attributes:
1515
label: NetBox version
1616
description: What version of NetBox are you currently running?
17-
placeholder: v3.0.11
17+
placeholder: v3.0.12
1818
validations:
1919
required: true
2020
- type: dropdown

.github/ISSUE_TEMPLATE/feature_request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
attributes:
1515
label: NetBox version
1616
description: What version of NetBox are you currently running?
17-
placeholder: v3.0.11
17+
placeholder: v3.0.12
1818
validations:
1919
required: true
2020
- type: dropdown

docs/release-notes/version-3.0.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# NetBox v3.0
22

3-
## v3.0.12 (FUTURE)
3+
## v3.0.12 (2021-12-06)
4+
5+
### Enhancements
6+
7+
* [#7751](https://github.com/netbox-community/netbox/issues/7751) - Get API user from LDAP only when `FIND_GROUP_PERMS` is enabled
8+
* [#7885](https://github.com/netbox-community/netbox/issues/7885) - Linkify VLAN name in VLANs table
9+
* [#7892](https://github.com/netbox-community/netbox/issues/7892) - Add L22-30 power port & outlet types
10+
* [#7932](https://github.com/netbox-community/netbox/issues/7932) - Improve performance of the "quick find" function
11+
* [#7941](https://github.com/netbox-community/netbox/issues/7941) - Add multi-standard ITA power outlet type
12+
13+
### Bug Fixes
14+
15+
* [#7823](https://github.com/netbox-community/netbox/issues/7823) - Fix issue where `return_url` is not honored when 'Save & Continue' button is present
16+
* [#7981](https://github.com/netbox-community/netbox/issues/7981) - Fix Markdown sanitization regex
417

518
---
619

netbox/dcim/choices.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ class PowerPortTypeChoices(ChoiceSet):
331331
TYPE_NEMA_L1560P = 'nema-l15-60p'
332332
TYPE_NEMA_L2120P = 'nema-l21-20p'
333333
TYPE_NEMA_L2130P = 'nema-l21-30p'
334+
TYPE_NEMA_L2230P = 'nema-l22-30p'
334335
# California style
335336
TYPE_CS6361C = 'cs6361c'
336337
TYPE_CS6365C = 'cs6365c'
@@ -436,6 +437,7 @@ class PowerPortTypeChoices(ChoiceSet):
436437
(TYPE_NEMA_L1560P, 'NEMA L15-60P'),
437438
(TYPE_NEMA_L2120P, 'NEMA L21-20P'),
438439
(TYPE_NEMA_L2130P, 'NEMA L21-30P'),
440+
(TYPE_NEMA_L2230P, 'NEMA L22-30P'),
439441
)),
440442
('California Style', (
441443
(TYPE_CS6361C, 'CS6361C'),
@@ -552,6 +554,7 @@ class PowerOutletTypeChoices(ChoiceSet):
552554
TYPE_NEMA_L1560R = 'nema-l15-60r'
553555
TYPE_NEMA_L2120R = 'nema-l21-20r'
554556
TYPE_NEMA_L2130R = 'nema-l21-30r'
557+
TYPE_NEMA_L2230R = 'nema-l22-30r'
555558
# California style
556559
TYPE_CS6360C = 'CS6360C'
557560
TYPE_CS6364C = 'CS6364C'
@@ -571,6 +574,7 @@ class PowerOutletTypeChoices(ChoiceSet):
571574
TYPE_ITA_M = 'ita-m'
572575
TYPE_ITA_N = 'ita-n'
573576
TYPE_ITA_O = 'ita-o'
577+
TYPE_ITA_MULTISTANDARD = 'ita-multistandard'
574578
# USB
575579
TYPE_USB_A = 'usb-a'
576580
TYPE_USB_MICROB = 'usb-micro-b'
@@ -649,6 +653,7 @@ class PowerOutletTypeChoices(ChoiceSet):
649653
(TYPE_NEMA_L1560R, 'NEMA L15-60R'),
650654
(TYPE_NEMA_L2120R, 'NEMA L21-20R'),
651655
(TYPE_NEMA_L2130R, 'NEMA L21-30R'),
656+
(TYPE_NEMA_L2230R, 'NEMA L22-30R'),
652657
)),
653658
('California Style', (
654659
(TYPE_CS6360C, 'CS6360C'),
@@ -670,6 +675,7 @@ class PowerOutletTypeChoices(ChoiceSet):
670675
(TYPE_ITA_M, 'ITA Type M (BS 546)'),
671676
(TYPE_ITA_N, 'ITA Type N'),
672677
(TYPE_ITA_O, 'ITA Type O'),
678+
(TYPE_ITA_MULTISTANDARD, 'ITA Multistandard'),
673679
)),
674680
('USB', (
675681
(TYPE_USB_A, 'USB Type A'),

netbox/ipam/tables/vlans.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ class VLANTable(BaseTable):
9898
template_code=VLAN_LINK,
9999
verbose_name='VID'
100100
)
101+
name = tables.Column(
102+
linkify=True
103+
)
101104
site = tables.Column(
102105
linkify=True
103106
)

netbox/netbox/api/authentication.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ def authenticate_credentials(self, key):
2929
if settings.REMOTE_AUTH_BACKEND == 'netbox.authentication.LDAPBackend':
3030
from netbox.authentication import LDAPBackend
3131
ldap_backend = LDAPBackend()
32-
user = ldap_backend.populate_user(token.user.username)
33-
# If the user is found in the LDAP directory use it, if not fallback to the local user
34-
if user:
35-
return user, token
32+
33+
# Load from LDAP if FIND_GROUP_PERMS is active
34+
if ldap_backend.settings.FIND_GROUP_PERMS:
35+
user = ldap_backend.populate_user(token.user.username)
36+
# If the user is found in the LDAP directory use it, if not fallback to the local user
37+
if user:
38+
return user, token
3639

3740
return token.user, token
3841

netbox/project-static/dist/netbox.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netbox/project-static/dist/netbox.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netbox/project-static/src/forms/elements.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
import { getElements, scrollTo } from '../util';
1+
import { getElements, scrollTo, isTruthy } from '../util';
2+
3+
/**
4+
* When editing an object, it is sometimes desirable to customize the form action *without*
5+
* overriding the form's `submit` event. For example, the 'Save & Continue' button. We don't want
6+
* to use the `formaction` attribute on that element because it will be included on the form even
7+
* if the button isn't clicked.
8+
*
9+
* @example
10+
* ```html
11+
* <button type="button" return-url="/special-url/">
12+
* Save & Continue
13+
* </button>
14+
* ```
15+
*
16+
* @param event Click event.
17+
*/
18+
function handleSubmitWithReturnUrl(event: MouseEvent): void {
19+
const element = event.target as HTMLElement;
20+
if (element.tagName === 'BUTTON') {
21+
const button = element as HTMLButtonElement;
22+
const action = button.getAttribute('return-url');
23+
const form = button.form;
24+
if (form !== null && isTruthy(action)) {
25+
form.action = action;
26+
form.submit();
27+
}
28+
}
29+
}
230

331
function handleFormSubmit(event: Event, form: HTMLFormElement): void {
432
// Track the names of each invalid field.
@@ -38,6 +66,15 @@ function handleFormSubmit(event: Event, form: HTMLFormElement): void {
3866
}
3967
}
4068

69+
/**
70+
* Attach event listeners to form buttons with the `return-url` attribute present.
71+
*/
72+
function initReturnUrlSubmitButtons(): void {
73+
for (const button of getElements<HTMLButtonElement>('button[return-url]')) {
74+
button.addEventListener('click', handleSubmitWithReturnUrl);
75+
}
76+
}
77+
4178
/**
4279
* Attach an event listener to each form's submitter (button[type=submit]). When called, the
4380
* callback checks the validity of each form field and adds the appropriate Bootstrap CSS class
@@ -54,4 +91,5 @@ export function initFormElements(): void {
5491
submitter.addEventListener('click', (event: Event) => handleFormSubmit(event, form));
5592
}
5693
}
94+
initReturnUrlSubmitButtons();
5795
}

netbox/project-static/src/search.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,26 +107,36 @@ function initTableFilter(): void {
107107
// Create a regex pattern from the input search text to match against.
108108
const filter = new RegExp(target.value.toLowerCase().trim());
109109

110+
// List of which rows which match the query
111+
const matchedRows: Array<HTMLTableRowElement> = [];
112+
110113
for (const row of rows) {
111114
// Find the row's checkbox and deselect it, so that it is not accidentally included in form
112115
// submissions.
113116
const checkBox = row.querySelector<HTMLInputElement>('input[type="checkbox"][name="pk"]');
114117
if (checkBox !== null) {
115118
checkBox.checked = false;
116119
}
120+
117121
// Iterate through each row's cell values
118122
for (const value of getRowValues(row)) {
119123
if (filter.test(value.toLowerCase())) {
120-
// If this row matches the search pattern, but is already hidden, unhide it and stop
121-
// iterating through the rest of the cells.
122-
row.classList.remove('d-none');
124+
// If this row matches the search pattern, add it to the list.
125+
matchedRows.push(row);
123126
break;
124-
} else {
125-
// If none of the cells in this row match the search pattern, hide the row.
126-
row.classList.add('d-none');
127127
}
128128
}
129129
}
130+
131+
// Iterate the rows again to set visibility.
132+
// This results in a single reflow instead of one for each row.
133+
for (const row of rows) {
134+
if (matchedRows.indexOf(row) >= 0) {
135+
row.classList.remove('d-none');
136+
} else {
137+
row.classList.add('d-none');
138+
}
139+
}
130140
}
131141
input.addEventListener('keyup', debounce(handleInput, 300));
132142
}

0 commit comments

Comments
 (0)