Add enter to search 49/52849/1
authorthuva4 <tharma.thuva@gmail.com>
Wed, 28 Feb 2018 16:26:23 +0000 (21:56 +0530)
committerthuva4 <tharma.thuva@gmail.com>
Wed, 28 Feb 2018 16:26:23 +0000 (21:56 +0530)
Add directive to filter the list by enter

JIRA: RELENG-351

Change-Id: I1abc92cdf2cb103e1ba9b685437b65035c88dd5d
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
testapi/opnfv_testapi/ui/app.js
testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
testapi/opnfv_testapi/ui/components/pods/pods.html
testapi/opnfv_testapi/ui/components/projects/projects.html
testapi/opnfv_testapi/ui/components/results/results.html

index ae50166..def88d2 100644 (file)
             };
         }]);
 
+    angular
+        .module('testapiApp')
+        .directive('ngEnter', function () {
+            return function (scope, element, attrs) {
+                element.bind("keydown keypress", function (event) {
+                    if(event.which === 13) {
+                        scope.$apply(function (){
+                            scope.$eval(attrs.ngEnter);
+                        });
+                        event.preventDefault();
+                    }
+                });
+            };
+        });
+
     configureRoutes.$inject = ['$stateProvider', '$urlRouterProvider'];
 
     /**
index 6fbaaea..380416f 100644 (file)
@@ -15,7 +15,7 @@
         <div class="col-sm-2 pull-right" ng-class="{'hidden': ctrl.filter=='start_date' || ctrl.filter=='end_date'}">
             <span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
             <input list="filter" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;"
-                ng-Model="ctrl.filterText" placeholder="Search String">
+            ng-enter="ctrl.filterList()" ng-Model="ctrl.filterText" placeholder="Search String">
                 <datalist id="filter" ng-class="{ 'hidden' : ctrl.filterOption.length<0}">
                     <option ng-repeat="(index, filterValue) in ctrl.filterOption " value="{{filterValue}}">{{filterValue}}</option>
                 </datalist>
@@ -24,6 +24,7 @@
             <span style="margin-top:6px">Start&nbsp;Date:&nbsp;&nbsp;</span>
             <p class="input-group" style="width:48%;display:inline-flex;">
                 <input type="text" class="form-control"
+                    ng-enter="ctrl.filterList()"
                     uib-datepicker-popup="{{ctrl.format}}"
                     ng-model="ctrl.filterText" is-open="ctrl.startOpen"
                     close-text="Close" />
@@ -38,6 +39,7 @@
             <span style="margin-top:6px">End&nbsp;Date:&nbsp;&nbsp;</span>
             <p class="input-group" style="width:48%;display:inline-flex;">
                 <input type="text" class="form-control"
+                    ng-enter="ctrl.filterList()"
                     uib-datepicker-popup="{{ctrl.format}}"
                     ng-model="ctrl.filterText" is-open="ctrl.endOpen"
                     close-text="Close" />
index 7873977..8e66a9c 100644 (file)
@@ -22,7 +22,7 @@
         </div>
         <div class="col-sm-3 pull-right">
             <span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
-            <input type="text" class="form-control search" ng-Model="ctrl.filterText" placeholder="Search String">
+            <input type="text" class="form-control search" ng-enter="ctrl.listPods()"  ng-Model="ctrl.filterText" placeholder="Search String">
         </div>
 </div>
 <div class="col-md-12">
index b6b73d4..84902f8 100644 (file)
@@ -18,7 +18,7 @@
     </div>
     <div class="col-sm-3 pull-right">
         <span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
-        <input type="text" class="form-control search" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name">
+        <input type="text" class="form-control search" ng-enter="ctrl.listProjects()" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name">
     </div>
 </div>
 <div class='clo-md-12'>
index 2756bb0..e1413d5 100644 (file)
@@ -1,22 +1,5 @@
 <h3>{{ctrl.pageHeader}}</h3>
 <p>{{ctrl.pageParagraph}}</p>
-<form class="form-inline" ng-show="ctrl.isUserResults">
-<h4>Upload Results</h4>
-<div class="form-group col-m-3">
-     <input class="form-contrl btn btn-default" type = "file" file-model = "resultFile"/>
-</div>
-<div class="checkbox col-m-1">
-  <label>
-      <input type="checkbox" ng-model="ctrl.isPublic">public
-  </label>
-</div>
-<div class="form-group col-m-3">
-     <button class="btn btn-primary" ng-click = "ctrl.uploadFile()">upload result</button>
-</div>
-<div>
-<lable>{{ctrl.uploadState}}</label>
-</div>
-</form>
 <div class="row" style="margin-bottom:24px;"></div>
 <div class="result-filters" style="border-top: none;">
     <div class="row podTable" style="vertical-align:middle">
@@ -31,7 +14,7 @@
         </div>
         <div class="col-sm-2 pull-right" ng-class="{'hidden': ctrl.filter=='start_date' || ctrl.filter=='end_date'}">
             <span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
-            <input list="filter" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;"
+            <input list="filter" ng-enter="ctrl.filterList()" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;"
                 ng-Model="ctrl.filterText" placeholder="Search String">
                 <datalist id="filter" ng-class="{ 'hidden' : ctrl.filterOption.length<0}">
                     <option ng-repeat="(index, filterValue) in ctrl.filterOption " value="{{filterValue}}">{{filterValue}}</option>
@@ -41,6 +24,7 @@
             <span style="margin-top:6px">Start&nbsp;Date:&nbsp;&nbsp;</span>
             <p class="input-group" style="width:48%;display:inline-flex;">
                 <input type="text" class="form-control"
+                    ng-enter="ctrl.filterList()"
                     uib-datepicker-popup="{{ctrl.format}}"
                     ng-model="ctrl.filterText" is-open="ctrl.startOpen"
                     close-text="Close" />
@@ -55,6 +39,7 @@
             <span style="margin-top:6px">End&nbsp;Date:&nbsp;&nbsp;</span>
             <p class="input-group" style="width:48%;display:inline-flex;">
                 <input type="text" class="form-control"
+                    ng-enter="ctrl.filterList()"
                     uib-datepicker-popup="{{ctrl.format}}"
                     ng-model="ctrl.filterText" is-open="ctrl.endOpen"
                     close-text="Close" />