GUAC-586: Support data sources within home screen.

This commit is contained in:
Michael Jumper
2015-08-31 17:02:53 -07:00
parent 2ea4b609bb
commit a72cc118f4
3 changed files with 52 additions and 29 deletions

View File

@@ -27,19 +27,21 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
function homeController($scope, $injector) {
// Get required types
var ConnectionGroup = $injector.get("ConnectionGroup");
var ConnectionGroup = $injector.get('ConnectionGroup');
// Get required services
var authenticationService = $injector.get("authenticationService");
var connectionGroupService = $injector.get("connectionGroupService");
var authenticationService = $injector.get('authenticationService');
var connectionGroupService = $injector.get('connectionGroupService');
var dataSourceService = $injector.get('dataSourceService');
/**
* The root connection group, or null if the connection group hierarchy has
* not yet been loaded.
* Map of data source identifier to the root connection group of that data
* source, or null if the connection group hierarchy has not yet been
* loaded.
*
* @type ConnectionGroup
* @type Object.<String, ConnectionGroup>
*/
$scope.rootConnectionGroup = null;
$scope.rootConnectionGroups = null;
/**
* Returns whether critical data has completed being loaded.
@@ -54,10 +56,14 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
};
// Retrieve root group and all descendants
connectionGroupService.getConnectionGroupTree(ConnectionGroup.ROOT_IDENTIFIER)
.success(function rootGroupRetrieved(rootConnectionGroup) {
$scope.rootConnectionGroup = rootConnectionGroup;
// Retrieve root groups and all descendants
dataSourceService.apply(
connectionGroupService.getConnectionGroupTree,
authenticationService.getAvailableDataSources(),
ConnectionGroup.ROOT_IDENTIFIER
)
.then(function rootGroupsRetrieved(rootConnectionGroups) {
$scope.rootConnectionGroups = rootConnectionGroups;
});
}]);