From 19106f77c49f65ab53d2019d042455d03f5c9446 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Wed, 26 Jul 2017 15:08:16 +0200 Subject: [PATCH] implemented network map of users and travels --- app.js | 3 ++- img/asking.png | Bin 0 -> 564 bytes img/offering.png | Bin 0 -> 806 bytes img/package.png | Bin 0 -> 288 bytes index.html | 4 ++- views/main/main.html | 14 +++++----- views/network/network.html | 12 +++++++++ views/network/network.js | 53 +++++++++++++++++++++++++++++++++++++ 8 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 img/asking.png create mode 100644 img/offering.png create mode 100644 img/package.png create mode 100644 views/network/network.html create mode 100644 views/network/network.js diff --git a/app.js b/app.js index 83612e6..4731241 100644 --- a/app.js +++ b/app.js @@ -13,7 +13,8 @@ angular.module('adminApp', [ 'app.login', 'app.main', 'app.user', - 'app.travel' + 'app.travel', + 'app.network' ]). config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) { $locationProvider.hashPrefix('!'); diff --git a/img/asking.png b/img/asking.png new file mode 100644 index 0000000000000000000000000000000000000000..39c48426fabc7e87263b951d554b80a47e51b677 GIT binary patch literal 564 zcmV-40?Yl0P)C=PB#W8Ma$S`-5m$1N`7!ZM4s}N0yxHZ;JC`{O7M8beKmo*}!{g|=aCqY)Ng7j5 z8N^bRPfOL9wLYiKCcUWHTHujFb}82Js3gH@i;azK&SFZ;E;H48*RfCo+w*+UoIF9FC7_&$K00001KIqEP))dAu@+>|E@em_ zHt5@ho03HQ=#*T;+>xpLwLAFa5+&q=ZOnr^BdRKV6fG4{& zw9eStg?d!xTf}XHs!MtMJ^9usqE~f{m=_Uu&Ogasi>f}hc7%zC?EnIJQ4+z4NWWF1 zZHQ&hg*4h#uEzsGm7rZlz$+_AiOXUfo z#5akrhw%Il_R$LGT$_~tQ8T|oAC}mmu>b3rgzw)nThH+^Q(<8TNL!r#%rb1XM!Q5N zc}SxVbad0-x4bwmHHGRMt=*9nTmD4}A(T!r{uVd`anezjbpk6gPg+9WS5K(kj@G^U z2^UM4GFm4mG{+_&qg|m;n?0Rc4;X!o{6>OmT*1?8QM=OZ54vW$xnL*OKv6?@dOF%w zYp&1dOhFyA%I{^MO{%Y>RrLA$9`vZ(PFzdvH8$mNi8XToj5?p+WoSH(`@e8mO5&SJ z5R=i&5!h>0NcePpA_k#A|67U2b}K7Gfz_R kyZd>y$`|KlX(b^40>NzS5|~dP(EtDd07*qoM6N<$f?axa`Tzg` literal 0 HcmV?d00001 diff --git a/img/package.png b/img/package.png new file mode 100644 index 0000000000000000000000000000000000000000..2bb078affe91276e7507370d77bf1ecc4212568e GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^NEaj? z(VG0{|NsB>ZH^2x*lsZz7`zfF0pSBpr)m#uP|#{gJf$mjd)2hV8`2_~nwcgEWOe+h zIaV;|T3-SX>?ob{@TPyrLPufK#e9zJEBF$pCv6B>+`Kkx8c)!h6;3_POV=eH6j@X# zc5G6qq{N1$f>G&-I+5bLo!K}NI;D~t44f~VG35z8wnt;p{PWukTb8U(uJCT_bhdT5 zXSBw2wVh{{fMh9$l>{ + - + + diff --git a/views/main/main.html b/views/main/main.html index 763aafd..8ff289a 100644 --- a/views/main/main.html +++ b/views/main/main.html @@ -5,7 +5,7 @@

All users

- -
+

All travels

-
+
@@ -65,13 +63,15 @@ -
+

Actions

- Panel content +
Create user
+
Create travel
+ View network
diff --git a/views/network/network.html b/views/network/network.html new file mode 100644 index 0000000..83afe6c --- /dev/null +++ b/views/network/network.html @@ -0,0 +1,12 @@ +
+
+
+
+

Network

+
+
+
+
+
+
+
diff --git a/views/network/network.js b/views/network/network.js new file mode 100644 index 0000000..00a1756 --- /dev/null +++ b/views/network/network.js @@ -0,0 +1,53 @@ +'use strict'; + +angular.module('app.network', ['ngRoute']) + + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/network', { + templateUrl: 'views/network/network.html', + controller: 'NetworkCtrl' + }); + }]) + + .controller('NetworkCtrl', function($scope, $http, $routeParams) { + $scope.data = []; + $scope.nodes = []; + $scope.edges = []; + var nodes, edges, container; + var options = { + layout: { + improvedLayout: false + } + /*, + physics:{ + //stabilization: false, + // enabled: false + }*/ + }; + + + $scope.showMap = function() { + var nodes = $scope.nodes; + var edges = $scope.edges; + + var container = document.getElementById('mynetwork'); + var data = { + nodes: nodes, + edges: edges + }; + var network = new vis.Network(container, data, options); + }; + + $http.get(urlapi + 'admin/network') + .then(function(data, status, headers, config) { + console.log('data success'); + console.log(data); + + $scope.nodes = data.data.nodes; + $scope.edges = data.data.edges; + $scope.showMap(); + }, function(data, status, headers, config) { + console.log('data error'); + }); + + });