basic positions upload
This commit is contained in:
@@ -14,6 +14,12 @@ ajax '/ajax/content/device/netmap' => require_login sub {
|
|||||||
template 'ajax/device/netmap.tt', {}, { layout => undef };
|
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 {
|
ajax '/ajax/data/device/netmap' => require_login sub {
|
||||||
my $q = param('q');
|
my $q = param('q');
|
||||||
my $qdev = schema('netdisco')->resultset('Device')
|
my $qdev = schema('netdisco')->resultset('Device')
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script>
|
<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) {
|
$.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() {
|
function resizeGraphContainer() {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
var netmap_pane = jQuery('#netmap_pane');
|
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.force.on('end.setupfornetdisco', function() {
|
||||||
graph.inspect().main.nodes.each(function(n) { n.fixed = true });
|
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'] = {};
|
||||||
graph['nd2']['dragging'] = false;
|
graph['nd2']['dragging'] = false;
|
||||||
|
|
||||||
graph.inspect().main.nodes.on('mouseup.dragall', function(n) {
|
graph.inspect().main.nodes.on('mouseup.dragall', function(n) {
|
||||||
graph['nd2']['dragging'] = false;
|
graph['nd2']['dragging'] = false;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user