Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
1c0bfd4d
Commit
1c0bfd4d
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Plain Diff
Merge branch 'feat/84-tid-prettify-device-inventory-items-in-the-webui' into 'develop'
Resolve "(TID) Prettify device inventory items in the WebUI" Closes
#84
See merge request
!167
parents
eeb16213
d510a286
No related branches found
No related tags found
2 merge requests
!235
Release TeraFlowSDN 3.0
,
!167
Resolve "(TID) Prettify device inventory items in the WebUI"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/webui/service/templates/device/inventory.html
+36
-54
36 additions, 54 deletions
src/webui/service/templates/device/inventory.html
with
36 additions
and
54 deletions
src/webui/service/templates/device/inventory.html
+
36
−
54
View file @
1c0bfd4d
...
...
@@ -73,34 +73,53 @@
</button>
</div>
</div>
<br>
{% macro render_item(item, components, depth=0) %}
{% if depth
<
10
%}
{%
if
item.type
!=
'
CHASSIS
'
%}
<
li
><span
class=
"caret"
>
{{ item.name }}
</span>
<ul
class=
"nested"
>
<li><span><b>
Component UUID:
</b>
{{item.component_uuid.uuid}}
</span></li>
<li><span><b>
Attributes:
</b>
{{item.attributes}}
</span></li>
{% for comp in components | sort(reverse = false, attribute='name') %}
{% if item.name == comp.parent %}
{{ render_item(comp, components, depth + 1) }}
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endif %}
{% endmacro %}
<div
class=
"row mb-3"
>
<div
class=
"col-sm-3"
>
<div>
<ul
id=
"myUL"
>
<li><span
class=
"caret"
>
</span>
Components
</span>
<li><span
class=
"caret"
>
Components
</span>
<ul
class=
"nested"
>
{% for item in (device.components|sort(true, attribute='name')) %}
{% if item.parent |length
<
1
or
item.type=
='CHASSIS'
%}
<
li
><span
class=
"caret"
></span>
{{item.name}}
</span>
<ul
class=
"nested"
>
{% for comp in (device.components|sort(true, attribute='name')) %}
{% if item.name == comp.parent %}
<li>
{{comp.name}}
</li>
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
{% for item in device.components | sort(reverse = false, attribute='name') %}
{% if item.parent | length
<
1
or
item.type =
=
'
CHASSIS
'
%}
<
li
><span
class=
"caret"
>
{{ item.name }}
</span>
<ul
class=
"nested"
>
<li><span><b>
Component UUID:
</b>
{{item.component_uuid.uuid}}
</span></li>
<li><span><b>
Attributes:
</b>
{{item.attributes}}
</span></li>
{% for comp in device.components | sort(reverse = false, attribute='name') %}
{% if item.name == comp.parent %}
{{ render_item(comp, device.components) }}
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
</li>
</ul>
<script>
var
toggler
=
document
.
getElementsByClassName
(
"
caret
"
);
var
i
;
for
(
i
=
0
;
i
<
toggler
.
length
;
i
++
)
{
toggler
[
i
].
addEventListener
(
"
click
"
,
function
()
{
this
.
parentElement
.
querySelector
(
"
.nested
"
).
classList
.
toggle
(
"
active
"
);
...
...
@@ -108,44 +127,7 @@
});
}
</script>
</div>
{% if device.components|length > 1 %}
<div
class=
"col-sm-8"
>
<table
class=
"table table-striped table-hover"
>
<thead>
<tr>
<th
scope=
"col"
>
Component UUID
</th>
<th
scope=
"col"
>
Name
</th>
<th
scope=
"col"
>
Type
</th>
<th
scope=
"col"
>
Parent
</th>
<th
scope=
"col"
>
Attributes
</th>
</tr>
</thead>
<tbody>
{% for component in (device.components|sort(true, attribute='name')) %}
<tr>
<td>
{{ component.component_uuid.uuid }}
</td>
<td>
{{ component.name }}
</td>
<td>
{{ component.type }}
</td>
<td>
{{ component.parent }}
</td>
<td>
{{ component.attributes }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment