Compare commits

..

104 Commits

Author SHA1 Message Date
75d8f64b70 garbage collect plotly data. 2021-06-11 12:49:59 -07:00
b9919c19ee full plotly-dist 2020-07-21 11:56:23 -07:00
076588441e Merge branch 'plotly-import-size' of https://github.com/nasa/openmct into plotly-import-size 2020-07-21 11:24:10 -07:00
afe8382f8d reverted karma-jasmine 2020-07-21 11:23:40 -07:00
be18a764c0 Merge branch 'master' into plotly-import-size 2020-07-21 10:13:38 -07:00
6f4208c3fd touched file for new push 2020-07-21 10:08:53 -07:00
15ad5f5719 resolve merge conflict 2020-07-21 09:57:18 -07:00
76df729f2f fixed lint error 2020-07-20 16:07:18 -07:00
ee0b1f04bd resolved merge 2020-07-20 15:46:19 -07:00
352fe8ea7c Merge branch 'plotly-test' of https://github.com/nasa/openmct into plotly-test 2020-07-13 10:23:02 -07:00
29650f54de add unique id to plotElement 2020-07-13 10:22:31 -07:00
02d00aeb07 resolved conflict 2020-07-09 13:00:10 -07:00
fd21594e4a resolved conflict 2020-07-09 11:17:34 -07:00
5d0beb4351 reverted commit 2020-07-09 11:13:29 -07:00
f88d3bcaf3 Merge branch 'master' into plotly-test 2020-07-01 09:51:27 -07:00
c1102ed4b1 resolved merge conflict 2020-07-01 09:31:09 -07:00
fcd8a9a9c9 hide y-axis on empty plot, purge and recreate plot after removing only telemetry object 2020-07-01 09:28:48 -07:00
5f729640b2 added removeTelemetryObject 2020-06-30 13:59:59 -07:00
5fc12c771a fixed yaxis title, trace names in legend, markers 2020-06-30 11:39:35 -07:00
7931177497 resolved merge 2020-06-30 10:18:44 -07:00
195aa0a95b Remove composition listeners on destroy 2020-06-30 09:30:49 -07:00
c252d435bf Clear data on bounds change. Clean up on destroy. 2020-06-29 18:21:57 -07:00
87aa5a4342 Cleaning up unused code 2020-06-29 17:16:57 -07:00
bd98b81339 some code reorg 2020-06-29 16:47:47 -07:00
56794b0ed5 using smaller plotly bundle 2020-06-29 12:10:32 -07:00
0398679abc Merge branch 'master' of https://github.com/nasa/openmct into plotly-test 2020-06-29 11:52:48 -07:00
1bc60f8108 wip: refactoring 2020-06-25 13:26:00 -07:00
122f3efa1f removed extend argument 2020-06-25 10:41:59 -07:00
32791b442d wip: refactor 2020-06-24 14:55:00 -07:00
7aaccdb286 wip: refactoring 2020-06-24 11:34:03 -07:00
f49556adad wip: functional with single trace, but debugging problems with changing bounds with multiple traces 2020-06-23 12:32:47 -07:00
f726bfa31a wip: refactoring 2020-06-22 14:56:22 -07:00
e9c6c5760e resolve conflicts 2020-06-19 13:42:23 -07:00
07c3dd6cfa wip: changes for bounds events 2020-06-19 13:40:20 -07:00
651a369391 refactored for multiple telemetry types 2020-06-18 15:36:38 -07:00
ae67a2f438 wip: refactoring for multiple telemetry types 2020-06-18 08:53:24 -07:00
1acda469a9 fixed value formatting, removed listeners 2020-06-16 15:51:12 -07:00
d5b0ef735c Merge branch 'master' of https://github.com/nasa/openmct into plotly-test 2020-06-16 12:25:58 -07:00
a6cac13dfc removed duplicate function 2020-06-16 12:25:30 -07:00
3d058151f2 imported and used telemetry table components, removed console logs from telemetryTable.js 2020-06-16 12:16:17 -07:00
76817193eb minor color changes 2020-06-15 12:33:25 -07:00
35ef4407be changed way index is tracked mostly, other small changes 2020-06-15 11:16:01 -07:00
f3526f9185 refactored to follow telemetry tables pattern 2020-06-12 16:24:10 -07:00
70649b0657 added js-plotly-container class 2020-06-10 10:29:36 -07:00
3b89bf0b8c Merge branch 'plotly-test' of https://github.com/nasa/openmct into plotly-test 2020-06-09 11:08:03 -07:00
a314aa3c95 Merge branch 'master' of https://github.com/nasa/openmct into plotly-test 2020-06-09 11:07:27 -07:00
dc5723c227 tweaked margins 2020-06-09 11:07:14 -07:00
61fd7d4e4e mostly styling changes, removed isFixed arg from getLayout 2020-06-09 09:31:54 -07:00
32fc871e67 correct usage of node_options 2020-06-04 09:28:43 -07:00
6b74a133d8 Upgraded karma 2020-06-03 17:41:42 -07:00
ceaf4c2ef0 Cleared circle cache 2020-06-03 16:29:55 -07:00
982b69e7e1 Don't rebuild sass every time 2020-06-03 16:25:08 -07:00
8e5182732d Used cross-platform instead of export 2020-06-03 16:24:13 -07:00
2d0b92cc38 Removed no-sandbox flag 2020-06-03 16:23:17 -07:00
75e846ea3f Added missing new line 2020-06-03 16:22:08 -07:00
1b5dee981d Reverted resource class change 2020-06-03 16:20:49 -07:00
4fee7f73e7 Fixed circle config 2020-06-03 16:19:49 -07:00
4308a4c9cf Removed report files 2020-06-03 16:17:23 -07:00
abbffcfbf1 Merge branch 'plotly-test' of https://github.com/nasa/openmct into plotly-test 2020-06-03 16:16:00 -07:00
01710876fb Increase circle resource class 2020-06-03 16:15:52 -07:00
9e3d97c85d added no-sandbox flag 2020-06-03 13:33:59 -07:00
519075001e bumped docker config to node 13 2020-06-03 13:12:45 -07:00
96a48dd9ee moved rebuild node-sass later 2020-06-03 13:08:00 -07:00
550daae76f add rebuild node-sass to config 2020-06-03 13:03:36 -07:00
b8fcb8ff14 change circleci config to node12 2020-06-03 12:45:46 -07:00
373ddd0bf5 updated circleci to use node13 2020-06-03 11:47:00 -07:00
d62cc6b3ee bumped karma-jasmine to ^2.0.0 2020-06-03 11:11:07 -07:00
5116d38437 added test memory increase 2020-06-03 11:03:36 -07:00
29771f2722 Merge branch 'master' of https://github.com/nasa/openmct into plotly-test 2020-06-02 16:52:34 -07:00
7bfe4bb25c restored karma-jasmine to original 2020-06-02 16:31:04 -07:00
510c637081 locked karma-jasmine dependency 2020-06-02 16:01:02 -07:00
d7c65fec4c changed jasmine-core to ^2.0.0 2020-06-02 13:11:18 -07:00
626e2d8e80 changed jasmine-core to 2.0.0 to test circle-ci specfilter issue 2020-06-02 12:56:51 -07:00
1fe673c1f5 Merge branch 'plotly-test' of https://github.com/nasa/openmct into plotly-test 2020-06-02 12:44:35 -07:00
d9b00574e7 Merge branch 'master' of https://github.com/nasa/openmct into plotly-test 2020-06-02 12:38:39 -07:00
7c48b3ba9a Merge branch 'master' into plotly-test 2020-06-02 12:29:46 -07:00
b6e589eed4 removed telemetry from initialization config 2020-06-01 14:46:54 -07:00
fb1813c14b change in legend position, trace names 2020-06-01 07:40:24 -07:00
cce834f873 changed colors, added legend, fixed removeTelemetry 2020-05-29 15:14:05 -07:00
ca60d02614 added name to plugin function, changed colors 2020-05-29 13:38:52 -07:00
9520c09b49 fixed updateData so plot is extended in fixed timespan 2020-05-29 12:02:31 -07:00
0d70717b35 addressed review comments 2020-05-29 09:55:37 -07:00
f18da542d6 added updateRange function, removed length arg from updateData, fixed unsubscribe 2020-05-29 09:37:56 -07:00
e7c38d473b added unsubscribe, subscribeTo methods 2020-05-28 15:26:30 -07:00
2f8db31a33 added dynamic layout for fixed, local clock 2020-05-28 15:25:30 -07:00
1c58d8c85f implemented Plotly.relayout to set x-axis correctly for local clock 2020-05-28 15:25:05 -07:00
baf426055c added back if in updateData 2020-05-28 15:23:04 -07:00
aa3af520ea refactor of refreshData 2020-05-28 15:21:15 -07:00
4a43893ccc debugging local clock issues 2020-05-28 15:21:01 -07:00
77f50a41c9 added some comments 2020-05-28 15:20:38 -07:00
e4cd5f441f added requestHistory 2020-05-28 15:19:44 -07:00
a9cfb002fb added listeners and bounds methods 2020-05-28 15:15:39 -07:00
b603a5b722 WIP... 2020-05-28 15:13:35 -07:00
be165761c7 WIP: adding bounds functions 2020-05-28 15:13:10 -07:00
da88cf58cc add, remove multiple traces, remove hover effects 2020-05-28 15:12:48 -07:00
bc2bd53f9b WIP 2020-05-28 15:12:11 -07:00
6b7fd5f22a import RemoveAction 2020-05-28 15:09:01 -07:00
4ee214a142 add code to set Y-axis and plot multiple telemetry types 2020-05-28 15:07:35 -07:00
4af24db38a changed mode and type, dropped old data as data extends 2020-05-28 15:06:24 -07:00
8db27809ef rendering a plotly plot from SWG 2020-05-28 15:04:36 -07:00
3116b1addd wip: added telemetry provider 2020-05-28 14:58:24 -07:00
5f67c45b50 working on viewProvider 2020-05-28 14:57:52 -07:00
8158afc29a added hardcoded test plot 2020-05-28 14:57:13 -07:00
13b3acb7e0 basic plotly plugin structure 2020-05-28 14:55:06 -07:00
779 changed files with 3059 additions and 5441 deletions

View File

