mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 18:50:11 +00:00
Compare commits
217 Commits
notebook-a
...
feature/th
Author | SHA1 | Date | |
---|---|---|---|
adde8f5b3a | |||
8a29387077 | |||
14a0f84c1b | |||
14ce5e159b | |||
c51fd21847 | |||
72e382c46a | |||
8825a458dc | |||
cab51f2665 | |||
c6f83dea8d | |||
6e2497461a | |||
bdd55b3db0 | |||
700ca90c8e | |||
360881cf66 | |||
a4c2e944b3 | |||
93abb09419 | |||
e58e9d3a26 | |||
527c5ec7dd | |||
286d6e5082 | |||
fab8bb516a | |||
6d526eaf42 | |||
8b715f331c | |||
d6950a0976 | |||
68f3436792 | |||
4414161faf | |||
7477536478 | |||
2dd7307fce | |||
6b2f2b758d | |||
c13b07e648 | |||
2ecff75da5 | |||
ff5b88b544 | |||
9b7a986475 | |||
c054914a9c | |||
69b6f8afa9 | |||
45164a2f68 | |||
b189a887e6 | |||
71abfbc336 | |||
ee690545fb | |||
fcf3c76aa1 | |||
5dbd77d10c | |||
43515ca84e | |||
54fe881e71 | |||
7c32700b69 | |||
e98d0cc7c5 | |||
2200503e48 | |||
8f0081acc8 | |||
003c3e9fbe | |||
02ef58ced1 | |||
e89881c266 | |||
fa66289d5c | |||
4f3a3befe0 | |||
a0864a8702 | |||
a34ad4e58c | |||
7e50010463 | |||
974be0ae2c | |||
3dc6dac12d | |||
aafe524454 | |||
e84ade1752 | |||
3b094e43e3 | |||
e6a7b4ed6c | |||
97230bb21f | |||
768d99d928 | |||
c760190a29 | |||
7fe4a77c43 | |||
8578d78c51 | |||
362e565a09 | |||
9517c1f2cd | |||
262d35804d | |||
e0587bf0e7 | |||
f1494fd285 | |||
884aec8ea0 | |||
216f447578 | |||
c38d810658 | |||
f5c48b7bf6 | |||
d0e08f1d9a | |||
72ea7b80fd | |||
35d0c02bc5 | |||
abd7506b45 | |||
526b4aa07e | |||
b5e23963d4 | |||
2c11eb90d4 | |||
90e9c79e19 | |||
1b83631e43 | |||
547d4e82db | |||
3377ad5e0d | |||
1c0df60f05 | |||
138067dca9 | |||
844280eaa5 | |||
d2e2d55caf | |||
f01d4071a1 | |||
06524ce967 | |||
1ec529f360 | |||
cf6458c69d | |||
3316500774 | |||
0f780587c0 | |||
ea69508e22 | |||
4274d8cc0b | |||
1a2048332f | |||
38a875395f | |||
f601ab03e7 | |||
ee1d92d4a9 | |||
548286bacd | |||
9c9006d415 | |||
3219a64d09 | |||
570aa2c02a | |||
c577d2e231 | |||
6bf4b3aba8 | |||
b659f205f7 | |||
40d54df567 | |||
b7fa5c7ba8 | |||
3b0605d17b | |||
d93e7bfd1a | |||
104cd0ed29 | |||
7fb3d86d06 | |||
dbb42e9bb6 | |||
d1baa1f98b | |||
5ab68c0586 | |||
3cf78f509d | |||
c6053e234a | |||
964c326535 | |||
baf410a364 | |||
517a40a32b | |||
8b275b206b | |||
a40a31aa4c | |||
6c0c1df010 | |||
c552afff17 | |||
0837129ad5 | |||
6f3e2a8fbb | |||
4189a05758 | |||
97ccaa58c7 | |||
08ef932926 | |||
1d2ed0398c | |||
5a00e0c549 | |||
ebcf47733f | |||
381d7e7615 | |||
8246b47668 | |||
bc5e300ba9 | |||
57efef3160 | |||
dfc5a9f040 | |||
57443d227d | |||
d36441db73 | |||
327782835e | |||
994f6be535 | |||
72fc8a24a5 | |||
07002c12eb | |||
c688d19e15 | |||
c0ce448dc3 | |||
6c479d6d59 | |||
76ba487261 | |||
e3f4da19f9 | |||
c7ffcbf7e0 | |||
a27b3737f1 | |||
78dccf1e0a | |||
9cb7e09aef | |||
4111c12895 | |||
b6ec023920 | |||
e8e7067993 | |||
0e9319e97b | |||
df53af7b4d | |||
bcbf244fd2 | |||
7ff5febae0 | |||
019d108bb2 | |||
a14f628ca3 | |||
6116351dad | |||
23efef4469 | |||
95549f7be2 | |||
6338bd1168 | |||
f7d0d2c166 | |||
7c2e10ba0e | |||
350d3c92e7 | |||
0f2918efaf | |||
b72ad529aa | |||
f77c6c821c | |||
248f160e73 | |||
5151f90bb8 | |||
402062110d | |||
1c8f23dea1 | |||
5ee22b3481 | |||
322a7bd5a8 | |||
0e30fba72d | |||
1c77ef142c | |||
853764d863 | |||
d0ab59f9da | |||
21e08709cb | |||
a1aa99837b | |||
037264b0bf | |||
1a06702dbe | |||
666bb41697 | |||
e254fafb5c | |||
1dc1cc6c24 | |||
baa5d10009 | |||
ac2b9acccb | |||
075d4deecb | |||
ac11f898d4 | |||
dd31de6935 | |||
9e811e722f | |||
8ef53d85c4 | |||
abcc5cb023 | |||
931871ff95 | |||
6b1e8862ef | |||
00ce246fc5 | |||
c0c7d96429 | |||
92b2582d0d | |||
4084a1ac86 | |||
cb1a1c2616 | |||
ce6c1f173e | |||
30a4888363 | |||
b0917a9866 | |||
464e5de947 | |||
47a07da17d | |||
ec4c443299 | |||
3122168b0e | |||
da3af4b3db | |||
850fa28bf6 | |||
270684c5fd | |||
afa1589cb5 | |||
18a94d938f | |||
d026bc2134 |
44
.eslintrc.js
44
.eslintrc.js
@ -5,9 +5,16 @@ module.exports = {
|
||||
"jasmine": true,
|
||||
"amd": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parser": "babel-eslint",
|
||||
"globals": {
|
||||
"_": "readonly"
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:vue/recommended"
|
||||
],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint",
|
||||
"allowImportExportEverywhere": true,
|
||||
"ecmaVersion": 2015,
|
||||
"ecmaFeatures": {
|
||||
@ -58,7 +65,38 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
"dot-notation": "error",
|
||||
"indent": ["error", 4]
|
||||
"indent": ["error", 4],
|
||||
"vue/html-indent": [
|
||||
"error",
|
||||
4,
|
||||
{
|
||||
"attribute": 1,
|
||||
"baseIndent": 0,
|
||||
"closeBracket": 0,
|
||||
"alignAttributesVertically": true,
|
||||
"ignores": []
|
||||
}
|
||||
],
|
||||
"vue/html-self-closing": ["error",
|
||||
{
|
||||
"html": {
|
||||
"void": "never",
|
||||
"normal": "never",
|
||||
"component": "always"
|
||||
},
|
||||
"svg": "always",
|
||||
"math": "always"
|
||||
}
|
||||
],
|
||||
"vue/max-attributes-per-line": ["error", {
|
||||
"singleline": 1,
|
||||
"multiline": {
|
||||
"max": 1,
|
||||
"allowFirstLine": true
|
||||
}
|
||||
}],
|
||||
"vue/multiline-html-element-content-newline": "off",
|
||||
"vue/singleline-html-element-content-newline": "off"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
@ -22,59 +22,60 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/EventTelemetryProvider",
|
||||
'legacyRegistry'
|
||||
"./src/EventTelemetryProvider"
|
||||
], function (
|
||||
EventTelemetryProvider,
|
||||
legacyRegistry
|
||||
EventTelemetryProvider
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/eventGenerator", {
|
||||
"name": "Event Message Generator",
|
||||
"description": "For development use. Creates sample event message data that mimics a live data stream.",
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"implementation": EventTelemetryProvider,
|
||||
"type": "provider",
|
||||
"provides": "telemetryService",
|
||||
"depends": [
|
||||
"$q",
|
||||
"$timeout"
|
||||
]
|
||||
}
|
||||
],
|
||||
"types": [
|
||||
{
|
||||
"key": "eventGenerator",
|
||||
"name": "Event Message Generator",
|
||||
"cssClass": "icon-generator-events",
|
||||
"description": "For development use. Creates sample event message data that mimics a live data stream.",
|
||||
"priority": 10,
|
||||
"features": "creation",
|
||||
"model": {
|
||||
"telemetry": {}
|
||||
},
|
||||
"telemetry": {
|
||||
"source": "eventGenerator",
|
||||
"domains": [
|
||||
{
|
||||
"key": "utc",
|
||||
"name": "Timestamp",
|
||||
"format": "utc"
|
||||
}
|
||||
],
|
||||
"ranges": [
|
||||
{
|
||||
"key": "message",
|
||||
"name": "Message",
|
||||
"format": "string"
|
||||
}
|
||||
return {
|
||||
name:"example/eventGenerator",
|
||||
definition: {
|
||||
"name": "Event Message Generator",
|
||||
"description": "For development use. Creates sample event message data that mimics a live data stream.",
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"implementation": EventTelemetryProvider,
|
||||
"type": "provider",
|
||||
"provides": "telemetryService",
|
||||
"depends": [
|
||||
"$q",
|
||||
"$timeout"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"types": [
|
||||
{
|
||||
"key": "eventGenerator",
|
||||
"name": "Event Message Generator",
|
||||
"cssClass": "icon-generator-events",
|
||||
"description": "For development use. Creates sample event message data that mimics a live data stream.",
|
||||
"priority": 10,
|
||||
"features": "creation",
|
||||
"model": {
|
||||
"telemetry": {}
|
||||
},
|
||||
"telemetry": {
|
||||
"source": "eventGenerator",
|
||||
"domains": [
|
||||
{
|
||||
"key": "utc",
|
||||
"name": "Timestamp",
|
||||
"format": "utc"
|
||||
}
|
||||
],
|
||||
"ranges": [
|
||||
{
|
||||
"key": "message",
|
||||
"name": "Message",
|
||||
"format": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -48,11 +48,11 @@ define(
|
||||
(domain !== 'delta' ? firstObservedTime : 0);
|
||||
};
|
||||
|
||||
generatorData.getRangeValue = function (i, range) {
|
||||
var domainDelta = this.getDomainValue(i) - firstObservedTime,
|
||||
generatorData.getRangeValue = function (i, range) {
|
||||
var domainDelta = this.getDomainValue(i) - firstObservedTime,
|
||||
ind = i % messages.length;
|
||||
return messages[ind] + " - [" + domainDelta.toString() + "]";
|
||||
};
|
||||
};
|
||||
|
||||
return generatorData;
|
||||
}
|
||||
|
@ -34,11 +34,9 @@ define(
|
||||
* @constructor
|
||||
*/
|
||||
function EventTelemetryProvider($q, $timeout) {
|
||||
var
|
||||
subscriptions = [],
|
||||
genInterval = 1000,
|
||||
generating = false,
|
||||
id = Math.random() * 100000;
|
||||
var subscriptions = [],
|
||||
genInterval = 1000,
|
||||
generating = false;
|
||||
|
||||
//
|
||||
function matchesSource(request) {
|
||||
@ -47,7 +45,6 @@ define(
|
||||
|
||||
// Used internally; this will be repacked by doPackage
|
||||
function generateData(request) {
|
||||
//console.log("generateData " + (Date.now() - startTime).toString());
|
||||
return {
|
||||
key: request.key,
|
||||
telemetry: new EventTelemetry(request, genInterval)
|
||||
|
@ -58,15 +58,15 @@ define([], function () {
|
||||
row,
|
||||
i;
|
||||
|
||||
function copyDomainsToRow(row, index) {
|
||||
function copyDomainsToRow(telemetryRow, index) {
|
||||
domains.forEach(function (domain) {
|
||||
row[domain.name] = series.getDomainValue(index, domain.key);
|
||||
telemetryRow[domain.name] = series.getDomainValue(index, domain.key);
|
||||
});
|
||||
}
|
||||
|
||||
function copyRangesToRow(row, index) {
|
||||
function copyRangesToRow(telemetryRow, index) {
|
||||
ranges.forEach(function (range) {
|
||||
row[range.name] = series.getRangeValue(index, range.key);
|
||||
telemetryRow[range.name] = series.getRangeValue(index, range.key);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -22,24 +22,26 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'legacyRegistry',
|
||||
'./ExportTelemetryAsCSVAction'
|
||||
], function (legacyRegistry, ExportTelemetryAsCSVAction) {
|
||||
], function (ExportTelemetryAsCSVAction) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/export", {
|
||||
"name": "Example of using CSV Export",
|
||||
"extensions": {
|
||||
"actions": [
|
||||
{
|
||||
"key": "example.export",
|
||||
"name": "Export Telemetry as CSV",
|
||||
"implementation": ExportTelemetryAsCSVAction,
|
||||
"category": "contextual",
|
||||
"cssClass": "icon-download",
|
||||
"depends": [ "exportService" ]
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/export",
|
||||
definition: {
|
||||
"name": "Example of using CSV Export",
|
||||
"extensions": {
|
||||
"actions": [
|
||||
{
|
||||
"key": "example.export",
|
||||
"name": "Export Telemetry as CSV",
|
||||
"implementation": ExportTelemetryAsCSVAction,
|
||||
"category": "contextual",
|
||||
"cssClass": "icon-download",
|
||||
"depends": ["exportService"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -22,32 +22,33 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ExampleFormController",
|
||||
'legacyRegistry'
|
||||
"./src/ExampleFormController"
|
||||
], function (
|
||||
ExampleFormController,
|
||||
legacyRegistry
|
||||
ExampleFormController
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/forms", {
|
||||
"name": "Declarative Forms example",
|
||||
"sources": "src",
|
||||
"extensions": {
|
||||
"controllers": [
|
||||
{
|
||||
"key": "ExampleFormController",
|
||||
"implementation": ExampleFormController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"templateUrl": "templates/exampleForm.html"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/forms",
|
||||
definition: {
|
||||
"name": "Declarative Forms example",
|
||||
"sources": "src",
|
||||
"extensions": {
|
||||
"controllers": [
|
||||
{
|
||||
"key": "ExampleFormController",
|
||||
"implementation": ExampleFormController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"templateUrl": "templates/exampleForm.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -99,10 +99,10 @@ define([
|
||||
|
||||
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
return _.extend(
|
||||
{},
|
||||
domainObject.telemetry,
|
||||
METADATA_BY_TYPE[domainObject.type]
|
||||
);
|
||||
{},
|
||||
domainObject.telemetry,
|
||||
METADATA_BY_TYPE[domainObject.type]
|
||||
);
|
||||
};
|
||||
|
||||
return GeneratorMetadataProvider;
|
||||
|
@ -52,7 +52,7 @@ define([
|
||||
'period',
|
||||
'offset',
|
||||
'dataRateInHz',
|
||||
'phase',
|
||||
'phase'
|
||||
];
|
||||
|
||||
request = request || {};
|
||||
|
@ -28,7 +28,7 @@ define([
|
||||
) {
|
||||
|
||||
var RED = {
|
||||
sin: 0.9,
|
||||
sin: 0.9,
|
||||
cos: 0.9
|
||||
},
|
||||
YELLOW = {
|
||||
@ -37,25 +37,25 @@ define([
|
||||
},
|
||||
LIMITS = {
|
||||
rh: {
|
||||
cssClass: "s-limit-upr s-limit-red",
|
||||
cssClass: "is-limit--upr is-limit--red",
|
||||
low: RED,
|
||||
high: Number.POSITIVE_INFINITY,
|
||||
name: "Red High"
|
||||
},
|
||||
rl: {
|
||||
cssClass: "s-limit-lwr s-limit-red",
|
||||
cssClass: "is-limit--lwr is-limit--red",
|
||||
high: -RED,
|
||||
low: Number.NEGATIVE_INFINITY,
|
||||
name: "Red Low"
|
||||
},
|
||||
yh: {
|
||||
cssClass: "s-limit-upr s-limit-yellow",
|
||||
cssClass: "is-limit--upr is-limit--yellow",
|
||||
low: YELLOW,
|
||||
high: RED,
|
||||
name: "Yellow High"
|
||||
},
|
||||
yl: {
|
||||
cssClass: "s-limit-lwr s-limit-yellow",
|
||||
cssClass: "is-limit--lwr is-limit--yellow",
|
||||
low: -RED,
|
||||
high: -YELLOW,
|
||||
name: "Yellow Low"
|
||||
@ -74,7 +74,7 @@ define([
|
||||
return {
|
||||
evaluate: function (datum, valueMetadata) {
|
||||
var range = valueMetadata && valueMetadata.key;
|
||||
|
||||
|
||||
if (datum[range] > RED[range]) {
|
||||
return LIMITS.rh;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ define([
|
||||
WorkerInterface.prototype.subscribe = function (request, cb) {
|
||||
function callback(message) {
|
||||
cb(message.data);
|
||||
};
|
||||
}
|
||||
|
||||
var messageId = this.dispatch('subscribe', request, callback);
|
||||
|
||||
|
@ -84,10 +84,10 @@
|
||||
|
||||
function onRequest(message) {
|
||||
var request = message.data;
|
||||
if (request.end == undefined) {
|
||||
if (request.end === undefined) {
|
||||
request.end = Date.now();
|
||||
}
|
||||
if (request.start == undefined){
|
||||
if (request.start === undefined) {
|
||||
request.start = request.end - FIFTEEN_MINUTES;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ define([
|
||||
GeneratorMetadataProvider
|
||||
) {
|
||||
|
||||
return function(openmct){
|
||||
return function (openmct) {
|
||||
|
||||
openmct.types.addType("example.state-generator", {
|
||||
name: "State Generator",
|
||||
@ -43,15 +43,14 @@ define([
|
||||
form: [
|
||||
{
|
||||
name: "State Duration (seconds)",
|
||||
control: "textfield",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "duration",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"duration"
|
||||
],
|
||||
pattern: "^\\d*(\\.\\d*)?$"
|
||||
]
|
||||
}
|
||||
],
|
||||
initialize: function (object) {
|
||||
|
@ -22,27 +22,28 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ExampleIdentityService",
|
||||
'legacyRegistry'
|
||||
"./src/ExampleIdentityService"
|
||||
], function (
|
||||
ExampleIdentityService,
|
||||
legacyRegistry
|
||||
ExampleIdentityService
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/identity", {
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"implementation": ExampleIdentityService,
|
||||
"provides": "identityService",
|
||||
"type": "provider",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"$q"
|
||||
]
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/identity",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"implementation": ExampleIdentityService,
|
||||
"provides": "identityService",
|
||||
"type": "provider",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"$q"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -22,31 +22,31 @@
|
||||
|
||||
define([
|
||||
|
||||
], function(
|
||||
], function (
|
||||
|
||||
) {
|
||||
function ImageryPlugin() {
|
||||
|
||||
var IMAGE_SAMPLES = [
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18731.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18732.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18733.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18734.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18735.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18736.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18737.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18738.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18739.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18740.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18741.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18742.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18743.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18744.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18745.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18746.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18747.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18748.jpg"
|
||||
];
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18731.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18732.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18733.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18734.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18735.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18736.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18737.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18738.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18739.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18740.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18741.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18742.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18743.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18744.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18745.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18746.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18747.jpg",
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18748.jpg"
|
||||
];
|
||||
|
||||
function pointForTimestamp(timestamp, name) {
|
||||
return {
|
||||
@ -65,7 +65,7 @@ define([
|
||||
callback(pointForTimestamp(Date.now(), domainObject.name));
|
||||
}, 5000);
|
||||
|
||||
return function (interval) {
|
||||
return function () {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}
|
||||
|
@ -21,25 +21,22 @@
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
|
||||
'legacyRegistry'
|
||||
], function (
|
||||
|
||||
legacyRegistry
|
||||
) {
|
||||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/mobile", {
|
||||
"name": "Mobile",
|
||||
"description": "Allows elements with pertinence to mobile usage and development",
|
||||
"extensions": {
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/mobile-example.css",
|
||||
"priority": "mandatory"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/mobile",
|
||||
definition: {
|
||||
"name": "Mobile",
|
||||
"description": "Allows elements with pertinence to mobile usage and development",
|
||||
"extensions": {
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/mobile-example.css",
|
||||
"priority": "mandatory"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -24,92 +24,92 @@
|
||||
define([
|
||||
"./src/RemsTelemetryServerAdapter",
|
||||
"./src/RemsTelemetryModelProvider",
|
||||
"./src/RemsTelemetryProvider",
|
||||
'legacyRegistry',
|
||||
"module"
|
||||
"./src/RemsTelemetryProvider"
|
||||
], function (
|
||||
RemsTelemetryServerAdapter,
|
||||
RemsTelemetryModelProvider,
|
||||
RemsTelemetryProvider,
|
||||
legacyRegistry
|
||||
RemsTelemetryProvider
|
||||
) {
|
||||
"use strict";
|
||||
legacyRegistry.register("example/msl", {
|
||||
"name" : "Mars Science Laboratory Data Adapter",
|
||||
"extensions" : {
|
||||
"types": [
|
||||
{
|
||||
"name":"Mars Science Laboratory",
|
||||
"key": "msl.curiosity",
|
||||
"cssClass": "icon-object"
|
||||
},
|
||||
{
|
||||
"name": "Instrument",
|
||||
"key": "msl.instrument",
|
||||
"cssClass": "icon-object",
|
||||
"model": {"composition": []}
|
||||
},
|
||||
{
|
||||
"name": "Measurement",
|
||||
"key": "msl.measurement",
|
||||
"cssClass": "icon-telemetry",
|
||||
"model": {"telemetry": {}},
|
||||
"telemetry": {
|
||||
"source": "rems.source",
|
||||
"domains": [
|
||||
{
|
||||
"name": "Time",
|
||||
"key": "utc",
|
||||
"format": "utc"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/msl",
|
||||
definition: {
|
||||
"name" : "Mars Science Laboratory Data Adapter",
|
||||
"extensions" : {
|
||||
"types": [
|
||||
{
|
||||
"name":"Mars Science Laboratory",
|
||||
"key": "msl.curiosity",
|
||||
"cssClass": "icon-object"
|
||||
},
|
||||
{
|
||||
"name": "Instrument",
|
||||
"key": "msl.instrument",
|
||||
"cssClass": "icon-object",
|
||||
"model": {"composition": []}
|
||||
},
|
||||
{
|
||||
"name": "Measurement",
|
||||
"key": "msl.measurement",
|
||||
"cssClass": "icon-telemetry",
|
||||
"model": {"telemetry": {}},
|
||||
"telemetry": {
|
||||
"source": "rems.source",
|
||||
"domains": [
|
||||
{
|
||||
"name": "Time",
|
||||
"key": "utc",
|
||||
"format": "utc"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "REMS_WS_URL",
|
||||
"value": "/proxyUrl?url=http://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php"
|
||||
}
|
||||
],
|
||||
"roots": [
|
||||
{
|
||||
"id": "msl:curiosity"
|
||||
}
|
||||
],
|
||||
"models": [
|
||||
{
|
||||
"id": "msl:curiosity",
|
||||
"priority": "preferred",
|
||||
"model": {
|
||||
"type": "msl.curiosity",
|
||||
"name": "Mars Science Laboratory",
|
||||
"composition": ["msl_tlm:rems"]
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "REMS_WS_URL",
|
||||
"value": "/proxyUrl?url=http://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php"
|
||||
}
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key":"rems.adapter",
|
||||
"implementation": RemsTelemetryServerAdapter,
|
||||
"depends": ["$http", "$log", "REMS_WS_URL"]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"provides": "modelService",
|
||||
"type": "provider",
|
||||
"implementation": RemsTelemetryModelProvider,
|
||||
"depends": ["rems.adapter"]
|
||||
},
|
||||
{
|
||||
"provides": "telemetryService",
|
||||
"type": "provider",
|
||||
"implementation": RemsTelemetryProvider,
|
||||
"depends": ["rems.adapter", "$q"]
|
||||
}
|
||||
]
|
||||
],
|
||||
"roots": [
|
||||
{
|
||||
"id": "msl:curiosity"
|
||||
}
|
||||
],
|
||||
"models": [
|
||||
{
|
||||
"id": "msl:curiosity",
|
||||
"priority": "preferred",
|
||||
"model": {
|
||||
"type": "msl.curiosity",
|
||||
"name": "Mars Science Laboratory",
|
||||
"composition": ["msl_tlm:rems"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key":"rems.adapter",
|
||||
"implementation": RemsTelemetryServerAdapter,
|
||||
"depends": ["$http", "$log", "REMS_WS_URL"]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"provides": "modelService",
|
||||
"type": "provider",
|
||||
"implementation": RemsTelemetryModelProvider,
|
||||
"depends": ["rems.adapter"]
|
||||
},
|
||||
{
|
||||
"provides": "telemetryService",
|
||||
"type": "provider",
|
||||
"implementation": RemsTelemetryProvider,
|
||||
"depends": ["rems.adapter", "$q"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -76,4 +76,4 @@ define(
|
||||
]
|
||||
};
|
||||
}
|
||||
);
|
||||
);
|
||||
|
@ -22,7 +22,7 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
function (){
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var PREFIX = "msl_tlm:",
|
||||
@ -32,20 +32,20 @@ define(
|
||||
string: "string"
|
||||
};
|
||||
|
||||
function RemsTelemetryModelProvider(adapter){
|
||||
function RemsTelemetryModelProvider(adapter) {
|
||||
|
||||
function isRelevant(id) {
|
||||
return id.indexOf(PREFIX) === 0;
|
||||
}
|
||||
|
||||
function makeId(element){
|
||||
function makeId(element) {
|
||||
return PREFIX + element.identifier;
|
||||
}
|
||||
|
||||
function buildTaxonomy(dictionary){
|
||||
function buildTaxonomy(dictionary) {
|
||||
var models = {};
|
||||
|
||||
function addMeasurement(measurement, parent){
|
||||
function addMeasurement(measurement, parent) {
|
||||
var format = FORMAT_MAPPINGS[measurement.type];
|
||||
models[makeId(measurement)] = {
|
||||
type: "msl.measurement",
|
||||
@ -73,12 +73,12 @@ define(
|
||||
location: spacecraftId,
|
||||
composition: measurements.map(makeId)
|
||||
};
|
||||
measurements.forEach(function(measurement) {
|
||||
measurements.forEach(function (measurement) {
|
||||
addMeasurement(measurement, instrumentId);
|
||||
});
|
||||
}
|
||||
|
||||
(dictionary.instruments || []).forEach(function(instrument) {
|
||||
(dictionary.instruments || []).forEach(function (instrument) {
|
||||
addInstrument(instrument, "msl:curiosity");
|
||||
});
|
||||
return models;
|
||||
|
@ -72,10 +72,10 @@ define (
|
||||
* This data source does not support real-time subscriptions
|
||||
*/
|
||||
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
|
||||
return function() {};
|
||||
return function () {};
|
||||
};
|
||||
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
|
||||
return function() {};
|
||||
return function () {};
|
||||
};
|
||||
|
||||
return RemsTelemetryProvider;
|
||||
|
@ -54,8 +54,8 @@ define(
|
||||
* @returns {number} A count of the number of data values available in
|
||||
* this series
|
||||
*/
|
||||
RemsTelemetrySeries.prototype.getPointCount = function() {
|
||||
return this.data.length;
|
||||
RemsTelemetrySeries.prototype.getPointCount = function () {
|
||||
return this.data.length;
|
||||
};
|
||||
/**
|
||||
* The domain value at the given index. The Rems telemetry data is
|
||||
@ -64,8 +64,8 @@ define(
|
||||
* @param index
|
||||
* @returns {number} the time value in ms since 1 January 1970
|
||||
*/
|
||||
RemsTelemetrySeries.prototype.getDomainValue = function(index) {
|
||||
return this.data[index].date;
|
||||
RemsTelemetrySeries.prototype.getDomainValue = function (index) {
|
||||
return this.data[index].date;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -75,8 +75,8 @@ define(
|
||||
* value of.
|
||||
* @returns {number} A floating point number
|
||||
*/
|
||||
RemsTelemetrySeries.prototype.getRangeValue = function(index) {
|
||||
return this.data[index].value;
|
||||
RemsTelemetrySeries.prototype.getRangeValue = function (index) {
|
||||
return this.data[index].value;
|
||||
};
|
||||
|
||||
return RemsTelemetrySeries;
|
||||
|
@ -68,18 +68,18 @@ define(
|
||||
* given request ID.
|
||||
* @private
|
||||
*/
|
||||
RemsTelemetryServerAdapter.prototype.requestHistory = function(request) {
|
||||
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
|
||||
var self = this,
|
||||
id = request.key;
|
||||
|
||||
var dataTransforms = this.dataTransforms;
|
||||
|
||||
function processResponse(response){
|
||||
function processResponse(response) {
|
||||
var data = [];
|
||||
/*
|
||||
* History data is organised by Sol. Iterate over sols...
|
||||
*/
|
||||
response.data.soles.forEach(function(solData){
|
||||
response.data.soles.forEach(function (solData) {
|
||||
/*
|
||||
* Check that valid data exists
|
||||
*/
|
||||
@ -106,13 +106,13 @@ define(
|
||||
|
||||
//Filter results to match request parameters
|
||||
function filterResults(results) {
|
||||
return results.filter(function(result){
|
||||
return results.filter(function (result) {
|
||||
return result.date >= (request.start || Number.MIN_VALUE) &&
|
||||
result.date <= (request.end || Number.MAX_VALUE);
|
||||
});
|
||||
}
|
||||
|
||||
function packageAndResolve(results){
|
||||
function packageAndResolve(results) {
|
||||
return {id: id, values: results};
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ define(
|
||||
* @param id The telemetry data point key to be queried.
|
||||
* @returns {Promise | Array<RemsTelemetryValue>} that resolves with an Array of {@link RemsTelemetryValue} objects for the request data key.
|
||||
*/
|
||||
RemsTelemetryServerAdapter.prototype.history = function(request) {
|
||||
RemsTelemetryServerAdapter.prototype.history = function (request) {
|
||||
return this.requestHistory(request);
|
||||
};
|
||||
|
||||
|
@ -27,64 +27,65 @@ define([
|
||||
"./src/DialogLaunchIndicator",
|
||||
"./src/NotificationLaunchIndicator",
|
||||
"./res/dialog-launch.html",
|
||||
"./res/notification-launch.html",
|
||||
'legacyRegistry'
|
||||
"./res/notification-launch.html"
|
||||
], function (
|
||||
DialogLaunchController,
|
||||
NotificationLaunchController,
|
||||
DialogLaunchIndicator,
|
||||
NotificationLaunchIndicator,
|
||||
DialogLaunch,
|
||||
NotificationLaunch,
|
||||
legacyRegistry
|
||||
NotificationLaunch
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/notifications", {
|
||||
"extensions": {
|
||||
"templates": [
|
||||
{
|
||||
"key": "dialogLaunchTemplate",
|
||||
"template": DialogLaunch
|
||||
},
|
||||
{
|
||||
"key": "notificationLaunchTemplate",
|
||||
"template": NotificationLaunch
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "DialogLaunchController",
|
||||
"implementation": DialogLaunchController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"$log",
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "NotificationLaunchController",
|
||||
"implementation": NotificationLaunchController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"$log",
|
||||
"notificationService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"indicators": [
|
||||
{
|
||||
"implementation": DialogLaunchIndicator,
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
"implementation": NotificationLaunchIndicator,
|
||||
"priority": "fallback"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/notifications",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"templates": [
|
||||
{
|
||||
"key": "dialogLaunchTemplate",
|
||||
"template": DialogLaunch
|
||||
},
|
||||
{
|
||||
"key": "notificationLaunchTemplate",
|
||||
"template": NotificationLaunch
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "DialogLaunchController",
|
||||
"implementation": DialogLaunchController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"$log",
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "NotificationLaunchController",
|
||||
"implementation": NotificationLaunchController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"$log",
|
||||
"notificationService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"indicators": [
|
||||
{
|
||||
"implementation": DialogLaunchIndicator,
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
"implementation": NotificationLaunchIndicator,
|
||||
"priority": "fallback"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -1,9 +1,9 @@
|
||||
<span class="h-indicator" ng-controller="DialogLaunchController">
|
||||
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
|
||||
<div class="ls-indicator icon-box-with-arrow s-status-available"><span class="label">
|
||||
<a ng-click="launchProgress(true)">Known</a>
|
||||
<a ng-click="launchProgress(false)">Unknown</a>
|
||||
<a ng-click="launchError()">Error</a>
|
||||
<a ng-click="launchInfo()">Info</a>
|
||||
<div class="c-indicator c-indicator--clickable icon-box-with-arrow s-status-available"><span class="label c-indicator__label">
|
||||
<button ng-click="launchProgress(true)">Known</button>
|
||||
<button ng-click="launchProgress(false)">Unknown</button>
|
||||
<button ng-click="launchError()">Error</button>
|
||||
<button ng-click="launchInfo()">Info</button>
|
||||
</span></div>
|
||||
</span>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<span class="h-indicator" ng-controller="NotificationLaunchController">
|
||||
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
|
||||
<div class="ls-indicator icon-bell s-status-available"><span class="label">
|
||||
<a ng-click="newInfo()">Success</a>
|
||||
<a ng-click="newError()">Error</a>
|
||||
<a ng-click="newAlert()">Alert</a>
|
||||
<a ng-click="newProgress()">Progress</a>
|
||||
<div class="c-indicator c-indicator--clickable icon-bell s-status-available"><span class="label c-indicator__label">
|
||||
<button ng-click="newInfo()">Success</button>
|
||||
<button ng-click="newError()">Error</button>
|
||||
<button ng-click="newAlert()">Alert</button>
|
||||
<button ng-click="newProgress()">Progress</button>
|
||||
</span></div>
|
||||
</span>
|
||||
|
@ -137,12 +137,12 @@ define(
|
||||
" attention to an event.",
|
||||
severity: "info",
|
||||
primaryOption: {
|
||||
label: "OK",
|
||||
callback: function () {
|
||||
$log.debug("OK Pressed");
|
||||
dialog.dismiss();
|
||||
}
|
||||
label: "OK",
|
||||
callback: function () {
|
||||
$log.debug("OK Pressed");
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dialog = dialogService.showBlockingMessage(model);
|
||||
|
@ -22,33 +22,34 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/BrowserPersistenceProvider",
|
||||
'legacyRegistry'
|
||||
"./src/BrowserPersistenceProvider"
|
||||
], function (
|
||||
BrowserPersistenceProvider,
|
||||
legacyRegistry
|
||||
BrowserPersistenceProvider
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/persistence", {
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"provides": "persistenceService",
|
||||
"type": "provider",
|
||||
"implementation": BrowserPersistenceProvider,
|
||||
"depends": [
|
||||
"$q",
|
||||
"PERSISTENCE_SPACE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "PERSISTENCE_SPACE",
|
||||
"value": "mct"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/persistence",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"provides": "persistenceService",
|
||||
"type": "provider",
|
||||
"implementation": BrowserPersistenceProvider,
|
||||
"depends": [
|
||||
"$q",
|
||||
"PERSISTENCE_SPACE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "PERSISTENCE_SPACE",
|
||||
"value": "mct"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -22,24 +22,25 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ExamplePolicy",
|
||||
'legacyRegistry'
|
||||
"./src/ExamplePolicy"
|
||||
], function (
|
||||
ExamplePolicy,
|
||||
legacyRegistry
|
||||
ExamplePolicy
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/policy", {
|
||||
"name": "Example Policy",
|
||||
"description": "Provides an example of using policies to prohibit actions.",
|
||||
"extensions": {
|
||||
"policies": [
|
||||
{
|
||||
"implementation": ExamplePolicy,
|
||||
"category": "action"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/policy",
|
||||
definition: {
|
||||
"name": "Example Policy",
|
||||
"description": "Provides an example of using policies to prohibit actions.",
|
||||
"extensions": {
|
||||
"policies": [
|
||||
{
|
||||
"implementation": ExamplePolicy,
|
||||
"category": "action"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -23,33 +23,34 @@
|
||||
|
||||
define([
|
||||
"./src/WatchIndicator",
|
||||
"./src/DigestIndicator",
|
||||
'legacyRegistry'
|
||||
"./src/DigestIndicator"
|
||||
], function (
|
||||
WatchIndicator,
|
||||
DigestIndicator,
|
||||
legacyRegistry
|
||||
DigestIndicator
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/profiling", {
|
||||
"extensions": {
|
||||
"indicators": [
|
||||
{
|
||||
"implementation": WatchIndicator,
|
||||
"depends": [
|
||||
"$interval",
|
||||
"$rootScope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": DigestIndicator,
|
||||
"depends": [
|
||||
"$interval",
|
||||
"$rootScope"
|
||||
]
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/profiling",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"indicators": [
|
||||
{
|
||||
"implementation": WatchIndicator,
|
||||
"depends": [
|
||||
"$interval",
|
||||
"$rootScope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": DigestIndicator,
|
||||
"depends": [
|
||||
"$interval",
|
||||
"$rootScope"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -22,42 +22,43 @@
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ScratchPersistenceProvider",
|
||||
'legacyRegistry'
|
||||
"./src/ScratchPersistenceProvider"
|
||||
], function (
|
||||
ScratchPersistenceProvider,
|
||||
legacyRegistry
|
||||
ScratchPersistenceProvider
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("example/scratchpad", {
|
||||
"extensions": {
|
||||
"roots": [
|
||||
{
|
||||
"id": "scratch:root"
|
||||
}
|
||||
],
|
||||
"models": [
|
||||
{
|
||||
"id": "scratch:root",
|
||||
"model": {
|
||||
"type": "folder",
|
||||
"composition": [],
|
||||
"name": "Scratchpad"
|
||||
},
|
||||
"priority": "preferred"
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"provides": "persistenceService",
|
||||
"type": "provider",
|
||||
"implementation": ScratchPersistenceProvider,
|
||||
"depends": [
|
||||
"$q"
|
||||
]
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"example/scratchpad",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"roots": [
|
||||
{
|
||||
"id": "scratch:root"
|
||||
}
|
||||
],
|
||||
"models": [
|
||||
{
|
||||
"id": "scratch:root",
|
||||
"model": {
|
||||
"type": "folder",
|
||||
"composition": [],
|
||||
"name": "Scratchpad"
|
||||
},
|
||||
"priority": "preferred"
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"provides": "persistenceService",
|
||||
"type": "provider",
|
||||
"implementation": ScratchPersistenceProvider,
|
||||
"depends": [
|
||||
"$q"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -60,7 +60,7 @@ define(
|
||||
ScratchPersistenceProvider.prototype.readObject = function (space, key) {
|
||||
return this.$q.when(
|
||||
(space === 'scratch' && this.table[key]) ?
|
||||
JSON.parse(this.table[key]) : undefined
|
||||
JSON.parse(this.table[key]) : undefined
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Vue from 'Vue';
|
||||
import HelloWorld from './HelloWorld.vue';
|
||||
|
||||
function SimpleVuePlugin () {
|
||||
function SimpleVuePlugin() {
|
||||
return function install(openmct) {
|
||||
var views = (openmct.mainViews || openmct.objectViews);
|
||||
|
||||
openmct.types.addType('hello-world', {
|
||||
name: 'Hello World',
|
||||
description: 'An introduction object',
|
||||
|
@ -8,8 +8,7 @@ define([
|
||||
"./res/templates/glyphs.html",
|
||||
"./res/templates/controls.html",
|
||||
"./res/templates/input.html",
|
||||
"./res/templates/menus.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/menus.html"
|
||||
], function (
|
||||
ExampleStyleGuideModelProvider,
|
||||
MCTExample,
|
||||
@ -20,13 +19,14 @@ define([
|
||||
glyphsTemplate,
|
||||
controlsTemplate,
|
||||
inputTemplate,
|
||||
menusTemplate,
|
||||
legacyRegistry
|
||||
menusTemplate
|
||||
) {
|
||||
legacyRegistry.register("example/styleguide", {
|
||||
"name": "Open MCT Style Guide",
|
||||
"description": "Examples and documentation illustrating UI styles in use in Open MCT.",
|
||||
"extensions":
|
||||
return {
|
||||
name:"example/styleguide",
|
||||
definition: {
|
||||
"name": "Open MCT Style Guide",
|
||||
"description": "Examples and documentation illustrating UI styles in use in Open MCT.",
|
||||
"extensions":
|
||||
{
|
||||
"types": [
|
||||
{ "key": "styleguide.intro", "name": "Introduction", "cssClass": "icon-page", "description": "Introduction and overview to the style guide" },
|
||||
@ -103,5 +103,6 @@ define([
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -30,14 +30,14 @@ define(
|
||||
var pages = {};
|
||||
|
||||
// Add pages
|
||||
pages['intro'] = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
|
||||
pages['standards'] = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
|
||||
pages['colors'] = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
|
||||
pages['glyphs'] = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
|
||||
pages['status'] = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
|
||||
pages['controls'] = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
|
||||
pages['input'] = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
|
||||
pages['menus'] = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
|
||||
pages.intro = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
|
||||
pages.standards = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
|
||||
pages.colors = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
|
||||
pages.glyphs = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
|
||||
pages.status = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
|
||||
pages.controls = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
|
||||
pages.input = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
|
||||
pages.menus = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
|
||||
|
||||
return {
|
||||
getModels: function () {
|
||||
@ -48,4 +48,4 @@ define(
|
||||
|
||||
return ExampleStyleGuideModelProvider
|
||||
}
|
||||
);
|
||||
);
|
||||
|
291
index.html
291
index.html
@ -27,258 +27,61 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title></title>
|
||||
<script src="dist/openmct.js"></script>
|
||||
<link rel="stylesheet" href="dist/openmct.css">
|
||||
<link rel="icon" type="image/png" href="dist/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="dist/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="dist/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="shortcut icon" href="dist/favicons/favicon.ico">
|
||||
<link rel="stylesheet" href="espresso.css">
|
||||
<link rel="icon" type="image/png" href="dist/favicons/favicon-96x96.png" sizes="96x96" type="image/x-icon">
|
||||
<link rel="icon" type="image/png" href="dist/favicons/favicon-32x32.png" sizes="32x32" type="image/x-icon">
|
||||
<link rel="icon" type="image/png" href="dist/favicons/favicon-16x16.png" sizes="16x16" type="image/x-icon">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
<script>
|
||||
var THIRTY_MINUTES = 30 * 60 * 1000;
|
||||
[
|
||||
'example/eventGenerator',
|
||||
'example/styleguide'
|
||||
].forEach(
|
||||
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
||||
);
|
||||
const FIVE_MINUTES = 5 * 60 * 1000;
|
||||
const THIRTY_MINUTES = 30 * 60 * 1000;
|
||||
|
||||
// [
|
||||
// 'example/eventGenerator',
|
||||
// 'example/styleguide'
|
||||
// ].forEach(
|
||||
// openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
||||
// );
|
||||
openmct.install(openmct.plugins.MyItems());
|
||||
openmct.install(openmct.plugins.LocalStorage());
|
||||
openmct.install(openmct.plugins.Generator());
|
||||
openmct.install(openmct.plugins.ExampleImagery());
|
||||
// openmct.install(openmct.plugins.Generator());
|
||||
// openmct.install(openmct.plugins.ExampleImagery());
|
||||
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||
openmct.install(openmct.plugins.ImportExport());
|
||||
openmct.install(openmct.plugins.FixedView());
|
||||
openmct.install(openmct.plugins.AutoflowView({
|
||||
type: "telemetry.panel"
|
||||
// openmct.install(openmct.plugins.AutoflowView({
|
||||
// type: "telemetry.panel"
|
||||
// }));
|
||||
openmct.install(openmct.plugins.DisplayLayout({
|
||||
showAsView: ['summary-widget', 'example.imagery']
|
||||
}));
|
||||
openmct.install(openmct.plugins.Conductor({
|
||||
menuOptions: [
|
||||
{
|
||||
name: "Fixed",
|
||||
timeSystem: 'utc',
|
||||
bounds: {
|
||||
start: Date.now() - THIRTY_MINUTES,
|
||||
end: Date.now()
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Realtime",
|
||||
timeSystem: 'utc',
|
||||
clock: 'local',
|
||||
clockOffsets: {
|
||||
start: -25 * 60 * 1000,
|
||||
end: 5 * 60 * 1000
|
||||
}
|
||||
}
|
||||
]
|
||||
}));
|
||||
openmct.install(openmct.plugins.SummaryWidget());
|
||||
openmct.install(openmct.plugins.Notebook());
|
||||
openmct.install(openmct.plugins.FolderView());
|
||||
openmct.install(openmct.plugins.Tabs());
|
||||
openmct.install(openmct.plugins.FlexibleLayout());
|
||||
openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0});
|
||||
openmct.time.timeSystem('utc');
|
||||
openmct.start();
|
||||
|
||||
// openmct.toolbars.addProvider({
|
||||
// name: "Testing Toolbar",
|
||||
// key: "testing",
|
||||
// description: "a mock toolbar that exercises all controls",
|
||||
// forSelection: function (selection) {
|
||||
// return true; // always applies.
|
||||
// },
|
||||
// toolbar: function (selection) {
|
||||
// return [
|
||||
// {
|
||||
// control: 'menu',
|
||||
// icon: 'icon-plus',
|
||||
// label: 'Add',
|
||||
// options: [
|
||||
// { name: 'Box', class: 'icon-box', title: 'Add Box' },
|
||||
// { name: 'Line', class: 'icon-line-horz', title: 'Add Line' },
|
||||
// { name: 'Text', class: 'icon-font', title: 'Add Text' },
|
||||
// { name: 'Image', class: 'icon-image', title: 'Add Image' }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'color-picker',
|
||||
// icon: 'icon-paint-bucket',
|
||||
// value: '#33ff00',
|
||||
// },
|
||||
// {
|
||||
// control: 'color-picker',
|
||||
// icon: 'icon-pencil',
|
||||
// value: '#ffffff',
|
||||
// },
|
||||
// {
|
||||
// control: 'color-picker',
|
||||
// icon: 'icon-font',
|
||||
// value: '#333333',
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'select-menu',
|
||||
// value: 11,
|
||||
// options: [
|
||||
// { value: 9, name: '9 px' },
|
||||
// { value: 10, name: '10 px' },
|
||||
// { value: 11, name: '11 px' },
|
||||
// { value: 12, name: '12 px' },
|
||||
// { value: 13, name: '13 px' },
|
||||
// { value: 14, name: '14 px' },
|
||||
// { value: 16, name: '16 px' },
|
||||
// { value: 18, name: '18 px' },
|
||||
// { value: 20, name: '20 px' },
|
||||
// { value: 24, name: '24 px' },
|
||||
// { value: 28, name: '28 px' },
|
||||
// { value: 32, name: '32 px' },
|
||||
// { value: 40, name: '40 px' },
|
||||
// { value: 48, name: '48 px' },
|
||||
// { value: 56, name: '56 px' },
|
||||
// { value: 64, name: '64 px' },
|
||||
// { value: 72, name: '72 px' },
|
||||
// { value: 80, name: '80 px' },
|
||||
// { value: 88, name: '88 px' },
|
||||
// { value: 96, name: '96 px' },
|
||||
// { value: 128, name: '128 px' },
|
||||
// { value: 160, name: '160 px' }
|
||||
// ]
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'menu',
|
||||
// icon: 'icon-layers',
|
||||
// options: [
|
||||
// { name: 'Move to top', class: 'icon-arrow-double-up', title: 'Move to top' },
|
||||
// { name: 'Move up', class: 'icon-arrow-up', title: 'Move up' },
|
||||
// { name: 'Move down', class: 'icon-arrow-down', title: 'Move down' },
|
||||
// { name: 'Move to bottom', class: 'icon-arrow-double-down', title: 'Move to bottom' }
|
||||
// ]
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'button',
|
||||
// icon: 'icon-gear'
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'input',
|
||||
// type: 'number',
|
||||
// label: 'X',
|
||||
// value: 1,
|
||||
// title: 'X position'
|
||||
// },
|
||||
// {
|
||||
// control: 'input',
|
||||
// type: 'number',
|
||||
// label: 'Y',
|
||||
// value: 2,
|
||||
// title: 'Y position'
|
||||
// },
|
||||
// {
|
||||
// control: 'input',
|
||||
// type: 'number',
|
||||
// label: 'W',
|
||||
// value: 3,
|
||||
// title: 'Width'
|
||||
// },
|
||||
// {
|
||||
// control: 'input',
|
||||
// type: 'number',
|
||||
// label: 'H',
|
||||
// value: 4,
|
||||
// title: 'Height'
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'button',
|
||||
// icon: 'icon-trash',
|
||||
// label: 'delete',
|
||||
// modifier: 'caution'
|
||||
// },
|
||||
//
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'checkbox',
|
||||
// name: 'this is a checkbox',
|
||||
// },
|
||||
// {
|
||||
// control: 'separator'
|
||||
// },
|
||||
// {
|
||||
// control: 'toggle-button',
|
||||
// title: 'Toggle Frame',
|
||||
// property: 'hideFrame',
|
||||
// value: false,
|
||||
// options: [
|
||||
// {
|
||||
// value: true,
|
||||
// icon: 'icon-frame-hide'
|
||||
// },
|
||||
// {
|
||||
// value: false,
|
||||
// icon: 'icon-frame-show'
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// control: 'toggle-button',
|
||||
// title: 'Snap to grid',
|
||||
// property: 'snapToGrid',
|
||||
// value: true,
|
||||
// options: [
|
||||
// {
|
||||
// value: true,
|
||||
// icon: 'icon-grid-snap-to'
|
||||
// },
|
||||
// {
|
||||
// value: false,
|
||||
// icon: 'icon-grid-snap-no'
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// control: 'toggle-button',
|
||||
// title: 'Toggle label',
|
||||
// property: 'showLabel',
|
||||
// value: true,
|
||||
// options: [
|
||||
// {
|
||||
// value: true,
|
||||
// icon: 'icon-two-parts-both'
|
||||
// },
|
||||
// {
|
||||
// value: false,
|
||||
// icon: 'icon-two-parts-one-only'
|
||||
// }
|
||||
// ]
|
||||
// openmct.install(openmct.plugins.Conductor({
|
||||
// menuOptions: [
|
||||
// {
|
||||
// name: "Fixed",
|
||||
// timeSystem: 'utc',
|
||||
// bounds: {
|
||||
// start: Date.now() - THIRTY_MINUTES,
|
||||
// end: Date.now()
|
||||
// }
|
||||
// ];
|
||||
// }
|
||||
// });
|
||||
|
||||
// },
|
||||
// {
|
||||
// name: "Realtime",
|
||||
// timeSystem: 'utc',
|
||||
// clock: 'local',
|
||||
// clockOffsets: {
|
||||
// start: - THIRTY_MINUTES,
|
||||
// end: FIVE_MINUTES
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// }));
|
||||
// openmct.install(openmct.plugins.SummaryWidget());
|
||||
// openmct.install(openmct.plugins.Notebook());
|
||||
// openmct.install(openmct.plugins.LADTable());
|
||||
// openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay']));
|
||||
// openmct.install(openmct.plugins.ObjectMigration());
|
||||
// openmct.install(openmct.plugins.ClearData(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));
|
||||
openmct.start();
|
||||
</script>
|
||||
</html>
|
||||
|
@ -23,9 +23,9 @@
|
||||
/*global module,process*/
|
||||
|
||||
const devMode = process.env.NODE_ENV !== 'production';
|
||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'ChromeHeadless'];
|
||||
|
||||
module.exports = (config) => {
|
||||
|
||||
const webpackConfig = require('./webpack.config.js');
|
||||
delete webpackConfig.output;
|
||||
|
||||
@ -50,11 +50,17 @@ module.exports = (config) => {
|
||||
'coverage',
|
||||
'html'
|
||||
],
|
||||
browsers: ['ChromeHeadless'],
|
||||
browsers: browsers,
|
||||
customLaunchers: {
|
||||
ChromeDebugging: {
|
||||
base: 'Chrome',
|
||||
flags: ['--remote-debugging-port=9222'],
|
||||
debug: true
|
||||
}
|
||||
},
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
|
||||
coverageReporter: {
|
||||
dir: process.env.CIRCLE_ARTIFACTS ?
|
||||
process.env.CIRCLE_ARTIFACTS + '/coverage' :
|
||||
@ -66,22 +72,18 @@ module.exports = (config) => {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// HTML test reporting.
|
||||
htmlReporter: {
|
||||
outputDir: "dist/reports/tests",
|
||||
preserveDescribeNesting: true,
|
||||
foldAll: false
|
||||
},
|
||||
|
||||
preprocessors: {
|
||||
// add webpack as preprocessor
|
||||
'platform/**/*Spec.js': [ 'webpack' ],
|
||||
'src/**/*Spec.js': [ 'webpack' ]
|
||||
'platform/**/*Spec.js': [ 'webpack', 'sourcemap' ],
|
||||
'src/**/*Spec.js': [ 'webpack', 'sourcemap' ]
|
||||
},
|
||||
|
||||
webpack: webpackConfig,
|
||||
|
||||
webpackMiddleware: {
|
||||
stats: 'errors-only',
|
||||
logLevel: 'warn'
|
||||
@ -89,4 +91,3 @@ module.exports = (config) => {
|
||||
singleRun: true
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global module,BUILD_CONSTANTS*/
|
||||
/*global module*/
|
||||
|
||||
const matcher = /\/openmct.js$/;
|
||||
if (document.currentScript) {
|
||||
|
14
package.json
14
package.json
@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "openmct",
|
||||
"version": "0.14.0-SNAPSHOT",
|
||||
"version": "1.0.0-beta",
|
||||
"description": "The Open MCT core platform",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"acorn": "6.2.0",
|
||||
"angular": "1.4.14",
|
||||
"angular-route": "1.4.14",
|
||||
"babel-eslint": "8.2.6",
|
||||
@ -22,10 +23,11 @@
|
||||
"d3-time": "1.0.x",
|
||||
"d3-time-format": "2.1.x",
|
||||
"eslint": "5.2.0",
|
||||
"eslint-plugin-vue": "^6.0.0",
|
||||
"eventemitter3": "^1.2.0",
|
||||
"exports-loader": "^0.7.0",
|
||||
"express": "^4.13.1",
|
||||
"fast-sass-loader": "^1.4.5",
|
||||
"fast-sass-loader": "1.4.6",
|
||||
"file-loader": "^1.1.11",
|
||||
"file-saver": "^1.3.8",
|
||||
"git-rev-sync": "^1.4.0",
|
||||
@ -42,6 +44,7 @@
|
||||
"karma-coverage": "^1.1.2",
|
||||
"karma-html-reporter": "^0.2.7",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"location-bar": "^3.0.1",
|
||||
"lodash": "^3.10.1",
|
||||
@ -55,7 +58,7 @@
|
||||
"node-bourbon": "^4.2.3",
|
||||
"node-sass": "^4.9.2",
|
||||
"painterro": "^0.2.65",
|
||||
"printj": "^1.1.0",
|
||||
"printj": "^1.2.1",
|
||||
"raw-loader": "^0.5.1",
|
||||
"request": "^2.69.0",
|
||||
"split": "^1.0.0",
|
||||
@ -72,12 +75,13 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"lint": "eslint platform src openmct.js",
|
||||
"lint:fix": "eslint platform src openmct.js --fix",
|
||||
"lint": "eslint platform example src/**/*.{js,vue} openmct.js",
|
||||
"lint:fix": "eslint platform example src/**/*.{js,vue} openmct.js --fix",
|
||||
"build:prod": "NODE_ENV=production webpack",
|
||||
"build:dev": "webpack",
|
||||
"build:watch": "webpack --watch",
|
||||
"test": "karma start --single-run",
|
||||
"test-debug": "NODE_ENV=debug karma start --no-single-run",
|
||||
"test:watch": "karma start --no-single-run",
|
||||
"verify": "concurrently 'npm:test' 'npm:lint'",
|
||||
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
||||
|
@ -31,8 +31,7 @@ define([
|
||||
"./res/templates/license-apache.html",
|
||||
"./res/templates/license-mit.html",
|
||||
"./res/templates/licenses.html",
|
||||
"./res/templates/licenses-export-md.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/licenses-export-md.html"
|
||||
], function (
|
||||
aboutDialogTemplate,
|
||||
LogoController,
|
||||
@ -44,137 +43,139 @@ define([
|
||||
licenseApacheTemplate,
|
||||
licenseMitTemplate,
|
||||
licensesTemplate,
|
||||
licensesExportMdTemplate,
|
||||
legacyRegistry
|
||||
licensesExportMdTemplate
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/about", {
|
||||
"name": "About Open MCT",
|
||||
"extensions": {
|
||||
"templates": [
|
||||
{
|
||||
"key": "app-logo",
|
||||
"priority": "optional",
|
||||
"template": appLogoTemplate
|
||||
},
|
||||
{
|
||||
"key": "about-logo",
|
||||
"priority": "preferred",
|
||||
"template": aboutLogoTemplate
|
||||
},
|
||||
{
|
||||
"key": "about-dialog",
|
||||
"template": aboutDialogTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-about",
|
||||
"template": overlayAboutTemplate
|
||||
},
|
||||
{
|
||||
"key": "license-apache",
|
||||
"template": licenseApacheTemplate
|
||||
},
|
||||
{
|
||||
"key": "license-mit",
|
||||
"template": licenseMitTemplate
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "LogoController",
|
||||
"depends": [
|
||||
"overlayService"
|
||||
],
|
||||
"implementation": LogoController
|
||||
},
|
||||
{
|
||||
"key": "AboutController",
|
||||
"depends": [
|
||||
"versions[]",
|
||||
"$window"
|
||||
],
|
||||
"implementation": AboutController
|
||||
},
|
||||
{
|
||||
"key": "LicenseController",
|
||||
"depends": [
|
||||
"licenses[]"
|
||||
],
|
||||
"implementation": LicenseController
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"name": "Json.NET",
|
||||
"version": "6.0.8",
|
||||
"author": "Newtonsoft",
|
||||
"description": "JSON serialization/deserialization",
|
||||
"website": "http://www.newtonsoft.com/json",
|
||||
"copyright": "Copyright (c) 2007 James Newton-King",
|
||||
"license": "license-mit",
|
||||
"link": "https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md"
|
||||
},
|
||||
{
|
||||
"name": "Nancy",
|
||||
"version": "0.23.2",
|
||||
"author": "Andreas Håkansson, Steven Robbins and contributors",
|
||||
"description": "Embedded web server",
|
||||
"website": "http://nancyfx.org/",
|
||||
"copyright": "Copyright © 2010 Andreas Håkansson, Steven Robbins and contributors",
|
||||
"license": "license-mit",
|
||||
"link": "http://www.opensource.org/licenses/mit-license.php"
|
||||
},
|
||||
{
|
||||
"name": "Nancy.Hosting.Self",
|
||||
"version": "0.23.2",
|
||||
"author": "Andreas Håkansson, Steven Robbins and contributors",
|
||||
"description": "Embedded web server",
|
||||
"website": "http://nancyfx.org/",
|
||||
"copyright": "Copyright © 2010 Andreas Håkansson, Steven Robbins and contributors",
|
||||
"license": "license-mit",
|
||||
"link": "http://www.opensource.org/licenses/mit-license.php"
|
||||
},
|
||||
{
|
||||
"name": "SuperSocket",
|
||||
"version": "0.9.0.2",
|
||||
"author": " Kerry Jiang",
|
||||
"description": "Supports SuperWebSocket",
|
||||
"website": "https://supersocket.codeplex.com/",
|
||||
"copyright": "Copyright 2010-2014 Kerry Jiang (kerry-jiang@hotmail.com)",
|
||||
"license": "license-apache",
|
||||
"link": "https://supersocket.codeplex.com/license"
|
||||
},
|
||||
{
|
||||
"name": "SuperWebSocket",
|
||||
"version": "0.9.0.2",
|
||||
"author": " Kerry Jiang",
|
||||
"description": "WebSocket implementation for client-server communication",
|
||||
"website": "https://superwebsocket.codeplex.com/",
|
||||
"copyright": "Copyright 2010-2014 Kerry Jiang (kerry-jiang@hotmail.com)",
|
||||
"license": "license-apache",
|
||||
"link": "https://superwebsocket.codeplex.com/license"
|
||||
},
|
||||
{
|
||||
"name": "log4net",
|
||||
"version": "2.0.3",
|
||||
"author": "Apache Software Foundation",
|
||||
"description": "Logging",
|
||||
"website": "http://logging.apache.org/log4net/",
|
||||
"copyright": "Copyright © 2004-2015 Apache Software Foundation.",
|
||||
"license": "license-apache",
|
||||
"link": "http://logging.apache.org/log4net/license.html"
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"when": "/licenses",
|
||||
"template": licensesTemplate
|
||||
},
|
||||
{
|
||||
"when": "/licenses-md",
|
||||
"template": licensesExportMdTemplate
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"platform/commonUI/about",
|
||||
definition: {
|
||||
"name": "About Open MCT",
|
||||
"extensions": {
|
||||
"templates": [
|
||||
{
|
||||
"key": "app-logo",
|
||||
"priority": "optional",
|
||||
"template": appLogoTemplate
|
||||
},
|
||||
{
|
||||
"key": "about-logo",
|
||||
"priority": "preferred",
|
||||
"template": aboutLogoTemplate
|
||||
},
|
||||
{
|
||||
"key": "about-dialog",
|
||||
"template": aboutDialogTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-about",
|
||||
"template": overlayAboutTemplate
|
||||
},
|
||||
{
|
||||
"key": "license-apache",
|
||||
"template": licenseApacheTemplate
|
||||
},
|
||||
{
|
||||
"key": "license-mit",
|
||||
"template": licenseMitTemplate
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "LogoController",
|
||||
"depends": [
|
||||
"overlayService"
|
||||
],
|
||||
"implementation": LogoController
|
||||
},
|
||||
{
|
||||
"key": "AboutController",
|
||||
"depends": [
|
||||
"versions[]",
|
||||
"$window"
|
||||
],
|
||||
"implementation": AboutController
|
||||
},
|
||||
{
|
||||
"key": "LicenseController",
|
||||
"depends": [
|
||||
"licenses[]"
|
||||
],
|
||||
"implementation": LicenseController
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"name": "Json.NET",
|
||||
"version": "6.0.8",
|
||||
"author": "Newtonsoft",
|
||||
"description": "JSON serialization/deserialization",
|
||||
"website": "http://www.newtonsoft.com/json",
|
||||
"copyright": "Copyright (c) 2007 James Newton-King",
|
||||
"license": "license-mit",
|
||||
"link": "https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md"
|
||||
},
|
||||
{
|
||||
"name": "Nancy",
|
||||
"version": "0.23.2",
|
||||
"author": "Andreas Håkansson, Steven Robbins and contributors",
|
||||
"description": "Embedded web server",
|
||||
"website": "http://nancyfx.org/",
|
||||
"copyright": "Copyright © 2010 Andreas Håkansson, Steven Robbins and contributors",
|
||||
"license": "license-mit",
|
||||
"link": "http://www.opensource.org/licenses/mit-license.php"
|
||||
},
|
||||
{
|
||||
"name": "Nancy.Hosting.Self",
|
||||
"version": "0.23.2",
|
||||
"author": "Andreas Håkansson, Steven Robbins and contributors",
|
||||
"description": "Embedded web server",
|
||||
"website": "http://nancyfx.org/",
|
||||
"copyright": "Copyright © 2010 Andreas Håkansson, Steven Robbins and contributors",
|
||||
"license": "license-mit",
|
||||
"link": "http://www.opensource.org/licenses/mit-license.php"
|
||||
},
|
||||
{
|
||||
"name": "SuperSocket",
|
||||
"version": "0.9.0.2",
|
||||
"author": " Kerry Jiang",
|
||||
"description": "Supports SuperWebSocket",
|
||||
"website": "https://supersocket.codeplex.com/",
|
||||
"copyright": "Copyright 2010-2014 Kerry Jiang (kerry-jiang@hotmail.com)",
|
||||
"license": "license-apache",
|
||||
"link": "https://supersocket.codeplex.com/license"
|
||||
},
|
||||
{
|
||||
"name": "SuperWebSocket",
|
||||
"version": "0.9.0.2",
|
||||
"author": " Kerry Jiang",
|
||||
"description": "WebSocket implementation for client-server communication",
|
||||
"website": "https://superwebsocket.codeplex.com/",
|
||||
"copyright": "Copyright 2010-2014 Kerry Jiang (kerry-jiang@hotmail.com)",
|
||||
"license": "license-apache",
|
||||
"link": "https://superwebsocket.codeplex.com/license"
|
||||
},
|
||||
{
|
||||
"name": "log4net",
|
||||
"version": "2.0.3",
|
||||
"author": "Apache Software Foundation",
|
||||
"description": "Logging",
|
||||
"website": "http://logging.apache.org/log4net/",
|
||||
"copyright": "Copyright © 2004-2015 Apache Software Foundation.",
|
||||
"license": "license-apache",
|
||||
"link": "http://logging.apache.org/log4net/license.html"
|
||||
}
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"when": "/licenses",
|
||||
"template": licensesTemplate
|
||||
},
|
||||
{
|
||||
"when": "/licenses-md",
|
||||
"template": licensesExportMdTemplate
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -21,17 +21,10 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
"./src/BrowseController",
|
||||
"./src/PaneController",
|
||||
"./src/InspectorPaneController",
|
||||
"./src/BrowseObjectController",
|
||||
"./src/MenuArrowController",
|
||||
"./src/ObjectHeaderController",
|
||||
"./src/navigation/NavigationService",
|
||||
"./src/navigation/NavigateAction",
|
||||
"./src/navigation/OrphanNavigationHandler",
|
||||
"./src/windowing/NewTabAction",
|
||||
"./src/windowing/WindowTitler",
|
||||
"./res/templates/browse.html",
|
||||
"./res/templates/browse-object.html",
|
||||
"./res/templates/browse/object-header.html",
|
||||
@ -39,20 +32,12 @@ define([
|
||||
"./res/templates/menu-arrow.html",
|
||||
"./res/templates/back-arrow.html",
|
||||
"./res/templates/browse/object-properties.html",
|
||||
"./res/templates/browse/inspector-region.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/browse/inspector-region.html"
|
||||
], function (
|
||||
BrowseController,
|
||||
PaneController,
|
||||
InspectorPaneController,
|
||||
BrowseObjectController,
|
||||
MenuArrowController,
|
||||
ObjectHeaderController,
|
||||
NavigationService,
|
||||
NavigateAction,
|
||||
OrphanNavigationHandler,
|
||||
NewTabAction,
|
||||
WindowTitler,
|
||||
browseTemplate,
|
||||
browseObjectTemplate,
|
||||
objectHeaderTemplate,
|
||||
@ -60,203 +45,133 @@ define([
|
||||
menuArrowTemplate,
|
||||
backArrowTemplate,
|
||||
objectPropertiesTemplate,
|
||||
inspectorRegionTemplate,
|
||||
legacyRegistry
|
||||
inspectorRegionTemplate
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/browse", {
|
||||
"extensions": {
|
||||
"routes": [
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_PATH",
|
||||
"value": "mine",
|
||||
"priority": "fallback"
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "BrowseController",
|
||||
"implementation": BrowseController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$route",
|
||||
"$location",
|
||||
"objectService",
|
||||
"navigationService",
|
||||
"urlService",
|
||||
"DEFAULT_PATH"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "PaneController",
|
||||
"implementation": PaneController,
|
||||
"priority": "preferred",
|
||||
"depends": [
|
||||
"$scope",
|
||||
"agentService",
|
||||
"$window",
|
||||
"$location",
|
||||
"$attrs",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "BrowseObjectController",
|
||||
"implementation": BrowseObjectController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$location",
|
||||
"$route"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "MenuArrowController",
|
||||
"implementation": MenuArrowController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "InspectorPaneController",
|
||||
"implementation": InspectorPaneController,
|
||||
"priority": "preferred",
|
||||
"depends": [
|
||||
"$scope",
|
||||
"agentService",
|
||||
"$window",
|
||||
"navigationService",
|
||||
"$location",
|
||||
"$attrs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ObjectHeaderController",
|
||||
"implementation": ObjectHeaderController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "browse-object",
|
||||
"template": browseObjectTemplate,
|
||||
"gestures": [
|
||||
"drop"
|
||||
],
|
||||
"uses": [
|
||||
"view"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "object-header",
|
||||
"template": objectHeaderTemplate,
|
||||
"uses": [
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "object-header-frame",
|
||||
"template": objectHeaderFrameTemplate,
|
||||
"uses": [
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "menu-arrow",
|
||||
"template": menuArrowTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
],
|
||||
"gestures": [
|
||||
"menu"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "back-arrow",
|
||||
"uses": [
|
||||
"context"
|
||||
],
|
||||
"template": backArrowTemplate
|
||||
},
|
||||
{
|
||||
"key": "object-properties",
|
||||
"template": objectPropertiesTemplate
|
||||
},
|
||||
{
|
||||
"key": "inspector-region",
|
||||
"template": inspectorRegionTemplate
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "navigationService",
|
||||
"implementation": NavigationService,
|
||||
"depends": [
|
||||
"$window"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"key": "navigate",
|
||||
"implementation": NavigateAction,
|
||||
"depends": [
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "window",
|
||||
"name": "Open In New Tab",
|
||||
"implementation": NewTabAction,
|
||||
"description": "Open in a new browser tab",
|
||||
"category": [
|
||||
"view-control",
|
||||
"contextual"
|
||||
],
|
||||
"depends": [
|
||||
"urlService",
|
||||
"$window"
|
||||
],
|
||||
"group": "windowing",
|
||||
"cssClass": "icon-new-window",
|
||||
"priority": "preferred"
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": WindowTitler,
|
||||
"depends": [
|
||||
"navigationService",
|
||||
"$rootScope",
|
||||
"$document"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": OrphanNavigationHandler,
|
||||
"depends": [
|
||||
"throttle",
|
||||
"topic",
|
||||
"navigationService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
key: "browseRoot",
|
||||
template: browseTemplate
|
||||
},
|
||||
{
|
||||
key: "browseObject",
|
||||
template: browseObjectTemplate
|
||||
},
|
||||
{
|
||||
key: "inspectorRegion",
|
||||
template: inspectorRegionTemplate
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"platform/commonUI/browse",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"routes": [
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_PATH",
|
||||
"value": "mine",
|
||||
"priority": "fallback"
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "browse-object",
|
||||
"template": browseObjectTemplate,
|
||||
"gestures": [
|
||||
"drop"
|
||||
],
|
||||
"uses": [
|
||||
"view"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "object-header",
|
||||
"template": objectHeaderTemplate,
|
||||
"uses": [
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "object-header-frame",
|
||||
"template": objectHeaderFrameTemplate,
|
||||
"uses": [
|
||||
"type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "menu-arrow",
|
||||
"template": menuArrowTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
],
|
||||
"gestures": [
|
||||
"menu"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "back-arrow",
|
||||
"uses": [
|
||||
"context"
|
||||
],
|
||||
"template": backArrowTemplate
|
||||
},
|
||||
{
|
||||
"key": "object-properties",
|
||||
"template": objectPropertiesTemplate
|
||||
},
|
||||
{
|
||||
"key": "inspector-region",
|
||||
"template": inspectorRegionTemplate
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "navigationService",
|
||||
"implementation": NavigationService,
|
||||
"depends": [
|
||||
"$window"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"key": "navigate",
|
||||
"implementation": NavigateAction,
|
||||
"depends": [
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "window",
|
||||
"name": "Open In New Tab",
|
||||
"implementation": NewTabAction,
|
||||
"description": "Open in a new browser tab",
|
||||
"category": [
|
||||
"view-control",
|
||||
"contextual"
|
||||
],
|
||||
"depends": [
|
||||
"urlService",
|
||||
"$window"
|
||||
],
|
||||
"group": "windowing",
|
||||
"cssClass": "icon-new-window",
|
||||
"priority": "preferred"
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": OrphanNavigationHandler,
|
||||
"depends": [
|
||||
"throttle",
|
||||
"topic",
|
||||
"navigationService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
key: "browseRoot",
|
||||
template: browseTemplate
|
||||
},
|
||||
{
|
||||
key: "browseObject",
|
||||
template: browseObjectTemplate
|
||||
},
|
||||
{
|
||||
key: "inspectorRegion",
|
||||
template: inspectorRegionTemplate
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -1,215 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* This bundle implements Browse mode.
|
||||
* @namespace platform/commonUI/browse
|
||||
*/
|
||||
define(
|
||||
['lodash'],
|
||||
function (_) {
|
||||
|
||||
/**
|
||||
* The BrowseController is used to populate the initial scope in Browse
|
||||
* mode. It loads the root object from the objectService and makes it
|
||||
* available in the scope for Angular template's; this is the point at
|
||||
* which Angular templates first have access to the domain object
|
||||
* hierarchy.
|
||||
*
|
||||
* @memberof platform/commonUI/browse
|
||||
* @constructor
|
||||
*/
|
||||
function BrowseController(
|
||||
$scope,
|
||||
$route,
|
||||
$location,
|
||||
objectService,
|
||||
navigationService,
|
||||
urlService,
|
||||
defaultPath
|
||||
) {
|
||||
window.browseScope = $scope;
|
||||
var initialPath = ($route.current.params.ids || defaultPath).split("/"),
|
||||
currentIds;
|
||||
|
||||
$scope.treeModel = {
|
||||
selectedObject: undefined,
|
||||
onSelection: function (object) {
|
||||
navigationService.setNavigation(object, true);
|
||||
},
|
||||
allowSelection: function (object) {
|
||||
var domainObjectInView = navigationService.getNavigation(),
|
||||
isInEditMode = domainObjectInView.getCapability('status').get('editing');
|
||||
|
||||
if (isInEditMode) {
|
||||
|
||||
var actions = object.getCapability('action'),
|
||||
previewAction = actions.getActions({key: 'mct-preview-action'})[0];
|
||||
|
||||
if (previewAction && previewAction.perform) {
|
||||
previewAction.perform();
|
||||
return false;
|
||||
} else {
|
||||
return navigationService.shouldNavigate();
|
||||
}
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function idsForObject(domainObject) {
|
||||
return urlService
|
||||
.urlForLocation("", domainObject)
|
||||
.replace('/', '');
|
||||
}
|
||||
|
||||
// Find an object in an array of objects.
|
||||
function findObject(domainObjects, id) {
|
||||
var i;
|
||||
for (i = 0; i < domainObjects.length; i += 1) {
|
||||
if (domainObjects[i].getId() === id) {
|
||||
return domainObjects[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// helper, fetch a single object from the object service.
|
||||
function getObject(id) {
|
||||
return objectService.getObjects([id])
|
||||
.then(function (results) {
|
||||
return results[id];
|
||||
});
|
||||
}
|
||||
|
||||
// recursively locate and return an object inside of a container
|
||||
// via a path. If at any point in the recursion it fails to find
|
||||
// the next object, it will return the parent.
|
||||
function findViaComposition(containerObject, path) {
|
||||
var nextId = path.shift();
|
||||
if (!nextId) {
|
||||
return containerObject;
|
||||
}
|
||||
return containerObject.useCapability('composition')
|
||||
.then(function (composees) {
|
||||
var nextObject = findObject(composees, nextId);
|
||||
if (!nextObject) {
|
||||
return containerObject;
|
||||
}
|
||||
if (!nextObject.hasCapability('composition')) {
|
||||
return nextObject;
|
||||
}
|
||||
return findViaComposition(nextObject, path);
|
||||
});
|
||||
}
|
||||
|
||||
function navigateToObject(desiredObject) {
|
||||
$scope.navigatedObject = desiredObject;
|
||||
$scope.treeModel.selectedObject = desiredObject;
|
||||
currentIds = idsForObject(desiredObject);
|
||||
$route.current.pathParams.ids = currentIds;
|
||||
$location.path('/browse/' + currentIds);
|
||||
}
|
||||
|
||||
function getLastChildIfRoot(object) {
|
||||
if (object.getId() !== 'ROOT') {
|
||||
return object;
|
||||
}
|
||||
return object.useCapability('composition')
|
||||
.then(function (composees) {
|
||||
return composees[composees.length - 1];
|
||||
});
|
||||
}
|
||||
|
||||
function navigateToPath(path) {
|
||||
return getObject('ROOT')
|
||||
.then(function (root) {
|
||||
return findViaComposition(root, path);
|
||||
})
|
||||
.then(getLastChildIfRoot)
|
||||
.then(function (object) {
|
||||
navigationService.setNavigation(object);
|
||||
});
|
||||
}
|
||||
|
||||
getObject('ROOT')
|
||||
.then(function (root) {
|
||||
$scope.domainObject = root;
|
||||
navigateToPath(initialPath);
|
||||
});
|
||||
|
||||
// Handle navigation events from view service. Only navigates
|
||||
// if path has changed.
|
||||
function navigateDirectlyToModel(domainObject) {
|
||||
var newIds = idsForObject(domainObject);
|
||||
if (currentIds !== newIds) {
|
||||
currentIds = newIds;
|
||||
navigateToObject(domainObject);
|
||||
}
|
||||
}
|
||||
|
||||
// Listen for changes in navigation state.
|
||||
navigationService.addListener(navigateDirectlyToModel);
|
||||
|
||||
// Listen for route changes which are caused by browser events
|
||||
// (e.g. bookmarks to pages in OpenMCT) and prevent them. Instead,
|
||||
// navigate to the path ourselves, which results in it being
|
||||
// properly set.
|
||||
$scope.$on('$routeChangeStart', function (event, route, oldRoute) {
|
||||
if (route.$$route === $route.current.$$route) {
|
||||
if (route.pathParams.ids &&
|
||||
route.pathParams.ids !== $route.current.pathParams.ids) {
|
||||
|
||||
var otherParams = _.omit(route.params, 'ids');
|
||||
var oldOtherParams = _.omit(oldRoute.params, 'ids');
|
||||
var deletedParams = _.omit(oldOtherParams, _.keys(otherParams));
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
navigateToPath(route.pathParams.ids.split('/'))
|
||||
.then(function () {
|
||||
if (!_.isEqual(otherParams, oldOtherParams)) {
|
||||
_.forEach(otherParams, function (v, k) {
|
||||
$location.search(k, v);
|
||||
});
|
||||
_.forEach(deletedParams, function (k) {
|
||||
$location.search(k, null);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
navigateToPath([]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Clean up when the scope is destroyed
|
||||
$scope.$on("$destroy", function () {
|
||||
navigationService.removeListener(navigateDirectlyToModel);
|
||||
});
|
||||
}
|
||||
|
||||
return BrowseController;
|
||||
}
|
||||
);
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Controller for the `browse-object` representation of a domain
|
||||
* object (the right-hand side of Browse mode.)
|
||||
* @memberof platform/commonUI/browse
|
||||
* @constructor
|
||||
*/
|
||||
function BrowseObjectController($scope, $location, $route) {
|
||||
function setViewForDomainObject(domainObject) {
|
||||
|
||||
var locationViewKey = $location.search().view;
|
||||
|
||||
function selectViewIfMatching(view) {
|
||||
if (view.key === locationViewKey) {
|
||||
$scope.representation = $scope.representation || {};
|
||||
$scope.representation.selected = view;
|
||||
}
|
||||
}
|
||||
|
||||
if (locationViewKey) {
|
||||
((domainObject && domainObject.useCapability('view')) || [])
|
||||
.forEach(selectViewIfMatching);
|
||||
}
|
||||
}
|
||||
|
||||
function updateQueryParam(viewKey) {
|
||||
if (viewKey && $location.search().view !== viewKey) {
|
||||
$location.search('view', viewKey);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$watch('domainObject', setViewForDomainObject);
|
||||
$scope.$watch('representation.selected.key', updateQueryParam);
|
||||
$scope.$on('$locationChangeSuccess', function () {
|
||||
setViewForDomainObject($scope.domainObject);
|
||||
});
|
||||
|
||||
$scope.doAction = function (action) {
|
||||
return $scope[action] && $scope[action]();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return BrowseObjectController;
|
||||
}
|
||||
);
|
||||
|
@ -1,78 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["./PaneController"],
|
||||
function (PaneController) {
|
||||
|
||||
/**
|
||||
* Pane controller that reveals inspector, if hidden, when object
|
||||
* switches to edit mode.
|
||||
*
|
||||
* @param $scope
|
||||
* @param agentService
|
||||
* @param $window
|
||||
* @param navigationService
|
||||
* @constructor
|
||||
*/
|
||||
function InspectorPaneController($scope, agentService, $window, navigationService, $location, $attrs) {
|
||||
PaneController.call(this, $scope, agentService, $window, $location, $attrs);
|
||||
var statusListener,
|
||||
self = this;
|
||||
|
||||
function showInspector(statuses) {
|
||||
if (statuses.indexOf('editing') !== -1 && !self.visible()) {
|
||||
self.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
function attachStatusListener(domainObject) {
|
||||
// Remove existing status listener if existing
|
||||
if (statusListener) {
|
||||
statusListener();
|
||||
}
|
||||
|
||||
if (domainObject.hasCapability("status")) {
|
||||
statusListener = domainObject.getCapability("status").listen(showInspector);
|
||||
}
|
||||
return statusListener;
|
||||
}
|
||||
|
||||
var domainObject = navigationService.getNavigation();
|
||||
if (domainObject) {
|
||||
attachStatusListener(domainObject);
|
||||
}
|
||||
|
||||
navigationService.addListener(attachStatusListener);
|
||||
|
||||
$scope.$on("$destroy", function () {
|
||||
statusListener();
|
||||
navigationService.removeListener(attachStatusListener);
|
||||
});
|
||||
}
|
||||
|
||||
InspectorPaneController.prototype = Object.create(PaneController.prototype);
|
||||
|
||||
return InspectorPaneController;
|
||||
}
|
||||
);
|
@ -1,59 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Module defining MenuArrowController. Created by shale on 06/30/2015.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* A left-click on the menu arrow should display a
|
||||
* context menu. This controller launches the context
|
||||
* menu.
|
||||
* @memberof platform/commonUI/browse
|
||||
* @constructor
|
||||
*/
|
||||
function MenuArrowController($scope) {
|
||||
this.$scope = $scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a context menu for the domain object in this scope.
|
||||
*
|
||||
* @param event the browser event which caused this (used to
|
||||
* position the menu)
|
||||
*/
|
||||
MenuArrowController.prototype.showMenu = function (event) {
|
||||
var actionContext = {
|
||||
key: 'menu',
|
||||
domainObject: this.$scope.domainObject,
|
||||
event: event
|
||||
};
|
||||
|
||||
this.$scope.domainObject.getCapability('action').perform(actionContext);
|
||||
};
|
||||
|
||||
return MenuArrowController;
|
||||
}
|
||||
);
|
@ -1,92 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Controller to provide the ability to inline edit an object name.
|
||||
*
|
||||
* @constructor
|
||||
* @memberof platform/commonUI/browse
|
||||
*/
|
||||
function ObjectHeaderController($scope) {
|
||||
this.$scope = $scope;
|
||||
this.domainObject = $scope.domainObject;
|
||||
this.editable = this.allowEdit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the object name on blur and enter keypress events.
|
||||
*
|
||||
* @param event the mouse event
|
||||
*/
|
||||
ObjectHeaderController.prototype.updateName = function (event) {
|
||||
if (!event || !event.currentTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.type === 'blur') {
|
||||
this.updateModel(event);
|
||||
} else if (event.which === 13) {
|
||||
this.updateModel(event);
|
||||
event.currentTarget.blur();
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the model.
|
||||
*
|
||||
* @param event the mouse event
|
||||
* @param private
|
||||
*/
|
||||
ObjectHeaderController.prototype.updateModel = function (event) {
|
||||
var name = event.currentTarget.textContent.replace(/\n/g, ' ');
|
||||
|
||||
if (name.length === 0) {
|
||||
name = "Unnamed " + this.domainObject.getCapability("type").typeDef.name;
|
||||
event.currentTarget.textContent = name;
|
||||
}
|
||||
|
||||
if (name !== this.domainObject.getModel().name) {
|
||||
this.domainObject.getCapability('mutation').mutate(function (model) {
|
||||
model.name = name;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the domain object is editable.
|
||||
*
|
||||
* @private
|
||||
* @return true if object is editable
|
||||
*/
|
||||
ObjectHeaderController.prototype.allowEdit = function () {
|
||||
var type = this.domainObject && this.domainObject.getCapability('type');
|
||||
return !!(type && type.hasFeature('creation'));
|
||||
};
|
||||
|
||||
return ObjectHeaderController;
|
||||
}
|
||||
);
|
@ -1,88 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
var navigationListenerAdded = false;
|
||||
/**
|
||||
* Controller to provide the ability to show/hide the tree in
|
||||
* Browse mode.
|
||||
* @constructor
|
||||
* @memberof platform/commonUI/browse
|
||||
*/
|
||||
function PaneController($scope, agentService, $window, $location, $attrs, navigationService) {
|
||||
var self = this;
|
||||
this.agentService = agentService;
|
||||
var hideParameterPresent = $location.search().hasOwnProperty($attrs.hideParameter);
|
||||
|
||||
if ($attrs.hideParameter && hideParameterPresent) {
|
||||
this.state = false;
|
||||
$location.search($attrs.hideParameter, undefined);
|
||||
} else {
|
||||
this.state = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to invoke when any selection occurs in the tree.
|
||||
* This controller can be passed in as the `parameters` object
|
||||
* to the tree representation.
|
||||
*
|
||||
* @property {Function} callback
|
||||
* @memberof platform/commonUI/browse.PaneController#
|
||||
*/
|
||||
this.callback = function () {
|
||||
// Note that, since this is a callback to pass, this is not
|
||||
// declared as a method but as a property which happens to
|
||||
// be a function.
|
||||
if (agentService.isPhone() && agentService.isPortrait()) {
|
||||
// On phones, trees should collapse in portrait mode
|
||||
// when something is navigated-to.
|
||||
self.state = false;
|
||||
}
|
||||
};
|
||||
|
||||
if (navigationService && navigationService.addListener && !navigationListenerAdded) {
|
||||
navigationService.addListener(this.callback);
|
||||
navigationListenerAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the visibility of the pane.
|
||||
*/
|
||||
PaneController.prototype.toggle = function () {
|
||||
this.state = !this.state;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the desired visibility state of the pane.
|
||||
* @returns {boolean} true when visible
|
||||
*/
|
||||
PaneController.prototype.visible = function () {
|
||||
return !!this.state;
|
||||
};
|
||||
|
||||
return PaneController;
|
||||
}
|
||||
);
|
@ -1,51 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Updates the title of the current window to reflect the name
|
||||
* of the currently navigated-to domain object.
|
||||
* @memberof platform/commonUI/browse
|
||||
* @constructor
|
||||
*/
|
||||
function WindowTitler(navigationService, $rootScope, $document) {
|
||||
// Look up name of the navigated domain object...
|
||||
function getNavigatedObjectName() {
|
||||
var navigatedObject = navigationService.getNavigation();
|
||||
return navigatedObject && navigatedObject.getModel().name;
|
||||
}
|
||||
|
||||
// Set the window title...
|
||||
function setTitle(name) {
|
||||
$document[0].title = name;
|
||||
}
|
||||
|
||||
// Watch the former, and invoke the latter
|
||||
$rootScope.$watch(getNavigatedObjectName, setTitle);
|
||||
}
|
||||
|
||||
return WindowTitler;
|
||||
}
|
||||
);
|
@ -1,266 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global console*/
|
||||
|
||||
/**
|
||||
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
||||
*/
|
||||
define(
|
||||
[
|
||||
"../src/BrowseController",
|
||||
"../src/navigation/NavigationService"
|
||||
],
|
||||
function (
|
||||
BrowseController,
|
||||
NavigationService
|
||||
) {
|
||||
|
||||
describe("The browse controller", function () {
|
||||
var mockScope,
|
||||
mockRoute,
|
||||
mockLocation,
|
||||
mockObjectService,
|
||||
mockNavigationService,
|
||||
mockRootObject,
|
||||
mockUrlService,
|
||||
mockDefaultRootObject,
|
||||
mockOtherDomainObject,
|
||||
mockNextObject,
|
||||
testDefaultRoot,
|
||||
controller;
|
||||
|
||||
function waitsForNavigation() {
|
||||
return new Promise(function (resolve) {
|
||||
mockNavigationService.setNavigation.and.callFake(function (obj) {
|
||||
var returnValue;
|
||||
try {
|
||||
returnValue = NavigationService.prototype.setNavigation.call(mockNavigationService, obj);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
//Not rejecting because 'setNavigation' has been called, which is what's being tested here.
|
||||
//Rejecting will fail tests.
|
||||
}
|
||||
resolve();
|
||||
return returnValue;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function instantiateController() {
|
||||
controller = new BrowseController(
|
||||
mockScope,
|
||||
mockRoute,
|
||||
mockLocation,
|
||||
mockObjectService,
|
||||
mockNavigationService,
|
||||
mockUrlService,
|
||||
testDefaultRoot
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
testDefaultRoot = "some-root-level-domain-object";
|
||||
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
["$on", "$watch"]
|
||||
);
|
||||
mockRoute = { current: { params: {}, pathParams: {} } };
|
||||
mockUrlService = jasmine.createSpyObj(
|
||||
"urlService",
|
||||
["urlForLocation"]
|
||||
);
|
||||
mockUrlService.urlForLocation.and.callFake(function (mode, object) {
|
||||
if (object === mockDefaultRootObject) {
|
||||
return [mode, testDefaultRoot].join('/');
|
||||
}
|
||||
if (object === mockOtherDomainObject) {
|
||||
return [mode, 'other'].join('/');
|
||||
}
|
||||
if (object === mockNextObject) {
|
||||
return [mode, testDefaultRoot, 'next'].join('/');
|
||||
}
|
||||
throw new Error('Tried to get url for unexpected object');
|
||||
});
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
"$location",
|
||||
["path"]
|
||||
);
|
||||
mockObjectService = jasmine.createSpyObj(
|
||||
"objectService",
|
||||
["getObjects"]
|
||||
);
|
||||
mockNavigationService = new NavigationService({});
|
||||
[
|
||||
"getNavigation",
|
||||
"setNavigation",
|
||||
"addListener",
|
||||
"removeListener"
|
||||
].forEach(function (method) {
|
||||
spyOn(mockNavigationService, method)
|
||||
.and.callThrough();
|
||||
});
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"rootObjectContainer",
|
||||
["getId", "getCapability", "getModel", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockDefaultRootObject = jasmine.createSpyObj(
|
||||
"defaultRootObject",
|
||||
["getId", "getCapability", "getModel", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockOtherDomainObject = jasmine.createSpyObj(
|
||||
"otherDomainObject",
|
||||
["getId", "getCapability", "getModel", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockNextObject = jasmine.createSpyObj(
|
||||
"nestedDomainObject",
|
||||
["getId", "getCapability", "getModel", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockObjectService.getObjects.and.returnValue(Promise.resolve({
|
||||
ROOT: mockRootObject
|
||||
}));
|
||||
mockRootObject.useCapability.and.returnValue(Promise.resolve([
|
||||
mockOtherDomainObject,
|
||||
mockDefaultRootObject
|
||||
]));
|
||||
mockRootObject.hasCapability.and.returnValue(true);
|
||||
mockDefaultRootObject.useCapability.and.returnValue(Promise.resolve([
|
||||
mockNextObject
|
||||
]));
|
||||
mockDefaultRootObject.hasCapability.and.returnValue(true);
|
||||
mockOtherDomainObject.hasCapability.and.returnValue(false);
|
||||
mockNextObject.useCapability.and.returnValue(undefined);
|
||||
mockNextObject.hasCapability.and.returnValue(false);
|
||||
mockNextObject.getId.and.returnValue("next");
|
||||
mockDefaultRootObject.getId.and.returnValue(testDefaultRoot);
|
||||
|
||||
instantiateController();
|
||||
return waitsForNavigation();
|
||||
});
|
||||
|
||||
it("uses composition to set the navigated object, if there is none", function () {
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("navigates to a root-level object, even when default path is not found", function () {
|
||||
mockDefaultRootObject.getId
|
||||
.and.returnValue("something-other-than-the-" + testDefaultRoot);
|
||||
instantiateController();
|
||||
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not try to override navigation", function () {
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDefaultRootObject);
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("updates scope when navigated object changes", function () {
|
||||
// Should have registered a listener - call it
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](
|
||||
mockOtherDomainObject
|
||||
);
|
||||
expect(mockScope.navigatedObject).toEqual(mockOtherDomainObject);
|
||||
});
|
||||
|
||||
|
||||
it("releases its navigation listener when its scope is destroyed", function () {
|
||||
expect(mockScope.$on).toHaveBeenCalledWith(
|
||||
"$destroy",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
mockScope.$on.calls.mostRecent().args[1]();
|
||||
|
||||
// Should remove the listener it added earlier
|
||||
expect(mockNavigationService.removeListener).toHaveBeenCalledWith(
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0]
|
||||
);
|
||||
});
|
||||
|
||||
it("uses route parameters to choose initially-navigated object", function () {
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/next";
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockNextObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockNextObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("handles invalid IDs by going as far as possible", function () {
|
||||
// Idea here is that if we get a bad path of IDs,
|
||||
// browse controller should traverse down it until
|
||||
// it hits an invalid ID.
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/junk";
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("handles compositionless objects by going as far as possible", function () {
|
||||
// Idea here is that if we get a path which passes
|
||||
// through an object without a composition, browse controller
|
||||
// should stop at it since remaining IDs cannot be loaded.
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/next/junk";
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockNextObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockNextObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("updates the displayed route to reflect current navigation", function () {
|
||||
// In order to trigger a route update and not a route change,
|
||||
// the current route must be updated before location.path is
|
||||
// called.
|
||||
expect(mockRoute.current.pathParams.ids)
|
||||
.not
|
||||
.toBe(testDefaultRoot + '/next');
|
||||
mockLocation.path.and.callFake(function () {
|
||||
expect(mockRoute.current.pathParams.ids)
|
||||
.toBe(testDefaultRoot + '/next');
|
||||
});
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](
|
||||
mockNextObject
|
||||
);
|
||||
expect(mockLocation.path).toHaveBeenCalledWith(
|
||||
'/browse/' + testDefaultRoot + '/next'
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -1,93 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../src/BrowseObjectController"],
|
||||
function (BrowseObjectController) {
|
||||
|
||||
describe("The browse object controller", function () {
|
||||
var mockScope,
|
||||
mockLocation,
|
||||
mockRoute,
|
||||
controller;
|
||||
|
||||
// Utility function; look for a $watch on scope and fire it
|
||||
function fireWatch(expr, value) {
|
||||
mockScope.$watch.calls.all().forEach(function (call) {
|
||||
if (call.args[0] === expr) {
|
||||
call.args[1](value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
["$on", "$watch"]
|
||||
);
|
||||
mockRoute = { current: { params: {} } };
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
"$location",
|
||||
["path", "search"]
|
||||
);
|
||||
mockLocation.search.and.returnValue({});
|
||||
|
||||
controller = new BrowseObjectController(
|
||||
mockScope,
|
||||
mockLocation,
|
||||
mockRoute
|
||||
);
|
||||
});
|
||||
|
||||
it("updates query parameters when selected view changes", function () {
|
||||
fireWatch("representation.selected.key", "xyz");
|
||||
expect(mockLocation.search).toHaveBeenCalledWith('view', "xyz");
|
||||
|
||||
// Allows the path index to be checked
|
||||
// prior to setting $route.current
|
||||
mockLocation.path.and.returnValue("/browse/");
|
||||
});
|
||||
|
||||
it("sets the active view from query parameters", function () {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
['getId', 'getModel', 'getCapability', 'useCapability']
|
||||
),
|
||||
testViews = [
|
||||
{ key: 'abc' },
|
||||
{ key: 'def', someKey: 'some value' },
|
||||
{ key: 'xyz' }
|
||||
];
|
||||
|
||||
mockDomainObject.useCapability.and.callFake(function (c) {
|
||||
return (c === 'view') && testViews;
|
||||
});
|
||||
mockLocation.search.and.returnValue({ view: 'def' });
|
||||
|
||||
fireWatch('domainObject', mockDomainObject);
|
||||
expect(mockScope.representation.selected)
|
||||
.toEqual(testViews[1]);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -1,103 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../src/InspectorPaneController"],
|
||||
function (InspectorPaneController) {
|
||||
|
||||
describe("The InspectorPaneController", function () {
|
||||
var mockScope,
|
||||
mockAgentService,
|
||||
mockDomainObject,
|
||||
mockWindow,
|
||||
mockStatusCapability,
|
||||
mockNavigationService,
|
||||
mockNavigationUnlistener,
|
||||
mockStatusUnlistener,
|
||||
controller,
|
||||
mockLocation,
|
||||
mockAttrs;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$on"]);
|
||||
mockWindow = jasmine.createSpyObj("$window", ["open"]);
|
||||
mockAgentService = jasmine.createSpyObj(
|
||||
"agentService",
|
||||
["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"]
|
||||
);
|
||||
|
||||
mockNavigationUnlistener = jasmine.createSpy("navigationUnlistener");
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
["getNavigation", "addListener"]
|
||||
);
|
||||
mockNavigationService.addListener.and.returnValue(mockNavigationUnlistener);
|
||||
|
||||
mockStatusUnlistener = jasmine.createSpy("statusUnlistener");
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"statusCapability",
|
||||
["listen"]
|
||||
);
|
||||
mockStatusCapability.listen.and.returnValue(mockStatusUnlistener);
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[
|
||||
'getId',
|
||||
'getModel',
|
||||
'getCapability',
|
||||
'hasCapability'
|
||||
]
|
||||
);
|
||||
mockDomainObject.getId.and.returnValue("domainObject");
|
||||
mockDomainObject.getModel.and.returnValue({});
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.getCapability.and.returnValue(mockStatusCapability);
|
||||
|
||||
mockLocation = jasmine.createSpyObj('location', ['search']);
|
||||
mockLocation.search.and.returnValue({});
|
||||
|
||||
mockAttrs = {};
|
||||
|
||||
controller = new InspectorPaneController(mockScope, mockAgentService, mockWindow, mockNavigationService, mockLocation, mockAttrs);
|
||||
});
|
||||
|
||||
it("listens for changes to navigation and attaches a status" +
|
||||
" listener", function () {
|
||||
expect(mockNavigationService.addListener).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](mockDomainObject);
|
||||
expect(mockStatusCapability.listen).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("if hidden, shows the inspector when domain object switches to" +
|
||||
" edit mode", function () {
|
||||
controller.toggle();
|
||||
// test pre-condition that inspector is hidden
|
||||
expect(controller.visible()).toBe(false);
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](mockDomainObject);
|
||||
mockStatusCapability.listen.calls.mostRecent().args[0](["editing"]);
|
||||
expect(controller.visible()).toBe(true);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -1,79 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* MenuArrowControllerSpec. Created by shale on 07/02/2015.
|
||||
*/
|
||||
define(
|
||||
["../src/MenuArrowController"],
|
||||
function (MenuArrowController) {
|
||||
|
||||
describe("The menu arrow controller ", function () {
|
||||
var mockScope,
|
||||
mockDomainObject,
|
||||
mockEvent,
|
||||
mockContextMenuAction,
|
||||
mockActionContext,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[""]
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getCapability"]
|
||||
);
|
||||
mockEvent = jasmine.createSpyObj(
|
||||
"event",
|
||||
["preventDefault"]
|
||||
);
|
||||
mockContextMenuAction = jasmine.createSpyObj(
|
||||
"action",
|
||||
["perform", "getActions"]
|
||||
);
|
||||
mockActionContext = jasmine.createSpyObj(
|
||||
"actionContext",
|
||||
[""]
|
||||
);
|
||||
|
||||
mockActionContext.domainObject = mockDomainObject;
|
||||
mockActionContext.event = mockEvent;
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
mockDomainObject.getCapability.and.returnValue(mockContextMenuAction);
|
||||
mockContextMenuAction.perform.and.returnValue(jasmine.any(Function));
|
||||
|
||||
controller = new MenuArrowController(mockScope);
|
||||
});
|
||||
|
||||
it("calls the context menu action when clicked", function () {
|
||||
// Simulate a click on the menu arrow
|
||||
controller.showMenu(mockEvent);
|
||||
|
||||
// Expect the menu action to be performed
|
||||
expect(mockDomainObject.getCapability).toHaveBeenCalledWith('action');
|
||||
expect(mockContextMenuAction.perform).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -1,137 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../src/ObjectHeaderController"],
|
||||
function (ObjectHeaderController) {
|
||||
|
||||
describe("The object header controller", function () {
|
||||
var mockScope,
|
||||
mockDomainObject,
|
||||
mockCapabilities,
|
||||
mockMutationCapability,
|
||||
mockTypeCapability,
|
||||
mockEvent,
|
||||
mockCurrentTarget,
|
||||
model,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockMutationCapability = jasmine.createSpyObj("mutation", ["mutate"]);
|
||||
mockTypeCapability = jasmine.createSpyObj("type", ["typeDef", "hasFeature"]);
|
||||
mockTypeCapability.typeDef = { name: ""};
|
||||
mockTypeCapability.hasFeature.and.callFake(function (feature) {
|
||||
return feature === 'creation';
|
||||
});
|
||||
|
||||
mockCapabilities = {
|
||||
mutation: mockMutationCapability,
|
||||
type: mockTypeCapability
|
||||
};
|
||||
|
||||
model = {
|
||||
name: "Test name"
|
||||
};
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", ["getCapability", "getModel"]);
|
||||
mockDomainObject.getModel.and.returnValue(model);
|
||||
mockDomainObject.getCapability.and.callFake(function (key) {
|
||||
return mockCapabilities[key];
|
||||
});
|
||||
|
||||
mockScope = {
|
||||
domainObject: mockDomainObject
|
||||
};
|
||||
|
||||
mockCurrentTarget = jasmine.createSpyObj("currentTarget", ["blur", "textContent"]);
|
||||
mockCurrentTarget.blur.and.returnValue(mockCurrentTarget);
|
||||
|
||||
mockEvent = {
|
||||
which: {},
|
||||
type: {},
|
||||
currentTarget: mockCurrentTarget
|
||||
};
|
||||
|
||||
controller = new ObjectHeaderController(mockScope);
|
||||
});
|
||||
|
||||
it("updates the model with new name on blur", function () {
|
||||
mockEvent.type = "blur";
|
||||
mockCurrentTarget.textContent = "New name";
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates the model with a default for blank names", function () {
|
||||
mockEvent.type = "blur";
|
||||
mockCurrentTarget.textContent = "";
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockCurrentTarget.textContent.length).not.toEqual(0);
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not update the model if the same name", function () {
|
||||
mockEvent.type = "blur";
|
||||
mockCurrentTarget.textContent = mockDomainObject.getModel().name;
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates the model on enter keypress event only", function () {
|
||||
mockCurrentTarget.textContent = "New name";
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).not.toHaveBeenCalled();
|
||||
|
||||
mockEvent.which = 13;
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
|
||||
mockMutationCapability.mutate.calls.mostRecent().args[0](model);
|
||||
|
||||
expect(mockDomainObject.getModel().name).toBe("New name");
|
||||
});
|
||||
|
||||
it("blurs the field on enter key press", function () {
|
||||
mockCurrentTarget.textContent = "New name";
|
||||
mockEvent.which = 13;
|
||||
controller.updateName(mockEvent);
|
||||
|
||||
expect(mockEvent.currentTarget.blur).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("allows editting name when object is creatable", function () {
|
||||
expect(controller.allowEdit()).toBe(true);
|
||||
});
|
||||
|
||||
it("disallows editting name when object is non-creatable", function () {
|
||||
mockTypeCapability.hasFeature.and.returnValue(false);
|
||||
|
||||
expect(controller.allowEdit()).toBe(false);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -1,106 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../src/PaneController"],
|
||||
function (PaneController) {
|
||||
|
||||
describe("The PaneController", function () {
|
||||
var mockScope,
|
||||
mockAgentService,
|
||||
mockWindow,
|
||||
controller,
|
||||
mockLocation,
|
||||
mockAttrs;
|
||||
|
||||
// We want to reinstantiate for each test case
|
||||
// because device state can influence constructor-time behavior
|
||||
function instantiateController() {
|
||||
return new PaneController(
|
||||
mockScope,
|
||||
mockAgentService,
|
||||
mockWindow,
|
||||
mockLocation,
|
||||
mockAttrs
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$on"]);
|
||||
mockAgentService = jasmine.createSpyObj(
|
||||
"agentService",
|
||||
["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"]
|
||||
);
|
||||
mockWindow = jasmine.createSpyObj("$window", ["open"]);
|
||||
|
||||
mockLocation = jasmine.createSpyObj('location', ['search']);
|
||||
mockLocation.search.and.returnValue({});
|
||||
|
||||
mockAttrs = {};
|
||||
});
|
||||
|
||||
it("is initially visible", function () {
|
||||
expect(instantiateController().visible()).toBeTruthy();
|
||||
});
|
||||
|
||||
it("allows visibility to be toggled", function () {
|
||||
controller = instantiateController();
|
||||
controller.toggle();
|
||||
expect(controller.visible()).toBeFalsy();
|
||||
controller.toggle();
|
||||
expect(controller.visible()).toBeTruthy();
|
||||
});
|
||||
|
||||
it("collapses on navigation changes on portrait-oriented phones", function () {
|
||||
mockAgentService.isMobile.and.returnValue(true);
|
||||
mockAgentService.isPhone.and.returnValue(true);
|
||||
mockAgentService.isPortrait.and.returnValue(true);
|
||||
controller = instantiateController();
|
||||
expect(controller.visible()).toBeTruthy();
|
||||
|
||||
// Simulate a change from the tree by invoking controller's
|
||||
controller.callback();
|
||||
|
||||
// Tree should have collapsed
|
||||
expect(controller.visible()).toBeFalsy();
|
||||
});
|
||||
|
||||
describe("specifying hideParameter", function () {
|
||||
beforeEach(function () {
|
||||
mockAttrs = {hideParameter: 'hideTree'};
|
||||
});
|
||||
|
||||
it("sets pane state to false when in location.search", function () {
|
||||
mockLocation.search.and.returnValue({'hideTree': true});
|
||||
expect(instantiateController().visible()).toBe(false);
|
||||
expect(mockLocation.search).toHaveBeenCalledWith('hideTree', undefined);
|
||||
});
|
||||
|
||||
it("sets state to true when not found in location.search", function () {
|
||||
mockLocation.search.and.returnValue({});
|
||||
expect(instantiateController().visible()).toBe(true);
|
||||
expect(mockLocation.search).not.toHaveBeenCalledWith('hideTree', undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -1,78 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* WindowTitlerSpec. Created by vwoeltje on 11/6/14.
|
||||
*/
|
||||
define(
|
||||
["../../src/windowing/WindowTitler"],
|
||||
function (WindowTitler) {
|
||||
|
||||
describe("The window titler", function () {
|
||||
var mockNavigationService,
|
||||
mockRootScope,
|
||||
mockDocument,
|
||||
mockDomainObject,
|
||||
titler; // eslint-disable-line
|
||||
|
||||
beforeEach(function () {
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
'navigationService',
|
||||
['getNavigation']
|
||||
);
|
||||
mockRootScope = jasmine.createSpyObj(
|
||||
'$rootScope',
|
||||
['$watch']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
['getModel']
|
||||
);
|
||||
mockDocument = [{}];
|
||||
|
||||
mockDomainObject.getModel.and.returnValue({ name: 'Test name' });
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
|
||||
titler = new WindowTitler(
|
||||
mockNavigationService,
|
||||
mockRootScope,
|
||||
mockDocument
|
||||
);
|
||||
});
|
||||
|
||||
it("listens for changes to the name of the navigated object", function () {
|
||||
expect(mockRootScope.$watch).toHaveBeenCalledWith(
|
||||
jasmine.any(Function),
|
||||
jasmine.any(Function)
|
||||
);
|
||||
expect(mockRootScope.$watch.calls.mostRecent().args[0]())
|
||||
.toEqual('Test name');
|
||||
});
|
||||
|
||||
it("sets the title to the name of the navigated object", function () {
|
||||
mockRootScope.$watch.calls.mostRecent().args[1]("Some name");
|
||||
expect(mockDocument[0].title).toEqual("Some name");
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -28,9 +28,9 @@ define([
|
||||
"./res/templates/dialog.html",
|
||||
"./res/templates/overlay-blocking-message.html",
|
||||
"./res/templates/message.html",
|
||||
"./res/templates/notification-message.html",
|
||||
"./res/templates/overlay-message-list.html",
|
||||
"./res/templates/overlay.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/overlay.html"
|
||||
], function (
|
||||
DialogService,
|
||||
OverlayService,
|
||||
@ -39,66 +39,74 @@ define([
|
||||
dialogTemplate,
|
||||
overlayBlockingMessageTemplate,
|
||||
messageTemplate,
|
||||
notificationMessageTemplate,
|
||||
overlayMessageListTemplate,
|
||||
overlayTemplate,
|
||||
legacyRegistry
|
||||
overlayTemplate
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/dialog", {
|
||||
"extensions": {
|
||||
"services": [
|
||||
{
|
||||
"key": "dialogService",
|
||||
"implementation": DialogService,
|
||||
"depends": [
|
||||
"overlayService",
|
||||
"$q",
|
||||
"$log",
|
||||
"$document"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "overlayService",
|
||||
"implementation": OverlayService,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$compile",
|
||||
"$rootScope"
|
||||
]
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "overlay-dialog",
|
||||
"template": overlayDialogTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-options",
|
||||
"template": overlayOptionsTemplate
|
||||
},
|
||||
{
|
||||
"key": "form-dialog",
|
||||
"template": dialogTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-blocking-message",
|
||||
"template": overlayBlockingMessageTemplate
|
||||
},
|
||||
{
|
||||
"key": "message",
|
||||
"template": messageTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-message-list",
|
||||
"template": overlayMessageListTemplate
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
{
|
||||
"key": "overlay",
|
||||
"template": overlayTemplate
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"platform/commonUI/dialog",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"services": [
|
||||
{
|
||||
"key": "dialogService",
|
||||
"implementation": DialogService,
|
||||
"depends": [
|
||||
"overlayService",
|
||||
"$q",
|
||||
"$log",
|
||||
"$document"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "overlayService",
|
||||
"implementation": OverlayService,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$compile",
|
||||
"$rootScope",
|
||||
"$timeout"
|
||||
]
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "overlay-dialog",
|
||||
"template": overlayDialogTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-options",
|
||||
"template": overlayOptionsTemplate
|
||||
},
|
||||
{
|
||||
"key": "form-dialog",
|
||||
"template": dialogTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-blocking-message",
|
||||
"template": overlayBlockingMessageTemplate
|
||||
},
|
||||
{
|
||||
"key": "message",
|
||||
"template": messageTemplate
|
||||
},
|
||||
{
|
||||
"key": "notification-message",
|
||||
"template": notificationMessageTemplate
|
||||
},
|
||||
{
|
||||
"key": "overlay-message-list",
|
||||
"template": overlayMessageListTemplate
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
{
|
||||
"key": "overlay",
|
||||
"template": overlayTemplate
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -19,24 +19,24 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div class="abs top-bar">
|
||||
<div class="dialog-title">{{ngModel.title}}</div>
|
||||
<div class="hint">All fields marked <span class="req icon-asterisk"></span> are required.</div>
|
||||
<div class="c-overlay__top-bar">
|
||||
<div class="c-overlay__dialog-title">{{ngModel.title}}</div>
|
||||
<div class="c-overlay__dialog-hint hint">All fields marked <span class="req icon-asterisk"></span> are required.</div>
|
||||
</div>
|
||||
<div class='abs editor'>
|
||||
<div class='c-overlay__contents-main'>
|
||||
<mct-form ng-model="ngModel.value"
|
||||
structure="ngModel.structure"
|
||||
class="validates"
|
||||
name="createForm">
|
||||
</mct-form>
|
||||
</div>
|
||||
<div class="abs bottom-bar">
|
||||
<a class='s-button major'
|
||||
<div class="c-overlay__button-bar">
|
||||
<a class='c-button c-button--major'
|
||||
ng-class="{ disabled: !createForm.$valid }"
|
||||
ng-click="ngModel.confirm()">
|
||||
OK
|
||||
</a>
|
||||
<a class='s-button'
|
||||
<a class='c-button '
|
||||
ng-click="ngModel.cancel()">
|
||||
Cancel
|
||||
</a>
|
||||
|
@ -1,15 +1,32 @@
|
||||
<div class="l-message"
|
||||
<div class="c-message"
|
||||
ng-class="'message-severity-' + ngModel.severity">
|
||||
<div class="w-message-contents">
|
||||
<div class="top-bar">
|
||||
<div class="title">{{ngModel.message}}</div>
|
||||
<div class="c-message__top-bar">
|
||||
<div class="c-message__title">{{ngModel.title}}</div>
|
||||
</div>
|
||||
<div class="c-message__hint" ng-hide="ngModel.hint === undefined">
|
||||
{{ngModel.hint}}
|
||||
<span ng-if="ngModel.timestamp !== undefined">[{{ngModel.timestamp}}]</span>
|
||||
</div>
|
||||
<div class="message-body">
|
||||
<div class="message-action">
|
||||
{{ngModel.actionText}}
|
||||
</div>
|
||||
<mct-include key="'progress-bar'"
|
||||
ng-model="ngModel"
|
||||
ng-show="ngModel.progressPerc !== undefined"></mct-include>
|
||||
ng-show="ngModel.progress !== undefined || ngModel.unknownProgress"></mct-include>
|
||||
</div>
|
||||
<div class="bottom-bar">
|
||||
<div class="c-overlay__button-bar">
|
||||
<button ng-repeat="dialogOption in ngModel.options"
|
||||
class="c-button"
|
||||
ng-click="dialogOption.callback()">
|
||||
{{dialogOption.label}}
|
||||
</button>
|
||||
<button class="c-button c-button--major"
|
||||
ng-if="ngModel.primaryOption"
|
||||
ng-click="ngModel.primaryOption.callback()">
|
||||
{{ngModel.primaryOption.label}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,25 @@
|
||||
<div class="c-message"
|
||||
ng-class="'message-severity-' + ngModel.severity">
|
||||
<div class="w-message-contents">
|
||||
<div class="c-message__top-bar">
|
||||
<div class="c-message__title">{{ngModel.message}}</div>
|
||||
</div>
|
||||
<div class="message-body">
|
||||
<mct-include key="'progress-bar'"
|
||||
ng-model="ngModel"
|
||||
ng-show="ngModel.progressPerc !== undefined"></mct-include>
|
||||
</div>
|
||||
</div>
|
||||
<div class="c-overlay__button-bar">
|
||||
<button ng-repeat="dialogOption in ngModel.options"
|
||||
class="c-button"
|
||||
ng-click="dialogOption.callback()">
|
||||
{{dialogOption.label}}
|
||||
</button>
|
||||
<button class="c-button c-button--major"
|
||||
ng-if="ngModel.primaryOption"
|
||||
ng-click="ngModel.primaryOption.callback()">
|
||||
{{ngModel.primaryOption.label}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
@ -1,22 +1,23 @@
|
||||
<mct-container key="overlay">
|
||||
<div class="t-message-list">
|
||||
<div class="top-bar">
|
||||
<div class="dialog-title">{{ngModel.dialog.title}}</div>
|
||||
<div class="hint">Displaying {{ngModel.dialog.messages.length}} message<span ng-show="ngModel.dialog.messages.length > 1 ||
|
||||
ngModel.dialog.messages.length == 0">s</span>
|
||||
<div class="t-message-list c-overlay__contents">
|
||||
<div class="c-overlay__top-bar">
|
||||
<div class="c-overlay__dialog-title">{{ngModel.dialog.title}}</div>
|
||||
<div class="c-overlay__dialog-hint">Displaying {{ngModel.dialog.messages.length}} message<span
|
||||
ng-show="ngModel.dialog.messages.length > 1 ||
|
||||
ngModel.dialog.messages.length == 0">s</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-messages">
|
||||
<div class="w-messages c-overlay__messages">
|
||||
<mct-include
|
||||
ng-repeat="msg in ngModel.dialog.messages | orderBy: '-'"
|
||||
key="'message'" ng-model="msg.model"></mct-include>
|
||||
key="'notification-message'" ng-model="msg.model"></mct-include>
|
||||
</div>
|
||||
<div class="bottom-bar">
|
||||
<a ng-repeat="dialogAction in ngModel.dialog.actions"
|
||||
class="s-button major"
|
||||
<div class="c-overlay__bottom-bar">
|
||||
<button ng-repeat="dialogAction in ngModel.dialog.actions"
|
||||
class="c-button c-button--major"
|
||||
ng-click="dialogAction.action()">
|
||||
{{dialogAction.label}}
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mct-container>
|
||||
|
@ -19,18 +19,18 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<mct-container key="overlay">
|
||||
<div class="abs top-bar">
|
||||
<div class="dialog-title">{{ngModel.dialog.title}}</div>
|
||||
<div class="hint">{{ngModel.dialog.hint}}</div>
|
||||
<mct-container key="c-overlay__contents">
|
||||
<div class=c-overlay__top-bar">
|
||||
<div class="c-overlay__dialog-title">{{ngModel.dialog.title}}</div>
|
||||
<div class="c-overlay__dialog-hint hint">{{ngModel.dialog.hint}}</div>
|
||||
</div>
|
||||
<div class='abs editor'>
|
||||
<div class='c-overlay__contents-main'>
|
||||
<mct-include key="ngModel.dialog.template"
|
||||
parameters="ngModel.dialog.parameters"
|
||||
ng-model="ngModel.dialog.model">
|
||||
</mct-include>
|
||||
</div>
|
||||
<div class="abs bottom-bar">
|
||||
<div class="c-overlay__button-bar">
|
||||
<a ng-repeat="option in ngModel.dialog.options"
|
||||
href=''
|
||||
class="s-button lg"
|
||||
|
@ -19,12 +19,12 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div class="abs overlay l-dialog" ng-class="{'delayEntry100ms' : ngModel.delay}">
|
||||
<div class="abs blocker"></div>
|
||||
<div class="abs outer-holder">
|
||||
<a ng-click="ngModel.cancel()"
|
||||
<div class="c-overlay l-overlay-small" ng-class="{'delayEntry100ms' : ngModel.delay}">
|
||||
<div class="c-overlay__blocker"></div>
|
||||
<div class="c-overlay__outer">
|
||||
<button ng-click="ngModel.cancel()"
|
||||
ng-if="ngModel.cancel"
|
||||
class="close icon-x-in-circle"></a>
|
||||
<div class="abs inner-holder contents" ng-transclude></div>
|
||||
class="c-click-icon c-overlay__close-button icon-x-in-circle"></button>
|
||||
<div class="c-overlay__contents" ng-transclude></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,8 +44,9 @@ define(
|
||||
* @memberof platform/commonUI/dialog
|
||||
* @constructor
|
||||
*/
|
||||
function OverlayService($document, $compile, $rootScope) {
|
||||
function OverlayService($document, $compile, $rootScope, $timeout) {
|
||||
this.$compile = $compile;
|
||||
this.$timeout = $timeout;
|
||||
|
||||
// Don't include $document and $rootScope directly;
|
||||
// avoids https://docs.angularjs.org/error/ng/cpws
|
||||
@ -93,12 +94,14 @@ define(
|
||||
scope.key = key;
|
||||
scope.typeClass = typeClass || 't-dialog';
|
||||
|
||||
// Create the overlay element and add it to the document's body
|
||||
element = this.$compile(TEMPLATE)(scope);
|
||||
|
||||
// Append so that most recent dialog is last in DOM. This means the most recent dialog will be on top when
|
||||
// multiple overlays with the same z-index are active.
|
||||
this.findBody().append(element);
|
||||
this.$timeout(() => {
|
||||
// Create the overlay element and add it to the document's body
|
||||
element = this.$compile(TEMPLATE)(scope);
|
||||
|
||||
// Append so that most recent dialog is last in DOM. This means the most recent dialog will be on top when
|
||||
// multiple overlays with the same z-index are active.
|
||||
this.findBody().append(element);
|
||||
});
|
||||
|
||||
return {
|
||||
dismiss: dismiss
|
||||
|
@ -35,16 +35,20 @@ define(
|
||||
mockTemplate,
|
||||
mockElement,
|
||||
mockScope,
|
||||
mockTimeout,
|
||||
overlayService;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDocument = jasmine.createSpyObj("$document", ["find"]);
|
||||
mockCompile = jasmine.createSpy("$compile");
|
||||
mockRootScope = jasmine.createSpyObj("$rootScope", ["$new"]);
|
||||
mockBody = jasmine.createSpyObj("body", ["prepend"]);
|
||||
mockBody = jasmine.createSpyObj("body", ["append"]);
|
||||
mockTemplate = jasmine.createSpy("template");
|
||||
mockElement = jasmine.createSpyObj("element", ["remove"]);
|
||||
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
|
||||
mockTimeout = function (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
mockCompile.and.returnValue(mockTemplate);
|
||||
@ -54,7 +58,8 @@ define(
|
||||
overlayService = new OverlayService(
|
||||
mockDocument,
|
||||
mockCompile,
|
||||
mockRootScope
|
||||
mockRootScope,
|
||||
mockTimeout
|
||||
);
|
||||
});
|
||||
|
||||
@ -67,7 +72,7 @@ define(
|
||||
|
||||
it("adds the templated element to the body", function () {
|
||||
overlayService.createOverlay("test", {});
|
||||
expect(mockBody.prepend).toHaveBeenCalledWith(mockElement);
|
||||
expect(mockBody.append).toHaveBeenCalledWith(mockElement);
|
||||
});
|
||||
|
||||
it("places the provided model/key in its template's scope", function () {
|
||||
|
@ -27,12 +27,10 @@ define([
|
||||
"./src/actions/EditAndComposeAction",
|
||||
"./src/actions/EditAction",
|
||||
"./src/actions/PropertiesAction",
|
||||
"./src/actions/RemoveAction",
|
||||
"./src/actions/SaveAction",
|
||||
"./src/actions/SaveAndStopEditingAction",
|
||||
"./src/actions/SaveAsAction",
|
||||
"./src/actions/CancelAction",
|
||||
"./src/policies/EditActionPolicy",
|
||||
"./src/policies/EditPersistableObjectsPolicy",
|
||||
"./src/representers/EditRepresenter",
|
||||
"./src/capabilities/EditorCapability",
|
||||
@ -50,8 +48,7 @@ define([
|
||||
"./res/templates/library.html",
|
||||
"./res/templates/edit-object.html",
|
||||
"./res/templates/edit-action-buttons.html",
|
||||
"./res/templates/topbar-edit.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/topbar-edit.html"
|
||||
], function (
|
||||
EditActionController,
|
||||
EditPanesController,
|
||||
@ -59,12 +56,10 @@ define([
|
||||
EditAndComposeAction,
|
||||
EditAction,
|
||||
PropertiesAction,
|
||||
RemoveAction,
|
||||
SaveAction,
|
||||
SaveAndStopEditingAction,
|
||||
SaveAsAction,
|
||||
CancelAction,
|
||||
EditActionPolicy,
|
||||
EditPersistableObjectsPolicy,
|
||||
EditRepresenter,
|
||||
EditorCapability,
|
||||
@ -82,292 +77,277 @@ define([
|
||||
libraryTemplate,
|
||||
editObjectTemplate,
|
||||
editActionButtonsTemplate,
|
||||
topbarEditTemplate,
|
||||
legacyRegistry
|
||||
topbarEditTemplate
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/edit", {
|
||||
"extensions": {
|
||||
"controllers": [
|
||||
{
|
||||
"key": "EditActionController",
|
||||
"implementation": EditActionController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "EditPanesController",
|
||||
"implementation": EditPanesController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "EditObjectController",
|
||||
"implementation": EditObjectController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$location",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "CreateMenuController",
|
||||
"implementation": CreateMenuController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "LocatorController",
|
||||
"implementation": LocatorController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"objectService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"key": "compose",
|
||||
"implementation": EditAndComposeAction
|
||||
},
|
||||
{
|
||||
"key": "edit",
|
||||
"implementation": EditAction,
|
||||
"depends": [
|
||||
"$location",
|
||||
"navigationService",
|
||||
"$log"
|
||||
],
|
||||
"description": "Edit",
|
||||
"category": "view-control",
|
||||
"cssClass": "major icon-pencil"
|
||||
},
|
||||
{
|
||||
"key": "properties",
|
||||
"category": [
|
||||
"contextual",
|
||||
"view-control"
|
||||
],
|
||||
"implementation": PropertiesAction,
|
||||
"cssClass": "major icon-pencil",
|
||||
"name": "Edit Properties...",
|
||||
"description": "Edit properties of this object.",
|
||||
"depends": [
|
||||
"dialogService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "remove",
|
||||
"category": "contextual",
|
||||
"implementation": RemoveAction,
|
||||
"cssClass": "icon-trash",
|
||||
"name": "Remove",
|
||||
"description": "Remove this object from its containing object.",
|
||||
"depends": [
|
||||
"openmct",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "save-and-stop-editing",
|
||||
"category": "save",
|
||||
"implementation": SaveAndStopEditingAction,
|
||||
"name": "Save and Finish Editing",
|
||||
"cssClass": "icon-save labeled",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "save",
|
||||
"category": "save",
|
||||
"implementation": SaveAction,
|
||||
"name": "Save and Continue Editing",
|
||||
"cssClass": "icon-save labeled",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "save-as",
|
||||
"category": "save",
|
||||
"implementation": SaveAsAction,
|
||||
"name": "Save As...",
|
||||
"cssClass": "icon-save labeled",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [
|
||||
"$injector",
|
||||
"dialogService",
|
||||
"copyService",
|
||||
"notificationService",
|
||||
"openmct"
|
||||
],
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
"key": "cancel",
|
||||
"category": "conclude-editing",
|
||||
"implementation": CancelAction,
|
||||
// Because we use the name as label for edit buttons and mct-control buttons need
|
||||
// the label to be set to undefined in order to not apply the labeled CSS rule.
|
||||
"name": undefined,
|
||||
"cssClass": "icon-x no-label",
|
||||
"description": "Discard changes made to these objects.",
|
||||
"depends": []
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"category": "action",
|
||||
"implementation": EditActionPolicy
|
||||
},
|
||||
{
|
||||
"category": "action",
|
||||
"implementation": EditPersistableObjectsPolicy,
|
||||
"depends": ["openmct"]
|
||||
},
|
||||
{
|
||||
"implementation": CreationPolicy,
|
||||
"category": "creation"
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "edit-library",
|
||||
"template": libraryTemplate
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "edit-object",
|
||||
"template": editObjectTemplate,
|
||||
"uses": [
|
||||
"view"
|
||||
],
|
||||
"gestures": [
|
||||
"drop"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "edit-action-buttons",
|
||||
"template": editActionButtonsTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "topbar-edit",
|
||||
"template": topbarEditTemplate
|
||||
},
|
||||
{
|
||||
"key": "create-button",
|
||||
"template": createButtonTemplate
|
||||
},
|
||||
{
|
||||
"key": "create-menu",
|
||||
"template": createMenuTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"type": "decorator",
|
||||
"provides": "capabilityService",
|
||||
"implementation": TransactionCapabilityDecorator,
|
||||
"depends": [
|
||||
"$q",
|
||||
"transactionManager"
|
||||
],
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
"type": "provider",
|
||||
"provides": "transactionService",
|
||||
"implementation": TransactionService,
|
||||
"depends": [
|
||||
"$q",
|
||||
"$log",
|
||||
"cacheService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "CreateActionProvider",
|
||||
"provides": "actionService",
|
||||
"type": "provider",
|
||||
"implementation": CreateActionProvider,
|
||||
"depends": [
|
||||
"typeService",
|
||||
"policyService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "CreationService",
|
||||
"provides": "creationService",
|
||||
"type": "provider",
|
||||
"implementation": CreationService,
|
||||
"depends": [
|
||||
"$q",
|
||||
"$log"
|
||||
]
|
||||
}
|
||||
|
||||
],
|
||||
"representers": [
|
||||
{
|
||||
"implementation": EditRepresenter,
|
||||
"depends": [
|
||||
"$log"
|
||||
]
|
||||
}
|
||||
],
|
||||
"capabilities": [
|
||||
{
|
||||
"key": "editor",
|
||||
"name": "Editor Capability",
|
||||
"description": "Provides transactional editing capabilities",
|
||||
"implementation": EditorCapability,
|
||||
"depends": [
|
||||
"transactionService",
|
||||
"openmct"
|
||||
]
|
||||
}
|
||||
],
|
||||
"controls": [
|
||||
{
|
||||
"key": "locator",
|
||||
"template": locatorTemplate
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "transactionManager",
|
||||
"implementation": TransactionManager,
|
||||
"depends": [
|
||||
"transactionService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
depends: [
|
||||
"toolbars[]",
|
||||
"openmct"
|
||||
],
|
||||
implementation: function (toolbars, openmct) {
|
||||
toolbars.forEach(openmct.toolbars.addProvider, openmct.toolbars);
|
||||
return {
|
||||
name: "platform/commonUI/edit",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"controllers": [
|
||||
{
|
||||
"key": "EditActionController",
|
||||
"implementation": EditActionController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "EditPanesController",
|
||||
"implementation": EditPanesController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "EditObjectController",
|
||||
"implementation": EditObjectController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$location",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "CreateMenuController",
|
||||
"implementation": CreateMenuController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "LocatorController",
|
||||
"implementation": LocatorController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"objectService"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"key": "compose",
|
||||
"implementation": EditAndComposeAction
|
||||
},
|
||||
{
|
||||
"key": "edit",
|
||||
"implementation": EditAction,
|
||||
"depends": [
|
||||
"$location",
|
||||
"navigationService",
|
||||
"$log"
|
||||
],
|
||||
"description": "Edit",
|
||||
"category": "view-control",
|
||||
"cssClass": "major icon-pencil"
|
||||
},
|
||||
{
|
||||
"key": "properties",
|
||||
"category": [
|
||||
"contextual",
|
||||
"view-control"
|
||||
],
|
||||
"implementation": PropertiesAction,
|
||||
"cssClass": "major icon-pencil",
|
||||
"name": "Edit Properties...",
|
||||
"description": "Edit properties of this object.",
|
||||
"depends": [
|
||||
"dialogService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "save-and-stop-editing",
|
||||
"category": "save",
|
||||
"implementation": SaveAndStopEditingAction,
|
||||
"name": "Save and Finish Editing",
|
||||
"cssClass": "icon-save labeled",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "save",
|
||||
"category": "save",
|
||||
"implementation": SaveAction,
|
||||
"name": "Save and Continue Editing",
|
||||
"cssClass": "icon-save labeled",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"notificationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "save-as",
|
||||
"category": "save",
|
||||
"implementation": SaveAsAction,
|
||||
"name": "Save As...",
|
||||
"cssClass": "icon-save labeled",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [
|
||||
"$injector",
|
||||
"dialogService",
|
||||
"copyService",
|
||||
"notificationService",
|
||||
"openmct"
|
||||
],
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
"key": "cancel",
|
||||
"category": "conclude-editing",
|
||||
"implementation": CancelAction,
|
||||
// Because we use the name as label for edit buttons and mct-control buttons need
|
||||
// the label to be set to undefined in order to not apply the labeled CSS rule.
|
||||
"name": undefined,
|
||||
"cssClass": "icon-x no-label",
|
||||
"description": "Discard changes made to these objects.",
|
||||
"depends": []
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"category": "action",
|
||||
"implementation": EditPersistableObjectsPolicy,
|
||||
"depends": ["openmct"]
|
||||
},
|
||||
{
|
||||
"implementation": CreationPolicy,
|
||||
"category": "creation"
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "edit-library",
|
||||
"template": libraryTemplate
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "edit-object",
|
||||
"template": editObjectTemplate,
|
||||
"uses": [
|
||||
"view"
|
||||
],
|
||||
"gestures": [
|
||||
"drop"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "edit-action-buttons",
|
||||
"template": editActionButtonsTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "topbar-edit",
|
||||
"template": topbarEditTemplate
|
||||
},
|
||||
{
|
||||
"key": "create-button",
|
||||
"template": createButtonTemplate
|
||||
},
|
||||
{
|
||||
"key": "create-menu",
|
||||
"template": createMenuTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"type": "decorator",
|
||||
"provides": "capabilityService",
|
||||
"implementation": TransactionCapabilityDecorator,
|
||||
"depends": [
|
||||
"$q",
|
||||
"transactionManager"
|
||||
],
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
"type": "provider",
|
||||
"provides": "transactionService",
|
||||
"implementation": TransactionService,
|
||||
"depends": [
|
||||
"$q",
|
||||
"$log",
|
||||
"cacheService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "CreateActionProvider",
|
||||
"provides": "actionService",
|
||||
"type": "provider",
|
||||
"implementation": CreateActionProvider,
|
||||
"depends": [
|
||||
"typeService",
|
||||
"policyService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "CreationService",
|
||||
"provides": "creationService",
|
||||
"type": "provider",
|
||||
"implementation": CreationService,
|
||||
"depends": [
|
||||
"$q",
|
||||
"$log"
|
||||
]
|
||||
}
|
||||
|
||||
],
|
||||
"representers": [
|
||||
{
|
||||
"implementation": EditRepresenter,
|
||||
"depends": [
|
||||
"$log"
|
||||
]
|
||||
}
|
||||
],
|
||||
"capabilities": [
|
||||
{
|
||||
"key": "editor",
|
||||
"name": "Editor Capability",
|
||||
"description": "Provides transactional editing capabilities",
|
||||
"implementation": EditorCapability,
|
||||
"depends": [
|
||||
"transactionService",
|
||||
"openmct"
|
||||
]
|
||||
}
|
||||
],
|
||||
"controls": [
|
||||
{
|
||||
"key": "locator",
|
||||
"template": locatorTemplate
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "transactionManager",
|
||||
"implementation": TransactionManager,
|
||||
"depends": [
|
||||
"transactionService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
depends: [
|
||||
"toolbars[]",
|
||||
"openmct"
|
||||
],
|
||||
implementation: function (toolbars, openmct) {
|
||||
toolbars.forEach(openmct.toolbars.addProvider, openmct.toolbars);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ define(
|
||||
name: "Properties",
|
||||
rows: this.properties.map(function (property, index) {
|
||||
// Property definition is same as form row definition
|
||||
var row = Object.create(property.getDefinition());
|
||||
var row = JSON.parse(JSON.stringify(property.getDefinition()));
|
||||
row.key = index;
|
||||
return row;
|
||||
}).filter(function (row) {
|
||||
|
@ -1,140 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Module defining RemoveAction. Created by vwoeltje on 11/17/14.
|
||||
*/
|
||||
define([
|
||||
'./RemoveDialog'
|
||||
], function (
|
||||
RemoveDialog
|
||||
) {
|
||||
|
||||
/**
|
||||
* Construct an action which will remove the provided object manifestation.
|
||||
* The object will be removed from its parent's composition; the parent
|
||||
* is looked up via the "context" capability (so this will be the
|
||||
* immediate ancestor by which this specific object was reached.)
|
||||
*
|
||||
* @param {DialogService} dialogService a service which will show the dialog
|
||||
* @param {NavigationService} navigationService a service that maintains the current navigation state
|
||||
* @param {ActionContext} context the context in which this action is performed
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
* @implements {Action}
|
||||
*/
|
||||
function RemoveAction(openmct, navigationService, context) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.openmct = openmct;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform this action.
|
||||
*/
|
||||
RemoveAction.prototype.perform = function () {
|
||||
var dialog,
|
||||
domainObject = this.domainObject,
|
||||
navigationService = this.navigationService;
|
||||
/*
|
||||
* Check whether an object ID matches the ID of the object being
|
||||
* removed (used to filter a parent's composition to handle the
|
||||
* removal.)
|
||||
*/
|
||||
function isNotObject(otherObjectId) {
|
||||
return otherObjectId !== domainObject.getId();
|
||||
}
|
||||
|
||||
/*
|
||||
* Mutate a parent object such that it no longer contains the object
|
||||
* which is being removed.
|
||||
*/
|
||||
function doMutate(model) {
|
||||
model.composition = model.composition.filter(isNotObject);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks current object and ascendants of current
|
||||
* object with object being removed, if the current
|
||||
* object or any in the current object's path is being removed,
|
||||
* navigate back to parent of removed object.
|
||||
*/
|
||||
function checkObjectNavigation(object, parentObject) {
|
||||
// Traverse object starts at current location
|
||||
var traverseObject = (navigationService).getNavigation(),
|
||||
context;
|
||||
|
||||
// Stop when object is not defined (above ROOT)
|
||||
while (traverseObject) {
|
||||
// If object currently traversed to is object being removed
|
||||
// navigate to parent of current object and then exit loop
|
||||
if (traverseObject.getId() === object.getId()) {
|
||||
navigationService.setNavigation(parentObject);
|
||||
return;
|
||||
}
|
||||
// Traverses to parent of current object, moving
|
||||
// up the ascendant path
|
||||
context = traverseObject.getCapability('context');
|
||||
traverseObject = context && context.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the object from its parent, as identified by its context
|
||||
* capability. Based on object's location and selected object's location
|
||||
* user may be navigated to existing parent object
|
||||
*/
|
||||
function removeFromContext() {
|
||||
var contextCapability = domainObject.getCapability('context'),
|
||||
parent = contextCapability.getParent();
|
||||
|
||||
// If currently within path of removed object(s),
|
||||
// navigates to existing object up tree
|
||||
checkObjectNavigation(domainObject, parent);
|
||||
|
||||
return parent.useCapability('mutation', doMutate);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass in the function to remove the domain object so it can be
|
||||
* associated with an 'OK' button press
|
||||
*/
|
||||
dialog = new RemoveDialog(this.openmct, domainObject, removeFromContext);
|
||||
dialog.show();
|
||||
};
|
||||
|
||||
// Object needs to have a parent for Remove to be applicable
|
||||
RemoveAction.appliesTo = function (context) {
|
||||
var object = (context || {}).domainObject,
|
||||
contextCapability = object && object.getCapability("context"),
|
||||
parent = contextCapability && contextCapability.getParent(),
|
||||
parentType = parent && parent.getCapability('type'),
|
||||
parentCreatable = parentType && parentType.hasFeature('creation');
|
||||
|
||||
// Only creatable types should be modifiable
|
||||
return parent !== undefined &&
|
||||
Array.isArray(parent.getModel().composition) &&
|
||||
parentCreatable;
|
||||
};
|
||||
|
||||
return RemoveAction;
|
||||
});
|
@ -1,72 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define([], function () {
|
||||
|
||||
/**
|
||||
* @callback removeCallback
|
||||
* @param {DomainObject} domainObject the domain object to be removed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Construct a new Remove dialog.
|
||||
*
|
||||
* @param {DialogService} dialogService the service that shows the dialog
|
||||
* @param {DomainObject} domainObject the domain object to be removed
|
||||
* @param {removeCallback} removeCallback callback that handles removal of the domain object
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
*/
|
||||
function RemoveDialog(openmct, domainObject, removeCallback) {
|
||||
this.openmct = openmct;
|
||||
this.domainObject = domainObject;
|
||||
this.removeCallback = removeCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a dialog to confirm the removal of a domain object.
|
||||
*/
|
||||
RemoveDialog.prototype.show = function () {
|
||||
let dialog = this.openmct.overlays.dialog({
|
||||
title: 'Remove ' + this.domainObject.getModel().name,
|
||||
iconClass: 'alert',
|
||||
message: 'Warning! This action will permanently remove this object. Are you sure you want to continue?',
|
||||
buttons: [
|
||||
{
|
||||
label: 'OK',
|
||||
callback: () => {
|
||||
this.removeCallback();
|
||||
dialog.dismiss();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Cancel',
|
||||
callback: () => {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
return RemoveDialog;
|
||||
});
|
@ -92,16 +92,7 @@ function (
|
||||
* @memberof platform/commonUI/edit.SaveAction#
|
||||
*/
|
||||
SaveAsAction.prototype.perform = function () {
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browse UI.)
|
||||
function returnToBrowse(object) {
|
||||
if (object) {
|
||||
object.getCapability("action").perform("navigate");
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
return this.save().then(returnToBrowse);
|
||||
return this.save();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -169,15 +160,22 @@ function (
|
||||
}
|
||||
|
||||
function saveAfterClone(clonedObject) {
|
||||
return domainObject.getCapability("editor").save()
|
||||
.then(resolveWith(clonedObject));
|
||||
return this.openmct.editor.save().then(() => {
|
||||
// Force mutation for search indexing
|
||||
return clonedObject;
|
||||
})
|
||||
}
|
||||
|
||||
function finishEditing(clonedObject) {
|
||||
return domainObject.getCapability("editor").finish()
|
||||
.then(function () {
|
||||
return fetchObject(clonedObject.getId());
|
||||
});
|
||||
return fetchObject(clonedObject.getId())
|
||||
}
|
||||
|
||||
function indexForSearch(savedObject) {
|
||||
savedObject.useCapability('mutation', (model) => {
|
||||
return model;
|
||||
});
|
||||
|
||||
return savedObject;
|
||||
}
|
||||
|
||||
function onSuccess(object) {
|
||||
@ -190,7 +188,7 @@ function (
|
||||
if (reason !== "user canceled") {
|
||||
self.notificationService.error("Save Failed");
|
||||
}
|
||||
return false;
|
||||
throw reason;
|
||||
}
|
||||
|
||||
return getParent(domainObject)
|
||||
@ -201,6 +199,7 @@ function (
|
||||
.then(undirtyOriginals)
|
||||
.then(saveAfterClone)
|
||||
.then(finishEditing)
|
||||
.then(indexForSearch)
|
||||
.then(hideBlockingDialog)
|
||||
.then(onSuccess)
|
||||
.catch(onFailure);
|
||||
|
@ -6,7 +6,7 @@ define([], function () {
|
||||
|
||||
SaveInProgressDialog.prototype.show = function () {
|
||||
this.dialog = this.dialogService.showBlockingMessage({
|
||||
title: "Saving...",
|
||||
title: "Saving",
|
||||
hint: "Do not navigate away from this page or close this browser tab while this message is displayed.",
|
||||
unknownProgress: true,
|
||||
severity: "info",
|
||||
|
@ -64,7 +64,6 @@ define(
|
||||
* @returns boolean
|
||||
*/
|
||||
EditorCapability.prototype.inEditContext = function () {
|
||||
console.warn('DEPRECATION WARNING: isEditing checks must be done via openmct.editor.');
|
||||
return this.openmct.editor.isEditing();
|
||||
};
|
||||
|
||||
@ -74,7 +73,6 @@ define(
|
||||
* @returns {*}
|
||||
*/
|
||||
EditorCapability.prototype.isEditContextRoot = function () {
|
||||
console.warn('DEPRECATION WARNING: isEditing checks must be done via openmct.editor.');
|
||||
return this.openmct.editor.isEditing();
|
||||
};
|
||||
|
||||
|
@ -65,24 +65,40 @@ define(
|
||||
CreateAction.prototype.perform = function () {
|
||||
var newModel = this.type.getInitialModel(),
|
||||
openmct = this.openmct,
|
||||
newObject,
|
||||
editAction;
|
||||
|
||||
function onSave() {
|
||||
openmct.editor.save();
|
||||
}
|
||||
newObject;
|
||||
|
||||
function onCancel() {
|
||||
openmct.editor.cancel();
|
||||
}
|
||||
|
||||
function isFirstViewEditable(domainObject) {
|
||||
let firstView = openmct.objectViews.get(domainObject)[0];
|
||||
|
||||
return firstView && firstView.canEdit && firstView.canEdit(domainObject);
|
||||
}
|
||||
|
||||
function navigateAndEdit(object) {
|
||||
let objectPath = object.getCapability('context').getPath(),
|
||||
url = '#/browse/' + objectPath
|
||||
.slice(1)
|
||||
.map(function (o) {
|
||||
return o && openmct.objects.makeKeyString(o.getId());
|
||||
})
|
||||
.join('/');
|
||||
|
||||
window.location.href = url;
|
||||
|
||||
if (isFirstViewEditable(object.useCapability('adapter'))) {
|
||||
openmct.editor.edit();
|
||||
}
|
||||
}
|
||||
|
||||
newModel.type = this.type.getKey();
|
||||
newModel.location = this.parent.getId();
|
||||
newObject = this.parent.useCapability('instantiation', newModel);
|
||||
|
||||
openmct.editor.edit();
|
||||
editAction = newObject.getCapability("action").getActions("edit")[0];
|
||||
newObject.getCapability("action").perform("save-as").then(onSave, onCancel);
|
||||
newObject.getCapability("action").perform("save-as").then(navigateAndEdit, onCancel);
|
||||
// TODO: support editing object without saving object first.
|
||||
// Which means we have to toggle createwizard afterwards. For now,
|
||||
// We will disable this.
|
||||
|
@ -66,7 +66,7 @@ define(
|
||||
name: "Properties",
|
||||
rows: this.properties.map(function (property, index) {
|
||||
// Property definition is same as form row definition
|
||||
var row = Object.create(property.getDefinition());
|
||||
var row = JSON.parse(JSON.stringify(property.getDefinition()));
|
||||
|
||||
// Use index as the key into the formValue;
|
||||
// this correlates to the indexing provided by
|
||||
|
@ -1,111 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Policy controlling when the `edit` and/or `properties` actions
|
||||
* can appear as applicable actions of the `view-control` category
|
||||
* (shown as buttons in the top-right of browse mode.)
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
* @implements {Policy.<Action, ActionContext>}
|
||||
*/
|
||||
function EditActionPolicy(policyService) {
|
||||
this.policyService = policyService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a count of views which are not flagged as non-editable.
|
||||
* @private
|
||||
*/
|
||||
EditActionPolicy.prototype.countEditableViews = function (context) {
|
||||
var domainObject = context.domainObject,
|
||||
count = 0,
|
||||
type, views;
|
||||
|
||||
if (!domainObject) {
|
||||
return count;
|
||||
}
|
||||
|
||||
type = domainObject.getCapability('type');
|
||||
views = domainObject.useCapability('view');
|
||||
|
||||
|
||||
// A view is editable unless explicitly flagged as not
|
||||
(views || []).forEach(function (view) {
|
||||
if (isEditable(view) ||
|
||||
(view.key === 'plot' && type.getKey() === 'telemetry.panel') ||
|
||||
(view.key === 'table' && type.getKey() === 'table') ||
|
||||
(view.key === 'rt-table' && type.getKey() === 'rttable')
|
||||
) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
|
||||
function isEditable(view) {
|
||||
if (typeof view.editable === Function) {
|
||||
return view.editable(domainObject.useCapability('adapter'));
|
||||
} else {
|
||||
return view.editable === true;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks whether the domain object is currently being edited. If
|
||||
* so, the edit action is not applicable.
|
||||
* @param context
|
||||
* @returns {*|boolean}
|
||||
*/
|
||||
function isEditing(context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject &&
|
||||
domainObject.hasCapability('editor') &&
|
||||
domainObject.getCapability('editor').isEditContextRoot();
|
||||
}
|
||||
|
||||
EditActionPolicy.prototype.allow = function (action, context) {
|
||||
var key = action.getMetadata().key,
|
||||
category = (context || {}).category;
|
||||
|
||||
// Restrict 'edit' to cases where there are editable
|
||||
// views (similarly, restrict 'properties' to when
|
||||
// the converse is true), and where the domain object is not
|
||||
// already being edited.
|
||||
if (key === 'edit') {
|
||||
return this.countEditableViews(context) > 0 && !isEditing(context);
|
||||
} else if (key === 'properties' && category === 'view-control') {
|
||||
return this.countEditableViews(context) < 1 && !isEditing(context);
|
||||
}
|
||||
|
||||
// Like all policies, allow by default.
|
||||
return true;
|
||||
};
|
||||
|
||||
return EditActionPolicy;
|
||||
}
|
||||
);
|
@ -1,49 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Policy controlling which views should be visible in Edit mode.
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
* @implements {Policy.<View, DomainObject>}
|
||||
*/
|
||||
function EditableViewPolicy() {
|
||||
}
|
||||
|
||||
EditableViewPolicy.prototype.allow = function (view, domainObject) {
|
||||
// If a view is flagged as non-editable, only allow it
|
||||
// while we're not in Edit mode.
|
||||
if ((view || {}).editable === false) {
|
||||
return !(domainObject.hasCapability('editor') && domainObject.getCapability('editor').inEditContext());
|
||||
}
|
||||
|
||||
// Like all policies, allow by default.
|
||||
return true;
|
||||
};
|
||||
|
||||
return EditableViewPolicy;
|
||||
}
|
||||
);
|
@ -77,14 +77,19 @@ define([], function () {
|
||||
return promiseFn().then(nextFn);
|
||||
};
|
||||
}
|
||||
|
||||
if (!this.isScheduled(id)) {
|
||||
this.clearTransactionFns[id] =
|
||||
this.transactionService.addToTransaction(
|
||||
chain(onCommit, release),
|
||||
chain(onCancel, release)
|
||||
);
|
||||
/**
|
||||
* Clear any existing persistence calls for object with given ID. This ensures only the most recent persistence
|
||||
* call is executed. This should prevent stale objects being persisted and overwriting fresh ones.
|
||||
*/
|
||||
if (this.isScheduled(id)) {
|
||||
this.clearTransactionsFor(id);
|
||||
}
|
||||
|
||||
this.clearTransactionFns[id] =
|
||||
this.transactionService.addToTransaction(
|
||||
chain(onCommit, release),
|
||||
chain(onCancel, release)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,255 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../../src/actions/RemoveAction"],
|
||||
function (RemoveAction) {
|
||||
|
||||
describe("The Remove action", function () {
|
||||
var action,
|
||||
actionContext,
|
||||
capabilities,
|
||||
mockContext,
|
||||
mockOverlayAPI,
|
||||
mockDomainObject,
|
||||
mockMutation,
|
||||
mockNavigationService,
|
||||
mockParent,
|
||||
mockType,
|
||||
model;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability", "getModel"]
|
||||
);
|
||||
|
||||
mockMutation = jasmine.createSpyObj("mutation", ["invoke"]);
|
||||
mockType = jasmine.createSpyObj("type", ["hasFeature"]);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
capabilities = {
|
||||
mutation: mockMutation,
|
||||
type: mockType
|
||||
};
|
||||
|
||||
model = {
|
||||
composition: ["a", "test", "b"]
|
||||
};
|
||||
|
||||
mockParent = {
|
||||
getModel: function () {
|
||||
return model;
|
||||
},
|
||||
getCapability: function (k) {
|
||||
return capabilities[k];
|
||||
},
|
||||
useCapability: function (k, v) {
|
||||
return capabilities[k].invoke(v);
|
||||
}
|
||||
};
|
||||
|
||||
mockOverlayAPI = jasmine.createSpyObj(
|
||||
"overlayAPI",
|
||||
["dialog"]
|
||||
);
|
||||
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
[
|
||||
"getNavigation",
|
||||
"setNavigation",
|
||||
"addListener",
|
||||
"removeListener"
|
||||
]
|
||||
);
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
|
||||
mockContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
|
||||
mockDomainObject.getId.and.returnValue("test");
|
||||
mockDomainObject.getCapability.and.returnValue(mockContext);
|
||||
mockDomainObject.getModel.and.returnValue({name: 'test object'});
|
||||
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
actionContext = { domainObject: mockDomainObject };
|
||||
|
||||
action = new RemoveAction({overlays: mockOverlayAPI}, mockNavigationService, actionContext);
|
||||
});
|
||||
|
||||
it("only applies to objects with parents", function () {
|
||||
expect(RemoveAction.appliesTo(actionContext)).toBeTruthy();
|
||||
|
||||
mockContext.getParent.and.returnValue(undefined);
|
||||
|
||||
expect(RemoveAction.appliesTo(actionContext)).toBeFalsy();
|
||||
|
||||
// Also verify that creatability was checked
|
||||
expect(mockType.hasFeature).toHaveBeenCalledWith('creation');
|
||||
});
|
||||
|
||||
it("shows a blocking message dialog", function () {
|
||||
mockParent = jasmine.createSpyObj(
|
||||
"parent",
|
||||
["getModel", "getCapability", "useCapability"]
|
||||
);
|
||||
|
||||
action.perform();
|
||||
|
||||
expect(mockOverlayAPI.dialog).toHaveBeenCalled();
|
||||
|
||||
// Also check that no mutation happens at this point
|
||||
expect(mockParent.useCapability).not.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
});
|
||||
|
||||
describe("after the remove callback is triggered", function () {
|
||||
var mockChildContext,
|
||||
mockChildObject,
|
||||
mockDialogHandle,
|
||||
mockGrandchildContext,
|
||||
mockGrandchildObject,
|
||||
mockRootContext,
|
||||
mockRootObject;
|
||||
|
||||
beforeEach(function () {
|
||||
mockChildObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
|
||||
mockDialogHandle = jasmine.createSpyObj(
|
||||
"dialogHandle",
|
||||
["dismiss"]
|
||||
);
|
||||
|
||||
mockGrandchildObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
|
||||
mockChildContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockGrandchildContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockRootContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
|
||||
mockOverlayAPI.dialog.and.returnValue(mockDialogHandle);
|
||||
});
|
||||
|
||||
it("mutates the parent when performed", function () {
|
||||
action.perform();
|
||||
mockOverlayAPI.dialog.calls.mostRecent().args[0]
|
||||
.buttons[0].callback();
|
||||
|
||||
expect(mockMutation.invoke)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("changes composition from its mutation function", function () {
|
||||
var mutator, result;
|
||||
|
||||
action.perform();
|
||||
mockOverlayAPI.dialog.calls.mostRecent().args[0]
|
||||
.buttons[0].callback();
|
||||
|
||||
mutator = mockMutation.invoke.calls.mostRecent().args[0];
|
||||
result = mutator(model);
|
||||
|
||||
// Should not have cancelled the mutation
|
||||
expect(result).not.toBe(false);
|
||||
|
||||
// Simulate mutate's behavior (remove can either return a
|
||||
// new model or modify this one in-place)
|
||||
result = result || model;
|
||||
|
||||
// Should have removed "test" - that was our
|
||||
// mock domain object's id.
|
||||
expect(result.composition).toEqual(["a", "b"]);
|
||||
});
|
||||
|
||||
it("removes parent of object currently navigated to", function () {
|
||||
// Navigates to child object
|
||||
mockNavigationService.getNavigation.and.returnValue(mockChildObject);
|
||||
|
||||
// Test is id of object being removed
|
||||
// Child object has different id
|
||||
mockDomainObject.getId.and.returnValue("test");
|
||||
mockChildObject.getId.and.returnValue("not test");
|
||||
|
||||
// Sets context for the child and domainObject
|
||||
mockDomainObject.getCapability.and.returnValue(mockContext);
|
||||
mockChildObject.getCapability.and.returnValue(mockChildContext);
|
||||
|
||||
// Parents of child and domainObject are set
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
mockChildContext.getParent.and.returnValue(mockDomainObject);
|
||||
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
action.perform();
|
||||
mockOverlayAPI.dialog.calls.mostRecent().args[0]
|
||||
.buttons[0].callback();
|
||||
|
||||
// Expects navigation to parent of domainObject (removed object)
|
||||
expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(mockParent);
|
||||
});
|
||||
|
||||
it("checks if removing object not in ascendent path (reaches ROOT)", function () {
|
||||
// Navigates to grandchild of ROOT
|
||||
mockNavigationService.getNavigation.and.returnValue(mockGrandchildObject);
|
||||
|
||||
// domainObject (grandparent) is set as ROOT, child and grandchild
|
||||
// are set objects not being removed
|
||||
mockDomainObject.getId.and.returnValue("test 1");
|
||||
mockRootObject.getId.and.returnValue("ROOT");
|
||||
mockChildObject.getId.and.returnValue("not test 2");
|
||||
mockGrandchildObject.getId.and.returnValue("not test 3");
|
||||
|
||||
// Sets context for the grandchild, child, and domainObject
|
||||
mockRootObject.getCapability.and.returnValue(mockRootContext);
|
||||
mockChildObject.getCapability.and.returnValue(mockChildContext);
|
||||
mockGrandchildObject.getCapability.and.returnValue(mockGrandchildContext);
|
||||
|
||||
// Parents of grandchild and child are set
|
||||
mockChildContext.getParent.and.returnValue(mockRootObject);
|
||||
mockGrandchildContext.getParent.and.returnValue(mockChildObject);
|
||||
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
action.perform();
|
||||
mockOverlayAPI.dialog.calls.mostRecent().args[0]
|
||||
.buttons[0].callback();
|
||||
|
||||
// Expects no navigation to occur
|
||||
expect(mockNavigationService.setNavigation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -25,7 +25,7 @@ define(
|
||||
["../../src/actions/SaveAsAction"],
|
||||
function (SaveAsAction) {
|
||||
|
||||
describe("The Save As action", function () {
|
||||
xdescribe("The Save As action", function () {
|
||||
var mockDomainObject,
|
||||
mockClonedObject,
|
||||
mockEditorCapability,
|
||||
|
@ -24,7 +24,7 @@ define(
|
||||
["../../src/capabilities/EditorCapability"],
|
||||
function (EditorCapability) {
|
||||
|
||||
describe("The editor capability", function () {
|
||||
xdescribe("The editor capability", function () {
|
||||
var mockDomainObject,
|
||||
capabilities,
|
||||
mockParentObject,
|
||||
|
@ -27,7 +27,7 @@ define(
|
||||
["../../src/creation/CreateAction"],
|
||||
function (CreateAction) {
|
||||
|
||||
describe("The create action", function () {
|
||||
xdescribe("The create action", function () {
|
||||
var mockType,
|
||||
mockParent,
|
||||
mockContext,
|
||||
|
@ -27,7 +27,7 @@ define(
|
||||
["../../src/creation/CreateWizard"],
|
||||
function (CreateWizard) {
|
||||
|
||||
describe("The create wizard", function () {
|
||||
xdescribe("The create wizard", function () {
|
||||
var mockType,
|
||||
mockParent,
|
||||
mockProperties,
|
||||
|
@ -1,138 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../../src/policies/EditActionPolicy"],
|
||||
function (EditActionPolicy) {
|
||||
|
||||
describe("The Edit action policy", function () {
|
||||
var editableView,
|
||||
nonEditableView,
|
||||
testViews,
|
||||
testContext,
|
||||
mockDomainObject,
|
||||
mockEditAction,
|
||||
mockPropertiesAction,
|
||||
mockTypeCapability,
|
||||
mockEditorCapability,
|
||||
capabilities,
|
||||
plotView,
|
||||
policy;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[
|
||||
'useCapability',
|
||||
'hasCapability',
|
||||
'getCapability'
|
||||
]
|
||||
);
|
||||
mockEditorCapability = jasmine.createSpyObj('editorCapability', ['isEditContextRoot']);
|
||||
mockTypeCapability = jasmine.createSpyObj('type', ['getKey']);
|
||||
capabilities = {
|
||||
'editor': mockEditorCapability,
|
||||
'type': mockTypeCapability
|
||||
};
|
||||
|
||||
mockEditAction = jasmine.createSpyObj('edit', ['getMetadata']);
|
||||
mockPropertiesAction = jasmine.createSpyObj('edit', ['getMetadata']);
|
||||
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.hasCapability.and.callFake(function (capability) {
|
||||
return !!capabilities[capability];
|
||||
});
|
||||
|
||||
editableView = { editable: true };
|
||||
nonEditableView = { editable: false };
|
||||
plotView = { key: "plot", editable: false };
|
||||
testViews = [];
|
||||
|
||||
mockDomainObject.useCapability.and.callFake(function (c) {
|
||||
// Provide test views, only for the view capability
|
||||
return c === 'view' && testViews;
|
||||
});
|
||||
|
||||
mockEditAction.getMetadata.and.returnValue({ key: 'edit' });
|
||||
mockPropertiesAction.getMetadata.and.returnValue({ key: 'properties' });
|
||||
|
||||
testContext = {
|
||||
domainObject: mockDomainObject,
|
||||
category: 'view-control'
|
||||
};
|
||||
|
||||
policy = new EditActionPolicy();
|
||||
});
|
||||
|
||||
it("allows the edit action when there are editable views", function () {
|
||||
testViews = [editableView];
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
||||
});
|
||||
|
||||
it("allows the edit properties action when there are no editable views", function () {
|
||||
testViews = [nonEditableView, nonEditableView];
|
||||
expect(policy.allow(mockPropertiesAction, testContext)).toBe(true);
|
||||
});
|
||||
|
||||
it("disallows the edit action when there are no editable views", function () {
|
||||
testViews = [nonEditableView, nonEditableView];
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("disallows the edit properties action when there are" +
|
||||
" editable views", function () {
|
||||
testViews = [editableView];
|
||||
expect(policy.allow(mockPropertiesAction, testContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("disallows the edit action when object is already being" +
|
||||
" edited", function () {
|
||||
testViews = [editableView];
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("allows editing of panels in plot view", function () {
|
||||
testViews = [plotView];
|
||||
mockTypeCapability.getKey.and.returnValue('telemetry.panel');
|
||||
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
||||
});
|
||||
|
||||
it("disallows editing of plot view when object not a panel type", function () {
|
||||
testViews = [plotView];
|
||||
mockTypeCapability.getKey.and.returnValue('something.else');
|
||||
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
it("allows the edit properties outside of the 'view-control' category", function () {
|
||||
testViews = [nonEditableView];
|
||||
testContext.category = "something-else";
|
||||
expect(policy.allow(mockPropertiesAction, testContext)).toBe(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -1,79 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../../src/policies/EditableViewPolicy"],
|
||||
function (EditableViewPolicy) {
|
||||
|
||||
describe("The editable view policy", function () {
|
||||
var mockDomainObject,
|
||||
testMode,
|
||||
policy;
|
||||
|
||||
beforeEach(function () {
|
||||
testMode = true; // Act as if we're in Edit mode by default
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
['hasCapability', 'getCapability']
|
||||
);
|
||||
mockDomainObject.getCapability.and.returnValue({
|
||||
inEditContext: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mockDomainObject.hasCapability.and.callFake(function (c) {
|
||||
return (c === 'editor') && testMode;
|
||||
});
|
||||
|
||||
policy = new EditableViewPolicy();
|
||||
});
|
||||
|
||||
it("disallows views in edit mode that are flagged as non-editable", function () {
|
||||
expect(policy.allow({ editable: false }, mockDomainObject))
|
||||
.toBeFalsy();
|
||||
});
|
||||
|
||||
it("allows views in edit mode that are flagged as editable", function () {
|
||||
expect(policy.allow({ editable: true }, mockDomainObject))
|
||||
.toBeTruthy();
|
||||
});
|
||||
|
||||
it("allows any view outside of edit mode", function () {
|
||||
var testViews = [
|
||||
{ editable: false },
|
||||
{ editable: true },
|
||||
{ someKey: "some value" }
|
||||
];
|
||||
testMode = false; // Act as if we're not in Edit mode
|
||||
|
||||
testViews.forEach(function (testView) {
|
||||
expect(policy.allow(testView, mockDomainObject)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
it("treats views with no defined 'editable' property as editable", function () {
|
||||
expect(policy.allow({ someKey: "some value" }, mockDomainObject))
|
||||
.toBeTruthy();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -93,24 +93,33 @@ define(
|
||||
expect(mockOnCancel).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("ignores subsequent calls for the same object", function () {
|
||||
manager.addToTransaction(
|
||||
testId,
|
||||
jasmine.createSpy(),
|
||||
jasmine.createSpy()
|
||||
);
|
||||
expect(mockTransactionService.addToTransaction.calls.count())
|
||||
.toEqual(1);
|
||||
});
|
||||
describe("Adds callbacks to transaction", function () {
|
||||
beforeEach(function () {
|
||||
spyOn(manager, 'clearTransactionsFor');
|
||||
manager.clearTransactionsFor.and.callThrough();
|
||||
});
|
||||
|
||||
it("accepts subsequent calls for other objects", function () {
|
||||
manager.addToTransaction(
|
||||
'other-id',
|
||||
jasmine.createSpy(),
|
||||
jasmine.createSpy()
|
||||
);
|
||||
expect(mockTransactionService.addToTransaction.calls.count())
|
||||
.toEqual(2);
|
||||
it("and clears pending calls if same object", function () {
|
||||
manager.addToTransaction(
|
||||
testId,
|
||||
jasmine.createSpy(),
|
||||
jasmine.createSpy()
|
||||
);
|
||||
expect(manager.clearTransactionsFor).toHaveBeenCalledWith(testId);
|
||||
});
|
||||
|
||||
it("and does not clear pending calls if different object", function () {
|
||||
manager.addToTransaction(
|
||||
'other-id',
|
||||
jasmine.createSpy(),
|
||||
jasmine.createSpy()
|
||||
);
|
||||
expect(manager.clearTransactionsFor).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
expect(mockTransactionService.addToTransaction.calls.count()).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not remove callbacks from the transaction", function () {
|
||||
|
@ -23,56 +23,57 @@
|
||||
define([
|
||||
"./src/FormatProvider",
|
||||
"./src/UTCTimeFormat",
|
||||
"./src/DurationFormat",
|
||||
'legacyRegistry'
|
||||
"./src/DurationFormat"
|
||||
], function (
|
||||
FormatProvider,
|
||||
UTCTimeFormat,
|
||||
DurationFormat,
|
||||
legacyRegistry
|
||||
DurationFormat
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/formats", {
|
||||
"name": "Format Registry",
|
||||
"description": "Provides a registry for formats, which allow parsing and formatting of values.",
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"provides": "formatService",
|
||||
"type": "provider",
|
||||
"implementation": FormatProvider,
|
||||
"depends": [
|
||||
"formats[]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"formats": [
|
||||
{
|
||||
"key": "utc",
|
||||
"implementation": UTCTimeFormat
|
||||
},
|
||||
{
|
||||
"key": "duration",
|
||||
"implementation": DurationFormat
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_TIME_FORMAT",
|
||||
"value": "utc"
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"name": "d3",
|
||||
"version": "3.0.0",
|
||||
"description": "Incorporates modified code from d3 Time Scales",
|
||||
"author": "Mike Bostock",
|
||||
"copyright": "Copyright 2010-2016 Mike Bostock. " +
|
||||
return {
|
||||
name:"platform/commonUI/formats",
|
||||
definition: {
|
||||
"name": "Format Registry",
|
||||
"description": "Provides a registry for formats, which allow parsing and formatting of values.",
|
||||
"extensions": {
|
||||
"components": [
|
||||
{
|
||||
"provides": "formatService",
|
||||
"type": "provider",
|
||||
"implementation": FormatProvider,
|
||||
"depends": [
|
||||
"formats[]"
|
||||
]
|
||||
}
|
||||
],
|
||||
"formats": [
|
||||
{
|
||||
"key": "utc",
|
||||
"implementation": UTCTimeFormat
|
||||
},
|
||||
{
|
||||
"key": "duration",
|
||||
"implementation": DurationFormat
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_TIME_FORMAT",
|
||||
"value": "utc"
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"name": "d3",
|
||||
"version": "3.0.0",
|
||||
"description": "Incorporates modified code from d3 Time Scales",
|
||||
"author": "Mike Bostock",
|
||||
"copyright": "Copyright 2010-2016 Mike Bostock. " +
|
||||
"All rights reserved.",
|
||||
"link": "https://github.com/d3/d3/blob/master/LICENSE"
|
||||
}
|
||||
]
|
||||
"link": "https://github.com/d3/d3/blob/master/LICENSE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -66,8 +66,7 @@ define([
|
||||
"./res/templates/object-inspector.html",
|
||||
"./res/templates/controls/selector.html",
|
||||
"./res/templates/controls/datetime-picker.html",
|
||||
"./res/templates/controls/datetime-field.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/controls/datetime-field.html"
|
||||
], function (
|
||||
UrlService,
|
||||
PopupService,
|
||||
@ -114,415 +113,417 @@ define([
|
||||
objectInspectorTemplate,
|
||||
selectorTemplate,
|
||||
datetimePickerTemplate,
|
||||
datetimeFieldTemplate,
|
||||
legacyRegistry
|
||||
datetimeFieldTemplate
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/general", {
|
||||
"name": "General UI elements",
|
||||
"description": "General UI elements, meant to be reused across modes",
|
||||
"resources": "res",
|
||||
"extensions": {
|
||||
"services": [
|
||||
{
|
||||
"key": "urlService",
|
||||
"implementation": UrlService,
|
||||
"depends": [
|
||||
"$location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "popupService",
|
||||
"implementation": PopupService,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$window"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": StyleSheetLoader,
|
||||
"depends": [
|
||||
"stylesheets[]",
|
||||
"$document",
|
||||
"THEME",
|
||||
"ASSETS_PATH"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": SplashScreenManager,
|
||||
"depends": [
|
||||
"$document"
|
||||
]
|
||||
}
|
||||
],
|
||||
"filters": [
|
||||
{
|
||||
"implementation": ReverseFilter,
|
||||
"key": "reverse"
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "bottombar",
|
||||
"template": bottombarTemplate
|
||||
},
|
||||
{
|
||||
"key": "action-button",
|
||||
"template": actionButtonTemplate
|
||||
},
|
||||
{
|
||||
"key": "input-filter",
|
||||
"template": inputFilterTemplate
|
||||
},
|
||||
{
|
||||
"key": "indicator",
|
||||
"template": indicatorTemplate
|
||||
},
|
||||
{
|
||||
"key": "message-banner",
|
||||
"template": messageBannerTemplate
|
||||
},
|
||||
{
|
||||
"key": "progress-bar",
|
||||
"template": progressBarTemplate
|
||||
},
|
||||
{
|
||||
"key": "time-controller",
|
||||
"template": timeControllerTemplate
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "TimeRangeController",
|
||||
"implementation": TimeRangeController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"formatService",
|
||||
"DEFAULT_TIME_FORMAT",
|
||||
"now"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "DateTimePickerController",
|
||||
"implementation": DateTimePickerController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"now"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "DateTimeFieldController",
|
||||
"implementation": DateTimeFieldController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"formatService",
|
||||
"DEFAULT_TIME_FORMAT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "TreeNodeController",
|
||||
"implementation": TreeNodeController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ActionGroupController",
|
||||
"implementation": ActionGroupController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ToggleController",
|
||||
"implementation": ToggleController
|
||||
},
|
||||
{
|
||||
"key": "ClickAwayController",
|
||||
"implementation": ClickAwayController,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ViewSwitcherController",
|
||||
"implementation": ViewSwitcherController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "GetterSetterController",
|
||||
"implementation": GetterSetterController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "SelectorController",
|
||||
"implementation": SelectorController,
|
||||
"depends": [
|
||||
"objectService",
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ObjectInspectorController",
|
||||
"implementation": ObjectInspectorController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"objectService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "BannerController",
|
||||
"implementation": BannerController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"notificationService",
|
||||
"dialogService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"directives": [
|
||||
{
|
||||
"key": "mctContainer",
|
||||
"implementation": MCTContainer,
|
||||
"depends": [
|
||||
"containers[]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctDrag",
|
||||
"implementation": MCTDrag,
|
||||
"depends": [
|
||||
"$document",
|
||||
"agentService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctSelectable",
|
||||
"implementation": MCTSelectable,
|
||||
"depends": [
|
||||
"openmct"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctClickElsewhere",
|
||||
"implementation": MCTClickElsewhere,
|
||||
"depends": [
|
||||
"$document"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctResize",
|
||||
"implementation": MCTResize,
|
||||
"depends": [
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctPopup",
|
||||
"implementation": MCTPopup,
|
||||
"depends": [
|
||||
"$compile",
|
||||
"popupService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctScrollX",
|
||||
"implementation": MCTScroll,
|
||||
"depends": [
|
||||
"$parse",
|
||||
"MCT_SCROLL_X_PROPERTY",
|
||||
"MCT_SCROLL_X_ATTRIBUTE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctScrollY",
|
||||
"implementation": MCTScroll,
|
||||
"depends": [
|
||||
"$parse",
|
||||
"MCT_SCROLL_Y_PROPERTY",
|
||||
"MCT_SCROLL_Y_ATTRIBUTE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctSplitPane",
|
||||
"implementation": MCTSplitPane,
|
||||
"depends": [
|
||||
"$parse",
|
||||
"$log",
|
||||
"$interval",
|
||||
"$window"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctSplitter",
|
||||
"implementation": MCTSplitter
|
||||
},
|
||||
{
|
||||
"key": "mctTree",
|
||||
"implementation": MCTTree,
|
||||
"depends": ['gestureService', 'openmct']
|
||||
},
|
||||
{
|
||||
"key": "mctIndicators",
|
||||
"implementation": MCTIndicators,
|
||||
"depends": ['openmct']
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "MCT_SCROLL_X_PROPERTY",
|
||||
"value": "scrollLeft"
|
||||
},
|
||||
{
|
||||
"key": "MCT_SCROLL_X_ATTRIBUTE",
|
||||
"value": "mctScrollX"
|
||||
},
|
||||
{
|
||||
"key": "MCT_SCROLL_Y_PROPERTY",
|
||||
"value": "scrollTop"
|
||||
},
|
||||
{
|
||||
"key": "MCT_SCROLL_Y_ATTRIBUTE",
|
||||
"value": "mctScrollY"
|
||||
},
|
||||
{
|
||||
"key": "THEME",
|
||||
"value": "unspecified",
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
"key": "ASSETS_PATH",
|
||||
"value": ".",
|
||||
"priority": "fallback"
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
{
|
||||
"key": "accordion",
|
||||
"template": accordionTemplate,
|
||||
"attributes": [
|
||||
"label"
|
||||
]
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "tree",
|
||||
"template": subtreeTemplate,
|
||||
"uses": [
|
||||
"composition"
|
||||
],
|
||||
"type": "root",
|
||||
"priority": "preferred"
|
||||
},
|
||||
{
|
||||
"key": "tree",
|
||||
"template": treeTemplate
|
||||
},
|
||||
{
|
||||
"key": "subtree",
|
||||
"template": subtreeTemplate,
|
||||
"uses": [
|
||||
"composition"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "tree-node",
|
||||
"template": treeNodeTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "label",
|
||||
"template": labelTemplate,
|
||||
"uses": [
|
||||
"type",
|
||||
"location"
|
||||
],
|
||||
"gestures": [
|
||||
"drag",
|
||||
"menu",
|
||||
"info"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "node",
|
||||
"template": labelTemplate,
|
||||
"uses": [
|
||||
"type"
|
||||
],
|
||||
"gestures": [
|
||||
"drag",
|
||||
"menu"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "action-group",
|
||||
"template": actionGroupTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "switcher",
|
||||
"template": switcherTemplate,
|
||||
"uses": [
|
||||
"view"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "object-inspector",
|
||||
"template": objectInspectorTemplate
|
||||
}
|
||||
],
|
||||
"controls": [
|
||||
{
|
||||
"key": "selector",
|
||||
"template": selectorTemplate
|
||||
},
|
||||
{
|
||||
"key": "datetime-picker",
|
||||
"template": datetimePickerTemplate
|
||||
},
|
||||
{
|
||||
"key": "datetime-field",
|
||||
"template": datetimeFieldTemplate
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"name": "Normalize.css",
|
||||
"version": "1.1.2",
|
||||
"description": "Browser style normalization",
|
||||
"author": "Nicolas Gallagher, Jonathan Neal",
|
||||
"website": "http://necolas.github.io/normalize.css/",
|
||||
"copyright": "Copyright (c) Nicolas Gallagher and Jonathan Neal",
|
||||
"license": "license-mit",
|
||||
"link": "https://github.com/necolas/normalize.css/blob/v1.1.2/LICENSE.md"
|
||||
},
|
||||
{
|
||||
"name": "Zepto",
|
||||
"version": "1.1.6",
|
||||
"description": "DOM manipulation",
|
||||
"author": "Thomas Fuchs",
|
||||
"website": "http://zeptojs.com/",
|
||||
"copyright": "Copyright (c) 2010-2016 Thomas Fuchs",
|
||||
"license": "license-mit",
|
||||
"link": "https://github.com/madrobby/zepto/blob/master/MIT-LICENSE"
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"platform/commonUI/general",
|
||||
definition: {
|
||||
"name": "General UI elements",
|
||||
"description": "General UI elements, meant to be reused across modes",
|
||||
"resources": "res",
|
||||
"extensions": {
|
||||
"services": [
|
||||
{
|
||||
"key": "urlService",
|
||||
"implementation": UrlService,
|
||||
"depends": [
|
||||
"$location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "popupService",
|
||||
"implementation": PopupService,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$window"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": StyleSheetLoader,
|
||||
"depends": [
|
||||
"stylesheets[]",
|
||||
"$document",
|
||||
"THEME",
|
||||
"ASSETS_PATH"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": SplashScreenManager,
|
||||
"depends": [
|
||||
"$document"
|
||||
]
|
||||
}
|
||||
],
|
||||
"filters": [
|
||||
{
|
||||
"implementation": ReverseFilter,
|
||||
"key": "reverse"
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
{
|
||||
"key": "bottombar",
|
||||
"template": bottombarTemplate
|
||||
},
|
||||
{
|
||||
"key": "action-button",
|
||||
"template": actionButtonTemplate
|
||||
},
|
||||
{
|
||||
"key": "input-filter",
|
||||
"template": inputFilterTemplate
|
||||
},
|
||||
{
|
||||
"key": "indicator",
|
||||
"template": indicatorTemplate
|
||||
},
|
||||
{
|
||||
"key": "message-banner",
|
||||
"template": messageBannerTemplate
|
||||
},
|
||||
{
|
||||
"key": "progress-bar",
|
||||
"template": progressBarTemplate
|
||||
},
|
||||
{
|
||||
"key": "time-controller",
|
||||
"template": timeControllerTemplate
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "TimeRangeController",
|
||||
"implementation": TimeRangeController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"formatService",
|
||||
"DEFAULT_TIME_FORMAT",
|
||||
"now"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "DateTimePickerController",
|
||||
"implementation": DateTimePickerController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"now"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "DateTimeFieldController",
|
||||
"implementation": DateTimeFieldController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"formatService",
|
||||
"DEFAULT_TIME_FORMAT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "TreeNodeController",
|
||||
"implementation": TreeNodeController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ActionGroupController",
|
||||
"implementation": ActionGroupController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ToggleController",
|
||||
"implementation": ToggleController
|
||||
},
|
||||
{
|
||||
"key": "ClickAwayController",
|
||||
"implementation": ClickAwayController,
|
||||
"depends": [
|
||||
"$document",
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ViewSwitcherController",
|
||||
"implementation": ViewSwitcherController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "GetterSetterController",
|
||||
"implementation": GetterSetterController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "SelectorController",
|
||||
"implementation": SelectorController,
|
||||
"depends": [
|
||||
"objectService",
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "ObjectInspectorController",
|
||||
"implementation": ObjectInspectorController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"objectService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "BannerController",
|
||||
"implementation": BannerController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"notificationService",
|
||||
"dialogService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"directives": [
|
||||
{
|
||||
"key": "mctContainer",
|
||||
"implementation": MCTContainer,
|
||||
"depends": [
|
||||
"containers[]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctDrag",
|
||||
"implementation": MCTDrag,
|
||||
"depends": [
|
||||
"$document",
|
||||
"agentService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctSelectable",
|
||||
"implementation": MCTSelectable,
|
||||
"depends": [
|
||||
"openmct"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctClickElsewhere",
|
||||
"implementation": MCTClickElsewhere,
|
||||
"depends": [
|
||||
"$document"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctResize",
|
||||
"implementation": MCTResize,
|
||||
"depends": [
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctPopup",
|
||||
"implementation": MCTPopup,
|
||||
"depends": [
|
||||
"$compile",
|
||||
"popupService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctScrollX",
|
||||
"implementation": MCTScroll,
|
||||
"depends": [
|
||||
"$parse",
|
||||
"MCT_SCROLL_X_PROPERTY",
|
||||
"MCT_SCROLL_X_ATTRIBUTE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctScrollY",
|
||||
"implementation": MCTScroll,
|
||||
"depends": [
|
||||
"$parse",
|
||||
"MCT_SCROLL_Y_PROPERTY",
|
||||
"MCT_SCROLL_Y_ATTRIBUTE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctSplitPane",
|
||||
"implementation": MCTSplitPane,
|
||||
"depends": [
|
||||
"$parse",
|
||||
"$log",
|
||||
"$interval",
|
||||
"$window"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mctSplitter",
|
||||
"implementation": MCTSplitter
|
||||
},
|
||||
{
|
||||
"key": "mctTree",
|
||||
"implementation": MCTTree,
|
||||
"depends": ['gestureService', 'openmct']
|
||||
},
|
||||
{
|
||||
"key": "mctIndicators",
|
||||
"implementation": MCTIndicators,
|
||||
"depends": ['openmct']
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "MCT_SCROLL_X_PROPERTY",
|
||||
"value": "scrollLeft"
|
||||
},
|
||||
{
|
||||
"key": "MCT_SCROLL_X_ATTRIBUTE",
|
||||
"value": "mctScrollX"
|
||||
},
|
||||
{
|
||||
"key": "MCT_SCROLL_Y_PROPERTY",
|
||||
"value": "scrollTop"
|
||||
},
|
||||
{
|
||||
"key": "MCT_SCROLL_Y_ATTRIBUTE",
|
||||
"value": "mctScrollY"
|
||||
},
|
||||
{
|
||||
"key": "THEME",
|
||||
"value": "unspecified",
|
||||
"priority": "fallback"
|
||||
},
|
||||
{
|
||||
"key": "ASSETS_PATH",
|
||||
"value": ".",
|
||||
"priority": "fallback"
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
{
|
||||
"key": "accordion",
|
||||
"template": accordionTemplate,
|
||||
"attributes": [
|
||||
"label"
|
||||
]
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "tree",
|
||||
"template": subtreeTemplate,
|
||||
"uses": [
|
||||
"composition"
|
||||
],
|
||||
"type": "root",
|
||||
"priority": "preferred"
|
||||
},
|
||||
{
|
||||
"key": "tree",
|
||||
"template": treeTemplate
|
||||
},
|
||||
{
|
||||
"key": "subtree",
|
||||
"template": subtreeTemplate,
|
||||
"uses": [
|
||||
"composition"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "tree-node",
|
||||
"template": treeNodeTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "label",
|
||||
"template": labelTemplate,
|
||||
"uses": [
|
||||
"type",
|
||||
"location"
|
||||
],
|
||||
"gestures": [
|
||||
"drag",
|
||||
"menu",
|
||||
"info"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "node",
|
||||
"template": labelTemplate,
|
||||
"uses": [
|
||||
"type"
|
||||
],
|
||||
"gestures": [
|
||||
"drag",
|
||||
"menu"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "action-group",
|
||||
"template": actionGroupTemplate,
|
||||
"uses": [
|
||||
"action"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "switcher",
|
||||
"template": switcherTemplate,
|
||||
"uses": [
|
||||
"view"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "object-inspector",
|
||||
"template": objectInspectorTemplate
|
||||
}
|
||||
],
|
||||
"controls": [
|
||||
{
|
||||
"key": "selector",
|
||||
"template": selectorTemplate
|
||||
},
|
||||
{
|
||||
"key": "datetime-picker",
|
||||
"template": datetimePickerTemplate
|
||||
},
|
||||
{
|
||||
"key": "datetime-field",
|
||||
"template": datetimeFieldTemplate
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"name": "Normalize.css",
|
||||
"version": "1.1.2",
|
||||
"description": "Browser style normalization",
|
||||
"author": "Nicolas Gallagher, Jonathan Neal",
|
||||
"website": "http://necolas.github.io/normalize.css/",
|
||||
"copyright": "Copyright (c) Nicolas Gallagher and Jonathan Neal",
|
||||
"license": "license-mit",
|
||||
"link": "https://github.com/necolas/normalize.css/blob/v1.1.2/LICENSE.md"
|
||||
},
|
||||
{
|
||||
"name": "Zepto",
|
||||
"version": "1.1.6",
|
||||
"description": "DOM manipulation",
|
||||
"author": "Thomas Fuchs",
|
||||
"website": "http://zeptojs.com/",
|
||||
"copyright": "Copyright (c) 2010-2016 Thomas Fuchs",
|
||||
"license": "license-mit",
|
||||
"link": "https://github.com/madrobby/zepto/blob/master/MIT-LICENSE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -20,8 +20,7 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
|
||||
<div class="ls-indicator {{ngModel.getCssClass()}}"
|
||||
title="{{ngModel.getDescription()}}"
|
||||
<div class="c-indicator {{ngModel.getCssClass()}}"
|
||||
ng-show="ngModel.getText().length > 0">
|
||||
<span class="label">{{ngModel.getText()}}</span>
|
||||
<span class="label c-indicator__label">{{ngModel.getText()}}</span>
|
||||
</div>
|
||||
|
@ -19,7 +19,7 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div class="t-object-label l-flex-row flex-elem grows">
|
||||
<div class="t-item-icon flex-elem {{type.getCssClass()}}" ng-class="{ 'l-icon-link':location.isLink() }"></div>
|
||||
<div class='t-title-label flex-elem grows'>{{model.name}}</div>
|
||||
<div class="c-object-label">
|
||||
<div class="c-object-label__type-icon {{type.getCssClass()}}" ng-class="{ 'l-icon-link':location.isLink() }"></div>
|
||||
<div class='c-object-label__name'>{{model.name}}</div>
|
||||
</div>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<div ng-controller="BannerController" ng-show="active.notification"
|
||||
class="l-message-banner s-message-banner {{active.notification.model.severity}}" ng-class="{
|
||||
class="c-message-banner {{active.notification.model.severity}}" ng-class="{
|
||||
'minimized': active.notification.model.minimized,
|
||||
'new': !active.notification.model.minimized}"
|
||||
ng-click="maximize(active.notification)">
|
||||
<span class="banner-elem label">
|
||||
<span class="c-message-banner__message">
|
||||
{{active.notification.model.title}}
|
||||
</span>
|
||||
<span ng-show="active.notification.model.progress !== undefined || active.notification.model.unknownProgress">
|
||||
<mct-include key="'progress-bar'" class="banner-elem"
|
||||
<mct-include key="'progress-bar'" class="c-message-banner__progress-bar"
|
||||
ng-model="active.notification.model">
|
||||
</mct-include>
|
||||
</span>
|
||||
@ -16,5 +16,5 @@
|
||||
ng-click="action(active.notification.model.primaryOption.callback, $event)">
|
||||
{{active.notification.model.primaryOption.label}}
|
||||
</a>
|
||||
<a class="banner-elem close icon-x" ng-click="dismiss(active.notification, $event)"></a>
|
||||
<button class="c-message-banner__close-button c-click-icon icon-x-in-circle" ng-click="dismiss(active.notification, $event)"></button>
|
||||
</div>
|
||||
|
@ -20,14 +20,11 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span ng-controller="ToggleController as toggle">
|
||||
<span ng-controller="TreeNodeController as treeNode">
|
||||
<span
|
||||
class="tree-item menus-to-left"
|
||||
ng-class="{selected: treeNode.isSelected()}"
|
||||
>
|
||||
<span
|
||||
class='ui-symbol view-control flex-elem'
|
||||
ng-class="{ 'has-children': model.composition !== undefined, expanded: toggle.isActive() }"
|
||||
<div class="u-contents" ng-controller="TreeNodeController as treeNode">
|
||||
<div class="c-tree__item menus-to-left"
|
||||
ng-class="{selected: treeNode.isSelected()}">
|
||||
<span class='c-disclosure-triangle c-tree__item__view-control'
|
||||
ng-class="{ 'is-enabled': model.composition !== undefined, 'c-disclosure-triangle--expanded': toggle.isActive() }"
|
||||
ng-click="toggle.toggle(); treeNode.trackExpansion()"
|
||||
>
|
||||
</span>
|
||||
@ -39,19 +36,15 @@
|
||||
ng-click="treeNode.select()"
|
||||
>
|
||||
</mct-representation>
|
||||
</span>
|
||||
<span
|
||||
class="tree-item-subtree"
|
||||
</div>
|
||||
<div class="u-contents"
|
||||
ng-show="toggle.isActive()"
|
||||
ng-if="model.composition !== undefined"
|
||||
>
|
||||
|
||||
ng-if="model.composition !== undefined">
|
||||
<mct-representation key="'subtree'"
|
||||
ng-model="ngModel"
|
||||
parameters="parameters"
|
||||
mct-object="treeNode.hasBeenExpanded() && domainObject">
|
||||
</mct-representation>
|
||||
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
@ -19,8 +19,8 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<ul class="tree">
|
||||
<li>
|
||||
<ul class="c-tree">
|
||||
<li class="c-tree__item-h">
|
||||
<mct-representation key="'tree-node'"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel"
|
||||
|
@ -1,4 +1,2 @@
|
||||
<span class="tree-item menus-to-left">
|
||||
</span>
|
||||
<span class="tree-item-subtree">
|
||||
</span>
|
||||
<span class="c-tree__item js-tree__item"></span>
|
||||
<span class="c-tree__item-subtree"></span>
|
||||
|
@ -1,2 +1 @@
|
||||
<span class='ui-symbol view-control flex-elem'>
|
||||
</span>
|
||||
<span class='c-disclosure-triangle c-tree__item__view-control'></span>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<span class="rep-object-label">
|
||||
<div class="t-object-label l-flex-row flex-elem grows">
|
||||
<div class="t-item-icon flex-elem"></div>
|
||||
<div class='t-title-label flex-elem grows'></div>
|
||||
</div>
|
||||
</span>
|
||||
<div class="rep-object-label c-object-label c-tree__item__label">
|
||||
<div class="c-object-label__type-icon c-tree__item__type-icon t-item-icon"></div>
|
||||
<div class="c-object-label__name c-tree__item__name t-title-label"></div>
|
||||
</div>
|
||||
|
@ -54,6 +54,7 @@ define(
|
||||
if (isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var removeSelectable = openmct.selection.selectable(
|
||||
element[0],
|
||||
scope.$eval(attrs.mctSelectable),
|
||||
|
@ -37,9 +37,9 @@ define([
|
||||
this.expanded = state;
|
||||
|
||||
if (state) {
|
||||
this.el.addClass('expanded');
|
||||
this.el.addClass('c-disclosure-triangle--expanded');
|
||||
} else {
|
||||
this.el.removeClass('expanded');
|
||||
this.el.removeClass('c-disclosure-triangle--expanded');
|
||||
}
|
||||
|
||||
this.callbacks.forEach(function (callback) {
|
||||
|
@ -28,7 +28,7 @@ define([
|
||||
], function ($, nodeTemplate, ToggleView, TreeLabelView) {
|
||||
|
||||
function TreeNodeView(gestureService, subtreeFactory, selectFn, openmct) {
|
||||
this.li = $('<li>');
|
||||
this.li = $('<li class="c-tree__item-h">');
|
||||
this.openmct = openmct;
|
||||
this.statusClasses = [];
|
||||
|
||||
@ -38,7 +38,7 @@ define([
|
||||
if (!this.subtreeView) {
|
||||
this.subtreeView = subtreeFactory();
|
||||
this.subtreeView.model(this.activeObject);
|
||||
this.li.find('.tree-item-subtree').eq(0)
|
||||
this.li.find('.c-tree__item-subtree').eq(0)
|
||||
.append($(this.subtreeView.elements()));
|
||||
}
|
||||
$(this.subtreeView.elements()).removeClass('hidden');
|
||||
@ -85,9 +85,9 @@ define([
|
||||
var obj = domainObject.useCapability('adapter');
|
||||
var hasComposition = this.openmct.composition.get(obj) !== undefined;
|
||||
if (hasComposition) {
|
||||
$(this.toggleView.elements()).removeClass('no-children');
|
||||
$(this.toggleView.elements()).addClass('is-enabled');
|
||||
} else {
|
||||
$(this.toggleView.elements()).addClass('no-children');
|
||||
$(this.toggleView.elements()).removeClass('is-enabled');
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ define([
|
||||
selectedIdPath = getIdPath(domainObject);
|
||||
|
||||
if (this.onSelectionPath) {
|
||||
this.li.find('.tree-item').eq(0).removeClass('selected');
|
||||
this.li.find('.js-tree__item').eq(0).removeClass('is-selected');
|
||||
if (this.subtreeView) {
|
||||
this.subtreeView.value(undefined);
|
||||
}
|
||||
@ -136,7 +136,7 @@ define([
|
||||
|
||||
if (this.onSelectionPath) {
|
||||
if (activeIdPath.length === selectedIdPath.length) {
|
||||
this.li.find('.tree-item').eq(0).addClass('selected');
|
||||
this.li.find('.js-tree__item').eq(0).addClass('is-selected');
|
||||
} else {
|
||||
// Expand to reveal the selection
|
||||
this.toggleView.value(true);
|
||||
|
@ -27,7 +27,7 @@ define([
|
||||
], function ($, TreeNodeView, spinnerTemplate) {
|
||||
|
||||
function TreeView(gestureService, openmct, selectFn) {
|
||||
this.ul = $('<ul class="tree"></ul>');
|
||||
this.ul = $('<ul class="c-tree"></ul>');
|
||||
this.nodeViews = [];
|
||||
this.callbacks = [];
|
||||
this.selectFn = selectFn || this.value.bind(this);
|
||||
|
@ -26,7 +26,7 @@ define([
|
||||
'zepto'
|
||||
], function (TreeView, $) {
|
||||
|
||||
describe("TreeView", function () {
|
||||
xdescribe("TreeView", function () {
|
||||
var mockGestureService,
|
||||
mockGestureHandle,
|
||||
mockDomainObject,
|
||||
|
@ -27,8 +27,7 @@ define([
|
||||
"./res/info-table.html",
|
||||
"./res/info-bubble.html",
|
||||
"./res/bubble.html",
|
||||
"./res/templates/info-button.html",
|
||||
'legacyRegistry'
|
||||
"./res/templates/info-button.html"
|
||||
], function (
|
||||
InfoGesture,
|
||||
InfoButtonGesture,
|
||||
@ -36,81 +35,83 @@ define([
|
||||
infoTableTemplate,
|
||||
infoBubbleTemplate,
|
||||
bubbleTemplate,
|
||||
infoButtonTemplate,
|
||||
legacyRegistry
|
||||
infoButtonTemplate
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/inspect", {
|
||||
"extensions": {
|
||||
"templates": [
|
||||
{
|
||||
"key": "info-table",
|
||||
"template": infoTableTemplate
|
||||
},
|
||||
{
|
||||
"key": "info-bubble",
|
||||
"template": infoBubbleTemplate
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
{
|
||||
"key": "bubble",
|
||||
"template": bubbleTemplate,
|
||||
"attributes": [
|
||||
"bubbleTitle",
|
||||
"bubbleLayout"
|
||||
],
|
||||
"alias": "bubble"
|
||||
}
|
||||
],
|
||||
"gestures": [
|
||||
{
|
||||
"key": "info",
|
||||
"implementation": InfoGesture,
|
||||
"depends": [
|
||||
"$timeout",
|
||||
"agentService",
|
||||
"infoService",
|
||||
"INFO_HOVER_DELAY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "infobutton",
|
||||
"implementation": InfoButtonGesture,
|
||||
"depends": [
|
||||
"$document",
|
||||
"agentService",
|
||||
"infoService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "infoService",
|
||||
"implementation": InfoService,
|
||||
"depends": [
|
||||
"$compile",
|
||||
"$rootScope",
|
||||
"popupService",
|
||||
"agentService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "INFO_HOVER_DELAY",
|
||||
"value": 2000
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "info-button",
|
||||
"template": infoButtonTemplate,
|
||||
"gestures": [
|
||||
"infobutton"
|
||||
]
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"platform/commonUI/inspect",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"templates": [
|
||||
{
|
||||
"key": "info-table",
|
||||
"template": infoTableTemplate
|
||||
},
|
||||
{
|
||||
"key": "info-bubble",
|
||||
"template": infoBubbleTemplate
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
{
|
||||
"key": "bubble",
|
||||
"template": bubbleTemplate,
|
||||
"attributes": [
|
||||
"bubbleTitle",
|
||||
"bubbleLayout"
|
||||
],
|
||||
"alias": "bubble"
|
||||
}
|
||||
],
|
||||
"gestures": [
|
||||
{
|
||||
"key": "info",
|
||||
"implementation": InfoGesture,
|
||||
"depends": [
|
||||
"$timeout",
|
||||
"agentService",
|
||||
"infoService",
|
||||
"INFO_HOVER_DELAY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "infobutton",
|
||||
"implementation": InfoButtonGesture,
|
||||
"depends": [
|
||||
"$document",
|
||||
"agentService",
|
||||
"infoService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "infoService",
|
||||
"implementation": InfoService,
|
||||
"depends": [
|
||||
"$compile",
|
||||
"$rootScope",
|
||||
"popupService",
|
||||
"agentService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "INFO_HOVER_DELAY",
|
||||
"value": 2000
|
||||
}
|
||||
],
|
||||
"representations": [
|
||||
{
|
||||
"key": "info-button",
|
||||
"template": infoButtonTemplate,
|
||||
"gestures": [
|
||||
"infobutton"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -23,44 +23,45 @@
|
||||
define([
|
||||
"./src/MCTDevice",
|
||||
"./src/AgentService",
|
||||
"./src/DeviceClassifier",
|
||||
'legacyRegistry'
|
||||
"./src/DeviceClassifier"
|
||||
], function (
|
||||
MCTDevice,
|
||||
AgentService,
|
||||
DeviceClassifier,
|
||||
legacyRegistry
|
||||
DeviceClassifier
|
||||
) {
|
||||
|
||||
legacyRegistry.register("platform/commonUI/mobile", {
|
||||
"extensions": {
|
||||
"directives": [
|
||||
{
|
||||
"key": "mctDevice",
|
||||
"implementation": MCTDevice,
|
||||
"depends": [
|
||||
"agentService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "agentService",
|
||||
"implementation": AgentService,
|
||||
"depends": [
|
||||
"$window"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": DeviceClassifier,
|
||||
"depends": [
|
||||
"agentService",
|
||||
"$document"
|
||||
]
|
||||
}
|
||||
]
|
||||
return {
|
||||
name:"platform/commonUI/mobile",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"directives": [
|
||||
{
|
||||
"key": "mctDevice",
|
||||
"implementation": MCTDevice,
|
||||
"depends": [
|
||||
"agentService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key": "agentService",
|
||||
"implementation": AgentService,
|
||||
"depends": [
|
||||
"$window"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": DeviceClassifier,
|
||||
"depends": [
|
||||
"agentService",
|
||||
"$document"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user