basic positions upload

This commit is contained in:
Oliver Gorwits
2017-12-19 23:24:47 +00:00
parent 786115ebda
commit b7cd0251ff
2 changed files with 15 additions and 3 deletions

View File

@@ -14,6 +14,12 @@ ajax '/ajax/content/device/netmap' => require_login sub {
template 'ajax/device/netmap.tt', {}, { layout => undef };
};
# TODO
ajax '/ajax/data/device/netmappositions' => require_login sub {
my $x = from_json param('positions');
use DDP; p $x;
};
ajax '/ajax/data/device/netmap' => require_login sub {
my $q = param('q');
my $qdev = schema('netdisco')->resultset('Device')

View File

@@ -1,9 +1,9 @@
<script>
// custom resize function as there is no event to fire and we need
// to react to the sidebar.
$.getJSON('[% uri_for('/ajax/data/device/netmap') %]', {q: '[% params.q %]'}, function(mapdata) {
// custom resize function as there is no event to fire and we need
// to react to the sidebar.
function resizeGraphContainer() {
setTimeout(function(){
var netmap_pane = jQuery('#netmap_pane');
@@ -39,9 +39,15 @@ $.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())
);
graph['nd2'] = {};
graph['nd2']['dragging'] = false;
graph.inspect().main.nodes.on('mouseup.dragall', function(n) {
graph['nd2']['dragging'] = false;
});