Skip to content

Commit b384e84

Browse files
committed
Merge branch 'open933' into open1182
2 parents 5babf72 + 07140b1 commit b384e84

File tree

92 files changed

+646
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+646
-297
lines changed

bower.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"zepto": "^1.1.6",
2222
"eventemitter3": "^1.2.0",
2323
"d3": "~4.1.0",
24-
"html2canvas": "^0.4.1",
25-
"jspdf": "^1.2.61"
24+
"html2canvas": "^0.4.1"
2625
}
2726
}

build-docs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ WEBSITE_DIRECTORY="website"
3232
BUILD_SHA=`git rev-parse HEAD`
3333

3434
# A remote will be created for the git repository we are pushing to.
35-
# Don't worry, as this entire directory will get trashed inbetween builds.
35+
# Don't worry, as this entire directory will get trashed in between builds.
3636
REMOTE_NAME="documentation"
3737
WEBSITE_BRANCH="master"
3838

docs/src/architecture/platform.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ follows:
616616
part of an action's extension definition.
617617
* `CreateActionProvider` provides the various Create actions which
618618
populate the Create menu. These are driven by the available types,
619-
so do not map easily ot extension category `actions`; instead, these
619+
so do not map easily to extension category `actions`; instead, these
620620
are generated after looking up which actions are available from the
621621
[`TypeService`](#type-service).
622622
* `ActionAggregator` merges together actions from multiple providers.

docs/src/design/proposals/APIRedesign.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Worked on bug fixes in the platform and a plugin for search.
9898
It is hard to figure out what the difference between the various ways of
9999
dealing with telemetry are. e.g., what is the difference between just
100100
"Telemetry" and the "Telemetry Service"? There are many
101-
"Telemetry Thing"s which seem related, but in an unclear way.
101+
"Telemetry Things" which seem related, but in an unclear way.
102102

103103
### Developer Intern 2
104104

@@ -456,7 +456,7 @@ Instead, propose that:
456456
For parity with actions, a `View` would be a constructor which
457457
takes an `ActionContext` as a parameter (with similarly-defined
458458
properties) and exposes a method to retrieve the HTML elements
459-
associateed with it.
459+
associated with it.
460460

461461
The platform would then additionally expose an `AngularView`
462462
implementation to improve compatibility with existing

docs/src/design/proposals/APIRedesign_PeteRichards.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ To reduce interface depth, we can replace our own provider and registry patterns
9999

100100
## More angular: for all services
101101

102-
Increasing our commitment to angular would mean using more of the angular factorys, services, etc, and less of our home grown tools. We'd implement our services and extension points as angular providers, and make them configurable via app.config.
102+
Increasing our commitment to angular would mean using more of the angular factories, services, etc, and less of our home grown tools. We'd implement our services and extension points as angular providers, and make them configurable via app.config.
103103

104104
As an example, registering a specific type of model provider in angular would look like:
105105

docs/src/tutorials/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3238,7 +3238,7 @@ define(
32383238
__tutorials/telemetry/src/ExampleTelemetryServerAdapter.js__
32393239

32403240
Here, we have added `subscribe` and `unsubscribe` methods which issue the
3241-
corresponding requests to the server. Seperately, we introduce the ability to
3241+
corresponding requests to the server. Separately, we introduce the ability to
32423242
listen for `data` messages as they come in: These will contain the data associated
32433243
with these subscriptions.
32443244

example/eventGenerator/data/transcript.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"LMP: 47 degrees.",
1111
"CC: Eagle, looking great. You're GO.",
1212
"CC: Roger. 1202. We copy it.",
13-
"O1: LMP 35 degrees. 35 degrees. 750. Coming aown to 23.fl",
13+
"O1: LMP 35 degrees. 35 degrees. 750. Coming down to 23.fl",
1414
"LMP: 700 feet, 21 down, 33 degrees.",
1515
"LMP: 600 feet, down at 19.",
1616
"LMP: 540 feet, down at - 30. Down at 15.",

main.js

-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ requirejs.config({
3030
"EventEmitter": "bower_components/eventemitter3/index",
3131
"es6-promise": "bower_components/es6-promise/es6-promise.min",
3232
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
33-
"jsPDF": "bower_components/jspdf/dist/jspdf.min",
3433
"moment": "bower_components/moment/moment",
3534
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
3635
"saveAs": "bower_components/FileSaver.js/FileSaver.min",
@@ -50,9 +49,6 @@ requirejs.config({
5049
"html2canvas": {
5150
"exports": "html2canvas"
5251
},
53-
"jsPDF": {
54-
"exports": "jsPDF"
55-
},
5652
"EventEmitter": {
5753
"exports": "EventEmitter"
5854
},

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openmct",
3-
"version": "0.11.3-SNAPSHOT",
3+
"version": "0.12.0-SNAPSHOT",
44
"description": "The Open MCT core platform",
55
"dependencies": {
66
"express": "^4.13.1",

platform/commonUI/browse/src/navigation/NavigateAction.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,35 @@ define(
4848
*/
4949
NavigateAction.prototype.perform = function () {
5050
var self = this,
51-
navigationAllowed = true;
51+
navigateTo = this.domainObject,
52+
currentObject = self.navigationService.getNavigation();
5253

5354
function allow() {
54-
self.policyService.allow("navigation", self.navigationService.getNavigation(), self.domainObject, function (message) {
55+
var navigationAllowed = true;
56+
self.policyService.allow("navigation", currentObject, navigateTo, function (message) {
5557
navigationAllowed = self.$window.confirm(message + "\r\n\r\n" +
5658
" Are you sure you want to continue?");
5759
});
5860
return navigationAllowed;
5961
}
6062

61-
// Set navigation, and wrap like a promise
62-
return this.$q.when(
63-
allow() && this.navigationService.setNavigation(this.domainObject)
64-
);
63+
function cancelIfEditing() {
64+
var editing = currentObject.hasCapability('editor') &&
65+
currentObject.getCapability('editor').isEditContextRoot();
66+
67+
return self.$q.when(editing && currentObject.getCapability("editor").finish());
68+
}
69+
70+
function navigate() {
71+
return self.navigationService.setNavigation(navigateTo);
72+
}
73+
74+
if (allow()) {
75+
return cancelIfEditing().then(navigate);
76+
} else {
77+
return this.$q.when(false);
78+
}
79+
6580
};
6681

6782
/**

platform/commonUI/browse/test/navigation/NavigateActionSpec.js

+46-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ define(
3232
mockQ,
3333
mockDomainObject,
3434
mockPolicyService,
35+
mockNavigatedObject,
3536
mockWindow,
37+
capabilities,
3638
action;
3739

3840
function mockPromise(value) {
@@ -44,18 +46,44 @@ define(
4446
}
4547

4648
beforeEach(function () {
49+
capabilities = {};
50+
51+
mockQ = { when: mockPromise };
52+
mockNavigatedObject = jasmine.createSpyObj(
53+
"domainObject",
54+
[
55+
"getId",
56+
"getModel",
57+
"hasCapability",
58+
"getCapability"
59+
]
60+
);
61+
62+
capabilities.editor = jasmine.createSpyObj("editorCapability", [
63+
"isEditContextRoot",
64+
"finish"
65+
]);
66+
67+
mockNavigatedObject.getCapability.andCallFake(function (capability) {
68+
return capabilities[capability];
69+
});
70+
mockNavigatedObject.hasCapability.andReturn(false);
71+
4772
mockNavigationService = jasmine.createSpyObj(
4873
"navigationService",
4974
[
5075
"setNavigation",
5176
"getNavigation"
5277
]
5378
);
54-
mockNavigationService.getNavigation.andReturn({});
55-
mockQ = { when: mockPromise };
79+
mockNavigationService.getNavigation.andReturn(mockNavigatedObject);
80+
5681
mockDomainObject = jasmine.createSpyObj(
5782
"domainObject",
58-
["getId", "getModel", "getCapability"]
83+
[
84+
"getId",
85+
"getModel"
86+
]
5987
);
6088

6189
mockPolicyService = jasmine.createSpyObj("policyService",
@@ -112,6 +140,21 @@ define(
112140
});
113141
});
114142

143+
describe("in edit mode", function () {
144+
beforeEach(function () {
145+
mockNavigatedObject.hasCapability.andCallFake(function (capability) {
146+
return capability === "editor";
147+
});
148+
capabilities.editor.isEditContextRoot.andReturn(true);
149+
});
150+
151+
it("finishes editing if in edit mode", function () {
152+
action.perform();
153+
expect(capabilities.editor.finish)
154+
.toHaveBeenCalled();
155+
});
156+
});
157+
115158
it("is only applicable when a domain object is in context", function () {
116159
expect(NavigateAction.appliesTo({})).toBeFalsy();
117160
expect(NavigateAction.appliesTo({

platform/commonUI/dialog/res/templates/overlay.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
this source code distribution or the Licensing information page available
2020
at runtime from the About dialog for additional information.
2121
-->
22-
<div class="abs overlay">
22+
<div class="abs overlay" ng-class="{'delayEntry100ms' : ngModel.delay}">
2323
<div class="abs blocker"></div>
2424
<div class="abs holder">
2525
<a ng-click="ngModel.cancel()"

platform/commonUI/dialog/src/DialogService.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ define(
187187

188188
/**
189189
* A description of the model options that may be passed to the
190-
* showBlockingMessage method. Note that the DialogModel desribed
190+
* showBlockingMessage method. Note that the DialogModel described
191191
* here is shared with the Notifications framework.
192192
* @see NotificationService
193193
*
@@ -200,6 +200,9 @@ define(
200200
* shown above a progress bar to indicate what's happening.
201201
* @property {number} progress a percentage value (1-100)
202202
* indicating the completion of the blocking task
203+
* @property {boolean} delay adds a brief delay before loading
204+
* the dialog. Useful for removing the dialog flicker when the
205+
* conditions for displaying the dialog change rapidly.
203206
* @property {string} progressText the message to show below a
204207
* progress bar to indicate progress. For example, this might be
205208
* used to indicate time remaining, or items still to process.

platform/commonUI/edit/bundle.js

+21-8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ define([
3131
"./src/actions/PropertiesAction",
3232
"./src/actions/RemoveAction",
3333
"./src/actions/SaveAction",
34+
"./src/actions/SaveAndStopEditingAction",
3435
"./src/actions/SaveAsAction",
3536
"./src/actions/CancelAction",
3637
"./src/policies/EditActionPolicy",
@@ -70,6 +71,7 @@ define([
7071
PropertiesAction,
7172
RemoveAction,
7273
SaveAction,
74+
SaveAndStopEditingAction,
7375
SaveAsAction,
7476
CancelAction,
7577
EditActionPolicy,
@@ -202,21 +204,31 @@ define([
202204
"navigationService"
203205
]
204206
},
207+
{
208+
"key": "save-and-stop-editing",
209+
"category": "save",
210+
"implementation": SaveAndStopEditingAction,
211+
"name": "Save and Finish Editing",
212+
"cssclass": "icon-save labeled",
213+
"description": "Save changes made to these objects.",
214+
"depends": [
215+
"dialogService"
216+
]
217+
},
205218
{
206219
"key": "save",
207-
"category": "conclude-editing",
220+
"category": "save",
208221
"implementation": SaveAction,
209-
"name": "Save",
222+
"name": "Save and Continue Editing",
210223
"cssclass": "icon-save labeled",
211224
"description": "Save changes made to these objects.",
212225
"depends": [
213226
"dialogService"
214-
],
215-
"priority": "mandatory"
227+
]
216228
},
217229
{
218-
"key": "save",
219-
"category": "conclude-editing",
230+
"key": "save-as",
231+
"category": "save",
220232
"implementation": SaveAsAction,
221233
"name": "Save As...",
222234
"cssclass": "icon-save labeled",
@@ -225,7 +237,6 @@ define([
225237
"$injector",
226238
"policyService",
227239
"dialogService",
228-
"creationService",
229240
"copyService"
230241
],
231242
"priority": "mandatory"
@@ -234,7 +245,9 @@ define([
234245
"key": "cancel",
235246
"category": "conclude-editing",
236247
"implementation": CancelAction,
237-
"name": "Cancel",
248+
// Because we use the name as label for edit buttons and mct-control buttons need
249+
// the label to be set to undefined in order to not apply the labeled CSS rule.
250+
"name": undefined,
238251
"cssclass": "icon-x no-label",
239252
"description": "Discard changes made to these objects.",
240253
"depends": []

platform/commonUI/edit/res/templates/edit-action-buttons.html

+29-7
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,34 @@
2020
at runtime from the About dialog for additional information.
2121
-->
2222
<span ng-controller="EditActionController">
23-
<span ng-repeat="currentAction in editActions">
24-
<a class='s-button {{currentAction.getMetadata().cssclass}}'
25-
title='{{currentAction.getMetadata().name}}'
26-
ng-click="currentAction.perform()"
27-
ng-class="{ major: $index === 0 }">
28-
<span class="title-label">{{currentAction.getMetadata().name}}</span>
29-
</a>
23+
<!-- If there's a single save action show a button, otherwise show a dropdown with all save actions. -->
24+
<span ng-if="saveActions.length === 1">
25+
<mct-control key="'button'"
26+
structure="{
27+
text: saveActions[0].getMetadata().name,
28+
click: actionPerformer(saveActions[0]),
29+
cssclass: 'major ' + saveActions[0].getMetadata().cssclass
30+
}">
31+
</mct-control>
32+
</span>
33+
34+
<span ng-if="saveActions.length > 1">
35+
<mct-control key="'menu-button'"
36+
structure="{
37+
options: saveActionsAsMenuOptions,
38+
click: saveActionMenuClickHandler,
39+
cssclass: 'btn-bar right icon-save no-label major'
40+
}">
41+
</mct-control>
42+
</span>
43+
44+
<span ng-repeat="currentAction in otherEditActions">
45+
<mct-control key="'button'"
46+
structure="{
47+
text: currentAction.getMetadata().name,
48+
click: actionPerformer(currentAction),
49+
cssclass: currentAction.getMetadata().cssclass
50+
}">
51+
</mct-control>
3052
</span>
3153
</span>

platform/commonUI/edit/src/actions/CancelAction.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ define(
6262
}
6363

6464
function cancel(allowed) {
65-
return allowed && domainObject.getCapability("editor").cancel();
65+
return allowed && domainObject.getCapability("editor").finish();
6666
}
6767

6868
//Do navigation first in order to trigger unsaved changes dialog

platform/commonUI/edit/src/actions/EditAction.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,13 @@ define(
6969
* Enter edit mode.
7070
*/
7171
EditAction.prototype.perform = function () {
72-
var self = this;
73-
function cancelEditing() {
74-
self.domainObject.getCapability('editor').cancel();
75-
self.navigationService.removeListener(cancelEditing);
76-
}
72+
7773
//If this is not the currently navigated object, then navigate
7874
// to it.
7975
if (this.navigationService.getNavigation() !== this.domainObject) {
8076
this.navigationService.setNavigation(this.domainObject);
8177
}
8278

83-
this.navigationService.addListener(cancelEditing);
8479
this.domainObject.useCapability("editor");
8580
};
8681

0 commit comments

Comments
 (0)