new device module plugin

This commit is contained in:
Eric A. Miller
2013-09-01 08:39:07 -04:00
parent c75167fe27
commit 5807fd0323
7 changed files with 196 additions and 3 deletions

View File

@@ -45,7 +45,7 @@ web_plugins:
- Search::Port
- Device::Details
- Device::Ports
# - Device::Modules
- Device::Modules
- Device::Neighbors
- Device::Addresses
web_plugins_extra: []

View File

@@ -0,0 +1,63 @@
/* style for collapsable tree */
.tree {
min-height:20px;
padding:19px;
margin-bottom:20px;
background-color:#fbfbfb;
border:1px solid #999;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;
-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05)
}
.tree li {
list-style-type:none;
margin:0;
padding:10px 5px 0 5px;
position:relative
}
.tree li::before, .tree li::after {
content:'';
left:-20px;
position:absolute;
right:auto
}
.tree li::before {
border-left:1px solid #999;
bottom:50px;
height:100%;
top:0;
width:1px
}
.tree li::after {
border-top:1px solid #999;
height:20px;
top:25px;
width:25px
}
.tree li span {
-moz-border-radius:5px;
-webkit-border-radius:5px;
border:1px solid #999;
border-radius:5px;
display:inline-block;
padding:3px 8px;
text-decoration:none
}
.tree li.parent_li>span {
cursor:pointer
}
.tree>ul>li::before, .tree>ul>li::after {
border:0
}
.tree li:last-child::before {
height:30px
}
.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span {
background:#eee;
border:1px solid #94a0b4;
color:#000
}

View File

@@ -0,0 +1,60 @@
[% BLOCK recurse -%]
[% INCLUDE print_line item=item %]
[% IF nodes.$item.children.defined -%]
<ul>
[% FOREACH kidtype IN nodes.$item.children.keys -%]
[%- FOREACH kid IN nodes.$item.children.$kidtype -%]
[%- IF kid -%]
[% INCLUDE recurse item=kid %]
[%- END -%]
[%- END -%]
[%- END -%]
</ul>
[% END -%]
</li>
[%- END -%]
[% BLOCK print_line -%]
<li>
[% IF nodes.$item.children.defined -%]
<span><i class="icon-minus-sign text-info"></i>&nbsp;
[%- ELSE -%]
<span><i class="icon-leaf"></i>&nbsp;
[%- END -%]
[% nodes.$item.module.description -%]
[%- IF nodes.$item.module.name -%]
([% nodes.$item.module.name %])
[%- END -%]
[%- IF nodes.$item.module.fw_ver -%]
fw: [% nodes.$item.module.fw_ver %]
[%- END -%]
[%- IF nodes.$item.module.hw_ver -%]
hw: [% nodes.$item.module.fw_ver %]
[%- END -%]
[%- IF nodes.$item.module.sw_ver -%]
sw: [% nodes.$item.module.sw_ver %]
[%- END -%]
[%- IF nodes.$item.module.serial -%]
[serial: [% nodes.$item.module.serial %]]
[%- END -%]
[%- IF nodes.$item.module.type -%]
/ [% nodes.$item.module.type %]
[%- END -%]
[%- IF nodes.$item.module.model -%]
/ [% nodes.$item.module.model %]
[%- END -%]
[%- IF nodes.$item.module.fru -%]
<b>[FRU]</b>
[%- END -%]
</span>
[%- END -%]
<div class="tree">
<ul>
[% FOREACH module IN nodes.root %]
[% INCLUDE recurse item=module %]
[%- END -%]
</ul>
</div>
<script type="text/javascript">
[%+ INCLUDE 'js/bootstrap-tree.js' -%]
</script>

View File

@@ -0,0 +1,15 @@
$(document).ready(function() {
$('.tree > ul').attr('role', 'tree').find('ul').attr('role', 'group');
$('.tree').find('li:has(ul)').addClass('parent_li').attr('role', 'treeitem').find(' > span').attr('title', 'Collapse this branch').on('click', function (e) {
var children = $(this).parent('li.parent_li').find(' > ul > li');
if (children.is(':visible')) {
children.hide('fast');
$(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
}
else {
children.show('fast');
$(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
}
e.stopPropagation();
});
});

View File

@@ -43,6 +43,7 @@
<link rel="stylesheet" href="[% uri_base %]/css/font-awesome.min.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/toastr.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/netdisco.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/bootstrap-tree.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/nd_print.css" media="print"/>
[% FOREACH add_css IN settings._additional_css %]