save and load netmap positions for same device groups

This commit is contained in:
Oliver Gorwits
2017-12-20 22:05:51 +00:00
parent b7cd0251ff
commit aba359d2a9
6 changed files with 89 additions and 15 deletions

View File

@@ -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'

View File

@@ -0,0 +1,9 @@
BEGIN;
CREATE TABLE "netmap_positions" (
"id" serial PRIMARY KEY,
"device_groups" text[] UNIQUE NOT NULL,
"positions" text NOT NULL
);
COMMIT;

View File

@@ -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() {