@ -121,59 +121,6 @@ module.exports = {
// https://eslint.org/docs/rules/rest-spread-spacing // https://eslint.org/docs/rules/rest-spread-spacing
"rest-spread-spacing": ["error"], "rest-spread-spacing": ["error"],
// https://eslint.org/docs/rules/no-implicit-coercion
"no-implicit-coercion": "error",
//https://eslint.org/docs/rules/no-unneeded-ternary
"no-unneeded-ternary": "error",
// https://eslint.org/docs/rules/semi
"semi": ["error", "always"],
// https://eslint.org/docs/rules/no-multi-spaces
"no-multi-spaces": "error",
// https://eslint.org/docs/rules/key-spacing
"key-spacing": ["error", {
"afterColon": true
}],
// https://eslint.org/docs/rules/keyword-spacing
"keyword-spacing": ["error", {
"before": true,
"after": true
}],
// https://eslint.org/docs/rules/comma-spacing
// Also requires one line code fix
"comma-spacing": ["error", {
"after": true
}],
//https://eslint.org/docs/rules/no-whitespace-before-property
"no-whitespace-before-property": "error",
// https://eslint.org/docs/rules/object-curly-newline
"object-curly-newline": ["error", {"consistent": true, "multiline": true}],
// https://eslint.org/docs/rules/object-property-newline
"object-property-newline": "error",
// https://eslint.org/docs/rules/brace-style
"brace-style": "error",
// https://eslint.org/docs/rules/no-multiple-empty-lines
"no-multiple-empty-lines": ["error", {"max": 1}],
// https://eslint.org/docs/rules/operator-linebreak
"operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}],
// https://eslint.org/docs/rules/padding-line-between-statements
"padding-line-between-statements":["error", {
"blankLine": "always",
"prev": "multiline-block-like",
"next": "*"
}, {
"blankLine": "always",
"prev": "*",
"next": "return"
}],
// https://eslint.org/docs/rules/space-infix-ops
"space-infix-ops": "error",
// https://eslint.org/docs/rules/space-unary-ops
"space-unary-ops": ["error", {"words": true, "nonwords": false}],
// https://eslint.org/docs/rules/arrow-spacing
"arrow-spacing": "error",
// https://eslint.org/docs/rules/semi-spacing
"semi-spacing": ["error", {"before": false, "after": true}],
"vue/html-indent": [ "vue/html-indent": [
"error", "error",
4, 4,

1
.gitignore vendored
View File

@ -41,3 +41,4 @@ npm-debug.log
report.*.json report.*.json
package-lock.json package-lock.json
report.*.json

View File

@ -44,14 +44,13 @@ define(
}; };
generatorData.getDomainValue = function (i, domain) { generatorData.getDomainValue = function (i, domain) {
return i * interval return i * interval +
+ (domain !== 'delta' ? firstObservedTime : 0); (domain !== 'delta' ? firstObservedTime : 0);
}; };
generatorData.getRangeValue = function (i, range) { generatorData.getRangeValue = function (i, range) {
var domainDelta = this.getDomainValue(i) - firstObservedTime, var domainDelta = this.getDomainValue(i) - firstObservedTime,
ind = i % messages.length; ind = i % messages.length;
return messages[ind] + " - [" + domainDelta.toString() + "]"; return messages[ind] + " - [" + domainDelta.toString() + "]";
}; };

View File

@ -57,7 +57,6 @@ define(
results.forEach(function (result) { results.forEach(function (result) {
packaged[result.key] = result.telemetry; packaged[result.key] = result.telemetry;
}); });
// Format as expected (sources -> keys -> telemetry) // Format as expected (sources -> keys -> telemetry)
return { eventGenerator: packaged }; return { eventGenerator: packaged };
} }

View File

@ -76,14 +76,13 @@ define([], function () {
copyRangesToRow(row, i); copyRangesToRow(row, i);
rows.push(row); rows.push(row);
} }
exportService.exportCSV(rows, { headers: headers }); exportService.exportCSV(rows, { headers: headers });
}); });
}; };
ExportTelemetryAsCSVAction.appliesTo = function (context) { ExportTelemetryAsCSVAction.appliesTo = function (context) {
return context.domainObject return context.domainObject &&
&& context.domainObject.hasCapability("telemetry"); context.domainObject.hasCapability("telemetry");
}; };
return ExportTelemetryAsCSVAction; return ExportTelemetryAsCSVAction;

View File

@ -152,22 +152,10 @@ define(
name: "Choose something", name: "Choose something",
control: "select", control: "select",
options: [ options: [
{ { name: "Hats", value: "hats" },
name: "Hats", { name: "Bats", value: "bats" },
value: "hats" { name: "Cats", value: "cats" },
}, { name: "Mats", value: "mats" }
{
name: "Bats",
value: "bats"
},
{
name: "Cats",
value: "cats"
},
{
name: "Mats",
value: "mats"
}
], ],
key: "aChoice" key: "aChoice"
}, },
@ -176,22 +164,10 @@ define(
control: "select", control: "select",
required: true, required: true,
options: [ options: [
{ { name: "Hats", value: "hats" },
name: "Hats", { name: "Bats", value: "bats" },
value: "hats" { name: "Cats", value: "cats" },
}, { name: "Mats", value: "mats" }
{
name: "Bats",
value: "bats"
},
{
name: "Cats",
value: "cats"
},
{
name: "Mats",
value: "mats"
}
], ],
key: "aRequiredChoice" key: "aRequiredChoice"
} }

View File

@ -108,7 +108,7 @@ define([
} }
] ]
} }
}; }
function GeneratorMetadataProvider() { function GeneratorMetadataProvider() {

View File

@ -65,19 +65,15 @@ define([
if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) { if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) {
workerRequest[prop] = domainObject.telemetry[prop]; workerRequest[prop] = domainObject.telemetry[prop];
} }
if (request && request.hasOwnProperty(prop)) { if (request && request.hasOwnProperty(prop)) {
workerRequest[prop] = request[prop]; workerRequest[prop] = request[prop];
} }
if (!workerRequest.hasOwnProperty(prop)) { if (!workerRequest.hasOwnProperty(prop)) {
workerRequest[prop] = REQUEST_DEFAULTS[prop]; workerRequest[prop] = REQUEST_DEFAULTS[prop];
} }
workerRequest[prop] = Number(workerRequest[prop]); workerRequest[prop] = Number(workerRequest[prop]);
}); });
workerRequest.name = domainObject.name; workerRequest.name = domainObject.name;
return workerRequest; return workerRequest;
}; };
@ -85,13 +81,11 @@ define([
var workerRequest = this.makeWorkerRequest(domainObject, request); var workerRequest = this.makeWorkerRequest(domainObject, request);
workerRequest.start = request.start; workerRequest.start = request.start;
workerRequest.end = request.end; workerRequest.end = request.end;
return this.workerInterface.request(workerRequest); return this.workerInterface.request(workerRequest);
}; };
GeneratorProvider.prototype.subscribe = function (domainObject, callback) { GeneratorProvider.prototype.subscribe = function (domainObject, callback) {
var workerRequest = this.makeWorkerRequest(domainObject, {}); var workerRequest = this.makeWorkerRequest(domainObject, {});
return this.workerInterface.subscribe(workerRequest, callback); return this.workerInterface.subscribe(workerRequest, callback);
}; };

View File

@ -78,15 +78,12 @@ define([
if (datum[range] > RED[range]) { if (datum[range] > RED[range]) {
return LIMITS.rh; return LIMITS.rh;
} }
if (datum[range] < -RED[range]) { if (datum[range] < -RED[range]) {
return LIMITS.rl; return LIMITS.rl;
} }
if (datum[range] > YELLOW[range]) { if (datum[range] > YELLOW[range]) {
return LIMITS.yh; return LIMITS.yh;
} }
if (datum[range] < -YELLOW[range]) { if (datum[range] < -YELLOW[range]) {
return LIMITS.yl; return LIMITS.yl;
} }

View File

@ -48,7 +48,7 @@ define([
var interval = setInterval(function () { var interval = setInterval(function () {
var now = Date.now(); var now = Date.now();
var datum = pointForTimestamp(now, duration, domainObject.name); var datum = pointForTimestamp(now, duration, domainObject.name);
datum.value = String(datum.value); datum.value += "";
callback(datum); callback(datum);
}, duration); }, duration);
@ -57,6 +57,7 @@ define([
}; };
}; };
StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) { StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) {
return domainObject.type === 'example.state-generator'; return domainObject.type === 'example.state-generator';
}; };
@ -68,13 +69,11 @@ define([
if (options.strategy === 'latest' || options.size === 1) { if (options.strategy === 'latest' || options.size === 1) {
start = end; start = end;
} }
var data = []; var data = [];
while (start <= end && data.length < 5000) { while (start <= end && data.length < 5000) {
data.push(pointForTimestamp(start, duration, domainObject.name)); data.push(pointForTimestamp(start, duration, domainObject.name));
start += duration; start += duration;
} }
return Promise.resolve(data); return Promise.resolve(data);
}; };

View File

@ -78,7 +78,6 @@ define([
} else { } else {
deferred.resolve(message.data); deferred.resolve(message.data);
} }
delete this.callbacks[messageId]; delete this.callbacks[messageId];
} }
@ -102,5 +101,8 @@ define([
}.bind(this); }.bind(this);
}; };
return WorkerInterface; return WorkerInterface;
}); });

View File

@ -71,7 +71,6 @@
}); });
nextStep += step; nextStep += step;
} }
return nextStep; return nextStep;
} }
@ -88,7 +87,6 @@
if (request.end === undefined) { if (request.end === undefined) {
request.end = Date.now(); request.end = Date.now();
} }
if (request.start === undefined) { if (request.start === undefined) {
request.start = request.end - FIFTEEN_MINUTES; request.start = request.end - FIFTEEN_MINUTES;
} }
@ -117,7 +115,6 @@
cos: cos(nextStep, period, amplitude, offset, phase, randomness) cos: cos(nextStep, period, amplitude, offset, phase, randomness)
}); });
} }
self.postMessage({ self.postMessage({
id: message.id, id: message.id,
data: data data: data
@ -125,13 +122,13 @@
} }
function cos(timestamp, period, amplitude, offset, phase, randomness) { function cos(timestamp, period, amplitude, offset, phase, randomness) {
return amplitude return amplitude *
* Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset; Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
} }
function sin(timestamp, period, amplitude, offset, phase, randomness) { function sin(timestamp, period, amplitude, offset, phase, randomness) {
return amplitude return amplitude *
* Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset; Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
} }
function sendError(error, message) { function sendError(error, message) {

View File

@ -56,7 +56,7 @@ define([
initialize: function (object) { initialize: function (object) {
object.telemetry = { object.telemetry = {
duration: 5 duration: 5
}; }
} }
}); });

View File

@ -25,14 +25,10 @@ define(
function () { function () {
"use strict"; "use strict";
var DEFAULT_IDENTITY = { var DEFAULT_IDENTITY = { key: "user", name: "Example User" },
key: "user",
name: "Example User"
},
DIALOG_STRUCTURE = { DIALOG_STRUCTURE = {
name: "Identify Yourself", name: "Identify Yourself",
sections: [{ sections: [{ rows: [
rows: [
{ {
name: "User ID", name: "User ID",
control: "textfield", control: "textfield",
@ -45,10 +41,10 @@ define(
key: "name", key: "name",
required: true required: true
} }
] ]}]
}]
}; };
/** /**
* Example implementation of an identity service. This prompts the * Example implementation of an identity service. This prompts the
* user to enter a name and user ID; in a more realistic * user to enter a name and user ID; in a more realistic
@ -81,14 +77,14 @@ define(
*/ */
ExampleIdentityProvider.prototype.returnUser = function (user) { ExampleIdentityProvider.prototype.returnUser = function (user) {
return this.user = user; return this.user = user;
}; }
/** /**
* @private * @private
*/ */
ExampleIdentityProvider.prototype.returnUndefined = function () { ExampleIdentityProvider.prototype.returnUndefined = function () {
return undefined; return undefined;
}; }
return ExampleIdentityProvider; return ExampleIdentityProvider;
} }

View File

@ -85,28 +85,28 @@ define([
data.push(pointForTimestamp(start, domainObject.name)); data.push(pointForTimestamp(start, domainObject.name));
start += 5000; start += 5000;
} }
return Promise.resolve(data); return Promise.resolve(data);
} }
}; };
var ladProvider = { var ladProvider = {
supportsRequest: function (domainObject, options) { supportsRequest: function (domainObject, options) {
return domainObject.type === 'example.imagery' return domainObject.type === 'example.imagery' &&
&& options.strategy === 'latest'; options.strategy === 'latest';
}, },
request: function (domainObject, options) { request: function (domainObject, options) {
return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]); return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]);
} }
}; };
return function install(openmct) { return function install(openmct) {
openmct.types.addType('example.imagery', { openmct.types.addType('example.imagery', {
key: 'example.imagery', key: 'example.imagery',
name: 'Example Imagery', name: 'Example Imagery',
cssClass: 'icon-image', cssClass: 'icon-image',
description: 'For development use. Creates example imagery ' description: 'For development use. Creates example imagery ' +
+ 'data that mimics a live imagery stream.', 'data that mimics a live imagery stream.',
creatable: true, creatable: true,
initialize: function (object) { initialize: function (object) {
object.telemetry = { object.telemetry = {
@ -140,7 +140,7 @@ define([
} }
} }
] ]
}; }
} }
}); });

