Compare commits
159 Commits
summary-wi
...
telemetry-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b939eb2fbe | ||
|
|
1afecdc82c | ||
|
|
b9cda6985e | ||
|
|
401b7e3f19 | ||
|
|
c9e9845172 | ||
|
|
abbba38eac | ||
|
|
db856251da | ||
|
|
e1566e448d | ||
|
|
d9aae0700c | ||
|
|
5c29726cc0 | ||
|
|
5c207c3fe0 | ||
|
|
eba1dd1a4e | ||
|
|
570edc0dec | ||
|
|
ad6bcd4ef8 | ||
|
|
aedbbbbf75 | ||
|
|
3caaf00483 | ||
|
|
971eda4d88 | ||
|
|
090d216517 | ||
|
|
d42d7ae68d | ||
|
|
68e6e3c121 | ||
|
|
7e7f39db2d | ||
|
|
b6e0fca828 | ||
|
|
ffc5896e5a | ||
|
|
fd6ebd152f | ||
|
|
7a5c1c0e1f | ||
|
|
2f7e1e3f1a | ||
|
|
d73746b51b | ||
|
|
2df54af019 | ||
|
|
586269f761 | ||
|
|
e536ab34d7 | ||
|
|
e15002dd72 | ||
|
|
453cf3ad6a | ||
|
|
5c46e48bde | ||
|
|
868ea9362f | ||
|
|
d69106ff2c | ||
|
|
1658b17c56 | ||
|
|
39cf0528ca | ||
|
|
3d12f7312b | ||
|
|
22481fdc31 | ||
|
|
4a9d27dc79 | ||
|
|
a5a9fefd40 | ||
|
|
dae4074934 | ||
|
|
a540a3573f | ||
|
|
4e7fe9082c | ||
|
|
568141bf81 | ||
|
|
ac3ea43fe5 | ||
|
|
e922e8d504 | ||
|
|
650a877d2a | ||
|
|
1202109c59 | ||
|
|
429d7bbd57 | ||
|
|
af749fe71b | ||
|
|
cf64c512ce | ||
|
|
14592d1c3e | ||
|
|
c5bd3da44a | ||
|
|
ff3e49e926 | ||
|
|
e244a3e431 | ||
|
|
c5d9fb6fd9 | ||
|
|
4c276ab422 | ||
|
|
bf321abae4 | ||
|
|
7336968ef9 | ||
|
|
d60956948b | ||
|
|
23d5c2e1ee | ||
|
|
2632b8891a | ||
|
|
fff4cd9d51 | ||
|
|
7f9fd5c705 | ||
|
|
be0291cf70 | ||
|
|
b3a6d7271d | ||
|
|
ebeed2f236 | ||
|
|
337c26c019 | ||
|
|
730f363f94 | ||
|
|
ae30e6110b | ||
|
|
6e4bf3e45b | ||
|
|
5465ca92f9 | ||
|
|
e55ea41b0a | ||
|
|
8cfb3cc689 | ||
|
|
2d728a1362 | ||
|
|
99333988df | ||
|
|
de783d4286 | ||
|
|
1e1a2443d5 | ||
|
|
d65e1e604e | ||
|
|
f6c1488ccd | ||
|
|
26be1ecf37 | ||
|
|
38f0f072bb | ||
|
|
e5e969665f | ||
|
|
ffbb662c99 | ||
|
|
bd7b23f896 | ||
|
|
c238def902 | ||
|
|
2d430ece7f | ||
|
|
c92644a661 | ||
|
|
41ce3c04f7 | ||
|
|
fcf77f359f | ||
|
|
40a2737915 | ||
|
|
216489d67f | ||
|
|
418a393b26 | ||
|
|
1f3d744494 | ||
|
|
ff3f2dccba | ||
|
|
e69973bd29 | ||
|
|
05b352cc36 | ||
|
|
9735548999 | ||
|
|
f9529b1362 | ||
|
|
c598cec702 | ||
|
|
e9ea1c4a0f | ||
|
|
e9238ff282 | ||
|
|
4cebd72cba | ||
|
|
f8a44d6e71 | ||
|
|
d0745b300b | ||
|
|
2a4e0a3081 | ||
|
|
1ff19f9574 | ||
|
|
7ef84cb50d | ||
|
|
cd05c70d64 | ||
|
|
568473b82f | ||
|
|
c61b074755 | ||
|
|
8ed66ab4ab | ||
|
|
b2502dd998 | ||
|
|
856eedbf9d | ||
|
|
0c0ca6e6af | ||
|
|
498b797e49 | ||
|
|
02c33388ba | ||
|
|
8a8e3cc055 | ||
|
|
36d60b16e9 | ||
|
|
de3114568b | ||
|
|
eb5835faeb | ||
|
|
ff1ddb0b79 | ||
|
|
15b127bb2e | ||
|
|
e4ed881f6d | ||
|
|
7b62cf130c | ||
|
|
72fd2e531c | ||
|
|
4a5392ef78 | ||
|
|
0150a708ca | ||
|
|
eacc181d5e | ||
|
|
405bb55881 | ||
|
|
4a35508459 | ||
|
|
98a9d71a2e | ||
|
|
a1596d0b06 | ||
|
|
4b3be4c483 | ||
|
|
0fa8472db1 | ||
|
|
e1e2dca1d8 | ||
|
|
755c013ec8 | ||
|
|
eab702b763 | ||
|
|
d15446ac91 | ||
|
|
500733afb2 | ||
|
|
2aa04b0a56 | ||
|
|
c051f342af | ||
|
|
8aeb365f5f | ||
|
|
827a28313d | ||
|
|
c83de8aad2 | ||
|
|
b55f43b8df | ||
|
|
8466723a90 | ||
|
|
a103b4dbff | ||
|
|
826ac3a947 | ||
|
|
597327f138 | ||
|
|
bef79402ca | ||
|
|
e68e0c381f | ||
|
|
c73f7259c2 | ||
|
|
4c9235ba10 | ||
|
|
55e2a77df8 | ||
|
|
cfbff02e7f | ||
|
|
54980fb296 | ||
|
|
ba98d9315c |
15
API.md
15
API.md
@@ -879,21 +879,6 @@ openmct.install(openmct.plugins.CouchDB('http://localhost:9200'))
|
||||
* `openmct.plugins.Espresso` and `openmct.plugins.Snow` are two different
|
||||
themes (dark and light) available for Open MCT. Note that at least one
|
||||
of these themes must be installed for Open MCT to appear correctly.
|
||||
* `openmct.plugins.URLIndicatorPlugin` adds an indicator which shows the
|
||||
availability of a URL with the following options:
|
||||
- `url` : URL to indicate the status of
|
||||
- `cssClass`: Icon to show in the status bar, defaults to `icon-database`, [list of all icons](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home?view=items)
|
||||
- `interval`: Interval between checking the connection, defaults to `10000`
|
||||
- `label` Name showing up as text in the status bar, defaults to url
|
||||
```javascript
|
||||
openmct.install(openmct.plugins.URLIndicatorPlugin({
|
||||
url: 'http://google.com',
|
||||
cssClass: 'check',
|
||||
interval: 10000,
|
||||
label: 'Google'
|
||||
})
|
||||
);
|
||||
```
|
||||
* `openmct.plugins.LocalStorage` provides persistence of user-created
|
||||
objects in browser-local storage. This is particularly useful in
|
||||
development environments.
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
"screenfull": "^3.0.0",
|
||||
"node-uuid": "^1.4.7",
|
||||
"comma-separated-values": "^3.6.4",
|
||||
"file-saver": "^1.3.3",
|
||||
"zepto": "^1.1.6",
|
||||
"FileSaver.js": "^0.0.2",
|
||||
"zepto": "1.2.0",
|
||||
"eventemitter3": "^1.2.0",
|
||||
"lodash": "3.10.1",
|
||||
"almond": "~0.3.2",
|
||||
|
||||
@@ -4,6 +4,12 @@ deployment:
|
||||
commands:
|
||||
- npm install canvas nomnoml
|
||||
- ./build-docs.sh
|
||||
- git fetch --unshallow
|
||||
- git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master
|
||||
openmct-demo:
|
||||
branch: live_demo
|
||||
heroku:
|
||||
appname: openmct-demo
|
||||
openmctweb-staging-deux:
|
||||
branch: mobile
|
||||
heroku:
|
||||
|
||||
@@ -44,7 +44,9 @@ define([
|
||||
message = message.data;
|
||||
var callback = this.callbacks[message.id];
|
||||
if (callback) {
|
||||
callback(message);
|
||||
if (callback(message)) {
|
||||
delete this.callbacks[message.id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +72,6 @@ define([
|
||||
deferred.resolve = resolve;
|
||||
deferred.reject = reject;
|
||||
});
|
||||
var messageId;
|
||||
|
||||
function callback(message) {
|
||||
if (message.error) {
|
||||
@@ -78,27 +79,33 @@ define([
|
||||
} else {
|
||||
deferred.resolve(message.data);
|
||||
}
|
||||
delete this.callbacks[messageId];
|
||||
return true;
|
||||
}
|
||||
|
||||
messageId = this.dispatch('request', request, callback.bind(this));
|
||||
this.dispatch('request', request, callback);
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
WorkerInterface.prototype.subscribe = function (request, cb) {
|
||||
function callback(message) {
|
||||
var isCancelled = false;
|
||||
|
||||
var callback = function (message) {
|
||||
if (isCancelled) {
|
||||
return true;
|
||||
}
|
||||
cb(message.data);
|
||||
};
|
||||
|
||||
var messageId = this.dispatch('subscribe', request, callback);
|
||||
var messageId = this.dispatch('subscribe', request, callback)
|
||||
|
||||
return function () {
|
||||
isCancelled = true;
|
||||
this.dispatch('unsubscribe', {
|
||||
id: messageId
|
||||
});
|
||||
delete this.callbacks[messageId];
|
||||
}.bind(this);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
openmct.install(openmct.plugins.ExampleImagery());
|
||||
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||
openmct.install(openmct.plugins.ImportExport());
|
||||
openmct.install(openmct.plugins.TelemetryMean());
|
||||
openmct.install(openmct.plugins.Conductor({
|
||||
menuOptions: [
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ requirejs.config({
|
||||
"moment": "bower_components/moment/moment",
|
||||
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
|
||||
"moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data",
|
||||
"saveAs": "bower_components/file-saver/FileSaver.min",
|
||||
"saveAs": "bower_components/FileSaver.js/FileSaver.min",
|
||||
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
||||
"text": "bower_components/text/text",
|
||||
"uuid": "bower_components/node-uuid/uuid",
|
||||
@@ -66,9 +66,6 @@ requirejs.config({
|
||||
"moment-duration-format": {
|
||||
"deps": ["moment"]
|
||||
},
|
||||
"saveAs": {
|
||||
"exports": "saveAs"
|
||||
},
|
||||
"screenfull": {
|
||||
"exports": "screenfull"
|
||||
},
|
||||
|
||||
@@ -42,37 +42,23 @@ define(
|
||||
* @param event the mouse event
|
||||
*/
|
||||
ObjectHeaderController.prototype.updateName = function (event) {
|
||||
if (!event || !event.currentTarget) {
|
||||
return;
|
||||
}
|
||||
if (event && (event.type === 'blur' || event.which === 13)) {
|
||||
var name = event.currentTarget.innerHTML;
|
||||
|
||||
if (event.type === 'blur') {
|
||||
this.updateModel(event);
|
||||
} else if (event.which === 13) {
|
||||
this.updateModel(event);
|
||||
event.currentTarget.blur();
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
};
|
||||
if (name.length === 0) {
|
||||
name = "Unnamed " + this.domainObject.getCapability("type").typeDef.name;
|
||||
event.currentTarget.innerHTML = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the model.
|
||||
*
|
||||
* @param event the mouse event
|
||||
* @param private
|
||||
*/
|
||||
ObjectHeaderController.prototype.updateModel = function (event) {
|
||||
var name = event.currentTarget.textContent.replace(/\n/g, ' ');
|
||||
if (name !== this.$scope.domainObject.model.name) {
|
||||
this.domainObject.getCapability('mutation').mutate(function (model) {
|
||||
model.name = name;
|
||||
});
|
||||
}
|
||||
|
||||
if (name.length === 0) {
|
||||
name = "Unnamed " + this.domainObject.getCapability("type").typeDef.name;
|
||||
event.currentTarget.textContent = name;
|
||||
}
|
||||
|
||||
if (name !== this.domainObject.getModel().name) {
|
||||
this.domainObject.getCapability('mutation').mutate(function (model) {
|
||||
model.name = name;
|
||||
});
|
||||
if (event.which === 13) {
|
||||
event.currentTarget.blur();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ define(
|
||||
mockTypeCapability,
|
||||
mockEvent,
|
||||
mockCurrentTarget,
|
||||
model,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -48,11 +47,8 @@ define(
|
||||
type: mockTypeCapability
|
||||
};
|
||||
|
||||
model = {
|
||||
name: "Test name"
|
||||
};
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", ["getCapability", "getModel"]);
|
||||
mockDomainObject.getModel.andReturn(model);
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", ["getCapability", "model"]);
|
||||
mockDomainObject.model = {name: "Test name"};
|
||||
mockDomainObject.getCapability.andCallFake(function (key) {
|
||||
return mockCapabilities[key];
|
||||
});
|
||||
@@ -61,7 +57,7 @@ define(
|
||||
domainObject: mockDomainObject
|
||||
};
|
||||
|
||||
mockCurrentTarget = jasmine.createSpyObj("currentTarget", ["blur", "textContent"]);
|
||||
mockCurrentTarget = jasmine.createSpyObj("currentTarget", ["blur", "innerHTML"]);
|
||||
mockCurrentTarget.blur.andReturn(mockCurrentTarget);
|
||||
|
||||
mockEvent = {
|
||||
@@ -75,7 +71,7 @@ define(
|
||||
|
||||
it("updates the model with new name on blur", function () {
|
||||
mockEvent.type = "blur";
|
||||
mockCurrentTarget.textContent = "New name";
|
||||
mockCurrentTarget.innerHTML = "New name";
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalled();
|
||||
@@ -83,23 +79,23 @@ define(
|
||||
|
||||
it("updates the model with a default for blank names", function () {
|
||||
mockEvent.type = "blur";
|
||||
mockCurrentTarget.textContent = "";
|
||||
mockCurrentTarget.innerHTML = "";
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockCurrentTarget.textContent.length).not.toEqual(0);
|
||||
expect(mockCurrentTarget.innerHTML.length).not.toEqual(0);
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not update the model if the same name", function () {
|
||||
mockEvent.type = "blur";
|
||||
mockCurrentTarget.textContent = mockDomainObject.getModel().name;
|
||||
mockCurrentTarget.innerHTML = mockDomainObject.model.name;
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates the model on enter keypress event only", function () {
|
||||
mockCurrentTarget.textContent = "New name";
|
||||
mockCurrentTarget.innerHTML = "New name";
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).not.toHaveBeenCalled();
|
||||
@@ -109,13 +105,12 @@ define(
|
||||
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
|
||||
mockMutationCapability.mutate.mostRecentCall.args[0](model);
|
||||
mockMutationCapability.mutate.mostRecentCall.args[0](mockDomainObject.model);
|
||||
|
||||
expect(mockDomainObject.getModel().name).toBe("New name");
|
||||
expect(mockDomainObject.model.name).toBe("New name");
|
||||
});
|
||||
|
||||
it("blurs the field on enter key press", function () {
|
||||
mockCurrentTarget.textContent = "New name";
|
||||
mockEvent.which = 13;
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
|
||||
@@ -101,15 +101,10 @@ define(
|
||||
*/
|
||||
EditorCapability.prototype.finish = function () {
|
||||
var domainObject = this.domainObject;
|
||||
|
||||
if (this.transactionService.isActive()) {
|
||||
return this.transactionService.cancel().then(function () {
|
||||
domainObject.getCapability("status").set("editing", false);
|
||||
return domainObject;
|
||||
});
|
||||
} else {
|
||||
return Promise.resolve(domainObject);
|
||||
}
|
||||
return this.transactionService.cancel().then(function () {
|
||||
domainObject.getCapability("status").set("editing", false);
|
||||
return domainObject;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,6 +80,12 @@ define(
|
||||
return closeEditor();
|
||||
}
|
||||
|
||||
function resolveWith (object) {
|
||||
return function () {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
newModel.type = this.type.getKey();
|
||||
newModel.location = this.parent.getId();
|
||||
newObject = this.parent.useCapability('instantiation', newModel);
|
||||
|
||||
@@ -62,7 +62,6 @@ define(
|
||||
);
|
||||
mockTransactionService.commit.andReturn(fastPromise());
|
||||
mockTransactionService.cancel.andReturn(fastPromise());
|
||||
mockTransactionService.isActive = jasmine.createSpy('isActive');
|
||||
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"statusCapability",
|
||||
@@ -142,7 +141,6 @@ define(
|
||||
|
||||
describe("finish", function () {
|
||||
beforeEach(function () {
|
||||
mockTransactionService.isActive.andReturn(true);
|
||||
capability.edit();
|
||||
capability.finish();
|
||||
});
|
||||
@@ -154,23 +152,6 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
describe("finish", function () {
|
||||
beforeEach(function () {
|
||||
mockTransactionService.isActive.andReturn(false);
|
||||
capability.edit();
|
||||
});
|
||||
|
||||
it("does not cancel transaction when transaction is not active", function () {
|
||||
capability.finish();
|
||||
expect(mockTransactionService.cancel).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns a promise", function () {
|
||||
expect(capability.finish() instanceof Promise).toBe(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("dirty", function () {
|
||||
var model = {};
|
||||
|
||||
|
||||
@@ -290,11 +290,6 @@
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.l-rule-action-buttons-wrapper {
|
||||
.t-delete {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
.t-condition {
|
||||
&:hover {
|
||||
.l-condition-action-buttons-wrapper {
|
||||
|
||||
@@ -45,7 +45,9 @@
|
||||
&.t-object-type-timer,
|
||||
&.t-object-type-clock,
|
||||
&.t-object-type-hyperlink,
|
||||
&.t-object-type-summary-widget {
|
||||
&.t-object-type-summary-widget,
|
||||
&.no-frame .t-object-type-fixed-display,
|
||||
&.no-frame .t-object-type-layout {
|
||||
// Hide the right side buttons for objects where they don't make sense
|
||||
// Note that this will hide the view Switcher button if applied
|
||||
// to an object that has it.
|
||||
@@ -104,7 +106,7 @@
|
||||
}
|
||||
&.t-frame-outer > .t-rep-frame {
|
||||
&.contents {
|
||||
$m: 2px;
|
||||
$m: 0px;
|
||||
top: $m;
|
||||
right: $m;
|
||||
bottom: $m;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
.s-hover-border {
|
||||
border: 1px dotted transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.s-status-editing {
|
||||
|
||||
@@ -36,9 +36,7 @@ define(
|
||||
* @param {ActionContext} context the context for this action
|
||||
*/
|
||||
function FollowTimerAction(timerService, context) {
|
||||
var domainObject =
|
||||
context.domainObject &&
|
||||
context.domainObject.useCapability('adapter');
|
||||
var domainObject = context.domainObject;
|
||||
this.perform =
|
||||
timerService.setTimer.bind(timerService, domainObject);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
function TimerService(openmct) {
|
||||
EventEmitter.apply(this);
|
||||
this.time = openmct.time;
|
||||
this.objects = openmct.objects;
|
||||
}
|
||||
|
||||
TimerService.prototype = Object.create(EventEmitter.prototype);
|
||||
@@ -45,16 +44,6 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
TimerService.prototype.setTimer = function (timer) {
|
||||
this.timer = timer;
|
||||
this.emit('change');
|
||||
|
||||
if (this.stopObserving) {
|
||||
this.stopObserving();
|
||||
delete this.stopObserving;
|
||||
}
|
||||
|
||||
if (timer) {
|
||||
this.stopObserving =
|
||||
this.objects.observe(timer, '*', this.setTimer.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -84,16 +73,16 @@ define(['EventEmitter'], function (EventEmitter) {
|
||||
var clock = this.time.clock();
|
||||
var canConvert = this.hasTimer() &&
|
||||
!!clock &&
|
||||
this.timer.timerState !== 'stopped';
|
||||
this.timer.getModel().timerState !== 'stopped';
|
||||
|
||||
if (!canConvert) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var now = clock.currentValue();
|
||||
var delta = this.timer.timerState === 'paused' ?
|
||||
now - this.timer.pausedTime : 0;
|
||||
var epoch = this.timer.timestamp;
|
||||
var model = this.timer.getModel();
|
||||
var delta = model.timerState === 'paused' ? now - model.pausedTime : 0;
|
||||
var epoch = model.timestamp;
|
||||
|
||||
return timestamp - epoch - delta;
|
||||
};
|
||||
|
||||
@@ -29,19 +29,12 @@ define([
|
||||
describe("The Follow Timer action", function () {
|
||||
var testContext;
|
||||
var testModel;
|
||||
var testAdaptedObject;
|
||||
|
||||
beforeEach(function () {
|
||||
testModel = {};
|
||||
testContext = { domainObject: jasmine.createSpyObj('domainObject', [
|
||||
'getModel',
|
||||
'useCapability'
|
||||
]) };
|
||||
testAdaptedObject = { foo: 'bar' };
|
||||
testContext.domainObject.getModel.andReturn(testModel);
|
||||
testContext.domainObject.useCapability.andCallFake(function (c) {
|
||||
return c === 'adapter' && testAdaptedObject;
|
||||
});
|
||||
testContext = { domainObject: { getModel: function () {
|
||||
return testModel;
|
||||
} } };
|
||||
});
|
||||
|
||||
it("is applicable to timers", function () {
|
||||
@@ -79,7 +72,7 @@ define([
|
||||
|
||||
it("sets the active timer", function () {
|
||||
expect(mockTimerService.setTimer)
|
||||
.toHaveBeenCalledWith(testAdaptedObject);
|
||||
.toHaveBeenCalledWith(testContext.domainObject);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,10 +30,7 @@ define([
|
||||
|
||||
beforeEach(function () {
|
||||
callback = jasmine.createSpy('callback');
|
||||
mockmct = {
|
||||
time: { clock: jasmine.createSpy('clock') },
|
||||
objects: { observe: jasmine.createSpy('observe') }
|
||||
};
|
||||
mockmct = { time: { clock: jasmine.createSpy('clock') } };
|
||||
timerService = new TimerService(mockmct);
|
||||
timerService.on('change', callback);
|
||||
});
|
||||
@@ -61,17 +58,6 @@ define([
|
||||
it("reports the current timer", function () {
|
||||
expect(timerService.getTimer()).toBe(testTimer);
|
||||
});
|
||||
|
||||
it("observes changes to an object", function () {
|
||||
var newTimer = { name: "I am another timer." };
|
||||
expect(mockmct.objects.observe).toHaveBeenCalledWith(
|
||||
testTimer,
|
||||
'*',
|
||||
jasmine.any(Function)
|
||||
);
|
||||
mockmct.objects.observe.mostRecentCall.args[2](newTimer);
|
||||
expect(timerService.getTimer()).toBe(newTimer);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -255,8 +255,6 @@ define(
|
||||
if (this.nextDatum) {
|
||||
this.updateValues(this.nextDatum);
|
||||
delete this.nextDatum;
|
||||
} else {
|
||||
this.updateValues(this.$scope.imageHistory[this.$scope.imageHistory.length - 1]);
|
||||
}
|
||||
this.autoScroll = true;
|
||||
}
|
||||
|
||||
@@ -183,17 +183,6 @@ define(
|
||||
expect(controller.getImageUrl()).toEqual(newUrl);
|
||||
});
|
||||
|
||||
it("forwards large image view to latest image in history on un-pause", function () {
|
||||
$scope.imageHistory = [
|
||||
{ utc: 1434600258122, url: 'some/url1', selected: false},
|
||||
{ utc: 1434600258123, url: 'some/url2', selected: false}
|
||||
];
|
||||
controller.paused(true);
|
||||
controller.paused(false);
|
||||
|
||||
expect(controller.getImageUrl()).toEqual(controller.getImageUrl($scope.imageHistory[1]));
|
||||
});
|
||||
|
||||
it("subscribes to telemetry", function () {
|
||||
expect(openmct.telemetry.subscribe).toHaveBeenCalledWith(
|
||||
newDomainObject,
|
||||
@@ -238,7 +227,7 @@ define(
|
||||
expect(controller.updateHistory(mockDatum)).toBe(false);
|
||||
});
|
||||
|
||||
describe("when user clicks on imagery thumbnail", function () {
|
||||
describe("user clicks on imagery thumbnail", function () {
|
||||
var mockDatum = { utc: 1434600258123, url: 'some/url', selected: false};
|
||||
|
||||
it("pauses and adds selected class to imagery thumbnail", function () {
|
||||
@@ -259,7 +248,6 @@ define(
|
||||
expect(controller.getTime()).toEqual(controller.timeFormat.format(mockDatum.utc));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it("initially shows an empty string for date/time", function () {
|
||||
|
||||
@@ -360,47 +360,22 @@ define(
|
||||
*/
|
||||
FixedController.prototype.updateView = function (telemetryObject, datum) {
|
||||
var metadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||
var telemetryKeyToDisplay = this.chooseTelemetryKeyToDisplay(metadata);
|
||||
var formattedTelemetryValue = this.getFormattedTelemetryValueForKey(telemetryKeyToDisplay, datum, metadata);
|
||||
var rangeMetadata = metadata.valuesForHints(['range'])[0];
|
||||
var rangeKey = rangeMetadata.source || rangeMetadata.key;
|
||||
var valueMetadata = metadata.value(rangeKey);
|
||||
var limitEvaluator = this.openmct.telemetry.limitEvaluator(telemetryObject);
|
||||
var alarm = limitEvaluator && limitEvaluator.evaluate(datum, telemetryKeyToDisplay);
|
||||
var formatter = this.openmct.telemetry.getValueFormatter(valueMetadata);
|
||||
var value = datum[valueMetadata.key];
|
||||
var alarm = limitEvaluator && limitEvaluator.evaluate(datum, rangeKey);
|
||||
|
||||
this.setDisplayedValue(
|
||||
telemetryObject,
|
||||
formattedTelemetryValue,
|
||||
formatter.format(value),
|
||||
alarm && alarm.cssClass
|
||||
);
|
||||
this.digest();
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
FixedController.prototype.getFormattedTelemetryValueForKey = function (telemetryKeyToDisplay, datum, metadata) {
|
||||
var valueMetadata = metadata.value(telemetryKeyToDisplay);
|
||||
var formatter = this.openmct.telemetry.getValueFormatter(valueMetadata);
|
||||
|
||||
return formatter.format(datum[valueMetadata.key]);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
FixedController.prototype.chooseTelemetryKeyToDisplay = function (metadata) {
|
||||
// If there is a range value, show that preferentially
|
||||
var telemetryKeyToDisplay = metadata.valuesForHints(['range'])[0];
|
||||
|
||||
// If no range is defined, default to the highest priority non time-domain data.
|
||||
if (telemetryKeyToDisplay === undefined) {
|
||||
var valuesOrderedByPriority = metadata.values();
|
||||
telemetryKeyToDisplay = valuesOrderedByPriority.filter(function (valueMetadata) {
|
||||
return !(valueMetadata.hints.domain);
|
||||
})[0];
|
||||
}
|
||||
|
||||
return telemetryKeyToDisplay.source;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request the last historical data point for the given domain objects
|
||||
* @param {object[]} objects
|
||||
@@ -413,9 +388,7 @@ define(
|
||||
objects.forEach(function (object) {
|
||||
self.openmct.telemetry.request(object, {start: bounds.start, end: bounds.end, size: 1})
|
||||
.then(function (data) {
|
||||
if (data.length > 0) {
|
||||
self.updateView(object, data[data.length - 1]);
|
||||
}
|
||||
self.updateView(object, data[data.length - 1]);
|
||||
});
|
||||
});
|
||||
return objects;
|
||||
|
||||
@@ -26,12 +26,8 @@
|
||||
* @namespace platform/features/layout
|
||||
*/
|
||||
define(
|
||||
[
|
||||
'./LayoutDrag'
|
||||
],
|
||||
function (
|
||||
LayoutDrag
|
||||
) {
|
||||
['./LayoutDrag'],
|
||||
function (LayoutDrag) {
|
||||
|
||||
var DEFAULT_DIMENSIONS = [12, 8],
|
||||
DEFAULT_GRID_SIZE = [32, 32],
|
||||
@@ -127,8 +123,6 @@ define(
|
||||
if (self.droppedIdToSelectAfterRefresh) {
|
||||
self.select(null, self.droppedIdToSelectAfterRefresh);
|
||||
delete self.droppedIdToSelectAfterRefresh;
|
||||
} else if (composition.indexOf(self.selectedId) === -1) {
|
||||
self.clearSelection();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -178,6 +178,7 @@ define(
|
||||
Promise.resolve(mockChildren)
|
||||
);
|
||||
|
||||
|
||||
mockScope.model = testModel;
|
||||
mockScope.configuration = testConfiguration;
|
||||
mockScope.selection = jasmine.createSpyObj(
|
||||
@@ -193,8 +194,7 @@ define(
|
||||
|
||||
mockMetadata = jasmine.createSpyObj('mockMetadata', [
|
||||
'valuesForHints',
|
||||
'value',
|
||||
'values'
|
||||
'value'
|
||||
]);
|
||||
mockMetadata.value.andReturn({
|
||||
key: 'value'
|
||||
@@ -653,39 +653,6 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
it("selects an range value to display, if available", function () {
|
||||
mockMetadata.valuesForHints.andReturn([
|
||||
{
|
||||
key: 'range',
|
||||
source: 'range'
|
||||
}
|
||||
]);
|
||||
var key = controller.chooseTelemetryKeyToDisplay(mockMetadata);
|
||||
expect(key).toEqual('range');
|
||||
});
|
||||
|
||||
it("selects the first non-domain value to display, if no range available", function () {
|
||||
mockMetadata.valuesForHints.andReturn([]);
|
||||
mockMetadata.values.andReturn([
|
||||
{
|
||||
key: 'domain',
|
||||
source: 'domain',
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'image',
|
||||
source: 'image',
|
||||
hints: {
|
||||
image: 1
|
||||
}
|
||||
}
|
||||
]);
|
||||
var key = controller.chooseTelemetryKeyToDisplay(mockMetadata);
|
||||
expect(key).toEqual('image');
|
||||
});
|
||||
|
||||
it("reflects limit status", function () {
|
||||
mockLimitEvaluator.evaluate.andReturn({cssClass: "alarm-a"});
|
||||
controller.updateView(mockTelemetryObject, [{
|
||||
|
||||
@@ -424,17 +424,6 @@ define(
|
||||
expect(selectedObj.showFrame).toEqual(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("deselects the object that is no longer in the composition", function () {
|
||||
mockScope.$watchCollection.mostRecentCall.args[1]();
|
||||
var childObj = mockCompositionObjects[0];
|
||||
controller.select(mockEvent, childObj.getId());
|
||||
|
||||
var composition = ["b", "c"];
|
||||
mockScope.$watchCollection.mostRecentCall.args[1](composition);
|
||||
|
||||
expect(controller.selected(childObj)).toBe(false);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
{
|
||||
"key": "ListViewController",
|
||||
"implementation": ListViewController,
|
||||
"depends": ["$scope", "formatService"]
|
||||
"depends": ["$scope"]
|
||||
}
|
||||
],
|
||||
"directives": [
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define(function () {
|
||||
function ListViewController($scope, formatService) {
|
||||
function ListViewController($scope) {
|
||||
this.$scope = $scope;
|
||||
$scope.orderByField = 'title';
|
||||
$scope.reverseSort = false;
|
||||
@@ -30,8 +30,6 @@ define(function () {
|
||||
var unlisten = $scope.domainObject.getCapability('mutation')
|
||||
.listen(this.updateView.bind(this));
|
||||
|
||||
this.utc = formatService.getFormat('utc');
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
unlisten();
|
||||
});
|
||||
@@ -52,13 +50,17 @@ define(function () {
|
||||
icon: child.getCapability('type').getCssClass(),
|
||||
title: child.getModel().name,
|
||||
type: child.getCapability('type').getName(),
|
||||
persisted: this.utc.format(child.getModel().persisted),
|
||||
modified: this.utc.format(child.getModel().modified),
|
||||
persisted: new Date(
|
||||
child.getModel().persisted
|
||||
).toUTCString(),
|
||||
modified: new Date(
|
||||
child.getModel().modified
|
||||
).toUTCString(),
|
||||
asDomainObject: child,
|
||||
location: child.getCapability('location'),
|
||||
action: child.getCapability('action')
|
||||
};
|
||||
}, this);
|
||||
});
|
||||
};
|
||||
|
||||
return ListViewController;
|
||||
|
||||
@@ -31,9 +31,7 @@ define(
|
||||
controller,
|
||||
childModel,
|
||||
typeCapability,
|
||||
mutationCapability,
|
||||
formatService;
|
||||
|
||||
mutationCapability;
|
||||
beforeEach(function () {
|
||||
unlistenFunc = jasmine.createSpy("unlisten");
|
||||
|
||||
@@ -43,18 +41,6 @@ define(
|
||||
);
|
||||
mutationCapability.listen.andReturn(unlistenFunc);
|
||||
|
||||
formatService = jasmine.createSpyObj(
|
||||
"formatService",
|
||||
["getFormat"]
|
||||
);
|
||||
formatService.getFormat.andReturn(jasmine.createSpyObj(
|
||||
'utc',
|
||||
["format"]
|
||||
));
|
||||
formatService.getFormat().format.andCallFake(function (v) {
|
||||
return "formatted " + v;
|
||||
});
|
||||
|
||||
typeCapability = jasmine.createSpyObj(
|
||||
"typeCapability",
|
||||
["getCssClass", "getName"]
|
||||
@@ -108,27 +94,20 @@ define(
|
||||
);
|
||||
scope.domainObject = domainObject;
|
||||
|
||||
controller = new ListViewController(scope, formatService);
|
||||
controller = new ListViewController(scope);
|
||||
|
||||
waitsFor(function () {
|
||||
return scope.children;
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the UTC time format", function () {
|
||||
expect(formatService.getFormat).toHaveBeenCalledWith('utc');
|
||||
});
|
||||
|
||||
it("updates the view", function () {
|
||||
expect(scope.children[0]).toEqual(
|
||||
{
|
||||
icon: "icon-folder",
|
||||
title: "Battery Charge Status",
|
||||
type: "Folder",
|
||||
persisted: formatService.getFormat('utc')
|
||||
.format(childModel.persisted),
|
||||
modified: formatService.getFormat('utc')
|
||||
.format(childModel.modified),
|
||||
persisted: "Wed, 07 Jun 2017 20:34:57 GMT",
|
||||
modified: "Wed, 07 Jun 2017 20:34:57 GMT",
|
||||
asDomainObject: childObject,
|
||||
location: ''
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
var DIGITS = 3;
|
||||
var DIGITS = 2;
|
||||
|
||||
/**
|
||||
* Wraps a `TelemetryFormatter` to provide formats for domain and
|
||||
|
||||
@@ -170,9 +170,6 @@ define(
|
||||
* @param rows
|
||||
*/
|
||||
TelemetryTableController.prototype.addRowsToTable = function (rows) {
|
||||
rows.forEach(function (row) {
|
||||
this.$scope.rows.push(row);
|
||||
}, this);
|
||||
this.$scope.$broadcast('add:rows', rows);
|
||||
};
|
||||
|
||||
|
||||
@@ -436,28 +436,5 @@ define(
|
||||
expect(mockScope.$broadcast).toHaveBeenCalledWith("remove:rows", discardedRows);
|
||||
});
|
||||
|
||||
describe('when telemetry is added', function () {
|
||||
var testRows;
|
||||
var expectedRows;
|
||||
|
||||
beforeEach(function () {
|
||||
testRows = [{ a: 0 }, { a: 1 }, { a: 2 }];
|
||||
mockScope.rows = [{ a: -1 }];
|
||||
expectedRows = mockScope.rows.concat(testRows);
|
||||
|
||||
spyOn(controller.telemetry, "on").andCallThrough();
|
||||
controller.registerChangeListeners();
|
||||
|
||||
controller.telemetry.on.calls.forEach(function (call) {
|
||||
if (call.args[0] === 'added') {
|
||||
call.args[1](testRows);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("adds it to rows in scope", function () {
|
||||
expect(mockScope.rows).toEqual(expectedRows);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,7 +38,6 @@ define([
|
||||
"./src/capabilities/CostCapability",
|
||||
"./src/directives/MCTSwimlaneDrop",
|
||||
"./src/directives/MCTSwimlaneDrag",
|
||||
"./src/directives/MCTResourceGraphDrop",
|
||||
"./src/services/ObjectLoader",
|
||||
"./src/chart/MCTTimelineChart",
|
||||
"text!./res/templates/values.html",
|
||||
@@ -70,7 +69,6 @@ define([
|
||||
CostCapability,
|
||||
MCTSwimlaneDrop,
|
||||
MCTSwimlaneDrag,
|
||||
MCTResourceGraphDrop,
|
||||
ObjectLoader,
|
||||
MCTTimelineChart,
|
||||
valuesTemplate,
|
||||
@@ -579,13 +577,6 @@ define([
|
||||
"$interval",
|
||||
"$log"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctResourceGraphDrop",
|
||||
"implementation": MCTResourceGraphDrop,
|
||||
"depends": [
|
||||
"dndService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
.l-timeline-pane {
|
||||
@include absPosDefault();
|
||||
|
||||
&.drop-over {
|
||||
background-color: lighten($colorEditAreaBg, 5%);
|
||||
}
|
||||
|
||||
.l-width-control {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -77,8 +77,7 @@
|
||||
<mct-splitter></mct-splitter>
|
||||
|
||||
<!-- BOTTOM PANE RESOURCE LEGEND -->
|
||||
<div mct-resource-graph-drop
|
||||
class="split-pane-component abs l-timeline-pane t-pane-h l-pane-btm s-timeline-resource-legend l-timeline-resource-legend">
|
||||
<div class="split-pane-component abs l-timeline-pane t-pane-h l-pane-btm s-timeline-resource-legend l-timeline-resource-legend">
|
||||
<div class="l-title s-title">{{ngModel.title}}Resource Graph Legend</div>
|
||||
<div class="l-legend-items legend">
|
||||
<mct-include key="'timeline-legend-item'"
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2009-2016, 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(
|
||||
['./SwimlaneDragConstants'],
|
||||
function (SwimlaneDragConstants) {
|
||||
|
||||
/**
|
||||
* Defines the `mct-resource-graph-drop` directive. When a drop occurs
|
||||
* on an element with this attribute, the swimlane targeted by the drop
|
||||
* will receive the dropped domain object (at which point it can handle
|
||||
* the drop, typically by toggling the swimlane graph.)
|
||||
* @param {DndService} dndService drag-and-drop service
|
||||
*/
|
||||
function MCTResourceGraphDrop(dndService) {
|
||||
|
||||
function link(scope, element, attrs) {
|
||||
// Handle dragover
|
||||
element.on('dragover', function (e) {
|
||||
var swimlane = dndService.getData(
|
||||
SwimlaneDragConstants.TIMELINE_SWIMLANE_DRAG_TYPE
|
||||
);
|
||||
|
||||
if (typeof swimlane !== "undefined" && !swimlane.graph()) {
|
||||
element.addClass('drop-over');
|
||||
scope.$apply();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
// Handle drops
|
||||
element.on('drop', function (e) {
|
||||
var swimlane = dndService.getData(
|
||||
SwimlaneDragConstants.TIMELINE_SWIMLANE_DRAG_TYPE
|
||||
);
|
||||
|
||||
element.removeClass('drop-over');
|
||||
|
||||
// Only toggle if the graph isn't already set
|
||||
if (typeof swimlane !== "undefined" && !swimlane.graph()) {
|
||||
swimlane.toggleGraph();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
// Clear highlights when drag leaves this swimlane
|
||||
element.on('dragleave', function (e) {
|
||||
element.removeClass('drop-over');
|
||||
scope.$apply();
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Applies to attributes
|
||||
restrict: "A",
|
||||
// Link using above function
|
||||
link: link
|
||||
};
|
||||
}
|
||||
|
||||
return MCTResourceGraphDrop;
|
||||
}
|
||||
);
|
||||
@@ -1,159 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2009-2016, 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(
|
||||
['../../src/directives/MCTResourceGraphDrop', '../../src/directives/SwimlaneDragConstants'],
|
||||
function (MCTResourceGraphDrop, SwimlaneDragConstants) {
|
||||
|
||||
describe("The mct-resource-graph-drop directive", function () {
|
||||
var mockDndService,
|
||||
mockScope,
|
||||
mockElement,
|
||||
testAttrs,
|
||||
mockSwimlane,
|
||||
testEvent,
|
||||
handlers,
|
||||
directive;
|
||||
|
||||
beforeEach(function () {
|
||||
handlers = {};
|
||||
|
||||
mockDndService = jasmine.createSpyObj(
|
||||
'dndService',
|
||||
['setData', 'getData', 'removeData']
|
||||
);
|
||||
mockScope = jasmine.createSpyObj('$scope', ['$eval', '$apply']);
|
||||
mockElement = jasmine.createSpyObj('element', ['on', 'addClass', 'removeClass']);
|
||||
testAttrs = { mctSwimlaneDrop: "mockSwimlane" };
|
||||
mockSwimlane = jasmine.createSpyObj(
|
||||
"swimlane",
|
||||
['graph', 'toggleGraph']
|
||||
);
|
||||
|
||||
testEvent = {
|
||||
dataTransfer: { getData: jasmine.createSpy() },
|
||||
preventDefault: jasmine.createSpy(),
|
||||
stopPropagation: jasmine.createSpy()
|
||||
};
|
||||
|
||||
testEvent.dataTransfer.getData.andReturn('abc');
|
||||
mockDndService.getData.andCallFake(function (key) {
|
||||
return key === SwimlaneDragConstants.TIMELINE_SWIMLANE_DRAG_TYPE ?
|
||||
mockSwimlane : undefined;
|
||||
});
|
||||
|
||||
mockSwimlane.graph.andReturn(false);
|
||||
|
||||
directive = new MCTResourceGraphDrop(mockDndService);
|
||||
directive.link(mockScope, mockElement, testAttrs);
|
||||
|
||||
mockElement.on.calls.forEach(function (call) {
|
||||
handlers[call.args[0]] = call.args[1];
|
||||
});
|
||||
});
|
||||
|
||||
it("is available as an attribute", function () {
|
||||
expect(directive.restrict).toEqual("A");
|
||||
});
|
||||
|
||||
[false, true].forEach(function (graphing) {
|
||||
describe("when swimlane graph is " + (graphing ? "" : "not ") + "enabled", function () {
|
||||
beforeEach(function () {
|
||||
mockSwimlane.graph.andReturn(graphing);
|
||||
});
|
||||
|
||||
|
||||
describe("on dragover", function () {
|
||||
var prefix = !graphing ? "does" : "does not";
|
||||
|
||||
beforeEach(function () {
|
||||
handlers.dragover(testEvent);
|
||||
});
|
||||
|
||||
it(prefix + " add a drop-over class", function () {
|
||||
var expectAddClass = expect(mockElement.addClass);
|
||||
(!graphing ? expectAddClass : expectAddClass.not)
|
||||
.toHaveBeenCalledWith('drop-over');
|
||||
});
|
||||
|
||||
it(prefix + " call $apply on scope", function () {
|
||||
var expectApply = expect(mockScope.$apply);
|
||||
(!graphing ? expectApply : expectApply.not)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it(prefix + " prevent default", function () {
|
||||
var expectPreventDefault = expect(testEvent.preventDefault);
|
||||
(!graphing ? expectPreventDefault : expectPreventDefault.not)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("on drop", function () {
|
||||
var prefix = !graphing ? "does" : "does not";
|
||||
|
||||
beforeEach(function () {
|
||||
handlers.drop(testEvent);
|
||||
});
|
||||
|
||||
it("removes any drop-over class", function () {
|
||||
expect(mockElement.removeClass)
|
||||
.toHaveBeenCalledWith('drop-over');
|
||||
});
|
||||
|
||||
it(prefix + " toggle the swimlane's resource graph", function () {
|
||||
var expectToggle = expect(mockSwimlane.toggleGraph);
|
||||
(!graphing ? expectToggle : expectToggle.not)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it(prefix + " prevent default", function () {
|
||||
var expectPreventDefault = expect(testEvent.preventDefault);
|
||||
(!graphing ? expectPreventDefault : expectPreventDefault.not)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("on dragleave", function () {
|
||||
beforeEach(function () {
|
||||
handlers.dragleave(testEvent);
|
||||
});
|
||||
|
||||
it("removes any drop-over class", function () {
|
||||
expect(mockElement.removeClass)
|
||||
.toHaveBeenCalledWith('drop-over');
|
||||
});
|
||||
|
||||
it("calls $apply on scope", function () {
|
||||
expect(mockScope.$apply).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("calls preventDefault on events", function () {
|
||||
expect(testEvent.preventDefault).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -27,7 +27,7 @@
|
||||
ng-required="ngRequired || compositeCtrl.isNonEmpty(ngModel[field])"
|
||||
ng-pattern="ngPattern"
|
||||
options="item.options"
|
||||
structure="item"
|
||||
structure="row"
|
||||
field="$index">
|
||||
</mct-control>
|
||||
<span class="composite-control-label">
|
||||
|
||||
@@ -255,15 +255,16 @@ define([
|
||||
this.legacyExtension('types', legacyDefinition);
|
||||
}.bind(this));
|
||||
|
||||
this.objectViews.getAllProviders().forEach(function (p) {
|
||||
this.objectViews.providers.forEach(function (p) {
|
||||
this.legacyExtension('views', {
|
||||
key: p.key,
|
||||
key: 'vpid' + p.vpid,
|
||||
vpid: p.vpid,
|
||||
provider: p,
|
||||
name: p.name,
|
||||
cssClass: p.cssClass,
|
||||
description: p.description,
|
||||
editable: p.editable,
|
||||
template: '<mct-view mct-provider-key="' + p.key + '"/>'
|
||||
template: '<mct-view mct-vpid="' + p.vpid + '"/>'
|
||||
});
|
||||
}, this);
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ define([
|
||||
priority: i + 100 // arbitrary to allow new views to
|
||||
// be defaults by returning priority less than 100.
|
||||
};
|
||||
if (v.provider && v.provider.priority) {
|
||||
vd.priority = v.provider.priority(newDomainObject);
|
||||
if (v.provider) {
|
||||
vd.priority = v.provider.canView(newDomainObject);
|
||||
}
|
||||
return vd;
|
||||
})
|
||||
@@ -54,6 +54,7 @@ define([
|
||||
};
|
||||
return capability;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return patchViewCapability;
|
||||
|
||||
@@ -27,15 +27,12 @@ define([
|
||||
return {
|
||||
restrict: 'E',
|
||||
link: function (scope, element, attrs) {
|
||||
var provider = openmct.objectViews.getByProviderKey(attrs.mctProviderKey);
|
||||
var provider = openmct.objectViews.getByVPID(Number(attrs.mctVpid));
|
||||
var view = new provider.view(scope.domainObject.useCapability('adapter'));
|
||||
var domElement = element[0];
|
||||
|
||||
view.show(domElement);
|
||||
|
||||
view.show(element[0]);
|
||||
if (view.destroy) {
|
||||
scope.$on('$destroy', function () {
|
||||
view.destroy(domElement);
|
||||
view.destroy(element[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ define([], function () {
|
||||
view,
|
||||
legacyObject
|
||||
) {
|
||||
if (view.hasOwnProperty('provider')) {
|
||||
if (view.hasOwnProperty('vpid')) {
|
||||
var domainObject = legacyObject.useCapability('adapter');
|
||||
return view.provider.canView(domainObject);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ define([
|
||||
this.unlisteners.forEach(function (unlisten) {
|
||||
unlisten();
|
||||
});
|
||||
this.unlisteners = [];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,18 +50,11 @@ define([
|
||||
this.rootProvider = new RootObjectProvider(this.rootRegistry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fallback provider, this is an internal API for legacy reasons.
|
||||
* @private
|
||||
*/
|
||||
ObjectAPI.prototype.supersecretSetFallbackProvider = function (p) {
|
||||
this.fallbackProvider = p;
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the provider for a given identifier.
|
||||
* @private
|
||||
*/
|
||||
// Retrieve the provider for a given key.
|
||||
ObjectAPI.prototype.getProvider = function (identifier) {
|
||||
if (identifier.key === 'ROOT') {
|
||||
return this.rootProvider;
|
||||
@@ -142,28 +135,27 @@ define([
|
||||
* @returns {Promise} a promise which will resolve when the domain object
|
||||
* has been saved, or be rejected if it cannot be saved
|
||||
*/
|
||||
ObjectAPI.prototype.get = function (identifier) {
|
||||
identifier = utils.parseKeyString(identifier);
|
||||
var provider = this.getProvider(identifier);
|
||||
|
||||
if (!provider) {
|
||||
throw new Error('No Provider Matched');
|
||||
}
|
||||
[
|
||||
'save',
|
||||
'delete',
|
||||
'get'
|
||||
].forEach(function (method) {
|
||||
ObjectAPI.prototype[method] = function () {
|
||||
var identifier = arguments[0],
|
||||
provider = this.getProvider(identifier);
|
||||
|
||||
if (!provider.get) {
|
||||
throw new Error('Provider does not support get!');
|
||||
}
|
||||
if (!provider) {
|
||||
throw new Error('No Provider Matched');
|
||||
}
|
||||
|
||||
return provider.get(identifier);
|
||||
};
|
||||
if (!provider[method]) {
|
||||
throw new Error('Provider does not support [' + method + '].');
|
||||
}
|
||||
|
||||
ObjectAPI.prototype.delete = function () {
|
||||
throw new Error('Delete not implemented');
|
||||
};
|
||||
|
||||
ObjectAPI.prototype.save = function () {
|
||||
throw new Error('Save not implemented');
|
||||
};
|
||||
return provider[method].apply(provider, arguments);
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a root-level object.
|
||||
|
||||
@@ -35,7 +35,7 @@ define([
|
||||
name: 'Name'
|
||||
});
|
||||
|
||||
metadata.domains.forEach(function (domain, index) {
|
||||
(metadata.domains || []).forEach(function (domain, index) {
|
||||
var valueMetadata = _.clone(domain);
|
||||
valueMetadata.hints = {
|
||||
domain: index + 1
|
||||
@@ -43,11 +43,11 @@ define([
|
||||
valueMetadatas.push(valueMetadata);
|
||||
});
|
||||
|
||||
metadata.ranges.forEach(function (range, index) {
|
||||
(metadata.ranges || []).forEach(function (range, index) {
|
||||
var valueMetadata = _.clone(range);
|
||||
valueMetadata.hints = {
|
||||
range: index,
|
||||
priority: index + metadata.domains.length + 1
|
||||
priority: index + (metadata.domains || []).length + 1
|
||||
};
|
||||
|
||||
if (valueMetadata.type === 'enum') {
|
||||
|
||||
@@ -25,7 +25,7 @@ define([
|
||||
], function (
|
||||
_
|
||||
) {
|
||||
|
||||
|
||||
// TODO: needs reference to formatService;
|
||||
function TelemetryValueFormatter(valueMetadata, formatService) {
|
||||
var numberFormatter = {
|
||||
@@ -33,7 +33,12 @@ define([
|
||||
return Number(x);
|
||||
},
|
||||
format: function (x) {
|
||||
return x;
|
||||
var number = parseFloat(x);
|
||||
if (isNaN(number)){
|
||||
return x;
|
||||
} else {
|
||||
return number.toFixed(2);
|
||||
}
|
||||
},
|
||||
validate: function (x) {
|
||||
return true;
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2016, 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 () {
|
||||
|
||||
// Set of connection states; changing among these states will be
|
||||
// reflected in the indicator's appearance.
|
||||
// CONNECTED: Everything nominal, expect to be able to read/write.
|
||||
// DISCONNECTED: HTTP failed; maybe misconfigured, disconnected.
|
||||
// PENDING: Still trying to connect, and haven't failed yet.
|
||||
var CONNECTED = {
|
||||
glyphClass: "ok"
|
||||
},
|
||||
PENDING = {
|
||||
glyphClass: 'caution'
|
||||
},
|
||||
DISCONNECTED = {
|
||||
glyphClass: "err"
|
||||
};
|
||||
function URLIndicator($http, $interval) {
|
||||
var self = this;
|
||||
this.cssClass = this.options.cssClass ? this.options.cssClass : "icon-database";
|
||||
this.URLpath = this.options.url;
|
||||
this.label = this.options.label ? this.options.label : this.options.url;
|
||||
this.interval = this.options.interval || 10000;
|
||||
this.state = PENDING;
|
||||
|
||||
function handleError(e) {
|
||||
self.state = DISCONNECTED;
|
||||
}
|
||||
function handleResponse() {
|
||||
self.state = CONNECTED;
|
||||
}
|
||||
function updateIndicator() {
|
||||
$http.get(self.URLpath).then(handleResponse, handleError);
|
||||
}
|
||||
updateIndicator();
|
||||
$interval(updateIndicator, self.interval, 0, false);
|
||||
}
|
||||
|
||||
URLIndicator.prototype.getCssClass = function () {
|
||||
return this.cssClass;
|
||||
};
|
||||
URLIndicator.prototype.getGlyphClass = function () {
|
||||
return this.state.glyphClass;
|
||||
};
|
||||
URLIndicator.prototype.getText = function () {
|
||||
switch (this.state) {
|
||||
case CONNECTED: {
|
||||
return this.label + " is connected";
|
||||
}
|
||||
case PENDING: {
|
||||
return "Checking status of " + this.label + " please stand by...";
|
||||
}
|
||||
case DISCONNECTED: {
|
||||
return this.label + " is offline";
|
||||
}
|
||||
}
|
||||
};
|
||||
URLIndicator.prototype.getDescription = function () {
|
||||
switch (this.state) {
|
||||
case CONNECTED: {
|
||||
return this.label + " is online, checking status every " +
|
||||
this.interval + " milliseconds.";
|
||||
}
|
||||
case PENDING: {
|
||||
return "Checking status of " + this.label + " please stand by...";
|
||||
}
|
||||
case DISCONNECTED: {
|
||||
return this.label + " is offline, checking status every " +
|
||||
this.interval + " milliseconds";
|
||||
}
|
||||
}
|
||||
};
|
||||
return URLIndicator;
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
define(
|
||||
[
|
||||
'./URLIndicator'
|
||||
],
|
||||
function URLIndicatorPlugin(URLIndicator) {
|
||||
return function (opts) {
|
||||
// Wrap the plugin in a function so we can apply the arguments.
|
||||
function URLIndicatorWrapper() {
|
||||
this.options = opts;
|
||||
URLIndicator.apply(this, arguments);
|
||||
}
|
||||
URLIndicatorWrapper.prototype = Object.create(URLIndicator.prototype);
|
||||
return function install(openmct) {
|
||||
openmct.legacyExtension('indicators', {
|
||||
"implementation": URLIndicatorWrapper,
|
||||
"depends": ["$http", "$interval"]
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
@@ -1,158 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2016, 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(
|
||||
["./URLIndicator"],
|
||||
function (URLIndicator) {
|
||||
|
||||
describe("The URLIndicator", function () {
|
||||
var mockHttp,
|
||||
mockInterval,
|
||||
mockPromise,
|
||||
opts,
|
||||
Indicator,
|
||||
indicatorWrapper;
|
||||
|
||||
beforeEach(function () {
|
||||
mockHttp = jasmine.createSpyObj("$http", ["get"]);
|
||||
mockInterval = jasmine.createSpy("$interval");
|
||||
mockPromise = jasmine.createSpyObj("promise", ["then"]);
|
||||
opts = {
|
||||
url: "http://localhost:8080",
|
||||
interval: 1337 //some number
|
||||
};
|
||||
mockHttp.get.andReturn(mockPromise);
|
||||
Indicator = function () {
|
||||
this.options = opts;
|
||||
URLIndicator.call(this, mockHttp, mockInterval);
|
||||
};
|
||||
Indicator.prototype = Object.create(URLIndicator.prototype);
|
||||
indicatorWrapper = new Indicator();
|
||||
});
|
||||
it("polls for changes", function () {
|
||||
expect(mockInterval).toHaveBeenCalledWith(
|
||||
jasmine.any(Function),
|
||||
opts.interval,
|
||||
0,
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
it("has a database cssClass as default", function () {
|
||||
expect(indicatorWrapper.getCssClass()).toEqual("icon-database");
|
||||
});
|
||||
|
||||
it("consults the url with the path supplied", function () {
|
||||
expect(mockHttp.get).toHaveBeenCalledWith(opts.url);
|
||||
});
|
||||
|
||||
it("changes when the database connection is nominal", function () {
|
||||
var initialText = indicatorWrapper.getText(),
|
||||
initialDescrption = indicatorWrapper.getDescription(),
|
||||
initialGlyphClass = indicatorWrapper.getGlyphClass();
|
||||
|
||||
// Nominal just means getting back an object, without
|
||||
// an error field.
|
||||
mockPromise.then.mostRecentCall.args[0]({ data: {} });
|
||||
|
||||
// Verify that these values changed;
|
||||
// don't test for specific text.
|
||||
expect(indicatorWrapper.getText()).not.toEqual(initialText);
|
||||
expect(indicatorWrapper.getGlyphClass()).not.toEqual(initialGlyphClass);
|
||||
expect(indicatorWrapper.getDescription()).not.toEqual(initialDescrption);
|
||||
|
||||
// Do check for specific class
|
||||
expect(indicatorWrapper.getGlyphClass()).toEqual("ok");
|
||||
});
|
||||
|
||||
it("changes when the server cannot be reached", function () {
|
||||
var initialText = indicatorWrapper.getText(),
|
||||
initialDescrption = indicatorWrapper.getDescription(),
|
||||
initialGlyphClass = indicatorWrapper.getGlyphClass();
|
||||
|
||||
// Nominal just means getting back an object, without
|
||||
// an error field.
|
||||
mockPromise.then.mostRecentCall.args[1]({ data: {} });
|
||||
|
||||
// Verify that these values changed;
|
||||
// don't test for specific text.
|
||||
expect(indicatorWrapper.getText()).not.toEqual(initialText);
|
||||
expect(indicatorWrapper.getGlyphClass()).not.toEqual(initialGlyphClass);
|
||||
expect(indicatorWrapper.getDescription()).not.toEqual(initialDescrption);
|
||||
|
||||
// Do check for specific class
|
||||
expect(indicatorWrapper.getGlyphClass()).toEqual("err");
|
||||
});
|
||||
it("has a customized cssClass if supplied in initialization", function () {
|
||||
opts = {
|
||||
url: "http://localhost:8080",
|
||||
cssClass: "cssClass-checked",
|
||||
interval: 10000
|
||||
};
|
||||
indicatorWrapper = new Indicator();
|
||||
expect(indicatorWrapper.getCssClass()).toEqual("cssClass-checked");
|
||||
});
|
||||
it("has a customized interval if supplied in initialization", function () {
|
||||
opts = {
|
||||
url: "http://localhost:8080",
|
||||
interval: 1814
|
||||
};
|
||||
indicatorWrapper = new Indicator();
|
||||
expect(mockInterval).toHaveBeenCalledWith(
|
||||
jasmine.any(Function),
|
||||
1814,
|
||||
0,
|
||||
false
|
||||
);
|
||||
});
|
||||
it("has a custom label if supplied in initialization", function () {
|
||||
opts = {
|
||||
url: "http://localhost:8080",
|
||||
label: "Localhost"
|
||||
};
|
||||
indicatorWrapper = new Indicator();
|
||||
expect(indicatorWrapper.getText()).toEqual("Checking status of Localhost please stand by...");
|
||||
});
|
||||
it("has a default label if not supplied in initialization", function () {
|
||||
opts = {
|
||||
url: "http://localhost:8080"
|
||||
};
|
||||
indicatorWrapper = new Indicator();
|
||||
expect(indicatorWrapper.getText()).toEqual(
|
||||
"Checking status of http://localhost:8080 please stand by..."
|
||||
);
|
||||
});
|
||||
it("has a default interval if not supplied in initialization", function () {
|
||||
opts = {
|
||||
url: "http://localhost:8080"
|
||||
};
|
||||
indicatorWrapper = new Indicator();
|
||||
expect(mockInterval).toHaveBeenCalledWith(
|
||||
jasmine.any(Function),
|
||||
10000,
|
||||
0,
|
||||
false
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -27,9 +27,9 @@ define([
|
||||
'../../platform/features/autoflow/plugin',
|
||||
'./timeConductor/plugin',
|
||||
'../../example/imagery/plugin',
|
||||
'../../platform/import-export/bundle',
|
||||
'./summaryWidget/plugin',
|
||||
'./URLIndicatorPlugin/URLIndicatorPlugin'
|
||||
'../../platform/import-export/bundle',
|
||||
'./telemetryMean/plugin'
|
||||
], function (
|
||||
_,
|
||||
UTCTimeSystem,
|
||||
@@ -37,9 +37,9 @@ define([
|
||||
AutoflowPlugin,
|
||||
TimeConductorPlugin,
|
||||
ExampleImagery,
|
||||
ImportExport,
|
||||
SummaryWidget,
|
||||
URLIndicatorPlugin
|
||||
ImportExport,
|
||||
TelemetryMean
|
||||
) {
|
||||
var bundleMap = {
|
||||
CouchDB: 'platform/persistence/couch',
|
||||
@@ -124,9 +124,8 @@ define([
|
||||
};
|
||||
|
||||
plugins.ExampleImagery = ExampleImagery;
|
||||
|
||||
plugins.SummaryWidget = SummaryWidget;
|
||||
plugins.URLIndicatorPlugin = URLIndicatorPlugin;
|
||||
plugins.TelemetryMean = TelemetryMean;
|
||||
|
||||
return plugins;
|
||||
});
|
||||
|
||||
@@ -24,11 +24,19 @@ define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Defines composition policy for Display Layout objects.
|
||||
* They cannot contain folders.
|
||||
* @constructor
|
||||
* @memberof platform/features/layout
|
||||
* @implements {Policy.<View, DomainObject>}
|
||||
*/
|
||||
function SummaryWidgetsCompositionPolicy(openmct) {
|
||||
this.openmct = openmct;
|
||||
}
|
||||
|
||||
SummaryWidgetsCompositionPolicy.prototype.allow = function (parent, child) {
|
||||
|
||||
var parentType = parent.getCapability('type');
|
||||
var newStyleChild = child.useCapability('adapter');
|
||||
|
||||
|
||||
@@ -44,13 +44,16 @@ define(['./src/SummaryWidget', './SummaryWidgetsCompositionPolicy'], function (S
|
||||
return {
|
||||
name: 'Widget View',
|
||||
view: function (domainObject) {
|
||||
return new SummaryWidget(domainObject, openmct);
|
||||
var summaryWidget = new SummaryWidget(domainObject, openmct);
|
||||
return {
|
||||
show: summaryWidget.show,
|
||||
destroy: summaryWidget.destroy
|
||||
};
|
||||
},
|
||||
canView: function (domainObject) {
|
||||
return (domainObject.type === 'summary-widget');
|
||||
},
|
||||
editable: true,
|
||||
key: 'summaryWidgets'
|
||||
editable: true
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,8 +61,7 @@ define(['./src/SummaryWidget', './SummaryWidgetsCompositionPolicy'], function (S
|
||||
openmct.types.addType('summary-widget', widgetType);
|
||||
openmct.objectViews.addProvider(initViewProvider(openmct));
|
||||
openmct.legacyExtension('policies', {category: 'composition',
|
||||
implementation: SummaryWidgetsCompositionPolicy, depends: ['openmct']
|
||||
});
|
||||
implementation: SummaryWidgetsCompositionPolicy, depends: ['openmct']});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,14 @@
|
||||
<select class="t-trigger">
|
||||
<option value="any">any condition is met</option>
|
||||
<option value="all">all conditions are met</option>
|
||||
<!-- <option value="js">the following JavaScript evaluates to true</option> -->
|
||||
</select>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
<!-- <li class="t-rule-js-condition-input-holder">
|
||||
<textarea placeholder="" class="med t-rule-js-condition-input"></textarea>
|
||||
</li> -->
|
||||
<li>
|
||||
<label></label>
|
||||
<span class="controls">
|
||||
|
||||
@@ -3,7 +3,6 @@ define([
|
||||
'./input/ObjectSelect',
|
||||
'./input/KeySelect',
|
||||
'./input/OperationSelect',
|
||||
'./eventHelpers',
|
||||
'EventEmitter',
|
||||
'zepto'
|
||||
], function (
|
||||
@@ -11,10 +10,10 @@ define([
|
||||
ObjectSelect,
|
||||
KeySelect,
|
||||
OperationSelect,
|
||||
eventHelpers,
|
||||
EventEmitter,
|
||||
$
|
||||
) {
|
||||
|
||||
/**
|
||||
* Represents an individual condition for a summary widget rule. Manages the
|
||||
* associated inputs and view.
|
||||
@@ -26,7 +25,6 @@ define([
|
||||
* selects with configuration data
|
||||
*/
|
||||
function Condition(conditionConfig, index, conditionManager) {
|
||||
eventHelpers.extend(this);
|
||||
this.config = conditionConfig;
|
||||
this.index = index;
|
||||
this.conditionManager = conditionManager;
|
||||
@@ -73,17 +71,15 @@ define([
|
||||
value = (isNaN(elem.valueAsNumber) ? elem.value : elem.valueAsNumber),
|
||||
inputIndex = self.valueInputs.indexOf(elem);
|
||||
|
||||
if (elem.tagName.toUpperCase() === 'INPUT') {
|
||||
self.eventEmitter.emit('change', {
|
||||
value: value,
|
||||
property: 'values[' + inputIndex + ']',
|
||||
index: self.index
|
||||
});
|
||||
}
|
||||
self.eventEmitter.emit('change', {
|
||||
value: value,
|
||||
property: 'values[' + inputIndex + ']',
|
||||
index: self.index
|
||||
});
|
||||
}
|
||||
|
||||
this.listenTo(this.deleteButton, 'click', this.remove, this);
|
||||
this.listenTo(this.duplicateButton, 'click', this.duplicate, this);
|
||||
this.deleteButton.on('click', this.remove);
|
||||
this.duplicateButton.on('click', this.duplicate);
|
||||
|
||||
this.selects.object = new ObjectSelect(this.config, this.conditionManager, [
|
||||
['any', 'any telemetry'],
|
||||
@@ -109,9 +105,13 @@ define([
|
||||
$('.t-configuration', self.domElement).append(select.getDOM());
|
||||
});
|
||||
|
||||
this.listenTo($(this.domElement), 'input', onValueInput);
|
||||
$(this.domElement).on('input', 'input', onValueInput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the DOM element representing this condition in the view
|
||||
* @return {Element}
|
||||
*/
|
||||
Condition.prototype.getDOM = function (container) {
|
||||
return this.domElement;
|
||||
};
|
||||
@@ -143,14 +143,6 @@ define([
|
||||
*/
|
||||
Condition.prototype.remove = function () {
|
||||
this.eventEmitter.emit('remove', this.index);
|
||||
this.destroy();
|
||||
};
|
||||
|
||||
Condition.prototype.destroy = function () {
|
||||
this.stopListening();
|
||||
Object.values(this.selects).forEach(function (select) {
|
||||
select.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -312,6 +312,17 @@ define([], function () {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Interpret a string as a JavaScript conditional, and return its boolean value
|
||||
* @param {string} condition The string to interpreted as JavaScript
|
||||
* @return {boolean} The value of the conditions
|
||||
*/
|
||||
ConditionEvaluator.prototype.executeJavaScriptCondition = function (condition) {
|
||||
var conditionValue = false;
|
||||
//TODO: implement JavaScript execution
|
||||
return conditionValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* A function that returns true only if each value in its input argument is
|
||||
* of a numerical type
|
||||
|
||||
@@ -66,8 +66,6 @@ define ([
|
||||
ConditionManager.prototype.on = function (event, callback, context) {
|
||||
if (this.supportedCallbacks.includes(event)) {
|
||||
this.eventEmitter.on(event, callback, context || this);
|
||||
} else {
|
||||
throw event + " is not a supported callback. Supported callbacks are " + this.supportedCallbacks;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -87,7 +85,8 @@ define ([
|
||||
|
||||
ruleOrder.forEach(function (ruleId) {
|
||||
rule = rules[ruleId];
|
||||
conditions = rule.getProperty('conditions');
|
||||
conditions = rule.getProperty('trigger') === 'js' ?
|
||||
rule.getProperty('jsCondition') : rule.getProperty('conditions');
|
||||
if (self.evaluator.execute(conditions, rule.getProperty('trigger'))) {
|
||||
activeId = ruleId;
|
||||
}
|
||||
@@ -129,7 +128,7 @@ define ([
|
||||
self = this;
|
||||
|
||||
self.telemetryTypesById[object.identifier.key] = {};
|
||||
return telemetryAPI.request(object, {size: 1, strategy: 'latest'}).then(function (telemetry) {
|
||||
return telemetryAPI.request(object, {}).then(function (telemetry) {
|
||||
Object.entries(telemetry[telemetry.length - 1]).forEach(function (telem) {
|
||||
key = telem[0];
|
||||
type = typeof telem[1];
|
||||
|
||||
@@ -3,7 +3,6 @@ define([
|
||||
'./Condition',
|
||||
'./input/ColorPalette',
|
||||
'./input/IconPalette',
|
||||
'./eventHelpers',
|
||||
'EventEmitter',
|
||||
'lodash',
|
||||
'zepto'
|
||||
@@ -12,11 +11,11 @@ define([
|
||||
Condition,
|
||||
ColorPalette,
|
||||
IconPalette,
|
||||
eventHelpers,
|
||||
EventEmitter,
|
||||
_,
|
||||
$
|
||||
) {
|
||||
|
||||
/**
|
||||
* An object representing a summary widget rule. Maintains a set of text
|
||||
* and css properties for output, and a set of conditions for configuring
|
||||
@@ -30,7 +29,6 @@ define([
|
||||
* @param {element} container The DOM element which cotains this summary widget
|
||||
*/
|
||||
function Rule(ruleConfig, domainObject, openmct, conditionManager, widgetDnD, container) {
|
||||
eventHelpers.extend(this);
|
||||
var self = this;
|
||||
|
||||
this.config = ruleConfig;
|
||||
@@ -104,19 +102,11 @@ define([
|
||||
*/
|
||||
function onColorInput(color, property) {
|
||||
self.config.style[property] = color;
|
||||
self.updateDomainObject();
|
||||
self.thumbnail.css(property, color);
|
||||
self.eventEmitter.emit('change');
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse input text from textbox to prevent HTML Injection
|
||||
* @param {string} msg The text to be Parsed
|
||||
* @private
|
||||
*/
|
||||
function encodeMsg(msg) {
|
||||
return $('<div />').text(msg).html();
|
||||
}
|
||||
|
||||
/**
|
||||
* An onchange event handler method for this rule's trigger key
|
||||
* @param {event} event The change event from this rule's select element
|
||||
@@ -124,7 +114,7 @@ define([
|
||||
*/
|
||||
function onTriggerInput(event) {
|
||||
var elem = event.target;
|
||||
self.config.trigger = encodeMsg(elem.value);
|
||||
self.config.trigger = elem.value;
|
||||
self.generateDescription();
|
||||
self.updateDomainObject();
|
||||
self.refreshConditions();
|
||||
@@ -138,13 +128,12 @@ define([
|
||||
* @private
|
||||
*/
|
||||
function onTextInput(elem, inputKey) {
|
||||
var text = encodeMsg(elem.value);
|
||||
self.config[inputKey] = text;
|
||||
self.config[inputKey] = elem.value;
|
||||
self.updateDomainObject();
|
||||
if (inputKey === 'name') {
|
||||
self.title.html(text);
|
||||
self.title.html(elem.value);
|
||||
} else if (inputKey === 'label') {
|
||||
self.thumbnailLabel.html(text);
|
||||
self.thumbnailLabel.html(elem.value);
|
||||
}
|
||||
self.eventEmitter.emit('change');
|
||||
}
|
||||
@@ -184,38 +173,33 @@ define([
|
||||
|
||||
Object.keys(this.colorInputs).forEach(function (inputKey) {
|
||||
var input = self.colorInputs[inputKey];
|
||||
|
||||
input.set(self.config.style[inputKey]);
|
||||
onColorInput(self.config.style[inputKey], inputKey);
|
||||
|
||||
input.on('change', function (value) {
|
||||
onColorInput(value, inputKey);
|
||||
self.updateDomainObject();
|
||||
});
|
||||
|
||||
input.set(self.config.style[inputKey]);
|
||||
$('.t-style-input', self.domElement).append(input.getDOM());
|
||||
});
|
||||
|
||||
Object.keys(this.textInputs).forEach(function (inputKey) {
|
||||
self.textInputs[inputKey].prop('value', self.config[inputKey] || '');
|
||||
self.listenTo(self.textInputs[inputKey], 'input', function () {
|
||||
self.textInputs[inputKey].on('input', function () {
|
||||
onTextInput(this, inputKey);
|
||||
});
|
||||
});
|
||||
|
||||
this.listenTo(this.deleteButton, 'click', this.remove);
|
||||
this.listenTo(this.duplicateButton, 'click', this.duplicate);
|
||||
this.listenTo(this.addConditionButton, 'click', function () {
|
||||
this.deleteButton.on('click', this.remove);
|
||||
this.duplicateButton.on('click', this.duplicate);
|
||||
this.addConditionButton.on('click', function () {
|
||||
self.initCondition();
|
||||
});
|
||||
this.listenTo(this.toggleConfigButton, 'click', toggleConfig);
|
||||
this.listenTo(this.trigger, 'change', onTriggerInput);
|
||||
this.toggleConfigButton.on('click', toggleConfig);
|
||||
this.trigger.on('change', onTriggerInput);
|
||||
|
||||
this.title.html(self.config.name);
|
||||
this.description.html(self.config.description);
|
||||
this.trigger.prop('value', self.config.trigger);
|
||||
|
||||
this.listenTo(this.grippy, 'mousedown', onDragStart);
|
||||
this.grippy.on('mousedown', onDragStart);
|
||||
this.widgetDnD.on('drop', function () {
|
||||
this.domElement.show();
|
||||
$('.t-drag-indicator').hide();
|
||||
@@ -260,10 +244,6 @@ define([
|
||||
palette.destroy();
|
||||
});
|
||||
this.iconInput.destroy();
|
||||
this.stopListening();
|
||||
this.conditions.forEach(function (condition) {
|
||||
condition.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -376,7 +356,6 @@ define([
|
||||
this.domainObject.configuration.ruleConfigById = ruleConfigById;
|
||||
this.updateDomainObject();
|
||||
this.refreshConditions();
|
||||
this.generateDescription();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -416,9 +395,11 @@ define([
|
||||
}
|
||||
|
||||
if (self.conditions.length === 1) {
|
||||
// Only one condition
|
||||
self.conditions[0].hideButtons();
|
||||
}
|
||||
|
||||
self.generateDescription();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -436,7 +417,6 @@ define([
|
||||
this.domainObject.configuration.ruleConfigById[this.config.id] = this.config;
|
||||
this.updateDomainObject();
|
||||
this.refreshConditions();
|
||||
this.generateDescription();
|
||||
this.eventEmitter.emit('conditionChange');
|
||||
};
|
||||
|
||||
@@ -480,6 +460,7 @@ define([
|
||||
description = (description === '' ? this.config.description : description);
|
||||
this.description.html(description);
|
||||
this.config.description = description;
|
||||
this.updateDomainObject();
|
||||
};
|
||||
|
||||
return Rule;
|
||||
|
||||
@@ -4,7 +4,6 @@ define([
|
||||
'./ConditionManager',
|
||||
'./TestDataManager',
|
||||
'./WidgetDnD',
|
||||
'./eventHelpers',
|
||||
'lodash',
|
||||
'zepto'
|
||||
], function (
|
||||
@@ -13,7 +12,6 @@ define([
|
||||
ConditionManager,
|
||||
TestDataManager,
|
||||
WidgetDnD,
|
||||
eventHelpers,
|
||||
_,
|
||||
$
|
||||
) {
|
||||
@@ -34,8 +32,6 @@ define([
|
||||
* @param {MCT} openmct An MCT instance
|
||||
*/
|
||||
function SummaryWidget(domainObject, openmct) {
|
||||
eventHelpers.extend(this);
|
||||
|
||||
this.domainObject = domainObject;
|
||||
this.openmct = openmct;
|
||||
|
||||
@@ -90,7 +86,7 @@ define([
|
||||
self.outerWrapper.toggleClass('expanded-widget-test-data');
|
||||
self.toggleTestDataControl.toggleClass('expanded');
|
||||
}
|
||||
this.listenTo(this.toggleTestDataControl, 'click', toggleTestData);
|
||||
this.toggleTestDataControl.on('click', toggleTestData);
|
||||
|
||||
/**
|
||||
* Toggles the configuration area for rules in the view
|
||||
@@ -100,7 +96,7 @@ define([
|
||||
self.outerWrapper.toggleClass('expanded-widget-rules');
|
||||
self.toggleRulesControl.toggleClass('expanded');
|
||||
}
|
||||
this.listenTo(this.toggleRulesControl, 'click', toggleRules);
|
||||
this.toggleRulesControl.on('click', toggleRules);
|
||||
|
||||
openmct.$injector.get('objectService')
|
||||
.getObjects([id])
|
||||
@@ -142,7 +138,7 @@ define([
|
||||
* @param {domainObject} Object instance of this object
|
||||
*/
|
||||
SummaryWidget.prototype.watchForChanges = function (openmct, domainObject) {
|
||||
this.watchForChangesUnsubscribe = openmct.objects.observe(domainObject, '*', function (newDomainObject) {
|
||||
openmct.objects.observe(domainObject, '*', function (newDomainObject) {
|
||||
if (newDomainObject.url !== this.domainObject.url ||
|
||||
newDomainObject.openNewTab !== this.domainObject.openNewTab) {
|
||||
this.addHyperlink(newDomainObject.url, newDomainObject.openNewTab);
|
||||
@@ -164,15 +160,13 @@ define([
|
||||
this.widgetDnD = new WidgetDnD(this.domElement, this.domainObject.configuration.ruleOrder, this.rulesById);
|
||||
this.initRule('default', 'Default');
|
||||
this.domainObject.configuration.ruleOrder.forEach(function (ruleId) {
|
||||
if (ruleId !== 'default') {
|
||||
self.initRule(ruleId);
|
||||
}
|
||||
self.initRule(ruleId);
|
||||
});
|
||||
this.refreshRules();
|
||||
this.updateWidget();
|
||||
this.updateView();
|
||||
|
||||
this.listenTo(this.addRuleButton, 'click', this.addRule);
|
||||
this.addRuleButton.on('click', this.addRule);
|
||||
this.conditionManager.on('receiveTelemetry', this.executeRules, this);
|
||||
this.widgetDnD.on('drop', this.reorder, this);
|
||||
};
|
||||
@@ -184,14 +178,10 @@ define([
|
||||
SummaryWidget.prototype.destroy = function (container) {
|
||||
this.editListenerUnsubscribe();
|
||||
this.conditionManager.destroy();
|
||||
this.testDataManager.destroy();
|
||||
this.widgetDnD.destroy();
|
||||
this.watchForChangesUnsubscribe();
|
||||
Object.values(this.rulesById).forEach(function (rule) {
|
||||
rule.destroy();
|
||||
});
|
||||
|
||||
this.stopListening();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -232,26 +222,13 @@ define([
|
||||
var self = this,
|
||||
ruleOrder = self.domainObject.configuration.ruleOrder,
|
||||
rules = self.rulesById;
|
||||
|
||||
self.ruleArea.html('');
|
||||
Object.values(ruleOrder).forEach(function (ruleId) {
|
||||
self.ruleArea.append(rules[ruleId].getDOM());
|
||||
});
|
||||
|
||||
this.executeRules();
|
||||
this.addOrRemoveDragIndicator();
|
||||
};
|
||||
|
||||
SummaryWidget.prototype.addOrRemoveDragIndicator = function () {
|
||||
var rules = this.domainObject.configuration.ruleOrder;
|
||||
var rulesById = this.rulesById;
|
||||
|
||||
rules.forEach(function (ruleKey, index, array) {
|
||||
if (array.length > 2 && index > 0) {
|
||||
$('.t-grippy', rulesById[ruleKey].domElement).show();
|
||||
} else {
|
||||
$('.t-grippy', rulesById[ruleKey].domElement).hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -285,13 +262,12 @@ define([
|
||||
ruleOrder = this.domainObject.configuration.ruleOrder;
|
||||
|
||||
while (Object.keys(this.rulesById).includes('rule' + ruleCount)) {
|
||||
ruleCount++;
|
||||
ruleCount = ++ruleCount;
|
||||
}
|
||||
|
||||
ruleId = 'rule' + ruleCount;
|
||||
ruleOrder.push(ruleId);
|
||||
this.domainObject.configuration.ruleOrder = ruleOrder;
|
||||
|
||||
this.updateDomainObject();
|
||||
this.initRule(ruleId, 'Rule');
|
||||
this.refreshRules();
|
||||
@@ -341,7 +317,7 @@ define([
|
||||
if (!this.domainObject.configuration.ruleConfigById[ruleId]) {
|
||||
this.domainObject.configuration.ruleConfigById[ruleId] = {
|
||||
name: ruleName || 'Rule',
|
||||
label: 'Unnamed Rule',
|
||||
label: this.domainObject.name,
|
||||
message: '',
|
||||
id: ruleId,
|
||||
icon: ' ',
|
||||
|
||||
@@ -2,14 +2,12 @@ define([
|
||||
'text!../res/testDataItemTemplate.html',
|
||||
'./input/ObjectSelect',
|
||||
'./input/KeySelect',
|
||||
'./eventHelpers',
|
||||
'EventEmitter',
|
||||
'zepto'
|
||||
], function (
|
||||
itemTemplate,
|
||||
ObjectSelect,
|
||||
KeySelect,
|
||||
eventHelpers,
|
||||
EventEmitter,
|
||||
$
|
||||
) {
|
||||
@@ -26,7 +24,6 @@ define([
|
||||
* @constructor
|
||||
*/
|
||||
function TestDataItem(itemConfig, index, conditionManager) {
|
||||
eventHelpers.extend(this);
|
||||
this.config = itemConfig;
|
||||
this.index = index;
|
||||
this.conditionManager = conditionManager;
|
||||
@@ -73,17 +70,16 @@ define([
|
||||
function onValueInput(event) {
|
||||
var elem = event.target,
|
||||
value = (isNaN(elem.valueAsNumber) ? elem.value : elem.valueAsNumber);
|
||||
if (elem.tagName.toUpperCase() === 'INPUT') {
|
||||
self.eventEmitter.emit('change', {
|
||||
value: value,
|
||||
property: 'value',
|
||||
index: self.index
|
||||
});
|
||||
}
|
||||
|
||||
self.eventEmitter.emit('change', {
|
||||
value: value,
|
||||
property: 'value',
|
||||
index: self.index
|
||||
});
|
||||
}
|
||||
|
||||
this.listenTo(this.deleteButton, 'click', this.remove);
|
||||
this.listenTo(this.duplicateButton, 'click', this.duplicate);
|
||||
this.deleteButton.on('click', this.remove);
|
||||
this.duplicateButton.on('click', this.duplicate);
|
||||
|
||||
this.selects.object = new ObjectSelect(this.config, this.conditionManager);
|
||||
this.selects.key = new KeySelect(
|
||||
@@ -101,7 +97,8 @@ define([
|
||||
Object.values(this.selects).forEach(function (select) {
|
||||
$('.t-configuration', self.domElement).append(select.getDOM());
|
||||
});
|
||||
this.listenTo(this.domElement, 'input', onValueInput);
|
||||
|
||||
$(this.domElement).on('input', 'input', onValueInput);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,11 +137,6 @@ define([
|
||||
TestDataItem.prototype.remove = function () {
|
||||
var self = this;
|
||||
this.eventEmitter.emit('remove', self.index);
|
||||
this.stopListening();
|
||||
|
||||
Object.values(this.selects).forEach(function (select) {
|
||||
select.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
define([
|
||||
'./eventHelpers',
|
||||
'text!../res/testDataTemplate.html',
|
||||
'./TestDataItem',
|
||||
'zepto',
|
||||
'lodash'
|
||||
], function (
|
||||
eventHelpers,
|
||||
testDataTemplate,
|
||||
TestDataItem,
|
||||
$,
|
||||
@@ -20,7 +18,6 @@ define([
|
||||
* @param {MCT} openmct and MCT instance
|
||||
*/
|
||||
function TestDataManager(domainObject, conditionManager, openmct) {
|
||||
eventHelpers.extend(this);
|
||||
var self = this;
|
||||
|
||||
this.domainObject = domainObject;
|
||||
@@ -48,10 +45,10 @@ define([
|
||||
self.updateTestCache();
|
||||
}
|
||||
|
||||
this.listenTo(this.addItemButton, 'click', function () {
|
||||
this.addItemButton.on('click', function () {
|
||||
self.initItem();
|
||||
});
|
||||
this.listenTo(this.testDataInput, 'change', toggleTestData);
|
||||
this.testDataInput.on('change', toggleTestData);
|
||||
|
||||
this.evaluator.setTestDataCache(this.testCache);
|
||||
this.evaluator.useTestData(false);
|
||||
@@ -189,12 +186,5 @@ define([
|
||||
this.openmct.objects.mutate(this.domainObject, 'configuration.testDataConfig', this.config);
|
||||
};
|
||||
|
||||
TestDataManager.prototype.destroy = function () {
|
||||
this.items.forEach(function (item) {
|
||||
item.remove();
|
||||
});
|
||||
this.stopListening();
|
||||
};
|
||||
|
||||
return TestDataManager;
|
||||
});
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
var listenersCount = 0;
|
||||
/*global define*/
|
||||
// jscs:disable disallowDanglingUnderscores
|
||||
define([], function () {
|
||||
var helperFunctions = {
|
||||
listenTo: function (object, event, callback, context) {
|
||||
if (!this._listeningTo) {
|
||||
this._listeningTo = [];
|
||||
}
|
||||
var listener = {
|
||||
object: object,
|
||||
event: event,
|
||||
callback: callback,
|
||||
context: context,
|
||||
_cb: !!context ? callback.bind(context) : callback
|
||||
};
|
||||
if (object.$watch && event.indexOf('change:') === 0) {
|
||||
var scopePath = event.replace('change:', '');
|
||||
listener.unlisten = object.$watch(scopePath, listener._cb, true);
|
||||
} else if (object.$on) {
|
||||
listener.unlisten = object.$on(event, listener._cb);
|
||||
} else if (object.addEventListener) {
|
||||
object.addEventListener(event, listener._cb);
|
||||
} else {
|
||||
object.on(event, listener._cb);
|
||||
}
|
||||
this._listeningTo.push(listener);
|
||||
listenersCount++;
|
||||
},
|
||||
|
||||
stopListening: function (object, event, callback, context) {
|
||||
if (!this._listeningTo) {
|
||||
this._listeningTo = [];
|
||||
}
|
||||
|
||||
this._listeningTo.filter(function (listener) {
|
||||
if (object && object !== listener.object) {
|
||||
return false;
|
||||
}
|
||||
if (event && event !== listener.event) {
|
||||
return false;
|
||||
}
|
||||
if (callback && callback !== listener.callback) {
|
||||
return false;
|
||||
}
|
||||
if (context && context !== listener.context) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(function (listener) {
|
||||
if (listener.unlisten) {
|
||||
listener.unlisten();
|
||||
} else if (listener.object.removeEventListener) {
|
||||
listener.object.removeEventListener(listener.event, listener._cb);
|
||||
} else {
|
||||
listener.object.off(listener.event, listener._cb);
|
||||
}
|
||||
listenersCount--;
|
||||
return listener;
|
||||
})
|
||||
.forEach(function (listener) {
|
||||
this._listeningTo.splice(this._listeningTo.indexOf(listener), 1);
|
||||
}, this);
|
||||
},
|
||||
|
||||
extend: function (object) {
|
||||
object.listenTo = helperFunctions.listenTo;
|
||||
object.stopListening = helperFunctions.stopListening;
|
||||
}
|
||||
};
|
||||
|
||||
return helperFunctions;
|
||||
});
|
||||
@@ -1,8 +1,4 @@
|
||||
define([
|
||||
'./Select'
|
||||
], function (
|
||||
Select
|
||||
) {
|
||||
define(['./Select'], function (Select) {
|
||||
|
||||
/**
|
||||
* Create a {Select} element whose composition is dynamically updated with
|
||||
@@ -66,7 +62,7 @@ define([
|
||||
onMetadataLoad();
|
||||
}
|
||||
|
||||
this.objectSelect.on('change', onObjectChange, this);
|
||||
this.objectSelect.on('change', onObjectChange);
|
||||
this.manager.on('metadata', onMetadataLoad);
|
||||
|
||||
return this.select;
|
||||
@@ -89,10 +85,6 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
KeySelect.prototype.destroy = function () {
|
||||
this.objectSelect.destroy();
|
||||
};
|
||||
|
||||
return KeySelect;
|
||||
|
||||
});
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
define([
|
||||
'./Select',
|
||||
'../eventHelpers'
|
||||
], function (
|
||||
Select,
|
||||
eventHelpers
|
||||
) {
|
||||
define(['./Select'], function (Select) {
|
||||
|
||||
/**
|
||||
* Create a {Select} element whose composition is dynamically updated with
|
||||
@@ -23,7 +17,6 @@ define([
|
||||
var NULLVALUE = '- Select Comparison -';
|
||||
|
||||
function OperationSelect(config, keySelect, manager, changeCallback) {
|
||||
eventHelpers.extend(this);
|
||||
var self = this;
|
||||
|
||||
this.config = config;
|
||||
@@ -38,7 +31,7 @@ define([
|
||||
this.select.hide();
|
||||
this.select.addOption('', NULLVALUE);
|
||||
if (changeCallback) {
|
||||
this.listenTo(this.select, 'change', changeCallback);
|
||||
this.select.on('change', changeCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +63,7 @@ define([
|
||||
}
|
||||
self.select.setSelected(self.config.operation);
|
||||
}
|
||||
|
||||
this.keySelect.on('change', onKeyChange);
|
||||
this.manager.on('metadata', onMetadataLoad);
|
||||
|
||||
@@ -115,10 +109,6 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
OperationSelect.prototype.destroy = function () {
|
||||
this.stopListening();
|
||||
};
|
||||
|
||||
return OperationSelect;
|
||||
|
||||
});
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
define([
|
||||
'../eventHelpers',
|
||||
'text!../../res/input/paletteTemplate.html',
|
||||
'EventEmitter',
|
||||
'zepto'
|
||||
], function (
|
||||
eventHelpers,
|
||||
paletteTemplate,
|
||||
EventEmitter,
|
||||
$
|
||||
) {
|
||||
|
||||
/**
|
||||
* Instantiates a new Open MCT Color Palette input
|
||||
* @constructor
|
||||
@@ -20,8 +19,6 @@ define([
|
||||
* up to the descendent class
|
||||
*/
|
||||
function Palette(cssClass, container, items) {
|
||||
eventHelpers.extend(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.cssClass = cssClass;
|
||||
@@ -52,8 +49,8 @@ define([
|
||||
|
||||
$('.menu', self.domElement).hide();
|
||||
|
||||
this.listenTo($(document), 'click', this.hideMenu);
|
||||
this.listenTo($('.l-click-area', self.domElement), 'click', function (event) {
|
||||
$(document).on('click', this.hideMenu);
|
||||
$('.l-click-area', self.domElement).on('click', function (event) {
|
||||
event.stopPropagation();
|
||||
$('.menu', self.container).hide();
|
||||
$('.menu', self.domElement).show();
|
||||
@@ -72,7 +69,7 @@ define([
|
||||
$('.menu', self.domElement).hide();
|
||||
}
|
||||
|
||||
this.listenTo($('.s-palette-item', self.domElement), 'click', handleItemClick);
|
||||
$('.s-palette-item', self.domElement).on('click', handleItemClick);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +83,7 @@ define([
|
||||
* Clean up any event listeners registered to DOM elements external to the widget
|
||||
*/
|
||||
Palette.prototype.destroy = function () {
|
||||
this.stopListening();
|
||||
$(document).off('click', this.hideMenu);
|
||||
};
|
||||
|
||||
Palette.prototype.hideMenu = function () {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
define([
|
||||
'../eventHelpers',
|
||||
'text!../../res/input/selectTemplate.html',
|
||||
'EventEmitter',
|
||||
'zepto'
|
||||
], function (
|
||||
eventHelpers,
|
||||
selectTemplate,
|
||||
EventEmitter,
|
||||
$
|
||||
@@ -16,8 +14,6 @@ define([
|
||||
* @constructor
|
||||
*/
|
||||
function Select() {
|
||||
eventHelpers.extend(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.domElement = $(selectTemplate);
|
||||
@@ -40,7 +36,7 @@ define([
|
||||
self.eventEmitter.emit('change', value[0]);
|
||||
}
|
||||
|
||||
this.listenTo($('select', this.domElement), 'change', onChange, this);
|
||||
$('select', this.domElement).on('change', onChange);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,9 +140,5 @@ define([
|
||||
$('.equal-to').removeClass('hidden');
|
||||
};
|
||||
|
||||
Select.prototype.destroy = function () {
|
||||
this.stopListening();
|
||||
};
|
||||
|
||||
return Select;
|
||||
});
|
||||
|
||||
@@ -196,6 +196,7 @@ define(['../src/ConditionEvaluator'], function (ConditionEvaluator) {
|
||||
//if no conditions are fully defined, should return false for any mode
|
||||
expect(evaluator.execute(mockConditionsUndefined, 'any')).toEqual(false);
|
||||
expect(evaluator.execute(mockConditionsUndefined, 'all')).toEqual(false);
|
||||
expect(evaluator.execute(mockConditionsUndefined, 'js')).toEqual(false);
|
||||
//these conditions are true: evaluator should ignore undefined conditions,
|
||||
//and evaluate the rule as true
|
||||
mockConditionsUndefined.push({
|
||||
|
||||
@@ -65,8 +65,7 @@ define(['../src/SummaryWidget', 'zepto'], function (SummaryWidget, $) {
|
||||
]);
|
||||
mockOpenMCT.composition.get.andReturn(mockComposition);
|
||||
mockOpenMCT.objects.mutate = jasmine.createSpy('mutate');
|
||||
mockOpenMCT.objects.observe = jasmine.createSpy('observe');
|
||||
mockOpenMCT.objects.observe.andReturn(function () {});
|
||||
mockOpenMCT.objects.observe = function () {};
|
||||
|
||||
summaryWidget = new SummaryWidget(mockDomainObject, mockOpenMCT);
|
||||
mockContainer = document.createElement('div');
|
||||
@@ -116,8 +115,7 @@ define(['../src/SummaryWidget', 'zepto'], function (SummaryWidget, $) {
|
||||
expect(Object.keys(mockDomainObject.configuration.ruleConfigById).length).toEqual(1);
|
||||
});
|
||||
|
||||
it('uses mutate when updating the domain object only when in edit mode', function () {
|
||||
summaryWidget.editing = true;
|
||||
it('uses mutate when updating the domain object', function () {
|
||||
summaryWidget.updateDomainObject();
|
||||
expect(mockOpenMCT.objects.mutate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
60
src/plugins/telemetryMean/plugin.js
Executable file
60
src/plugins/telemetryMean/plugin.js
Executable file
@@ -0,0 +1,60 @@
|
||||
define([
|
||||
'./src/TelemetryMeanProvider',
|
||||
'./src/TelemetryMeanActionDecorator'
|
||||
],
|
||||
function (
|
||||
TelemetryMeanProvider, TelemetryMeanActionDecorator) {
|
||||
var DEFAULT_SAMPLES = 10;
|
||||
|
||||
function plugin() {
|
||||
return function install(openmct) {
|
||||
openmct.types.addType('telemetry-mean', {
|
||||
name: 'Telemetry Filter',
|
||||
description: 'Provides telemetry values that represent the mean of the last N values of a telemetry stream',
|
||||
creatable: true,
|
||||
cssClass: 'icon-telemetry',
|
||||
initialize: function (domainObject) {
|
||||
domainObject.samples = DEFAULT_SAMPLES;
|
||||
domainObject.telemetry = {
|
||||
values: [
|
||||
{
|
||||
key: "utc",
|
||||
name: "Time",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
name: "Value",
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
form: [
|
||||
{
|
||||
"key": "telemetryPoint",
|
||||
"name": "Telemetry Point",
|
||||
"control": "textfield",
|
||||
"required": true,
|
||||
"cssClass": "l-input-lg"
|
||||
},
|
||||
{
|
||||
"key": "samples",
|
||||
"name": "Samples to Average",
|
||||
"control": "textfield",
|
||||
"required": true,
|
||||
"cssClass": "l-input-sm"
|
||||
}
|
||||
]
|
||||
});
|
||||
openmct.telemetry.addProvider(new TelemetryMeanProvider(openmct));
|
||||
};
|
||||
}
|
||||
|
||||
return plugin;
|
||||
});
|
||||
@@ -0,0 +1,71 @@
|
||||
define([], function () {
|
||||
function TelemetryMeanActionDecorator (openmct, actionService) {
|
||||
this.actionService = actionService;
|
||||
this.openmct = openmct;
|
||||
|
||||
[
|
||||
'decorateAction',
|
||||
'getActions',
|
||||
'updateTelemetryFromLinkedObject'
|
||||
].forEach(function (name) {
|
||||
this[name] = this[name].bind(this);
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
TelemetryMeanActionDecorator.prototype.decorateAction = function (action) {
|
||||
function update(object) {
|
||||
var domainObject = object || action.domainObject;
|
||||
return this.updateTelemetryFromLinkedObject(object)
|
||||
.then(function (modelWithTelemetry) {
|
||||
return this.mutate(domainObject, modelWithTelemetry);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
if (action.getMetadata && action.getMetadata().key === 'properties' || action.getMetadata().key === 'create'){
|
||||
var oldPerform = action.perform.bind(action);
|
||||
action.perform = function () {
|
||||
return oldPerform().then(update.bind(this), update.bind(this));
|
||||
}.bind(this);
|
||||
}
|
||||
}
|
||||
|
||||
TelemetryMeanActionDecorator.prototype.mutate = function (domainObject, model) {
|
||||
return domainObject.useCapability('mutation', function () {
|
||||
return model
|
||||
});
|
||||
}
|
||||
|
||||
TelemetryMeanActionDecorator.prototype.getActions = function () {
|
||||
var actions = this.actionService.getActions.apply(this.actionService, arguments);
|
||||
actions.forEach(this.decorateAction);
|
||||
return actions;
|
||||
};
|
||||
|
||||
TelemetryMeanActionDecorator.prototype.updateTelemetryFromLinkedObject = function (domainObject) {
|
||||
var model = domainObject.getModel();
|
||||
var telemetryPoint = model.telemetryPoint;
|
||||
var telemetryApi = this.openmct.telemetry;
|
||||
|
||||
if (telemetryPoint) {
|
||||
return this.openmct.objects.get(telemetryPoint).then(function (referencedObject) {
|
||||
if (referencedObject.type !== 'unknown') {
|
||||
var keysForRanges = telemetryApi.getMetadata(referencedObject).valuesForHints(['range'])
|
||||
.map(function (metadatum) {
|
||||
return metadatum.source;
|
||||
});
|
||||
|
||||
model.telemetry.values = referencedObject.telemetry.values.map(function (value) {
|
||||
if (keysForRanges.indexOf(value.source) !== -1) {
|
||||
value.name = value.name + " (Mean)";
|
||||
}
|
||||
return value;
|
||||
});
|
||||
}
|
||||
return model;
|
||||
}.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
return TelemetryMeanActionDecorator;
|
||||
|
||||
});
|
||||
112
src/plugins/telemetryMean/src/TelemetryMeanProvider.js
Normal file
112
src/plugins/telemetryMean/src/TelemetryMeanProvider.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, 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 () {
|
||||
|
||||
function TelemetryMeanProvider(openmct) {
|
||||
this.openmct = openmct;
|
||||
this.subscriptionBuffer = [];
|
||||
this.lastNValues = [];
|
||||
}
|
||||
|
||||
TelemetryMeanProvider.prototype.canProvideTelemetry = function (domainObject) {
|
||||
return domainObject.type === 'telemetry-mean';
|
||||
};
|
||||
|
||||
TelemetryMeanProvider.prototype.supportsRequest = function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
TelemetryMeanProvider.prototype.supportsSubscribe =
|
||||
TelemetryMeanProvider.prototype.canProvideTelemetry;
|
||||
|
||||
TelemetryMeanProvider.prototype.subscribe = function (domainObject, callback) {
|
||||
var promiseForObject = this.getWrappedObject(domainObject)
|
||||
return this.subscribeToWrappedObject(promiseForObject, callback);
|
||||
};
|
||||
|
||||
TelemetryMeanProvider.prototype.getWrappedObject = function (domainObject) {
|
||||
var objectId = domainObject.telemetryPoint;
|
||||
return this.openmct.objects.get(objectId);
|
||||
};
|
||||
|
||||
TelemetryMeanProvider.prototype.subscribeToWrappedObject = function (promiseForObject, callback) {
|
||||
var wrappedUnsubscribe;
|
||||
var unsubscribeCalled = false;
|
||||
|
||||
promiseForObject.then(function subscribe(wrappedObject) {
|
||||
if (!unsubscribeCalled && wrappedObject){
|
||||
wrappedUnsubscribe = this.subscribeToMeanValues(wrappedObject, callback);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
return function unsubscribe(){
|
||||
unsubscribeCalled = true;
|
||||
if (wrappedUnsubscribe !== undefined) {
|
||||
wrappedUnsubscribe();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
TelemetryMeanProvider.prototype.subscribeToMeanValues = function (object, callback) {
|
||||
var telemetryApi = this.openmct.telemetry;
|
||||
var lastNData = [];
|
||||
var rangeKey = telemetryApi.getMetadata(object).valuesForHints(['range'])
|
||||
.map(function (metadatum) {
|
||||
return metadatum.source;
|
||||
}
|
||||
)[0];
|
||||
|
||||
return telemetryApi.subscribe(object, function (telemetryDatum) {
|
||||
|
||||
lastNData.push(telemetryDatum);
|
||||
if (lastNData.length > object.samples) {
|
||||
lastNData.shift();
|
||||
}
|
||||
|
||||
var meanDatum = this.calculateMeansForDatum(telemetryDatum, rangeKey, lastNData);
|
||||
callback(meanDatum);
|
||||
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
TelemetryMeanProvider.prototype.calculateMeansForDatum = function (telemetryDatum, keyToMean, lastNData) {
|
||||
var meanDatum = {
|
||||
'utc': telemetryDatum['utc'],
|
||||
'value': this.calculateMean(lastNData, keyToMean)
|
||||
}
|
||||
return meanDatum;
|
||||
}
|
||||
|
||||
TelemetryMeanProvider.prototype.calculateMean = function (lastNData, valueToMean) {
|
||||
return lastNData.reduce(function (sum, datum){
|
||||
return sum + datum[valueToMean];
|
||||
}, 0) / lastNData.length;
|
||||
};
|
||||
|
||||
TelemetryMeanProvider.prototype.request = function (domainObject, request) {
|
||||
throw "Historical requests not supported for Telemetry Averager";
|
||||
};
|
||||
|
||||
return TelemetryMeanProvider;
|
||||
});
|
||||
@@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global console */
|
||||
|
||||
define([], function () {
|
||||
/**
|
||||
@@ -29,7 +28,8 @@ define([], function () {
|
||||
* @memberof module:openmct
|
||||
*/
|
||||
function ViewRegistry() {
|
||||
this.providers = {};
|
||||
this.next_id = 0;
|
||||
this.providers = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -40,17 +40,10 @@ define([], function () {
|
||||
* which can provide views of this object
|
||||
*/
|
||||
ViewRegistry.prototype.get = function (item) {
|
||||
return this.getAllProviders()
|
||||
.filter(function (provider) {
|
||||
return provider.canView(item);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ViewRegistry.prototype.getAllProviders = function () {
|
||||
return Object.values(this.providers);
|
||||
return this.providers.filter(function (provider) {
|
||||
return typeof provider.canView(item) !== 'undefined' &&
|
||||
provider.canView(item) !== false;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -61,22 +54,8 @@ define([], function () {
|
||||
* @memberof module:openmct.ViewRegistry#
|
||||
*/
|
||||
ViewRegistry.prototype.addProvider = function (provider) {
|
||||
var key = provider.key;
|
||||
if (key === undefined) {
|
||||
throw "View providers must have a unique 'key' property defined";
|
||||
}
|
||||
if (this.providers[key] !== undefined) {
|
||||
console.warn("Provider already defined for key '%s'. Provider keys must be unique.", key);
|
||||
}
|
||||
|
||||
this.providers[key] = provider;
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ViewRegistry.prototype.getByProviderKey = function (key) {
|
||||
return this.providers[key];
|
||||
provider.vpid = this.next_id++;
|
||||
this.providers.push(provider);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -126,7 +105,6 @@ define([], function () {
|
||||
* Exposes types of views in Open MCT.
|
||||
*
|
||||
* @interface ViewProvider
|
||||
* @property {string} key a unique identifier for this view
|
||||
* @property {string} name the human-readable name of this view
|
||||
* @property {string} [description] a longer-form description (typically
|
||||
* a single sentence or short paragraph) of this kind of view
|
||||
@@ -141,26 +119,16 @@ define([], function () {
|
||||
* When called by Open MCT, this may include additional arguments
|
||||
* which are on the path to the object to be viewed; for instance,
|
||||
* when viewing "A Folder" within "My Items", this method will be
|
||||
* invoked with "A Folder" (as a domain object) as the first argument
|
||||
* invoked with "A Folder" (as a domain object) as the first argument,
|
||||
* and "My Items" as the second argument.
|
||||
*
|
||||
* @method canView
|
||||
* @memberof module:openmct.ViewProvider#
|
||||
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||
* to be viewed
|
||||
* @returns {boolean} 'true' if the view applies to the provided object,
|
||||
* otherwise 'false'.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Optional method determining the priority of a given view. If this
|
||||
* function is not defined on a view provider, then a default priority
|
||||
* of 100 will be applicable for all objects supported by this view.
|
||||
*
|
||||
* @method priority
|
||||
* @memberof module:openmct.ViewProvider#
|
||||
* @param {module:openmct.DomainObject} domainObject the domain object
|
||||
* to be viewed
|
||||
* @returns {number} The priority of the view. If multiple views could apply
|
||||
* @returns {Number|boolean} if this returns `false`, then the view does
|
||||
* not apply to the object. If it returns true or any number, then
|
||||
* it applies to this object. If multiple views could apply
|
||||
* to an object, the view that returns the lowest number will be
|
||||
* the default view.
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ requirejs.config({
|
||||
"moment": "bower_components/moment/moment",
|
||||
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
|
||||
"moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data",
|
||||
"saveAs": "bower_components/file-saver/FileSaver.min",
|
||||
"saveAs": "bower_components/FileSaver.js/FileSaver.min",
|
||||
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
||||
"text": "bower_components/text/text",
|
||||
"uuid": "bower_components/node-uuid/uuid",
|
||||
|
||||
Reference in New Issue
Block a user