Skip to content
Snippets Groups Projects
Commit 6f953be9 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #1103 from metabase/nav_state_fix

fix issue where dashboard listing doesn't update after user login/logout.
parents cec332e0 e6e64b5b
No related branches found
No related tags found
No related merge requests found
......@@ -54,13 +54,15 @@ MetabaseControllers.controller('Nav', ['$scope', '$routeParams', '$location', '$
function($scope, $routeParams, $location, $rootScope, AppState, Dashboard) {
function refreshDashboards() {
Dashboard.list({
'filterMode': 'all'
}, function (dashes) {
$scope.dashboards = dashes;
}, function (error) {
console.log('error getting dahsboards list', error);
});
if (AppState.model.currentUser) {
Dashboard.list({
'filterMode': 'all'
}, function (dashes) {
$scope.dashboards = dashes;
}, function (error) {
console.log('error getting dahsboards list', error);
});
}
}
function setNavContext(context) {
......@@ -111,6 +113,18 @@ MetabaseControllers.controller('Nav', ['$scope', '$routeParams', '$location', '$
refreshDashboards();
});
$scope.$on("appstate:user", function(event, dashboardId) {
refreshDashboards();
});
$scope.$on("appstate:login", function(event, dashboardId) {
refreshDashboards();
});
$scope.$on("appstate:logout", function(event, dashboardId) {
$scope.dashboards = [];
});
// always initialize with a fresh listing
refreshDashboards();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment