nitweb: show parents and children in inheritance tab
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 17 Jun 2017 20:49:21 +0000 (16:49 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 15 Aug 2017 18:15:45 +0000 (14:15 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

share/nitweb/javascripts/entities.js

index 2958f58..c5deb0a 100644 (file)
                                                                        $state.go('404', null, { location: false })
                                                                });
                                                        return d.promise;
+                                               },
+                                               inh: function(Model, $q, $stateParams, $state) {
+                                                       var d = $q.defer();
+                                                       Model.loadEntityInh($stateParams.id, d.resolve,
+                                                               function() {
+                                                                       $state.go('404', null, { location: false })
+                                                               });
+                                                       return d.promise;
                                                }
                                        },
-                                       controller: function(graph, $sce) {
+                                       controller: function(inh, graph, $sce) {
                                                this.graph = $sce.trustAsHtml(graph);
+                                               this.inh = inh;
                                        },
                                        controllerAs: 'vm',
                                })
                                                .error(cbErr);
                                },
 
+                               loadEntityInh: function(id, cb, cbErr) {
+                                       $http.get('/api/inheritance/' + id)
+                                               .success(cb)
+                                               .error(cbErr);
+                               },
+
                                search: function(q, n, cb, cbErr) {
                                        $http.get('/api/search?q=' + q + '&n=' + n)
                                                .success(cb)