save and load netmap positions for same device groups
This commit is contained in:
@@ -172,6 +172,8 @@ login_logo: ""
|
||||
# mibhome is discovered from environment
|
||||
# mibdirs defaults to contents of mibhome
|
||||
host_groups:
|
||||
__ANY__:
|
||||
- 'any'
|
||||
__LOCAL_ADDRESSES__:
|
||||
- '::1'
|
||||
- 'fe80::/10'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE "netmap_positions" (
|
||||
"id" serial PRIMARY KEY,
|
||||
"device_groups" text[] UNIQUE NOT NULL,
|
||||
"positions" text NOT NULL
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
@@ -40,11 +40,12 @@ $.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, fu
|
||||
graph.inspect().main.force.on('end.setupfornetdisco', function() {
|
||||
graph.inspect().main.nodes.each(function(n) { n.fixed = true });
|
||||
|
||||
// FIXME
|
||||
$.post(
|
||||
'[% uri_for('/ajax/data/device/netmappositions') %]'
|
||||
,'positions=' + JSON.stringify(graph.positions())
|
||||
);
|
||||
if (mapdata['v3']['newnodes']) {
|
||||
$.post(
|
||||
'[% uri_for('/ajax/data/device/netmappositions') %]'
|
||||
,'positions=' + JSON.stringify(graph.positions())
|
||||
);
|
||||
}
|
||||
|
||||
graph['nd2'] = {};
|
||||
graph['nd2']['dragging'] = false;
|
||||
@@ -89,7 +90,7 @@ $.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, fu
|
||||
}),
|
||||
'links': mapdata['v3']['links']
|
||||
}};
|
||||
graph.start();
|
||||
graph.start(netmapdata);
|
||||
|
||||
// center on our selected device
|
||||
// graph.inspect().main.force.on('end.centernode', function() {
|
||||
|
||||
Reference in New Issue
Block a user