View File

@ -31,7 +31,6 @@ define([
RemsTelemetryProvider RemsTelemetryProvider
) { ) {
"use strict"; "use strict";
return { return {
name:"example/msl", name:"example/msl",
definition: { definition: {

View File

@ -81,7 +81,6 @@ define(
(dictionary.instruments || []).forEach(function (instrument) { (dictionary.instruments || []).forEach(function (instrument) {
addInstrument(instrument, "msl:curiosity"); addInstrument(instrument, "msl:curiosity");
}); });
return models; return models;
} }
@ -91,7 +90,6 @@ define(
} }
}; };
} }
return RemsTelemetryModelProvider; return RemsTelemetryModelProvider;
} }
); );

View File

@ -74,7 +74,6 @@ define (
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) { RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
return function () {}; return function () {};
}; };
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) { RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
return function () {}; return function () {};
}; };

View File

@ -57,7 +57,6 @@ define(
RemsTelemetrySeries.prototype.getPointCount = function () { RemsTelemetrySeries.prototype.getPointCount = function () {
return this.data.length; return this.data.length;
}; };
/** /**
* The domain value at the given index. The Rems telemetry data is * The domain value at the given index. The Rems telemetry data is
* time ordered, so the domain value is the time stamp of each data * time ordered, so the domain value is the time stamp of each data

View File

@ -95,32 +95,28 @@ define(
}); });
} }
}); });
return data; return data;
} }
function fallbackToLocal() { function fallbackToLocal() {
self.$log.warn("Loading REMS data failed, probably due to" self.$log.warn("Loading REMS data failed, probably due to" +
+ " cross origin policy. Falling back to local data"); " cross origin policy. Falling back to local data");
return self.$http.get(self.localDataURI); return self.$http.get(self.localDataURI);
} }
//Filter results to match request parameters //Filter results to match request parameters
function filterResults(results) { function filterResults(results) {
return results.filter(function (result) { return results.filter(function (result) {
return result.date >= (request.start || Number.MIN_VALUE) return result.date >= (request.start || Number.MIN_VALUE) &&
&& result.date <= (request.end || Number.MAX_VALUE); result.date <= (request.end || Number.MAX_VALUE);
}); });
} }
function packageAndResolve(results) { function packageAndResolve(results) {
return { return {id: id, values: results};
id: id,
values: results
};
} }
return (this.promise = this.promise || this.$http.get(this.REMS_WS_URL)) return (this.promise = this.promise || this.$http.get(this.REMS_WS_URL))
.catch(fallbackToLocal) .catch(fallbackToLocal)
.then(processResponse) .then(processResponse)

View File

@ -91,6 +91,7 @@ define(
} }
}; };
/* /*
Demonstrates launching an error dialog Demonstrates launching an error dialog
*/ */
@ -131,9 +132,9 @@ define(
var dialog, var dialog,
model = { model = {
title: "Info Dialog Example", title: "Info Dialog Example",
actionText: "This is an example of a blocking info" actionText: "This is an example of a blocking info" +
+ " dialog. This dialog can be used to draw the user's" " dialog. This dialog can be used to draw the user's" +
+ " attention to an event.", " attention to an event.",
severity: "info", severity: "info",
primaryOption: { primaryOption: {
label: "OK", label: "OK",
@ -152,7 +153,6 @@ define(
}; };
} }
return DialogLaunchController; return DialogLaunchController;
} }
); );

View File

@ -42,11 +42,9 @@ define(
DialogLaunchIndicator.prototype.getGlyphClass = function () { DialogLaunchIndicator.prototype.getGlyphClass = function () {
return 'ok'; return 'ok';
}; };
DialogLaunchIndicator.prototype.getText = function () { DialogLaunchIndicator.prototype.getText = function () {
return "Launch test dialog"; return "Launch test dialog";
}; };
DialogLaunchIndicator.prototype.getDescription = function () { DialogLaunchIndicator.prototype.getDescription = function () {
return "Launch test dialog"; return "Launch test dialog";
}; };

View File

@ -48,7 +48,6 @@ define(
"Eros turpis, pulvinar turpis eros eu", "Eros turpis, pulvinar turpis eros eu",
"Lundium nascetur a, lectus montes ac, parturient in natoque, duis risus risus pulvinar pid rhoncus, habitasse auctor natoque!" "Lundium nascetur a, lectus montes ac, parturient in natoque, duis risus risus pulvinar pid rhoncus, habitasse auctor natoque!"
]; ];
return actionTexts[Math.floor(Math.random()*3)]; return actionTexts[Math.floor(Math.random()*3)];
} }
@ -62,7 +61,6 @@ define(
severity: "error" severity: "error"
}); });
}; };
/** /**
* Launch a new notification with a severity of 'Alert'. * Launch a new notification with a severity of 'Alert'.
*/ */
@ -75,6 +73,7 @@ define(
}); });
}; };
/** /**
* Launch a new notification with a progress bar that is updated * Launch a new notification with a progress bar that is updated
* periodically, tracking an ongoing process. * periodically, tracking an ongoing process.
@ -94,10 +93,10 @@ define(
* @param notification * @param notification
*/ */
function incrementProgress() { function incrementProgress() {
progress = Math.min(100, Math.floor(progress + Math.random() * 30)); progress = Math.min(100, Math.floor(progress + Math.random() * 30))
let progressText = ["Estimated time" let progressText = ["Estimated time" +
+ " remaining:" " remaining:" +
+ " about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" "); " about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" ");
notification.progress(progress, progressText); notification.progress(progress, progressText);
if (progress < 100) { if (progress < 100) {
@ -121,7 +120,6 @@ define(
}; };
} }
return NotificationLaunchController; return NotificationLaunchController;
} }
); );

View File

@ -42,11 +42,9 @@ define(
NotificationLaunchIndicator.prototype.getGlyphClass = function () { NotificationLaunchIndicator.prototype.getGlyphClass = function () {
return 'ok'; return 'ok';
}; };
NotificationLaunchIndicator.prototype.getText = function () { NotificationLaunchIndicator.prototype.getText = function () {
return "Launch notification"; return "Launch notification";
}; };
NotificationLaunchIndicator.prototype.getDescription = function () { NotificationLaunchIndicator.prototype.getDescription = function () {
return "Launch notification"; return "Launch notification";
}; };

View File

@ -30,6 +30,8 @@ define(
function () { function () {
'use strict'; 'use strict';
function BrowserPersistenceProvider($q, SPACE) { function BrowserPersistenceProvider($q, SPACE) {
var spaces = SPACE ? [SPACE] : [], var spaces = SPACE ? [SPACE] : [],
caches = {}, caches = {},
@ -49,7 +51,6 @@ define(
}, },
listObjects: function (space) { listObjects: function (space) {
var cache = caches[space]; var cache = caches[space];
return promises.as( return promises.as(
cache ? Object.keys(cache) : null cache ? Object.keys(cache) : null
); );
@ -67,7 +68,6 @@ define(
}, },
readObject: function (space, key) { readObject: function (space, key) {
var cache = caches[space]; var cache = caches[space];
return promises.as( return promises.as(
cache ? cache[key] : null cache ? cache[key] : null
); );

View File

@ -37,7 +37,6 @@ define(
model = (domainObject && domainObject.getModel()) || {}, model = (domainObject && domainObject.getModel()) || {},
name = model.name || "", name = model.name || "",
metadata = action.getMetadata() || {}; metadata = action.getMetadata() || {};
return metadata.key !== 'remove' || name.indexOf('foo') < 0; return metadata.key !== 'remove' || name.indexOf('foo') < 0;
} }
}; };

View File

@ -54,14 +54,13 @@ define(
if (space === 'scratch') { if (space === 'scratch') {
this.table[key] = JSON.stringify(value); this.table[key] = JSON.stringify(value);
} }
return this.$q.when(space === 'scratch'); return this.$q.when(space === 'scratch');
}; };
ScratchPersistenceProvider.prototype.readObject = function (space, key) { ScratchPersistenceProvider.prototype.readObject = function (space, key) {
return this.$q.when( return this.$q.when(
(space === 'scratch' && this.table[key]) (space === 'scratch' && this.table[key]) ?
? JSON.parse(this.table[key]) : undefined JSON.parse(this.table[key]) : undefined
); );
}; };
@ -69,7 +68,6 @@ define(
if (space === 'scratch') { if (space === 'scratch') {
delete this.table[key]; delete this.table[key];
} }
return this.$q.when(space === 'scratch'); return this.$q.when(space === 'scratch');
}; };

View File

@ -7,9 +7,9 @@ export default {
data() { data() {
return { return {
msg: 'Hello world!' msg: 'Hello world!'
};
} }
}; }
}
</script> </script>
<style> <style>

View File

@ -17,7 +17,6 @@ function SimpleVuePlugin() {
}, },
view: function (domainObject) { view: function (domainObject) {
var vm; var vm;
return { return {
show: function (container) { show: function (container) {
vm = new Vue(HelloWorld); vm = new Vue(HelloWorld);
@ -30,7 +29,7 @@ function SimpleVuePlugin() {
} }
}); });
}; }
} }
export default SimpleVuePlugin; export default SimpleVuePlugin

View File

