Compare commits
107 Commits
angular-up
...
eslint-one
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c70ac9759c | ||
|
|
d9baa94970 | ||
|
|
afeb89a51a | ||
|
|
07992f0b2a | ||
|
|
a5c4508578 | ||
|
|
a4fab3ce8a | ||
|
|
97d80f57cc | ||
|
|
10241ee87d | ||
|
|
46d4ecc497 | ||
|
|
41138a1731 | ||
|
|
a54a2f8f84 | ||
|
|
5bbe710552 | ||
|
|
f2d34d7c33 | ||
|
|
8fa1770885 | ||
|
|
7221dc1ac6 | ||
|
|
25bb9939d6 | ||
|
|
e7e12504f2 | ||
|
|
63bf856d89 | ||
|
|
e3dcd51f8d | ||
|
|
cb63f4eca1 | ||
|
|
3f60c3c0f1 | ||
|
|
16bb22e834 | ||
|
|
b1467548da | ||
|
|
baa7c0bc58 | ||
|
|
73b81e38e7 | ||
|
|
8b088b7a2c | ||
|
|
894da25461 | ||
|
|
d83adec21f | ||
|
|
87d63806b9 | ||
|
|
4512fe960a | ||
|
|
f0e7f8cfc0 | ||
|
|
db597e1e93 | ||
|
|
98db273f5d | ||
|
|
8a6f944655 | ||
|
|
bacad24811 | ||
|
|
8cc58946cf | ||
|
|
3338bc1000 | ||
|
|
80c20b3d05 | ||
|
|
529aa3a2cd | ||
|
|
35062b164a | ||
|
|
976d070402 | ||
|
|
d2161d692c | ||
|
|
aa3aa23b95 | ||
|
|
3fc20995c7 | ||
|
|
0d9558b891 | ||
|
|
b378b6e465 | ||
|
|
c29c3c386f | ||
|
|
3a4c205f55 | ||
|
|
5071328c90 | ||
|
|
04c258ccd3 | ||
|
|
6d37adde0e | ||
|
|
25aad22562 | ||
|
|
6e3e7a50d7 | ||
|
|
9ceb3c5b1e | ||
|
|
cfcfb31193 | ||
|
|
db0d5bd974 | ||
|
|
01407ffbe2 | ||
|
|
26d3fce0c8 | ||
|
|
539e0773f8 | ||
|
|
4d34fad8db | ||
|
|
bfea0e89e6 | ||
|
|
8e04a9c550 | ||
|
|
bee3a9eedf | ||
|
|
e515d19acd | ||
|
|
dd13efe065 | ||
|
|
b5dfbe268c | ||
|
|
a9b9107cc3 | ||
|
|
cfda4e4214 | ||
|
|
0a657de4b2 | ||
|
|
8153edb9cb | ||
|
|
22ca339fb9 | ||
|
|
7f8764560b | ||
|
|
4411bb0a2d | ||
|
|
4ecd264d93 | ||
|
|
e6cd94123c | ||
|
|
1be7927303 | ||
|
|
16677c99c9 | ||
|
|
6ab468086a | ||
|
|
9d2991ee10 | ||
|
|
dadb6120c2 | ||
|
|
d9a94db59d | ||
|
|
6dd8d448df | ||
|
|
ef2db1edaf | ||
|
|
3748927e87 | ||
|
|
7e4aac028b | ||
|
|
8e54b8a819 | ||
|
|
9e5eddec9b | ||
|
|
c46e4c5dad | ||
|
|
f0dc928230 | ||
|
|
6f674930d9 | ||
|
|
8675fc3fa6 | ||
|
|
25434342f3 | ||
|
|
8044dfe726 | ||
|
|
cd6c7fdc5e | ||
|
|
7ff85dc396 | ||
|
|
fb4877924a | ||
|
|
4b13cbdb33 | ||
|
|
51c9328dfd | ||
|
|
31ac67b393 | ||
|
|
0399766ccd | ||
|
|
18ab034147 | ||
|
|
8a4bc2a463 | ||
|
|
e9cf337aac | ||
|
|
04a18248c7 | ||
|
|
d462db60de | ||
|
|
8962b0c88b | ||
|
|
3876151a4b |
@@ -120,6 +120,8 @@ module.exports = {
|
|||||||
"no-useless-computed-key": "error",
|
"no-useless-computed-key": "error",
|
||||||
// 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/one-var
|
||||||
|
"one-var": ["error", "never"],
|
||||||
|
|
||||||
"vue/html-indent": [
|
"vue/html-indent": [
|
||||||
"error",
|
"error",
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -37,4 +37,7 @@ protractor/logs
|
|||||||
# npm-debug log
|
# npm-debug log
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
|
# karma reports
|
||||||
|
report.*.json
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|||||||
@@ -226,9 +226,9 @@ typically from the author of the change and its reviewer.
|
|||||||
Automated testing shall occur whenever changes are merged into the main
|
Automated testing shall occur whenever changes are merged into the main
|
||||||
development branch and must be confirmed alongside any pull request.
|
development branch and must be confirmed alongside any pull request.
|
||||||
|
|
||||||
Automated tests are typically unit tests which exercise individual software
|
Automated tests are tests which exercise plugins, API, and utility classes.
|
||||||
components. Tests are subject to code review along with the actual
|
Tests are subject to code review along with the actual implementation, to
|
||||||
implementation, to ensure that tests are applicable and useful.
|
ensure that tests are applicable and useful.
|
||||||
|
|
||||||
Examples of useful tests:
|
Examples of useful tests:
|
||||||
* Tests which replicate bugs (or their root causes) to verify their
|
* Tests which replicate bugs (or their root causes) to verify their
|
||||||
@@ -238,8 +238,26 @@ Examples of useful tests:
|
|||||||
* Tests which verify expected interactions with other components in the
|
* Tests which verify expected interactions with other components in the
|
||||||
system.
|
system.
|
||||||
|
|
||||||
During automated testing, code coverage metrics will be reported. Line
|
#### Guidelines
|
||||||
coverage must remain at or above 80%.
|
* 100% statement coverage is achievable and desirable.
|
||||||
|
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
|
||||||
|
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
||||||
|
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
||||||
|
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
||||||
|
* Where builtin functions have been mocked, be sure to clear them between tests.
|
||||||
|
* Test at an appropriate level of isolation. Eg.
|
||||||
|
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
||||||
|
* You do not need to test that the view switcher works, there should be separate tests for that.
|
||||||
|
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
||||||
|
* Use your best judgement when deciding on appropriate scope.
|
||||||
|
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
||||||
|
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
||||||
|
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
||||||
|
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
||||||
|
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
||||||
|
|
||||||
### Commit Message Standards
|
### Commit Message Standards
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Open MCT License
|
# Open MCT License
|
||||||
|
|
||||||
Open MCT, Copyright (c) 2014-2019, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
Open MCT, Copyright (c) 2014-2020, 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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ define(
|
|||||||
|
|
||||||
function EventTelemetry(request, interval) {
|
function EventTelemetry(request, interval) {
|
||||||
|
|
||||||
var latestObservedTime = Date.now(),
|
var latestObservedTime = Date.now();
|
||||||
count = Math.floor((latestObservedTime - firstObservedTime) / interval),
|
var count = Math.floor((latestObservedTime - firstObservedTime) / interval);
|
||||||
generatorData = {};
|
var generatorData = {};
|
||||||
|
|
||||||
generatorData.getPointCount = function () {
|
generatorData.getPointCount = function () {
|
||||||
return count;
|
return count;
|
||||||
@@ -49,8 +49,8 @@ define(
|
|||||||
};
|
};
|
||||||
|
|
||||||
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;
|
var ind = i % messages.length;
|
||||||
return messages[ind] + " - [" + domainDelta.toString() + "]";
|
return messages[ind] + " - [" + domainDelta.toString() + "]";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function EventTelemetryProvider($q, $timeout) {
|
function EventTelemetryProvider($q, $timeout) {
|
||||||
var subscriptions = [],
|
var subscriptions = [];
|
||||||
genInterval = 1000,
|
var genInterval = 1000;
|
||||||
generating = false;
|
var generating = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
function matchesSource(request) {
|
function matchesSource(request) {
|
||||||
|
|||||||
@@ -40,23 +40,23 @@ define([], function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExportTelemetryAsCSVAction.prototype.perform = function () {
|
ExportTelemetryAsCSVAction.prototype.perform = function () {
|
||||||
var context = this.context,
|
var context = this.context;
|
||||||
domainObject = context.domainObject,
|
var domainObject = context.domainObject;
|
||||||
telemetry = domainObject.getCapability("telemetry"),
|
var telemetry = domainObject.getCapability("telemetry");
|
||||||
metadata = telemetry.getMetadata(),
|
var metadata = telemetry.getMetadata();
|
||||||
domains = metadata.domains,
|
var domains = metadata.domains;
|
||||||
ranges = metadata.ranges,
|
var ranges = metadata.ranges;
|
||||||
exportService = this.exportService;
|
var exportService = this.exportService;
|
||||||
|
|
||||||
function getName(domainOrRange) {
|
function getName(domainOrRange) {
|
||||||
return domainOrRange.name;
|
return domainOrRange.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
telemetry.requestData({}).then(function (series) {
|
telemetry.requestData({}).then(function (series) {
|
||||||
var headers = domains.map(getName).concat(ranges.map(getName)),
|
var headers = domains.map(getName).concat(ranges.map(getName));
|
||||||
rows = [],
|
var rows = [];
|
||||||
row,
|
var row;
|
||||||
i;
|
var i;
|
||||||
|
|
||||||
function copyDomainsToRow(telemetryRow, index) {
|
function copyDomainsToRow(telemetryRow, index) {
|
||||||
domains.forEach(function (domain) {
|
domains.forEach(function (domain) {
|
||||||
|
|||||||
@@ -28,6 +28,16 @@ define([
|
|||||||
domain: 2
|
domain: 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// Need to enable "LocalTimeSystem" plugin to make use of this
|
||||||
|
// {
|
||||||
|
// key: "local",
|
||||||
|
// name: "Time",
|
||||||
|
// format: "local-format",
|
||||||
|
// source: "utc",
|
||||||
|
// hints: {
|
||||||
|
// domain: 3
|
||||||
|
// }
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
key: "sin",
|
key: "sin",
|
||||||
name: "Sine",
|
name: "Sine",
|
||||||
@@ -61,6 +71,15 @@ define([
|
|||||||
domain: 1
|
domain: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "local",
|
||||||
|
name: "Time",
|
||||||
|
format: "utc",
|
||||||
|
source: "utc",
|
||||||
|
hints: {
|
||||||
|
domain: 2
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "state",
|
key: "state",
|
||||||
source: "value",
|
source: "value",
|
||||||
|
|||||||
@@ -28,39 +28,39 @@ define([
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
var RED = {
|
var RED = {
|
||||||
sin: 0.9,
|
sin: 0.9,
|
||||||
cos: 0.9
|
cos: 0.9
|
||||||
|
};
|
||||||
|
var YELLOW = {
|
||||||
|
sin: 0.5,
|
||||||
|
cos: 0.5
|
||||||
|
};
|
||||||
|
var LIMITS = {
|
||||||
|
rh: {
|
||||||
|
cssClass: "is-limit--upr is-limit--red",
|
||||||
|
low: RED,
|
||||||
|
high: Number.POSITIVE_INFINITY,
|
||||||
|
name: "Red High"
|
||||||
},
|
},
|
||||||
YELLOW = {
|
rl: {
|
||||||
sin: 0.5,
|
cssClass: "is-limit--lwr is-limit--red",
|
||||||
cos: 0.5
|
high: -RED,
|
||||||
|
low: Number.NEGATIVE_INFINITY,
|
||||||
|
name: "Red Low"
|
||||||
},
|
},
|
||||||
LIMITS = {
|
yh: {
|
||||||
rh: {
|
cssClass: "is-limit--upr is-limit--yellow",
|
||||||
cssClass: "is-limit--upr is-limit--red",
|
low: YELLOW,
|
||||||
low: RED,
|
high: RED,
|
||||||
high: Number.POSITIVE_INFINITY,
|
name: "Yellow High"
|
||||||
name: "Red High"
|
},
|
||||||
},
|
yl: {
|
||||||
rl: {
|
cssClass: "is-limit--lwr is-limit--yellow",
|
||||||
cssClass: "is-limit--lwr is-limit--red",
|
low: -RED,
|
||||||
high: -RED,
|
high: -YELLOW,
|
||||||
low: Number.NEGATIVE_INFINITY,
|
name: "Yellow Low"
|
||||||
name: "Red Low"
|
}
|
||||||
},
|
};
|
||||||
yh: {
|
|
||||||
cssClass: "is-limit--upr is-limit--yellow",
|
|
||||||
low: YELLOW,
|
|
||||||
high: RED,
|
|
||||||
name: "Yellow High"
|
|
||||||
},
|
|
||||||
yl: {
|
|
||||||
cssClass: "is-limit--lwr is-limit--yellow",
|
|
||||||
low: -RED,
|
|
||||||
high: -YELLOW,
|
|
||||||
name: "Yellow Low"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function SinewaveLimitProvider() {
|
function SinewaveLimitProvider() {
|
||||||
|
|
||||||
|
|||||||
@@ -25,24 +25,24 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var DEFAULT_IDENTITY = { key: "user", name: "Example User" },
|
var DEFAULT_IDENTITY = { key: "user", name: "Example User" };
|
||||||
DIALOG_STRUCTURE = {
|
var DIALOG_STRUCTURE = {
|
||||||
name: "Identify Yourself",
|
name: "Identify Yourself",
|
||||||
sections: [{ rows: [
|
sections: [{ rows: [
|
||||||
{
|
{
|
||||||
name: "User ID",
|
name: "User ID",
|
||||||
control: "textfield",
|
control: "textfield",
|
||||||
key: "key",
|
key: "key",
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Human name",
|
name: "Human name",
|
||||||
control: "textfield",
|
control: "textfield",
|
||||||
key: "name",
|
key: "name",
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
]}]
|
]}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var PREFIX = "msl_tlm:",
|
var PREFIX = "msl_tlm:";
|
||||||
FORMAT_MAPPINGS = {
|
var FORMAT_MAPPINGS = {
|
||||||
float: "number",
|
float: "number",
|
||||||
integer: "number",
|
integer: "number",
|
||||||
string: "string"
|
string: "string"
|
||||||
};
|
};
|
||||||
|
|
||||||
function RemsTelemetryModelProvider(adapter) {
|
function RemsTelemetryModelProvider(adapter) {
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addInstrument(subsystem, spacecraftId) {
|
function addInstrument(subsystem, spacecraftId) {
|
||||||
var measurements = (subsystem.measurements || []),
|
var measurements = (subsystem.measurements || []);
|
||||||
instrumentId = makeId(subsystem);
|
var instrumentId = makeId(subsystem);
|
||||||
|
|
||||||
models[instrumentId] = {
|
models[instrumentId] = {
|
||||||
type: "msl.instrument",
|
type: "msl.instrument",
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ define (
|
|||||||
* object that wraps the telemetry returned from the telemetry source.
|
* object that wraps the telemetry returned from the telemetry source.
|
||||||
*/
|
*/
|
||||||
RemsTelemetryProvider.prototype.requestTelemetry = function (requests) {
|
RemsTelemetryProvider.prototype.requestTelemetry = function (requests) {
|
||||||
var packaged = {},
|
var packaged = {};
|
||||||
relevantReqs,
|
var relevantReqs;
|
||||||
adapter = this.adapter;
|
var adapter = this.adapter;
|
||||||
|
|
||||||
function matchesSource(request) {
|
function matchesSource(request) {
|
||||||
return (request.source === SOURCE);
|
return (request.source === SOURCE);
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ define(
|
|||||||
function (MSLDataDictionary, module) {
|
function (MSLDataDictionary, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var TERRESTRIAL_DATE = "terrestrial_date",
|
var TERRESTRIAL_DATE = "terrestrial_date";
|
||||||
LOCAL_DATA = "../data/rems.json";
|
var LOCAL_DATA = "../data/rems.json";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches historical data from the REMS instrument on the Curiosity
|
* Fetches historical data from the REMS instrument on the Curiosity
|
||||||
@@ -69,8 +69,8 @@ define(
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
|
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
|
||||||
var self = this,
|
var self = this;
|
||||||
id = request.key;
|
var id = request.key;
|
||||||
|
|
||||||
var dataTransforms = this.dataTransforms;
|
var dataTransforms = this.dataTransforms;
|
||||||
|
|
||||||
|
|||||||
@@ -44,31 +44,31 @@ define(
|
|||||||
periodically with the progress of an ongoing process.
|
periodically with the progress of an ongoing process.
|
||||||
*/
|
*/
|
||||||
$scope.launchProgress = function (knownProgress) {
|
$scope.launchProgress = function (knownProgress) {
|
||||||
var dialog,
|
var dialog;
|
||||||
model = {
|
var model = {
|
||||||
title: "Progress Dialog Example",
|
title: "Progress Dialog Example",
|
||||||
progress: 0,
|
progress: 0,
|
||||||
hint: "Do not navigate away from this page or close this browser tab while this operation is in progress.",
|
hint: "Do not navigate away from this page or close this browser tab while this operation is in progress.",
|
||||||
actionText: "Calculating...",
|
actionText: "Calculating...",
|
||||||
unknownProgress: !knownProgress,
|
unknownProgress: !knownProgress,
|
||||||
unknownDuration: false,
|
unknownDuration: false,
|
||||||
severity: "info",
|
severity: "info",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "Cancel Operation",
|
label: "Cancel Operation",
|
||||||
callback: function () {
|
callback: function () {
|
||||||
$log.debug("Operation cancelled");
|
$log.debug("Operation cancelled");
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Do something else...",
|
|
||||||
callback: function () {
|
|
||||||
$log.debug("Something else pressed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
};
|
{
|
||||||
|
label: "Do something else...",
|
||||||
|
callback: function () {
|
||||||
|
$log.debug("Something else pressed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
function incrementProgress() {
|
function incrementProgress() {
|
||||||
model.progress = Math.min(100, Math.floor(model.progress + Math.random() * 30));
|
model.progress = Math.min(100, Math.floor(model.progress + Math.random() * 30));
|
||||||
@@ -96,28 +96,28 @@ define(
|
|||||||
Demonstrates launching an error dialog
|
Demonstrates launching an error dialog
|
||||||
*/
|
*/
|
||||||
$scope.launchError = function () {
|
$scope.launchError = function () {
|
||||||
var dialog,
|
var dialog;
|
||||||
model = {
|
var model = {
|
||||||
title: "Error Dialog Example",
|
title: "Error Dialog Example",
|
||||||
actionText: "Something happened, and it was not good.",
|
actionText: "Something happened, and it was not good.",
|
||||||
severity: "error",
|
severity: "error",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "Try Again",
|
label: "Try Again",
|
||||||
callback: function () {
|
callback: function () {
|
||||||
$log.debug("Try Again Pressed");
|
$log.debug("Try Again Pressed");
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Cancel",
|
|
||||||
callback: function () {
|
|
||||||
$log.debug("Cancel Pressed");
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
};
|
{
|
||||||
|
label: "Cancel",
|
||||||
|
callback: function () {
|
||||||
|
$log.debug("Cancel Pressed");
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
dialog = dialogService.showBlockingMessage(model);
|
dialog = dialogService.showBlockingMessage(model);
|
||||||
|
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
@@ -129,21 +129,21 @@ define(
|
|||||||
Demonstrates launching an error dialog
|
Demonstrates launching an error dialog
|
||||||
*/
|
*/
|
||||||
$scope.launchInfo = function () {
|
$scope.launchInfo = function () {
|
||||||
var dialog,
|
var dialog;
|
||||||
model = {
|
var 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",
|
||||||
callback: function () {
|
callback: function () {
|
||||||
$log.debug("OK Pressed");
|
$log.debug("OK Pressed");
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
dialog = dialogService.showBlockingMessage(model);
|
dialog = dialogService.showBlockingMessage(model);
|
||||||
|
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ define(
|
|||||||
|
|
||||||
|
|
||||||
function BrowserPersistenceProvider($q, SPACE) {
|
function BrowserPersistenceProvider($q, SPACE) {
|
||||||
var spaces = SPACE ? [SPACE] : [],
|
var spaces = SPACE ? [SPACE] : [];
|
||||||
caches = {},
|
var caches = {};
|
||||||
promises = {
|
var promises = {
|
||||||
as: function (value) {
|
as: function (value) {
|
||||||
return $q.when(value);
|
return $q.when(value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
spaces.forEach(function (space) {
|
spaces.forEach(function (space) {
|
||||||
caches[space] = {};
|
caches[space] = {};
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ define(
|
|||||||
* "foo."
|
* "foo."
|
||||||
*/
|
*/
|
||||||
allow: function (action, context) {
|
allow: function (action, context) {
|
||||||
var domainObject = (context || {}).domainObject,
|
var domainObject = (context || {}).domainObject;
|
||||||
model = (domainObject && domainObject.getModel()) || {},
|
var model = (domainObject && domainObject.getModel()) || {};
|
||||||
name = model.name || "",
|
var name = model.name || "";
|
||||||
metadata = action.getMetadata() || {};
|
var metadata = action.getMetadata() || {};
|
||||||
return metadata.key !== 'remove' || name.indexOf('foo') < 0;
|
return metadata.key !== 'remove' || name.indexOf('foo') < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ define(
|
|||||||
* @implements {Indicator}
|
* @implements {Indicator}
|
||||||
*/
|
*/
|
||||||
function DigestIndicator($interval, $rootScope) {
|
function DigestIndicator($interval, $rootScope) {
|
||||||
var digests = 0,
|
var digests = 0;
|
||||||
displayed = 0,
|
var displayed = 0;
|
||||||
start = Date.now();
|
var start = Date.now();
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
var now = Date.now(),
|
var now = Date.now();
|
||||||
secs = (now - start) / 1000;
|
var secs = (now - start) / 1000;
|
||||||
displayed = Math.round(digests / secs);
|
displayed = Math.round(digests / secs);
|
||||||
start = now;
|
start = now;
|
||||||
digests = 0;
|
digests = 0;
|
||||||
|
|||||||
45
index.html
45
index.html
@@ -34,8 +34,8 @@
|
|||||||
<body>
|
<body>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
const FIVE_MINUTES = 5 * 60 * 1000;
|
const THIRTY_SECONDS = 30 * 1000;
|
||||||
const THIRTY_MINUTES = 30 * 60 * 1000;
|
const THIRTY_MINUTES = THIRTY_SECONDS * 60;
|
||||||
|
|
||||||
[
|
[
|
||||||
'example/eventGenerator'
|
'example/eventGenerator'
|
||||||
@@ -63,7 +63,39 @@
|
|||||||
bounds: {
|
bounds: {
|
||||||
start: Date.now() - THIRTY_MINUTES,
|
start: Date.now() - THIRTY_MINUTES,
|
||||||
end: Date.now()
|
end: Date.now()
|
||||||
}
|
},
|
||||||
|
// commonly used bounds can be stored in history
|
||||||
|
// bounds (start and end) can accept either a milliseconds number
|
||||||
|
// or a callback function returning a milliseconds number
|
||||||
|
// a function is useful for invoking Date.now() at exact moment of preset selection
|
||||||
|
presets: [
|
||||||
|
{
|
||||||
|
label: 'Last Day',
|
||||||
|
bounds: {
|
||||||
|
start: () => Date.now() - 1000 * 60 * 60 * 24,
|
||||||
|
end: () => Date.now()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Last 2 hours',
|
||||||
|
bounds: {
|
||||||
|
start: () => Date.now() - 1000 * 60 * 60 * 2,
|
||||||
|
end: () => Date.now()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Last hour',
|
||||||
|
bounds: {
|
||||||
|
start: () => Date.now() - 1000 * 60 * 60,
|
||||||
|
end: () => Date.now()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// maximum recent bounds to retain in conductor history
|
||||||
|
records: 10,
|
||||||
|
// maximum duration between start and end bounds
|
||||||
|
// for utc-based time systems this is in milliseconds
|
||||||
|
limit: 1000 * 60 * 60 * 24
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Realtime",
|
name: "Realtime",
|
||||||
@@ -71,7 +103,7 @@
|
|||||||
clock: 'local',
|
clock: 'local',
|
||||||
clockOffsets: {
|
clockOffsets: {
|
||||||
start: - THIRTY_MINUTES,
|
start: - THIRTY_MINUTES,
|
||||||
end: FIVE_MINUTES
|
end: THIRTY_SECONDS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -81,7 +113,10 @@
|
|||||||
openmct.install(openmct.plugins.LADTable());
|
openmct.install(openmct.plugins.LADTable());
|
||||||
openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay']));
|
openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay']));
|
||||||
openmct.install(openmct.plugins.ObjectMigration());
|
openmct.install(openmct.plugins.ObjectMigration());
|
||||||
openmct.install(openmct.plugins.ClearData(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));
|
openmct.install(openmct.plugins.ClearData(
|
||||||
|
['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked'],
|
||||||
|
{indicator: true}
|
||||||
|
));
|
||||||
openmct.start();
|
openmct.start();
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
/*global module,process*/
|
/*global module,process*/
|
||||||
|
|
||||||
const devMode = process.env.NODE_ENV !== 'production';
|
const devMode = process.env.NODE_ENV !== 'production';
|
||||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'ChromeHeadless'];
|
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'FirefoxHeadless'];
|
||||||
const coverageEnabled = process.env.COVERAGE === 'true';
|
const coverageEnabled = process.env.COVERAGE === 'true';
|
||||||
const reporters = ['progress', 'html'];
|
const reporters = ['progress', 'html'];
|
||||||
|
|
||||||
@@ -95,6 +95,7 @@ module.exports = (config) => {
|
|||||||
stats: 'errors-only',
|
stats: 'errors-only',
|
||||||
logLevel: 'warn'
|
logLevel: 'warn'
|
||||||
},
|
},
|
||||||
singleRun: true
|
singleRun: true,
|
||||||
|
browserNoActivityTimeout: 90000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "The Open MCT core platform",
|
"description": "The Open MCT core platform",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"angular": "1.7.9",
|
"angular": ">=1.8.0",
|
||||||
"angular-route": "1.4.14",
|
"angular-route": "1.4.14",
|
||||||
"babel-eslint": "8.2.6",
|
"babel-eslint": "8.2.6",
|
||||||
"comma-separated-values": "^3.6.4",
|
"comma-separated-values": "^3.6.4",
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
"jsdoc": "^3.3.2",
|
"jsdoc": "^3.3.2",
|
||||||
"karma": "^2.0.3",
|
"karma": "^2.0.3",
|
||||||
"karma-chrome-launcher": "^2.2.0",
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
|
"karma-firefox-launcher": "^1.3.0",
|
||||||
"karma-cli": "^1.0.1",
|
"karma-cli": "^1.0.1",
|
||||||
"karma-coverage": "^1.1.2",
|
"karma-coverage": "^1.1.2",
|
||||||
"karma-coverage-istanbul-reporter": "^2.1.1",
|
"karma-coverage-istanbul-reporter": "^2.1.1",
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
"moment-timezone": "0.5.28",
|
"moment-timezone": "0.5.28",
|
||||||
"node-bourbon": "^4.2.3",
|
"node-bourbon": "^4.2.3",
|
||||||
"node-sass": "^4.9.2",
|
"node-sass": "^4.9.2",
|
||||||
"painterro": "^0.2.65",
|
"painterro": "^1.0.35",
|
||||||
"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",
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ define(
|
|||||||
function (AboutController) {
|
function (AboutController) {
|
||||||
|
|
||||||
describe("The About controller", function () {
|
describe("The About controller", function () {
|
||||||
var testVersions,
|
var testVersions;
|
||||||
mockWindow,
|
var mockWindow;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
testVersions = [
|
testVersions = [
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ define(
|
|||||||
function (LicenseController) {
|
function (LicenseController) {
|
||||||
|
|
||||||
describe("The License controller", function () {
|
describe("The License controller", function () {
|
||||||
var testLicenses,
|
var testLicenses;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
testLicenses = [
|
testLicenses = [
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ define(
|
|||||||
function (LogoController) {
|
function (LogoController) {
|
||||||
|
|
||||||
describe("The About controller", function () {
|
describe("The About controller", function () {
|
||||||
var mockOverlayService,
|
var mockOverlayService;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockOverlayService = jasmine.createSpyObj(
|
mockOverlayService = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ define([
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
describe("The navigate action", function () {
|
describe("The navigate action", function () {
|
||||||
var mockNavigationService,
|
var mockNavigationService;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockNavigationService = jasmine.createSpyObj(
|
mockNavigationService = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ define(
|
|||||||
function (NavigationService) {
|
function (NavigationService) {
|
||||||
|
|
||||||
describe("The navigation service", function () {
|
describe("The navigation service", function () {
|
||||||
var $window,
|
let $window;
|
||||||
navigationService;
|
let navigationService;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
$window = jasmine.createSpyObj('$window', ['confirm']);
|
$window = jasmine.createSpyObj('$window', ['confirm']);
|
||||||
@@ -37,8 +37,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("stores navigation state", function () {
|
it("stores navigation state", function () {
|
||||||
var testObject = { someKey: 42 },
|
var testObject = { someKey: 42 };
|
||||||
otherObject = { someKey: "some value" };
|
var otherObject = { someKey: "some value" };
|
||||||
expect(navigationService.getNavigation())
|
expect(navigationService.getNavigation())
|
||||||
.toBeUndefined();
|
.toBeUndefined();
|
||||||
navigationService.setNavigation(testObject);
|
navigationService.setNavigation(testObject);
|
||||||
@@ -52,8 +52,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("notifies listeners on change", function () {
|
it("notifies listeners on change", function () {
|
||||||
var testObject = { someKey: 42 },
|
var testObject = { someKey: 42 };
|
||||||
callback = jasmine.createSpy("callback");
|
var callback = jasmine.createSpy("callback");
|
||||||
|
|
||||||
navigationService.addListener(callback);
|
navigationService.addListener(callback);
|
||||||
expect(callback).not.toHaveBeenCalled();
|
expect(callback).not.toHaveBeenCalled();
|
||||||
@@ -63,8 +63,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("does not notify listeners when no changes occur", function () {
|
it("does not notify listeners when no changes occur", function () {
|
||||||
var testObject = { someKey: 42 },
|
var testObject = { someKey: 42 };
|
||||||
callback = jasmine.createSpy("callback");
|
var callback = jasmine.createSpy("callback");
|
||||||
|
|
||||||
navigationService.addListener(callback);
|
navigationService.addListener(callback);
|
||||||
navigationService.setNavigation(testObject);
|
navigationService.setNavigation(testObject);
|
||||||
@@ -73,8 +73,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("stops notifying listeners after removal", function () {
|
it("stops notifying listeners after removal", function () {
|
||||||
var testObject = { someKey: 42 },
|
var testObject = { someKey: 42 };
|
||||||
callback = jasmine.createSpy("callback");
|
var callback = jasmine.createSpy("callback");
|
||||||
|
|
||||||
navigationService.addListener(callback);
|
navigationService.addListener(callback);
|
||||||
navigationService.removeListener(callback);
|
navigationService.removeListener(callback);
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ define([
|
|||||||
'../../src/navigation/OrphanNavigationHandler'
|
'../../src/navigation/OrphanNavigationHandler'
|
||||||
], function (OrphanNavigationHandler) {
|
], function (OrphanNavigationHandler) {
|
||||||
describe("OrphanNavigationHandler", function () {
|
describe("OrphanNavigationHandler", function () {
|
||||||
var mockTopic,
|
var mockTopic;
|
||||||
mockThrottle,
|
var mockThrottle;
|
||||||
mockMutationTopic,
|
var mockMutationTopic;
|
||||||
mockNavigationService,
|
var mockNavigationService;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
mockParentObject,
|
var mockParentObject;
|
||||||
mockContext,
|
var mockContext;
|
||||||
mockActionCapability,
|
var mockActionCapability;
|
||||||
mockEditor,
|
var mockEditor;
|
||||||
testParentComposition,
|
var testParentComposition;
|
||||||
testId,
|
var testId;
|
||||||
mockThrottledFns;
|
var mockThrottledFns;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
testId = 'some-identifier';
|
testId = 'some-identifier';
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ define(
|
|||||||
function (NewTabAction) {
|
function (NewTabAction) {
|
||||||
|
|
||||||
describe("The new tab action", function () {
|
describe("The new tab action", function () {
|
||||||
var actionSelected,
|
var actionSelected;
|
||||||
actionCurrent,
|
var actionCurrent;
|
||||||
mockWindow,
|
var mockWindow;
|
||||||
mockContextCurrent,
|
var mockContextCurrent;
|
||||||
mockContextSelected,
|
var mockContextSelected;
|
||||||
mockUrlService;
|
var mockUrlService;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockWindow = jasmine.createSpyObj("$window", ["open", "location"]);
|
mockWindow = jasmine.createSpyObj("$window", ["open", "location"]);
|
||||||
|
|||||||
@@ -31,13 +31,13 @@
|
|||||||
</mct-form>
|
</mct-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="c-overlay__button-bar">
|
<div class="c-overlay__button-bar">
|
||||||
<a class='c-button c-button--major'
|
<button 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
|
||||||
</a>
|
</button>
|
||||||
<a class='c-button '
|
<button class='c-button '
|
||||||
ng-click="ngModel.cancel()">
|
ng-click="ngModel.cancel()">
|
||||||
Cancel
|
Cancel
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,13 +31,13 @@
|
|||||||
</mct-include>
|
</mct-include>
|
||||||
</div>
|
</div>
|
||||||
<div class="c-overlay__button-bar">
|
<div class="c-overlay__button-bar">
|
||||||
<a ng-repeat="option in ngModel.dialog.options"
|
<button 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}}
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</mct-container>
|
</mct-container>
|
||||||
|
|||||||
@@ -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-in-circle"></button>
|
class="c-click-icon c-overlay__close-button icon-x"></button>
|
||||||
<div class="c-overlay__contents" ng-transclude></div>
|
<div class="c-overlay__contents" ng-transclude></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ define(
|
|||||||
DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) {
|
DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) {
|
||||||
// We will return this result as a promise, because user
|
// We will return this result as a promise, because user
|
||||||
// input is asynchronous.
|
// input is asynchronous.
|
||||||
var deferred = this.$q.defer(),
|
var deferred = this.$q.defer();
|
||||||
self = this,
|
var self = this;
|
||||||
overlay,
|
var overlay;
|
||||||
handleEscKeydown;
|
var handleEscKeydown;
|
||||||
|
|
||||||
// Confirm function; this will be passed in to the
|
// Confirm function; this will be passed in to the
|
||||||
// overlay-dialog template and associated with a
|
// overlay-dialog template and associated with a
|
||||||
@@ -247,12 +247,12 @@ define(
|
|||||||
if (this.canShowDialog(dialogModel)) {
|
if (this.canShowDialog(dialogModel)) {
|
||||||
// Add the overlay using the OverlayService, which
|
// Add the overlay using the OverlayService, which
|
||||||
// will handle actual insertion into the DOM
|
// will handle actual insertion into the DOM
|
||||||
var self = this,
|
var self = this;
|
||||||
overlay = this.overlayService.createOverlay(
|
var overlay = this.overlayService.createOverlay(
|
||||||
"overlay-blocking-message",
|
"overlay-blocking-message",
|
||||||
dialogModel,
|
dialogModel,
|
||||||
"t-dialog-sm"
|
"t-dialog-sm"
|
||||||
);
|
);
|
||||||
|
|
||||||
this.activeOverlay = overlay;
|
this.activeOverlay = overlay;
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ define(
|
|||||||
*/
|
*/
|
||||||
OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) {
|
OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) {
|
||||||
// Create a new scope for this overlay
|
// Create a new scope for this overlay
|
||||||
var scope = this.newScope(),
|
var scope = this.newScope();
|
||||||
element;
|
var element;
|
||||||
|
|
||||||
// Stop showing the overlay; additionally, release the scope
|
// Stop showing the overlay; additionally, release the scope
|
||||||
// that it uses.
|
// that it uses.
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ define(
|
|||||||
function (DialogService) {
|
function (DialogService) {
|
||||||
|
|
||||||
describe("The dialog service", function () {
|
describe("The dialog service", function () {
|
||||||
var mockOverlayService,
|
var mockOverlayService;
|
||||||
mockQ,
|
var mockQ;
|
||||||
mockLog,
|
var mockLog;
|
||||||
mockOverlay,
|
var mockOverlay;
|
||||||
mockDeferred,
|
var mockDeferred;
|
||||||
mockDocument,
|
var mockDocument;
|
||||||
mockBody,
|
var mockBody;
|
||||||
dialogService;
|
var dialogService;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockOverlayService = jasmine.createSpyObj(
|
mockOverlayService = jasmine.createSpyObj(
|
||||||
@@ -188,8 +188,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("individual dialogs can be dismissed", function () {
|
it("individual dialogs can be dismissed", function () {
|
||||||
var secondDialogHandle,
|
var secondDialogHandle;
|
||||||
secondMockOverlay;
|
var secondMockOverlay;
|
||||||
|
|
||||||
dialogHandle.dismiss();
|
dialogHandle.dismiss();
|
||||||
|
|
||||||
|
|||||||
@@ -28,15 +28,15 @@ define(
|
|||||||
function (OverlayService) {
|
function (OverlayService) {
|
||||||
|
|
||||||
describe("The overlay service", function () {
|
describe("The overlay service", function () {
|
||||||
var mockDocument,
|
var mockDocument;
|
||||||
mockCompile,
|
var mockCompile;
|
||||||
mockRootScope,
|
var mockRootScope;
|
||||||
mockBody,
|
var mockBody;
|
||||||
mockTemplate,
|
var mockTemplate;
|
||||||
mockElement,
|
var mockElement;
|
||||||
mockScope,
|
var mockScope;
|
||||||
mockTimeout,
|
var mockTimeout;
|
||||||
overlayService;
|
var overlayService;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockDocument = jasmine.createSpyObj("$document", ["find"]);
|
mockDocument = jasmine.createSpyObj("$document", ["find"]);
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ define(
|
|||||||
* will be performed; should contain a `domainObject` property
|
* will be performed; should contain a `domainObject` property
|
||||||
*/
|
*/
|
||||||
EditAction.appliesTo = function (context) {
|
EditAction.appliesTo = function (context) {
|
||||||
var domainObject = (context || {}).domainObject,
|
var domainObject = (context || {}).domainObject;
|
||||||
type = domainObject && domainObject.getCapability('type');
|
var type = domainObject && domainObject.getCapability('type');
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
EditAndComposeAction.prototype.perform = function () {
|
EditAndComposeAction.prototype.perform = function () {
|
||||||
var self = this,
|
var self = this;
|
||||||
editAction = this.domainObject.getCapability('action').getActions("edit")[0];
|
var editAction = this.domainObject.getCapability('action').getActions("edit")[0];
|
||||||
|
|
||||||
// Link these objects
|
// Link these objects
|
||||||
function doLink() {
|
function doLink() {
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
PropertiesAction.prototype.perform = function () {
|
PropertiesAction.prototype.perform = function () {
|
||||||
var type = this.domainObject.getCapability('type'),
|
var type = this.domainObject.getCapability('type');
|
||||||
domainObject = this.domainObject,
|
var domainObject = this.domainObject;
|
||||||
dialogService = this.dialogService;
|
var dialogService = this.dialogService;
|
||||||
|
|
||||||
// Update the domain object model based on user input
|
// Update the domain object model based on user input
|
||||||
function updateModel(userInput, dialog) {
|
function updateModel(userInput, dialog) {
|
||||||
@@ -81,9 +81,14 @@ define(
|
|||||||
* context.
|
* context.
|
||||||
*/
|
*/
|
||||||
PropertiesAction.appliesTo = function (context) {
|
PropertiesAction.appliesTo = function (context) {
|
||||||
var domainObject = (context || {}).domainObject,
|
|
||||||
type = domainObject && domainObject.getCapability('type'),
|
var domainObject = (context || {}).domainObject;
|
||||||
creatable = type && type.hasFeature('creation');
|
var type = domainObject && domainObject.getCapability('type');
|
||||||
|
var creatable = type && type.hasFeature('creation');
|
||||||
|
|
||||||
|
if (domainObject && domainObject.model && domainObject.model.locked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Only allow creatable types to be edited
|
// Only allow creatable types to be edited
|
||||||
return domainObject && creatable;
|
return domainObject && creatable;
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ define(
|
|||||||
* @memberof platform/commonUI/edit.SaveAction#
|
* @memberof platform/commonUI/edit.SaveAction#
|
||||||
*/
|
*/
|
||||||
SaveAction.prototype.perform = function () {
|
SaveAction.prototype.perform = function () {
|
||||||
var self = this,
|
var self = this;
|
||||||
domainObject = this.domainObject,
|
var domainObject = this.domainObject;
|
||||||
dialog = new SaveInProgressDialog(this.dialogService);
|
var dialog = new SaveInProgressDialog(this.dialogService);
|
||||||
|
|
||||||
// Invoke any save behavior introduced by the editor capability;
|
// Invoke any save behavior introduced by the editor capability;
|
||||||
// this is introduced by EditableDomainObject which is
|
// this is introduced by EditableDomainObject which is
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ define(
|
|||||||
* @memberof platform/commonUI/edit.SaveAndStopEditingAction#
|
* @memberof platform/commonUI/edit.SaveAndStopEditingAction#
|
||||||
*/
|
*/
|
||||||
SaveAndStopEditingAction.prototype.perform = function () {
|
SaveAndStopEditingAction.prototype.perform = function () {
|
||||||
var domainObject = this.domainObject,
|
var domainObject = this.domainObject;
|
||||||
saveAction = new SaveAction(this.dialogService, this.notificationService, this.context);
|
var saveAction = new SaveAction(this.dialogService, this.notificationService, this.context);
|
||||||
|
|
||||||
function closeEditor() {
|
function closeEditor() {
|
||||||
return domainObject.getCapability("editor").finish();
|
return domainObject.getCapability("editor").finish();
|
||||||
|
|||||||
@@ -99,11 +99,11 @@ function (
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
SaveAsAction.prototype.save = function () {
|
SaveAsAction.prototype.save = function () {
|
||||||
var self = this,
|
var self = this;
|
||||||
domainObject = this.domainObject,
|
var domainObject = this.domainObject;
|
||||||
copyService = this.copyService,
|
var copyService = this.copyService;
|
||||||
dialog = new SaveInProgressDialog(this.dialogService),
|
var dialog = new SaveInProgressDialog(this.dialogService);
|
||||||
toUndirty = [];
|
var toUndirty = [];
|
||||||
|
|
||||||
function doWizardSave(parent) {
|
function doWizardSave(parent) {
|
||||||
var wizard = self.createWizard(parent);
|
var wizard = self.createWizard(parent);
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ define(
|
|||||||
* transaction is in progress.
|
* transaction is in progress.
|
||||||
*/
|
*/
|
||||||
TransactionCapabilityDecorator.prototype.getCapabilities = function () {
|
TransactionCapabilityDecorator.prototype.getCapabilities = function () {
|
||||||
var self = this,
|
var self = this;
|
||||||
capabilities = this.capabilityService.getCapabilities
|
var capabilities = this.capabilityService.getCapabilities
|
||||||
.apply(this.capabilityService, arguments),
|
.apply(this.capabilityService, arguments);
|
||||||
persistenceCapability = capabilities.persistence;
|
var persistenceCapability = capabilities.persistence;
|
||||||
|
|
||||||
capabilities.persistence = function (domainObject) {
|
capabilities.persistence = function (domainObject) {
|
||||||
var original =
|
var original =
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
|
|
||||||
function cancelEditing(domainObject) {
|
function cancelEditing(domainObject) {
|
||||||
var navigatedObject = domainObject,
|
var navigatedObject = domainObject;
|
||||||
editorCapability = navigatedObject &&
|
var editorCapability = navigatedObject &&
|
||||||
navigatedObject.getCapability("editor");
|
navigatedObject.getCapability("editor");
|
||||||
|
|
||||||
return editorCapability &&
|
return editorCapability &&
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ 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 &&
|
var context = domainObject &&
|
||||||
domainObject.getCapability('context'),
|
domainObject.getCapability('context');
|
||||||
newRoot = context && context.getTrueRoot(),
|
var newRoot = context && context.getTrueRoot();
|
||||||
oldId = root && root.getId(),
|
var oldId = root && root.getId();
|
||||||
newId = newRoot && newRoot.getId();
|
var newId = newRoot && newRoot.getId();
|
||||||
|
|
||||||
// Only update if this has actually changed,
|
// Only update if this has actually changed,
|
||||||
// to avoid excessive refreshing.
|
// to avoid excessive refreshing.
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ define(
|
|||||||
* This will prompt for user input first.
|
* This will prompt for user input first.
|
||||||
*/
|
*/
|
||||||
CreateAction.prototype.perform = function () {
|
CreateAction.prototype.perform = function () {
|
||||||
var newModel = this.type.getInitialModel(),
|
var newModel = this.type.getInitialModel();
|
||||||
openmct = this.openmct,
|
var openmct = this.openmct;
|
||||||
newObject;
|
var newObject;
|
||||||
|
|
||||||
function onCancel() {
|
function onCancel() {
|
||||||
openmct.editor.cancel();
|
openmct.editor.cancel();
|
||||||
@@ -78,13 +78,13 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function navigateAndEdit(object) {
|
function navigateAndEdit(object) {
|
||||||
let objectPath = object.getCapability('context').getPath(),
|
let objectPath = object.getCapability('context').getPath();
|
||||||
url = '#/browse/' + objectPath
|
let url = '#/browse/' + objectPath
|
||||||
.slice(1)
|
.slice(1)
|
||||||
.map(function (o) {
|
.map(function (o) {
|
||||||
return o && openmct.objects.makeKeyString(o.getId());
|
return o && openmct.objects.makeKeyString(o.getId());
|
||||||
})
|
})
|
||||||
.join('/');
|
.join('/');
|
||||||
|
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreateActionProvider.prototype.getActions = function (actionContext) {
|
CreateActionProvider.prototype.getActions = function (actionContext) {
|
||||||
var context = actionContext || {},
|
var context = actionContext || {};
|
||||||
key = context.key,
|
var key = context.key;
|
||||||
destination = context.domainObject,
|
var destination = context.domainObject;
|
||||||
self = this;
|
var self = this;
|
||||||
|
|
||||||
// We only provide Create actions, and we need a
|
// We only provide Create actions, and we need a
|
||||||
// domain object to serve as the container for the
|
// domain object to serve as the container for the
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ define(
|
|||||||
* show in the create dialog
|
* show in the create dialog
|
||||||
*/
|
*/
|
||||||
CreateWizard.prototype.getFormStructure = function (includeLocation) {
|
CreateWizard.prototype.getFormStructure = function (includeLocation) {
|
||||||
var sections = [],
|
var sections = [];
|
||||||
domainObject = this.domainObject;
|
var domainObject = this.domainObject;
|
||||||
|
|
||||||
function validateLocation(parent) {
|
function validateLocation(parent) {
|
||||||
return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
|
return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
|
||||||
@@ -107,8 +107,8 @@ define(
|
|||||||
* @returns {DomainObject}
|
* @returns {DomainObject}
|
||||||
*/
|
*/
|
||||||
CreateWizard.prototype.populateObjectFromInput = function (formValue) {
|
CreateWizard.prototype.populateObjectFromInput = function (formValue) {
|
||||||
var parent = this.getLocation(formValue),
|
var parent = this.getLocation(formValue);
|
||||||
formModel = this.createModel(formValue);
|
var formModel = this.createModel(formValue);
|
||||||
|
|
||||||
formModel.location = parent.getId();
|
formModel.location = parent.getId();
|
||||||
this.domainObject.useCapability("mutation", function () {
|
this.domainObject.useCapability("mutation", function () {
|
||||||
@@ -126,10 +126,10 @@ define(
|
|||||||
*/
|
*/
|
||||||
CreateWizard.prototype.getInitialFormValue = function () {
|
CreateWizard.prototype.getInitialFormValue = function () {
|
||||||
// Start with initial values for properties
|
// Start with initial values for properties
|
||||||
var model = this.model,
|
var model = this.model;
|
||||||
formValue = this.properties.map(function (property) {
|
var formValue = this.properties.map(function (property) {
|
||||||
return property.getValue(model);
|
return property.getValue(model);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Include the createParent
|
// Include the createParent
|
||||||
formValue.createParent = this.parent;
|
formValue.createParent = this.parent;
|
||||||
|
|||||||
@@ -63,17 +63,17 @@ define(
|
|||||||
* object has been created
|
* object has been created
|
||||||
*/
|
*/
|
||||||
CreationService.prototype.createObject = function (model, parent) {
|
CreationService.prototype.createObject = function (model, parent) {
|
||||||
var persistence = parent.getCapability("persistence"),
|
var persistence = parent.getCapability("persistence");
|
||||||
newObject = parent.useCapability("instantiation", model),
|
var newObject = parent.useCapability("instantiation", model);
|
||||||
newObjectPersistence = newObject.getCapability("persistence"),
|
var newObjectPersistence = newObject.getCapability("persistence");
|
||||||
self = this;
|
var self = this;
|
||||||
|
|
||||||
// Add the newly-created object's id to the parent's
|
// Add the newly-created object's id to the parent's
|
||||||
// composition, so that it will subsequently appear
|
// composition, so that it will subsequently appear
|
||||||
// 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 &&
|
var addResult = compositionCapability &&
|
||||||
compositionCapability.add(newObject);
|
compositionCapability.add(newObject);
|
||||||
|
|
||||||
return self.$q.when(addResult).then(function (result) {
|
return self.$q.when(addResult).then(function (result) {
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ define(
|
|||||||
// 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();
|
var contextRoot = context && context.getRoot();
|
||||||
|
|
||||||
if (contextRoot && contextRoot !== $scope.rootObject) {
|
if (contextRoot && contextRoot !== $scope.rootObject) {
|
||||||
$scope.rootObject = undefined;
|
$scope.rootObject = undefined;
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
EditPersistableObjectsPolicy.prototype.allow = function (action, context) {
|
EditPersistableObjectsPolicy.prototype.allow = function (action, context) {
|
||||||
var identifier;
|
|
||||||
var provider;
|
|
||||||
var domainObject = context.domainObject;
|
var domainObject = context.domainObject;
|
||||||
var key = action.getMetadata().key;
|
var key = action.getMetadata().key;
|
||||||
var category = (context || {}).category;
|
var category = (context || {}).category;
|
||||||
@@ -46,9 +44,8 @@ define(
|
|||||||
// is also invoked during the create process which should be allowed,
|
// is also invoked during the create process which should be allowed,
|
||||||
// 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') {
|
||||||
identifier = objectUtils.parseKeyString(domainObject.getId());
|
let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId());
|
||||||
provider = this.openmct.objects.getProvider(identifier);
|
return this.openmct.objects.isPersistable(newStyleObject);
|
||||||
return provider.save !== undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ define(
|
|||||||
* @param {String} message a message to log with the commit message.
|
* @param {String} message a message to log with the commit message.
|
||||||
*/
|
*/
|
||||||
EditRepresenter.prototype.commit = function (message) {
|
EditRepresenter.prototype.commit = function (message) {
|
||||||
var model = this.$scope.model,
|
var model = this.$scope.model;
|
||||||
configuration = this.$scope.configuration,
|
var configuration = this.$scope.configuration;
|
||||||
domainObject = this.domainObject;
|
var domainObject = this.domainObject;
|
||||||
|
|
||||||
this.$log.debug([
|
this.$log.debug([
|
||||||
"Committing ",
|
"Committing ",
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ define(
|
|||||||
function (CancelAction) {
|
function (CancelAction) {
|
||||||
|
|
||||||
describe("The Cancel action", function () {
|
describe("The Cancel action", function () {
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
mockParentObject,
|
var mockParentObject;
|
||||||
capabilities = {},
|
var capabilities = {};
|
||||||
parentCapabilities = {},
|
var parentCapabilities = {};
|
||||||
actionContext,
|
var actionContext;
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ define(
|
|||||||
function (EditAction) {
|
function (EditAction) {
|
||||||
|
|
||||||
describe("The Edit action", function () {
|
describe("The Edit action", function () {
|
||||||
var mockLocation,
|
var mockLocation;
|
||||||
mockNavigationService,
|
var mockNavigationService;
|
||||||
mockLog,
|
var mockLog;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
mockType,
|
var mockType;
|
||||||
mockEditor,
|
var mockEditor;
|
||||||
actionContext,
|
var actionContext;
|
||||||
capabilities,
|
var capabilities;
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockLocation = jasmine.createSpyObj(
|
mockLocation = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -25,17 +25,17 @@ define(
|
|||||||
function (EditAndComposeAction) {
|
function (EditAndComposeAction) {
|
||||||
|
|
||||||
describe("The Link action", function () {
|
describe("The Link action", function () {
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
mockParent,
|
var mockParent;
|
||||||
mockContext,
|
var mockContext;
|
||||||
mockComposition,
|
var mockComposition;
|
||||||
mockActionCapability,
|
var mockActionCapability;
|
||||||
mockEditAction,
|
var mockEditAction;
|
||||||
mockType,
|
var mockType;
|
||||||
actionContext,
|
var actionContext;
|
||||||
model,
|
var model;
|
||||||
capabilities,
|
var capabilities;
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -25,7 +25,13 @@ define(
|
|||||||
function (PropertiesAction) {
|
function (PropertiesAction) {
|
||||||
|
|
||||||
describe("Properties action", function () {
|
describe("Properties action", function () {
|
||||||
var capabilities, model, object, context, input, dialogService, action;
|
var capabilities;
|
||||||
|
var model;
|
||||||
|
var object;
|
||||||
|
var context;
|
||||||
|
var input;
|
||||||
|
var dialogService;
|
||||||
|
var action;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ define(
|
|||||||
|
|
||||||
describe("Properties dialog", function () {
|
describe("Properties dialog", function () {
|
||||||
|
|
||||||
var type, properties, model, dialog;
|
var type;
|
||||||
|
var properties;
|
||||||
|
var model;
|
||||||
|
var dialog;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
type = {
|
type = {
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ define(
|
|||||||
function (SaveAction) {
|
function (SaveAction) {
|
||||||
|
|
||||||
describe("The Save action", function () {
|
describe("The Save action", function () {
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
mockEditorCapability,
|
var mockEditorCapability;
|
||||||
actionContext,
|
var actionContext;
|
||||||
mockDialogService,
|
var mockDialogService;
|
||||||
mockNotificationService,
|
var mockNotificationService;
|
||||||
mockActionCapability,
|
var mockActionCapability;
|
||||||
capabilities = {},
|
var capabilities = {};
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ define(
|
|||||||
// depends on is not mocked, so we mock some
|
// depends on is not mocked, so we mock some
|
||||||
// of SaveAction's own dependencies to make
|
// of SaveAction's own dependencies to make
|
||||||
// it run.
|
// it run.
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
mockEditorCapability,
|
var mockEditorCapability;
|
||||||
actionContext,
|
var actionContext;
|
||||||
dialogService,
|
var dialogService;
|
||||||
notificationService,
|
var notificationService;
|
||||||
mockActionCapability,
|
var mockActionCapability;
|
||||||
capabilities = {},
|
var capabilities = {};
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -26,18 +26,18 @@ define(
|
|||||||
function (SaveAsAction) {
|
function (SaveAsAction) {
|
||||||
|
|
||||||
xdescribe("The Save As action", function () {
|
xdescribe("The Save As action", function () {
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
mockClonedObject,
|
var mockClonedObject;
|
||||||
mockEditorCapability,
|
var mockEditorCapability;
|
||||||
mockActionCapability,
|
var mockActionCapability;
|
||||||
mockObjectService,
|
var mockObjectService;
|
||||||
mockDialogService,
|
var mockDialogService;
|
||||||
mockCopyService,
|
var mockCopyService;
|
||||||
mockNotificationService,
|
var mockNotificationService;
|
||||||
mockParent,
|
var mockParent;
|
||||||
actionContext,
|
var actionContext;
|
||||||
capabilities = {},
|
var capabilities = {};
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ define(
|
|||||||
function (EditorCapability) {
|
function (EditorCapability) {
|
||||||
|
|
||||||
xdescribe("The editor capability", function () {
|
xdescribe("The editor capability", function () {
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
capabilities,
|
var capabilities;
|
||||||
mockParentObject,
|
var mockParentObject;
|
||||||
mockTransactionService,
|
var mockTransactionService;
|
||||||
mockStatusCapability,
|
var mockStatusCapability;
|
||||||
mockParentStatus,
|
var mockParentStatus;
|
||||||
mockContextCapability,
|
var mockContextCapability;
|
||||||
capability;
|
var capability;
|
||||||
|
|
||||||
function fastPromise(val) {
|
function fastPromise(val) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ define(
|
|||||||
function (TransactionalPersistenceCapability, TransactionCapabilityDecorator) {
|
function (TransactionalPersistenceCapability, TransactionCapabilityDecorator) {
|
||||||
|
|
||||||
describe("The transaction capability decorator", function () {
|
describe("The transaction capability decorator", function () {
|
||||||
var mockQ,
|
var mockQ;
|
||||||
mockTransactionService,
|
var mockTransactionService;
|
||||||
mockCapabilityService,
|
var mockCapabilityService;
|
||||||
provider;
|
var provider;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockQ = {};
|
mockQ = {};
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("The transactional persistence decorator", function () {
|
describe("The transactional persistence decorator", function () {
|
||||||
var mockQ,
|
var mockQ;
|
||||||
mockTransactionManager,
|
var mockTransactionManager;
|
||||||
mockPersistence,
|
var mockPersistence;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
testId,
|
var testId;
|
||||||
capability;
|
var capability;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
testId = "test-id";
|
testId = "test-id";
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mockScope,
|
var mockScope;
|
||||||
mockActions,
|
var mockActions;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
||||||
|
|||||||
@@ -25,16 +25,16 @@ define(
|
|||||||
function (EditObjectController) {
|
function (EditObjectController) {
|
||||||
|
|
||||||
describe("The Edit Object controller", function () {
|
describe("The Edit Object controller", function () {
|
||||||
var mockScope,
|
var mockScope;
|
||||||
mockObject,
|
var mockObject;
|
||||||
testViews,
|
var testViews;
|
||||||
mockEditorCapability,
|
var mockEditorCapability;
|
||||||
mockLocation,
|
var mockLocation;
|
||||||
mockNavigationService,
|
var mockNavigationService;
|
||||||
removeCheck,
|
var removeCheck;
|
||||||
mockStatusCapability,
|
var mockStatusCapability;
|
||||||
mockCapabilities,
|
var mockCapabilities;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj(
|
mockScope = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ define(
|
|||||||
function (EditPanesController) {
|
function (EditPanesController) {
|
||||||
|
|
||||||
describe("The Edit Panes controller", function () {
|
describe("The Edit Panes controller", function () {
|
||||||
var mockScope,
|
var mockScope;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
mockContext,
|
var mockContext;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ define(
|
|||||||
function (CreateActionProvider) {
|
function (CreateActionProvider) {
|
||||||
|
|
||||||
describe("The create action provider", function () {
|
describe("The create action provider", function () {
|
||||||
var mockTypeService,
|
var mockTypeService;
|
||||||
mockPolicyService,
|
var mockPolicyService;
|
||||||
mockCreationPolicy,
|
var mockCreationPolicy;
|
||||||
mockPolicyMap = {},
|
var mockPolicyMap = {};
|
||||||
mockTypes,
|
var mockTypes;
|
||||||
provider;
|
var provider;
|
||||||
|
|
||||||
function createMockType(name) {
|
function createMockType(name) {
|
||||||
var mockType = jasmine.createSpyObj(
|
var mockType = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ define(
|
|||||||
function (CreateAction) {
|
function (CreateAction) {
|
||||||
|
|
||||||
xdescribe("The create action", function () {
|
xdescribe("The create action", function () {
|
||||||
var mockType,
|
var mockType;
|
||||||
mockParent,
|
var mockParent;
|
||||||
mockContext,
|
var mockContext;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
capabilities = {},
|
var capabilities = {};
|
||||||
mockEditAction,
|
var mockEditAction;
|
||||||
action;
|
var action;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ define(
|
|||||||
function (CreateMenuController) {
|
function (CreateMenuController) {
|
||||||
|
|
||||||
describe("The create menu controller", function () {
|
describe("The create menu controller", function () {
|
||||||
var mockScope,
|
var mockScope;
|
||||||
mockActions,
|
var mockActions;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ define(
|
|||||||
function (CreateWizard) {
|
function (CreateWizard) {
|
||||||
|
|
||||||
xdescribe("The create wizard", function () {
|
xdescribe("The create wizard", function () {
|
||||||
var mockType,
|
var mockType;
|
||||||
mockParent,
|
var mockParent;
|
||||||
mockProperties,
|
var mockProperties;
|
||||||
mockPolicyService,
|
var mockPolicyService;
|
||||||
testModel,
|
var testModel;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
wizard;
|
var wizard;
|
||||||
|
|
||||||
function createMockProperty(name) {
|
function createMockProperty(name) {
|
||||||
var mockProperty = jasmine.createSpyObj(
|
var mockProperty = jasmine.createSpyObj(
|
||||||
@@ -142,11 +142,11 @@ define(
|
|||||||
|
|
||||||
it("populates the model on the associated object", function () {
|
it("populates the model on the associated object", function () {
|
||||||
var formValue = {
|
var formValue = {
|
||||||
"A": "ValueA",
|
"A": "ValueA",
|
||||||
"B": "ValueB",
|
"B": "ValueB",
|
||||||
"C": "ValueC"
|
"C": "ValueC"
|
||||||
},
|
};
|
||||||
compareModel = wizard.createModel(formValue);
|
var compareModel = wizard.createModel(formValue);
|
||||||
//populateObjectFromInput adds a .location attribute that is not added by createModel.
|
//populateObjectFromInput adds a .location attribute that is not added by createModel.
|
||||||
compareModel.location = undefined;
|
compareModel.location = undefined;
|
||||||
wizard.populateObjectFromInput(formValue);
|
wizard.populateObjectFromInput(formValue);
|
||||||
@@ -156,19 +156,19 @@ define(
|
|||||||
|
|
||||||
it("validates selection types using policy", function () {
|
it("validates selection types using policy", function () {
|
||||||
var mockDomainObj = jasmine.createSpyObj(
|
var mockDomainObj = jasmine.createSpyObj(
|
||||||
'domainObject',
|
'domainObject',
|
||||||
['getCapability']
|
['getCapability']
|
||||||
),
|
);
|
||||||
mockOtherType = jasmine.createSpyObj(
|
var mockOtherType = jasmine.createSpyObj(
|
||||||
'otherType',
|
'otherType',
|
||||||
['getKey']
|
['getKey']
|
||||||
),
|
);
|
||||||
|
|
||||||
//Create a form structure with location
|
//Create a form structure with location
|
||||||
structure = wizard.getFormStructure(true),
|
var structure = wizard.getFormStructure(true);
|
||||||
sections = structure.sections,
|
var sections = structure.sections;
|
||||||
rows = structure.sections[sections.length - 1].rows,
|
var rows = structure.sections[sections.length - 1].rows;
|
||||||
locationRow = rows[rows.length - 1];
|
var locationRow = rows[rows.length - 1];
|
||||||
|
|
||||||
mockDomainObj.getCapability.and.returnValue(mockOtherType);
|
mockDomainObj.getCapability.and.returnValue(mockOtherType);
|
||||||
locationRow.validate(mockDomainObj);
|
locationRow.validate(mockDomainObj);
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ define(
|
|||||||
function (CreationPolicy) {
|
function (CreationPolicy) {
|
||||||
|
|
||||||
describe("The creation policy", function () {
|
describe("The creation policy", function () {
|
||||||
var mockType,
|
var mockType;
|
||||||
policy;
|
var policy;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockType = jasmine.createSpyObj(
|
mockType = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ define(
|
|||||||
function (CreationService) {
|
function (CreationService) {
|
||||||
|
|
||||||
describe("The creation service", function () {
|
describe("The creation service", function () {
|
||||||
var mockQ,
|
var mockQ;
|
||||||
mockLog,
|
var mockLog;
|
||||||
mockParentObject,
|
var mockParentObject;
|
||||||
mockNewObject,
|
var mockNewObject;
|
||||||
mockMutationCapability,
|
var mockMutationCapability;
|
||||||
mockPersistenceCapability,
|
var mockPersistenceCapability;
|
||||||
mockCompositionCapability,
|
var mockCompositionCapability;
|
||||||
mockContextCapability,
|
var mockContextCapability;
|
||||||
mockCreationCapability,
|
var mockCreationCapability;
|
||||||
mockCapabilities,
|
var mockCapabilities;
|
||||||
mockNewPersistenceCapability,
|
var mockNewPersistenceCapability;
|
||||||
creationService;
|
var creationService;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return (value && value.then) ? value : {
|
return (value && value.then) ? value : {
|
||||||
@@ -157,10 +157,10 @@ define(
|
|||||||
|
|
||||||
it("provides the newly-created object", function () {
|
it("provides the newly-created object", function () {
|
||||||
var mockDomainObject = jasmine.createSpyObj(
|
var mockDomainObject = jasmine.createSpyObj(
|
||||||
'newDomainObject',
|
'newDomainObject',
|
||||||
['getId', 'getModel', 'getCapability']
|
['getId', 'getModel', 'getCapability']
|
||||||
),
|
);
|
||||||
mockCallback = jasmine.createSpy('callback');
|
var mockCallback = jasmine.createSpy('callback');
|
||||||
|
|
||||||
// Act as if the object had been created
|
// Act as if the object had been created
|
||||||
mockCompositionCapability.add.and.callFake(function (id) {
|
mockCompositionCapability.add.and.callFake(function (id) {
|
||||||
@@ -180,8 +180,8 @@ define(
|
|||||||
|
|
||||||
it("warns if parent has no persistence capability", function () {
|
it("warns if parent has no persistence capability", function () {
|
||||||
// Callbacks
|
// Callbacks
|
||||||
var success = jasmine.createSpy("success"),
|
var success = jasmine.createSpy("success");
|
||||||
failure = jasmine.createSpy("failure");
|
var failure = jasmine.createSpy("failure");
|
||||||
|
|
||||||
mockCapabilities.persistence = undefined;
|
mockCapabilities.persistence = undefined;
|
||||||
creationService.createObject({}, mockParentObject).then(
|
creationService.createObject({}, mockParentObject).then(
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ define(
|
|||||||
function (LocatorController) {
|
function (LocatorController) {
|
||||||
|
|
||||||
describe("The locator controller", function () {
|
describe("The locator controller", function () {
|
||||||
var mockScope,
|
var mockScope;
|
||||||
mockTimeout,
|
var mockTimeout;
|
||||||
mockDomainObject,
|
var mockDomainObject;
|
||||||
mockRootObject,
|
var mockRootObject;
|
||||||
mockContext,
|
var mockContext;
|
||||||
mockObjectService,
|
var mockObjectService;
|
||||||
getObjectsPromise,
|
var getObjectsPromise;
|
||||||
controller;
|
var controller;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj(
|
mockScope = jasmine.createSpyObj(
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ define(
|
|||||||
function (EditPersistableObjectsPolicy) {
|
function (EditPersistableObjectsPolicy) {
|
||||||
|
|
||||||
describe("The Edit persistable objects policy", function () {
|
describe("The Edit persistable objects policy", function () {
|
||||||
var mockDomainObject,
|
var mockDomainObject;
|
||||||
mockEditAction,
|
var mockEditAction;
|
||||||
mockPropertiesAction,
|
var mockPropertiesAction;
|
||||||
mockOtherAction,
|
var mockOtherAction;
|
||||||
mockAPI,
|
var mockAPI;
|
||||||
mockObjectAPI,
|
var mockObjectAPI;
|
||||||
testContext,
|
var testContext;
|
||||||
policy;
|
var policy;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockDomainObject = jasmine.createSpyObj(
|
mockDomainObject = jasmine.createSpyObj(
|
||||||
@@ -43,7 +43,7 @@ define(
|
|||||||
);
|
);
|
||||||
|
|
||||||
mockObjectAPI = jasmine.createSpyObj('objectAPI', [
|
mockObjectAPI = jasmine.createSpyObj('objectAPI', [
|
||||||
'getProvider'
|
'isPersistable'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
mockAPI = {
|
mockAPI = {
|
||||||
@@ -69,34 +69,31 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Applies to edit action", function () {
|
it("Applies to edit action", function () {
|
||||||
mockObjectAPI.getProvider.and.returnValue({});
|
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
policy.allow(mockEditAction, testContext);
|
policy.allow(mockEditAction, testContext);
|
||||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
expect(mockObjectAPI.isPersistable).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Applies to properties action", function () {
|
it("Applies to properties action", function () {
|
||||||
mockObjectAPI.getProvider.and.returnValue({});
|
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
policy.allow(mockPropertiesAction, testContext);
|
policy.allow(mockPropertiesAction, testContext);
|
||||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
expect(mockObjectAPI.isPersistable).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not apply to other actions", function () {
|
it("does not apply to other actions", function () {
|
||||||
mockObjectAPI.getProvider.and.returnValue({});
|
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
policy.allow(mockOtherAction, testContext);
|
policy.allow(mockOtherAction, testContext);
|
||||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Tests object provider for editability", function () {
|
it("Tests object provider for editability", function () {
|
||||||
mockObjectAPI.getProvider.and.returnValue({});
|
mockObjectAPI.isPersistable.and.returnValue(false);
|
||||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
expect(mockObjectAPI.isPersistable).toHaveBeenCalled();
|
||||||
mockObjectAPI.getProvider.and.returnValue({save: function () {}});
|
mockObjectAPI.isPersistable.and.returnValue(true);
|
||||||
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ define([
|
|||||||
EditRepresenter
|
EditRepresenter
|
||||||
) {
|
) {
|
||||||
describe('EditRepresenter', function () {
|
describe('EditRepresenter', function () {
|
||||||
var $log,
|
var $log;
|
||||||
$scope,
|
var $scope;
|
||||||
representer;
|
var representer;
|
||||||
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@@ -42,8 +42,8 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('representation', function () {
|
describe('representation', function () {
|
||||||
var domainObject,
|
var domainObject;
|
||||||
representation;
|
var representation;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
domainObject = jasmine.createSpyObj('domainObject', [
|
domainObject = jasmine.createSpyObj('domainObject', [
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
|
|||||||
var TRANSACTION_METHODS = ['add', 'commit', 'cancel', 'size'];
|
var TRANSACTION_METHODS = ['add', 'commit', 'cancel', 'size'];
|
||||||
|
|
||||||
describe("A NestedTransaction", function () {
|
describe("A NestedTransaction", function () {
|
||||||
var mockTransaction,
|
var mockTransaction;
|
||||||
nestedTransaction;
|
var nestedTransaction;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockTransaction =
|
mockTransaction =
|
||||||
@@ -42,8 +42,8 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when callbacks are added", function () {
|
describe("when callbacks are added", function () {
|
||||||
var mockCommit,
|
var mockCommit;
|
||||||
mockCancel;
|
var mockCancel;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockCommit = jasmine.createSpy('commit');
|
mockCommit = jasmine.createSpy('commit');
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ define(
|
|||||||
["../../src/services/TransactionManager"],
|
["../../src/services/TransactionManager"],
|
||||||
function (TransactionManager) {
|
function (TransactionManager) {
|
||||||
describe("TransactionManager", function () {
|
describe("TransactionManager", function () {
|
||||||
var mockTransactionService,
|
var mockTransactionService;
|
||||||
testId,
|
var testId;
|
||||||
mockOnCommit,
|
var mockOnCommit;
|
||||||
mockOnCancel,
|
var mockOnCancel;
|
||||||
mockRemoves,
|
var mockRemoves;
|
||||||
mockPromise,
|
var mockPromise;
|
||||||
manager;
|
var manager;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockRemoves = [];
|
mockRemoves = [];
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ define(
|
|||||||
function (TransactionService) {
|
function (TransactionService) {
|
||||||
|
|
||||||
describe("The Transaction Service", function () {
|
describe("The Transaction Service", function () {
|
||||||
var mockQ,
|
var mockQ;
|
||||||
mockLog,
|
var mockLog;
|
||||||
transactionService;
|
var transactionService;
|
||||||
|
|
||||||
function fastPromise(val) {
|
function fastPromise(val) {
|
||||||
return {
|
return {
|
||||||
@@ -52,8 +52,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("addToTransaction queues onCommit and onCancel functions", function () {
|
it("addToTransaction queues onCommit and onCancel functions", function () {
|
||||||
var onCommit = jasmine.createSpy('onCommit'),
|
var onCommit = jasmine.createSpy('onCommit');
|
||||||
onCancel = jasmine.createSpy('onCancel');
|
var onCancel = jasmine.createSpy('onCancel');
|
||||||
|
|
||||||
transactionService.startTransaction();
|
transactionService.startTransaction();
|
||||||
transactionService.addToTransaction(onCommit, onCancel);
|
transactionService.addToTransaction(onCommit, onCancel);
|
||||||
@@ -61,8 +61,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("size function returns size of commit and cancel queues", function () {
|
it("size function returns size of commit and cancel queues", function () {
|
||||||
var onCommit = jasmine.createSpy('onCommit'),
|
var onCommit = jasmine.createSpy('onCommit');
|
||||||
onCancel = jasmine.createSpy('onCancel');
|
var onCancel = jasmine.createSpy('onCancel');
|
||||||
|
|
||||||
transactionService.startTransaction();
|
transactionService.startTransaction();
|
||||||
transactionService.addToTransaction(onCommit, onCancel);
|
transactionService.addToTransaction(onCommit, onCancel);
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ define(
|
|||||||
function (Transaction) {
|
function (Transaction) {
|
||||||
|
|
||||||
describe("A Transaction", function () {
|
describe("A Transaction", function () {
|
||||||
var mockLog,
|
var mockLog;
|
||||||
transaction;
|
var transaction;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockLog = jasmine.createSpyObj(
|
mockLog = jasmine.createSpyObj(
|
||||||
@@ -42,9 +42,9 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("when callbacks are added", function () {
|
describe("when callbacks are added", function () {
|
||||||
var mockCommit,
|
var mockCommit;
|
||||||
mockCancel,
|
var mockCancel;
|
||||||
remove;
|
var remove;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockCommit = jasmine.createSpy('commit');
|
mockCommit = jasmine.createSpy('commit');
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ define([
|
|||||||
moment
|
moment
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var DATE_FORMAT = "HH:mm:ss",
|
var DATE_FORMAT = "HH:mm:ss";
|
||||||
DATE_FORMATS = [
|
var DATE_FORMATS = [
|
||||||
DATE_FORMAT
|
DATE_FORMAT
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ define([
|
|||||||
moment
|
moment
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS",
|
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS";
|
||||||
DATE_FORMATS = [
|
var DATE_FORMATS = [
|
||||||
DATE_FORMAT,
|
DATE_FORMAT,
|
||||||
DATE_FORMAT + "Z",
|
DATE_FORMAT + "Z",
|
||||||
"YYYY-MM-DD HH:mm:ss",
|
"YYYY-MM-DD HH:mm:ss",
|
||||||
"YYYY-MM-DD HH:mm",
|
"YYYY-MM-DD HH:mm",
|
||||||
"YYYY-MM-DD"
|
"YYYY-MM-DD"
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef Scale
|
* @typedef Scale
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ define(
|
|||||||
var KEYS = ['a', 'b', 'c'];
|
var KEYS = ['a', 'b', 'c'];
|
||||||
|
|
||||||
describe("The FormatProvider", function () {
|
describe("The FormatProvider", function () {
|
||||||
var mockFormats,
|
var mockFormats;
|
||||||
mockFormatInstances,
|
var mockFormatInstances;
|
||||||
provider;
|
var provider;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockFormatInstances = KEYS.map(function (k) {
|
mockFormatInstances = KEYS.map(function (k) {
|
||||||
|
|||||||
@@ -19,7 +19,13 @@
|
|||||||
this source code distribution or the Licensing information page available
|
this source code distribution or the Licensing information page available
|
||||||
at runtime from the About dialog for additional information.
|
at runtime from the About dialog for additional information.
|
||||||
-->
|
-->
|
||||||
<div class="c-object-label">
|
<div class="c-object-label"
|
||||||
<div class="c-object-label__type-icon {{type.getCssClass()}}" ng-class="{ 'l-icon-link':location.isLink() }"></div>
|
ng-class="{ 'is-missing': model.status === 'missing' }"
|
||||||
|
>
|
||||||
|
<div class="c-object-label__type-icon {{type.getCssClass()}}"
|
||||||
|
ng-class="{ 'l-icon-link':location.isLink() }"
|
||||||
|
>
|
||||||
|
<span class="is-missing__indicator" title="This item is missing"></span>
|
||||||
|
</div>
|
||||||
<div class='c-object-label__name'>{{model.name}}</div>
|
<div class='c-object-label__name'>{{model.name}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -41,19 +41,19 @@ define(
|
|||||||
* stylesheets will be found
|
* stylesheets will be found
|
||||||
*/
|
*/
|
||||||
function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
|
function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
|
||||||
var head = $document.find('head'),
|
var head = $document.find('head');
|
||||||
document = $document[0];
|
var document = $document[0];
|
||||||
|
|
||||||
// Procedure for adding a single stylesheet
|
// Procedure for adding a single stylesheet
|
||||||
function addStyleSheet(stylesheet) {
|
function addStyleSheet(stylesheet) {
|
||||||
// Create a link element, and construct full path
|
// Create a link element, and construct full path
|
||||||
var link = document.createElement('link'),
|
var link = document.createElement('link');
|
||||||
path = [
|
var path = [
|
||||||
assetPath,
|
assetPath,
|
||||||
stylesheet.bundle.path,
|
stylesheet.bundle.path,
|
||||||
stylesheet.bundle.resources,
|
stylesheet.bundle.resources,
|
||||||
stylesheet.stylesheetUrl
|
stylesheet.stylesheetUrl
|
||||||
].join("/");
|
].join("/");
|
||||||
|
|
||||||
// Initialize attributes on the link
|
// Initialize attributes on the link
|
||||||
link.setAttribute("rel", "stylesheet");
|
link.setAttribute("rel", "stylesheet");
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ define(
|
|||||||
// Separate out the actions that have been retrieved
|
// Separate out the actions that have been retrieved
|
||||||
// into groups, and populate scope with this.
|
// into groups, and populate scope with this.
|
||||||
function groupActions(actions) {
|
function groupActions(actions) {
|
||||||
var groups = {},
|
var groups = {};
|
||||||
ungrouped = [];
|
var ungrouped = [];
|
||||||
|
|
||||||
function assignToGroup(action) {
|
function assignToGroup(action) {
|
||||||
var metadata = action.getMetadata(),
|
var metadata = action.getMetadata();
|
||||||
group = metadata.group;
|
var group = metadata.group;
|
||||||
if (group) {
|
if (group) {
|
||||||
groups[group] = groups[group] || [];
|
groups[group] = groups[group] || [];
|
||||||
groups[group].push(action);
|
groups[group].push(action);
|
||||||
@@ -73,9 +73,9 @@ define(
|
|||||||
// Callback for when state which might influence action groupings
|
// Callback for when state which might influence action groupings
|
||||||
// changes.
|
// changes.
|
||||||
function updateGroups() {
|
function updateGroups() {
|
||||||
var actionCapability = $scope.action,
|
var actionCapability = $scope.action;
|
||||||
params = $scope.parameters || {},
|
var params = $scope.parameters || {};
|
||||||
category = params.category;
|
var category = params.category;
|
||||||
|
|
||||||
if (actionCapability && category) {
|
if (actionCapability && category) {
|
||||||
// Get actions by capability, and group them
|
// Get actions by capability, and group them
|
||||||
|
|||||||
@@ -25,22 +25,22 @@ define(
|
|||||||
function (moment) {
|
function (moment) {
|
||||||
|
|
||||||
var TIME_NAMES = {
|
var TIME_NAMES = {
|
||||||
'hours': "Hour",
|
'hours': "Hour",
|
||||||
'minutes': "Minute",
|
'minutes': "Minute",
|
||||||
'seconds': "Second"
|
'seconds': "Second"
|
||||||
},
|
};
|
||||||
MONTHS = moment.months(),
|
var MONTHS = moment.months();
|
||||||
TIME_OPTIONS = (function makeRanges() {
|
var TIME_OPTIONS = (function makeRanges() {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
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,
|
||||||
seconds: arr
|
seconds: arr
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller to support the date-time picker.
|
* Controller to support the date-time picker.
|
||||||
@@ -65,15 +65,15 @@ define(
|
|||||||
* Months are zero-indexed, day-of-months are one-indexed.
|
* Months are zero-indexed, day-of-months are one-indexed.
|
||||||
*/
|
*/
|
||||||
function DateTimePickerController($scope, now) {
|
function DateTimePickerController($scope, now) {
|
||||||
var year,
|
var year;
|
||||||
month, // For picker state, not model state
|
var month; // For picker state, not model state
|
||||||
interacted = false;
|
var interacted = false;
|
||||||
|
|
||||||
function generateTable() {
|
function generateTable() {
|
||||||
var m = moment.utc({ year: year, month: month }).day(0),
|
var m = moment.utc({ year: year, month: month }).day(0);
|
||||||
table = [],
|
var table = [];
|
||||||
row,
|
var row;
|
||||||
col;
|
var col;
|
||||||
|
|
||||||
for (row = 0; row < 6; row += 1) {
|
for (row = 0; row < 6; row += 1) {
|
||||||
table.push([]);
|
table.push([]);
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ define(
|
|||||||
|
|
||||||
// Gets an array of the contextual parents/ancestors of the selected object
|
// Gets an array of the contextual parents/ancestors of the selected object
|
||||||
function getContextualPath() {
|
function getContextualPath() {
|
||||||
var currentObj = $scope.domainObject,
|
var currentObj = $scope.domainObject;
|
||||||
currentParent,
|
var currentParent;
|
||||||
parents = [];
|
var parents = [];
|
||||||
|
|
||||||
currentParent = currentObj &&
|
currentParent = currentObj &&
|
||||||
currentObj.hasCapability('context') &&
|
currentObj.hasCapability('context') &&
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ define(
|
|||||||
* @param $scope Angular scope for this controller
|
* @param $scope Angular scope for this controller
|
||||||
*/
|
*/
|
||||||
function SelectorController(objectService, $scope) {
|
function SelectorController(objectService, $scope) {
|
||||||
var treeModel = {},
|
var treeModel = {};
|
||||||
listModel = {},
|
var listModel = {};
|
||||||
previousSelected,
|
var previousSelected;
|
||||||
self = this;
|
var self = this;
|
||||||
|
|
||||||
// For watch; look at the user's selection in the tree
|
// For watch; look at the user's selection in the tree
|
||||||
function getTreeSelection() {
|
function getTreeSelection() {
|
||||||
@@ -126,8 +126,8 @@ define(
|
|||||||
* @param {DomainObject} the domain object to select
|
* @param {DomainObject} the domain object to select
|
||||||
*/
|
*/
|
||||||
SelectorController.prototype.select = function (domainObject) {
|
SelectorController.prototype.select = function (domainObject) {
|
||||||
var id = domainObject && domainObject.getId(),
|
var id = domainObject && domainObject.getId();
|
||||||
list = this.getField() || [];
|
var list = this.getField() || [];
|
||||||
// Only select if we have a valid id,
|
// Only select if we have a valid id,
|
||||||
// and it isn't already selected
|
// and it isn't already selected
|
||||||
if (id && list.indexOf(id) === -1) {
|
if (id && list.indexOf(id) === -1) {
|
||||||
@@ -140,8 +140,8 @@ define(
|
|||||||
* @param {DomainObject} the domain object to select
|
* @param {DomainObject} the domain object to select
|
||||||
*/
|
*/
|
||||||
SelectorController.prototype.deselect = function (domainObject) {
|
SelectorController.prototype.deselect = function (domainObject) {
|
||||||
var id = domainObject && domainObject.getId(),
|
var id = domainObject && domainObject.getId();
|
||||||
list = this.getField() || [];
|
var list = this.getField() || [];
|
||||||
// Only change if this was a valid id,
|
// Only change if this was a valid id,
|
||||||
// for an object which was already selected
|
// for an object which was already selected
|
||||||
if (id && list.indexOf(id) !== -1) {
|
if (id && list.indexOf(id) !== -1) {
|
||||||
|
|||||||
@@ -101,7 +101,12 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
TimeRangeController.prototype.updateTicks = function () {
|
TimeRangeController.prototype.updateTicks = function () {
|
||||||
var i, p, ts, start, end, span;
|
var i;
|
||||||
|
var p;
|
||||||
|
var ts;
|
||||||
|
var start;
|
||||||
|
var end;
|
||||||
|
var span;
|
||||||
end = this.$scope.ngModel.outer.end;
|
end = this.$scope.ngModel.outer.end;
|
||||||
start = this.$scope.ngModel.outer.start;
|
start = this.$scope.ngModel.outer.start;
|
||||||
span = end - start;
|
span = end - start;
|
||||||
@@ -197,9 +202,9 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
TimeRangeController.prototype.middleDrag = function (pixels) {
|
TimeRangeController.prototype.middleDrag = function (pixels) {
|
||||||
var delta = this.toMillis(pixels),
|
var delta = this.toMillis(pixels);
|
||||||
edge = delta < 0 ? 'start' : 'end',
|
var edge = delta < 0 ? 'start' : 'end';
|
||||||
opposite = delta < 0 ? 'end' : 'start';
|
var opposite = delta < 0 ? 'end' : 'start';
|
||||||
|
|
||||||
// Adjust the position of the edge in the direction of drag
|
// Adjust the position of the edge in the direction of drag
|
||||||
this.$scope.ngModel.inner[edge] = clamp(
|
this.$scope.ngModel.inner[edge] = clamp(
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TreeNodeController($scope, $timeout) {
|
function TreeNodeController($scope, $timeout) {
|
||||||
var self = this,
|
var self = this;
|
||||||
selectedObject = ($scope.ngModel || {}).selectedObject;
|
var selectedObject = ($scope.ngModel || {}).selectedObject;
|
||||||
|
|
||||||
// Look up the id for a domain object. A convenience
|
// Look up the id for a domain object. A convenience
|
||||||
// for mapping; additionally does some undefined-checking.
|
// for mapping; additionally does some undefined-checking.
|
||||||
@@ -86,14 +86,14 @@ define(
|
|||||||
// Consider the currently-navigated object and update
|
// Consider the currently-navigated object and update
|
||||||
// parameters which support display.
|
// parameters which support display.
|
||||||
function checkSelection() {
|
function checkSelection() {
|
||||||
var nodeObject = $scope.domainObject,
|
var nodeObject = $scope.domainObject;
|
||||||
navObject = selectedObject,
|
var navObject = selectedObject;
|
||||||
nodeContext = nodeObject &&
|
var nodeContext = nodeObject &&
|
||||||
nodeObject.getCapability('context'),
|
nodeObject.getCapability('context');
|
||||||
navContext = navObject &&
|
var navContext = navObject &&
|
||||||
navObject.getCapability('context'),
|
navObject.getCapability('context');
|
||||||
nodePath,
|
var nodePath;
|
||||||
navPath;
|
var navPath;
|
||||||
|
|
||||||
// Deselect; we will reselect below, iff we are
|
// Deselect; we will reselect below, iff we are
|
||||||
// exactly at the end of the path.
|
// exactly at the end of the path.
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ define(
|
|||||||
var body = $document.find('body');
|
var body = $document.find('body');
|
||||||
|
|
||||||
function clickBody(event) {
|
function clickBody(event) {
|
||||||
var x = event.clientX,
|
var x = event.clientX;
|
||||||
y = event.clientY,
|
var y = event.clientY;
|
||||||
rect = element[0].getBoundingClientRect(),
|
var rect = element[0].getBoundingClientRect();
|
||||||
xMin = rect.left,
|
var xMin = rect.left;
|
||||||
xMax = xMin + rect.width,
|
var xMax = xMin + rect.width;
|
||||||
yMin = rect.top,
|
var yMin = rect.top;
|
||||||
yMax = yMin + rect.height;
|
var yMax = yMin + rect.height;
|
||||||
|
|
||||||
if (x < xMin || x > xMax || y < yMin || y > yMax) {
|
if (x < xMin || x > xMax || y < yMin || y > yMax) {
|
||||||
scope.$apply(function () {
|
scope.$apply(function () {
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ define(
|
|||||||
// Populate initial scope based on attributes requested
|
// Populate initial scope based on attributes requested
|
||||||
// by the container definition
|
// by the container definition
|
||||||
link: function (scope, element, attrs) {
|
link: function (scope, element, attrs) {
|
||||||
var key = attrs.key,
|
var key = attrs.key;
|
||||||
container = containerMap[key],
|
var container = containerMap[key];
|
||||||
alias = "container",
|
var alias = "container";
|
||||||
copiedAttributes = {};
|
var copiedAttributes = {};
|
||||||
|
|
||||||
if (container) {
|
if (container) {
|
||||||
alias = container.alias || alias;
|
alias = container.alias || alias;
|
||||||
@@ -78,8 +78,8 @@ define(
|
|||||||
},
|
},
|
||||||
|
|
||||||
template: function (element, attrs) {
|
template: function (element, attrs) {
|
||||||
var key = attrs.key,
|
var key = attrs.key;
|
||||||
container = containerMap[key];
|
var container = containerMap[key];
|
||||||
return container ? container.template : "";
|
return container ? container.template : "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,12 +54,12 @@ define(
|
|||||||
// mouse event handlers; mousedown and mouseup cannot
|
// mouse event handlers; mousedown and mouseup cannot
|
||||||
// only be attached to the element being linked, as the
|
// only be attached to the element being linked, as the
|
||||||
// mouse may leave this element during the drag.
|
// mouse may leave this element during the drag.
|
||||||
var body = $document.find('body'),
|
var body = $document.find('body');
|
||||||
isMobile = agentService.isMobile(),
|
var isMobile = agentService.isMobile();
|
||||||
touchEvents,
|
var touchEvents;
|
||||||
initialPosition,
|
var initialPosition;
|
||||||
$event,
|
var $event;
|
||||||
delta;
|
var delta;
|
||||||
|
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
touchEvents = {
|
touchEvents = {
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ define(
|
|||||||
*/
|
*/
|
||||||
function MCTPopup($compile, popupService) {
|
function MCTPopup($compile, popupService) {
|
||||||
function link(scope, element, attrs, ctrl, transclude) {
|
function link(scope, element, attrs, ctrl, transclude) {
|
||||||
var div = $compile(TEMPLATE)(scope),
|
var div = $compile(TEMPLATE)(scope);
|
||||||
rect = element.parent()[0].getBoundingClientRect(),
|
var rect = element.parent()[0].getBoundingClientRect();
|
||||||
position = [rect.left, rect.top],
|
var position = [rect.left, rect.top];
|
||||||
popup = popupService.display(div, position);
|
var popup = popupService.display(div, position);
|
||||||
|
|
||||||
div.addClass('t-popup');
|
div.addClass('t-popup');
|
||||||
transclude(function (clone) {
|
transclude(function (clone) {
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ define(
|
|||||||
|
|
||||||
// Link; start listening for changes to an element's size
|
// Link; start listening for changes to an element's size
|
||||||
function link(scope, element, attrs) {
|
function link(scope, element, attrs) {
|
||||||
var lastBounds,
|
var lastBounds;
|
||||||
linking = true,
|
var linking = true;
|
||||||
active = true;
|
var active = true;
|
||||||
|
|
||||||
// Determine how long to wait before the next update
|
// Determine how long to wait before the next update
|
||||||
function currentInterval() {
|
function currentInterval() {
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ define(
|
|||||||
*/
|
*/
|
||||||
function MCTScroll($parse, property, attribute) {
|
function MCTScroll($parse, property, attribute) {
|
||||||
function link(scope, element, attrs) {
|
function link(scope, element, attrs) {
|
||||||
var expr = attrs[attribute],
|
var expr = attrs[attribute];
|
||||||
parsed = $parse(expr);
|
var parsed = $parse(expr);
|
||||||
|
|
||||||
// Set the element's scroll to match the scope's state
|
// Set the element's scroll to match the scope's state
|
||||||
function updateElement(value) {
|
function updateElement(value) {
|
||||||
|
|||||||
@@ -25,47 +25,47 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
|
|
||||||
// Pixel width to allocate for the splitter itself
|
// Pixel width to allocate for the splitter itself
|
||||||
var DEFAULT_ANCHOR = 'left',
|
var DEFAULT_ANCHOR = 'left';
|
||||||
POLLING_INTERVAL = 15, // milliseconds
|
var POLLING_INTERVAL = 15; // milliseconds
|
||||||
CHILDREN_WARNING_MESSAGE = [
|
var CHILDREN_WARNING_MESSAGE = [
|
||||||
"Invalid mct-split-pane contents.",
|
"Invalid mct-split-pane contents.",
|
||||||
"This element should contain exactly three",
|
"This element should contain exactly three",
|
||||||
"child elements, where the middle-most element",
|
"child elements, where the middle-most element",
|
||||||
"is an mct-splitter."
|
"is an mct-splitter."
|
||||||
].join(" "),
|
].join(" ");
|
||||||
ANCHOR_WARNING_MESSAGE = [
|
var ANCHOR_WARNING_MESSAGE = [
|
||||||
"Unknown anchor provided to mct-split-pane,",
|
"Unknown anchor provided to mct-split-pane;",
|
||||||
"defaulting to",
|
"defaulting to",
|
||||||
DEFAULT_ANCHOR + "."
|
DEFAULT_ANCHOR + "."
|
||||||
].join(" "),
|
].join(" ");
|
||||||
ANCHORS = {
|
var ANCHORS = {
|
||||||
left: {
|
left: {
|
||||||
edge: "left",
|
edge: "left",
|
||||||
opposite: "right",
|
opposite: "right",
|
||||||
dimension: "width",
|
dimension: "width",
|
||||||
orientation: "vertical"
|
orientation: "vertical"
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
edge: "right",
|
edge: "right",
|
||||||
opposite: "left",
|
opposite: "left",
|
||||||
dimension: "width",
|
dimension: "width",
|
||||||
orientation: "vertical",
|
orientation: "vertical",
|
||||||
reversed: true
|
reversed: true
|
||||||
},
|
},
|
||||||
top: {
|
top: {
|
||||||
edge: "top",
|
edge: "top",
|
||||||
opposite: "bottom",
|
opposite: "bottom",
|
||||||
dimension: "height",
|
dimension: "height",
|
||||||
orientation: "horizontal"
|
orientation: "horizontal"
|
||||||
},
|
},
|
||||||
bottom: {
|
bottom: {
|
||||||
edge: "bottom",
|
edge: "bottom",
|
||||||
opposite: "top",
|
opposite: "top",
|
||||||
dimension: "height",
|
dimension: "height",
|
||||||
orientation: "horizontal",
|
orientation: "horizontal",
|
||||||
reversed: true
|
reversed: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements `mct-split-pane` directive.
|
* Implements `mct-split-pane` directive.
|
||||||
@@ -95,19 +95,19 @@ define(
|
|||||||
*/
|
*/
|
||||||
function MCTSplitPane($parse, $log, $interval, $window) {
|
function MCTSplitPane($parse, $log, $interval, $window) {
|
||||||
function controller($scope, $element, $attrs) {
|
function controller($scope, $element, $attrs) {
|
||||||
var anchorKey = $attrs.anchor || DEFAULT_ANCHOR,
|
var anchorKey = $attrs.anchor || DEFAULT_ANCHOR;
|
||||||
positionParsed = $parse($attrs.position),
|
var positionParsed = $parse($attrs.position);
|
||||||
anchor,
|
var anchor;
|
||||||
activeInterval,
|
var activeInterval;
|
||||||
position,
|
var position;
|
||||||
splitterSize,
|
var splitterSize;
|
||||||
|
|
||||||
alias = $attrs.alias !== undefined ?
|
var alias = $attrs.alias !== undefined ?
|
||||||
"mctSplitPane-" + $attrs.alias : undefined,
|
"mctSplitPane-" + $attrs.alias : undefined;
|
||||||
|
|
||||||
//convert string to number from localStorage
|
//convert string to number from localStorage
|
||||||
userWidthPreference = $window.localStorage.getItem(alias) === null ?
|
var userWidthPreference = $window.localStorage.getItem(alias) === null ?
|
||||||
undefined : Number($window.localStorage.getItem(alias));
|
undefined : Number($window.localStorage.getItem(alias));
|
||||||
|
|
||||||
// Get relevant size (height or width) of DOM element
|
// Get relevant size (height or width) of DOM element
|
||||||
function getSize(domElement) {
|
function getSize(domElement) {
|
||||||
@@ -121,10 +121,10 @@ define(
|
|||||||
|
|
||||||
// Pick out correct elements to update, flowing from
|
// Pick out correct elements to update, flowing from
|
||||||
// selected anchor edge.
|
// selected anchor edge.
|
||||||
var first = children.eq(anchor.reversed ? 2 : 0),
|
var first = children.eq(anchor.reversed ? 2 : 0);
|
||||||
splitter = children.eq(1),
|
var splitter = children.eq(1);
|
||||||
last = children.eq(anchor.reversed ? 0 : 2),
|
var last = children.eq(anchor.reversed ? 0 : 2);
|
||||||
firstSize;
|
var firstSize;
|
||||||
|
|
||||||
splitterSize = getSize(splitter[0]);
|
splitterSize = getSize(splitter[0]);
|
||||||
first.css(anchor.edge, "0px");
|
first.css(anchor.edge, "0px");
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ define(
|
|||||||
*/
|
*/
|
||||||
function MCTSplitter() {
|
function MCTSplitter() {
|
||||||
function link(scope, element, attrs, mctSplitPane) {
|
function link(scope, element, attrs, mctSplitPane) {
|
||||||
var initialPosition,
|
var initialPosition;
|
||||||
newPosition;
|
var newPosition;
|
||||||
|
|
||||||
element.addClass("splitter");
|
element.addClass("splitter");
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ define(
|
|||||||
},
|
},
|
||||||
// Handle user changes to splitter position
|
// Handle user changes to splitter position
|
||||||
move: function (delta) {
|
move: function (delta) {
|
||||||
var anchor = mctSplitPane.anchor(),
|
var anchor = mctSplitPane.anchor();
|
||||||
index = anchor.orientation === "vertical" ? 0 : 1,
|
var index = anchor.orientation === "vertical" ? 0 : 1;
|
||||||
pixelDelta = delta[index] *
|
var pixelDelta = delta[index] *
|
||||||
(anchor.reversed ? -1 : 1);
|
(anchor.reversed ? -1 : 1);
|
||||||
|
|
||||||
// Update the position of this splitter
|
// Update the position of this splitter
|
||||||
|
|||||||
@@ -75,13 +75,13 @@ define(
|
|||||||
* @returns {platform/commonUI/general.Popup} the popup
|
* @returns {platform/commonUI/general.Popup} the popup
|
||||||
*/
|
*/
|
||||||
PopupService.prototype.display = function (element, position, options) {
|
PopupService.prototype.display = function (element, position, options) {
|
||||||
var $document = this.$document,
|
var $document = this.$document;
|
||||||
$window = this.$window,
|
var $window = this.$window;
|
||||||
body = $document.find('body'),
|
var body = $document.find('body');
|
||||||
winDim = [$window.innerWidth, $window.innerHeight],
|
var winDim = [$window.innerWidth, $window.innerHeight];
|
||||||
styles = { position: 'absolute' },
|
var styles = { position: 'absolute' };
|
||||||
margin,
|
var margin;
|
||||||
offset;
|
var offset;
|
||||||
|
|
||||||
function adjustNegatives(value, index) {
|
function adjustNegatives(value, index) {
|
||||||
return value < 0 ? (value + winDim[index]) : value;
|
return value < 0 ? (value + winDim[index]) : value;
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ define(
|
|||||||
*/
|
*/
|
||||||
UrlService.prototype.urlForLocation = function (mode, domainObject) {
|
UrlService.prototype.urlForLocation = function (mode, domainObject) {
|
||||||
var context = domainObject &&
|
var context = domainObject &&
|
||||||
domainObject.getCapability('context'),
|
domainObject.getCapability('context');
|
||||||
objectPath = context ? context.getPath() : [],
|
var objectPath = context ? context.getPath() : [];
|
||||||
ids = objectPath.map(function (domainObj) {
|
var ids = objectPath.map(function (domainObj) {
|
||||||
return domainObj.getId();
|
return domainObj.getId();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Parses the path together. Starts with the
|
// Parses the path together. Starts with the
|
||||||
// default index.html file, then the mode passed
|
// default index.html file, then the mode passed
|
||||||
@@ -73,15 +73,15 @@ define(
|
|||||||
* @returns {string} URL for the domain object
|
* @returns {string} URL for the domain object
|
||||||
*/
|
*/
|
||||||
UrlService.prototype.urlForNewTab = function (mode, domainObject) {
|
UrlService.prototype.urlForNewTab = function (mode, domainObject) {
|
||||||
var search = this.$location.search(),
|
var search = this.$location.search();
|
||||||
arr = [];
|
var arr = [];
|
||||||
for (var key in search) {
|
for (var key in search) {
|
||||||
if (search.hasOwnProperty(key)) {
|
if (search.hasOwnProperty(key)) {
|
||||||
arr.push(key + '=' + search[key]);
|
arr.push(key + '=' + search[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var searchPath = "?" + arr.join('&'),
|
var searchPath = "?" + arr.join('&');
|
||||||
newTabPath =
|
var newTabPath =
|
||||||
"#" + this.urlForLocation(mode, domainObject) +
|
"#" + this.urlForLocation(mode, domainObject) +
|
||||||
searchPath;
|
searchPath;
|
||||||
return newTabPath;
|
return newTabPath;
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
TreeLabelView.prototype.updateView = function (domainObject) {
|
TreeLabelView.prototype.updateView = function (domainObject) {
|
||||||
var titleEl = this.el.find('.t-title-label'),
|
var titleEl = this.el.find('.t-title-label');
|
||||||
iconEl = this.el.find('.t-item-icon');
|
var iconEl = this.el.find('.t-item-icon');
|
||||||
|
|
||||||
removePreviousIconClass(iconEl);
|
removePreviousIconClass(iconEl);
|
||||||
|
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
TreeNodeView.prototype.value = function (domainObject) {
|
TreeNodeView.prototype.value = function (domainObject) {
|
||||||
var activeIdPath = getIdPath(this.activeObject),
|
var activeIdPath = getIdPath(this.activeObject);
|
||||||
selectedIdPath = getIdPath(domainObject);
|
var selectedIdPath = getIdPath(domainObject);
|
||||||
|
|
||||||
if (this.onSelectionPath) {
|
if (this.onSelectionPath) {
|
||||||
this.li.find('.js-tree__item').eq(0).removeClass('is-selected');
|
this.li.find('.js-tree__item').eq(0).removeClass('is-selected');
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user