浏览代码

Error message if the result is not found

Gaël Métais 10 年之前
父节点
当前提交
73f48b71a2
共有 2 个文件被更改,包括 11 次插入7 次删除
  1. 1 1
      front/src/js/controllers/dashboardCtrl.js
  2. 10 6
      front/src/views/dashboard.html

+ 1 - 1
front/src/js/controllers/dashboardCtrl.js

@@ -13,7 +13,7 @@ dashboardCtrl.controller('DashboardCtrl', ['$scope', '$rootScope', '$routeParams
                 $scope.result = result;
                 $scope.result = result;
                 init();
                 init();
             }, function(err) {
             }, function(err) {
-                alert('aie');
+                $scope.error = true;
             });
             });
         } else {
         } else {
             $scope.result = $rootScope.loadedResult;
             $scope.result = $rootScope.loadedResult;

+ 10 - 6
front/src/views/dashboard.html

@@ -1,16 +1,16 @@
 <div ng-include="'/front/views/resultSubHeader.html'"></div>
 <div ng-include="'/front/views/resultSubHeader.html'"></div>
 <div class="summary board">
 <div class="summary board">
     
     
-    <h2> Global score</h2>
     <div class="globalScore" ng-if="globalScore === 0 || globalScore > 0">
     <div class="globalScore" ng-if="globalScore === 0 || globalScore > 0">
+        <h2> Global score</h2>
         <div class="globalScoreDisplay">
         <div class="globalScoreDisplay">
             <grade score="result.scoreProfiles.generic.globalScore" class="globalGrade"></grade>
             <grade score="result.scoreProfiles.generic.globalScore" class="globalGrade"></grade>
             <div class="on100">{{globalScore}}/100</div>
             <div class="on100">{{globalScore}}/100</div>
         </div>
         </div>
     </div>
     </div>
 
 
-    <h2 ng-if="!fromSocialShare">Score details</h2>
-    <div ng-if="!fromSocialShare" class="notations">
+    <h2 ng-if="!error && !fromSocialShare">Score details</h2>
+    <div ng-if="!error && !fromSocialShare" class="notations">
         <div ng-repeat="categoryKey in categoriesOrder" ng-init="category = result.scoreProfiles.generic.categories[categoryKey]">
         <div ng-repeat="categoryKey in categoriesOrder" ng-init="category = result.scoreProfiles.generic.categories[categoryKey]">
             <grade score="category.categoryScore" class="categoryScore"></grade>
             <grade score="category.categoryScore" class="categoryScore"></grade>
             <div class="category">{{category.label}}</div>
             <div class="category">{{category.label}}</div>
@@ -38,11 +38,11 @@
         </div>
         </div>
     </div>
     </div>
 
 
-    <div class="apiTip">
+    <div ng-if="!error" class="apiTip">
         <b>Did you know? Yellow Lab Tools now has an API</b>! <a href="{{getAPIUrl()}}" target="_blank">Here</a> is the JSON output for this run. Checkout <a href="https://github.com/gmetais/YellowLabTools/wiki/Public-API" target="_blank">the API doc</a>.
         <b>Did you know? Yellow Lab Tools now has an API</b>! <a href="{{getAPIUrl()}}" target="_blank">Here</a> is the JSON output for this run. Checkout <a href="https://github.com/gmetais/YellowLabTools/wiki/Public-API" target="_blank">the API doc</a>.
     </div>
     </div>
 
 
-    <div class="tweet" ng-if="!fromSocialShare">
+    <div class="tweet" ng-if="!error && !fromSocialShare">
         <form ng-submit="sendTweet()">
         <form ng-submit="sendTweet()">
             <input type="text" class="tweetText" ng-model="tweetText">
             <input type="text" class="tweetText" ng-model="tweetText">
             <input type="submit" class="tweetButton" value="Tweet this!" ng-click="shareOnTwitter(tweetText)">
             <input type="submit" class="tweetButton" value="Tweet this!" ng-click="shareOnTwitter(tweetText)">
@@ -50,9 +50,13 @@
         </form>
         </form>
     </div>
     </div>
 
 
-    <div class="fromShare" ng-if="fromSocialShare">
+    <div class="fromShare" ng-if="!error && fromSocialShare">
         <p>Yellow Lab Tools is a free online tool that analyzes performance and front-end quality.</p>
         <p>Yellow Lab Tools is a free online tool that analyzes performance and front-end quality.</p>
         <a href="" ng-click="seeFullReport()">See the full report for this page</a>
         <a href="" ng-click="seeFullReport()">See the full report for this page</a>
         <a href="/">Test another webpage</a>
         <a href="/">Test another webpage</a>
     </div>
     </div>
+
+    <div ng-if="error">
+        <h2>Run failed / Run not found</h2>
+    </div>
 </div>
 </div>