mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-16 16:52:17 -06:00
* Initial work on #19735 * Work in progress * Remove ClusterRemoveDevicesView (anti-pattern) * Misc cleanup * Fix has_bulk_actions * Fix has_bulk_actions for ObjectChildrenView * Restore clone button * Misc cleanup * Clean up custom bulk actions * Rename individual object actions * Collapse into a single template tag * Fix support for legacy action dicts * Rename bulk attr to multi * clone_button tag should fail silently if view name is invalid * Clean up action buttons * Fix export button label * Replace clone_button with an ObjectAction * Create object actions for adding device/VM components * Move core_sync.html to core app * Remove extra_bulk_buttons from template doc
This commit is contained in:
38
netbox/dcim/object_actions.py
Normal file
38
netbox/dcim/object_actions.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from netbox.object_actions import ObjectAction
|
||||
|
||||
__all__ = (
|
||||
'BulkAddComponents',
|
||||
'BulkDisconnect',
|
||||
)
|
||||
|
||||
|
||||
class BulkAddComponents(ObjectAction):
|
||||
"""
|
||||
Add components to the selected devices.
|
||||
"""
|
||||
label = _('Add Components')
|
||||
multi = True
|
||||
permissions_required = {'change'}
|
||||
template_name = 'dcim/buttons/bulk_add_components.html'
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, context, obj):
|
||||
return {
|
||||
'perms': context.get('perms'),
|
||||
'request': context.get('request'),
|
||||
'formaction': context.get('formaction'),
|
||||
'label': cls.label,
|
||||
}
|
||||
|
||||
|
||||
class BulkDisconnect(ObjectAction):
|
||||
"""
|
||||
Disconnect each of a set of objects to which a cable is connected.
|
||||
"""
|
||||
name = 'bulk_disconnect'
|
||||
label = _('Disconnect Selected')
|
||||
multi = True
|
||||
permissions_required = {'change'}
|
||||
template_name = 'dcim/buttons/bulk_disconnect.html'
|
||||
Reference in New Issue
Block a user