@ -29,104 +29,24 @@ define([
"extensions": "extensions":
{ {
"types": [ "types": [
{ { "key": "styleguide.intro", "name": "Introduction", "cssClass": "icon-page", "description": "Introduction and overview to the style guide" },
"key": "styleguide.intro", { "key": "styleguide.standards", "name": "Standards", "cssClass": "icon-page", "description": "" },
"name": "Introduction", { "key": "styleguide.colors", "name": "Colors", "cssClass": "icon-page", "description": "" },
"cssClass": "icon-page", { "key": "styleguide.status", "name": "status", "cssClass": "icon-page", "description": "Limits, telemetry paused, etc." },
"description": "Introduction and overview to the style guide" { "key": "styleguide.glyphs", "name": "Glyphs", "cssClass": "icon-page", "description": "Glyphs overview" },
}, { "key": "styleguide.controls", "name": "Controls", "cssClass": "icon-page", "description": "Buttons, selects, HTML controls" },
{ { "key": "styleguide.input", "name": "Text Inputs", "cssClass": "icon-page", "description": "Various text inputs" },
"key": "styleguide.standards", { "key": "styleguide.menus", "name": "Menus", "cssClass": "icon-page", "description": "Context menus, dropdowns" }
"name": "Standards",
"cssClass": "icon-page",
"description": ""
},
{
"key": "styleguide.colors",
"name": "Colors",
"cssClass": "icon-page",
"description": ""
},
{
"key": "styleguide.status",
"name": "status",
"cssClass": "icon-page",
"description": "Limits, telemetry paused, etc."
},
{
"key": "styleguide.glyphs",
"name": "Glyphs",
"cssClass": "icon-page",
"description": "Glyphs overview"
},
{
"key": "styleguide.controls",
"name": "Controls",
"cssClass": "icon-page",
"description": "Buttons, selects, HTML controls"
},
{
"key": "styleguide.input",
"name": "Text Inputs",
"cssClass": "icon-page",
"description": "Various text inputs"
},
{
"key": "styleguide.menus",
"name": "Menus",
"cssClass": "icon-page",
"description": "Context menus, dropdowns"
}
], ],
"views": [ "views": [
{ { "key": "styleguide.intro", "type": "styleguide.intro", "template": introTemplate, "editable": false },
"key": "styleguide.intro", { "key": "styleguide.standards", "type": "styleguide.standards", "template": standardsTemplate, "editable": false },
"type": "styleguide.intro", { "key": "styleguide.colors", "type": "styleguide.colors", "template": colorsTemplate, "editable": false },
"template": introTemplate, { "key": "styleguide.status", "type": "styleguide.status", "template": statusTemplate, "editable": false },
"editable": false { "key": "styleguide.glyphs", "type": "styleguide.glyphs", "template": glyphsTemplate, "editable": false },
}, { "key": "styleguide.controls", "type": "styleguide.controls", "template": controlsTemplate, "editable": false },
{ { "key": "styleguide.input", "type": "styleguide.input", "template": inputTemplate, "editable": false },
"key": "styleguide.standards", { "key": "styleguide.menus", "type": "styleguide.menus", "template": menusTemplate, "editable": false }
"type": "styleguide.standards",
"template": standardsTemplate,
"editable": false
},
{
"key": "styleguide.colors",
"type": "styleguide.colors",
"template": colorsTemplate,
"editable": false
},
{
"key": "styleguide.status",
"type": "styleguide.status",
"template": statusTemplate,
"editable": false
},
{
"key": "styleguide.glyphs",
"type": "styleguide.glyphs",
"template": glyphsTemplate,
"editable": false
},
{
"key": "styleguide.controls",
"type": "styleguide.controls",
"template": controlsTemplate,
"editable": false
},
{
"key": "styleguide.input",
"type": "styleguide.input",
"template": inputTemplate,
"editable": false
},
{
"key": "styleguide.menus",
"type": "styleguide.menus",
"template": menusTemplate,
"editable": false
}
], ],
"roots": [ "roots": [
{ {

View File

@ -30,46 +30,14 @@ define(
var pages = {}; var pages = {};
// Add pages // Add pages
pages.intro = { pages.intro = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
name: "Introduction", pages.standards = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
type: "styleguide.intro", pages.colors = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
location: "styleguide:home" pages.glyphs = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
}; pages.status = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
pages.standards = { pages.controls = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
name: "Standards", pages.input = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
type: "styleguide.standards", pages.menus = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
location: "styleguide:home"
};
pages.colors = {
name: "Colors",
type: "styleguide.colors",
location: "styleguide:home"
};
pages.glyphs = {
name: "Glyphs",
type: "styleguide.glyphs",
location: "styleguide:home"
};
pages.status = {
name: "Status Indication",
type: "styleguide.status",
location: "styleguide:home"
};
pages.controls = {
name: "Controls",
type: "styleguide.controls",
location: "styleguide:ui-elements"
};
pages.input = {
name: "Text Inputs",
type: "styleguide.input",
location: "styleguide:ui-elements"
};
pages.menus = {
name: "Menus",
type: "styleguide.menus",
location: "styleguide:ui-elements"
};
return { return {
getModels: function () { getModels: function () {
@ -78,6 +46,6 @@ define(
}; };
} }
return ExampleStyleGuideModelProvider; return ExampleStyleGuideModelProvider
} }
); );

View File

@ -2,7 +2,6 @@
"name": "openmct", "name": "openmct",
"version": "1.0.0-snapshot", "version": "1.0.0-snapshot",
"description": "The Open MCT core platform", "description": "The Open MCT core platform",
"dependencies": {},
"devDependencies": { "devDependencies": {
"angular": ">=1.8.0", "angular": ">=1.8.0",
"angular-route": "1.4.14", "angular-route": "1.4.14",
@ -61,6 +60,7 @@
"node-bourbon": "^4.2.3", "node-bourbon": "^4.2.3",
"node-sass": "^4.9.2", "node-sass": "^4.9.2",
"painterro": "^1.0.35", "painterro": "^1.0.35",
"plotly.js-dist": "^1.54.5",
"printj": "^1.2.1", "printj": "^1.2.1",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"request": "^2.69.0", "request": "^2.69.0",

View File

@ -20,6 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/** /**
* Implements Open MCT's About dialog. * Implements Open MCT's About dialog.
* @namespace platform/commonUI/about * @namespace platform/commonUI/about

View File

@ -31,14 +31,8 @@ define(
beforeEach(function () { beforeEach(function () {
testVersions = [ testVersions = [
{ { name: "Some name", value: "1.2.3" },
name: "Some name", { name: "Some other name", value: "3.2.1" }
value: "1.2.3"
},
{
name: "Some other name",
value: "3.2.1"
}
]; ];
mockWindow = jasmine.createSpyObj("$window", ["open"]); mockWindow = jasmine.createSpyObj("$window", ["open"]);
controller = new AboutController(testVersions, mockWindow); controller = new AboutController(testVersions, mockWindow);
@ -57,6 +51,7 @@ define(
expect(mockWindow.open).toHaveBeenCalledWith("#/licenses"); expect(mockWindow.open).toHaveBeenCalledWith("#/licenses");
}); });
}); });
} }

View File

@ -46,7 +46,6 @@ define(
NavigateAction.prototype.perform = function () { NavigateAction.prototype.perform = function () {
if (this.navigationService.shouldNavigate()) { if (this.navigationService.shouldNavigate()) {
this.navigationService.setNavigation(this.domainObject, true); this.navigationService.setNavigation(this.domainObject, true);
return Promise.resolve({}); return Promise.resolve({});
} }

View File

@ -69,10 +69,8 @@ define(
NavigationService.prototype.setNavigation = function (domainObject, force) { NavigationService.prototype.setNavigation = function (domainObject, force) {
if (force) { if (force) {
this.doNavigation(domainObject); this.doNavigation(domainObject);
return true; return true;
} }
if (this.navigated === domainObject) { if (this.navigated === domainObject) {
return true; return true;
} }
@ -83,7 +81,6 @@ define(
} }
this.doNavigation(domainObject); this.doNavigation(domainObject);
return true; return true;
}; };
@ -123,7 +120,6 @@ define(
*/ */
NavigationService.prototype.shouldNavigate = function () { NavigationService.prototype.shouldNavigate = function () {
var doNotNavigate = this.shouldWarnBeforeNavigate(); var doNotNavigate = this.shouldWarnBeforeNavigate();
return !doNotNavigate || this.$window.confirm(doNotNavigate); return !doNotNavigate || this.$window.confirm(doNotNavigate);
}; };
@ -139,7 +135,6 @@ define(
*/ */
NavigationService.prototype.checkBeforeNavigation = function (checkFn) { NavigationService.prototype.checkBeforeNavigation = function (checkFn) {
this.checks.push(checkFn); this.checks.push(checkFn);
return function removeCheck() { return function removeCheck() {
this.checks = this.checks.filter(function (fn) { this.checks = this.checks.filter(function (fn) {
return checkFn !== fn; return checkFn !== fn;
@ -177,7 +172,6 @@ define(
if (reasons.length) { if (reasons.length) {
return reasons.join('\n'); return reasons.join('\n');
} }
return false; return false;
}; };
@ -192,7 +186,6 @@ define(
if (shouldWarnBeforeNavigate) { if (shouldWarnBeforeNavigate) {
return shouldWarnBeforeNavigate; return shouldWarnBeforeNavigate;
} }
if (this.oldUnload) { if (this.oldUnload) {
return this.oldUnload.apply(undefined, [].slice.apply(arguments)); return this.oldUnload.apply(undefined, [].slice.apply(arguments));
} }

View File

@ -40,7 +40,6 @@ define([], function () {
function getParent(domainObject) { function getParent(domainObject) {
var context = domainObject.getCapability('context'); var context = domainObject.getCapability('context');
return context.getParent(); return context.getParent();
} }

View File

@ -53,7 +53,6 @@ define([
it("sets navigation if it is allowed", function () { it("sets navigation if it is allowed", function () {
mockNavigationService.shouldNavigate.and.returnValue(true); mockNavigationService.shouldNavigate.and.returnValue(true);
return action.perform() return action.perform()
.then(function () { .then(function () {
expect(mockNavigationService.setNavigation) expect(mockNavigationService.setNavigation)
@ -64,7 +63,6 @@ define([
it("does not set navigation if it is not allowed", function () { it("does not set navigation if it is not allowed", function () {
mockNavigationService.shouldNavigate.and.returnValue(false); mockNavigationService.shouldNavigate.and.returnValue(false);
var onSuccess = jasmine.createSpy('onSuccess'); var onSuccess = jasmine.createSpy('onSuccess');
return action.perform() return action.perform()
.then(onSuccess, function () { .then(onSuccess, function () {
expect(onSuccess).not.toHaveBeenCalled(); expect(onSuccess).not.toHaveBeenCalled();

View File

@ -79,6 +79,7 @@ define(
navigationService.addListener(callback); navigationService.addListener(callback);
navigationService.removeListener(callback); navigationService.removeListener(callback);
navigationService.setNavigation(testObject); navigationService.setNavigation(testObject);
expect(callback).not.toHaveBeenCalled(); expect(callback).not.toHaveBeenCalled();
}); });

View File

@ -70,7 +70,6 @@ define([
jasmine.createSpy('throttled-' + mockThrottledFns.length); jasmine.createSpy('throttled-' + mockThrottledFns.length);
mockThrottledFn.and.callFake(fn); mockThrottledFn.and.callFake(fn);
mockThrottledFns.push(mockThrottledFn); mockThrottledFns.push(mockThrottledFn);
return mockThrottledFn; return mockThrottledFn;
}); });
mockTopic.and.returnValue(mockMutationTopic); mockTopic.and.returnValue(mockMutationTopic);
@ -82,7 +81,7 @@ define([
}[c]; }[c];
}); });
mockDomainObject.hasCapability.and.callFake(function (c) { mockDomainObject.hasCapability.and.callFake(function (c) {
return Boolean(mockDomainObject.getCapability(c)); return !!mockDomainObject.getCapability(c);
}); });
mockParentObject.getCapability.and.callFake(function (c) { mockParentObject.getCapability.and.callFake(function (c) {
return { return {
@ -103,6 +102,7 @@ define([
); );
}); });
it("listens for mutation with a throttled function", function () { it("listens for mutation with a throttled function", function () {
expect(mockMutationTopic.listen) expect(mockMutationTopic.listen)
.toHaveBeenCalledWith(jasmine.any(Function)); .toHaveBeenCalledWith(jasmine.any(Function));
@ -129,8 +129,8 @@ define([
}); });
[false, true].forEach(function (isEditRoot) { [false, true].forEach(function (isEditRoot) {
var caseName = isEditRoot var caseName = isEditRoot ?
? "that are being edited" : "that are not being edited"; "that are being edited" : "that are not being edited";
function itNavigatesAsExpected() { function itNavigatesAsExpected() {
if (isOrphan && !isEditRoot) { if (isOrphan && !isEditRoot) {

View File

@ -31,13 +31,13 @@
</mct-form> </mct-form>
</div> </div>
<div class="c-overlay__button-bar"> <div class="c-overlay__button-bar">
<button class='c-button c-button--major' <a class='c-button c-button--major'
ng-class="{ disabled: !createForm.$valid }" ng-class="{ disabled: !createForm.$valid }"
ng-click="ngModel.confirm()"> ng-click="ngModel.confirm()">
OK OK
</button> </a>
<button class='c-button ' <a class='c-button '
ng-click="ngModel.cancel()"> ng-click="ngModel.cancel()">
Cancel Cancel
</button> </a>
</div> </div>

View File

@ -31,13 +31,13 @@
</mct-include> </mct-include>
</div> </div>
<div class="c-overlay__button-bar"> <div class="c-overlay__button-bar">
<button ng-repeat="option in ngModel.dialog.options" <a ng-repeat="option in ngModel.dialog.options"
href='' href=''
class="s-button lg" class="s-button lg"
title="{{option.description}}" title="{{option.description}}"
ng-click="ngModel.confirm(option.key)" ng-click="ngModel.confirm(option.key)"
ng-class="{ major: $first, subtle: !$first }"> ng-class="{ major: $first, subtle: !$first }">
{{option.name}} {{option.name}}
</button> </a>
</div> </div>
</mct-container> </mct-container>

View File

@ -24,7 +24,7 @@
<div class="c-overlay__outer"> <div class="c-overlay__outer">
<button ng-click="ngModel.cancel()" <button ng-click="ngModel.cancel()"
ng-if="ngModel.cancel" ng-if="ngModel.cancel"
class="c-click-icon c-overlay__close-button icon-x"></button> class="c-click-icon c-overlay__close-button icon-x-in-circle"></button>
<div class="c-overlay__contents" ng-transclude></div> <div class="c-overlay__contents" ng-transclude></div>
</div> </div>
</div> </div>

View File

@ -28,6 +28,7 @@ define(
// the a specific template that can be included via mct-include // the a specific template that can be included via mct-include
var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></mct-include>'; var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></mct-include>';
/** /**
* The OverlayService is responsible for pre-pending templates to * The OverlayService is responsible for pre-pending templates to
* the body of the document, which is useful for displaying templates * the body of the document, which is useful for displaying templates
@ -52,7 +53,6 @@ define(
this.findBody = function () { this.findBody = function () {
return $document.find('body'); return $document.find('body');
}; };
this.newScope = function () { this.newScope = function () {
return $rootScope.$new(); return $rootScope.$new();
}; };

View File

@ -129,8 +129,8 @@ define(
); );
}); });
it("invokes the overlay service with the correct parameters when" it("invokes the overlay service with the correct parameters when" +
+ " a blocking dialog is requested", function () { " a blocking dialog is requested", function () {
var dialogModel = {}; var dialogModel = {};
expect(dialogService.showBlockingMessage(dialogModel)).not.toBe(false); expect(dialogService.showBlockingMessage(dialogModel)).not.toBe(false);
expect(mockOverlayService.createOverlay).toHaveBeenCalledWith( expect(mockOverlayService.createOverlay).toHaveBeenCalledWith(

View File

@ -48,7 +48,7 @@ define(
mockScope = jasmine.createSpyObj("scope", ["$destroy"]); mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
mockTimeout = function (callback) { mockTimeout = function (callback) {
callback(); callback();
}; }
mockDocument.find.and.returnValue(mockBody); mockDocument.find.and.returnValue(mockBody);
mockCompile.and.returnValue(mockTemplate); mockCompile.and.returnValue(mockTemplate);

View File

@ -56,7 +56,6 @@ define(
//navigate back to parent because nothing to show. //navigate back to parent because nothing to show.
return domainObject.getCapability("location").getOriginal().then(function (original) { return domainObject.getCapability("location").getOriginal().then(function (original) {
parent = original.getCapability("context").getParent(); parent = original.getCapability("context").getParent();
return parent.getCapability("action").perform("navigate"); return parent.getCapability("action").perform("navigate");
}); });
} }
@ -79,10 +78,9 @@ define(
*/ */
CancelAction.appliesTo = function (context) { CancelAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject; var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
return domainObject !== undefined domainObject.hasCapability('editor') &&
&& domainObject.hasCapability('editor') domainObject.getCapability('editor').isEditContextRoot();
&& domainObject.getCapability('editor').isEditContextRoot();
}; };
return CancelAction; return CancelAction;

View File

@ -91,9 +91,9 @@ define(
// Only allow editing of types that support it and are not already // Only allow editing of types that support it and are not already
// being edited // being edited
return type && type.hasFeature('creation') return type && type.hasFeature('creation') &&
&& domainObject.hasCapability('editor') domainObject.hasCapability('editor') &&
&& !domainObject.getCapability('editor').isEditContextRoot(); !domainObject.getCapability('editor').isEditContextRoot();
}; };
return EditAction; return EditAction;

View File

@ -24,6 +24,7 @@ define(
[], [],
function () { function () {
/** /**
* Add one domain object to another's composition. * Add one domain object to another's composition.
* @constructor * @constructor
@ -41,9 +42,8 @@ define(
// Link these objects // Link these objects
function doLink() { function doLink() {
var composition = self.domainObject var composition = self.domainObject &&
&& self.domainObject.getCapability('composition'); self.domainObject.getCapability('composition');
return composition && composition.add(self.selectedObject); return composition && composition.add(self.selectedObject);
} }

View File

@ -99,3 +99,4 @@ define(
); );

View File

@ -51,7 +51,6 @@ define(
// Property definition is same as form row definition // Property definition is same as form row definition
var row = JSON.parse(JSON.stringify(property.getDefinition())); var row = JSON.parse(JSON.stringify(property.getDefinition()));
row.key = index; row.key = index;
return row; return row;
}).filter(function (row) { }).filter(function (row) {
// Only show properties which are editable // Only show properties which are editable

View File

@ -86,11 +86,10 @@ define(
*/ */
SaveAction.appliesTo = function (context) { SaveAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject; var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
return domainObject !== undefined domainObject.hasCapability('editor') &&
&& domainObject.hasCapability('editor') domainObject.getCapability('editor').isEditContextRoot() &&
&& domainObject.getCapability('editor').isEditContextRoot() domainObject.getModel().persisted !== undefined;
&& domainObject.getModel().persisted !== undefined;
}; };
return SaveAction; return SaveAction;

View File

@ -20,6 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define([ define([
'../creation/CreateWizard', '../creation/CreateWizard',
'./SaveInProgressDialog' './SaveInProgressDialog'
@ -49,7 +50,6 @@ function (
this.injectObjectService = function () { this.injectObjectService = function () {
this.objectService = $injector.get("objectService"); this.objectService = $injector.get("objectService");
}; };
this.dialogService = dialogService; this.dialogService = dialogService;
this.copyService = copyService; this.copyService = copyService;
this.notificationService = notificationService; this.notificationService = notificationService;
@ -75,7 +75,6 @@ function (
if (!this.objectService) { if (!this.objectService) {
this.injectObjectService(); this.injectObjectService();
} }
return this.objectService; return this.objectService;
}; };
@ -119,13 +118,11 @@ function (
function showBlockingDialog(object) { function showBlockingDialog(object) {
dialog.show(); dialog.show();
return object; return object;
} }
function hideBlockingDialog(object) { function hideBlockingDialog(object) {
dialog.hide(); dialog.hide();
return object; return object;
} }
@ -141,12 +138,11 @@ function (
function allowClone(objectToClone) { function allowClone(objectToClone) {
var allowed = var allowed =
(objectToClone.getId() === domainObject.getId()) (objectToClone.getId() === domainObject.getId()) ||
|| objectToClone.getCapability('location').isOriginal(); objectToClone.getCapability('location').isOriginal();
if (allowed) { if (allowed) {
toUndirty.push(objectToClone); toUndirty.push(objectToClone);
} }
return allowed; return allowed;
} }
@ -167,11 +163,11 @@ function (
return this.openmct.editor.save().then(() => { return this.openmct.editor.save().then(() => {
// Force mutation for search indexing // Force mutation for search indexing
return clonedObject; return clonedObject;
}); })
} }
function finishEditing(clonedObject) { function finishEditing(clonedObject) {
return fetchObject(clonedObject.getId()); return fetchObject(clonedObject.getId())
} }
function indexForSearch(savedObject) { function indexForSearch(savedObject) {
@ -184,7 +180,6 @@ function (
function onSuccess(object) { function onSuccess(object) {
self.notificationService.info("Save Succeeded"); self.notificationService.info("Save Succeeded");
return object; return object;
} }
@ -193,7 +188,6 @@ function (
if (reason !== "user canceled") { if (reason !== "user canceled") {
self.notificationService.error("Save Failed"); self.notificationService.error("Save Failed");
} }
throw reason; throw reason;
} }
@ -211,6 +205,7 @@ function (
.catch(onFailure); .catch(onFailure);
}; };
/** /**
* Check if this action is applicable in a given context. * Check if this action is applicable in a given context.
* This will ensure that a domain object is present in the context, * This will ensure that a domain object is present in the context,
@ -219,11 +214,10 @@ function (
*/ */
SaveAsAction.appliesTo = function (context) { SaveAsAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject; var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
return domainObject !== undefined domainObject.hasCapability('editor') &&
&& domainObject.hasCapability('editor') domainObject.getCapability('editor').isEditContextRoot() &&
&& domainObject.getCapability('editor').isEditContextRoot() domainObject.getModel().persisted === undefined;
&& domainObject.getModel().persisted === undefined;
}; };
return SaveAsAction; return SaveAsAction;

View File

@ -83,7 +83,6 @@ define(
*/ */
EditorCapability.prototype.save = function () { EditorCapability.prototype.save = function () {
console.warn('DEPRECATED: cannot save via edit capability, use openmct.editor instead.'); console.warn('DEPRECATED: cannot save via edit capability, use openmct.editor instead.');
return Promise.resolve(); return Promise.resolve();
}; };
@ -96,7 +95,6 @@ define(
*/ */
EditorCapability.prototype.finish = function () { EditorCapability.prototype.finish = function () {
console.warn('DEPRECATED: cannot finish via edit capability, use openmct.editor instead.'); console.warn('DEPRECATED: cannot finish via edit capability, use openmct.editor instead.');
return Promise.resolve(); return Promise.resolve();
}; };

View File

@ -56,10 +56,9 @@ define(
capabilities.persistence = function (domainObject) { capabilities.persistence = function (domainObject) {
var original = var original =
(typeof persistenceCapability === 'function') (typeof persistenceCapability === 'function') ?
? persistenceCapability(domainObject) persistenceCapability(domainObject) :
: persistenceCapability; persistenceCapability;
return new TransactionalPersistenceCapability( return new TransactionalPersistenceCapability(
self.$q, self.$q,
self.transactionService, self.transactionService,
@ -67,7 +66,6 @@ define(
domainObject domainObject
); );
}; };
return capabilities; return capabilities;
}; };

View File

@ -64,7 +64,6 @@ define(
wrappedPersistence.persist.bind(wrappedPersistence), wrappedPersistence.persist.bind(wrappedPersistence),
wrappedPersistence.refresh.bind(wrappedPersistence) wrappedPersistence.refresh.bind(wrappedPersistence)
); );
//Need to return a promise from this function //Need to return a promise from this function
return this.$q.when(true); return this.$q.when(true);
} else { } else {
@ -75,7 +74,6 @@ define(
TransactionalPersistenceCapability.prototype.refresh = function () { TransactionalPersistenceCapability.prototype.refresh = function () {
this.transactionManager this.transactionManager
.clearTransactionsFor(this.domainObject.getId()); .clearTransactionsFor(this.domainObject.getId());
return this.persistenceCapability.refresh(); return this.persistenceCapability.refresh();
}; };

View File

@ -48,9 +48,9 @@ define(
// Maintain all "conclude-editing" and "save" actions in the // Maintain all "conclude-editing" and "save" actions in the
// present context. // present context.
function updateActions() { function updateActions() {
$scope.saveActions = $scope.action $scope.saveActions = $scope.action ?
? $scope.action.getActions(SAVE_ACTION_CONTEXT) $scope.action.getActions(SAVE_ACTION_CONTEXT) :
: []; [];
$scope.saveActionsAsMenuOptions = $scope.saveActions.map(actionToMenuOption); $scope.saveActionsAsMenuOptions = $scope.saveActions.map(actionToMenuOption);
@ -58,9 +58,9 @@ define(
clickedAction.perform(); clickedAction.perform();
}; };
$scope.otherEditActions = $scope.action $scope.otherEditActions = $scope.action ?
? $scope.action.getActions(OTHERS_ACTION_CONTEXT) $scope.action.getActions(OTHERS_ACTION_CONTEXT) :
: []; [];
// Required because Angular does not allow 'bind' // Required because Angular does not allow 'bind'
// in expressions. // in expressions.

View File

@ -30,11 +30,11 @@ define(
function cancelEditing(domainObject) { function cancelEditing(domainObject) {
var navigatedObject = domainObject, var navigatedObject = domainObject,
editorCapability = navigatedObject editorCapability = navigatedObject &&
&& navigatedObject.getCapability("editor"); navigatedObject.getCapability("editor");
return editorCapability return editorCapability &&
&& editorCapability.finish(); editorCapability.finish();
} }
/** /**

View File

@ -35,8 +35,8 @@ define(
// Update root object based on represented object // Update root object based on represented object
function updateRoot(domainObject) { function updateRoot(domainObject) {
var root = self.rootDomainObject, var root = self.rootDomainObject,
context = domainObject context = domainObject &&
&& domainObject.getCapability('context'), domainObject.getCapability('context'),
newRoot = context && context.getTrueRoot(), newRoot = context && context.getTrueRoot(),
oldId = root && root.getId(), oldId = root && root.getId(),
newId = newRoot && newRoot.getId(); newId = newRoot && newRoot.getId();
@ -51,7 +51,6 @@ define(
// Update root when represented object changes // Update root when represented object changes
$scope.$watch('domainObject', updateRoot); $scope.$watch('domainObject', updateRoot);
} }
/** /**
* Get the root-level domain object, as reported by the * Get the root-level domain object, as reported by the
* represented domain object. * represented domain object.

View File

@ -104,6 +104,7 @@ define(
// We will disable this. // We will disable this.
}; };
/** /**
* Metadata associated with a Create action. * Metadata associated with a Create action.
* @typedef {ActionMetadata} CreateActionMetadata * @typedef {ActionMetadata} CreateActionMetadata

View File

@ -38,9 +38,9 @@ define(
function CreateMenuController($scope) { function CreateMenuController($scope) {
// Update the set of Create actions // Update the set of Create actions
function refreshActions() { function refreshActions() {
$scope.createActions = $scope.action $scope.createActions = $scope.action ?
? $scope.action.getActions('create') $scope.action.getActions('create') :
: []; [];
} }
// Listen for new instances of the represented object's // Listen for new instances of the represented object's

View File

@ -114,7 +114,6 @@ define(
this.domainObject.useCapability("mutation", function () { this.domainObject.useCapability("mutation", function () {
return formModel; return formModel;
}); });
return this.domainObject; return this.domainObject;
}; };

View File

@ -73,13 +73,12 @@ define(
// as a child contained by that parent. // as a child contained by that parent.
function addToComposition() { function addToComposition() {
var compositionCapability = parent.getCapability('composition'), var compositionCapability = parent.getCapability('composition'),
addResult = compositionCapability addResult = compositionCapability &&
&& compositionCapability.add(newObject); compositionCapability.add(newObject);
return self.$q.when(addResult).then(function (result) { return self.$q.when(addResult).then(function (result) {
if (!result) { if (!result) {
self.$log.error("Could not modify " + parent.getId()); self.$log.error("Could not modify " + parent.getId());
return undefined; return undefined;
} }
@ -93,7 +92,6 @@ define(
// what space to create the new object's model in. // what space to create the new object's model in.
if (!persistence || !newObjectPersistence) { if (!persistence || !newObjectPersistence) {
self.$log.warn(NON_PERSISTENT_WARNING); self.$log.warn(NON_PERSISTENT_WARNING);
return self.$q.reject(new Error(NON_PERSISTENT_WARNING)); return self.$q.reject(new Error(NON_PERSISTENT_WARNING));
} }
@ -101,6 +99,8 @@ define(
return newObjectPersistence.persist().then(addToComposition); return newObjectPersistence.persist().then(addToComposition);
}; };
return CreationService; return CreationService;
} }
); );

View File

@ -38,8 +38,8 @@ define(
// * treeModel: The model for the embedded tree representation, // * treeModel: The model for the embedded tree representation,
// used for bi-directional object selection. // used for bi-directional object selection.
function setLocatingObject(domainObject, priorObject) { function setLocatingObject(domainObject, priorObject) {
var context = domainObject var context = domainObject &&
&& domainObject.getCapability("context"), domainObject.getCapability("context"),
contextRoot = context && context.getRoot(); contextRoot = context && context.getRoot();
if (contextRoot && contextRoot !== $scope.rootObject) { if (contextRoot && contextRoot !== $scope.rootObject) {
@ -65,12 +65,11 @@ define(
$scope.ngModel[$scope.field] = domainObject; $scope.ngModel[$scope.field] = domainObject;
// Restrict which locations can be selected // Restrict which locations can be selected
if (domainObject if (domainObject &&
&& $scope.structure $scope.structure &&
&& $scope.structure.validate) { $scope.structure.validate) {
if (!$scope.structure.validate(domainObject)) { if (!$scope.structure.validate(domainObject)) {
setLocatingObject(priorObject, undefined); setLocatingObject(priorObject, undefined);
return; return;
} }
} }
@ -79,7 +78,7 @@ define(
if ($scope.ngModelController) { if ($scope.ngModelController) {
$scope.ngModelController.$setValidity( $scope.ngModelController.$setValidity(
'composition', 'composition',
Boolean($scope.treeModel.selectedObject) !!$scope.treeModel.selectedObject
); );
} }
} }

View File

@ -45,7 +45,6 @@ define(
// because it may be saved elsewhere // because it may be saved elsewhere
if ((key === 'edit' && category === 'view-control') || key === 'properties') { if ((key === 'edit' && category === 'view-control') || key === 'properties') {
let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId()); let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId());
return this.openmct.objects.isPersistable(newStyleObject); return this.openmct.objects.isPersistable(newStyleObject);
} }

View File

@ -74,7 +74,6 @@ define(
model.configuration = model.configuration || {}; model.configuration = model.configuration || {};
model.configuration[this.key] = configuration; model.configuration[this.key] = configuration;
} }
domainObject.useCapability('mutation', function () { domainObject.useCapability('mutation', function () {
return model; return model;
}); });

View File

@ -41,7 +41,6 @@ define(['./Transaction'], function (Transaction) {
Transaction.prototype.commit.bind(this), Transaction.prototype.commit.bind(this),
Transaction.prototype.cancel.bind(this) Transaction.prototype.cancel.bind(this)
); );
return Promise.resolve(true); return Promise.resolve(true);
}; };

View File

@ -41,12 +41,8 @@ define([], function () {
* pair of callbacks from the transaction * pair of callbacks from the transaction
*/ */
Transaction.prototype.add = function (commit, cancel) { Transaction.prototype.add = function (commit, cancel) {
var callback = { var callback = { commit: commit, cancel: cancel };
commit: commit,
cancel: cancel
};
this.callbacks.push(callback); this.callbacks.push(callback);
return function () { return function () {
this.callbacks = this.callbacks.filter(function (c) { this.callbacks = this.callbacks.filter(function (c) {
return c !== callback; return c !== callback;
@ -95,5 +91,6 @@ define([], function () {
}; };
}); });
return Transaction; return Transaction;
}); });

View File

@ -50,7 +50,7 @@ define([], function () {
* @returns {boolean} true if callbacks have been added * @returns {boolean} true if callbacks have been added
*/ */
TransactionManager.prototype.isScheduled = function (id) { TransactionManager.prototype.isScheduled = function (id) {
return Boolean(this.clearTransactionFns[id]); return !!this.clearTransactionFns[id];
}; };
/** /**
@ -77,7 +77,6 @@ define([], function () {
return promiseFn().then(nextFn); return promiseFn().then(nextFn);
}; };
} }
/** /**
* Clear any existing persistence calls for object with given ID. This ensures only the most recent persistence * Clear any existing persistence calls for object with given ID. This ensures only the most recent persistence
* call is executed. This should prevent stale objects being persisted and overwriting fresh ones. * call is executed. This should prevent stale objects being persisted and overwriting fresh ones.

View File

@ -48,9 +48,9 @@ define(
* #cancel} are called * #cancel} are called
*/ */
TransactionService.prototype.startTransaction = function () { TransactionService.prototype.startTransaction = function () {
var transaction = this.isActive() var transaction = this.isActive() ?
? new NestedTransaction(this.transactions[0]) new NestedTransaction(this.transactions[0]) :
: new Transaction(this.$log); new Transaction(this.$log);
this.transactions.push(transaction); this.transactions.push(transaction);
}; };
@ -99,16 +99,13 @@ define(
if (!transaction) { if (!transaction) {
return Promise.reject(); return Promise.reject();
} }
if (!this.isActive()) { if (!this.isActive()) {
return transaction.commit() return transaction.commit()
.then(function (r) { .then(function (r) {
this.cacheService.flush(); this.cacheService.flush();
return r; return r;
}.bind(this)); }.bind(this));
} }
return transaction.commit(); return transaction.commit();
}; };
@ -122,7 +119,6 @@ define(
*/ */
TransactionService.prototype.cancel = function () { TransactionService.prototype.cancel = function () {
var transaction = this.transactions.pop(); var transaction = this.transactions.pop();
return transaction ? transaction.cancel() : Promise.reject(); return transaction ? transaction.cancel() : Promise.reject();
}; };

View File

@ -102,7 +102,7 @@ define(
}); });
mockDomainObject.hasCapability.and.callFake(function (name) { mockDomainObject.hasCapability.and.callFake(function (name) {
return Boolean(capabilities[name]); return !!capabilities[name];
}); });
capabilities.editor.finish.and.returnValue(mockPromise(true)); capabilities.editor.finish.and.returnValue(mockPromise(true));
@ -123,8 +123,8 @@ define(
expect(CancelAction.appliesTo(actionContext)).toBeFalsy(); expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
}); });
it("invokes the editor capability's cancel functionality when" it("invokes the editor capability's cancel functionality when" +
+ " performed", function () { " performed", function () {
mockDomainObject.getModel.and.returnValue({persisted: 1}); mockDomainObject.getModel.and.returnValue({persisted: 1});
//Return true from navigate action //Return true from navigate action
capabilities.action.perform.and.returnValue(mockPromise(true)); capabilities.action.perform.and.returnValue(mockPromise(true));

View File

@ -93,6 +93,7 @@ define(
action = new EditAndComposeAction(actionContext); action = new EditAndComposeAction(actionContext);
}); });
it("adds to the parent's composition when performed", function () { it("adds to the parent's composition when performed", function () {
action.perform(); action.perform();
expect(mockComposition.add) expect(mockComposition.add)
@ -105,8 +106,8 @@ define(
expect(mockEditAction.perform).toHaveBeenCalled(); expect(mockEditAction.perform).toHaveBeenCalled();
}); });
it("Does not enable edit mode for objects that do not have an" it("Does not enable edit mode for objects that do not have an" +
+ " edit action", function () { " edit action", function () {
mockActionCapability.getActions.and.returnValue([]); mockActionCapability.getActions.and.returnValue([]);
action.perform(); action.perform();
expect(mockEditAction.perform).not.toHaveBeenCalled(); expect(mockEditAction.perform).not.toHaveBeenCalled();

View File

@ -64,10 +64,7 @@ define(
return true; return true;
} }
}; };
context = { context = { someKey: "some value", domainObject: object };
someKey: "some value",
domainObject: object
};
dialogService = { dialogService = {
getUserInput: function () { getUserInput: function () {
return mockPromise(input); return mockPromise(input);

View File

@ -138,7 +138,6 @@ define(
it("notifies if saving succeeded", function () { it("notifies if saving succeeded", function () {
var mockCallback = jasmine.createSpy("callback"); var mockCallback = jasmine.createSpy("callback");
mockEditorCapability.save.and.returnValue(Promise.resolve()); mockEditorCapability.save.and.returnValue(Promise.resolve());
return action.perform().then(mockCallback).then(function () { return action.perform().then(mockCallback).then(function () {
expect(mockNotificationService.info).toHaveBeenCalled(); expect(mockNotificationService.info).toHaveBeenCalled();
expect(mockNotificationService.error).not.toHaveBeenCalled(); expect(mockNotificationService.error).not.toHaveBeenCalled();
@ -148,7 +147,6 @@ define(
it("notifies if saving failed", function () { it("notifies if saving failed", function () {
var mockCallback = jasmine.createSpy("callback"); var mockCallback = jasmine.createSpy("callback");
mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason")); mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason"));
return action.perform().then(mockCallback).then(function () { return action.perform().then(mockCallback).then(function () {
expect(mockNotificationService.error).toHaveBeenCalled(); expect(mockNotificationService.error).toHaveBeenCalled();
expect(mockNotificationService.info).not.toHaveBeenCalled(); expect(mockNotificationService.info).not.toHaveBeenCalled();

View File

@ -97,6 +97,7 @@ define(
action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext); action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext);
}); });
it("only applies to domain object with an editor capability", function () { it("only applies to domain object with an editor capability", function () {
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true); expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true);
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor"); expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");

View File

@ -42,8 +42,8 @@ define(
function noop() {} function noop() {}
function mockPromise(value) { function mockPromise(value) {
return (value || {}).then ? value return (value || {}).then ? value :
: { {
then: function (callback) { then: function (callback) {
return mockPromise(callback(value)); return mockPromise(callback(value));
}, },
@ -67,10 +67,7 @@ define(
mockDomainObject.getCapability.and.callFake(function (capability) { mockDomainObject.getCapability.and.callFake(function (capability) {
return capabilities[capability]; return capabilities[capability];
}); });
mockDomainObject.getModel.and.returnValue({ mockDomainObject.getModel.and.returnValue({location: 'a', persisted: undefined});
location: 'a',
persisted: undefined
});
mockDomainObject.getId.and.returnValue(0); mockDomainObject.getId.and.returnValue(0);
mockClonedObject = jasmine.createSpyObj( mockClonedObject = jasmine.createSpyObj(
@ -171,8 +168,8 @@ define(
expect(SaveAsAction.appliesTo(actionContext)).toBe(false); expect(SaveAsAction.appliesTo(actionContext)).toBe(false);
}); });
it("only applies to domain object that has not already been" it("only applies to domain object that has not already been" +
+ " persisted", function () { " persisted", function () {
expect(SaveAsAction.appliesTo(actionContext)).toBe(true); expect(SaveAsAction.appliesTo(actionContext)).toBe(true);
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor"); expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");

View File

@ -118,8 +118,8 @@ define(
expect(capability.isEditContextRoot()).toBe(true); expect(capability.isEditContextRoot()).toBe(true);
}); });
it("inEditingContext returns true if parent object is being" it("inEditingContext returns true if parent object is being" +
+ " edited", function () { " edited", function () {
mockStatusCapability.get.and.returnValue(false); mockStatusCapability.get.and.returnValue(false);
mockParentStatus.get.and.returnValue(false); mockParentStatus.get.and.returnValue(false);
expect(capability.inEditContext()).toBe(false); expect(capability.inEditContext()).toBe(false);
@ -179,8 +179,8 @@ define(
capability.edit(); capability.edit();
capability.finish(); capability.finish();
}); });
it("returns true if the object has been modified since it" it("returns true if the object has been modified since it" +
+ " was last persisted", function () { " was last persisted", function () {
mockTransactionService.size.and.returnValue(0); mockTransactionService.size.and.returnValue(0);
expect(capability.dirty()).toBe(false); expect(capability.dirty()).toBe(false);
mockTransactionService.size.and.returnValue(1); mockTransactionService.size.and.returnValue(1);

View File

@ -76,15 +76,15 @@ define(
); );
}); });
it("if no transaction is active, passes through to persistence" it("if no transaction is active, passes through to persistence" +
+ " provider", function () { " provider", function () {
mockTransactionManager.isActive.and.returnValue(false); mockTransactionManager.isActive.and.returnValue(false);
capability.persist(); capability.persist();
expect(mockPersistence.persist).toHaveBeenCalled(); expect(mockPersistence.persist).toHaveBeenCalled();
}); });
it("if transaction is active, persist and cancel calls are" it("if transaction is active, persist and cancel calls are" +
+ " queued", function () { " queued", function () {
mockTransactionManager.isActive.and.returnValue(true); mockTransactionManager.isActive.and.returnValue(true);
capability.persist(); capability.persist();
expect(mockTransactionManager.addToTransaction).toHaveBeenCalled(); expect(mockTransactionManager.addToTransaction).toHaveBeenCalled();

View File

@ -40,7 +40,6 @@ define(
mockedSaveActions.forEach(function (action) { mockedSaveActions.forEach(function (action) {
action.getMetadata.and.returnValue(mockSaveActionMetadata); action.getMetadata.and.returnValue(mockSaveActionMetadata);
}); });
return mockedSaveActions; return mockedSaveActions;
} else if (actionContext.category === "conclude-editing") { } else if (actionContext.category === "conclude-editing") {
return ["a", "b", "c"]; return ["a", "b", "c"];

View File

@ -77,10 +77,7 @@ define(
testViews = [ testViews = [
{ key: 'abc' }, { key: 'abc' },
{ { key: 'def', someKey: 'some value' },
key: 'def',
someKey: 'some value'
},
{ key: 'xyz' } { key: 'xyz' }
]; ];

View File

@ -48,10 +48,10 @@ define(
mockContext.getTrueRoot.and.callFake(function () { mockContext.getTrueRoot.and.callFake(function () {
var mockRoot = jasmine.createSpyObj('root', ['getId']); var mockRoot = jasmine.createSpyObj('root', ['getId']);
mockRoot.getId.and.returnValue('root-id'); mockRoot.getId.and.returnValue('root-id');
return mockRoot; return mockRoot;
}); });
controller = new EditPanesController(mockScope); controller = new EditPanesController(mockScope);
}); });
@ -97,7 +97,6 @@ define(
mockContext.getTrueRoot.and.callFake(function () { mockContext.getTrueRoot.and.callFake(function () {
var mockRoot = jasmine.createSpyObj('root', ['getId']); var mockRoot = jasmine.createSpyObj('root', ['getId']);
mockRoot.getId.and.returnValue('other-root-id'); mockRoot.getId.and.returnValue('other-root-id');
return mockRoot; return mockRoot;
}); });

View File

@ -51,7 +51,6 @@ define(
); );
mockType.hasFeature.and.returnValue(true); mockType.hasFeature.and.returnValue(true);
mockType.getName.and.returnValue(name); mockType.getName.and.returnValue(name);
return mockType; return mockType;
} }
@ -76,7 +75,7 @@ define(
}; };
mockPolicyService.allow.and.callFake(function (category, type) { mockPolicyService.allow.and.callFake(function (category, type) {
return Boolean(category === "creation" && mockCreationPolicy(type)); return category === "creation" && mockCreationPolicy(type) ? true : false;
}); });
mockTypeService.listTypes.and.returnValue(mockTypes); mockTypeService.listTypes.and.returnValue(mockTypes);

View File

@ -77,7 +77,7 @@ define(
] ]
); );
mockDomainObject.hasCapability.and.callFake(function (name) { mockDomainObject.hasCapability.and.callFake(function (name) {
return Boolean(capabilities[name]); return !!capabilities[name];
}); });
mockDomainObject.getCapability.and.callFake(function (name) { mockDomainObject.getCapability.and.callFake(function (name) {
return capabilities[name]; return capabilities[name];
@ -150,8 +150,8 @@ define(
expect(mockEditAction.perform).toHaveBeenCalled(); expect(mockEditAction.perform).toHaveBeenCalled();
}); });
it("uses the save-as action if object does not have an edit action" it("uses the save-as action if object does not have an edit action" +
+ " available", function () { " available", function () {
capabilities.action.getActions.and.returnValue([]); capabilities.action.getActions.and.returnValue([]);
capabilities.action.perform.and.returnValue(mockPromise(undefined)); capabilities.action.perform.and.returnValue(mockPromise(undefined));
capabilities.editor.save.and.returnValue(promise); capabilities.editor.save.and.returnValue(promise);

View File

@ -45,7 +45,6 @@ define(
control: "textfield" control: "textfield"
}); });
mockProperty.getValue.and.returnValue(name); mockProperty.getValue.and.returnValue(name);
return mockProperty; return mockProperty;
} }
@ -121,10 +120,7 @@ define(
// Should have gotten a setValue call // Should have gotten a setValue call
mockProperties.forEach(function (mockProperty, i) { mockProperties.forEach(function (mockProperty, i) {
expect(mockProperty.setValue).toHaveBeenCalledWith( expect(mockProperty.setValue).toHaveBeenCalledWith(
{ { someKey: "some value", type: 'test' },
someKey: "some value",
type: 'test'
},
"field " + i "field " + i
); );
}); });
@ -192,6 +188,7 @@ define(
})).toEqual(false); })).toEqual(false);
}); });
}); });
} }
); );

View File

@ -58,10 +58,7 @@ define(
} }
beforeEach(function () { beforeEach(function () {
mockQ = { mockQ = { when: mockPromise, reject: mockReject };
when: mockPromise,
reject: mockReject
};
mockLog = jasmine.createSpyObj( mockLog = jasmine.createSpyObj(
"$log", "$log",
["error", "warn", "info", "debug"] ["error", "warn", "info", "debug"]
@ -116,8 +113,8 @@ define(
mockNewObject.getId.and.returnValue('newId'); mockNewObject.getId.and.returnValue('newId');
mockNewObject.getCapability.and.callFake(function (c) { mockNewObject.getCapability.and.callFake(function (c) {
return c === 'persistence' return c === 'persistence' ?
? mockNewPersistenceCapability : undefined; mockNewPersistenceCapability : undefined;
}); });
mockPersistenceCapability.persist mockPersistenceCapability.persist
@ -170,7 +167,6 @@ define(
mockDomainObject.getId.and.returnValue(id); mockDomainObject.getId.and.returnValue(id);
mockCompositionCapability.invoke mockCompositionCapability.invoke
.and.returnValue(mockPromise([mockDomainObject])); .and.returnValue(mockPromise([mockDomainObject]));
return mockPromise(mockDomainObject); return mockPromise(mockDomainObject);
}); });
@ -211,6 +207,7 @@ define(
expect(mockLog.error).toHaveBeenCalled(); expect(mockLog.error).toHaveBeenCalled();
}); });
}); });
} }
); );

View File

@ -30,6 +30,7 @@ define([
$scope, $scope,
representer; representer;
beforeEach(function () { beforeEach(function () {
$log = jasmine.createSpyObj('$log', ['debug']); $log = jasmine.createSpyObj('$log', ['debug']);
$scope = {}; $scope = {};
@ -83,5 +84,6 @@ define([
}); });
}); });
}); });

View File

@ -74,3 +74,4 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
}); });
}); });

View File

@ -51,7 +51,6 @@ define(
var mockRemove = var mockRemove =
jasmine.createSpy('remove-' + mockRemoves.length); jasmine.createSpy('remove-' + mockRemoves.length);
mockRemoves.push(mockRemove); mockRemoves.push(mockRemove);
return mockRemove; return mockRemove;
}); });

View File

@ -68,8 +68,8 @@ define([
"version": "3.0.0", "version": "3.0.0",
"description": "Incorporates modified code from d3 Time Scales", "description": "Incorporates modified code from d3 Time Scales",
"author": "Mike Bostock", "author": "Mike Bostock",
"copyright": "Copyright 2010-2016 Mike Bostock. " "copyright": "Copyright 2010-2016 Mike Bostock. " +
+ "All rights reserved.", "All rights reserved.",
"link": "https://github.com/d3/d3/blob/master/LICENSE" "link": "https://github.com/d3/d3/blob/master/LICENSE"
} }
] ]

View File

@ -31,6 +31,7 @@ define([
DATE_FORMAT DATE_FORMAT
]; ];
/** /**
* Formatter for duration. Uses moment to produce a date from a given * Formatter for duration. Uses moment to produce a date from a given
* value, but output is formatted to display only time. Can be used for * value, but output is formatted to display only time. Can be used for

View File

@ -114,7 +114,6 @@ define([
if (!format) { if (!format) {
throw new Error("FormatProvider: No format found for " + key); throw new Error("FormatProvider: No format found for " + key);
} }
return format; return format;
}; };

View File

@ -71,7 +71,6 @@ define([
if (typeof text === 'number') { if (typeof text === 'number') {
return text; return text;
} }
return moment.utc(text, DATE_FORMATS).valueOf(); return moment.utc(text, DATE_FORMATS).valueOf();
}; };

View File

@ -43,9 +43,7 @@ define(
function MockFormat() { function MockFormat() {
return mockFormatInstances[i]; return mockFormatInstances[i];
} }
MockFormat.key = k; MockFormat.key = k;
return MockFormat; return MockFormat;
}); });
provider = new FormatProvider(mockFormats); provider = new FormatProvider(mockFormats);

View File

@ -20,6 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
define([ define([
], function ( ], function (
@ -33,7 +34,6 @@ define([
if (!splash) { if (!splash) {
return; return;
} }
splash.className += ' fadeout'; splash.className += ' fadeout';
splash.addEventListener('transitionend', function () { splash.addEventListener('transitionend', function () {
splash.parentNode.removeChild(splash); splash.parentNode.removeChild(splash);

View File

@ -67,8 +67,8 @@ define(
// Stylesheets which specify themes should only be applied // Stylesheets which specify themes should only be applied
// when that theme has been declared. // when that theme has been declared.
function matchesTheme(stylesheet) { function matchesTheme(stylesheet) {
return stylesheet.theme === undefined return stylesheet.theme === undefined ||
|| stylesheet.theme === activeTheme; stylesheet.theme === activeTheme;
} }
assetPath = assetPath || "."; assetPath = assetPath || ".";

View File

@ -46,22 +46,18 @@ define(
notification button notification button
*/ */
$event.stopPropagation(); $event.stopPropagation();
return action(); return action();
}; };
$scope.dismiss = function (notification, $event) { $scope.dismiss = function (notification, $event) {
$event.stopPropagation(); $event.stopPropagation();
notification.dismiss(); notification.dismiss();
}; };
$scope.maximize = function (notification) { $scope.maximize = function (notification) {
if (notification.model.severity !== "info") { if (notification.model.severity !== "info") {
var dialog; var dialog;
notification.model.cancel = function () { notification.model.cancel = function () {
dialog.dismiss(); dialog.dismiss();
}; };
//If the notification is dismissed by the user, close //If the notification is dismissed by the user, close
// the dialog. // the dialog.
notification.on('dismiss', function () { notification.on('dismiss', function () {
@ -72,6 +68,5 @@ define(
} }
}; };
} }
return BannerController; return BannerController;
}); });

View File

@ -56,7 +56,6 @@ define(
this.state = false; this.state = false;
this.$document.off("mouseup", this.clickaway); this.$document.off("mouseup", this.clickaway);
}; };
ClickAwayController.prototype.activate = function () { ClickAwayController.prototype.activate = function () {
this.state = true; this.state = true;
this.$document.on("mouseup", this.clickaway); this.$document.on("mouseup", this.clickaway);

View File

@ -47,13 +47,12 @@ define(
function updateFromModel(value) { function updateFromModel(value) {
// Only reformat if the value is different from user // Only reformat if the value is different from user
// input (to avoid reformatting valid input while typing.) // input (to avoid reformatting valid input while typing.)
if (!formatter.validate($scope.textValue) if (!formatter.validate($scope.textValue) ||
|| formatter.parse($scope.textValue) !== value) { formatter.parse($scope.textValue) !== value) {
$scope.textValue = formatter.format(value); $scope.textValue = formatter.format(value);
$scope.textInvalid = false; $scope.textInvalid = false;
$scope.lastValidValue = $scope.textValue; $scope.lastValidValue = $scope.textValue;
} }
$scope.pickerModel = { value: value }; $scope.pickerModel = { value: value };
} }

View File

@ -35,7 +35,6 @@ define(
while (arr.length < 60) { while (arr.length < 60) {
arr.push(arr.length); arr.push(arr.length);
} }
return { return {
hours: arr.slice(0, 24), hours: arr.slice(0, 24),
minutes: arr, minutes: arr,
@ -71,10 +70,7 @@ define(
interacted = false; interacted = false;
function generateTable() { function generateTable() {
var m = moment.utc({ var m = moment.utc({ year: year, month: month }).day(0),
year: year,
month: month
}).day(0),
table = [], table = [],
row, row,
col; col;
@ -146,10 +142,9 @@ define(
$scope.isSelected = function (cell) { $scope.isSelected = function (cell) {
var date = $scope.date || {}; var date = $scope.date || {};
return cell.day === date.day &&
return cell.day === date.day cell.month === date.month &&
&& cell.month === date.month cell.year === date.year;
&& cell.year === date.year;
}; };
$scope.select = function (cell) { $scope.select = function (cell) {
@ -161,9 +156,9 @@ define(
}; };
$scope.dateEquals = function (d1, d2) { $scope.dateEquals = function (d1, d2) {
return d1.year === d2.year return d1.year === d2.year &&
&& d1.month === d2.month d1.month === d2.month &&
&& d1.day === d2.day; d1.day === d2.day;
}; };
$scope.changeMonth = function (delta) { $scope.changeMonth = function (delta) {
@ -172,12 +167,10 @@ define(
month = 0; month = 0;
year += 1; year += 1;
} }
if (month < 0) { if (month < 0) {
month = 11; month = 11;
year -= 1; year -= 1;
} }
interacted = true; interacted = true;
updateScopeForMonth(); updateScopeForMonth();
}; };
@ -194,8 +187,8 @@ define(
// Ensure some useful default // Ensure some useful default
$scope.ngModel[$scope.field] = $scope.ngModel[$scope.field] =
$scope.ngModel[$scope.field] === undefined $scope.ngModel[$scope.field] === undefined ?
? now() : $scope.ngModel[$scope.field]; now() : $scope.ngModel[$scope.field];
$scope.$watch('ngModel[field]', updateFromModel); $scope.$watch('ngModel[field]', updateFromModel);
$scope.$watchCollection('date', updateFromView); $scope.$watchCollection('date', updateFromView);

View File

@ -44,12 +44,12 @@ define(
currentParent, currentParent,
parents = []; parents = [];
currentParent = currentObj currentParent = currentObj &&
&& currentObj.hasCapability('context') currentObj.hasCapability('context') &&
&& currentObj.getCapability('context').getParent(); currentObj.getCapability('context').getParent();
while (currentParent && currentParent.getModel().type !== 'root' while (currentParent && currentParent.getModel().type !== 'root' &&
&& currentParent.hasCapability('context')) { currentParent.hasCapability('context')) {
// Record this object // Record this object
parents.unshift(currentParent); parents.unshift(currentParent);
@ -87,16 +87,16 @@ define(
// Gets the metadata for the selected object // Gets the metadata for the selected object
function getMetadata() { function getMetadata() {
$scope.metadata = $scope.domainObject $scope.metadata = $scope.domainObject &&
&& $scope.domainObject.hasCapability('metadata') $scope.domainObject.hasCapability('metadata') &&
&& $scope.domainObject.useCapability('metadata'); $scope.domainObject.useCapability('metadata');
} }
// Set scope variables when the selected object changes // Set scope variables when the selected object changes
$scope.$watch('domainObject', function () { $scope.$watch('domainObject', function () {
$scope.isLink = $scope.domainObject $scope.isLink = $scope.domainObject &&
&& $scope.domainObject.hasCapability('location') $scope.domainObject.hasCapability('location') &&
&& $scope.domainObject.getCapability('location').isLink(); $scope.domainObject.getCapability('location').isLink();
if ($scope.isLink) { if ($scope.isLink) {
getPrimaryPath(); getPrimaryPath();
@ -113,7 +113,6 @@ define(
var unlisten = mutation.listen(getMetadata); var unlisten = mutation.listen(getMetadata);
$scope.$on('$destroy', unlisten); $scope.$on('$destroy', unlisten);
} }
return ObjectInspectorController; return ObjectInspectorController;
} }
); );

Some files were not shown because too many files have changed in this diff Show More