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

if there is an error loading the dashboard show some kind of error rather just...

if there is an error loading the dashboard show some kind of error rather just letting the spinner go on forever.
parent e54182eb
No related merge requests found
......@@ -186,6 +186,7 @@ DashboardControllers.controller('DashDetail', ['$scope', '$routeParams', '$locat
};
$scope.dashboardLoaded = false;
$scope.dashboardLoadError = null;
if ($routeParams.dashId) {
......@@ -200,9 +201,14 @@ DashboardControllers.controller('DashDetail', ['$scope', '$routeParams', '$locat
$scope.dashboardLoaded = true;
}, function (error) {
console.log(error);
$scope.dashboardLoaded = true;
if (error.status == 404) {
$location.path('/');
} else if (error.message) {
$scope.dashboardLoadError = error.message;
} else {
$scope.dashboardLoadError = "Hmmm. We had a problem loading this dashboard for some reason :(";
}
});
}
......
<div class="Dashboard">
<div class="wrapper">
<header class="py2 px2 clearfix">
<div class="text-centered my4 py4" ng-if="!dashboardLoaded">
<div class="my4 py4 text-brand">
<mb-loading-icon></mb-loading-icon>
<h1 class="text-normal text-grey-2">Loading...</h1>
</div>
</div>
<div class="text-centered my4 py4" ng-if="dashboardLoaded && dashboardLoadError">
<div class="my4 py4 text-error">
<h1 class="text-error text-grey-2">{{dashboardLoadError}}</h1>
</div>
</div>
<header class="py2 px2 clearfix" ng-if="dashboardLoaded && !dashboardLoadError">
<div class="float-right">
<!-- <a class="Button" ng-click="toggleSubscribe()" ng-if="dashboard">{{toggleSubscribeButtonText()}}</a> -->
<div class="mx1 inline-block">
......@@ -22,14 +35,7 @@
</p>
</header>
<div class="text-centered my4 py4" ng-if="!dashboardLoaded">
<div class="my4 py4 text-brand">
<mb-loading-icon></mb-loading-icon>
<h1 class="text-normal text-grey-2">Loading...</h1>
</div>
</div>
<div class="text-centered my4 py4" ng-if="dashboardLoaded && !dashcards.length > 0">
<div class="text-centered my4 py4" ng-if="dashboardLoaded && !dashboardLoadError && !dashcards.length > 0">
<h1 class="text-normal text-grey-2 mt4 pt4">No cards have been added to this dashboard.</h1>
<a class="Button Button--primary" href="/card/create">Create Card</a>
</div>
......
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