|
157 | 157 |
|
158 | 158 | # Plugins configuration settings. These settings are used by various plugins that the user may have installed. |
159 | 159 | # Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings. |
160 | | -# PLUGINS_CONFIG = {} |
| 160 | +PLUGINS_CONFIG = { |
| 161 | + |
| 162 | + 'netbox_qrcode': { |
| 163 | + |
| 164 | + ## Example Template for Devices |
| 165 | + |
| 166 | + 'device_2': { |
| 167 | + 'title': 'Example 2 (Template for Device)', |
| 168 | + 'text_template': '<div style="display: inline-block; height: 5mm; width: 15mm"><img src="{{ logo }}" style="width:100%; height:100%; object-fit:fill;""></div><br>{{ obj.name }}<br>Device: {{ obj.id|stringformat:"07d" }}', |
| 169 | + 'font_size': '4mm', |
| 170 | + 'label_qr_width': '20mm', |
| 171 | + 'label_qr_height': '30mm', |
| 172 | + 'label_qr_text_distance': '2mm', |
| 173 | + 'label_width': '56mm', |
| 174 | + 'label_height': '32mm', |
| 175 | + 'label_edge_top': '0mm', |
| 176 | + 'label_edge_left': '2mm', |
| 177 | + 'label_edge_right': '2mm', |
| 178 | + 'logo': '/media/image-attachments/Netbox_Icon_Example.png', |
| 179 | + }, |
| 180 | + |
| 181 | + 'device_3': { |
| 182 | + 'title': 'Example 3 (Template for Device)', |
| 183 | + 'font_size': '4mm', |
| 184 | + 'label_qr_width': '15mm', |
| 185 | + 'label_qr_height': '15mm', |
| 186 | + 'label_qr_text_distance': '2mm', |
| 187 | + 'label_width': '56mm', |
| 188 | + 'label_height': '32mm', |
| 189 | + 'label_edge_top': '0mm', |
| 190 | + 'label_edge_left': '2mm', |
| 191 | + 'label_edge_right': '2mm', |
| 192 | + 'text_location': 'left', |
| 193 | + }, |
| 194 | + |
| 195 | + 'device_4': { |
| 196 | + 'title': 'Example 4 (Template for Device)', |
| 197 | + 'font_size': '4mm', |
| 198 | + 'text_align_horizontal': 'center', |
| 199 | + 'text_align_vertical': 'middle', |
| 200 | + 'label_qr_width': '20mm', |
| 201 | + 'label_qr_height': '20mm', |
| 202 | + 'label_qr_text_distance': '0mm', |
| 203 | + 'label_width': '56mm', |
| 204 | + 'label_height': '32mm', |
| 205 | + 'label_edge_top': '0mm', |
| 206 | + 'label_edge_left': '0mm', |
| 207 | + 'label_edge_right': '0mm', |
| 208 | + 'with_text': True, |
| 209 | + 'with_qr': False, |
| 210 | + }, |
| 211 | + |
| 212 | + 'device_5': { |
| 213 | + 'title': 'Example 5 (Template for Device)', |
| 214 | + 'font_size': '4mm', |
| 215 | + 'text_align_horizontal': 'left', |
| 216 | + 'text_align_vertical': 'middle', |
| 217 | + 'label_qr_width': '20mm', |
| 218 | + 'label_qr_height': '20mm', |
| 219 | + 'label_qr_text_distance': '0mm', |
| 220 | + 'label_width': '56mm', |
| 221 | + 'label_height': '32mm', |
| 222 | + 'label_edge_top': '0mm', |
| 223 | + 'label_edge_left': '2mm', |
| 224 | + 'label_edge_right': '0mm', |
| 225 | + 'with_text': True, |
| 226 | + 'with_qr': False, |
| 227 | + }, |
| 228 | + |
| 229 | + 'device_6': { |
| 230 | + 'title': 'Example 6 (Template for Device)', |
| 231 | + 'font_size': '4mm', |
| 232 | + 'label_qr_width': '20mm', |
| 233 | + 'label_qr_height': '20mm', |
| 234 | + 'label_qr_text_distance': '0mm', |
| 235 | + 'label_width': '56mm', |
| 236 | + 'label_height': '32mm', |
| 237 | + 'label_edge_top': '0mm', |
| 238 | + 'label_edge_left': '0mm', |
| 239 | + 'label_edge_right': '0mm', |
| 240 | + 'with_text': False, |
| 241 | + 'with_qr': True, |
| 242 | + }, |
| 243 | + |
| 244 | + 'device_7': { |
| 245 | + 'title': 'Example 7 (Template for Device)', |
| 246 | + 'font_size': '4mm', |
| 247 | + 'label_qr_width': '20mm', |
| 248 | + 'label_qr_height': '20mm', |
| 249 | + 'label_qr_text_distance': '0mm', |
| 250 | + 'label_width': '32mm', |
| 251 | + 'label_height': '56mm', |
| 252 | + 'label_edge_top': '2mm', |
| 253 | + 'label_edge_left': '0mm', |
| 254 | + 'label_edge_right': '0mm', |
| 255 | + 'text_location': 'up', |
| 256 | + 'text_align_horizontal': 'center', |
| 257 | + 'text_align_vertical': 'top', |
| 258 | + 'label_edge_bottom': '2mm', |
| 259 | + }, |
| 260 | + |
| 261 | + 'device_8': { |
| 262 | + 'title': 'Example 8 (Template for Device)', |
| 263 | + 'font_size': '4mm', |
| 264 | + 'label_qr_width': '20mm', |
| 265 | + 'label_qr_height': '20mm', |
| 266 | + 'label_qr_text_distance': '2mm', |
| 267 | + 'label_width': '32mm', |
| 268 | + 'label_height': '56mm', |
| 269 | + 'label_edge_top': '2mm', |
| 270 | + 'label_edge_left': '0mm', |
| 271 | + 'label_edge_right': '0mm', |
| 272 | + 'text_location': 'down', |
| 273 | + 'text_align_horizontal': 'center', |
| 274 | + 'text_align_vertical': 'top', |
| 275 | + }, |
| 276 | + |
| 277 | + 'device_9': { |
| 278 | + 'title': 'Example 9 (Template for Device)', |
| 279 | + 'font_size': '1mm', |
| 280 | + 'label_qr_width': '9mm', |
| 281 | + 'label_qr_height': '9mm', |
| 282 | + 'label_qr_text_distance': '1mm', |
| 283 | + 'label_width': '25mm', |
| 284 | + 'label_height': '10mm', |
| 285 | + 'label_edge_top': '0.2mm', |
| 286 | + 'label_edge_left': '0.2mm', |
| 287 | + 'label_edge_right': '0mm', |
| 288 | + }, |
| 289 | + |
| 290 | + 'device_10': { |
| 291 | + 'title': 'Example 10 (Template for Device)', |
| 292 | + 'with_qr': False, |
| 293 | + 'text_align_horizontal': 'center', |
| 294 | + 'text_align_vertical': 'middle', |
| 295 | + 'text_template': '<div style="display: inline-block; height: 8.65mm; width: 30mm"><img src="/media/image-attachments/Netbox_Icon_Example.png" style="width:100%; height:100%; object-fit:fill;"></div><br>' |
| 296 | + '{{ obj.name }} <br>' |
| 297 | + '<div style="display: inline-block; height: 10mm; width: 10mm"><img src="data:image/png;base64,{{qrCode}}" style="width:100%; height:100%; object-fit:fill;"/></div><br>' |
| 298 | + 'Device: {{ obj.id|stringformat:"07d" }}' |
| 299 | + '<p>😝 <font color="red"><b> My label design </b> </font> 😝</p>', |
| 300 | + |
| 301 | + 'label_width': '56mm', |
| 302 | + 'label_height': '32mm', |
| 303 | + 'label_edge_top': '0mm', |
| 304 | + 'label_edge_left': '0mm', |
| 305 | + 'label_edge_right': '0mm', |
| 306 | + }, |
| 307 | + |
| 308 | + |
| 309 | + ## Example Template for Cables |
| 310 | + |
| 311 | + 'cable': { |
| 312 | + 'title': 'Example 1 (Template for Cable)', |
| 313 | + 'with_qr': False, |
| 314 | + 'label_edge_left': '0.00mm', |
| 315 | + 'label_edge_right': '0.00mm', |
| 316 | + 'label_edge_top': '0.00mm', |
| 317 | + 'text_align_vertical': 'middle', |
| 318 | + 'text_align_horizontal': 'center', |
| 319 | + 'text_template': '<span style="writing-mode: vertical-lr; transform: scale(-1);">' |
| 320 | + '{{ obj.label }}</br>' |
| 321 | + '{{ obj.label }}</br>' |
| 322 | + '{{ obj.label }}</br>' |
| 323 | + '{{ obj.label }}</br>' |
| 324 | + '{{ obj.label }}</br>' |
| 325 | + '{{ obj.label }}</br>' |
| 326 | + '{{ obj.label }}</br>' |
| 327 | + '{{ obj.label }}</br>' |
| 328 | + '{{ obj.label }}</br>' |
| 329 | + '{{ obj.label }}</br>' |
| 330 | + '{{ obj.label }}</br>' |
| 331 | + '{{ obj.label }}</br>' |
| 332 | + '{{ obj.label }}</br>' |
| 333 | + '</span>' |
| 334 | + }, |
| 335 | + |
| 336 | + 'cable_2': { |
| 337 | + 'title': 'Example 2 (Template for Cable)', |
| 338 | + 'with_qr': False, |
| 339 | + 'label_edge_left': '0.00mm', |
| 340 | + 'label_edge_right': '0.00mm', |
| 341 | + 'label_edge_top': '0.00mm', |
| 342 | + 'text_align_vertical': 'middle', |
| 343 | + 'text_align_horizontal': 'center', |
| 344 | + |
| 345 | + # QR-Code Image File |
| 346 | + 'qr_version': 1, |
| 347 | + 'qr_error_correction': 1, |
| 348 | + 'qr_box_size': 2, |
| 349 | + 'qr_border': 0, |
| 350 | + |
| 351 | + 'text_template': '<svg id="barcode"></svg>' |
| 352 | + '<svg id="barcode"></svg>' |
| 353 | + '<svg id="barcode"></svg>' |
| 354 | + '<svg id="barcode"></svg>' |
| 355 | + '' |
| 356 | + '<style>' |
| 357 | + ' #barcode {' |
| 358 | + ' max-width: 48mm;' |
| 359 | + ' width: 100%;' |
| 360 | + ' max-height: 6mm;' |
| 361 | + ' height: 100%;' |
| 362 | + ' }' |
| 363 | + '</style>' |
| 364 | + '' |
| 365 | + '<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js"></script>' |
| 366 | + '' |
| 367 | + '<script>' |
| 368 | + ' JsBarcode("#barcode", "{{ obj.label }}", {' |
| 369 | + ' background: "transparent",' |
| 370 | + ' format: "CODE128",' |
| 371 | + ' displayValue: true,' |
| 372 | + ' margin: 0,' |
| 373 | + ' height: 15' |
| 374 | + ' });' |
| 375 | + '</script>' |
| 376 | + } |
| 377 | + } |
| 378 | +} |
161 | 379 |
|
162 | 380 | # When determining the primary IP address for a device, IPv6 is preferred over IPv4 by default. Set this to True to |
163 | 381 | # prefer IPv4 instead. |
|
0 commit comments