1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
| from django.utils.translation import gettext as _
from netbox.registry import registry from . import *
ORGANIZATION_MENU = Menu( label=_('组织机构'), icon_class='mdi mdi-domain', groups=( MenuGroup( label=_('机房'), items=( get_model_item('dcim', 'site', _('数据中心')), get_model_item('dcim', 'region', _('地区')), get_model_item('dcim', 'sitegroup', _('数据中心组')), get_model_item('dcim', 'location', _('具体地点')), ), ), MenuGroup( label=_('机架'), items=( get_model_item('dcim', 'rack', _('机柜')), get_model_item('dcim', 'rackrole', _('机柜角色')), get_model_item('dcim', 'rackreservation', _('预留')), MenuItem( link='dcim:rack_elevation_list', link_text=_('立面图'), permissions=['dcim.view_rack'] ), ), ), MenuGroup( label=_('租凭'), items=( get_model_item('tenancy', 'tenant', _('租户')), get_model_item('tenancy', 'tenantgroup', _('租户组')), ), ), MenuGroup( label=_('联系方式'), items=( get_model_item('tenancy', 'contact', _('联系人')), get_model_item('tenancy', 'contactgroup', _('联系人组')), get_model_item('tenancy', 'contactrole', _('联系人角色')), get_model_item('tenancy', 'contactassignment', _('联系方式分配'), actions=[]), ), ), ), )
DEVICES_MENU = Menu( label=_('设备'), icon_class='mdi mdi-server', groups=( MenuGroup( label=_('Devices'), items=( get_model_item('dcim', 'device', _('设备')), get_model_item('dcim', 'module', _('模块组件')), get_model_item('dcim', 'devicerole', _('设备角色')), get_model_item('dcim', 'platform', _('平台')), get_model_item('dcim', 'virtualchassis', _('虚拟机箱')), get_model_item('dcim', 'virtualdevicecontext', _('Virtual Device Contexts')), ), ), MenuGroup( label=_('类型'), items=( get_model_item('dcim', 'devicetype', _('设备型号')), get_model_item('dcim', 'moduletype', _('模块类型')), get_model_item('dcim', 'manufacturer', _('制造商')), ), ), MenuGroup( label=_('设备组件'), items=( get_model_item('dcim', 'interface', _('接口')), get_model_item('dcim', 'frontport', _('前端口')), get_model_item('dcim', 'rearport', _('后端口')), get_model_item('dcim', 'consoleport', _('Console 端口')), get_model_item('dcim', 'consoleserverport', _('Console 服务器端口')), get_model_item('dcim', 'powerport', _('电力接口')), get_model_item('dcim', 'poweroutlet', _('电源插座PDU')), get_model_item('dcim', 'modulebay', _('模块组件托架')), get_model_item('dcim', 'devicebay', _('设备托架')), get_model_item('dcim', 'inventoryitem', _('库存物品')), get_model_item('dcim', 'inventoryitemrole', _('库存项目角色')), ), ), ), )
CONNECTIONS_MENU = Menu( label=_('连接'), icon_class='mdi mdi-connection', groups=( MenuGroup( label=_('Connections'), items=( get_model_item('dcim', 'cable', _('线缆'), actions=['import']), get_model_item('wireless', 'wirelesslink', _('无线连接')), MenuItem( link='dcim:interface_connections_list', link_text=_('接口连接'), permissions=['dcim.view_interface'] ), MenuItem( link='dcim:console_connections_list', link_text=_('Console 连接'), permissions=['dcim.view_consoleport'] ), MenuItem( link='dcim:power_connections_list', link_text=_('电源连接'), permissions=['dcim.view_powerport'] ), ), ), ), )
WIRELESS_MENU = Menu( label=_('无线'), icon_class='mdi mdi-wifi', groups=( MenuGroup( label=_('Wireless'), items=( get_model_item('wireless', 'wirelesslan', _('无线局域网')), get_model_item('wireless', 'wirelesslangroup', _('无线局域网组')), ), ), ), )
IPAM_MENU = Menu( label=_('IP地址管理'), icon_class='mdi mdi-counter', groups=( MenuGroup( label=_('IP Addresses'), items=( get_model_item('ipam', 'ipaddress', _('IP 地址')), get_model_item('ipam', 'iprange', _('IP 范围')), ), ), MenuGroup( label=_('Prefixes'), items=( get_model_item('ipam', 'prefix', _('IP网段')), get_model_item('ipam', 'role', _('网段和VLAN 角色')), ), ), MenuGroup( label=_('ASNs'), items=( get_model_item('ipam', 'asnrange', _('ASN Ranges')), get_model_item('ipam', 'asn', _('ASNs')), ), ), MenuGroup( label=_('Aggregates'), items=( get_model_item('ipam', 'aggregate', _('Aggregates')), get_model_item('ipam', 'rir', _('RIRs')), ), ), MenuGroup( label=_('VRFs'), items=( get_model_item('ipam', 'vrf', _('VRFs')), get_model_item('ipam', 'routetarget', _('Route Targets')), ), ), MenuGroup( label=_('VLANs'), items=( get_model_item('ipam', 'vlan', _('VLANs')), get_model_item('ipam', 'vlangroup', _('VLAN Groups')), ), ), MenuGroup( label=_('Other'), items=( get_model_item('ipam', 'fhrpgroup', _('FHRP Groups')), get_model_item('ipam', 'servicetemplate', _('Service Templates')), get_model_item('ipam', 'service', _('Services')), ), ), ), )
OVERLAY_MENU = Menu( label=_('网络虚拟化Overlay'), icon_class='mdi mdi-graph-outline', groups=( MenuGroup( label='L2VPNs', items=( get_model_item('ipam', 'l2vpn', _('L2VPNs')), get_model_item('ipam', 'l2vpntermination', _('Terminations')), ), ), ), )
VIRTUALIZATION_MENU = Menu( label=_('裸金属虚拟化'), icon_class='mdi mdi-monitor', groups=( MenuGroup( label=_('Virtual Machines'), items=( get_model_item('virtualization', 'virtualmachine', _('虚拟机')), get_model_item('virtualization', 'vminterface', _('虚拟机接口')), ), ), MenuGroup( label=_('Clusters'), items=( get_model_item('virtualization', 'cluster', _('虚拟化集群')), get_model_item('virtualization', 'clustertype', _('虚拟化集群类型')), get_model_item('virtualization', 'clustergroup', _('集群组')), ), ), ), )
CIRCUITS_MENU = Menu( label=_('线路'), icon_class='mdi mdi-transit-connection-variant', groups=( MenuGroup( label=_('Circuits'), items=( get_model_item('circuits', 'circuit', _('线路')), get_model_item('circuits', 'circuittype', _('线路类型')), ), ), MenuGroup( label=_('Providers'), items=( get_model_item('circuits', 'provider', _('供应商')), get_model_item('circuits', 'provideraccount', _('供应商账号')), get_model_item('circuits', 'providernetwork', _('供应商网络')), ), ), ), )
POWER_MENU = Menu( label=_('电力'), icon_class='mdi mdi-flash', groups=( MenuGroup( label=_('Power'), items=( get_model_item('dcim', 'powerfeed', _('电源线')), get_model_item('dcim', 'powerpanel', _('电源插座')), ), ), ), )
PROVISIONING_MENU = Menu( label=_('设备配置'), icon_class='mdi mdi-file-document-multiple-outline', groups=( MenuGroup( label=_('Configurations'), items=( get_model_item('extras', 'configcontext', _('Config Contexts'), actions=['add']), get_model_item('extras', 'configtemplate', _('Config Templates'), actions=['add']), ), ), ), )
CUSTOMIZATION_MENU = Menu( label=_('自定义'), icon_class='mdi mdi-toolbox-outline', groups=( MenuGroup( label=_('Customization'), items=( get_model_item('extras', 'customfield', _('自定义字段')), get_model_item('extras', 'customlink', _('自定义链接')), get_model_item('extras', 'exporttemplate', _('自定义验证')), get_model_item('extras', 'savedfilter', _('已保存的筛选条件')), get_model_item('extras', 'tag', 'Tags'), get_model_item('extras', 'imageattachment', _('图片附件'), actions=()), ), ), MenuGroup( label=_('Reports & Scripts'), items=( MenuItem( link='extras:report_list', link_text=_('报告'), permissions=['extras.view_report'], buttons=get_model_buttons('extras', "reportmodule", actions=['add']) ), MenuItem( link='extras:script_list', link_text=_('脚本'), permissions=['extras.view_script'], buttons=get_model_buttons('extras', "scriptmodule", actions=['add']) ), ), ), ), )
OPERATIONS_MENU = Menu( label=_('运营'), icon_class='mdi mdi-cogs', groups=( MenuGroup( label=_('Integrations'), items=( get_model_item('core', 'datasource', _('Data Sources')), get_model_item('extras', 'webhook', _('Webhooks')), ), ), MenuGroup( label=_('Jobs'), items=( MenuItem( link='core:job_list', link_text=_('Jobs'), permissions=['core.view_job'], ), ), ), MenuGroup( label=_('Logging'), items=( get_model_item('extras', 'journalentry', _('日记列表'), actions=['import']), get_model_item('extras', 'objectchange', _('操作日志'), actions=[]), ), ), ), )
MENUS = [ ORGANIZATION_MENU, DEVICES_MENU, CONNECTIONS_MENU, WIRELESS_MENU, IPAM_MENU, OVERLAY_MENU, VIRTUALIZATION_MENU, CIRCUITS_MENU, POWER_MENU, PROVISIONING_MENU, CUSTOMIZATION_MENU, OPERATIONS_MENU, ]
# # Add plugin menus #
for menu in registry['plugins']['menus']: MENUS.append(menu)
if registry['plugins']['menu_items']:
# Build the default plugins menu groups = [ MenuGroup(label=label, items=items) for label, items in registry['plugins']['menu_items'].items() ] plugins_menu = Menu( label=_("Plugins"), icon_class="mdi mdi-puzzle", groups=groups ) MENUS.append(plugins_menu)
|