Skip to content

Commit 7557a86

Browse files
committed
Merge branch 'master' into open933
2 parents 46e644e + c8931f8 commit 7557a86

File tree

9 files changed

+39
-29
lines changed

9 files changed

+39
-29
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting S
99
Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/).
1010
![Demo](https://nasa.github.io/openmct/static/res/images/Open-MCT.Browse.Layout.Mars-Weather-1.jpg)
1111

12+
## New API
13+
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.
14+
15+
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.
16+
1217
## Building and Running Open MCT Locally
1318

1419
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.

platform/commonUI/general/bundle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ define([
259259
"implementation": ClickAwayController,
260260
"depends": [
261261
"$document",
262-
"$scope"
262+
"$timeout"
263263
]
264264
},
265265
{
@@ -381,7 +381,7 @@ define([
381381
{
382382
"key": "mctTree",
383383
"implementation": MCTTree,
384-
"depends": ['$parse', 'gestureService']
384+
"depends": ['gestureService']
385385
}
386386
],
387387
"constants": [

platform/commonUI/general/src/controllers/ClickAwayController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define(
3434
* @param $scope the scope in which this controller is active
3535
* @param $document the document element, injected by Angular
3636
*/
37-
function ClickAwayController($document, $scope) {
37+
function ClickAwayController($document, $timeout) {
3838
var self = this;
3939

4040
this.state = false;
@@ -44,7 +44,7 @@ define(
4444
// `clickaway` action occurs after `toggle` if `toggle` is
4545
// triggered by a click/mouseup.
4646
this.clickaway = function () {
47-
$scope.$apply(function () {
47+
$timeout(function () {
4848
self.deactivate();
4949
});
5050
};

platform/commonUI/general/src/controllers/ToggleController.js

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ define(
3333
*/
3434
function ToggleController() {
3535
this.state = false;
36+
37+
this.setState = this.setState.bind(this);
3638
}
3739

3840
/**

platform/commonUI/general/src/directives/MCTTree.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,25 @@ define([
2424
'angular',
2525
'../ui/TreeView'
2626
], function (angular, TreeView) {
27-
function MCTTree($parse, gestureService) {
28-
function link(scope, element, attrs) {
27+
function MCTTree(gestureService) {
28+
function link(scope, element) {
2929
var treeView = new TreeView(gestureService),
30-
expr = $parse(attrs.mctModel),
3130
unobserve = treeView.observe(function (domainObject) {
32-
if (domainObject !== expr(scope.$parent)) {
33-
expr.assign(scope.$parent, domainObject);
34-
scope.$apply();
35-
}
31+
scope.mctModel = domainObject;
32+
scope.$apply();
3633
});
3734

3835
element.append(angular.element(treeView.elements()));
3936

40-
scope.$parent.$watch(attrs.mctModel, treeView.value.bind(treeView));
37+
scope.$watch('mctModel', treeView.value.bind(treeView));
4138
scope.$watch('mctObject', treeView.model.bind(treeView));
4239
scope.$on('$destroy', unobserve);
4340
}
4441

4542
return {
4643
restrict: "E",
4744
link: link,
48-
scope: { mctObject: "=" }
45+
scope: { mctObject: "=", mctModel: "=" }
4946
};
5047
}
5148

platform/commonUI/general/test/controllers/ClickAwayControllerSpec.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,18 @@ define(
2626

2727
describe("The click-away controller", function () {
2828
var mockDocument,
29-
mockScope,
29+
mockTimeout,
3030
controller;
3131

3232
beforeEach(function () {
3333
mockDocument = jasmine.createSpyObj(
3434
"$document",
3535
["on", "off"]
3636
);
37-
mockScope = jasmine.createSpyObj('$scope', ['$apply']);
38-
37+
mockTimeout = jasmine.createSpy('timeout');
3938
controller = new ClickAwayController(
4039
mockDocument,
41-
mockScope
40+
mockTimeout
4241
);
4342
});
4443

@@ -78,15 +77,18 @@ define(
7877
});
7978

8079
it("deactivates and detaches listener on document click", function () {
81-
var callback, apply;
80+
var callback, timeout;
8281
controller.setState(true);
8382
callback = mockDocument.on.mostRecentCall.args[1];
8483
callback();
85-
apply = mockScope.$apply.mostRecentCall.args[0];
86-
apply();
84+
timeout = mockTimeout.mostRecentCall.args[0];
85+
timeout();
8786
expect(controller.isActive()).toEqual(false);
8887
expect(mockDocument.off).toHaveBeenCalledWith("mouseup", callback);
8988
});
89+
90+
91+
9092
});
9193
}
9294
);

platform/commonUI/general/test/directives/MCTTreeSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ define([
4646
expect(mctTree.restrict).toEqual("E");
4747
});
4848

49-
it("two-way binds to mctObject", function () {
50-
expect(mctTree.scope).toEqual({ mctObject: "=" });
49+
it("two-way binds to mctObject and mctModel", function () {
50+
expect(mctTree.scope).toEqual({ mctObject: "=", mctModel: "=" });
5151
});
5252

5353
describe("link", function () {
@@ -69,8 +69,8 @@ define([
6969
});
7070

7171
it("watches for mct-model's expression in the parent", function () {
72-
expect(mockScope.$parent.$watch).toHaveBeenCalledWith(
73-
testAttrs.mctModel,
72+
expect(mockScope.$watch).toHaveBeenCalledWith(
73+
"mctModel",
7474
jasmine.any(Function)
7575
);
7676
});

platform/search/res/templates/search-menu.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
<div ng-controller="SearchMenuController as controller">
2424

25-
<div class="menu checkbox-menu">
25+
<div class="menu checkbox-menu"
26+
mct-click-elsewhere="parameters.menuVisible(false)">
2627
<ul>
2728
<!-- First element is special - it's a reset option -->
2829
<li class="search-menu-item special icon-asterisk"
2930
title="Select all filters"
3031
ng-click="ngModel.checkAll = !ngModel.checkAll; controller.checkAll()">
31-
3232
<label class="checkbox custom no-text">
3333
<input type="checkbox"
3434
class="checkbox"

platform/search/res/templates/search.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-->
2222
<div class="l-flex-col flex-elem grows holder holder-search" ng-controller="SearchController as controller">
2323
<div class="search-bar flex-elem"
24-
ng-controller="ClickAwayController as toggle"
24+
ng-controller="ToggleController as toggle"
2525
ng-class="{ holder: !(ngModel.input === '' || ngModel.input === undefined) }">
2626
<input class="search-input"
2727
type="text"
@@ -30,13 +30,17 @@
3030
<a class="clear-icon clear-input icon-x-in-circle"
3131
ng-class="{show: !(ngModel.input === '' || ngModel.input === undefined)}"
3232
ng-click="ngModel.input = ''; controller.search()"></a>
33-
<a class="menu-icon context-available"
33+
<!-- To prevent double triggering of clicks on click away, render
34+
non-clickable version of the button when menu active-->
35+
<a ng-if="!toggle.isActive()" class="menu-icon context-available"
3436
ng-click="toggle.toggle()"></a>
37+
<a ng-if="toggle.isActive()" class="menu-icon context-available"></a>
38+
3539
<mct-include key="'search-menu'"
3640
class="menu-element search-menu-holder"
3741
ng-class="{off: !toggle.isActive()}"
3842
ng-model="ngModel"
39-
ng-click="toggle.setState(true)">
43+
parameters="{menuVisible: toggle.setState}">
4044
</mct-include>
4145
</div>
4246
<div class="active-filter-display flex-elem holder"

0 commit comments

Comments
 (0)