// Faraday Penetration Test IDE
// Copyright (C) 2013  Infobyte LLC (http://www.infobytesec.com/)
// See the file 'doc/LICENSE' for the license information

angular.module('faradayApp')
    .controller('topHostsCtrl',
        ['$scope', '$routeParams', 'dashboardSrv',
        function($scope, $routeParams, dashboardSrv) {

            $scope.topHosts;
            $scope.workspace;

            init = function() {
                if($routeParams.wsId != undefined) {
                    $scope.workspace = $routeParams.wsId;
                }

                dashboardSrv.getTopHosts($scope.workspace)
                    .then(function(topHosts) {
                        $scope.topHosts = topHosts;
                    });
            };

            dashboardSrv.registerCallback(init);

            init();
    }]);