Merge pull request #512 from wknet123/master

Update for interaction with enter key press when doing searches
This commit is contained in:
kun wang 2016-07-11 16:33:10 +08:00 committed by GitHub
commit 0c5e6caa5e
17 changed files with 86 additions and 20 deletions

View File

@ -16,7 +16,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.username" size="30">
<input type="text" id="txtSearchInput" class="form-control" placeholder="" ng-model="vm.username" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.search({op: vm.op, username: vm.username})"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -145,19 +145,28 @@
function listLog() {
var directive = {
restrict: 'E',
templateUrl: '/static/resources/js/components/log/list-log.directive.html',
scope: {
'restrict': 'E',
'templateUrl': '/static/resources/js/components/log/list-log.directive.html',
'scope': {
'sectionHeight': '=',
'target': '=',
'publicity': '='
},
controller: ListLogController,
controllerAs: 'vm',
bindToController: true
'link': link,
'controller': ListLogController,
'controllerAs': 'vm',
'bindToController': true
};
return directive;
function link(scope, element, attrs, ctrl) {
element.find('#txtSearchInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.search({'op': ctrl.op, 'username': ctrl.username});
}
});
}
}
})();

View File

@ -16,7 +16,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.username" size="30">
<input type="text" id="txtSearchInput" class="form-control" placeholder="" ng-model="vm.username" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.search({projectId: vm.projectId, username: vm.username})"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -106,12 +106,21 @@
'sectionHeight': '=',
'target': '='
},
'link': link,
'controller': ListProjectMemberController,
'controllerAs': 'vm',
'bindToController': true
};
return directive;
function link(scope, element, attrs, ctrl) {
element.find('#txtSearchInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.retrieve();
}
});
}
}
})();

View File

@ -16,7 +16,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.replicationPolicyName" size="30">
<input type="text" id="txtSearchPolicyInput" class="form-control" placeholder="" ng-model="vm.replicationPolicyName" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.searchReplicationPolicy()"><span class="glyphicon glyphicon-search"></span></button>
</span>
@ -79,7 +79,7 @@
<hr class="hr-line"/>
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.replicationJobName" size="30">
<input type="text" id="txtSearchJobInput" class="form-control" placeholder="" ng-model="vm.replicationJobName" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.searchReplicationJob()" loading-progress hide-target = "true" toggle-in-progress="vm.searchJobTIP"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -143,7 +143,7 @@
$scope.$emit('raiseAlert', alertInfo);
vm.searchJobTIP = false;
vm.refreshJobTIP = false;
}
}searchReplicationJob
function listReplicationJobFailed(data, status) {
console.log('Failed to list replication job:' + data);
@ -303,6 +303,19 @@
element.find('#toDatePicker').on('blur', function(){
ctrl.pickUp({'key': 'toDate', 'value': $(this).val()});
});
element.find('#txtSearchPolicyInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.searchReplicationPolicy();
}
});
element.find('#txtSearchJobInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.searchReplicationJob();
}
});
}
}

View File

@ -2,7 +2,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.filterInput" value="" size="30">
<input type="text" id="txtSearchInput" class="form-control" placeholder="" ng-model="vm.filterInput" value="" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.retrieve()"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -175,7 +175,11 @@
return directive;
function link(scope, element, attr, ctrl) {
element.find('#txtSearchInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.retrieve();
}
});
}
}

View File

@ -57,7 +57,7 @@
.on('keydown', keydownHandler);
function keydownHandler(e) {
if(e.keyCode === 13) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.searchFor($(this).val());
}
}

View File

@ -16,7 +16,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.destinationName" size="30">
<input type="text" id="txtSearchInput" class="form-control" placeholder="" ng-model="vm.destinationName" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.search()"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -108,11 +108,20 @@
'restrict': 'E',
'templateUrl': '/static/resources/js/components/system-management/destination.directive.html',
'scope': true,
'link': link,
'controller': DestinationController,
'controllerAs': 'vm',
'bindToController': true
};
return directive;
function link(scope, element, attrs, ctrl) {
element.find('#txtSearchInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.retrieve();
}
});
}
}
})();

View File

@ -16,7 +16,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.replicationName" size="30">
<input type="text" id="txtSearchInput" class="form-control" placeholder="" ng-model="vm.replicationName" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.search()"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -111,11 +111,20 @@
'restrict': 'E',
'templateUrl': '/static/resources/js/components/system-management/replication.directive.html',
'scope': true,
'link': link,
'controller': ReplicationController,
'controllerAs': 'vm',
'bindToController': true
};
return directive;
function link(scope, element, attrs, ctrl) {
element.find('#txtSearchInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.retrieve();
}
});
}
}
})();

View File

@ -16,7 +16,7 @@
<div class="col-xs-12 col-md-12 each-tab-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.username" size="30">
<input type="text" id="txtSearchInput" class="form-control" placeholder="" ng-model="vm.username" size="30">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.searchUser()"><span class="glyphicon glyphicon-search"></span></button>
</span>

View File

@ -102,8 +102,12 @@
};
return directive;
function link(scope, element, attrs) {
function link(scope, element, attrs, ctrl) {
element.find('#txtSearchInput').on('keydown', function(e) {
if($(this).is(':focus') && e.keyCode === 13) {
ctrl.retrieve();
}
});
}
}

View File

@ -38,6 +38,8 @@
vm.retrieve();
vm.getProjectRole = getProjectRole;
vm.searchProjectByKeyPress = searchProjectByKeyPress;
//Error message dialog handler for project.
$scope.$on('modalTitle', function(e, val) {
@ -116,6 +118,13 @@
console.log('vm.publicity:' + vm.publicity);
}
function searchProjectByKeyPress($event) {
var keyCode = $event.which || $event.keyCode;
if(keyCode === 13) {
vm.retrieve();
}
}
}
})();

View File

@ -28,7 +28,7 @@
<div class="search-pane">
<div class="form-inline">
<div class="input-group">
<input type="text" class="form-control" placeholder="" ng-model="vm.projectName" size="30">
<input type="text" class="form-control" placeholder="" ng-model="vm.projectName" size="30" ng-keydown="vm.searchProjectByKeyPress($event)">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" ng-click="vm.searchProject()"><span class="glyphicon glyphicon-search"></span></button>
</span>