falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peeyu...@apache.org
Subject [05/16] falcon git commit: FALCON-2118 Proposal for new UI changes
Date Mon, 22 Aug 2016 04:47:58 GMT
http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/instances-list.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/instances-list.js b/falcon-ui/app/js/directives/instances-list.js
index 269c7c1..a984f53 100644
--- a/falcon-ui/app/js/directives/instances-list.js
+++ b/falcon-ui/app/js/directives/instances-list.js
@@ -20,8 +20,8 @@
 
 	var entitiesListModule = angular.module('app.directives.instances-list', ['app.services'
]);
 
-  entitiesListModule.controller('InstancesListCtrl', ['$scope', 'Falcon', 'X2jsService',
'$window', 'EncodeService',
-                                      function($scope, Falcon, X2jsService, $window, encodeService)
{
+  entitiesListModule.controller('InstancesListCtrl', ['$scope', 'Falcon', 'X2jsService',
'$window', 'EncodeService', "DateHelper",
+                                      function($scope, Falcon, X2jsService, $window, encodeService,
DateHelper) {
 
     //$scope.downloadEntity = function(logURL) {
     //  Falcon.logRequest();
@@ -51,7 +51,7 @@
     };
   });
 
-  entitiesListModule.directive('instancesList', ["$timeout", 'Falcon', '$filter', function($timeout,
Falcon, $filter) {
+  entitiesListModule.directive('instancesList', ["$timeout", 'Falcon', '$filter', 'DateHelper',
function($timeout, Falcon, $filter, DateHelper) {
     return {
       scope: {
         input: "=",
@@ -70,7 +70,7 @@
       controller: 'InstancesListCtrl',
       restrict: "EA",
       templateUrl: 'html/directives/instancesListDv.html',
-      link: function (scope) {
+      link: function (scope, element) {
         scope.server = Falcon;
         scope.$watch(function () { return scope.input; }, function() {
           scope.selectedRows = [];
@@ -86,6 +86,36 @@
         scope.endSortOrder = "desc";
         scope.statusSortOrder = "desc";
 
+        var dateFormat = DateHelper.getLocaleDateFormat().toLowerCase();
+        scope.dateFormat = DateHelper.getLocaleDateFormat() + ' HH:mm';
+        var dateSeperator;
+        if(dateFormat.indexOf('.') >=0){
+          dateSeperator = '.';
+        }else if (dateFormat.indexOf('-') >=0) {
+          dateSeperator='-'
+        }else {
+          dateSeperator = '/';
+        }
+
+        var splitDate = dateFormat.split(dateSeperator);
+        var mask ='';
+        splitDate.forEach(function(value, index){
+          if(value.indexOf('d')>=0){
+            mask = mask + dateSeperator +'00'
+          }else if (value.indexOf('m')>=0) {
+            mask =  mask + dateSeperator +'00'
+          }else if (value.indexOf('y')>=0) {
+            if(value.length > 2){
+              mask =  mask + dateSeperator +'0000'
+            }else{
+              mask =  mask + dateSeperator +'00'
+            }
+          }
+        });
+        mask = mask + ' 00:00';
+        console.log(mask);
+        element.find('.dateInput').mask(mask.substr(1));
+
         scope.checkedRow = function (name) {
           var isInArray = false;
           scope.selectedRows.forEach(function(item) {
@@ -201,6 +231,16 @@
           }, 50);
         };
 
+        var CountDown = function(countParam){
+		this.count=countParam;
+		this.down=function(){
+			this.count--;
+		}
+		this.isDone=function(){
+			return this.count<1;
+		}
+        };
+
         var isSelected = function(item){
           var selected = false;
           scope.selectedRows.forEach(function(entity) {
@@ -230,107 +270,119 @@
           scope.instanceDetails(instance);
         };
 
-        var resumeInstance = function (type, name, start, end, refresh) {
+        var resumeInstance = function (type, name, start, end, countDown) {
           Falcon.logRequest();
           Falcon.postResumeInstance(type, name, start, end)
             .success(function (message) {
+              countDown.down();
               Falcon.logResponse('success', message, type);
-              if(refresh){
+              if(countDown.isDone()){
                 scope.$parent.refreshInstanceList(scope.type, scope.name, scope.start, scope.end);
               }
             })
             .error(function (err) {
+              countDown.down();
               Falcon.logResponse('error', err, type);
 
             });
         };
 
-        var suspendInstance = function (type, name, start, end, refresh) {
+        var suspendInstance = function (type, name, start, end, countDown) {
           Falcon.logRequest();
           Falcon.postSuspendInstance(type, name, start, end)
             .success(function (message) {
+              countDown.down();
               Falcon.logResponse('success', message, type);
-              if(refresh){
+              if(countDown.isDone()){
                 scope.$parent.refreshInstanceList(scope.type, scope.name, scope.start, scope.end);
               }
             })
             .error(function (err) {
+              countDown.down();
               Falcon.logResponse('error', err, type);
 
             });
         };
 
-        var reRunInstance = function (type, name, start, end, refresh) {
+        var reRunInstance = function (type, name, start, end, countDown) {
           Falcon.logRequest();
           Falcon.postReRunInstance(type, name, start, end)
             .success(function (message) {
-              Falcon.logResponse('success', message, type);
-              if(refresh){
-                scope.$parent.refreshInstanceList(scope.type, scope.name, scope.start, scope.end);
+              countDown.down();
+              if(countDown.isDone()){
+                $timeout(function () {
+                  Falcon.logResponse('success', message, type);
+                  scope.$parent.refreshInstanceList(scope.type, scope.name, scope.start,
scope.end);
+                }, 10000);
+              } else {
+                Falcon.logResponse('success', message, type);
               }
             })
             .error(function (err) {
+              countDown.down();
               Falcon.logResponse('error', err, type);
 
             });
         };
 
-        var killInstance = function (type, name, start, end, refresh) {
+        var killInstance = function (type, name, start, end, countDown) {
           Falcon.logRequest();
           Falcon.postKillInstance(type, name, start, end)
             .success(function (message) {
+              countDown.down();
               Falcon.logResponse('success', message, type);
-              if(refresh){
+              if(countDown.isDone()){
                 scope.$parent.refreshInstanceList(scope.type, scope.name, scope.start, scope.end);
               }
             })
             .error(function (err) {
+              countDown.down();
               Falcon.logResponse('error', err, type);
 
             });
         };
 
         scope.scopeResume = function () {
+          var countDown=new CountDown(scope.selectedRows.length);
           for(var i = 0; i < scope.selectedRows.length; i++) {
             var multiRequestType = scope.selectedRows[i].type.toLowerCase();
             Falcon.responses.multiRequest[multiRequestType] += 1;
             var start = scope.selectedRows[i].instance;
             var end = addOneMin(start);
-            var refresh = i === scope.selectedRows.length-1 ? true : false;
-            resumeInstance(scope.type, scope.name, start, end, refresh);
+            resumeInstance(scope.type, scope.name, start, end, countDown);
           }
         };
 
         scope.scopeSuspend = function () {
+          var countDown=new CountDown(scope.selectedRows.length);
           for(var i = 0; i < scope.selectedRows.length; i++) {
             var multiRequestType = scope.selectedRows[i].type.toLowerCase();
             Falcon.responses.multiRequest[multiRequestType] += 1;
             var start = scope.selectedRows[i].instance;
             var end = addOneMin(start);
-            var refresh = i === scope.selectedRows.length-1 ? true : false;
-            suspendInstance(scope.type, scope.name, start, end, refresh);
+            suspendInstance(scope.type, scope.name, start, end, countDown);
           }
         };
 
         scope.scopeRerun = function () {
+          var countDown=new CountDown(scope.selectedRows.length);
           for(var i = 0; i < scope.selectedRows.length; i++) {
             var multiRequestType = scope.selectedRows[i].type.toLowerCase();
             Falcon.responses.multiRequest[multiRequestType] += 1;
             var start = scope.selectedRows[i].instance;
             var end = addOneMin(start);
-            var refresh = i === scope.selectedRows.length-1 ? true : false;
-            reRunInstance(scope.type, scope.name, start, end, refresh);
+            reRunInstance(scope.type, scope.name, start, end, countDown);
           }
         };
 
         scope.scopeKill = function () {
+          var countDown=new CountDown(scope.selectedRows.length);
           for(var i = 0; i < scope.selectedRows.length; i++) {
             var multiRequestType = scope.selectedRows[i].type.toLowerCase();
             Falcon.responses.multiRequest[multiRequestType] += 1;
             var start = scope.selectedRows[i].instance;
             var end = addOneMin(start);
-            var refresh = i === scope.selectedRows.length-1 ? true : false;
-            killInstance(scope.type, scope.name, start, end, refresh);
+            killInstance(scope.type, scope.name, start, end, countDown);
           }
         };
 
@@ -355,319 +407,135 @@
           scope.changePagesSet(offset, page, visiblePages-1, scope.start, scope.end);
         };
 
+        scope.startDateValid = true;
+        scope.endDateValid = true;
+
         scope.validateDate = function(event, type){
           var which = event.which || event.keyCode;
           var charStr = String.fromCharCode(which);
-          event.preventDefault();
-          if (
-            which == 8 || which == 46 || which == 37 || which == 39 ||
-            (which >= 48 && which <= 57)
-          ) {
-            if(type == "start"){
-              if(scope.startFilter){
-                if(scope.startFilter.length == 1){
-                  //mm
-                  var prevChar = scope.startFilter.substring(scope.startFilter.length-1);
-                  prevChar = parseInt(prevChar);
-                  if(prevChar < 1){
-                    if(prevChar == 0 && charStr == 0){
-
-                    }else if(charStr <= 9){
-                      scope.startFilter += charStr + "/";
-                    }
-                  }else{
-                    if(charStr <= 2){
-                      scope.startFilter += charStr + "/";
-                    }
-                  }
-                }else if(scope.startFilter.length == 2){
-                  //mm/
-                  if(charStr <= 3){
-                    scope.startFilter += "/" + charStr;
-                  }
-                }else if(scope.startFilter.length == 3){
-                  //mm/d
-                  if(charStr <= 3){
-                    scope.startFilter += charStr;
-                  }
-                }else if(scope.startFilter.length == 4){
-                  //mm/dd
-                  var prevChar = scope.startFilter.substring(scope.startFilter.length-1);
-                  prevChar = parseInt(prevChar);
-                  if(prevChar < 3){
-                    if(prevChar == 0 && charStr == 0){
-
-                    }else if(charStr <= 9){
-                      scope.startFilter += charStr + "/";
-                    }
-                  }else{
-                    if(charStr <= 1){
-                      scope.startFilter += charStr + "/";
-                    }
-                  }
-                }else if(scope.startFilter.length == 5){
-                  //mm/dd/
-                  if(charStr <= 2){
-                    scope.startFilter += "/" + charStr;
-                  }
-                }else if(scope.startFilter.length == 6){
-                  //mm/dd/y
-                  if(charStr <= 2){
-                    scope.startFilter += charStr;
-                  }
-                }else if(scope.startFilter.length == 7){
-                  //mm/dd/yy
-                  if(charStr <= 9){
-                    scope.startFilter += charStr;
-                  }
-                }else if(scope.startFilter.length == 8){
-                  //mm/dd/yyy
-                  if(charStr <= 9){
-                    scope.startFilter += charStr;
-                  }
-                }else if(scope.startFilter.length == 9){
-                  //mm/dd/yyyy
-                  if(charStr <= 9){
-                    scope.startFilter += charStr + " ";
-                  }
-                }else if(scope.startFilter.length == 10){
-                  //mm/dd/yyyy
-                  if(charStr <= 2){
-                    scope.startFilter += " " + charStr;
-                  }
-                }else if(scope.startFilter.length == 11){
-                  //mm/dd/yyyy h
-                  if(charStr <= 2){
-                    scope.startFilter += charStr;
-                  }
-                }else if(scope.startFilter.length == 12){
-                  //mm/dd/yyyy hh
-                  var prevChar = scope.startFilter.substring(scope.startFilter.length-1);
-                  prevChar = parseInt(prevChar);
-                  if(prevChar < 2){
-                    if(charStr <= 9){
-                      scope.startFilter += charStr + ":";
-                    }
-                  }else{
-                    if(charStr <= 4){
-                      scope.startFilter += charStr + ":";
-                    }
-                  }
-                }else if(scope.startFilter.length == 13){
-                  //mm/dd/yyyy hh:
-                  if(charStr <= 5){
-                    scope.startFilter += ":" + charStr;
-                  }
-                }else if(scope.startFilter.length == 14){
-                  //mm/dd/yyyy hh:m
-                  if(charStr <= 5){
-                    scope.startFilter += charStr;
-                  }
-                }else if(scope.startFilter.length == 15){
-                  //mm/dd/yyyy hh:mm
-                  if(charStr <= 9){
-                    scope.startFilter += charStr;
-                    scope.startFilterError = false;
-                  }
-                }
-              }else{
-                //m
-                if(charStr <= 1){
-                  scope.startFilter = charStr;
-                }
-              }
-            }else{
-              if(scope.endFilter){
-                if(scope.endFilter.length == 1){
-                  //mm
-                  var prevChar = scope.endFilter.substring(scope.endFilter.length-1);
-                  prevChar = parseInt(prevChar);
-                  if(prevChar < 1){
-                    if(prevChar == 0 && charStr == 0){
-
-                    }else if(charStr <= 9){
-                      scope.endFilter += charStr + "/";
-                    }
-                  }else{
-                    if(charStr <= 2){
-                      scope.endFilter += charStr + "/";
-                    }
-                  }
-                }else if(scope.endFilter.length == 2){
-                  //mm/
-                  if(charStr <= 3){
-                    scope.endFilter += "/" + charStr;
-                  }
-                }else if(scope.endFilter.length == 3){
-                  //mm/d
-                  if(charStr <= 3){
-                    scope.endFilter += charStr;
-                  }
-                }else if(scope.endFilter.length == 4){
-                  //mm/dd
-                  var prevChar = scope.endFilter.substring(scope.endFilter.length-1);
-                  prevChar = parseInt(prevChar);
-                  if(prevChar < 3){
-                    if(prevChar == 0 && charStr == 0){
-
-                    }else if(charStr <= 9){
-                      scope.endFilter += charStr + "/";
-                    }
-                  }else{
-                    if(charStr <= 1){
-                      scope.endFilter += charStr + "/";
-                    }
-                  }
-                }else if(scope.endFilter.length == 5){
-                  //mm/dd/
-                  if(charStr <= 2){
-                    scope.endFilter += "/" + charStr;
-                  }
-                }else if(scope.endFilter.length == 6){
-                  //mm/dd/y
-                  if(charStr <= 2){
-                    scope.endFilter += charStr;
-                  }
-                }else if(scope.endFilter.length == 7){
-                  //mm/dd/yy
-                  if(charStr <= 9){
-                    scope.endFilter += charStr;
-                  }
-                }else if(scope.endFilter.length == 8){
-                  //mm/dd/yyy
-                  if(charStr <= 9){
-                    scope.endFilter += charStr;
-                  }
-                }else if(scope.endFilter.length == 9){
-                  //mm/dd/yyyy
-                  if(charStr <= 9){
-                    scope.endFilter += charStr + " ";
-                  }
-                }else if(scope.endFilter.length == 10){
-                  //mm/dd/yyyy
-                  if(charStr <= 2){
-                    scope.endFilter += " " + charStr;
-                  }
-                }else if(scope.endFilter.length == 11){
-                  //mm/dd/yyyy h
-                  if(charStr <= 2){
-                    scope.endFilter += charStr;
-                  }
-                }else if(scope.endFilter.length == 12){
-                  //mm/dd/yyyy hh
-                  var prevChar = scope.endFilter.substring(scope.endFilter.length-1);
-                  prevChar = parseInt(prevChar);
-                  if(prevChar < 2){
-                    if(charStr <= 9){
-                      scope.endFilter += charStr + ":";
-                    }
-                  }else{
-                    if(charStr <= 4){
-                      scope.endFilter += charStr + ":";
-                    }
-                  }
-                }else if(scope.endFilter.length == 13){
-                  //mm/dd/yyyy hh:
-                  if(charStr <= 5){
-                    scope.endFilter += ":" + charStr;
-                  }
-                }else if(scope.endFilter.length == 14){
-                  //mm/dd/yyyy hh:m
-                  if(charStr <= 5){
-                    scope.endFilter += charStr;
-                  }
-                }else if(scope.endFilter.length == 15){
-                  //mm/dd/yyyy hh:mm
-                  if(charStr <= 9){
-                    scope.endFilter += charStr;
-                    scope.endFilterError = false;
-                  }
-                }
-              }else{
-                //m
-                if(charStr <= 1){
-                  scope.endFilter = charStr;
-                }
-              }
+          var valueEntered = event.target.value + charStr;
+          var dateSeperator;
+          if(dateFormat.indexOf('.') >=0){
+            dateSeperator = '.';
+          }else if (dateFormat.indexOf('-') >=0) {
+            dateSeperator='-'
+          }else {
+            dateSeperator = '/';
+          }
+
+          var splitDateFormat = dateFormat.split(dateSeperator);
+          var dateArr = [];
+
+          var completeDate = valueEntered.split(" ");
+          var dates = completeDate[0].split(dateSeperator);
+          var timeArr = [];
+          if(completeDate[1]){
+            completeDate[1].split(":")
+          }
+          splitDateFormat.forEach(function(value, index){
+            if(value.indexOf('d')>=0){
+              dateArr[0] = dates[index];
+            }else if (value.indexOf('m')>=0) {
+              dateArr[1] = dates[index];
+            }else if (value.indexOf('y')>=0) {
+              dateArr[2] = dates[index];
             }
+          });
+          var dateValid = checkDateTimeValidity(dateArr, timeArr);
+          if(type === 'start'){
+            scope.startDateValid = dateValid;
+          }else if(type === 'end'){
+            scope.endDateValid = dateValid;
           }
         };
 
+        var checkDateTimeValidity = function(dateArr, timeArr){
+          var dateValid = false;
+         if(dateArr[2]){
+           if(parseInt(dateArr[2]) > 0 && parseInt(dateArr[2]) <= 9999){
+             dateValid = true;
+           }else {
+             return false;
+           }
+         }
+         if(dateArr[1]){
+           if(parseInt(dateArr[1]) > 0 && parseInt(dateArr[1]) <= 12){
+             dateValid = true;
+           }else {
+             return false;
+           }
+         }
+         if(dateArr[0]) {
+           if(parseInt(dateArr[0]) > 0 && parseInt(dateArr[0]) <= daysInMonth(dateArr[1],
dateArr[2])){
+             dateValid = true;
+           }else {
+             return false;
+           }
+         }
+         if(timeArr[0]){
+           if(parseInt(timeArr[0]) >= 0 && parseInt(timeArr[0]) < 24){
+             dateValid = true;
+           }else {
+             return false;
+           }
+         }
+         if(timeArr[1]){
+           if(parseInt(timeArr[1]) >= 0 && parseInt(timeArr[1] < 60)){
+             dateValid = true;
+           }else {
+             return false;
+           }
+         }
+         return dateValid;
+        }
+
         var changeDateFormat = function(date){
+
+          var dateSeperator;
+          if(dateFormat.indexOf('.') >=0){
+            dateSeperator = '.';
+          }else if (dateFormat.indexOf('-') >=0) {
+            dateSeperator='-'
+          }else {
+            dateSeperator = '/';
+          }
+
+          var splitDateFormat = dateFormat.split(dateSeperator);
+          var dateArr = [];
+
           var completeDate = date.split(" ");
-          var dates = completeDate[0].split("/");
-          date = dates[2] + "-" + dates[0] + "-" + dates[1] + "T" + completeDate[1] + "Z";
+          var dates = completeDate[0].split(dateSeperator);
+
+          splitDateFormat.forEach(function(value, index){
+            if(value.indexOf('d')>=0){
+              dateArr[0] = dates[index];
+            }else if (value.indexOf('m')>=0) {
+              dateArr[1] = dates[index];
+            }else if (value.indexOf('y')>=0) {
+              dateArr[2] = dates[index];
+            }
+          });
+
+          date = dateArr[2] + "-" + dateArr[1] + "-" + dateArr[0] + "T" + completeDate[1]
+ "Z";
           return date;
         };
 
         var validateDateFormat = function(date){
-          var char = date.substring(0, 1);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(1, 2);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(2, 3);
-          if(char != "/"){
-            return false;
-          }
-          char = date.substring(3, 4);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(4, 5);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(5, 6);
-          if(char != "/"){
-            return false;
-          }
-          char = date.substring(6, 7);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(7, 8);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(8, 9);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(9, 10);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(10, 11);
-          if(char != " "){
-            return false;
-          }
-          char = date.substring(11, 12);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(12, 13);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(13, 14);
-          if(char != ":"){
-            return false;
-          }
-          char = date.substring(14, 15);
-          if(isNaN(char)){
-            return false;
-          }
-          char = date.substring(15, 16);
-          if(isNaN(char)){
-            return false;
-          }
-          return true;
+          var date = new Date(changeDateFormat(date));
+          return !isNaN(date.getTime());
         };
 
+        function daysInMonth(month, year) {
+          switch (month) {
+            case 2 :
+              return (year % 4 == 0 && year % 100) || year % 400 == 0 ? 29 : 28;
+            case 9 : case 4 : case 6 : case 11 :
+              return 30;
+            default :
+              return 31
+    }
+}
+
         scope.filterInstances = function(orderBy){
           var start;
           var end;
@@ -686,9 +554,11 @@
               if(!validateDateFormat(scope.startFilter)){
                 executeFilter = false;
                 scope.startFilterError = true;
+                scope.startDateValid = false;
               }else if(!validateDateFormat(scope.endFilter)){
                 executeFilter = false;
                 scope.endFilterError = true;
+                scope.endDateValid = false;
               }else{
                 start = changeDateFormat(scope.startFilter);
                 var filterStartDate = new Date(start);

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/interface-endpoint.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/interface-endpoint.js b/falcon-ui/app/js/directives/interface-endpoint.js
new file mode 100644
index 0000000..1e3cef9
--- /dev/null
+++ b/falcon-ui/app/js/directives/interface-endpoint.js
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function () {
+  'use strict';
+
+  var interfaceEndpointModule = angular.module('app.directives.interface-endpoint', []);
+
+  interfaceEndpointModule.directive('interfaceEndpoint', [ "$timeout", function ($timeout)
{
+    return {
+      require: 'ngModel',
+
+      link: function($scope, $element, $attrs, ngModelCtrl) {
+        function applyDefaultStyle() {
+          $element.removeClass('endpointChanged');
+          $element.addClass('endpointDefault');
+        }
+
+        function applyModifiedStyle() {
+          $element.removeClass('endpointDefault');
+          $element.addClass('endpointChanged');
+        }
+
+        $scope.$watch(function(){
+          return $scope.clusterForm.$submitted;
+        },function(){
+          if(!$element.attr('disabled') && ngModelCtrl.$pristine){
+            $element.parent().find('.validationMessageGral').show();
+            ngModelCtrl.$setValidity('pattern', false);
+          }else if(ngModelCtrl.$dirty && ngModelCtrl.$error.pattern && !$element.attr('disabled')){
+            $element.parent().find('.validationMessageGral').show();
+            ngModelCtrl.$setValidity('pattern', false);
+          }else if($element.attr('disabled')){
+            $element.parent().find('.validationMessageGral').hide();
+            ngModelCtrl.$setValidity('pattern', true);
+          }
+        });
+
+        $scope.$watch(function(){
+          if(!$scope.clusterForm.$submitted && ngModelCtrl.$pristine){
+            $element.parent().find('.validationMessageGral').hide();
+            ngModelCtrl.$setValidity('pattern', true);
+          }else if(ngModelCtrl.$dirty && ngModelCtrl.$error.pattern){
+            $element.parent().find('.validationMessageGral').show();
+            ngModelCtrl.$setValidity('pattern', false);
+          }
+          return $element[0].value;
+        },function(newValue, oldValue){
+          if(newValue){
+            if(newValue === oldValue && newValue.indexOf('<hostname>') >=
0){
+              applyDefaultStyle();
+            }else{
+              applyModifiedStyle();
+            }
+          }
+        });
+
+        $element.focus(function(){
+          applyModifiedStyle();
+        });
+
+        $element.bind('blur',function(){
+          if(ngModelCtrl.$pristine && $element[0].value.indexOf('<hostname>')
>= 0){
+            applyDefaultStyle();
+          }
+        });
+      }
+    }
+  }]);
+
+}());

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/lineage-graph.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/lineage-graph.js b/falcon-ui/app/js/directives/lineage-graph.js
index 883d2a7..aeb014d 100644
--- a/falcon-ui/app/js/directives/lineage-graph.js
+++ b/falcon-ui/app/js/directives/lineage-graph.js
@@ -240,7 +240,7 @@
                 .attr('markerWidth', 8)
                 .attr('markerHeight', 5)
                 .attr('orient', 'auto')
-                .attr('style', 'fill: #ccc')
+                //.attr('style', 'fill: #ccc')
                 .append('svg:path')
                 .attr('d', 'M 0 0 L 10 5 L 0 10 z');
           }
@@ -248,7 +248,7 @@
           var bb = layout.graph();
           $('#lineage-graph').attr('width', bb.width);
           //$('#lineage-graph').attr('width', '100%');
-          $('#lineage-graph').attr('height', bb.height);
+         //$('#lineage-graph').attr('height', bb.height);
           post_render();
         }
 

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/ng-tags-input.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/ng-tags-input.js b/falcon-ui/app/js/directives/ng-tags-input.js
index 1039011..aa0d4d5 100644
--- a/falcon-ui/app/js/directives/ng-tags-input.js
+++ b/falcon-ui/app/js/directives/ng-tags-input.js
@@ -859,7 +859,7 @@
             span.css('display', 'none');
           }
 
-          element.css('width', width ? width + threshold + 'px' : '');
+          //element.css('width', width ? width + threshold + 'px' : '');
 
           return originalValue;
         };
@@ -1145,4 +1145,4 @@
     );
   }]);
 
-}());
\ No newline at end of file
+}());

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/server-messages.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/server-messages.js b/falcon-ui/app/js/directives/server-messages.js
index 6bd6ea9..475f279 100644
--- a/falcon-ui/app/js/directives/server-messages.js
+++ b/falcon-ui/app/js/directives/server-messages.js
@@ -19,18 +19,53 @@
   'use strict';
 
 	var serverMessagesModule = angular.module('app.directives.server-messages', []);
-	
-	serverMessagesModule.directive('serverMessages', function () {
+
+	serverMessagesModule.directive('serverMessages', ["$rootScope", "$timeout","Falcon", function
($rootScope, $timeout, Falcon) {
 		return {
 			replace:false,
 			restrict: 'E',
 			templateUrl: 'html/directives/serverMessagesDv.html',
       link: function (scope, element) {
-
+        scope.close = function(){
+          Falcon.hideNotifs();
+        };
         //scope.allMessages
+        var hideoutTimer;
+        var notifyPanel = element.find(".notifs");
+        $rootScope.$on('hideNotifications', function(event, setting) {
+          scope.showClose = false;
+          $timeout.cancel(hideoutTimer);
+          if (setting && setting.delay) {
+            hideoutTimer = $timeout(function () {
+              notifyPanel.fadeOut(300);
+            }, setting.delay==='slow'?5000:0);
+          } else {
+            notifyPanel.stop();
+            notifyPanel.fadeOut(300);
+          }
+        });
+
+        $rootScope.$on('flashNotifications', function() {
+          $timeout.cancel(hideoutTimer);
+          notifyPanel.stop();
+          notifyPanel.hide();
+          notifyPanel.fadeIn(300);
+          notifyPanel.fadeOut(300);
+          notifyPanel.fadeIn(300);
+          notifyPanel.fadeOut(300);
+          notifyPanel.fadeIn(300);
+        });
+
+        $rootScope.$on('showNotifications', function() {
+          scope.showClose = true;
+          $timeout.cancel(hideoutTimer);
+          notifyPanel.stop();
+          notifyPanel.hide();
+          notifyPanel.fadeIn(300);
+        });
 
       }
 		};
-	});
-	  
+	}]);
+
 })();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/tooltip.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/tooltip.js b/falcon-ui/app/js/directives/tooltip.js
index 31bb684..4951123 100644
--- a/falcon-ui/app/js/directives/tooltip.js
+++ b/falcon-ui/app/js/directives/tooltip.js
@@ -34,4 +34,26 @@
     };
   });
 
-})();
\ No newline at end of file
+  module.directive("tooltip", ['TooltipMessages', function(TooltipMessages){
+    return {
+      restrict: "A",
+      link: function(scope, element, attrs) {
+        var message = TooltipMessages.messages[attrs.tooltip];
+        if (!message) {
+          console.warn('Message not defined for key ' + attrs.tooltip);
+          return;
+        }
+        var tooltipElement = angular.element("<div class='entities-tooltip-theme'>");
+        tooltipElement.append("<div class='arrow-up'></div>");
+        tooltipElement.append("<div class='entities-tooltip'>" + message + "</div>");
+        element.append(tooltipElement);
+        element.on('mouseenter', function(){
+             tooltipElement.show();
+           }).on('mouseleave', function(){
+             tooltipElement.hide();
+           });
+      }
+    };
+  }]);
+
+})();

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/directives/validation-message.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/directives/validation-message.js b/falcon-ui/app/js/directives/validation-message.js
index 7530244..7eab75e 100644
--- a/falcon-ui/app/js/directives/validation-message.js
+++ b/falcon-ui/app/js/directives/validation-message.js
@@ -34,8 +34,9 @@
       scope: {
         validationMessage: "@"
       },
+      require : '^form',
       restrict: 'A',
-      link: function (scope, element) {
+      link: function (scope, element, attrs, formCtrl) {
 
         var lastOne = 0,
           stringLabel,
@@ -89,21 +90,28 @@
 
           if (element[0].type === "select-one") {
             element.bind('change', function () {
-              scope.messageSwitcher.show = false;
-              angular.element(stringLabel).hide();
+                  scope.messageSwitcher.show = false;
+                  angular.element(stringLabel).hide();
             });
           } else {
             element.bind('keyup', checkNameInList);
             element.bind('blur', function () {
-              if (element[0].value.length === 0) {
-                element.parent().addClass("showMessage showValidationStyle validationMessageParent");
-                scope.messageSwitcher.show = true;
-                angular.element(stringLabel).html(messageObject.empty).removeClass('valid');
-              }
+                if (element[0].value.length === 0) {
+                  element.parent().addClass("showMessage showValidationStyle validationMessageParent");
+                  scope.messageSwitcher.show = true;
+                  angular.element(stringLabel).html(messageObject.empty).removeClass('valid');
+                }else if (element.hasClass('ng-invalid-pattern')) {
+                  scope.messageSwitcher.show = true;
+                  angular.element(stringLabel).html(messageObject.patternInvalid).removeClass('valid');
+                  element.removeClass('empty');
+                  element.parent().addClass("showMessage showValidationStyle validationMessageParent");
+                }
             });
             element.bind('focus', function () {
               element.removeClass('empty');
             });
+
+
           }
         }
         function normalize() {
@@ -137,6 +145,17 @@
             element.addClass('empty');
           }
         });
+
+        scope.$watch(function () {
+          return formCtrl.$submitted;
+        }, function () {
+          if (formCtrl.$submitted === true && element.hasClass('ng-invalid-pattern'))
{
+            scope.messageSwitcher.show = true;
+            angular.element(stringLabel).html(messageObject.patternInvalid).removeClass('valid');
+            element.removeClass('empty');
+            element.parent().addClass("showMessage showValidationStyle validationMessageParent");
+          }
+        });
       }
     };
   }]);
