Skip to content

Commit

Permalink
Merged from open1182
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Oct 7, 2016
2 parents 51a9557 + b384e84 commit b995a8b
Show file tree
Hide file tree
Showing 93 changed files with 646 additions and 298 deletions.
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"zepto": "^1.1.6",
"eventemitter3": "^1.2.0",
"d3": "~4.1.0",
"html2canvas": "^0.4.1",
"jspdf": "^1.2.61"
"html2canvas": "^0.4.1"
}
}
2 changes: 1 addition & 1 deletion build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WEBSITE_DIRECTORY="website"
BUILD_SHA=`git rev-parse HEAD`

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

Expand Down
2 changes: 1 addition & 1 deletion docs/src/architecture/platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ follows:
part of an action's extension definition.
* `CreateActionProvider` provides the various Create actions which
populate the Create menu. These are driven by the available types,
so do not map easily ot extension category `actions`; instead, these
so do not map easily to extension category `actions`; instead, these
are generated after looking up which actions are available from the
[`TypeService`](#type-service).
* `ActionAggregator` merges together actions from multiple providers.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/design/proposals/APIRedesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Worked on bug fixes in the platform and a plugin for search.
It is hard to figure out what the difference between the various ways of
dealing with telemetry are. e.g., what is the difference between just
"Telemetry" and the "Telemetry Service"? There are many
"Telemetry Thing"s which seem related, but in an unclear way.
"Telemetry Things" which seem related, but in an unclear way.

### Developer Intern 2

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

The platform would then additionally expose an `AngularView`
implementation to improve compatibility with existing
Expand Down
2 changes: 1 addition & 1 deletion docs/src/design/proposals/APIRedesign_PeteRichards.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ To reduce interface depth, we can replace our own provider and registry patterns

## More angular: for all services

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

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

Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3238,7 +3238,7 @@ define(
__tutorials/telemetry/src/ExampleTelemetryServerAdapter.js__

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

Expand Down
2 changes: 1 addition & 1 deletion example/eventGenerator/data/transcript.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"LMP: 47 degrees.",
"CC: Eagle, looking great. You're GO.",
"CC: Roger. 1202. We copy it.",
"O1: LMP 35 degrees. 35 degrees. 750. Coming aown to 23.fl",
"O1: LMP 35 degrees. 35 degrees. 750. Coming down to 23.fl",
"LMP: 700 feet, 21 down, 33 degrees.",
"LMP: 600 feet, down at 19.",
"LMP: 540 feet, down at - 30. Down at 15.",
Expand Down
4 changes: 0 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ requirejs.config({
"EventEmitter": "bower_components/eventemitter3/index",
"es6-promise": "bower_components/es6-promise/es6-promise.min",
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
"jsPDF": "bower_components/jspdf/dist/jspdf.min",
"moment": "bower_components/moment/moment",
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
"saveAs": "bower_components/FileSaver.js/FileSaver.min",
Expand All @@ -50,9 +49,6 @@ requirejs.config({
"html2canvas": {
"exports": "html2canvas"
},
"jsPDF": {
"exports": "jsPDF"
},
"EventEmitter": {
"exports": "EventEmitter"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openmct",
"version": "0.11.3-SNAPSHOT",
"version": "0.12.0-SNAPSHOT",
"description": "The Open MCT core platform",
"dependencies": {
"express": "^4.13.1",
Expand Down
27 changes: 21 additions & 6 deletions platform/commonUI/browse/src/navigation/NavigateAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,35 @@ define(
*/
NavigateAction.prototype.perform = function () {
var self = this,
navigationAllowed = true;
navigateTo = this.domainObject,
currentObject = self.navigationService.getNavigation();

function allow() {
self.policyService.allow("navigation", self.navigationService.getNavigation(), self.domainObject, function (message) {
var navigationAllowed = true;
self.policyService.allow("navigation", currentObject, navigateTo, function (message) {
navigationAllowed = self.$window.confirm(message + "\r\n\r\n" +
" Are you sure you want to continue?");
});
return navigationAllowed;
}

// Set navigation, and wrap like a promise
return this.$q.when(
allow() && this.navigationService.setNavigation(this.domainObject)
);
function cancelIfEditing() {
var editing = currentObject.hasCapability('editor') &&
currentObject.getCapability('editor').isEditContextRoot();

return self.$q.when(editing && currentObject.getCapability("editor").finish());
}

function navigate() {
return self.navigationService.setNavigation(navigateTo);
}

if (allow()) {
return cancelIfEditing().then(navigate);
} else {
return this.$q.when(false);
}

};

/**
Expand Down
49 changes: 46 additions & 3 deletions platform/commonUI/browse/test/navigation/NavigateActionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ define(
mockQ,
mockDomainObject,
mockPolicyService,
mockNavigatedObject,
mockWindow,
capabilities,
action;

function mockPromise(value) {
Expand All @@ -44,18 +46,44 @@ define(
}

beforeEach(function () {
capabilities = {};

mockQ = { when: mockPromise };
mockNavigatedObject = jasmine.createSpyObj(
"domainObject",
[
"getId",
"getModel",
"hasCapability",
"getCapability"
]
);

capabilities.editor = jasmine.createSpyObj("editorCapability", [
"isEditContextRoot",
"finish"
]);

mockNavigatedObject.getCapability.andCallFake(function (capability) {
return capabilities[capability];
});
mockNavigatedObject.hasCapability.andReturn(false);

mockNavigationService = jasmine.createSpyObj(
"navigationService",
[
"setNavigation",
"getNavigation"
]
);
mockNavigationService.getNavigation.andReturn({});
mockQ = { when: mockPromise };
mockNavigationService.getNavigation.andReturn(mockNavigatedObject);

mockDomainObject = jasmine.createSpyObj(
"domainObject",
["getId", "getModel", "getCapability"]
[
"getId",
"getModel"
]
);

mockPolicyService = jasmine.createSpyObj("policyService",
Expand Down Expand Up @@ -112,6 +140,21 @@ define(
});
});

describe("in edit mode", function () {
beforeEach(function () {
mockNavigatedObject.hasCapability.andCallFake(function (capability) {
return capability === "editor";
});
capabilities.editor.isEditContextRoot.andReturn(true);
});

it("finishes editing if in edit mode", function () {
action.perform();
expect(capabilities.editor.finish)
.toHaveBeenCalled();
});
});

it("is only applicable when a domain object is in context", function () {
expect(NavigateAction.appliesTo({})).toBeFalsy();
expect(NavigateAction.appliesTo({
Expand Down
2 changes: 1 addition & 1 deletion platform/commonUI/dialog/res/templates/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<div class="abs overlay">
<div class="abs overlay" ng-class="{'delayEntry100ms' : ngModel.delay}">
<div class="abs blocker"></div>
<div class="abs holder">
<a ng-click="ngModel.cancel()"
Expand Down
5 changes: 4 additions & 1 deletion platform/commonUI/dialog/src/DialogService.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ define(

/**
* A description of the model options that may be passed to the
* showBlockingMessage method. Note that the DialogModel desribed
* showBlockingMessage method. Note that the DialogModel described
* here is shared with the Notifications framework.
* @see NotificationService
*
Expand All @@ -200,6 +200,9 @@ define(
* shown above a progress bar to indicate what's happening.
* @property {number} progress a percentage value (1-100)
* indicating the completion of the blocking task
* @property {boolean} delay adds a brief delay before loading
* the dialog. Useful for removing the dialog flicker when the
* conditions for displaying the dialog change rapidly.
* @property {string} progressText the message to show below a
* progress bar to indicate progress. For example, this might be
* used to indicate time remaining, or items still to process.
Expand Down
29 changes: 21 additions & 8 deletions platform/commonUI/edit/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ define([
"./src/actions/PropertiesAction",
"./src/actions/RemoveAction",
"./src/actions/SaveAction",
"./src/actions/SaveAndStopEditingAction",
"./src/actions/SaveAsAction",
"./src/actions/CancelAction",
"./src/policies/EditActionPolicy",
Expand Down Expand Up @@ -70,6 +71,7 @@ define([
PropertiesAction,
RemoveAction,
SaveAction,
SaveAndStopEditingAction,
SaveAsAction,
CancelAction,
EditActionPolicy,
Expand Down Expand Up @@ -202,21 +204,31 @@ define([
"navigationService"
]
},
{
"key": "save-and-stop-editing",
"category": "save",
"implementation": SaveAndStopEditingAction,
"name": "Save and Finish Editing",
"cssclass": "icon-save labeled",
"description": "Save changes made to these objects.",
"depends": [
"dialogService"
]
},
{
"key": "save",
"category": "conclude-editing",
"category": "save",
"implementation": SaveAction,
"name": "Save",
"name": "Save and Continue Editing",
"cssclass": "icon-save labeled",
"description": "Save changes made to these objects.",
"depends": [
"dialogService"
],
"priority": "mandatory"
]
},
{
"key": "save",
"category": "conclude-editing",
"key": "save-as",
"category": "save",
"implementation": SaveAsAction,
"name": "Save As...",
"cssclass": "icon-save labeled",
Expand All @@ -225,7 +237,6 @@ define([
"$injector",
"policyService",
"dialogService",
"creationService",
"copyService"
],
"priority": "mandatory"
Expand All @@ -234,7 +245,9 @@ define([
"key": "cancel",
"category": "conclude-editing",
"implementation": CancelAction,
"name": "Cancel",
// Because we use the name as label for edit buttons and mct-control buttons need
// the label to be set to undefined in order to not apply the labeled CSS rule.
"name": undefined,
"cssclass": "icon-x no-label",
"description": "Discard changes made to these objects.",
"depends": []
Expand Down
36 changes: 29 additions & 7 deletions platform/commonUI/edit/res/templates/edit-action-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,34 @@
at runtime from the About dialog for additional information.
-->
<span ng-controller="EditActionController">
<span ng-repeat="currentAction in editActions">
<a class='s-button {{currentAction.getMetadata().cssclass}}'
title='{{currentAction.getMetadata().name}}'
ng-click="currentAction.perform()"
ng-class="{ major: $index === 0 }">
<span class="title-label">{{currentAction.getMetadata().name}}</span>
</a>
<!-- If there's a single save action show a button, otherwise show a dropdown with all save actions. -->
<span ng-if="saveActions.length === 1">
<mct-control key="'button'"
structure="{
text: saveActions[0].getMetadata().name,
click: actionPerformer(saveActions[0]),
cssclass: 'major ' + saveActions[0].getMetadata().cssclass
}">
</mct-control>
</span>

<span ng-if="saveActions.length > 1">
<mct-control key="'menu-button'"
structure="{
options: saveActionsAsMenuOptions,
click: saveActionMenuClickHandler,
cssclass: 'btn-bar right icon-save no-label major'
}">
</mct-control>
</span>

<span ng-repeat="currentAction in otherEditActions">
<mct-control key="'button'"
structure="{
text: currentAction.getMetadata().name,
click: actionPerformer(currentAction),
cssclass: currentAction.getMetadata().cssclass
}">
</mct-control>
</span>
</span>
2 changes: 1 addition & 1 deletion platform/commonUI/edit/src/actions/CancelAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ define(
}

function cancel(allowed) {
return allowed && domainObject.getCapability("editor").cancel();
return allowed && domainObject.getCapability("editor").finish();
}

//Do navigation first in order to trigger unsaved changes dialog
Expand Down
7 changes: 1 addition & 6 deletions platform/commonUI/edit/src/actions/EditAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,13 @@ define(
* Enter edit mode.
*/
EditAction.prototype.perform = function () {
var self = this;
function cancelEditing() {
self.domainObject.getCapability('editor').cancel();
self.navigationService.removeListener(cancelEditing);
}

//If this is not the currently navigated object, then navigate
// to it.
if (this.navigationService.getNavigation() !== this.domainObject) {
this.navigationService.setNavigation(this.domainObject);
}

this.navigationService.addListener(cancelEditing);
this.domainObject.useCapability("editor");
};

Expand Down
Loading

0 comments on commit b995a8b

Please sign in to comment.