mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 01:16:46 +00:00
Merge remote-tracking branch 'origin/master' into search1093-b
Conflicts: platform/search/res/templates/search.html
This commit is contained in:
commit
8105a7edb8
@ -9,6 +9,11 @@ Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting S
|
||||
Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/).
|
||||

|
||||
|
||||
## New API
|
||||
A new API is currently under development that will deprecate a lot of the documentation currently in the docs directory, however Open MCT will remain compatible with the currently documented API. An updated set of tutorials is being developed with the new API, and progress on this task can be followed in the [associated pull request](https://github.com/nasa/openmct/pull/999). Any code in this branch should be considered experimental, and we welcome any feedback.
|
||||
|
||||
Differences between the two APIs include a move away from a declarative system of JSON configuration files towards an imperative system based on function calls. Developers will be able to extend and build on Open MCT by making direct function calls to a public API. Open MCT is also being refactored to minimize the dependencies that using Open MCT imposes on developers, such as the current requirement to use Angular JS.
|
||||
|
||||
## Building and Running Open MCT Locally
|
||||
|
||||
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
||||
|
@ -259,7 +259,7 @@ define([
|
||||
"implementation": ClickAwayController,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$scope"
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -381,7 +381,7 @@ define([
|
||||
{
|
||||
"key": "mctTree",
|
||||
"implementation": MCTTree,
|
||||
"depends": ['$parse', 'gestureService']
|
||||
"depends": ['gestureService']
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
|
@ -34,7 +34,7 @@ define(
|
||||
* @param $scope the scope in which this controller is active
|
||||
* @param $document the document element, injected by Angular
|
||||
*/
|
||||
function ClickAwayController($document, $scope) {
|
||||
function ClickAwayController($document, $timeout) {
|
||||
var self = this;
|
||||
|
||||
this.state = false;
|
||||
@ -44,7 +44,7 @@ define(
|
||||
// `clickaway` action occurs after `toggle` if `toggle` is
|
||||
// triggered by a click/mouseup.
|
||||
this.clickaway = function () {
|
||||
$scope.$apply(function () {
|
||||
$timeout(function () {
|
||||
self.deactivate();
|
||||
});
|
||||
};
|
||||
|
@ -33,6 +33,8 @@ define(
|
||||
*/
|
||||
function ToggleController() {
|
||||
this.state = false;
|
||||
|
||||
this.setState = this.setState.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,20 +24,17 @@ define([
|
||||
'angular',
|
||||
'../ui/TreeView'
|
||||
], function (angular, TreeView) {
|
||||
function MCTTree($parse, gestureService) {
|
||||
function link(scope, element, attrs) {
|
||||
function MCTTree(gestureService) {
|
||||
function link(scope, element) {
|
||||
var treeView = new TreeView(gestureService),
|
||||
expr = $parse(attrs.mctModel),
|
||||
unobserve = treeView.observe(function (domainObject) {
|
||||
if (domainObject !== expr(scope.$parent)) {
|
||||
expr.assign(scope.$parent, domainObject);
|
||||
scope.$apply();
|
||||
}
|
||||
scope.mctModel = domainObject;
|
||||
scope.$apply();
|
||||
});
|
||||
|
||||
element.append(angular.element(treeView.elements()));
|
||||
|
||||
scope.$parent.$watch(attrs.mctModel, treeView.value.bind(treeView));
|
||||
scope.$watch('mctModel', treeView.value.bind(treeView));
|
||||
scope.$watch('mctObject', treeView.model.bind(treeView));
|
||||
scope.$on('$destroy', unobserve);
|
||||
}
|
||||
@ -45,7 +42,7 @@ define([
|
||||
return {
|
||||
restrict: "E",
|
||||
link: link,
|
||||
scope: { mctObject: "=" }
|
||||
scope: { mctObject: "=", mctModel: "=" }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ define(
|
||||
|
||||
describe("The click-away controller", function () {
|
||||
var mockDocument,
|
||||
mockScope,
|
||||
mockTimeout,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
@ -34,11 +34,10 @@ define(
|
||||
"$document",
|
||||
["on", "off"]
|
||||
);
|
||||
mockScope = jasmine.createSpyObj('$scope', ['$apply']);
|
||||
|
||||
mockTimeout = jasmine.createSpy('timeout');
|
||||
controller = new ClickAwayController(
|
||||
mockDocument,
|
||||
mockScope
|
||||
mockTimeout
|
||||
);
|
||||
});
|
||||
|
||||
@ -78,15 +77,18 @@ define(
|
||||
});
|
||||
|
||||
it("deactivates and detaches listener on document click", function () {
|
||||
var callback, apply;
|
||||
var callback, timeout;
|
||||
controller.setState(true);
|
||||
callback = mockDocument.on.mostRecentCall.args[1];
|
||||
callback();
|
||||
apply = mockScope.$apply.mostRecentCall.args[0];
|
||||
apply();
|
||||
timeout = mockTimeout.mostRecentCall.args[0];
|
||||
timeout();
|
||||
expect(controller.isActive()).toEqual(false);
|
||||
expect(mockDocument.off).toHaveBeenCalledWith("mouseup", callback);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -46,8 +46,8 @@ define([
|
||||
expect(mctTree.restrict).toEqual("E");
|
||||
});
|
||||
|
||||
it("two-way binds to mctObject", function () {
|
||||
expect(mctTree.scope).toEqual({ mctObject: "=" });
|
||||
it("two-way binds to mctObject and mctModel", function () {
|
||||
expect(mctTree.scope).toEqual({ mctObject: "=", mctModel: "=" });
|
||||
});
|
||||
|
||||
describe("link", function () {
|
||||
@ -69,8 +69,8 @@ define([
|
||||
});
|
||||
|
||||
it("watches for mct-model's expression in the parent", function () {
|
||||
expect(mockScope.$parent.$watch).toHaveBeenCalledWith(
|
||||
testAttrs.mctModel,
|
||||
expect(mockScope.$watch).toHaveBeenCalledWith(
|
||||
"mctModel",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
});
|
||||
|
@ -22,13 +22,13 @@
|
||||
|
||||
<div ng-controller="SearchMenuController as controller">
|
||||
|
||||
<div class="menu checkbox-menu">
|
||||
<div class="menu checkbox-menu"
|
||||
mct-click-elsewhere="parameters.menuVisible(false)">
|
||||
<ul>
|
||||
<!-- First element is special - it's a reset option -->
|
||||
<li class="search-menu-item special icon-asterisk"
|
||||
title="Select all filters"
|
||||
ng-click="ngModel.checkAll = !ngModel.checkAll; controller.checkAll()">
|
||||
|
||||
<label class="checkbox custom no-text">
|
||||
<input type="checkbox"
|
||||
class="checkbox"
|
||||
|
@ -19,59 +19,52 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div class="angular-w" ng-controller="SearchController as controller">
|
||||
<div class="l-flex-col flex-elem grows holder holder-search" ng-controller="SearchMenuController as menuController">
|
||||
<div class="search-bar flex-elem l-flex-row"
|
||||
ng-controller="ClickAwayController as toggle"
|
||||
ng-class="{ holder: !(ngModel.input === '' || ngModel.input === undefined) }">
|
||||
<div class="l-flex-col flex-elem grows holder holder-search" ng-controller="SearchController as controller">
|
||||
<div class="search-bar flex-elem"
|
||||
ng-controller="ToggleController as toggle"
|
||||
ng-class="{ holder: !(ngModel.input === '' || ngModel.input === undefined) }">
|
||||
<input class="search-input"
|
||||
type="text"
|
||||
ng-model="ngModel.input"
|
||||
ng-keyup="controller.search()"/>
|
||||
<a class="clear-icon clear-input icon-x-in-circle"
|
||||
ng-class="{show: !(ngModel.input === '' || ngModel.input === undefined)}"
|
||||
ng-click="ngModel.input = ''; controller.search()"></a>
|
||||
<!-- To prevent double triggering of clicks on click away, render
|
||||
non-clickable version of the button when menu active-->
|
||||
<a ng-if="!toggle.isActive()" class="menu-icon context-available"
|
||||
ng-click="toggle.toggle()"></a>
|
||||
<a ng-if="toggle.isActive()" class="menu-icon context-available"></a>
|
||||
|
||||
<div class="holder flex-elem grows">
|
||||
<input class="search-input"
|
||||
type="text"
|
||||
ng-model="ngModel.input"
|
||||
ng-keyup="controller.search()"/>
|
||||
<a class="clear-icon clear-input icon-x-in-circle"
|
||||
ng-class="{show: !(ngModel.input === '' || ngModel.input === undefined)}"
|
||||
ng-click="ngModel.input = ''; controller.search()"></a>
|
||||
<a class="menu-icon context-available"
|
||||
ng-click="toggle.toggle()"></a>
|
||||
<mct-include key="'search-menu'"
|
||||
class="menu-element search-menu-holder"
|
||||
ng-class="{off: !toggle.isActive()}"
|
||||
ng-model="ngModel"
|
||||
ng-click="toggle.setState(true)">
|
||||
</mct-include>
|
||||
</div>
|
||||
<mct-include key="'search-menu'"
|
||||
class="menu-element search-menu-holder"
|
||||
ng-class="{off: !toggle.isActive()}"
|
||||
ng-model="ngModel"
|
||||
parameters="{menuVisible: toggle.setState}">
|
||||
</mct-include>
|
||||
</div>
|
||||
<div class="active-filter-display flex-elem holder"
|
||||
ng-class="{off: ngModel.filtersString === '' || ngModel.filtersString === undefined || !ngModel.search}"
|
||||
ng-controller="SearchMenuController as menuController">
|
||||
<a class="clear-icon clear-filters icon-x-in-circle"
|
||||
ng-click="ngModel.checkAll = true; menuController.checkAll()"></a>Filtered by: {{ ngModel.filtersString }}
|
||||
</div>
|
||||
|
||||
<a class="holder s-button flex-elem btn-cancel"
|
||||
ng-show="!(ngModel.input === '' || ngModel.input === undefined)"
|
||||
ng-click="ngModel.input = ''; ngModel.checkAll = true; menuController.checkAll(); controller.search()">
|
||||
Cancel</a>
|
||||
</div>
|
||||
|
||||
<div class="active-filter-display flex-elem holder"
|
||||
ng-class="{off: ngModel.filtersString === '' || ngModel.filtersString === undefined || !ngModel.search}">
|
||||
<a class="clear-filters icon-x-in-circle s-icon-button"
|
||||
ng-click="ngModel.checkAll = true; menuController.checkAll()"></a>Filtered by: {{ ngModel.filtersString }}
|
||||
</div>
|
||||
|
||||
<div class="flex-elem holder results-msg" ng-model="ngModel" ng-show="!loading && ngModel.search">
|
||||
{{
|
||||
!results.length > 0? 'No results found':
|
||||
results.length + ' result' + (results.length > 1? 's':'') + ' found'
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="search-results flex-elem holder grows vscroll"
|
||||
ng-class="{ off: !(loading || results.length > 0), loading: loading }">
|
||||
<mct-representation key="'search-item'"
|
||||
ng-repeat="result in results"
|
||||
mct-object="result.object"
|
||||
ng-model="ngModel"
|
||||
class="l-flex-row flex-elem grows">
|
||||
</mct-representation>
|
||||
<a class="load-more-button s-btn vsm" ng-if="controller.areMore()" ng-click="controller.loadMore()">More Results</a>
|
||||
</div>
|
||||
<div class="flex-elem holder results-msg" ng-model="ngModel" ng-show="!loading && ngModel.search">
|
||||
{{
|
||||
!results.length > 0? 'No results found':
|
||||
results.length + ' result' + (results.length > 1? 's':'') + ' found'
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="search-results flex-elem holder grows vscroll"
|
||||
ng-class="{ off: !(loading || results.length > 0), loading: loading }">
|
||||
<mct-representation key="'search-item'"
|
||||
ng-repeat="result in results"
|
||||
mct-object="result.object"
|
||||
ng-model="ngModel"
|
||||
class="l-flex-row flex-elem grows">
|
||||
</mct-representation>
|
||||
<a class="load-more-button s-button vsm" ng-if="controller.areMore()" ng-click="controller.loadMore()">More Results</a>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user