mirror of
https://github.com/nasa/openmct.git
synced 2025-03-05 21:51:49 +00:00
[Search] Added input ID parameter
Added a parameter to the controller's search function so that the html side can clearly see/choose which input ID is being used as the search input.
This commit is contained in:
parent
c92d15ba42
commit
457193657f
platform/features/search
@ -31,7 +31,7 @@
|
|||||||
value=""/>
|
value=""/>
|
||||||
<span class="button">
|
<span class="button">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
ng-click="controller.search()">Go</button>
|
ng-click="controller.search('searchinput')">Go</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -77,8 +77,17 @@ define(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use elasticsearch's search to search through all the objects
|
// Use elasticsearch's search to search through all the objects
|
||||||
function searchElastic() {
|
function searchElastic(inputID) {
|
||||||
var searchTerm = document.getElementById("searchinput").value;
|
var searchTerm;
|
||||||
|
|
||||||
|
// Get the user input
|
||||||
|
if (inputID) {
|
||||||
|
searchTerm = document.getElementById(inputID).value;
|
||||||
|
} else {
|
||||||
|
// Backward compatibility?
|
||||||
|
// TODO: May be unnecsisary
|
||||||
|
searchTerm = document.getElementById("searchinput").value;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the data...
|
// Get the data...
|
||||||
return $http({
|
return $http({
|
||||||
@ -131,8 +140,8 @@ define(function () {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
// Search the database using the user input of id "searchinput"
|
// Search the database using the user input of id "searchinput"
|
||||||
search: function () {
|
search: function (inputID) {
|
||||||
searchElastic().then( function (c) {
|
searchElastic(inputID).then( function (c) {
|
||||||
$scope.results = c;
|
$scope.results = c;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user