Compare commits
38 Commits
vista-r34.
...
plot-sync
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57abac96b2 | ||
|
|
204f6be9d0 | ||
|
|
c988c6c43b | ||
|
|
c143475f3e | ||
|
|
b248f57daa | ||
|
|
f4e8c5ecf6 | ||
|
|
11ef7c0ccd | ||
|
|
9c125e0454 | ||
|
|
439a654f6d | ||
|
|
9d32a3f1c3 | ||
|
|
705e25df8a | ||
|
|
787d6887dc | ||
|
|
1d516240a8 | ||
|
|
90ee0a309f | ||
|
|
72d05283da | ||
|
|
dc91a94f0e | ||
|
|
0243aa6584 | ||
|
|
e5d869f01e | ||
|
|
d4e3e6689c | ||
|
|
0363d0e8ad | ||
|
|
3669e776a9 | ||
|
|
5d3adc6a7f | ||
|
|
c1b2db848a | ||
|
|
5d19294c11 | ||
|
|
9b8d5f3f9c | ||
|
|
d03f323a9b | ||
|
|
54a453e5a0 | ||
|
|
14894cf197 | ||
|
|
0c6786198a | ||
|
|
6d077b775d | ||
|
|
144437a06e | ||
|
|
557cd91b21 | ||
|
|
39d3e92094 | ||
|
|
7529a86d01 | ||
|
|
d34e36831c | ||
|
|
aa8fa9168a | ||
|
|
3f1b7e0a87 | ||
|
|
5ec3b98d1c |
@@ -21,5 +21,6 @@
|
||||
"shadow": "outer",
|
||||
"strict": "implied",
|
||||
"undef": true,
|
||||
"unused": "vars"
|
||||
"unused": "vars",
|
||||
"latedef": "nofunc"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ and [`gulp`](http://gulpjs.com/).
|
||||
|
||||
To build Open MCT for deployment:
|
||||
|
||||
`npm run prepublish`
|
||||
`npm run prepare`
|
||||
|
||||
This will compile and minify JavaScript sources, as well as copy over assets.
|
||||
The contents of the `dist` folder will contain a runnable Open MCT
|
||||
|
||||
10
circle.yml
10
circle.yml
@@ -1,3 +1,11 @@
|
||||
machine:
|
||||
node:
|
||||
version: 4.7.0
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- npm install -g npm@latest
|
||||
|
||||
deployment:
|
||||
production:
|
||||
branch: master
|
||||
@@ -16,4 +24,4 @@ test:
|
||||
general:
|
||||
branches:
|
||||
ignore:
|
||||
- gh-pages
|
||||
- gh-pages
|
||||
@@ -2283,7 +2283,7 @@ To install build dependencies (only needs to be run once):
|
||||
|
||||
To build:
|
||||
|
||||
`npm run prepublish`
|
||||
`npm run prepare`
|
||||
|
||||
This will compile and minify JavaScript sources, as well as copy over assets.
|
||||
The contents of the `dist` folder will contain a runnable Open MCT
|
||||
|
||||
121
docs/src/guide/security.md
Normal file
121
docs/src/guide/security.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Security Guide
|
||||
|
||||
Open MCT is a rich client with plugin support that executes as a single page
|
||||
web application in a browser environment. Security concerns and
|
||||
vulnerabilities associated with the web as a platform should be considered
|
||||
before deploying Open MCT (or any other web application) for mission or
|
||||
production usage.
|
||||
|
||||
This document describes several important points to consider when developing
|
||||
for or deploying Open MCT securely. Other resources such as
|
||||
[Open Web Application Security Project (OWASP)](https://www.owasp.org)
|
||||
provide a deeper and more general overview of security for web applications.
|
||||
|
||||
|
||||
## Security Model
|
||||
|
||||
Open MCT has been architected assuming the following deployment pattern:
|
||||
|
||||
* A tagged, tested Open MCT version will be used.
|
||||
* Externally authored plugins will be installed.
|
||||
* A server will provide persistent storage, telemetry, and other shared data.
|
||||
* Authorization, authentication, and auditing will be handled by a server.
|
||||
|
||||
|
||||
## Security Procedures
|
||||
|
||||
The Open MCT team secures our code base using a combination of code review,
|
||||
dependency review, and periodic security reviews. Static analysis performed
|
||||
during automated verification additionally safeguards against common
|
||||
coding errors which may result in vulnerabilities.
|
||||
|
||||
|
||||
### Code Review
|
||||
|
||||
All contributions are reviewed by internal team members. External
|
||||
contributors receive increased scrutiny for security and quality,
|
||||
and must sign a licensing agreement.
|
||||
|
||||
### Dependency Review
|
||||
|
||||
Before integrating third-party dependencies, they are reviewed for security
|
||||
and quality, with consideration given to authors and users of these
|
||||
dependencies, as well as review of open source code.
|
||||
|
||||
### Periodic Security Reviews
|
||||
|
||||
Open MCT's code, design, and architecture are periodically reviewed
|
||||
(approximately annually) for common security issues, such as the
|
||||
[OWASP Top Ten](https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project).
|
||||
|
||||
|
||||
## Security Concerns
|
||||
|
||||
Certain security concerns deserve special attention when deploying Open MCT,
|
||||
or when authoring plugins.
|
||||
|
||||
### Identity Spoofing
|
||||
|
||||
Open MCT issues calls to web services with the privileges of a logged in user.
|
||||
Compromised sources (either for Open MCT itself or a plugin) could
|
||||
therefore allow malicious code to execute with those privileges.
|
||||
|
||||
To avoid this:
|
||||
|
||||
* Serve Open MCT and other scripts over SSL (https rather than http)
|
||||
to prevent man-in-the-middle attacks.
|
||||
* Exercise precautions such as security reviews for any plugins or
|
||||
applications built for or with Open MCT to reject malicious changes.
|
||||
|
||||
### Information Disclosure
|
||||
|
||||
If Open MCT is used to handle or display sensitive data, any components
|
||||
(such as adapter plugins) must take care to avoid leaking or disclosing
|
||||
this information. For example, avoid sending sensitive data to third-party
|
||||
servers or insecure APIs.
|
||||
|
||||
### Data Tampering
|
||||
|
||||
The web application architecture leaves open the possibility that direct
|
||||
calls will be made to back-end services, circumventing Open MCT entirely.
|
||||
As such, Open MCT assumes that server components will perform any necessary
|
||||
data validation during calls issues to the server.
|
||||
|
||||
Additionally, plugins which serialize and write data to the server must
|
||||
escape that data to avoid database injection attacks, and similar.
|
||||
|
||||
### Repudiation
|
||||
|
||||
Open MCT assumes that servers log any relevant interactions and associates
|
||||
these with a user identity; the specific user actions taken within the
|
||||
application are assumed not to be of concern for auditing.
|
||||
|
||||
In the absence of server-side logging, users may disclaim (maliciously,
|
||||
mistakenly, or otherwise) actions taken within the system without any
|
||||
way to prove otherwise.
|
||||
|
||||
If keeping client-level interactions is important, this will need to be
|
||||
implemented via a plugin.
|
||||
|
||||
### Denial-of-service
|
||||
|
||||
Open MCT assumes that server-side components will be insulated against
|
||||
denial-of-service attacks. Services should only permit resource-intensive
|
||||
tasks to be initiated by known or trusted users.
|
||||
|
||||
### Elevation of Privilege
|
||||
|
||||
Corollary to the assumption that servers guide against identity spoofing,
|
||||
Open MCT assumes that services do not allow a user to act with
|
||||
inappropriately escalated privileges. Open MCT cannot protect against
|
||||
such escalation; in the clearest case, a malicious actor could interact
|
||||
with web services directly to exploit such a vulnerability.
|
||||
|
||||
## Additional Reading
|
||||
|
||||
The following resources have been used as a basis for identifying potential
|
||||
security threats to Open MCT deployments in preparation of this document:
|
||||
|
||||
* [STRIDE model](https://www.owasp.org/index.php/Threat_Risk_Modeling#STRIDE)
|
||||
* [Attack Surface Analysis Cheat Sheet](https://www.owasp.org/index.php/Attack_Surface_Analysis_Cheat_Sheet)
|
||||
* [XSS Prevention Cheat Sheet](https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet)
|
||||
@@ -215,8 +215,6 @@ define([
|
||||
{
|
||||
key: "sin",
|
||||
name: "Sine",
|
||||
format: 'printf',
|
||||
sprintf: '%0.2f',
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
@@ -224,8 +222,6 @@ define([
|
||||
{
|
||||
key: "cos",
|
||||
name: "Cosine",
|
||||
format: 'printf',
|
||||
sprintf: '%0.2f',
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
/*global require,__dirname*/
|
||||
|
||||
require("v8-compile-cache");
|
||||
|
||||
var gulp = require('gulp'),
|
||||
sourcemaps = require('gulp-sourcemaps'),
|
||||
path = require('path'),
|
||||
@@ -177,4 +179,4 @@ gulp.task('install', [ 'assets', 'scripts' ]);
|
||||
|
||||
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
|
||||
|
||||
gulp.task('build', [ 'verify', 'install' ]);
|
||||
gulp.task('build', [ 'verify', 'install' ]);
|
||||
@@ -89,7 +89,8 @@ module.exports = function(config) {
|
||||
"dist/reports/coverage",
|
||||
check: {
|
||||
global: {
|
||||
lines: 80
|
||||
lines: 80,
|
||||
excludes: ['src/plugins/plot/**/*.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ requirejs.config({
|
||||
"vue": "node_modules/vue/dist/vue.min",
|
||||
"zepto": "bower_components/zepto/zepto.min",
|
||||
"lodash": "bower_components/lodash/lodash",
|
||||
"d3-selection": "node_modules/d3-selection/build/d3-selection.min",
|
||||
"d3-selection": "node_modules/d3-selection/dist/d3-selection.min",
|
||||
"d3-scale": "node_modules/d3-scale/build/d3-scale.min",
|
||||
"d3-axis": "node_modules/d3-axis/build/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/build/d3-array.min",
|
||||
@@ -49,8 +49,7 @@ requirejs.config({
|
||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||
"printj": "node_modules/printj/dist/printj.min"
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min"
|
||||
},
|
||||
"shim": {
|
||||
"angular": {
|
||||
@@ -102,6 +101,7 @@ define([
|
||||
var openmct = new MCT();
|
||||
|
||||
openmct.legacyRegistry = defaultRegistry;
|
||||
openmct.install(openmct.plugins.Plot());
|
||||
|
||||
if (typeof BUILD_CONSTANTS !== 'undefined') {
|
||||
openmct.install(buildInfo(BUILD_CONSTANTS));
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.11.1",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"printj": "^1.1.0",
|
||||
"requirejs": "2.1.x",
|
||||
"split": "^1.0.0"
|
||||
"split": "^1.0.0",
|
||||
"v8-compile-cache": "^1.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
@@ -61,7 +61,7 @@
|
||||
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
||||
"otherdoc": "node docs/gendocs.js --in docs/src --out dist/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
|
||||
"docs": "npm run jsdoc ; npm run otherdoc",
|
||||
"prepublish": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
|
||||
"prepare": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -28,16 +28,6 @@ define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
function isDirty(domainObject) {
|
||||
var navigatedObject = domainObject,
|
||||
editorCapability = navigatedObject &&
|
||||
navigatedObject.getCapability("editor");
|
||||
|
||||
return editorCapability &&
|
||||
editorCapability.isEditContextRoot() &&
|
||||
editorCapability.dirty();
|
||||
}
|
||||
|
||||
function cancelEditing(domainObject) {
|
||||
var navigatedObject = domainObject,
|
||||
editorCapability = navigatedObject &&
|
||||
@@ -59,10 +49,7 @@ define(
|
||||
|
||||
var removeCheck = navigationService
|
||||
.checkBeforeNavigation(function () {
|
||||
if (isDirty(domainObject)) {
|
||||
return "Continuing will cause the loss of any unsaved changes.";
|
||||
}
|
||||
return false;
|
||||
return "Continuing will cause the loss of any unsaved changes.";
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
|
||||
@@ -52,8 +52,22 @@ define(
|
||||
}
|
||||
|
||||
function setSelection(selection) {
|
||||
self.scope.selection = selection;
|
||||
self.refreshComposition(selection);
|
||||
if (!selection[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.mutationListener) {
|
||||
self.mutationListener();
|
||||
delete self.mutationListener;
|
||||
}
|
||||
|
||||
var domainObject = selection[0].context.oldItem;
|
||||
self.refreshComposition(domainObject);
|
||||
|
||||
if (domainObject) {
|
||||
self.mutationListener = domainObject.getCapability('mutation')
|
||||
.listen(self.refreshComposition.bind(self, domainObject));
|
||||
}
|
||||
}
|
||||
|
||||
$scope.filterBy = filterBy;
|
||||
@@ -70,15 +84,11 @@ define(
|
||||
/**
|
||||
* Gets the composition for the selected object and populates the scope with it.
|
||||
*
|
||||
* @param selection the selection object
|
||||
* @param domainObject the selected object
|
||||
* @private
|
||||
*/
|
||||
ElementsController.prototype.refreshComposition = function (selection) {
|
||||
if (!selection[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedObjectComposition = selection[0].context.oldItem.useCapability('composition');
|
||||
ElementsController.prototype.refreshComposition = function (domainObject) {
|
||||
var selectedObjectComposition = domainObject && domainObject.useCapability('composition');
|
||||
|
||||
if (selectedObjectComposition) {
|
||||
selectedObjectComposition.then(function (composition) {
|
||||
|
||||
@@ -44,11 +44,17 @@ define(
|
||||
this.selectedObj = undefined;
|
||||
|
||||
openmct.selection.on('change', function (selection) {
|
||||
if (selection[0] && selection[0].context.toolbar) {
|
||||
this.select(selection[0].context.toolbar);
|
||||
var selected = selection[0];
|
||||
|
||||
if (selected && selected.context.toolbar) {
|
||||
this.select(selected.context.toolbar);
|
||||
} else {
|
||||
this.deselect();
|
||||
}
|
||||
|
||||
if (selected && selected.context.viewProxy) {
|
||||
this.proxy(selected.context.viewProxy);
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -104,10 +104,10 @@ define(
|
||||
mockEditorCapability.isEditContextRoot.andReturn(false);
|
||||
mockEditorCapability.dirty.andReturn(false);
|
||||
|
||||
expect(checkFn()).toBe(false);
|
||||
expect(checkFn()).toBe("Continuing will cause the loss of any unsaved changes.");
|
||||
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
expect(checkFn()).toBe(false);
|
||||
expect(checkFn()).toBe("Continuing will cause the loss of any unsaved changes.");
|
||||
|
||||
mockEditorCapability.dirty.andReturn(true);
|
||||
expect(checkFn())
|
||||
|
||||
@@ -29,9 +29,25 @@ define(
|
||||
var mockScope,
|
||||
mockOpenMCT,
|
||||
mockSelection,
|
||||
mockDomainObject,
|
||||
mockMutationCapability,
|
||||
mockUnlisten,
|
||||
selectable = [],
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockUnlisten = jasmine.createSpy('unlisten');
|
||||
mockMutationCapability = jasmine.createSpyObj("mutationCapability", [
|
||||
"listen"
|
||||
]);
|
||||
mockMutationCapability.listen.andReturn(mockUnlisten);
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", [
|
||||
"getCapability",
|
||||
"useCapability"
|
||||
]);
|
||||
mockDomainObject.useCapability.andCallThrough();
|
||||
mockDomainObject.getCapability.andReturn(mockMutationCapability);
|
||||
|
||||
mockScope = jasmine.createSpyObj("$scope", ['$on']);
|
||||
mockSelection = jasmine.createSpyObj("selection", [
|
||||
'on',
|
||||
@@ -43,6 +59,14 @@ define(
|
||||
selection: mockSelection
|
||||
};
|
||||
|
||||
selectable[0] = {
|
||||
context: {
|
||||
oldItem: mockDomainObject
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(ElementsController.prototype, 'refreshComposition');
|
||||
|
||||
controller = new ElementsController(mockScope, mockOpenMCT);
|
||||
});
|
||||
|
||||
@@ -75,6 +99,44 @@ define(
|
||||
expect(objects.filter(mockScope.searchElements).length).toBe(4);
|
||||
});
|
||||
|
||||
it("refreshes composition on selection", function () {
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(ElementsController.prototype.refreshComposition).toHaveBeenCalledWith(mockDomainObject);
|
||||
});
|
||||
|
||||
it("listens on mutation and refreshes composition", function () {
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(mockDomainObject.getCapability).toHaveBeenCalledWith('mutation');
|
||||
expect(mockMutationCapability.listen).toHaveBeenCalled();
|
||||
expect(ElementsController.prototype.refreshComposition.calls.length).toBe(1);
|
||||
|
||||
mockMutationCapability.listen.mostRecentCall.args[0](mockDomainObject);
|
||||
|
||||
expect(ElementsController.prototype.refreshComposition.calls.length).toBe(2);
|
||||
});
|
||||
|
||||
it("cleans up mutation listener when selection changes", function () {
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(mockMutationCapability.listen).toHaveBeenCalled();
|
||||
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(mockUnlisten).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not listen on mutation for element proxy selectable", function () {
|
||||
selectable[0] = {
|
||||
context: {
|
||||
elementProxy: {}
|
||||
}
|
||||
};
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(mockDomainObject.getCapability).not.toHaveBeenCalledWith('mutation');
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
$ohH: $btnFrameH;
|
||||
$bc: $colorInteriorBorder;
|
||||
&.child-frame.panel {
|
||||
border: 1px solid transparent;
|
||||
z-index: 0; // Needed to prevent child-frame controls from showing through when another child-frame is above
|
||||
&:not(.no-frame) {
|
||||
background: $colorBodyBg;
|
||||
@@ -91,7 +90,7 @@
|
||||
|
||||
&.no-frame {
|
||||
background: transparent !important;
|
||||
border: none;
|
||||
border-color: transparent;
|
||||
.object-browse-bar .right {
|
||||
$m: 0;
|
||||
background: rgba(black, 0.3);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
.s-hover-border {
|
||||
border: 1px solid transparent;
|
||||
&:hover {
|
||||
border-color: rgba($colorSelectableSelectedPrimary, 0.5) !important;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ define(
|
||||
options = Object.create(OPTIONS);
|
||||
options.marginX = -bubbleSpaceLR;
|
||||
|
||||
// prevent bubble from appearing right under pointer,
|
||||
// which causes hover callback to be called multiple times
|
||||
options.offsetX = 1;
|
||||
|
||||
// On a phone, bubble takes up more screen real estate,
|
||||
// so position it differently (toward the bottom)
|
||||
if (this.agentService.isPhone()) {
|
||||
|
||||
@@ -50,7 +50,11 @@ define(
|
||||
view.show(container);
|
||||
} else {
|
||||
self.providerView = false;
|
||||
$scope.inspectorKey = selection[0].context.oldItem.getCapability("type").typeDef.inspector;
|
||||
var selectedItem = selection[0].context.oldItem;
|
||||
|
||||
if (selectedItem) {
|
||||
$scope.inspectorKey = selectedItem.getCapability("type").typeDef.inspector;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,8 @@ define([
|
||||
"$scope",
|
||||
"$q",
|
||||
"dialogService",
|
||||
"openmct"
|
||||
"openmct",
|
||||
"$element"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
ng-controller="FixedController as controller">
|
||||
|
||||
<!-- Background grid -->
|
||||
<div class="l-grid-holder" ng-click="controller.clearSelection()">
|
||||
<div class="l-grid-holder" ng-click="controller.bypassSelection($event)">
|
||||
<div class="l-grid l-grid-x"
|
||||
ng-if="!controller.getGridSize()[0] < 3"
|
||||
ng-style="{ 'background-size': controller.getGridSize() [0] + 'px 100%' }"></div>
|
||||
@@ -35,35 +35,28 @@
|
||||
<!-- Fixed position elements -->
|
||||
<div ng-repeat="element in controller.getElements()"
|
||||
class="l-fixed-position-item s-selectable s-moveable s-hover-border"
|
||||
ng-class="{
|
||||
's-not-selected': controller.selected() && !controller.selected(element),
|
||||
's-selected': controller.selected(element)
|
||||
}"
|
||||
ng-style="element.style"
|
||||
ng-click="controller.select(element, $event)">
|
||||
mct-selectable="controller.getContext(element)"
|
||||
mct-init-select="controller.shouldSelect(element)">
|
||||
<mct-include key="element.template"
|
||||
parameters="{ gridSize: controller.getGridSize() }"
|
||||
ng-model="element">
|
||||
</mct-include>
|
||||
</mct-include>
|
||||
</div>
|
||||
|
||||
<!-- Selection highlight, handles -->
|
||||
<span class="s-selected s-moveable" ng-if="controller.selected()">
|
||||
<span class="s-selected s-moveable" ng-if="controller.isElementSelected()">
|
||||
<div class="l-fixed-position-item t-edit-handle-holder"
|
||||
mct-drag-down="controller.moveHandle().startDrag(controller.selected())"
|
||||
mct-drag-down="controller.moveHandle().startDrag()"
|
||||
mct-drag="controller.moveHandle().continueDrag(delta)"
|
||||
mct-drag-up="controller.moveHandle().endDrag()"
|
||||
ng-style="controller.selected().style"
|
||||
ng-click="$event.stopPropagation()">
|
||||
mct-drag-up="controller.endDrag()"
|
||||
ng-style="controller.getSelectedElementStyle()">
|
||||
</div>
|
||||
<div ng-repeat="handle in controller.handles()"
|
||||
class="l-fixed-position-item-handle edit-corner"
|
||||
ng-style="handle.style()"
|
||||
mct-drag-down="handle.startDrag()"
|
||||
mct-drag="handle.continueDrag(delta)"
|
||||
mct-drag-up="handle.endDrag()"
|
||||
ng-click="$event.stopPropagation()">
|
||||
mct-drag-up="controller.endDrag(handle)">
|
||||
</div>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@ define(
|
||||
* @constructor
|
||||
* @param {Scope} $scope the controller's Angular scope
|
||||
*/
|
||||
function FixedController($scope, $q, dialogService, openmct) {
|
||||
function FixedController($scope, $q, dialogService, openmct, $element) {
|
||||
this.names = {}; // Cache names by ID
|
||||
this.values = {}; // Cache values by ID
|
||||
this.elementProxiesById = {};
|
||||
@@ -55,9 +55,11 @@ define(
|
||||
this.telemetryObjects = [];
|
||||
this.subscriptions = [];
|
||||
this.openmct = openmct;
|
||||
this.$element = $element;
|
||||
this.$scope = $scope;
|
||||
|
||||
this.gridSize = $scope.domainObject && $scope.domainObject.getModel().layoutGrid;
|
||||
this.fixedViewSelectable = false;
|
||||
|
||||
var self = this;
|
||||
[
|
||||
@@ -87,9 +89,8 @@ define(
|
||||
|
||||
// Update the style for a selected element
|
||||
function updateSelectionStyle() {
|
||||
var element = self.selection && self.selection.get();
|
||||
if (element) {
|
||||
element.style = convertPosition(element);
|
||||
if (self.selectedElementProxy) {
|
||||
self.selectedElementProxy.style = convertPosition(self.selectedElementProxy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,25 +137,19 @@ define(
|
||||
|
||||
// Decorate elements in the current configuration
|
||||
function refreshElements() {
|
||||
// Cache selection; we are instantiating new proxies
|
||||
// so we may want to restore this.
|
||||
var selected = self.selection && self.selection.get(),
|
||||
elements = (($scope.configuration || {}).elements || []),
|
||||
index = -1; // Start with a 'not-found' value
|
||||
|
||||
// Find the selection in the new array
|
||||
if (selected !== undefined) {
|
||||
index = elements.indexOf(selected.element);
|
||||
}
|
||||
var elements = (($scope.configuration || {}).elements || []);
|
||||
|
||||
// Create the new proxies...
|
||||
self.elementProxies = elements.map(makeProxyElement);
|
||||
|
||||
// Clear old selection, and restore if appropriate
|
||||
if (self.selection) {
|
||||
self.selection.deselect();
|
||||
if (index > -1) {
|
||||
self.select(self.elementProxies[index]);
|
||||
// If selection is not in array, select parent.
|
||||
// Otherwise, set the element to select after refresh.
|
||||
if (self.selectedElementProxy) {
|
||||
var index = elements.indexOf(self.selectedElementProxy.element);
|
||||
if (index === -1) {
|
||||
self.$element[0].click();
|
||||
} else if (!self.elementToSelectAfterRefresh) {
|
||||
self.elementToSelectAfterRefresh = self.elementProxies[index].element;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,12 +219,12 @@ define(
|
||||
$scope.configuration.elements || [];
|
||||
// Store the position of this element.
|
||||
$scope.configuration.elements.push(element);
|
||||
|
||||
self.elementToSelectAfterRefresh = element;
|
||||
|
||||
// Refresh displayed elements
|
||||
refreshElements();
|
||||
// Select the newly-added element
|
||||
self.select(
|
||||
self.elementProxies[self.elementProxies.length - 1]
|
||||
);
|
||||
|
||||
// Mark change as persistable
|
||||
if ($scope.commit) {
|
||||
$scope.commit("Dropped an element.");
|
||||
@@ -263,21 +258,36 @@ define(
|
||||
self.getTelemetry($scope.domainObject);
|
||||
}
|
||||
|
||||
// Sets the selectable object in response to the selection change event.
|
||||
function setSelection(selectable) {
|
||||
var selection = selectable[0];
|
||||
|
||||
if (!selection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.context.elementProxy) {
|
||||
self.selectedElementProxy = selection.context.elementProxy;
|
||||
self.mvHandle = self.generateDragHandle(self.selectedElementProxy);
|
||||
self.resizeHandles = self.generateDragHandles(self.selectedElementProxy);
|
||||
} else {
|
||||
// Make fixed view selectable if it's not already.
|
||||
if (!self.fixedViewSelectable && selectable.length === 1) {
|
||||
self.fixedViewSelectable = true;
|
||||
selection.context.viewProxy = new FixedProxy(addElement, $q, dialogService);
|
||||
self.openmct.selection.select(selection);
|
||||
}
|
||||
|
||||
self.resizeHandles = [];
|
||||
self.mvHandle = undefined;
|
||||
self.selectedElementProxy = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
this.elementProxies = [];
|
||||
this.generateDragHandle = generateDragHandle;
|
||||
this.generateDragHandles = generateDragHandles;
|
||||
|
||||
// Track current selection state
|
||||
$scope.$watch("selection", function (selection) {
|
||||
this.selection = selection;
|
||||
|
||||
// Expose the view's selection proxy
|
||||
if (this.selection) {
|
||||
this.selection.proxy(
|
||||
new FixedProxy(addElement, $q, dialogService)
|
||||
);
|
||||
}
|
||||
}.bind(this));
|
||||
this.updateSelectionStyle = updateSelectionStyle;
|
||||
|
||||
// Detect changes to grid size
|
||||
$scope.$watch("model.layoutGrid", updateElementPositions);
|
||||
@@ -298,10 +308,13 @@ define(
|
||||
$scope.$on("$destroy", function () {
|
||||
self.unsubscribe();
|
||||
self.openmct.time.off("bounds", updateDisplayBounds);
|
||||
self.openmct.selection.off("change", setSelection);
|
||||
});
|
||||
|
||||
// Respond to external bounds changes
|
||||
this.openmct.time.on("bounds", updateDisplayBounds);
|
||||
this.openmct.selection.on('change', setSelection);
|
||||
this.$element.on('click', this.bypassSelection.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -492,42 +505,56 @@ define(
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the element is currently selected, or (if no
|
||||
* argument is supplied) get the currently selected element.
|
||||
* @returns {boolean} true if selected
|
||||
* Checks if the element should be selected or not.
|
||||
*
|
||||
* @param elementProxy the element to check
|
||||
* @returns {boolean} true if the element should be selected.
|
||||
*/
|
||||
FixedController.prototype.selected = function (element) {
|
||||
var selection = this.selection;
|
||||
return selection && ((arguments.length > 0) ?
|
||||
selection.selected(element) : selection.get());
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the active user selection in this view.
|
||||
* @param element the element to select
|
||||
*/
|
||||
FixedController.prototype.select = function select(element, event) {
|
||||
if (event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
if (this.selection) {
|
||||
// Update selection...
|
||||
this.selection.select(element);
|
||||
// ...as well as move, resize handles
|
||||
this.mvHandle = this.generateDragHandle(element);
|
||||
this.resizeHandles = this.generateDragHandles(element);
|
||||
FixedController.prototype.shouldSelect = function (elementProxy) {
|
||||
if (elementProxy.element === this.elementToSelectAfterRefresh) {
|
||||
delete this.elementToSelectAfterRefresh;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the current user selection.
|
||||
* Checks if an element is currently selected.
|
||||
*
|
||||
* @returns {boolean} true if an element is selected.
|
||||
*/
|
||||
FixedController.prototype.clearSelection = function () {
|
||||
if (this.selection) {
|
||||
this.selection.deselect();
|
||||
this.resizeHandles = [];
|
||||
this.mvHandle = undefined;
|
||||
FixedController.prototype.isElementSelected = function () {
|
||||
return (this.selectedElementProxy) ? true : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the style for the selected element.
|
||||
*
|
||||
* @returns {string} element style
|
||||
*/
|
||||
FixedController.prototype.getSelectedElementStyle = function () {
|
||||
return (this.selectedElementProxy) ? this.selectedElementProxy.style : undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the selected element.
|
||||
*
|
||||
* @returns the selected element
|
||||
*/
|
||||
FixedController.prototype.getSelectedElement = function () {
|
||||
return this.selectedElementProxy;
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevents the event from bubbling up if drag is in progress.
|
||||
*/
|
||||
FixedController.prototype.bypassSelection = function ($event) {
|
||||
if (this.dragInProgress) {
|
||||
if ($event) {
|
||||
$event.stopPropagation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -548,6 +575,38 @@ define(
|
||||
return this.mvHandle;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the selection context.
|
||||
*
|
||||
* @param elementProxy the element proxy
|
||||
* @returns {object} the context object which includes elementProxy and toolbar
|
||||
*/
|
||||
FixedController.prototype.getContext = function (elementProxy) {
|
||||
return {
|
||||
elementProxy: elementProxy,
|
||||
toolbar: elementProxy
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* End drag.
|
||||
*
|
||||
* @param handle the resize handle
|
||||
*/
|
||||
FixedController.prototype.endDrag = function (handle) {
|
||||
this.dragInProgress = true;
|
||||
|
||||
setTimeout(function () {
|
||||
this.dragInProgress = false;
|
||||
}.bind(this), 0);
|
||||
|
||||
if (handle) {
|
||||
handle.endDrag();
|
||||
} else {
|
||||
this.moveHandle().endDrag();
|
||||
}
|
||||
};
|
||||
|
||||
return FixedController;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -65,7 +65,7 @@ define(
|
||||
* Start a drag gesture. This should be called when a drag
|
||||
* begins to track initial state.
|
||||
*/
|
||||
FixedDragHandle.prototype.startDrag = function startDrag() {
|
||||
FixedDragHandle.prototype.startDrag = function () {
|
||||
// Cache initial x/y positions
|
||||
this.dragging = {
|
||||
x: this.elementHandle.x(),
|
||||
|
||||
@@ -55,8 +55,8 @@ define(
|
||||
* @param element the fixed position element, as stored in its
|
||||
* configuration
|
||||
* @param index the element's index within its array
|
||||
* @param {number[]} gridSize the current layout grid size in [x,y] from
|
||||
* @param {Array} elements the full array of elements
|
||||
* @param {number[]} gridSize the current layout grid size in [x,y] from
|
||||
*/
|
||||
function ElementProxy(element, index, elements, gridSize) {
|
||||
/**
|
||||
|
||||
@@ -21,8 +21,14 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../src/FixedController"],
|
||||
function (FixedController) {
|
||||
[
|
||||
"../src/FixedController",
|
||||
"zepto"
|
||||
],
|
||||
function (
|
||||
FixedController,
|
||||
$
|
||||
) {
|
||||
|
||||
describe("The Fixed Position controller", function () {
|
||||
var mockScope,
|
||||
@@ -46,6 +52,9 @@ define(
|
||||
mockMetadata,
|
||||
mockTimeSystem,
|
||||
mockLimitEvaluator,
|
||||
mockSelection,
|
||||
$element = [],
|
||||
selectable = [],
|
||||
controller;
|
||||
|
||||
// Utility function; find a watch for a given expression
|
||||
@@ -180,17 +189,30 @@ define(
|
||||
|
||||
mockScope.model = testModel;
|
||||
mockScope.configuration = testConfiguration;
|
||||
mockScope.selection = jasmine.createSpyObj(
|
||||
'selection',
|
||||
['select', 'get', 'selected', 'deselect', 'proxy']
|
||||
);
|
||||
|
||||
selectable[0] = {
|
||||
context: {
|
||||
oldItem: mockDomainObject
|
||||
}
|
||||
};
|
||||
mockSelection = jasmine.createSpyObj("selection", [
|
||||
'select',
|
||||
'on',
|
||||
'off',
|
||||
'get'
|
||||
]);
|
||||
mockSelection.get.andCallThrough();
|
||||
|
||||
mockOpenMCT = {
|
||||
time: mockConductor,
|
||||
telemetry: mockTelemetryAPI,
|
||||
composition: mockCompositionAPI
|
||||
composition: mockCompositionAPI,
|
||||
selection: mockSelection
|
||||
};
|
||||
|
||||
$element = $('<div></div>');
|
||||
spyOn($element[0], 'click');
|
||||
|
||||
mockMetadata = jasmine.createSpyObj('mockMetadata', [
|
||||
'valuesForHints',
|
||||
'value',
|
||||
@@ -226,11 +248,11 @@ define(
|
||||
mockScope,
|
||||
mockQ,
|
||||
mockDialogService,
|
||||
mockOpenMCT
|
||||
mockOpenMCT,
|
||||
$element
|
||||
);
|
||||
|
||||
findWatch("model.layoutGrid")(testModel.layoutGrid);
|
||||
findWatch("selection")(mockScope.selection);
|
||||
});
|
||||
|
||||
it("subscribes when a domain object is available", function () {
|
||||
@@ -306,41 +328,41 @@ define(
|
||||
});
|
||||
|
||||
it("allows elements to be selected", function () {
|
||||
var elements;
|
||||
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
|
||||
elements = controller.getElements();
|
||||
controller.select(elements[1]);
|
||||
expect(mockScope.selection.select)
|
||||
.toHaveBeenCalledWith(elements[1]);
|
||||
selectable[0].context.elementProxy = controller.getElements()[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(controller.isElementSelected()).toBe(true);
|
||||
});
|
||||
|
||||
it("allows selection retrieval", function () {
|
||||
// selected with no arguments should give the current
|
||||
// selection
|
||||
var elements;
|
||||
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
|
||||
elements = controller.getElements();
|
||||
controller.select(elements[1]);
|
||||
mockScope.selection.get.andReturn(elements[1]);
|
||||
expect(controller.selected()).toEqual(elements[1]);
|
||||
selectable[0].context.elementProxy = elements[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
expect(controller.getSelectedElement()).toEqual(elements[1]);
|
||||
});
|
||||
|
||||
it("allows selections to be cleared", function () {
|
||||
var elements;
|
||||
|
||||
it("selects the parent view when selected element is removed", function () {
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
|
||||
elements = controller.getElements();
|
||||
controller.select(elements[1]);
|
||||
controller.clearSelection();
|
||||
expect(controller.selected(elements[1])).toBeFalsy();
|
||||
var elements = controller.getElements();
|
||||
selectable[0].context.elementProxy = elements[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
elements[1].remove();
|
||||
testModel.modified = 2;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
|
||||
expect($element[0].click).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("retains selections during refresh", function () {
|
||||
@@ -352,23 +374,21 @@ define(
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
|
||||
elements = controller.getElements();
|
||||
controller.select(elements[1]);
|
||||
selectable[0].context.elementProxy = elements[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
// Verify precondition
|
||||
expect(mockScope.selection.select.calls.length).toEqual(1);
|
||||
|
||||
// Mimic selection behavior
|
||||
mockScope.selection.get.andReturn(elements[1]);
|
||||
expect(controller.getSelectedElement()).toEqual(elements[1]);
|
||||
|
||||
elements[2].remove();
|
||||
testModel.modified = 2;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
|
||||
elements = controller.getElements();
|
||||
|
||||
// Verify removal, as test assumes this
|
||||
expect(elements.length).toEqual(2);
|
||||
|
||||
expect(mockScope.selection.select.calls.length).toEqual(2);
|
||||
expect(controller.shouldSelect(elements[1])).toBe(true);
|
||||
});
|
||||
|
||||
it("Displays received values for telemetry elements", function () {
|
||||
@@ -505,21 +525,25 @@ define(
|
||||
});
|
||||
|
||||
it("exposes a view-level selection proxy", function () {
|
||||
expect(mockScope.selection.proxy).toHaveBeenCalledWith(
|
||||
jasmine.any(Object)
|
||||
);
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
var selection = mockOpenMCT.selection.select.mostRecentCall.args[0];
|
||||
|
||||
expect(mockOpenMCT.selection.select).toHaveBeenCalled();
|
||||
expect(selection.context.viewProxy).toBeDefined();
|
||||
});
|
||||
|
||||
it("exposes drag handles", function () {
|
||||
var handles;
|
||||
|
||||
// Select something so that drag handles are expected
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
controller.select(controller.getElements()[1]);
|
||||
|
||||
selectable[0].context.elementProxy = controller.getElements()[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
// Should have a non-empty array of handles
|
||||
handles = controller.handles();
|
||||
|
||||
expect(handles).toEqual(jasmine.any(Array));
|
||||
expect(handles.length).not.toEqual(0);
|
||||
|
||||
@@ -532,15 +556,14 @@ define(
|
||||
});
|
||||
|
||||
it("exposes a move handle", function () {
|
||||
var handle;
|
||||
|
||||
// Select something so that drag handles are expected
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
controller.select(controller.getElements()[1]);
|
||||
|
||||
selectable[0].context.elementProxy = controller.getElements()[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
// Should have a move handle
|
||||
handle = controller.moveHandle();
|
||||
var handle = controller.moveHandle();
|
||||
|
||||
// And it should have start/continue/end drag methods
|
||||
expect(handle.startDrag).toEqual(jasmine.any(Function));
|
||||
@@ -551,26 +574,40 @@ define(
|
||||
it("updates selection style during drag", function () {
|
||||
var oldStyle;
|
||||
|
||||
// Select something so that drag handles are expected
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
controller.select(controller.getElements()[1]);
|
||||
mockScope.selection.get.andReturn(controller.getElements()[1]);
|
||||
|
||||
selectable[0].context.elementProxy = controller.getElements()[1];
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
|
||||
// Get style
|
||||
oldStyle = controller.selected().style;
|
||||
oldStyle = controller.getSelectedElementStyle();
|
||||
|
||||
// Start a drag gesture
|
||||
controller.moveHandle().startDrag();
|
||||
|
||||
// Haven't moved yet; style shouldn't have updated yet
|
||||
expect(controller.selected().style).toEqual(oldStyle);
|
||||
expect(controller.getSelectedElementStyle()).toEqual(oldStyle);
|
||||
|
||||
// Drag a little
|
||||
controller.moveHandle().continueDrag([1000, 100]);
|
||||
|
||||
// Style should have been updated
|
||||
expect(controller.selected().style).not.toEqual(oldStyle);
|
||||
expect(controller.getSelectedElementStyle()).not.toEqual(oldStyle);
|
||||
});
|
||||
|
||||
it("cleans up slection on scope destroy", function () {
|
||||
expect(mockScope.$on).toHaveBeenCalledWith(
|
||||
'$destroy',
|
||||
jasmine.any(Function)
|
||||
);
|
||||
|
||||
mockScope.$on.mostRecentCall.args[1]();
|
||||
|
||||
expect(mockOpenMCT.selection.off).toHaveBeenCalledWith(
|
||||
'change',
|
||||
jasmine.any(Function)
|
||||
);
|
||||
});
|
||||
|
||||
describe("on display bounds changes", function () {
|
||||
@@ -702,6 +739,14 @@ define(
|
||||
expect(controller.getElements()[0].cssClass).toEqual("alarm-a");
|
||||
});
|
||||
});
|
||||
|
||||
it("listens for selection change events", function () {
|
||||
expect(mockOpenMCT.selection.on).toHaveBeenCalledWith(
|
||||
'change',
|
||||
jasmine.any(Function)
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -268,7 +268,6 @@ define([
|
||||
|
||||
legacyRegistry.register('adapter', this.legacyBundle);
|
||||
legacyRegistry.enable('adapter');
|
||||
this.install(this.plugins.Plot());
|
||||
/**
|
||||
* Fired by [MCT]{@link module:openmct.MCT} when the application
|
||||
* is started.
|
||||
|
||||
@@ -76,20 +76,22 @@ define([
|
||||
throw new Error('Event not supported by composition: ' + event);
|
||||
}
|
||||
|
||||
if (event === 'add') {
|
||||
this.provider.on(
|
||||
this.domainObject,
|
||||
'add',
|
||||
this.onProviderAdd,
|
||||
this
|
||||
);
|
||||
} if (event === 'remove') {
|
||||
this.provider.on(
|
||||
this.domainObject,
|
||||
'remove',
|
||||
this.onProviderRemove,
|
||||
this
|
||||
);
|
||||
if (this.provider.on && this.provider.off) {
|
||||
if (event === 'add') {
|
||||
this.provider.on(
|
||||
this.domainObject,
|
||||
'add',
|
||||
this.onProviderAdd,
|
||||
this
|
||||
);
|
||||
} if (event === 'remove') {
|
||||
this.provider.on(
|
||||
this.domainObject,
|
||||
'remove',
|
||||
this.onProviderRemove,
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.listeners[event].push({
|
||||
@@ -124,20 +126,22 @@ define([
|
||||
if (this.listeners[event].length === 0) {
|
||||
// Remove provider listener if this is the last callback to
|
||||
// be removed.
|
||||
if (event === 'add') {
|
||||
this.provider.off(
|
||||
this.domainObject,
|
||||
'add',
|
||||
this.onProviderAdd,
|
||||
this
|
||||
);
|
||||
} else if (event === 'remove') {
|
||||
this.provider.off(
|
||||
this.domainObject,
|
||||
'remove',
|
||||
this.onProviderRemove,
|
||||
this
|
||||
);
|
||||
if (this.provider.off && this.provider.on) {
|
||||
if (event === 'add') {
|
||||
this.provider.off(
|
||||
this.domainObject,
|
||||
'add',
|
||||
this.onProviderAdd,
|
||||
this
|
||||
);
|
||||
} else if (event === 'remove') {
|
||||
this.provider.off(
|
||||
this.domainObject,
|
||||
'remove',
|
||||
this.onProviderRemove,
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ define([
|
||||
delete valueMetadata.hints.y;
|
||||
}
|
||||
|
||||
if (valueMetadata.format == 'enum') {
|
||||
if (valueMetadata.format === 'enum') {
|
||||
if (!valueMetadata.values) {
|
||||
valueMetadata.values = _.pluck(valueMetadata.enumerations, 'value');
|
||||
}
|
||||
|
||||
@@ -21,11 +21,9 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
'printj'
|
||||
'lodash'
|
||||
], function (
|
||||
_,
|
||||
printj
|
||||
_
|
||||
) {
|
||||
|
||||
// TODO: needs reference to formatService;
|
||||
@@ -67,18 +65,12 @@ define([
|
||||
this.formatter.parse = function (string) {
|
||||
if (typeof string === "string") {
|
||||
if (this.enumerations.byString.hasOwnProperty(string)) {
|
||||
return this.enumerations.byString[string]
|
||||
return this.enumerations.byString[string];
|
||||
}
|
||||
}
|
||||
return Number(string);
|
||||
}.bind(this);
|
||||
}
|
||||
if (valueMetadata.sprintf) {
|
||||
this.formatter = numberFormatter;
|
||||
this.formatter.format = function (value) {
|
||||
return printj.sprintf(valueMetadata.sprintf, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TelemetryValueFormatter.prototype.parse = function (datum) {
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
# plot
|
||||
|
||||
# One more time-- celebration.
|
||||
|
||||
PlotConfigurationModel -- backed by Plot Object model.
|
||||
PlotSeries[]
|
||||
PlotSeries
|
||||
XAxis
|
||||
YAxis
|
||||
|
||||
|
||||
PlotStateModel
|
||||
PlotSeries[]
|
||||
PlotSeries -- handles loading of data, data, etc.
|
||||
XAxis
|
||||
YAxis
|
||||
|
||||
|
||||
TelemetryPointPlot
|
||||
Creates a placeholder PlotConfigurationModel each time.
|
||||
|
||||
OverlayPlot
|
||||
|
||||
StackedPlot -- has an array of subplots.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The `plot-reborn` bundle provides directives for composing plot based views.
|
||||
It also exposes domain objects for plotting telemetry points.
|
||||
|
||||
## chart
|
||||
Chart defines a directive for charting data. It is the main interface between
|
||||
the drawing API and a plot controller.
|
||||
|
||||
## plot
|
||||
Plot defines a directive for plotting data, and provides some types it
|
||||
uses to do so: the PlotAxis and the PlotSeries.
|
||||
|
||||
## TelemetryPlot
|
||||
Telemetry plot includes controllers needed to connect to telemetry providers.
|
||||
|
||||
|
||||
|
||||
MCTChart is a directive for charting data.
|
||||
|
||||
## Types
|
||||
|
||||
* OverlayPlot: can be used on any domain object that has or delegates a
|
||||
telemetry capability.
|
||||
|
||||
-> View: OverlayPlot
|
||||
|
||||
* StackedPlot: can be used on any domain object that delegates telemetry or
|
||||
delegates composition of elements that have telemetry.
|
||||
|
||||
-> View: StackedPlot
|
||||
|
||||
|
||||
## Series
|
||||
* label
|
||||
* data
|
||||
* color
|
||||
* markers (yes/no)
|
||||
* scale
|
||||
- maps
|
||||
|
||||
## Directives
|
||||
|
||||
* `mct-chart`: an element that takes `series`, `viewport`, and
|
||||
`rectangles` and plots the data. Adding points to a series after it has
|
||||
been initially plotted can be done either by recreating the series object
|
||||
or by broadcasting "series:data:add" with arguments `event`, `seriesIndex`,
|
||||
`points`. This will append `points` to the `series` at index `seriesIndex`.
|
||||
|
||||
* `mct-plot`: A directive that wraps a mct-chart and handles user interactions
|
||||
with that plot. It emits events that a parent view can use for coordinating
|
||||
functionality:
|
||||
* emits a `user:viewport:change:start` event when the viewport begins being
|
||||
changed by a user, to allow any parent controller to prevent viewport
|
||||
modifications while the user is interacting with the plot.
|
||||
* emits a `user:viewport:change:end` event when the user has finished
|
||||
changing the viewport. This allows a controller on a parent scope to
|
||||
track viewport history and provide any necessary functionality
|
||||
around viewport changes, e.g. viewport history.
|
||||
|
||||
* `mct-overlay-plot`: A directive that takes `domainObject` and plots either a
|
||||
single series of data (in the case of a single telemetry object) or multiple
|
||||
series of data (in the case of a object which delegates telemetry).
|
||||
|
||||
## Controllers
|
||||
|
||||
NOTE: this section not accurate. Essentially, these controllers format data for
|
||||
the mct-chart directive. They also handle live viewport updating, as well as
|
||||
managing all transformations from domain objects to views.
|
||||
|
||||
* StackPlotController: Uses the composition capability of a StackPlot domain
|
||||
object to retrieve SubPlots and render them with individual PlotControllers.
|
||||
* PlotController: Uses either a domain object that delegates telemetry or a
|
||||
domain object with telemetry to and feeds that data to the mct-chart
|
||||
directive.
|
||||
|
||||
## TODOS:
|
||||
|
||||
* [ ] Re-implement history stack.
|
||||
* [ ] Re-implement plot pallette.
|
||||
* [ ] Re-implement stacked plot viewport synchronization (share viewport object)
|
||||
* [ ] Other things?
|
||||
* [ ] Handle edge cases with marquee zoom/panning.
|
||||
* [ ] Tidy code.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, 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
|
||||
* Open MCT 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.
|
||||
@@ -14,11 +14,12 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* Open MCT 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*/
|
||||
|
||||
define([
|
||||
@@ -215,7 +216,7 @@ define([
|
||||
"features": "creation",
|
||||
"contains": [
|
||||
"telemetry.plot.overlay",
|
||||
{"has": "telemetry"},
|
||||
{"has": "telemetry"}
|
||||
],
|
||||
"model": {
|
||||
"composition": []
|
||||
@@ -242,8 +243,8 @@ define([
|
||||
});
|
||||
|
||||
openmct.legacyRegistry.enable("openmct/plot");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return PlotPlugin
|
||||
return PlotPlugin;
|
||||
});
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT 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 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 class="gl-plot plot-legend-{{legend.get('position')}} {{legend.get('expanded')? 'plot-legend-expanded' : 'plot-legend-collapsed'}}">
|
||||
<div class="gl-plot-legend flex-elem l-flex-row"
|
||||
ng-class="{ 'hover-on-plot': !!highlights.length }"
|
||||
@@ -145,6 +166,11 @@
|
||||
ng-show="plotHistory.length"
|
||||
style="position: absolute; top: 8px; right: 8px;">
|
||||
|
||||
<a class="s-button icon-brackets"
|
||||
ng-click="plot.syncConductor()"
|
||||
title="Synchronize Time Conductor to plot bounds">
|
||||
</a>
|
||||
|
||||
<a class="s-button icon-arrow-left"
|
||||
ng-click="plot.back()"
|
||||
title="Restore previous pan/zoom">
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
Open MCT, Copyright (c) 2014-2018, 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
|
||||
Open MCT 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.
|
||||
@@ -14,7 +14,7 @@
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
Open MCT 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.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
Open MCT, Copyright (c) 2014-2018, 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
|
||||
Open MCT 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.
|
||||
@@ -14,7 +14,7 @@
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
Open MCT 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.
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT 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 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 ng-if="domainObject.getCapability('editor').inEditContext()">
|
||||
<mct-representation key="'plot-options-edit'"
|
||||
mct-object="domainObject">
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT 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 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="PlotController as controller"
|
||||
class="abs holder holder-plot has-control-bar"
|
||||
ng-class="{
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT 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 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="StackedPlotController as stackedPlot"
|
||||
class="abs holder holder-plot has-control-bar t-plot-stacked"
|
||||
ng-class="{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define,Float32Array*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
'../lib/extend',
|
||||
@@ -7,7 +28,6 @@ define([
|
||||
extend,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function MCTChartAlarmPointSet(series, chart, offset) {
|
||||
this.series = series;
|
||||
@@ -20,12 +40,12 @@ define([
|
||||
this.listenTo(series, 'reset', this.reset, this);
|
||||
this.listenTo(series, 'destroy', this.destroy, this);
|
||||
series.data.forEach(function (point, index) {
|
||||
this.append(point, index, series)
|
||||
this.append(point, index, series);
|
||||
}, this);
|
||||
}
|
||||
|
||||
MCTChartAlarmPointSet.prototype.append = function (datum) {
|
||||
if (datum._limit) {
|
||||
if (datum.mctLimitState) {
|
||||
this.points.push({
|
||||
x: this.offset.xVal(datum, this.series),
|
||||
y: this.offset.yVal(datum, this.series),
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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,requestAnimationFrame,Float32Array*/
|
||||
|
||||
/**
|
||||
@@ -21,7 +42,6 @@ function (
|
||||
eventHelpers,
|
||||
_
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var MARKER_SIZE = 6.0,
|
||||
HIGHLIGHT_SIZE = MARKER_SIZE * 2.0;
|
||||
@@ -147,17 +167,17 @@ function (
|
||||
});
|
||||
this.pointSets.forEach(function (pointSet) {
|
||||
pointSet.reset();
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
MCTChartController.prototype.setOffset = function (point, index, series) {
|
||||
MCTChartController.prototype.setOffset = function (offsetPoint, index, series) {
|
||||
if (this.offset.x && this.offset.y) {
|
||||
return;
|
||||
}
|
||||
|
||||
var offsets = {
|
||||
x: series.getXVal(point),
|
||||
y: series.getYVal(point)
|
||||
x: series.getXVal(offsetPoint),
|
||||
y: series.getYVal(offsetPoint)
|
||||
};
|
||||
|
||||
this.offset.x = function (x) {
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define,requestAnimationFrame,Float32Array*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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 MCTChart. Created by vwoeltje on 11/12/14.
|
||||
@@ -8,7 +29,6 @@ define([
|
||||
], function (
|
||||
MCTChartController
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var TEMPLATE = "<canvas style='position: absolute; background: none; width: 100%; height: 100%;'></canvas>";
|
||||
TEMPLATE += TEMPLATE;
|
||||
@@ -33,7 +53,7 @@ define([
|
||||
controller: MCTChartController,
|
||||
scope: {
|
||||
config: "=",
|
||||
draw: "=" ,
|
||||
draw: "=",
|
||||
rectangles: "=",
|
||||
series: "=",
|
||||
xAxis: "=theXAxis",
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
@@ -5,7 +26,6 @@ define([
|
||||
], function (
|
||||
MCTChartSeriesElement
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var MCTChartLineLinear = MCTChartSeriesElement.extend({
|
||||
addPoint: function (point, start, count) {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
@@ -5,7 +26,6 @@ define([
|
||||
], function (
|
||||
MCTChartSeriesElement
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var MCTChartLineStepAfter = MCTChartSeriesElement.extend({
|
||||
removePoint: function (point, index, count) {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
@@ -5,7 +26,6 @@ define([
|
||||
], function (
|
||||
MCTChartSeriesElement
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var MCTChartPointSet = MCTChartSeriesElement.extend({
|
||||
addPoint: function (point, start, count) {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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,Float32Array*/
|
||||
|
||||
define([
|
||||
@@ -7,7 +28,6 @@ define([
|
||||
extend,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function MCTChartSeriesElement(series, chart, offset) {
|
||||
this.series = series;
|
||||
@@ -20,7 +40,7 @@ define([
|
||||
this.listenTo(series, 'reset', this.reset, this);
|
||||
this.listenTo(series, 'destroy', this.destroy, this);
|
||||
series.data.forEach(function (point, index) {
|
||||
this.append(point, index, series)
|
||||
this.append(point, index, series);
|
||||
}, this);
|
||||
}
|
||||
|
||||
@@ -76,7 +96,7 @@ define([
|
||||
this.count -= (vertexCount / 2);
|
||||
};
|
||||
|
||||
MCTChartSeriesElement.prototype.makePoint = function(point, series) {
|
||||
MCTChartSeriesElement.prototype.makePoint = function (point, series) {
|
||||
if (!this.offset.xVal) {
|
||||
this.chart.setOffset(point, undefined, series);
|
||||
}
|
||||
@@ -106,9 +126,8 @@ define([
|
||||
this.isTempBuffer = true;
|
||||
}
|
||||
var target = insertionPoint + pointsRequired,
|
||||
start = insertionPoint,
|
||||
end = this.count * 2 + pointsRequired;
|
||||
for (;start < target; start++) {
|
||||
start = insertionPoint;
|
||||
for (; start < target; start++) {
|
||||
this.buffer.splice(start, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define, Promise*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
@@ -13,7 +34,6 @@ define([
|
||||
extend,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function Collection(options) {
|
||||
if (options.models) {
|
||||
@@ -87,7 +107,9 @@ define([
|
||||
Collection.prototype.indexOf = function (model) {
|
||||
return _.findIndex(
|
||||
this.models,
|
||||
function (m) { return m === model; }
|
||||
function (m) {
|
||||
return m === model;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
'./Model'
|
||||
], function (
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define, Promise*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
@@ -11,7 +32,6 @@ define([
|
||||
extend,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function Model(options) {
|
||||
if (!options) {
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define, Promise*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
'./Collection',
|
||||
@@ -17,7 +38,6 @@ define([
|
||||
LegendModel,
|
||||
_
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* PlotConfiguration model stores the configuration of a plot and some
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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*/
|
||||
|
||||
define([
|
||||
@@ -11,7 +32,6 @@ define([
|
||||
extend,
|
||||
EventEmitter
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Plot series handle interpreting telemetry metadata for a single telemetry
|
||||
@@ -81,7 +101,7 @@ define([
|
||||
markers: true,
|
||||
markerSize: 2.0,
|
||||
alarmMarkers: true
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -158,11 +178,11 @@ define([
|
||||
},
|
||||
|
||||
formatX: function (point) {
|
||||
return this.formats[this.get('xKey')].format(point)
|
||||
return this.formats[this.get('xKey')].format(point);
|
||||
},
|
||||
|
||||
formatY: function (point) {
|
||||
return this.formats[this.get('yKey')].format(point)
|
||||
return this.formats[this.get('yKey')].format(point);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -290,7 +310,7 @@ define([
|
||||
}
|
||||
}
|
||||
this.updateStats(point);
|
||||
point._limit = this.evaluate(point);
|
||||
point.mctLimitState = this.evaluate(point);
|
||||
this.data.splice(insertIndex, 0, point);
|
||||
this.emit('add', point, insertIndex, this);
|
||||
},
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
'./PlotSeries',
|
||||
'./Collection',
|
||||
'./Model',
|
||||
'../lib/color'
|
||||
'../lib/color',
|
||||
'lodash'
|
||||
], function (
|
||||
PlotSeries,
|
||||
Collection,
|
||||
Model,
|
||||
color
|
||||
color,
|
||||
_
|
||||
) {
|
||||
|
||||
var SeriesCollection = Collection.extend({
|
||||
@@ -75,11 +98,11 @@ define([
|
||||
// to defer mutation of our plot object, otherwise we might
|
||||
// mutate an outdated version of the plotObject.
|
||||
setTimeout(function () {
|
||||
var plotObject = this.plot.get('domainObject');
|
||||
var cSeries = plotObject.configuration.series.slice();
|
||||
var newPlotObject = this.plot.get('domainObject');
|
||||
var cSeries = newPlotObject.configuration.series.slice();
|
||||
cSeries.splice(index, 1);
|
||||
this.openmct.objects.mutate(plotObject, 'configuration.series', cSeries);
|
||||
}.bind(this))
|
||||
this.openmct.objects.mutate(newPlotObject, 'configuration.series', cSeries);
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
onSeriesAdd: function (series) {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
'./Model'
|
||||
], function (
|
||||
@@ -35,12 +56,14 @@ define([
|
||||
this.set('label', xMetadata.name);
|
||||
this.set('format', xFormat.format.bind(xFormat));
|
||||
} else {
|
||||
this.set('format', function (x) { return x;});
|
||||
this.set('format', function (x) {
|
||||
return x;
|
||||
});
|
||||
this.set('label', newKey);
|
||||
}
|
||||
this.plot.series.forEach(function (series) {
|
||||
series.set('xKey', newKey);
|
||||
series.reset();
|
||||
this.plot.series.forEach(function (plotSeries) {
|
||||
plotSeries.set('xKey', newKey);
|
||||
plotSeries.reset();
|
||||
});
|
||||
},
|
||||
defaults: function (options) {
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
'./Model',
|
||||
'lodash'
|
||||
@@ -6,27 +27,27 @@ define([
|
||||
_
|
||||
) {
|
||||
|
||||
/**
|
||||
* YAxis model
|
||||
/**
|
||||
* YAxis model
|
||||
*
|
||||
* TODO: docstrings.
|
||||
*
|
||||
* TODO: docstrings.
|
||||
*
|
||||
* has the following Model properties:
|
||||
*
|
||||
* `autoscale`: boolean, whether or not to autoscale.
|
||||
* `autoscalePadding`: float, percent of padding to display in plots.
|
||||
* `displayRange`: the current display range for the x Axis.
|
||||
* `format`: the formatter for the axis.
|
||||
* `frozen`: boolean, if true, displayRange will not be updated automatically.
|
||||
* Used to temporarily disable automatic updates during user interaction.
|
||||
* `label`: label to display on axis.
|
||||
* `stats`: Min and Max Values of data, automatically updated by observing
|
||||
* plot series.
|
||||
* `values`: for enumerated types, an array of possible display values.
|
||||
* `range`: the user-configured range to use for display, when autoscale is
|
||||
* disabled.
|
||||
*
|
||||
*/
|
||||
* has the following Model properties:
|
||||
*
|
||||
* `autoscale`: boolean, whether or not to autoscale.
|
||||
* `autoscalePadding`: float, percent of padding to display in plots.
|
||||
* `displayRange`: the current display range for the x Axis.
|
||||
* `format`: the formatter for the axis.
|
||||
* `frozen`: boolean, if true, displayRange will not be updated automatically.
|
||||
* Used to temporarily disable automatic updates during user interaction.
|
||||
* `label`: label to display on axis.
|
||||
* `stats`: Min and Max Values of data, automatically updated by observing
|
||||
* plot series.
|
||||
* `values`: for enumerated types, an array of possible display values.
|
||||
* `range`: the user-configured range to use for display, when autoscale is
|
||||
* disabled.
|
||||
*
|
||||
*/
|
||||
var YAxisModel = Model.extend({
|
||||
initialize: function (options) {
|
||||
this.plot = options.plot;
|
||||
@@ -67,7 +88,7 @@ define([
|
||||
}
|
||||
return {
|
||||
min: range.min - padding,
|
||||
max: range.max + padding,
|
||||
max: range.max + padding
|
||||
};
|
||||
},
|
||||
updatePadding: function (newPadding) {
|
||||
@@ -146,7 +167,7 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var yKey = sampleSeries.get('yKey')
|
||||
var yKey = sampleSeries.get('yKey');
|
||||
var yMetadata = sampleSeries.metadata.value(yKey);
|
||||
var yFormat = sampleSeries.formats[yKey];
|
||||
this.set('format', yFormat.format.bind(yFormat));
|
||||
|
||||
@@ -1,13 +1,33 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
define([
|
||||
], function (
|
||||
) {
|
||||
|
||||
var CONFIG_STORE = {};
|
||||
|
||||
function ConfigStore() {
|
||||
this.store = {};
|
||||
this.tracking = {};
|
||||
}
|
||||
|
||||
ConfigStore.prototype.track = function (id) {
|
||||
if (!this.tracking[id]) {
|
||||
this.tracking[id] = 0;
|
||||
@@ -22,7 +42,7 @@ define([
|
||||
this.store[id].destroy();
|
||||
delete this.store[id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ConfigStore.prototype.add = function (id, config) {
|
||||
this.store[id] = config;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/*global define*/
|
||||
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, 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
|
||||
* Open MCT 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.
|
||||
@@ -16,16 +14,18 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* Open MCT 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*/
|
||||
|
||||
define([],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
define([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
|
||||
/**
|
||||
* Create a new draw API utilizing the Canvas's 2D API for rendering.
|
||||
@@ -39,8 +39,8 @@ function () {
|
||||
this.c2d = canvas.getContext('2d');
|
||||
this.width = canvas.width;
|
||||
this.height = canvas.height;
|
||||
this.dimensions = [ this.width, this.height ];
|
||||
this.origin = [ 0, 0 ];
|
||||
this.dimensions = [this.width, this.height];
|
||||
this.origin = [0, 0];
|
||||
|
||||
if (!this.c2d) {
|
||||
throw new Error("Canvas 2d API unavailable.");
|
||||
@@ -153,7 +153,7 @@ function () {
|
||||
limitSize
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return Draw2D;
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define,console */
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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 console */
|
||||
|
||||
define(
|
||||
[
|
||||
|
||||
@@ -1,8 +1,31 @@
|
||||
/*global define,Float32Array*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
define([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
|
||||
// WebGL shader sources (for drawing plain colors)
|
||||
var FRAGMENT_SHADER = [
|
||||
@@ -197,7 +220,7 @@ function () {
|
||||
limitSize
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return DrawWebGL;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define(function () {
|
||||
/**
|
||||
@@ -10,8 +30,8 @@ define(function () {
|
||||
return {
|
||||
restrict: "A",
|
||||
link: function ($scope, $element) {
|
||||
var splitter = $element.parent(),
|
||||
elementsContainer;
|
||||
var splitter = $element.parent();
|
||||
|
||||
while (splitter[0].tagName !== 'MCT-SPLIT-PANE') {
|
||||
splitter = splitter.parent();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@@ -20,6 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
[
|
||||
'./Region'
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./Region'
|
||||
], function (
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./InspectorRegion',
|
||||
'./PlotBrowseRegion',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, 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
|
||||
* Open MCT 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.
|
||||
@@ -14,12 +14,11 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* Open MCT 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*/
|
||||
|
||||
define([
|
||||
'../configuration/configStore',
|
||||
@@ -32,7 +31,7 @@ define([
|
||||
objectUtils,
|
||||
_
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* The LayoutController is responsible for supporting the
|
||||
* Layout view. It arranges frames according to saved configuration
|
||||
@@ -128,7 +127,7 @@ define([
|
||||
newRange.max = Number(range.max);
|
||||
}
|
||||
return newRange;
|
||||
}, function validateRange (range) {
|
||||
}, function validateRange(range) {
|
||||
if (!range) {
|
||||
return 'Need range';
|
||||
}
|
||||
@@ -178,7 +177,7 @@ define([
|
||||
value: o.key
|
||||
};
|
||||
})
|
||||
}
|
||||
};
|
||||
var seriesObject = series.domainObject;
|
||||
var seriesId = objectUtils.makeKeyString(seriesObject.identifier);
|
||||
var configPath = 'configuration.series[' + index + '].';
|
||||
@@ -204,7 +203,7 @@ define([
|
||||
this.config.series.forEach(this.removeSeries, this);
|
||||
this.$scope.form.series = [];
|
||||
this.config.series.forEach(this.addSeries, this);
|
||||
}
|
||||
};
|
||||
|
||||
PlotOptionsController.prototype.removeSeries = function (series) {
|
||||
this.stopListening(series);
|
||||
@@ -220,10 +219,14 @@ define([
|
||||
objectPath
|
||||
) {
|
||||
if (!coerce) {
|
||||
coerce = function (v) { return v; };
|
||||
coerce = function (v) {
|
||||
return v;
|
||||
};
|
||||
}
|
||||
if (!validate) {
|
||||
validate = function () { return true; };
|
||||
validate = function () {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
this.listenTo(model, 'change:' + prop, function (newVal, oldVal) {
|
||||
if (!_.isEqual(coerce(_.get(this.$scope, scopePath)), coerce(newVal))) {
|
||||
@@ -246,7 +249,7 @@ define([
|
||||
if (objectPath && this.$scope.domainObject.getCapability('editor').isEditContextRoot()) {
|
||||
this.openmct.objects.mutate(this.domainObject, objectPath, coerce(newVal));
|
||||
}
|
||||
};
|
||||
}
|
||||
}, this);
|
||||
_.set(this.$scope, scopePath, coerce(model.get(prop)));
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, 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
|
||||
* Open MCT 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.
|
||||
@@ -14,17 +14,17 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* Open MCT 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*/
|
||||
|
||||
|
||||
define([
|
||||
|
||||
], function () {
|
||||
"use strict";
|
||||
|
||||
|
||||
/**
|
||||
* A class for encapsulating structure and behaviour of the plot
|
||||
@@ -39,7 +39,7 @@ define([
|
||||
Defined below are the form structures for the plot options.
|
||||
*/
|
||||
this.xAxisForm = {
|
||||
name:'x-axis',
|
||||
name: 'x-axis',
|
||||
sections: [{
|
||||
name: 'x-axis',
|
||||
rows: [
|
||||
@@ -67,10 +67,10 @@ define([
|
||||
]
|
||||
}
|
||||
]
|
||||
}]};
|
||||
}]};
|
||||
|
||||
this.yAxisForm = {
|
||||
name:'y-axis',
|
||||
name: 'y-axis',
|
||||
sections: [{
|
||||
// Will need to be repeated for each y-axis, with a
|
||||
// distinct name for each. Ideally the name of the axis
|
||||
@@ -123,7 +123,7 @@ define([
|
||||
}]
|
||||
};
|
||||
this.plotSeriesForm = {
|
||||
name:'Series Options',
|
||||
name: 'Series Options',
|
||||
sections: [
|
||||
{
|
||||
rows: [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@@ -20,6 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, 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
|
||||
* Open MCT 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.
|
||||
@@ -14,53 +14,52 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* Open MCT 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 console */
|
||||
|
||||
/*global define, console*/
|
||||
define(function () {
|
||||
'use strict';
|
||||
|
||||
var COLOR_PALETTE = [
|
||||
[ 0x20, 0xB2, 0xAA ],
|
||||
[ 0x9A, 0xCD, 0x32 ],
|
||||
[ 0xFF, 0x8C, 0x00 ],
|
||||
[ 0xD2, 0xB4, 0x8C ],
|
||||
[ 0x40, 0xE0, 0xD0 ],
|
||||
[ 0x41, 0x69, 0xFF ],
|
||||
[ 0xFF, 0xD7, 0x00 ],
|
||||
[ 0x6A, 0x5A, 0xCD ],
|
||||
[ 0xEE, 0x82, 0xEE ],
|
||||
[ 0xCC, 0x99, 0x66 ],
|
||||
[ 0x99, 0xCC, 0xCC ],
|
||||
[ 0x66, 0xCC, 0x33 ],
|
||||
[ 0xFF, 0xCC, 0x00 ],
|
||||
[ 0xFF, 0x66, 0x33 ],
|
||||
[ 0xCC, 0x66, 0xFF ],
|
||||
[ 0xFF, 0x00, 0x66 ],
|
||||
[ 0xFF, 0xFF, 0x00 ],
|
||||
[ 0x80, 0x00, 0x80 ],
|
||||
[ 0x00, 0x86, 0x8B ],
|
||||
[ 0x00, 0x8A, 0x00 ],
|
||||
[ 0xFF, 0x00, 0x00 ],
|
||||
[ 0x00, 0x00, 0xFF ],
|
||||
[ 0xF5, 0xDE, 0xB3 ],
|
||||
[ 0xBC, 0x8F, 0x8F ],
|
||||
[ 0x46, 0x82, 0xB4 ],
|
||||
[ 0xFF, 0xAF, 0xAF ],
|
||||
[ 0x43, 0xCD, 0x80 ],
|
||||
[ 0xCD, 0xC1, 0xC5 ],
|
||||
[ 0xA0, 0x52, 0x2D ],
|
||||
[ 0x64, 0x95, 0xED ]
|
||||
[0x20, 0xB2, 0xAA],
|
||||
[0x9A, 0xCD, 0x32],
|
||||
[0xFF, 0x8C, 0x00],
|
||||
[0xD2, 0xB4, 0x8C],
|
||||
[0x40, 0xE0, 0xD0],
|
||||
[0x41, 0x69, 0xFF],
|
||||
[0xFF, 0xD7, 0x00],
|
||||
[0x6A, 0x5A, 0xCD],
|
||||
[0xEE, 0x82, 0xEE],
|
||||
[0xCC, 0x99, 0x66],
|
||||
[0x99, 0xCC, 0xCC],
|
||||
[0x66, 0xCC, 0x33],
|
||||
[0xFF, 0xCC, 0x00],
|
||||
[0xFF, 0x66, 0x33],
|
||||
[0xCC, 0x66, 0xFF],
|
||||
[0xFF, 0x00, 0x66],
|
||||
[0xFF, 0xFF, 0x00],
|
||||
[0x80, 0x00, 0x80],
|
||||
[0x00, 0x86, 0x8B],
|
||||
[0x00, 0x8A, 0x00],
|
||||
[0xFF, 0x00, 0x00],
|
||||
[0x00, 0x00, 0xFF],
|
||||
[0xF5, 0xDE, 0xB3],
|
||||
[0xBC, 0x8F, 0x8F],
|
||||
[0x46, 0x82, 0xB4],
|
||||
[0xFF, 0xAF, 0xAF],
|
||||
[0x43, 0xCD, 0x80],
|
||||
[0xCD, 0xC1, 0xC5],
|
||||
[0xA0, 0x52, 0x2D],
|
||||
[0x64, 0x95, 0xED]
|
||||
];
|
||||
|
||||
function isDefaultColor(color) {
|
||||
var a = color.asIntegerArray();
|
||||
return COLOR_PALETTE.some(function (b) {
|
||||
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]
|
||||
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,9 +82,9 @@ define(function () {
|
||||
);
|
||||
}
|
||||
return new Color([
|
||||
parseInt(hexString.slice(1,3), 16),
|
||||
parseInt(hexString.slice(3,5), 16),
|
||||
parseInt(hexString.slice(5,7), 16)
|
||||
parseInt(hexString.slice(1, 3), 16),
|
||||
parseInt(hexString.slice(3, 5), 16),
|
||||
parseInt(hexString.slice(5, 7), 16)
|
||||
]);
|
||||
};
|
||||
|
||||
@@ -101,12 +100,12 @@ define(function () {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Return color as a string using #-prefixed six-digit RGB hex notation
|
||||
* (e.g. #FF0000). See http://www.w3.org/TR/css3-color/#rgb-color.
|
||||
*
|
||||
* @return {string} the color, as a style-friendly string
|
||||
*/
|
||||
/**
|
||||
* Return color as a string using #-prefixed six-digit RGB hex notation
|
||||
* (e.g. #FF0000). See http://www.w3.org/TR/css3-color/#rgb-color.
|
||||
*
|
||||
* @return {string} the color, as a style-friendly string
|
||||
*/
|
||||
|
||||
Color.prototype.asHexString = function () {
|
||||
return '#' + this.integerArray.map(function (c) {
|
||||
@@ -143,7 +142,7 @@ define(function () {
|
||||
return new Color(color);
|
||||
});
|
||||
this.colorGroups = [[], [], []];
|
||||
for (var l = allColors.length, i = 0; i < allColors.length; i++) {
|
||||
for (var i = 0; i < allColors.length; i++) {
|
||||
this.colorGroups[i % 3].push(allColors[i]);
|
||||
}
|
||||
this.reset();
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
/*jscs:disable disallowDanglingUnderscores */
|
||||
|
||||
define([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var helperFunctions = {
|
||||
listenTo: function (object, event, callback, context) {
|
||||
|
||||
@@ -1,13 +1,34 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
/*jscs:disable disallowDanglingUnderscores */
|
||||
|
||||
define([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function extend(props) {
|
||||
/*jshint validthis: true*/
|
||||
var parent = this,
|
||||
child,
|
||||
Surrogate;
|
||||
@@ -15,7 +36,9 @@ define([
|
||||
if (props && props.hasOwnProperty('constructor')) {
|
||||
child = props.constructor;
|
||||
} else {
|
||||
child = function () { return parent.apply(this, arguments); };
|
||||
child = function () {
|
||||
return parent.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
Object.keys(parent).forEach(function copyStaticProperties(propKey) {
|
||||
@@ -23,7 +46,9 @@ define([
|
||||
});
|
||||
|
||||
// Surrogate allows inheriting from parent without invoking constructor.
|
||||
Surrogate = function () { this.constructor = child; };
|
||||
Surrogate = function () {
|
||||
this.constructor = child;
|
||||
};
|
||||
Surrogate.prototype = parent.prototype;
|
||||
child.prototype = new Surrogate();
|
||||
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
/*jscs:disable disallowDanglingUnderscores */
|
||||
|
||||
define([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* A scale has an input domain and an output range. It provides functions
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./LinearScale',
|
||||
@@ -7,19 +27,19 @@ define([
|
||||
LinearScale,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MCTPlotController handles user interactions with the plot canvas.
|
||||
* It supports pan and zoom, implements zoom history, and supports locating
|
||||
* values near the cursor.
|
||||
*/
|
||||
function MCTPlotController($scope, $element, $window) {
|
||||
function MCTPlotController($scope, $element, $window, openmct) {
|
||||
this.$scope = $scope;
|
||||
this.$scope.config = this.config;
|
||||
this.$scope.plot = this;
|
||||
this.$element = $element;
|
||||
this.$window = $window;
|
||||
this.openmct = openmct;
|
||||
|
||||
this.xScale = new LinearScale(this.config.xAxis.get('displayRange'));
|
||||
this.yScale = new LinearScale(this.config.yAxis.get('displayRange'));
|
||||
@@ -39,7 +59,7 @@ define([
|
||||
|
||||
MCTPlotController.$inject = ['$scope', '$element', '$window'];
|
||||
|
||||
eventHelpers.extend(MCTPlotController.prototype)
|
||||
eventHelpers.extend(MCTPlotController.prototype);
|
||||
|
||||
MCTPlotController.prototype.initialize = function () {
|
||||
this.$canvas = this.$element.find('canvas');
|
||||
@@ -184,7 +204,9 @@ define([
|
||||
};
|
||||
|
||||
MCTPlotController.prototype.updateMarquee = function () {
|
||||
if (!this.marquee) { return; }
|
||||
if (!this.marquee) {
|
||||
return;
|
||||
}
|
||||
this.marquee.end = this.positionOverPlot;
|
||||
};
|
||||
|
||||
@@ -232,7 +254,9 @@ define([
|
||||
|
||||
MCTPlotController.prototype.updatePan = function () {
|
||||
// calculate offset between points. Apply that offset to viewport.
|
||||
if (!this.pan) { return; }
|
||||
if (!this.pan) {
|
||||
return;
|
||||
}
|
||||
var dX = this.pan.start.x - this.positionOverPlot.x,
|
||||
dY = this.pan.start.y - this.positionOverPlot.y,
|
||||
xRange = this.config.xAxis.get('displayRange'),
|
||||
@@ -309,6 +333,13 @@ define([
|
||||
this.$scope.$emit('user:viewport:change:end');
|
||||
};
|
||||
|
||||
|
||||
MCTPlotController.prototype.syncConductor = function () {
|
||||
var xDisplayRange = this.config.xAxis.get('displayRange');
|
||||
this.openmct.time.stopClock();
|
||||
this.openmct.time.bounds({start: xDisplayRange.min, end: xDisplayRange.max});
|
||||
};
|
||||
|
||||
MCTPlotController.prototype.destroy = function () {
|
||||
this.stopListening();
|
||||
};
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
/*global define,window*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./MCTPlotController',
|
||||
@@ -7,14 +27,13 @@ define([
|
||||
MCTPlotController,
|
||||
PlotTemplate
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function MCTPlot() {
|
||||
|
||||
return {
|
||||
restrict: "E",
|
||||
template: PlotTemplate,
|
||||
controller: MCTPlotController,
|
||||
controller: ['$scope', '$element', '$window', 'openmct', MCTPlotController],
|
||||
controllerAs: 'mctPlotController',
|
||||
bindToController: {
|
||||
config: "="
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
/*global define, setTimeout*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
@@ -7,7 +27,6 @@ define([
|
||||
_,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var e10 = Math.sqrt(50),
|
||||
e5 = Math.sqrt(10),
|
||||
@@ -43,7 +62,9 @@ define([
|
||||
|
||||
var precision = Math.max(0, -(+exponential.slice(i + 1)));
|
||||
|
||||
if (precision > 20) precision = 20;
|
||||
if (precision > 20) {
|
||||
precision = 20;
|
||||
}
|
||||
|
||||
return precision;
|
||||
}
|
||||
@@ -150,7 +171,7 @@ define([
|
||||
};
|
||||
|
||||
MCTTicksController.prototype.updateTicks = function () {
|
||||
var range = this.axis.get('displayRange')
|
||||
var range = this.axis.get('displayRange');
|
||||
if (!range) {
|
||||
delete this.$scope.min;
|
||||
delete this.$scope.max;
|
||||
@@ -183,7 +204,7 @@ define([
|
||||
};
|
||||
}, this);
|
||||
|
||||
if (newTicks.length && typeof newTicks[0].text === 'string' ) {
|
||||
if (newTicks.length && typeof newTicks[0].text === 'string') {
|
||||
var tickText = newTicks.map(function (t) {
|
||||
return t.text;
|
||||
});
|
||||
@@ -198,10 +219,9 @@ define([
|
||||
}
|
||||
});
|
||||
}
|
||||
this.$scope.ticks = newTicks
|
||||
this.$scope.ticks = newTicks;
|
||||
this.shouldCheckWidth = true;
|
||||
}
|
||||
// todo: break out tick updating.
|
||||
this.scheduleTickUpdate();
|
||||
};
|
||||
|
||||
@@ -217,8 +237,8 @@ define([
|
||||
if (this.shouldCheckWidth) {
|
||||
this.$scope.$digest();
|
||||
var element = this.$element[0],
|
||||
ticks = element.querySelectorAll('.gl-plot-tick > span'),
|
||||
tickWidth = Number([].reduce.call(ticks, function (memo, first) {
|
||||
tickElements = element.querySelectorAll('.gl-plot-tick > span'),
|
||||
tickWidth = Number([].reduce.call(tickElements, function (memo, first) {
|
||||
return Math.max(memo, first.offsetWidth);
|
||||
}, 0));
|
||||
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
/*global define,window*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'./MCTTicksController'
|
||||
], function (
|
||||
MCTTicksController
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function MCTTicksDirective() {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@@ -49,6 +49,10 @@ define(
|
||||
this.EXPORT_IMAGE_TIMEOUT = 1000;
|
||||
}
|
||||
|
||||
function changeBackgroundColor(element, color) {
|
||||
element.style.backgroundColor = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an HTML element into a base64 encoded image
|
||||
* as a BLOB, PNG, or JPG.
|
||||
@@ -56,16 +60,24 @@ define(
|
||||
* @param {string} type of image to convert the element to
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.renderElement = function (element, type) {
|
||||
ExportImageService.prototype.renderElement = function (element, type, color) {
|
||||
var defer = this.$q.defer(),
|
||||
validTypes = ["png", "jpg", "jpeg"],
|
||||
renderTimeout;
|
||||
renderTimeout,
|
||||
originalColor;
|
||||
|
||||
if (validTypes.indexOf(type) === -1) {
|
||||
this.$log.error("Invalid type requested. Try: (" + validTypes.join(",") + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
if (color) {
|
||||
// Save color to be restored later
|
||||
originalColor = element.style.backgroundColor || '';
|
||||
// Defaulting to white so we can see the chart when printed
|
||||
changeBackgroundColor(element, color);
|
||||
}
|
||||
|
||||
renderTimeout = this.$timeout(function () {
|
||||
defer.reject("html2canvas timed out");
|
||||
this.$log.warn("html2canvas timed out");
|
||||
@@ -74,6 +86,9 @@ define(
|
||||
try {
|
||||
html2canvas(element, {
|
||||
onrendered: function (canvas) {
|
||||
if (color) {
|
||||
changeBackgroundColor(element, originalColor);
|
||||
}
|
||||
switch (type.toLowerCase()) {
|
||||
case "png":
|
||||
canvas.toBlob(defer.resolve, "image/png");
|
||||
@@ -92,11 +107,40 @@ define(
|
||||
this.$log.warn("html2canvas failed with error: " + e);
|
||||
}
|
||||
|
||||
defer.promise.finally(renderTimeout.cancel);
|
||||
defer.promise.finally(function () {
|
||||
renderTimeout.cancel();
|
||||
if (color) {
|
||||
changeBackgroundColor(element, originalColor);
|
||||
}
|
||||
});
|
||||
|
||||
return defer.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a screenshot of a DOM node and exports to JPG.
|
||||
* @param {node} element to be exported
|
||||
* @param {string} filename the exported image
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.exportJPG = function (element, filename, color) {
|
||||
return this.renderElement(element, "jpeg", color).then(function (img) {
|
||||
saveAs(img, filename);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a screenshot of a DOM node and exports to PNG.
|
||||
* @param {node} element to be exported
|
||||
* @param {string} filename the exported image
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.exportPNG = function (element, filename, color) {
|
||||
return this.renderElement(element, "png", color).then(function (img) {
|
||||
saveAs(img, filename);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* canvas.toBlob() not supported in IE < 10, Opera, and Safari. This polyfill
|
||||
* implements the method in browsers that would not otherwise support it.
|
||||
@@ -121,30 +165,6 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a screenshot of a DOM node and exports to JPG.
|
||||
* @param {node} element to be exported
|
||||
* @param {string} filename the exported image
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.exportJPG = function (element, filename) {
|
||||
return this.renderElement(element, "jpeg").then(function (img) {
|
||||
saveAs(img, filename);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a screenshot of a DOM node and exports to PNG.
|
||||
* @param {node} element to be exported
|
||||
* @param {string} filename the exported image
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.exportPNG = function (element, filename) {
|
||||
return this.renderElement(element, "png").then(function (img) {
|
||||
saveAs(img, filename);
|
||||
});
|
||||
};
|
||||
|
||||
polyfillToBlob();
|
||||
|
||||
return ExportImageService;
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
/*global define*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'text!../../res/templates/plot.html'
|
||||
|
||||
@@ -1,4 +1,26 @@
|
||||
/*global define,Promise*/
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
/*jscs:disable disallowDanglingUnderscores */
|
||||
|
||||
define([
|
||||
'lodash',
|
||||
@@ -11,7 +33,6 @@ define([
|
||||
configStore,
|
||||
eventHelpers
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
TODO: Need to separate off plot configuration and specifying of defaults,
|
||||
@@ -75,7 +96,7 @@ define([
|
||||
PlotController.prototype.addSeries = function (series) {
|
||||
this.listenTo(series, 'change:yKey', function () {
|
||||
this.loadSeriesData(series);
|
||||
}, this)
|
||||
}, this);
|
||||
this.loadSeriesData(series);
|
||||
};
|
||||
|
||||
@@ -197,7 +218,7 @@ define([
|
||||
*/
|
||||
PlotController.prototype.exportJPG = function () {
|
||||
this.hideExportButtons = true;
|
||||
this.exportImageService.exportJPG(this.$element[0], 'plot.jpg')
|
||||
this.exportImageService.exportJPG(this.$element[0], 'plot.jpg', 'white')
|
||||
.finally(function () {
|
||||
this.hideExportButtons = false;
|
||||
}.bind(this));
|
||||
@@ -208,7 +229,7 @@ define([
|
||||
*/
|
||||
PlotController.prototype.exportPNG = function () {
|
||||
this.hideExportButtons = true;
|
||||
this.exportImageService.exportPNG(this.$element[0], 'plot.png')
|
||||
this.exportImageService.exportPNG(this.$element[0], 'plot.png', 'white')
|
||||
.finally(function () {
|
||||
this.hideExportButtons = false;
|
||||
}.bind(this));
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
/*global define */
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT 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 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash'
|
||||
], function (
|
||||
_
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
function StackedPlotController($scope, openmct, objectService, $element, exportImageService) {
|
||||
var tickWidth = 0,
|
||||
@@ -30,11 +49,14 @@ define([
|
||||
}
|
||||
|
||||
function onDomainObjectChange(domainObject) {
|
||||
var thisRequest = currentRequest = $scope.currentRequest = {
|
||||
var thisRequest = {
|
||||
pending: 0
|
||||
};
|
||||
currentRequest = thisRequest;
|
||||
$scope.currentRequest = thisRequest;
|
||||
var telemetryObjects = $scope.telemetryObjects = [];
|
||||
var thisTickWidthMap = tickWidthMap = {};
|
||||
var thisTickWidthMap = {};
|
||||
tickWidthMap = thisTickWidthMap;
|
||||
|
||||
if (unlisten) {
|
||||
unlisten();
|
||||
|
||||
@@ -15,8 +15,6 @@ define([
|
||||
EventEmitter,
|
||||
$
|
||||
) {
|
||||
|
||||
var CURRENT_CONDITION_COUNT = 0;
|
||||
/**
|
||||
* Represents an individual condition for a summary widget rule. Manages the
|
||||
* associated inputs and view.
|
||||
@@ -28,13 +26,6 @@ define([
|
||||
* selects with configuration data
|
||||
*/
|
||||
function Condition(conditionConfig, index, conditionManager) {
|
||||
if (CURRENT_CONDITION_COUNT > 2000) {
|
||||
console.error('Too many Summary Widget Conditions in use, please ' +
|
||||
'simplify your logic or remove unnecessary summary ' +
|
||||
'widgets from the current display.');
|
||||
throw 'TOO MANY CONDITIONS';
|
||||
}
|
||||
CURRENT_CONDITION_COUNT += 1;
|
||||
eventHelpers.extend(this);
|
||||
this.config = conditionConfig;
|
||||
this.index = index;
|
||||
@@ -46,9 +37,6 @@ define([
|
||||
|
||||
this.deleteButton = $('.t-delete', this.domElement);
|
||||
this.duplicateButton = $('.t-duplicate', this.domElement);
|
||||
this.conditionContents = $('.t-condition-context', this.domElement)
|
||||
this.selectContainer = $('.t-configuration', this.domElement)
|
||||
this.inputArea = $('.t-value-inputs', this.domElement)
|
||||
|
||||
this.selects = {};
|
||||
this.valueInputs = [];
|
||||
@@ -118,10 +106,10 @@ define([
|
||||
});
|
||||
|
||||
Object.values(this.selects).forEach(function (select) {
|
||||
self.selectContainer.append(select.getDOM());
|
||||
$('.t-configuration', self.domElement).append(select.getDOM());
|
||||
});
|
||||
|
||||
this.listenTo(this.domElement, 'input', onValueInput);
|
||||
this.listenTo($(this.domElement), 'input', onValueInput);
|
||||
}
|
||||
|
||||
Condition.prototype.getDOM = function (container) {
|
||||
@@ -160,7 +148,6 @@ define([
|
||||
|
||||
Condition.prototype.destroy = function () {
|
||||
this.stopListening();
|
||||
CURRENT_CONDITION_COUNT -= 1;
|
||||
Object.values(this.selects).forEach(function (select) {
|
||||
select.destroy();
|
||||
});
|
||||
@@ -185,12 +172,13 @@ define([
|
||||
*/
|
||||
Condition.prototype.generateValueInputs = function (operation) {
|
||||
var evaluator = this.conditionManager.getEvaluator(),
|
||||
inputArea = $('.t-value-inputs', this.domElement),
|
||||
inputCount,
|
||||
inputType,
|
||||
newInput,
|
||||
index = 0;
|
||||
|
||||
this.inputArea.html('');
|
||||
inputArea.html('');
|
||||
this.valueInputs = [];
|
||||
|
||||
if (evaluator.getInputCount(operation)) {
|
||||
@@ -202,7 +190,7 @@ define([
|
||||
}
|
||||
newInput = $('<input class="sm" type = "' + inputType + '" value = "' + this.config.values[index] + '"> </input>');
|
||||
this.valueInputs.push(newInput.get(0));
|
||||
this.inputArea.append(newInput);
|
||||
inputArea.append(newInput);
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ define([], function () {
|
||||
this.operations = {
|
||||
equalTo: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) === Number(input[1]);
|
||||
return input[0] === input[1];
|
||||
},
|
||||
text: 'is equal to',
|
||||
appliesTo: ['number'],
|
||||
@@ -66,7 +66,7 @@ define([], function () {
|
||||
},
|
||||
notEqualTo: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) !== Number(input[1]);
|
||||
return input[0] !== input[1];
|
||||
},
|
||||
text: 'is not equal to',
|
||||
appliesTo: ['number'],
|
||||
@@ -77,7 +77,7 @@ define([], function () {
|
||||
},
|
||||
greaterThan: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) > Number(input[1]);
|
||||
return input[0] > input[1];
|
||||
},
|
||||
text: 'is greater than',
|
||||
appliesTo: ['number'],
|
||||
@@ -88,7 +88,7 @@ define([], function () {
|
||||
},
|
||||
lessThan: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) < Number(input[1]);
|
||||
return input[0] < input[1];
|
||||
},
|
||||
text: 'is less than',
|
||||
appliesTo: ['number'],
|
||||
@@ -99,7 +99,7 @@ define([], function () {
|
||||
},
|
||||
greaterThanOrEq: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) >= Number(input[1]);
|
||||
return input[0] >= input[1];
|
||||
},
|
||||
text: 'is greater than or equal to',
|
||||
appliesTo: ['number'],
|
||||
@@ -110,7 +110,7 @@ define([], function () {
|
||||
},
|
||||
lessThanOrEq: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) <= Number(input[1]);
|
||||
return input[0] <= input[1];
|
||||
},
|
||||
text: 'is less than or equal to',
|
||||
appliesTo: ['number'],
|
||||
@@ -121,7 +121,7 @@ define([], function () {
|
||||
},
|
||||
between: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) > Number(input[1]) && Number(input[0]) < Number(input[2]);
|
||||
return input[0] > input[1] && input[0] < input[2];
|
||||
},
|
||||
text: 'is between',
|
||||
appliesTo: ['number'],
|
||||
@@ -132,7 +132,7 @@ define([], function () {
|
||||
},
|
||||
notBetween: {
|
||||
operation: function (input) {
|
||||
return Number(input[0]) < Number(input[1]) || Number(input[0]) > Number(input[2]);
|
||||
return input[0] < input[1] || input[0] > input[2];
|
||||
},
|
||||
text: 'is not between',
|
||||
appliesTo: ['number'],
|
||||
@@ -206,6 +206,17 @@ define([], function () {
|
||||
getDescription: function () {
|
||||
return ' is undefined';
|
||||
}
|
||||
},
|
||||
isDefined: {
|
||||
operation: function (input) {
|
||||
return typeof input[0] !== 'undefined';
|
||||
},
|
||||
text: 'is defined',
|
||||
appliesTo: ['string', 'number'],
|
||||
inputCount: 0,
|
||||
getDescription: function () {
|
||||
return ' is defined';
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -304,9 +315,12 @@ define([], function () {
|
||||
op = this.operations[operation] && this.operations[operation].operation;
|
||||
input = telemetryValue && telemetryValue.concat(values);
|
||||
validator = op && this.inputValidators[this.operations[operation].appliesTo[0]];
|
||||
|
||||
if (op && input && validator) {
|
||||
return validator(input) && op(input);
|
||||
if (this.operations[operation].appliesTo.length === 2) {
|
||||
return (this.validateNumberInput(input) || this.validateStringInput(input)) && op(input);
|
||||
} else {
|
||||
return validator(input) && op(input);
|
||||
}
|
||||
} else {
|
||||
throw new Error('Malformed condition');
|
||||
}
|
||||
@@ -321,7 +335,6 @@ define([], function () {
|
||||
ConditionEvaluator.prototype.validateNumberInput = function (input) {
|
||||
var valid = true;
|
||||
input.forEach(function (value) {
|
||||
value = Number(value);
|
||||
valid = valid && (typeof value === 'number');
|
||||
});
|
||||
return valid;
|
||||
|
||||
@@ -33,8 +33,6 @@ define([
|
||||
eventHelpers.extend(this);
|
||||
var self = this;
|
||||
|
||||
this.generateDescription = _.debounce(this.generateDescription.bind(this));
|
||||
|
||||
this.config = ruleConfig;
|
||||
this.domainObject = domainObject;
|
||||
this.openmct = openmct;
|
||||
@@ -64,7 +62,6 @@ define([
|
||||
this.deleteButton = $('.t-delete', this.domElement);
|
||||
this.duplicateButton = $('.t-duplicate', this.domElement);
|
||||
this.addConditionButton = $('.add-condition', this.domElement);
|
||||
this.insertBefore = $('li:last-of-type', this.conditionArea);
|
||||
|
||||
/**
|
||||
* The text inputs for this rule: any input included in this object will
|
||||
@@ -305,18 +302,11 @@ define([
|
||||
};
|
||||
|
||||
/**
|
||||
* Mutate thet domain object with this rule's local configuration, if it has
|
||||
* changed.
|
||||
* Mutate thet domain object with this rule's local configuration
|
||||
*/
|
||||
Rule.prototype.updateDomainObject = function () {
|
||||
var path = 'configuration.ruleConfigById.' + this.config.id,
|
||||
newConfig = this.config,
|
||||
oldConfig = _.get(this.domainObject, path);
|
||||
|
||||
if (_.isEqual(newConfig, oldConfig)) {
|
||||
return;
|
||||
}
|
||||
this.openmct.objects.mutate(this.domainObject, path, this.config);
|
||||
this.openmct.objects.mutate(this.domainObject, 'configuration.ruleConfigById.' +
|
||||
this.config.id, this.config);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -417,9 +407,9 @@ define([
|
||||
this.addConditionButton.show();
|
||||
self.conditions.forEach(function (condition) {
|
||||
$condition = condition.getDOM();
|
||||
self.insertBefore.before($condition);
|
||||
$('li:last-of-type', self.conditionArea).before($condition);
|
||||
if (loopCnt > 0) {
|
||||
condition.conditionContents.html(triggerContextStr + ' when');
|
||||
$('.t-condition-context', $condition).html(triggerContextStr + ' when');
|
||||
}
|
||||
loopCnt++;
|
||||
});
|
||||
@@ -450,7 +440,6 @@ define([
|
||||
this.eventEmitter.emit('conditionChange');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Build a human-readable description from this rule's conditions
|
||||
*/
|
||||
|
||||
@@ -116,8 +116,6 @@ define([
|
||||
self.onEdit([]);
|
||||
}
|
||||
});
|
||||
|
||||
this.executingRules = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +263,7 @@ define([
|
||||
var activeRule = this.rulesById[this.activeId];
|
||||
this.applyStyle($('#widget', this.domElement), activeRule.getProperty('style'));
|
||||
$('#widget', this.domElement).prop('title', activeRule.getProperty('message'));
|
||||
$('#widgetLabel', this.domElement)[0].innerText = activeRule.getProperty('label');
|
||||
$('#widgetLabel', this.domElement).html(activeRule.getProperty('label'));
|
||||
$('#widgetLabel', this.domElement).removeClass().addClass('label widget-label ' + activeRule.getProperty('icon'));
|
||||
};
|
||||
|
||||
@@ -273,17 +271,11 @@ define([
|
||||
* Get the active rule and update the Widget's appearance.
|
||||
*/
|
||||
SummaryWidget.prototype.executeRules = function () {
|
||||
if (!this.executingRules) {
|
||||
this.executingRules = true;
|
||||
setTimeout(function () {
|
||||
this.activeId = this.conditionManager.executeRules(
|
||||
this.domainObject.configuration.ruleOrder,
|
||||
this.rulesById
|
||||
);
|
||||
this.updateWidget();
|
||||
this.executingRules = false;
|
||||
}.bind(this), 100);
|
||||
}
|
||||
this.activeId = this.conditionManager.executeRules(
|
||||
this.domainObject.configuration.ruleOrder,
|
||||
this.rulesById
|
||||
);
|
||||
this.updateWidget();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -369,20 +361,13 @@ define([
|
||||
};
|
||||
|
||||
}
|
||||
try {
|
||||
ruleConfig = JSON.parse(JSON.stringify(this.domainObject.configuration.ruleConfigById[ruleId]));
|
||||
this.rulesById[ruleId] = new Rule(ruleConfig, this.domainObject, this.openmct,
|
||||
this.conditionManager, this.widgetDnD, this.container);
|
||||
this.rulesById[ruleId].on('remove', this.refreshRules, this);
|
||||
this.rulesById[ruleId].on('duplicate', this.duplicateRule, this);
|
||||
this.rulesById[ruleId].on('change', this.updateWidget, this);
|
||||
this.rulesById[ruleId].on('conditionChange', this.executeRules, this);
|
||||
} catch (e) {
|
||||
if (e === 'TOO MANY CONDITIONS') {
|
||||
$('#widgetLabel', this.domElement)[0].innerText = 'TOO MANY CONDITIONS';
|
||||
}
|
||||
}
|
||||
|
||||
ruleConfig = this.domainObject.configuration.ruleConfigById[ruleId];
|
||||
this.rulesById[ruleId] = new Rule(ruleConfig, this.domainObject, this.openmct,
|
||||
this.conditionManager, this.widgetDnD, this.container);
|
||||
this.rulesById[ruleId].on('remove', this.refreshRules, this);
|
||||
this.rulesById[ruleId].on('duplicate', this.duplicateRule, this);
|
||||
this.rulesById[ruleId].on('change', this.updateWidget, this);
|
||||
this.rulesById[ruleId].on('conditionChange', this.executeRules, this);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,8 +37,6 @@ define([
|
||||
|
||||
this.deleteButton = $('.t-delete', this.domElement);
|
||||
this.duplicateButton = $('.t-duplicate', this.domElement);
|
||||
this.equalTo = $('.equal-to', this.domElement);
|
||||
|
||||
|
||||
this.selects = {};
|
||||
this.valueInputs = [];
|
||||
@@ -59,13 +57,6 @@ define([
|
||||
if (property === 'key') {
|
||||
self.generateValueInput(value);
|
||||
}
|
||||
if (property === 'object') {
|
||||
if (!value) {
|
||||
self.equalTo.hide();
|
||||
} else {
|
||||
self.equalTo.show();
|
||||
}
|
||||
}
|
||||
self.eventEmitter.emit('change', {
|
||||
value: value,
|
||||
property: property,
|
||||
|
||||
@@ -60,13 +60,13 @@ define([
|
||||
self.generateOptions();
|
||||
}
|
||||
self.select.setSelected(self.config.key);
|
||||
self.objectSelect.on('change', onObjectChange, this);
|
||||
}
|
||||
|
||||
if (self.manager.metadataLoadCompleted()) {
|
||||
onMetadataLoad();
|
||||
}
|
||||
|
||||
this.objectSelect.on('change', onObjectChange, this);
|
||||
this.manager.on('metadata', onMetadataLoad);
|
||||
|
||||
return this.select;
|
||||
|
||||
@@ -21,7 +21,6 @@ define([
|
||||
var self = this;
|
||||
|
||||
this.domElement = $(selectTemplate);
|
||||
this.$select = $('select', this.domElement);
|
||||
this.options = [];
|
||||
this.eventEmitter = new EventEmitter();
|
||||
this.supportedCallbacks = ['change'];
|
||||
@@ -41,7 +40,7 @@ define([
|
||||
self.eventEmitter.emit('change', value[0]);
|
||||
}
|
||||
|
||||
this.listenTo(this.$select, 'change', onChange, this);
|
||||
this.listenTo($('select', this.domElement), 'change', onChange, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,16 +74,16 @@ define([
|
||||
var self = this,
|
||||
selectedIndex = 0;
|
||||
|
||||
selectedIndex = this.$select.prop('selectedIndex');
|
||||
selectedIndex = $('select', this.domElement).prop('selectedIndex');
|
||||
$('option', this.domElement).remove();
|
||||
|
||||
self.options.forEach(function (option, index) {
|
||||
self.$select
|
||||
$('select', self.domElement)
|
||||
.append('<option value = "' + option[0] + '"' + ' >' +
|
||||
option[1] + '</option>');
|
||||
});
|
||||
|
||||
this.$select.prop('selectedIndex', selectedIndex);
|
||||
$('select', this.domElement).prop('selectedIndex', selectedIndex);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -121,7 +120,7 @@ define([
|
||||
selectedIndex = index;
|
||||
}
|
||||
});
|
||||
this.$select.prop('selectedIndex', selectedIndex);
|
||||
$('select', this.domElement).prop('selectedIndex', selectedIndex);
|
||||
|
||||
selectedOption = this.options[selectedIndex];
|
||||
this.eventEmitter.emit('change', selectedOption[0]);
|
||||
@@ -132,15 +131,17 @@ define([
|
||||
* @return {string}
|
||||
*/
|
||||
Select.prototype.getSelected = function () {
|
||||
return this.$select.prop('value');
|
||||
return $('select', this.domElement).prop('value');
|
||||
};
|
||||
|
||||
Select.prototype.hide = function () {
|
||||
this.domElement.addClass('hidden');
|
||||
$(this.domElement).addClass('hidden');
|
||||
$('.equal-to').addClass('hidden');
|
||||
};
|
||||
|
||||
Select.prototype.show = function () {
|
||||
this.domElement.removeClass('hidden');
|
||||
$(this.domElement).removeClass('hidden');
|
||||
$('.equal-to').removeClass('hidden');
|
||||
};
|
||||
|
||||
Select.prototype.destroy = function () {
|
||||
|
||||
@@ -325,6 +325,10 @@ define(['../src/ConditionEvaluator'], function (ConditionEvaluator) {
|
||||
testOperation = testEvaluator.operations.isUndefined.operation;
|
||||
expect(testOperation([1])).toEqual(false);
|
||||
expect(testOperation([])).toEqual(true);
|
||||
//isDefined
|
||||
testOperation = testEvaluator.operations.isDefined.operation;
|
||||
expect(testOperation([1])).toEqual(true);
|
||||
expect(testOperation([])).toEqual(false);
|
||||
});
|
||||
|
||||
it('can produce a description for all supported operations', function () {
|
||||
|
||||
@@ -115,7 +115,7 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
element.addEventListener('click', selectCapture);
|
||||
|
||||
if (select) {
|
||||
this.select(selectable);
|
||||
element.click();
|
||||
}
|
||||
|
||||
return function () {
|
||||
|
||||
@@ -66,7 +66,7 @@ requirejs.config({
|
||||
"vue": "node_modules/vue/dist/vue.min",
|
||||
"zepto": "bower_components/zepto/zepto.min",
|
||||
"lodash": "bower_components/lodash/lodash",
|
||||
"d3-selection": "node_modules/d3-selection/build/d3-selection.min",
|
||||
"d3-selection": "node_modules/d3-selection/dist/d3-selection.min",
|
||||
"d3-scale": "node_modules/d3-scale/build/d3-scale.min",
|
||||
"d3-axis": "node_modules/d3-axis/build/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/build/d3-array.min",
|
||||
|
||||
Reference in New Issue
Block a user