mirror of
https://github.com/nasa/openmct.git
synced 2025-05-31 22:50:49 +00:00
[Search] Gets user input
Now sucessfully gets user input for the search term.
This commit is contained in:
parent
33b30f7583
commit
04257aedae
@ -24,32 +24,15 @@
|
|||||||
ng-controller="SearchController as controller">
|
ng-controller="SearchController as controller">
|
||||||
|
|
||||||
<!-- Search bar -->
|
<!-- Search bar -->
|
||||||
<div id="formid">
|
<div>
|
||||||
<form>
|
<div style="height: 30px">Search:</div>
|
||||||
<!--
|
<input type="text"
|
||||||
<div>
|
id="searchinput"
|
||||||
<label for="searchinput">Search this folder:</label>
|
value=""/>
|
||||||
<input type="text" id="searchinput" />
|
<span class="button">
|
||||||
</div>
|
<button type="button"
|
||||||
-->
|
ng-click="controller.search()">Go</button>
|
||||||
<div style="height: 30px">Search:</div>
|
</span>
|
||||||
<input type="text"
|
|
||||||
id="searchinput"
|
|
||||||
name="searchform"
|
|
||||||
value="input search term here"/>
|
|
||||||
<!--
|
|
||||||
<div class="button">
|
|
||||||
<button type="submit">Search</button>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
<input type="submit" value="go" />
|
|
||||||
-->
|
|
||||||
<span class="button">
|
|
||||||
<button type="button"
|
|
||||||
ng-click="controller.search('')">Go</button>
|
|
||||||
</span>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- some spacing -->
|
<!-- some spacing -->
|
||||||
@ -62,5 +45,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<mct-representation key="'grid-item'"
|
<mct-representation key="'grid-item'"
|
||||||
ng-repeat="result in results"
|
ng-repeat="result in results"
|
||||||
mct-object="result"></mct-representation>
|
mct-object="result">
|
||||||
|
</mct-representation>
|
||||||
</div>
|
</div>
|
@ -43,13 +43,13 @@ define(function () {
|
|||||||
return composition.invoke().then(function (children) {
|
return composition.invoke().then(function (children) {
|
||||||
var subList = [current],
|
var subList = [current],
|
||||||
i;
|
i;
|
||||||
console.log('children ', children);
|
//console.log('children ', children);
|
||||||
for (i = 0; i < children.length; i += 1) {
|
for (i = 0; i < children.length; i += 1) {
|
||||||
console.log('children[', i, ']', children[i]);
|
//console.log('children[', i, ']', children[i]);
|
||||||
subList.push(listHelper(children[i]));
|
subList.push(listHelper(children[i]));
|
||||||
console.log('subList', subList, 'index', i);
|
//console.log('subList', subList, 'index', i);
|
||||||
}
|
}
|
||||||
console.log('sublist ', subList);
|
//console.log('sublist ', subList);
|
||||||
return subList;
|
return subList;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -75,25 +75,26 @@ define(function () {
|
|||||||
// Aquire My Items (root folder)
|
// Aquire My Items (root folder)
|
||||||
return objectService.getObjects(['mine']).then(function (objects) {
|
return objectService.getObjects(['mine']).then(function (objects) {
|
||||||
return listHelper(objects.mine).then(function (c) {
|
return listHelper(objects.mine).then(function (c) {
|
||||||
console.log('final result ', c);
|
//console.log('final result ', c);
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search through items for items which contain the search term in the name
|
// Search through items for items which contain the search term in the name
|
||||||
function search(term) {
|
function search() {
|
||||||
console.log('search called, with term ', term);
|
var term,
|
||||||
var searchResults = [],
|
searchResults = [],
|
||||||
itemsLength,
|
itemsLength,
|
||||||
itemModel,
|
itemModel,
|
||||||
itemName,
|
itemName,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
|
// Search for user input by element id
|
||||||
|
term = document.getElementById("searchinput").value;
|
||||||
|
|
||||||
// Make not case sensitive
|
// Make not case sensitive
|
||||||
if (term) {
|
term = term.toLocaleLowerCase();
|
||||||
term = term.toLocaleLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get items list
|
// Get items list
|
||||||
return listify().then(function (items) {
|
return listify().then(function (items) {
|
||||||
@ -133,30 +134,6 @@ define(function () {
|
|||||||
|
|
||||||
///// Old stuff to look at later
|
///// Old stuff to look at later
|
||||||
|
|
||||||
// Get the root object
|
|
||||||
/*
|
|
||||||
objectService.getObjects(['root']).then(function (objects) {
|
|
||||||
console.log('rootObject 1', rootObject);
|
|
||||||
rootObject = objects.root;
|
|
||||||
console.log('rootObject 2', rootObject);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log('hasCapability("editor") ', rootObject.hasCapability('editor'));
|
|
||||||
console.log('getModel() ', rootObject.getModel());
|
|
||||||
console.log('getId() ', rootObject.getId());
|
|
||||||
|
|
||||||
// Get the children of the root object
|
|
||||||
console.log('hasCapability("composition") ', rootObject.hasCapability('composition'));
|
|
||||||
if (rootObject.hasCapability('composition')) {
|
|
||||||
rootComposition = rootObject.getCapability('composition').invoke();
|
|
||||||
console.log('rootComposition ', rootComposition);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
console.log('rootObject 3', rootObject);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Recursive search
|
// Recursive search
|
||||||
/*
|
/*
|
||||||
var subList = [current],
|
var subList = [current],
|
||||||
@ -187,19 +164,3 @@ define(function () {
|
|||||||
// return c;
|
// return c;
|
||||||
//});
|
//});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// For now, we want this view to only be in the My Items folder
|
|
||||||
if ($scope.domainObject.getId() === 'mine') {
|
|
||||||
var list = listHelper($scope.domainObject);
|
|
||||||
//debugger;
|
|
||||||
console.log(' ');
|
|
||||||
console.log('list ', list);
|
|
||||||
return list.then(function (c) {
|
|
||||||
console.log('final result ', c);
|
|
||||||
return c;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user