Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #14917: Replace slim-select with tom-select #15080

Merged
merged 26 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6fec62e
Experimenting
jeremystretch Jan 24, 2024
c4eed67
Remove testing resources
jeremystretch Jan 26, 2024
5ca7984
Replace ApiSelect with TomSelect
jeremystretch Jan 26, 2024
93ad822
Add color support
jeremystretch Jan 26, 2024
1400065
Add clear button
jeremystretch Jan 26, 2024
35966cb
Clear cached options when searching dynamic selects
jeremystretch Jan 29, 2024
36824d1
Add support for static parameters
jeremystretch Jan 29, 2024
04c6083
Refactor TomSelect implementation
jeremystretch Jan 29, 2024
edc9aaf
Add dynamic parameter support
jeremystretch Feb 6, 2024
ebd4a31
Limit number of options to 100
jeremystretch Feb 6, 2024
2f83a42
Remove redundant api_url definitions for user model
jeremystretch Feb 6, 2024
26e2aca
Add support for disabled indicator
jeremystretch Feb 6, 2024
0a23318
Remove obsolete value-field attr on dynamic select widgets
jeremystretch Feb 6, 2024
e0a71d2
Remove obsolete fetch_trigger kwarg from dynamic model choice widgets
jeremystretch Feb 6, 2024
dfc58bb
Remove obsolete empty_label kwarg from dynamic model choice widgets
jeremystretch Feb 6, 2024
3874c8d
Add support for API path variables
jeremystretch Feb 6, 2024
6926b37
Add support for setting a 'null' option
jeremystretch Feb 7, 2024
50f995e
Annotate depth for recursive hierarchies
jeremystretch Feb 7, 2024
d164833
Misc cleanup
jeremystretch Feb 7, 2024
bed47a4
Remove obsolete APISelect code
jeremystretch Feb 7, 2024
912f257
Remove slim-select & just-debounce-it
jeremystretch Feb 7, 2024
018815c
Clean up type validation
jeremystretch Feb 7, 2024
674f794
Closes #14237: Clear child selections on change to parent selection
jeremystretch Feb 8, 2024
3fa5168
Use an MD icon for the clear button
jeremystretch Feb 8, 2024
7f3c181
Use an MD icon for the clear button
jeremystretch Feb 8, 2024
de37c71
Explain why noUnusedParameters is disabled
jeremystretch Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions netbox/core/forms/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ class JobFilterForm(SavedFiltersMixin, FilterForm):
user = DynamicModelMultipleChoiceField(
queryset=get_user_model().objects.all(),
required=False,
label=_('User'),
widget=APISelectMultiple(
api_url='/api/users/users/',
)
label=_('User')
)


Expand Down
20 changes: 6 additions & 14 deletions netbox/dcim/forms/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,7 @@ class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
user_id = DynamicModelMultipleChoiceField(
queryset=get_user_model().objects.all(),
required=False,
label=_('User'),
widget=APISelectMultiple(
api_url='/api/users/users/',
)
label=_('User')
)
tag = TagFilterField(model)

