diff --git a/src/webui/service/device/routes.py b/src/webui/service/device/routes.py index 110a19b402da15697a903e80729c52a118031ba0..ce15c7abaa527191e87dcaeee5b91599014c1e72 100644 --- a/src/webui/service/device/routes.py +++ b/src/webui/service/device/routes.py @@ -149,6 +149,16 @@ def detail(device_uuid: str): return render_template( 'device/detail.html', device=device_obj, dde=DeviceDriverEnum, dose=DeviceOperationalStatusEnum) + +@device.route('inventory/', methods=['GET', 'POST']) +def inventory(device_uuid: str): + context_client.connect() + device_obj = get_device(context_client, device_uuid, rw_copy=False) + if device_obj is None: + flash('Device({:s}) not found'.format(str(device_uuid)), 'danger') + device_obj = Device() + context_client.close() + return render_template('device/inventory.html', device=device_obj) @device.get('/delete') def delete(device_uuid): diff --git a/src/webui/service/templates/device/detail.html b/src/webui/service/templates/device/detail.html index b02be6f4d4f6c975c4ebf3528bc6770ae25e6702..a9c069ac3a526af46392ffd2f23205a7604dbb7d 100644 --- a/src/webui/service/templates/device/detail.html +++ b/src/webui/service/templates/device/detail.html @@ -86,42 +86,6 @@ - {% if device.components|length > 0 %} -
- - - - - - - - - - - - {% for component in device.components %} - - - - - - - - {% endfor %} - -
Component UUIDNameTypeParentAttributes
- {{ component.component_uuid.uuid }} - - {{ component.name }} - - {{ component.type }} - - {{ component.parent }} - - {{ component.attributes }} -
-
- {% endif %} Configurations: diff --git a/src/webui/service/templates/device/home.html b/src/webui/service/templates/device/home.html index 53434196f85c3a8c79fe9b861204e9bd8c6a5d8f..e356fd4fbeccc6e735d9723b8b1ca3e5fcf865ec 100644 --- a/src/webui/service/templates/device/home.html +++ b/src/webui/service/templates/device/home.html @@ -50,6 +50,7 @@ Status Config Rules + @@ -74,6 +75,14 @@ + + + + + + + + {% endfor %} {% else %} diff --git a/src/webui/service/templates/device/inventory.html b/src/webui/service/templates/device/inventory.html new file mode 100644 index 0000000000000000000000000000000000000000..17c14785a89658b59e07373bc7d939e234937631 --- /dev/null +++ b/src/webui/service/templates/device/inventory.html @@ -0,0 +1,151 @@ + + +{% extends 'base.html' %} + +{% block content %} + + +

Device {{ device.name }} ({{ device.device_id.device_uuid.uuid }})

+ +
+
+ +
+
+ +
+
+
+
    +
  • Components +
      + {% for item in (device.components|sort(true, attribute='name')) %} + {% if item.parent |length < 1 or item.type=='CHASSIS' %} +
    • {{item.name}} +
        + {% for comp in (device.components|sort(true, attribute='name')) %} + {% if item.name == comp.parent %} +
      • {{comp.name}}
      • + {% endif %} + {% endfor %} +
      +
    • + {% endif %} + {% endfor %} +
    +
  • +
+ + + +
+ {% if device.components|length > 1 %} +
+ + + + + + + + + + + + {% for component in (device.components|sort(true, attribute='name')) %} + + + + + + + + {% endfor %} + +
Component UUIDNameTypeParentAttributes
+ {{ component.component_uuid.uuid }} + + {{ component.name }} + + {{ component.type }} + + {{ component.parent }} + + {{ component.attributes }} +
+
+ {% endif %} +
+ +{% endblock %}