climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [1/2] climate git commit: Resolve CLIMATE-407 Dataset select does not queue empty datasets.
Date Mon, 18 Jan 2016 04:17:43 GMT
Repository: climate
Updated Branches:
  refs/heads/master bb415adee -> f24ed17ad


Resolve CLIMATE-407 Dataset select does not queue empty datasets.


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/38f842f7
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/38f842f7
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/38f842f7

Branch: refs/heads/master
Commit: 38f842f7e396e6e43c617ffba5b5ad28a69144e1
Parents: 92ae043
Author: Omkar20895 <omkar@Omkars-MacBook-Pro.local>
Authored: Wed Dec 30 11:56:01 2015 +0530
Committer: Omkar20895 <omkar@Omkars-MacBook-Pro.local>
Committed: Wed Dec 30 11:56:01 2015 +0530

----------------------------------------------------------------------
 .../scripts/controllers/observationselect.js    | 59 ++++++++++++--------
 .../frontend/app/views/selectobservation.html   |  1 +
 2 files changed, 38 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/38f842f7/ocw-ui/frontend/app/scripts/controllers/observationselect.js
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend/app/scripts/controllers/observationselect.js b/ocw-ui/frontend/app/scripts/controllers/observationselect.js
index 6dfbb57..024b567 100644
--- a/ocw-ui/frontend/app/scripts/controllers/observationselect.js
+++ b/ocw-ui/frontend/app/scripts/controllers/observationselect.js
@@ -55,6 +55,9 @@ angular.module('ocwUiApp')
     // Toggle display of a confirmation when loading a dataset
     $scope.fileAdded = false;
 
+    //Toggle if the file loading failed/there was a discrepancy in loading the variables.
+    $scope.fileLoadFailed = false;
+
     $scope.latLonVals = [];
     $scope.timeVals = [];
     $scope.localSelectForm = {};
@@ -90,6 +93,7 @@ angular.module('ocwUiApp')
         // Handle success fetches!
         function(arrayOfResults) {
           $scope.loadingFile = false;
+          $scope.fileLoadFailed = false;
 
           // Handle lat/lon results
           var data = arrayOfResults[1].data;
@@ -128,6 +132,7 @@ angular.module('ocwUiApp')
         // Uh oh! AT LEAST on of our fetches failed
         function(arrayOfFailure) {
           $scope.loadingFile = false;
+          $scope.fileLoadFailed = true;
 
           $scope.params      = ['Unable to load variable(s)'];
           $scope.paramSelect = $scope.params[0];
@@ -173,29 +178,39 @@ angular.module('ocwUiApp')
         newDataset['time'] = $scope.timeSelect;
         newDataset['timeVals'] = {'start': $scope.timeVals[0], 'end': $scope.timeVals[1]};
 
-        selectedDatasetInformation.addDataset(newDataset);
-
-        // Reset all the fields!!
-        $scope.params = ['Please select a file above'];
-        $scope.paramSelect = $scope.params[0];
-        $scope.lats = ['Please select a file above'];
-        $scope.latsSelect = $scope.lats[0];
-        $scope.lons = ['Please select a file above'];
-        $scope.lonsSelect = $scope.lons[0];
-        $scope.times = ['Please select a file above'];
-        $scope.timeSelect = $scope.times[0];
-        $scope.latLonVals = [];
-        $scope.timeVals = [];
-
-        // Clear the input box
-        $('#observationFileInput').val('');
-
-        // Display a confirmation message for a little bit
-        $scope.fileAdded = true;
-        $timeout(function() {
-          $scope.fileAdded = false;
+        //Check if the file loading filaed.
+        if($scope.fileLoadFailed === 'false'){
+          selectedDatasetInformation.addDataset(newDataset);  
+          
+          // Reset all the fields!!
+          $scope.params = ['Please select a file above'];
+          $scope.paramSelect = $scope.params[0];
+          $scope.lats = ['Please select a file above'];
+          $scope.latsSelect = $scope.lats[0];
+          $scope.lons = ['Please select a file above'];
+          $scope.lonsSelect = $scope.lons[0];
+          $scope.times = ['Please select a file above'];
+          $scope.timeSelect = $scope.times[0];
+          $scope.latLonVals = [];
+          $scope.timeVals = [];
+
+          // Clear the input box
+          $('#observationFileInput').val('');
+
+          // Display a confirmation message for a little bit
+          $scope.fileAdded = true;
+          $timeout(function() {
+            $scope.fileAdded = false;
+          }, 2000);
+
+          $timeout(function(){
+            $scope.fileLoadFailed=false;
+          }, 2000);
+        } 
+        $timeout(function(){
+            $scope.fileLoadFailed=false;
         }, 2000);
-    }
+    };
 
     $scope.shouldDisableLoadButton = function() {
       return $scope.loadingFile;

http://git-wip-us.apache.org/repos/asf/climate/blob/38f842f7/ocw-ui/frontend/app/views/selectobservation.html
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend/app/views/selectobservation.html b/ocw-ui/frontend/app/views/selectobservation.html
index fd10ff8..96a8054 100644
--- a/ocw-ui/frontend/app/views/selectobservation.html
+++ b/ocw-ui/frontend/app/views/selectobservation.html
@@ -76,5 +76,6 @@ under the License.
       <button class="btn btn-primary btn-block" ng-click="addDataSet()">Add Dataset</button>
     </div>
     <div class="pull-left small-alert" ng-show="fileAdded">Successfully added dataset...</div>
+    <div class="pull-left small-alert" ng-show="fileLoadFailed">Failed loading the
Dataset. Retry...</div>
   </div>
 </div>


Mime
View raw message