Expand Down Expand Up @@ -551,8 +548,7 @@ class ModuleTypeFilterForm(NetBoxModelFilterSetForm):
manufacturer_id = DynamicModelMultipleChoiceField(
queryset=Manufacturer.objects.all(),
required=False,
label=_('Manufacturer'),
fetch_trigger='open'
label=_('Manufacturer')
)
part_number = forms.CharField(
label=_('Part number'),
Expand Down Expand Up @@ -828,8 +824,7 @@ class VirtualDeviceContextFilterForm(
device = DynamicModelMultipleChoiceField(
queryset=Device.objects.all(),
required=False,
label=_('Device'),
fetch_trigger='open'
label=_('Device')
)
status = forms.MultipleChoiceField(
label=_('Status'),
Expand All @@ -855,17 +850,15 @@ class ModuleFilterForm(LocalConfigContextFilterForm, TenancyFilterForm, NetBoxMo
manufacturer_id = DynamicModelMultipleChoiceField(
queryset=Manufacturer.objects.all(),
required=False,
label=_('Manufacturer'),
fetch_trigger='open'
label=_('Manufacturer')
)
module_type_id = DynamicModelMultipleChoiceField(
queryset=ModuleType.objects.all(),
required=False,
query_params={
'manufacturer_id': '$manufacturer_id'
},
label=_('Type'),
fetch_trigger='open'
label=_('Type')
)
status = forms.MultipleChoiceField(
label=_('Status'),
Expand Down Expand Up @@ -1414,8 +1407,7 @@ class InventoryItemFilterForm(DeviceComponentFilterForm):
role_id = DynamicModelMultipleChoiceField(
queryset=InventoryItemRole.objects.all(),
required=False,
label=_('Role'),
fetch_trigger='open'
label=_('Role')
)
manufacturer_id = DynamicModelMultipleChoiceField(
queryset=Manufacturer.objects.all(),
Expand Down
13 changes: 3 additions & 10 deletions netbox/extras/forms/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ class ConfigContextFilterForm(SavedFiltersMixin, FilterForm):
cluster_type_id = DynamicModelMultipleChoiceField(
queryset=ClusterType.objects.all(),
required=False,
label=_('Cluster types'),
fetch_trigger='open'
label=_('Cluster types')
)
cluster_group_id = DynamicModelMultipleChoiceField(
queryset=ClusterGroup.objects.all(),
Expand Down Expand Up @@ -462,10 +461,7 @@ class JournalEntryFilterForm(NetBoxModelFilterSetForm):
created_by_id = DynamicModelMultipleChoiceField(
queryset=get_user_model().objects.all(),
required=False,
label=_('User'),
widget=APISelectMultiple(
api_url='/api/users/users/',
)
label=_('User')
)
assigned_object_type_id = DynamicModelMultipleChoiceField(
queryset=ContentType.objects.all(),
Expand Down Expand Up @@ -508,10 +504,7 @@ class ObjectChangeFilterForm(SavedFiltersMixin, FilterForm):
user_id = DynamicModelMultipleChoiceField(
queryset=get_user_model().objects.all(),
required=False,
label=_('User'),
widget=APISelectMultiple(
api_url='/api/users/users/',
)
label=_('User')
)
changed_object_type_id = DynamicModelMultipleChoiceField(
queryset=ContentType.objects.all(),
Expand Down
2 changes: 1 addition & 1 deletion netbox/project-static/dist/netbox.css

Large diffs are not rendered by default.

23 changes: 8 additions & 15 deletions netbox/project-static/dist/netbox.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions netbox/project-static/dist/netbox.js.map

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions netbox/project-static/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions netbox/project-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
"gridstack": "^7.2.3",
"html-entities": "^2.3.3",
"htmx.org": "^1.8.0",
"just-debounce-it": "^3.1.1",
"query-string": "^7.1.1",
"sass": "^1.55.0",
"slim-select": "^1.27.1",
"tom-select": "^2.3.1",
"typeface-inter": "^3.18.1",
"typeface-roboto-mono": "^1.1.13"
},
"devDependencies": {
"@types/bootstrap": "5.2.10",
"@types/cookie": "^0.5.1",
"@types/node": "^20.11.16",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"esbuild": "^0.13.15",
Expand Down
4 changes: 2 additions & 2 deletions netbox/project-static/src/htmx.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getElements, isTruthy } from './util';
import { initButtons } from './buttons';
import { initSelect } from './select';
import { initSelects } from './select';
import { initObjectSelector } from './objectSelector';
import { initBootstrap } from './bs';

function initDepedencies(): void {
for (const init of [initButtons, initSelect, initObjectSelector, initBootstrap]) {
for (const init of [initButtons, initSelects, initObjectSelector, initBootstrap]) {
init();
}
}
Expand Down
1 change: 1 addition & 0 deletions netbox/project-static/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '@popperjs/core';
import 'bootstrap';
import 'htmx.org';
import 'tom-select';
import './netbox';
4 changes: 2 additions & 2 deletions netbox/project-static/src/netbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { initForms } from './forms';
import { initBootstrap } from './bs';
import { initQuickSearch } from './search';
import { initSelect } from './select';
import { initSelects } from './select';
import { initButtons } from './buttons';
import { initColorMode } from './colorMode';
import { initMessages } from './messages';
Expand All @@ -22,7 +22,7 @@ function initDocument(): void {
initMessages,
initForms,
initQuickSearch,
initSelect,
initSelects,
initDateSelector,
initButtons,
initClipboard,
Expand Down
Loading
Loading