angular
.module('entities', ['ngSanitize', 'ui', 'model'])
- .controller('EntityCtrl', ['Model', '$routeParams', '$scope', '$sce', function(Model, $routeParams, $scope, $sce) {
+ .controller('EntityCtrl', ['Model', 'Metrics', '$routeParams', '$scope', '$sce', function(Model, Metrics, $routeParams, $scope, $sce) {
$scope.entityId = $routeParams.id;
this.loadEntityLinearization = function() {
});
};
+ this.loadStructuralMetrics = function() {
+ Metrics.loadStructuralMetrics($routeParams.id,
+ function(data) {
+ $scope.metrics = data;
+ }, function(message, status) {
+ $scope.error = {message: message, status: status};
+ });
+ };
+
Model.loadEntity($routeParams.id,
function(data) {
$scope.mentity = data;
return {
restrict: 'E',
scope: {
- mentity: '='
+ namespace: '='
},
- templateUrl: '/directives/entity/namespace.html'
+ templateUrl: '/directives/entity/namespace.html',
+ link: function ($scope, element, attrs) {
+ $scope.isObject = function(obj) {
+ return typeof obj === 'object';
+ };
+ $scope.isArray = function(obj) {
+ return Array.isArray(obj);
+ };
+ $scope.isString = function(obj) {
+ return typeof obj === 'string';
+ };
+ }
};
})
};
})
+ .directive('entityGraph', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ mentity: '=',
+ graph: '='
+ },
+ replace: true,
+ templateUrl: '/directives/entity/graph.html'
+ };
+ })
+
.directive('entityCard', function() {
return {
restrict: 'E',
scope: {
- mentity: '='
+ mentity: '=',
+ defaultTab: '@'
},
replace: true,
- templateUrl: '/directives/entity/card.html'
+ templateUrl: '/directives/entity/card.html',
+ link: function ($scope, element, attrs) {
+ $scope.currentTab = $scope.defaultTab ? $scope.defaultTab : 'signature';
+ }
};
})
templateUrl: '/directives/entity/defcard.html',
link: function ($scope, element, attrs) {
$scope.codeId = 'code_' + $scope.definition.full_name.replace(/[^a-zA-Z0-9]/g, '_');
+
+ $scope.isActive = function() {
+ return $scope.focus.full_name == $scope.definition.full_name;
+ }
+
$scope.loadCardCode = function() {
if(!$scope.code) {
Model.loadEntityCode($scope.definition.full_name,
}
}
};
+
+ if($scope.isActive()) $scope.loadCardCode();
}
};
}])