@@ -208,10 +227,10 @@
 
           element.bind('keyup', prepare);
           element.bind('blur', function () {
-            if (valLength === 0 && required) {
-              element.removeClass('empty');
-              angular.element(stringLabel).html(messageObject.empty).removeClass('hidden');
-              element.parent().addClass("showMessage showValidationStyle validationMessageParent");
+              if (valLength === 0 && required) {
+                element.removeClass('empty');
+                angular.element(stringLabel).html(messageObject.empty).removeClass('hidden');
+                element.parent().addClass("showMessage showValidationStyle validationMessageParent");
             }
           });
         }
@@ -246,4 +265,4 @@
     };
   }]);
 
-}());
\ No newline at end of file
+}());

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/lib/angular-ngStorage.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/lib/angular-ngStorage.js b/falcon-ui/app/js/lib/angular-ngStorage.js
new file mode 100644
index 0000000..ee45bb2
--- /dev/null
+++ b/falcon-ui/app/js/lib/angular-ngStorage.js
@@ -0,0 +1,161 @@
+(function (root, factory) {
+  'use strict';
+
+  if (typeof define === 'function' && define.amd) {
+    define(['angular'], factory);
+  } else if (typeof exports === 'object') {
+    module.exports = factory(require('angular'));
+  } else {
+    // Browser globals (root is window), we don't register it.
+    factory(root.angular);
+  }
+}(this , function (angular) {
+    'use strict';
+
+    /**
+     * @ngdoc overview
+     * @name ngStorage
+     */
+
+    return angular.module('ngStorage', [])
+
+    /**
+     * @ngdoc object
+     * @name ngStorage.$localStorage
+     * @requires $rootScope
+     * @requires $window
+     */
+
+    .factory('$localStorage', _storageFactory('localStorage'))
+
+    /**
+     * @ngdoc object
+     * @name ngStorage.$sessionStorage
+     * @requires $rootScope
+     * @requires $window
+     */
+
+    .factory('$sessionStorage', _storageFactory('sessionStorage'));
+
+    function _storageFactory(storageType) {
+        return [
+            '$rootScope',
+            '$window',
+            '$log',
+            '$timeout',
+
+            function(
+                $rootScope,
+                $window,
+                $log,
+                $timeout
+            ){
+                function isStorageSupported(storageType) {
+
+                    // Some installations of IE, for an unknown reason, throw "SCRIPT5: Error:
Access is denied"
+                    // when accessing window.localStorage. This happens before you try to
do anything with it. Catch
+                    // that error and allow execution to continue.
+
+                    // fix 'SecurityError: DOM Exception 18' exception in Desktop Safari,
Mobile Safari
+                    // when "Block cookies": "Always block" is turned on
+                    var supported;
+                    try {
+                        supported = $window[storageType];
+                    }
+                    catch (err) {
+                        supported = false;
+                    }
+
+                    // When Safari (OS X or iOS) is in private browsing mode, it appears
as though localStorage
+                    // is available, but trying to call .setItem throws an exception below:
+                    // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add
something to storage that exceeded the quota."
+                    if (supported && storageType === 'localStorage') {
+                        var key = '__' + Math.round(Math.random() * 1e7);
+
+                        try {
+                            localStorage.setItem(key, key);
+                            localStorage.removeItem(key);
+                        }
+                        catch (err) {
+                            supported = false;
+                        }
+                    }
+
+                    return supported;
+                }
+
+                // #9: Assign a placeholder object if Web Storage is unavailable to prevent
breaking the entire AngularJS app
+                var webStorage = isStorageSupported(storageType) || ($log.warn('This browser
does not support Web Storage!'), {setItem: function() {}, getItem: function() {}}),
+                    $storage = {
+                        $default: function(items) {
+                            for (var k in items) {
+                                angular.isDefined($storage[k]) || ($storage[k] = items[k]);
+                            }
+
+                            return $storage;
+                        },
+                        $reset: function(items) {
+                            for (var k in $storage) {
+                                '$' === k[0] || (delete $storage[k] && webStorage.removeItem('ngStorage-'
+ k));
+                            }
+
+                            return $storage.$default(items);
+                        }
+                    },
+                    _last$storage,
+                    _debounce;
+
+                try {
+                    webStorage = $window[storageType];
+                    webStorage.length;
+                } catch(e) {
+                    $log.warn('This browser does not support Web Storage!');
+                    webStorage = {};
+                }
+
+                for (var i = 0, l = webStorage.length, k; i < l; i++) {
+                    // #8, #10: `webStorage.key(i)` may be an empty string (or throw an exception
in IE9 if `webStorage` is empty)
+                    (k = webStorage.key(i)) && 'ngStorage-' === k.slice(0, 10) &&
($storage[k.slice(10)] = angular.fromJson(webStorage.getItem(k)));
+                }
+
+                _last$storage = angular.copy($storage);
+
+                $rootScope.$watch(function() {
+                    var temp$storage;
+                    _debounce || (_debounce = $timeout(function() {
+                        _debounce = null;
+
+                        if (!angular.equals($storage, _last$storage)) {
+                            temp$storage = angular.copy(_last$storage);
+                            angular.forEach($storage, function(v, k) {
+                                angular.isDefined(v) && '$' !== k[0] && webStorage.setItem('ngStorage-'
+ k, angular.toJson(v));
+
+                                delete temp$storage[k];
+                            });
+
+                            for (var k in temp$storage) {
+                                webStorage.removeItem('ngStorage-' + k);
+                            }
+
+                            _last$storage = angular.copy($storage);
+                        }
+                    }, 100, false));
+                });
+
+                // #6: Use `$window.addEventListener` instead of `angular.element` to avoid
the jQuery-specific `event.originalEvent`
+                $window.addEventListener && $window.addEventListener('storage', function(event)
{
+                    if ('ngStorage-' === event.key.slice(0, 10)) {
+                        event.newValue ? $storage[event.key.slice(10)] = angular.fromJson(event.newValue)
: delete $storage[event.key.slice(10)];
+
+                        _last$storage = angular.copy($storage);
+
+                        $rootScope.$apply();
+                    }
+                });
+
+                return $storage;
+            }
+        ];
+    }
+
+}));

http://git-wip-us.apache.org/repos/asf/falcon/blob/76dc2e18/falcon-ui/app/js/lib/focusIf.min.js
----------------------------------------------------------------------
diff --git a/falcon-ui/app/js/lib/focusIf.min.js b/falcon-ui/app/js/lib/focusIf.min.js
new file mode 100644
index 0000000..b8206ac
--- /dev/null
+++ b/falcon-ui/app/js/lib/focusIf.min.js
@@ -0,0 +1 @@
+!function(){"use strict";function c(c){function u(u,f,t){function n(f){f&&c(function(){i.focus()},u.$eval(t.focusDelay)||0)}var
i=f[0];t.focusIf?u.$watch(t.focusIf,n):n(!0)}return{restrict:"A",link:u}}angular.module("focus-if",[]).directive("focusIf",c),c.$inject=["$timeout"]}();
\ No newline at end of file


Mime
View raw message