angular.module(PKG.name + '.feature.admin')
  .controller('AdminOverviewController', function ($scope, $state, myNamespace, MyDataSource, myLocalStorage, MY_CONFIG, myStreamApi) {
    var dataSrc = new MyDataSource($scope),
        PREFKEY = 'feature.admin.overview.welcomeIsHidden';

    myLocalStorage.get(PREFKEY)
      .then(function (v) {
        $scope.welcomeIsHidden = v;
      });

    $scope.hideWelcome = function () {
      myLocalStorage.set(PREFKEY, true);
      $scope.welcomeIsHidden = true;
    };

    $scope.isEnterprise = MY_CONFIG.isEnterprise;

    // TODO: add dataset and stream counts per namespace
    myNamespace.getList()
      .then(function (list) {
        $scope.nsList = list;
        $scope.nsList.forEach(function (namespace) {
          getApps(namespace)
            .then(function (apps) {
              namespace.appsCount = apps.length;
            });
          getDatasets(namespace)
            .then(function (data) {
              namespace.datasetsCount = data.length;
            });

          getStreams(namespace);
        });
      });

    function getApps (namespace) {
      return dataSrc.request({
        _cdapPath: '/namespaces/' + namespace.name + '/apps'
      });
    }

    function getDatasets (namespace) {
      return dataSrc.request({
        _cdapPath: '/namespaces/' + namespace.name + '/data/datasets'
      });
    }

    function getStreams (namespace) {
      var params = {
        namespace: namespace.name,
        scope: $scope
      };
      myStreamApi.list(params)
        .$promise
        .then(function (streams) {
          namespace.streamsCount = streams.length;
        });
    }
  });

@@ -1056,16 +1056,125 @@
 mespace)
+%0A            .then(function (streams) %7B%0A              namespace.streamsCount = streams.length;%0A            %7D)
 ;%0A      
@@ -1622,16 +1622,23 @@
 ;%0A      
+return 
 myStream
@@ -1657,123 +1657,17 @@
 ams)
-%0A        .$promise%0A        .then(function (streams) %7B%0A          namespace.streamsCount = streams.length;%0A        %7D)
+.$promise
 ;%0A  

refactor getStream function in admin overview