Просмотр исходного кода

Closes #7462: Include count of assigned virtual machines under platform view

jeremystretch 4 лет назад
Родитель
Сommit
d2bdf4e822
3 измененных файлов с 11 добавлено и 0 удалено
  1. 4 0
      docs/release-notes/version-3.0.md
  2. 1 0
      netbox/dcim/views.py
  3. 6 0
      netbox/templates/dcim/platform.html

+ 4 - 0
docs/release-notes/version-3.0.md

@@ -2,6 +2,10 @@
 
 
 ## v3.0.6 (FUTURE)
 ## v3.0.6 (FUTURE)
 
 
+### Enhancements
+
+* [#7462](https://github.com/netbox-community/netbox/issues/7462) - Include count of assigned virtual machines under platform view
+
 ### Bug Fixes
 ### Bug Fixes
 
 
 * [#7442](https://github.com/netbox-community/netbox/issues/7442) - Fix missing actions column on user-configured tables
 * [#7442](https://github.com/netbox-community/netbox/issues/7442) - Fix missing actions column on user-configured tables

+ 1 - 0
netbox/dcim/views.py

@@ -1229,6 +1229,7 @@ class PlatformView(generic.ObjectView):
 
 
         return {
         return {
             'devices_table': devices_table,
             'devices_table': devices_table,
+            'virtualmachine_count': VirtualMachine.objects.filter(platform=instance).count()
         }
         }
 
 
 
 

+ 6 - 0
netbox/templates/dcim/platform.html

@@ -46,6 +46,12 @@
               <a href="{% url 'dcim:device_list' %}?platform_id={{ object.pk }}">{{ devices_table.rows|length }}</a>
               <a href="{% url 'dcim:device_list' %}?platform_id={{ object.pk }}">{{ devices_table.rows|length }}</a>
             </td>
             </td>
           </tr>
           </tr>
+          <tr>
+            <th scope="row">Virtual Machines</th>
+            <td>
+              <a href="{% url 'virtualization:virtualmachine_list' %}?platform_id={{ object.pk }}">{{ virtualmachine_count }}</a>
+            </td>
+          </tr>
         </table>
         </table>
       </div>
       </div>
     </div>
     </div>