implement dynamic sizing option

This commit is contained in:
Oliver Gorwits
2017-12-24 18:12:04 +00:00
parent e4b19be5d7
commit 938848551e
7 changed files with 63 additions and 15 deletions

View File

@@ -135,6 +135,7 @@ sidebar_defaults:
device_netmap:
mapshow: { default: neighbors }
colorgroups: { default: checked }
dynamicsize: { default: null }
report_moduleinventory:
fruonly: { default: checked }
matchall: { default: checked }

View File

@@ -51,6 +51,8 @@ $.getJSON('[% uri_for('/ajax/data/device/netmap') %]?[% my_query %]', function(m
.width( parseInt(jQuery('#netmap_pane').parent().css('width')) )
.height( window.innerHeight - 100 )
.showSelfLinks(true)
.minNodeRadius(6)
.maxNodeRadius(20)
.minZoomFactor(0.1)
.maxZoomFactor(10)
.charge(-550)
@@ -133,8 +135,12 @@ $.getJSON('[% uri_for('/ajax/data/device/netmap') %]?[% my_query %]', function(m
if ('[% params.mapshow %]' == 'neighbors') {
setTimeout(function() {
var node = graph.nodeDataById( graph['nd2']['centernode'] );
graph.zoomSmooth(node.x, node.y, node.radius * 100);
if ('[% params.dynamicsize %]' == 'on') {
graph.zoomToFit();
} else {
var node = graph.nodeDataById( graph['nd2']['centernode'] );
graph.zoomSmooth(node.x, node.y, node.radius * 100);
}
}, 1000);
}
});

View File

@@ -69,7 +69,7 @@
<input type="radio" name="mapshow" id="nd_mapshow-only"
[% 'checked' IF vars.sidebar_defaults.device_netmap.mapshow == 'only' %]
[% 'disabled' IF NOT devgrp_list.size %] value="only">
<label for="nd_mapshow-only">Host Groups[% ':' IF devgrp_list.size %]</label>
<label for="nd_mapshow-only">Host Groups</label>
</div>
[% IF devgrp_list.size %]
@@ -110,8 +110,8 @@
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="dynamicsize" name="dynamicsize" disabled
[% 'checked="checked"' IF params.dynamicsize %]/>
<input type="checkbox" id="dynamicsize" name="dynamicsize"
[% 'checked="checked"' IF vars.sidebar_defaults.device_netmap.dynamicsize %]/>
</label>
<label class="nd_checkboxlabel" for="dynamicsize">
<span class="nd_searchcheckbox uneditable-input">Dynamic Size</span>