mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 03:06:54 +00:00
[Search] Creating searchbar
Starting to create a search bar which lives in the same side of the divder as the file tree does.
This commit is contained in:
parent
759eaa3b35
commit
b94ef695e2
@ -27,6 +27,11 @@
|
||||
style="min-width: 150px; max-width: 800px; width: 25%;">
|
||||
<mct-representation key="'create-button'" mct-object="navigatedObject">
|
||||
</mct-representation>
|
||||
<div>
|
||||
<mct-include key="'searchbar'"
|
||||
mct-object="domainObject">
|
||||
</mct-include>
|
||||
</div>
|
||||
<div class='holder tree-holder abs'>
|
||||
<mct-representation key="'tree'"
|
||||
mct-object="domainObject"
|
||||
|
@ -16,13 +16,25 @@
|
||||
"key": "SearchController",
|
||||
"implementation": "SearchController.js",
|
||||
"depends": [ "$scope", "queryService" ]
|
||||
},
|
||||
{
|
||||
"key": "SearchbarController",
|
||||
"implementation": "SearchbarController.js",
|
||||
"depends": [ "$scope", "queryService" ]
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "searchbar",
|
||||
"templateUrl": "templates/searchbar.html",
|
||||
"uses": [ "composition" ]
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "search-item",
|
||||
"templateUrl": "templates/search-item.html",
|
||||
"uses": [ "grid-item" ]
|
||||
"key": "searchbar-item",
|
||||
"templateUrl": "templates/searchbar-item.html",
|
||||
"uses": [ "composition" ]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
|
55
platform/features/search/res/templates/searchbar-item.html
Normal file
55
platform/features/search/res/templates/searchbar-item.html
Normal file
@ -0,0 +1,55 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web is licensed 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.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
|
||||
<div>
|
||||
<mct-representation
|
||||
key="'label'"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = domainObject"
|
||||
>
|
||||
</mct-representation>
|
||||
<!-- span
|
||||
class="tree-item menus-to-left"
|
||||
ng-class="{selected: treeNode.isSelected()}"
|
||||
>
|
||||
<!-- span
|
||||
class='ui-symbol view-control'
|
||||
ng-click="toggle.toggle(); treeNode.trackExpansion()"
|
||||
ng-if="model.composition !== undefined"
|
||||
>
|
||||
{{toggle.isActive() ? "v" : ">"}}
|
||||
</span ->
|
||||
</span -->
|
||||
<!-- span
|
||||
class="tree-item-subtree"
|
||||
ng-show="toggle.isActive()"
|
||||
ng-if="model.composition !== undefined"
|
||||
>
|
||||
|
||||
<mct-representation key="'subtree'"
|
||||
ng-model="ngModel"
|
||||
mct-object="treeNode.hasBeenExpanded() && domainObject">
|
||||
</mct-representation>
|
||||
|
||||
</span-->
|
||||
</div>
|
42
platform/features/search/res/templates/searchbar.html
Normal file
42
platform/features/search/res/templates/searchbar.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web is licensed 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.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span ng-controller="SearchbarController as controller">
|
||||
<!-- Search bar input -->
|
||||
<div>
|
||||
<span>
|
||||
Search:
|
||||
</span>
|
||||
<input type="text"
|
||||
id="searchbarinput"
|
||||
value=""
|
||||
ng-keyup="controller.search('searchbarinput')"
|
||||
style="width: 100%"/>
|
||||
</div>
|
||||
|
||||
<!-- Results list -->
|
||||
<div>
|
||||
<mct-representation key="'searchbar-item'"
|
||||
ng-repeat="result in results"
|
||||
mct-object="result">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</span>
|
51
platform/features/search/src/SearchbarController.js
Normal file
51
platform/features/search/src/SearchbarController.js
Normal file
@ -0,0 +1,51 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed 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.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* Module defining SearchbarController. Created by shale on 07/15/2015.
|
||||
*/
|
||||
define(function () {
|
||||
"use strict";
|
||||
|
||||
function SearchbarController($scope, queryService) {
|
||||
|
||||
return {
|
||||
// Search the database using the user input of id "searchinput"
|
||||
search: function (inputID) {
|
||||
queryService.query(inputID).then(function (c) {
|
||||
$scope.results = c;
|
||||
});
|
||||
},
|
||||
|
||||
// Check to see if there are any search results to display.
|
||||
areResults: function () {
|
||||
if ($scope.results) {
|
||||
return $scope.results.length > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
return SearchbarController;
|
||||
});
|
Loading…
Reference in New Issue
Block a user