mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 18:50:11 +00:00
Compare commits
146 Commits
vue-table-
...
summary-wi
Author | SHA1 | Date | |
---|---|---|---|
00f4dcd558 | |||
0bc05e1b9e | |||
c931c54332 | |||
4ec6f797e7 | |||
c40cc3e060 | |||
7ee4a508f6 | |||
28da6a5106 | |||
a4f203332a | |||
b9a678bf9a | |||
971eda4d88 | |||
68e6e3c121 | |||
7e7f39db2d | |||
b6e0fca828 | |||
ffc5896e5a | |||
fd6ebd152f | |||
7a5c1c0e1f | |||
2f7e1e3f1a | |||
d73746b51b | |||
2df54af019 | |||
586269f761 | |||
e536ab34d7 | |||
e15002dd72 | |||
453cf3ad6a | |||
5c46e48bde | |||
868ea9362f | |||
d69106ff2c | |||
1658b17c56 | |||
39cf0528ca | |||
3d12f7312b | |||
22481fdc31 | |||
4a9d27dc79 | |||
a5a9fefd40 | |||
dae4074934 | |||
a540a3573f | |||
4e7fe9082c | |||
568141bf81 | |||
ac3ea43fe5 | |||
e922e8d504 | |||
650a877d2a | |||
1202109c59 | |||
429d7bbd57 | |||
af749fe71b | |||
cf64c512ce | |||
c5bd3da44a | |||
ff3e49e926 | |||
e244a3e431 | |||
c5d9fb6fd9 | |||
4c276ab422 | |||
bf321abae4 | |||
7336968ef9 | |||
d60956948b | |||
23d5c2e1ee | |||
2632b8891a | |||
fff4cd9d51 | |||
be0291cf70 | |||
b3a6d7271d | |||
ebeed2f236 | |||
337c26c019 | |||
730f363f94 | |||
ae30e6110b | |||
6e4bf3e45b | |||
5465ca92f9 | |||
e55ea41b0a | |||
8cfb3cc689 | |||
2d728a1362 | |||
99333988df | |||
de783d4286 | |||
f6c1488ccd | |||
26be1ecf37 | |||
38f0f072bb | |||
e5e969665f | |||
ffbb662c99 | |||
bd7b23f896 | |||
c238def902 | |||
2d430ece7f | |||
c92644a661 | |||
41ce3c04f7 | |||
fcf77f359f | |||
40a2737915 | |||
216489d67f | |||
418a393b26 | |||
1f3d744494 | |||
ff3f2dccba | |||
e69973bd29 | |||
05b352cc36 | |||
9735548999 | |||
f9529b1362 | |||
c598cec702 | |||
e9ea1c4a0f | |||
e9238ff282 | |||
4cebd72cba | |||
f8a44d6e71 | |||
d0745b300b | |||
2a4e0a3081 | |||
1ff19f9574 | |||
7ef84cb50d | |||
cd05c70d64 | |||
568473b82f | |||
c61b074755 | |||
8ed66ab4ab | |||
b2502dd998 | |||
856eedbf9d | |||
0c0ca6e6af | |||
498b797e49 | |||
02c33388ba | |||
8a8e3cc055 | |||
36d60b16e9 | |||
de3114568b | |||
eb5835faeb | |||
ff1ddb0b79 | |||
15b127bb2e | |||
e4ed881f6d | |||
7b62cf130c | |||
72fd2e531c | |||
4a5392ef78 | |||
0150a708ca | |||
eacc181d5e | |||
405bb55881 | |||
4a35508459 | |||
98a9d71a2e | |||
a1596d0b06 | |||
4b3be4c483 | |||
0fa8472db1 | |||
e1e2dca1d8 | |||
755c013ec8 | |||
eab702b763 | |||
d15446ac91 | |||
500733afb2 | |||
2aa04b0a56 | |||
c051f342af | |||
8aeb365f5f | |||
827a28313d | |||
c83de8aad2 | |||
b55f43b8df | |||
8466723a90 | |||
a103b4dbff | |||
826ac3a947 | |||
597327f138 | |||
bef79402ca | |||
e68e0c381f | |||
c73f7259c2 | |||
4c9235ba10 | |||
55e2a77df8 | |||
cfbff02e7f | |||
54980fb296 | |||
ba98d9315c |
@ -21,6 +21,5 @@
|
||||
"shadow": "outer",
|
||||
"strict": "implied",
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"latedef": "nofunc"
|
||||
"unused": "vars"
|
||||
}
|
||||
|
171
API.md
171
API.md
@ -1,57 +1,3 @@
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of Contents**
|
||||
|
||||
- [Building Applications With Open MCT](#building-applications-with-open-mct)
|
||||
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
||||
- [Building From Source](#building-from-source)
|
||||
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
||||
- [Plugins](#plugins)
|
||||
- [Defining and Installing a New Plugin](#defining-and-installing-a-new-plugin)
|
||||
- [Domain Objects and Identifiers](#domain-objects-and-identifiers)
|
||||
- [Object Attributes](#object-attributes)
|
||||
- [Domain Object Types](#domain-object-types)
|
||||
- [Root Objects](#root-objects)
|
||||
- [Object Providers](#object-providers)
|
||||
- [Composition Providers](#composition-providers)
|
||||
- [Adding Composition Providers](#adding-composition-providers)
|
||||
- [Default Composition Provider](#default-composition-provider)
|
||||
- [Telemetry API](#telemetry-api)
|
||||
- [Integrating Telemetry Sources](#integrating-telemetry-sources)
|
||||
- [Telemetry Metadata](#telemetry-metadata)
|
||||
- [Values](#values)
|
||||
- [Value Hints](#value-hints)
|
||||
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
||||
- [Telemetry Providers](#telemetry-providers)
|
||||
- [Telemetry Requests and Responses.](#telemetry-requests-and-responses)
|
||||
- [Request Strategies **draft**](#request-strategies-draft)
|
||||
- [`latest` request strategy](#latest-request-strategy)
|
||||
- [`minmax` request strategy](#minmax-request-strategy)
|
||||
- [Telemetry Formats **draft**](#telemetry-formats-draft)
|
||||
- [Registering Formats](#registering-formats)
|
||||
- [Telemetry Data](#telemetry-data)
|
||||
- [Telemetry Datums](#telemetry-datums)
|
||||
- [Limit Evaluators **draft**](#limit-evaluators-draft)
|
||||
- [Telemetry Consumer APIs **draft**](#telemetry-consumer-apis-draft)
|
||||
- [Time API](#time-api)
|
||||
- [Time Systems and Bounds](#time-systems-and-bounds)
|
||||
- [Defining and Registering Time Systems](#defining-and-registering-time-systems)
|
||||
- [Getting and Setting the Active Time System](#getting-and-setting-the-active-time-system)
|
||||
- [Time Bounds](#time-bounds)
|
||||
- [Clocks](#clocks)
|
||||
- [Defining and registering clocks](#defining-and-registering-clocks)
|
||||
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
||||
- [Stopping an active clock](#stopping-an-active-clock)
|
||||
- [Clock Offsets](#clock-offsets)
|
||||
- [Time Events](#time-events)
|
||||
- [List of Time Events](#list-of-time-events)
|
||||
- [The Time Conductor](#the-time-conductor)
|
||||
- [Time Conductor Configuration](#time-conductor-configuration)
|
||||
- [Example conductor configuration](#example-conductor-configuration)
|
||||
- [Included Plugins](#included-plugins)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
# Building Applications With Open MCT
|
||||
|
||||
## Scope and purpose of this document
|
||||
@ -208,7 +154,7 @@ registry.
|
||||
|
||||
eg.
|
||||
```javascript
|
||||
openmct.types.addType('example.my-type', {
|
||||
openmct.types.addType('my-type', {
|
||||
name: "My Type",
|
||||
description: "This is a type that I added!",
|
||||
creatable: true
|
||||
@ -216,9 +162,8 @@ openmct.types.addType('example.my-type', {
|
||||
```
|
||||
|
||||
The `addType` function accepts two arguments:
|
||||
* A `string` key identifying the type. This key is used when specifying a type
|
||||
for an object. We recommend prefixing your types with a namespace to avoid
|
||||
conflicts with other plugins.
|
||||
* A `string` key identifying the type. This key is used when specifying a type
|
||||
for an object.
|
||||
* An object type specification. An object type definition supports the following
|
||||
attributes
|
||||
* `name`: a `string` naming this object type
|
||||
@ -249,7 +194,7 @@ To do so, use the `addRoot` method of the object API.
|
||||
eg.
|
||||
```javascript
|
||||
openmct.objects.addRoot({
|
||||
namespace: "example.namespace",
|
||||
namespace: "my-namespace",
|
||||
key: "my-key"
|
||||
});
|
||||
```
|
||||
@ -290,12 +235,13 @@ It is expected that the `get` function will return a
|
||||
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
||||
that resolves with the object being requested.
|
||||
|
||||
In future, object providers will support other methods to enable other operations with persistence stores, such as creating, updating, and deleting objects.
|
||||
In future, object providers will support other methods to enable other operations
|
||||
with persistence stores, such as creating, updating, and deleting objects.
|
||||
|
||||
## Composition Providers
|
||||
|
||||
The _composition_ of a domain object is the list of objects it contains, as
|
||||
shown (for example) in the tree for browsing. Open MCT provides a
|
||||
The _composition_ of a domain object is the list of objects it contains, as shown
|
||||
(for example) in the tree for browsing. Open MCT provides a
|
||||
[default solution](#default-composition-provider) for composition, but there
|
||||
may be cases where you want to provide the composition of a certain object
|
||||
(or type of object) dynamically.
|
||||
@ -309,7 +255,7 @@ Composition Provider:
|
||||
```javascript
|
||||
openmct.composition.addProvider({
|
||||
appliesTo: function (domainObject) {
|
||||
return domainObject.type === 'example.my-type';
|
||||
return domainObject.type === 'my-type';
|
||||
},
|
||||
load: function (domainObject) {
|
||||
return Promise.resolve(myDomainObjects);
|
||||
@ -327,9 +273,8 @@ These identifiers will be used to fetch Domain Objects from an [Object Provider]
|
||||
|
||||
### Default Composition Provider
|
||||
|
||||
The default composition provider applies to any domain object with a
|
||||
`composition` property. The value of `composition` should be an array of
|
||||
identifiers, e.g.:
|
||||
The default composition provider applies to any domain object with a `composition`
|
||||
property. The value of `composition` should be an array of identifiers, e.g.:
|
||||
|
||||
```javascript
|
||||
var domainObject = {
|
||||
@ -350,17 +295,13 @@ var domainObject = {
|
||||
|
||||
## Telemetry API
|
||||
|
||||
The Open MCT telemetry API provides two main sets of interfaces-- one for
|
||||
integrating telemetry data into Open MCT, and another for developing Open MCT
|
||||
visualization plugins utilizing the telemetry API.
|
||||
The Open MCT telemetry API provides two main sets of interfaces-- one for integrating telemetry data into Open MCT, and another for developing Open MCT visualization plugins utilizing telemetry API.
|
||||
|
||||
The APIs for visualization plugins are still a work in progress and docs may
|
||||
change at any time. However, the APIs for integrating telemetry metadata into
|
||||
Open MCT are stable and documentation is included below.
|
||||
The APIs for visualization plugins are still a work in progress and docs may change at any time. However, the APIs for integrating telemetry metadata into Open MCT are stable and documentation is included below.
|
||||
|
||||
### Integrating Telemetry Sources
|
||||
|
||||
There are two main tasks for integrating telemetry sources-- describing telemetry objects with relevant metadata, and then providing telemetry data for those objects. You'll use an [Object Provider](#object-providers) to provide objects with the necessary [Telemetry Metadata](#telemetry-metadata), and then register a [Telemetry Provider](#telemetry-providers) to retrieve telemetry data for those objects. Alternatively, you can register a telemetry metadata provider to provide the necessary telemetry metadata.
|
||||
There are two main tasks for integrating telemetry sources-- describing telemetry objects with relevant metadata, and then providing telemetry data for those objects. You'll use an [Object Provider](#object-providers) to provide objects with the necessary [Telemetry Metadata](#telemetry-metadata), and then register a [Telemetry Provider](#telemetry-providers) to retrieve telemetry data for those objects.
|
||||
|
||||
For a step-by-step guide to building a telemetry adapter, please see the
|
||||
[Open MCT Tutorials](https://github.com/nasa/openmct-tutorial).
|
||||
@ -414,7 +355,7 @@ attribute | type | flags | notes
|
||||
--- | --- | --- | ---
|
||||
`key` | string | required | unique identifier for this field.
|
||||
`hints` | object | required | Hints allow views to intelligently select relevant attributes for display, and are required for most views to function. See section on "Value Hints" below.
|
||||
`name` | string | optional | a human readable label for this field. If omitted, defaults to `key`.
|
||||
`name` | string | optional | a human readible label for this field. If omitted, defaults to `key`.
|
||||
`source` | string | optional | identifies the property of a datum where this value is stored. If omitted, defaults to `key`.
|
||||
`format` | string | optional | a specific format identifier, mapping to a formatter. If omitted, uses a default formatter. For enumerations, use `enum`. For timestamps, use `utc` if you are using utc dates, otherwise use a key mapping to your custom date format.
|
||||
`units` | string | optional | the units of this value, e.g. `km`, `seconds`, `parsecs`
|
||||
@ -442,18 +383,14 @@ In order for the time conductor to work, there will always be an active "time sy
|
||||
|
||||
#### Telemetry Providers
|
||||
|
||||
Telemetry providers are responsible for providing historical and real-time telemetry data for telemetry objects. Each telemetry provider determines which objects it can provide telemetry for, and then must implement methods to provide telemetry for those objects.
|
||||
Telemetry providers are responsible for providing historical and real time telemetry data for telemetry objects. Each telemetry provider determines which objects it can provide telemetry for, and then must implement methods to provide telemetry for those objects.
|
||||
|
||||
A telemetry provider is a javascript object with up to four methods:
|
||||
|
||||
* `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options).
|
||||
* `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function.
|
||||
* `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object.
|
||||
* `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests.
|
||||
* `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for.
|
||||
* `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition.
|
||||
* `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for.
|
||||
* `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object.
|
||||
* `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. For more request properties, see Request Properties below.
|
||||
|
||||
Telemetry providers are registered by calling `openmct.telemetry.addProvider(provider)`, e.g.
|
||||
|
||||
@ -461,15 +398,14 @@ Telemetry providers are registered by calling `openmct.telemetry.addProvider(pro
|
||||
openmct.telemetry.addProvider({
|
||||
supportsRequest: function (domainObject, options) { /*...*/ },
|
||||
request: function (domainObject, options) { /*...*/ },
|
||||
supportsSubscribe: function (domainObject, callback, options) { /*...*/ },
|
||||
subscribe: function (domainObject, callback, options) { /*...*/ }
|
||||
})
|
||||
```
|
||||
|
||||
Note: it is not required to implement all of the methods on every provider. Depending on the complexity of your implementation, it may be helpful to instantiate and register your realtime, historical, and metadata providers separately.
|
||||
|
||||
#### Telemetry Requests and Responses.
|
||||
#### Telemetry Requests
|
||||
|
||||
Telemetry requests support time bounded queries. A call to a _Telemetry Provider_'s `request` function will include an `options` argument. These are simply javascript objects with attributes for the request parameters. An example of a telemetry request object with a start and end time is included below:
|
||||
|
||||
```javascript
|
||||
{
|
||||
start: 1487981997240,
|
||||
@ -478,53 +414,7 @@ Telemetry requests support time bounded queries. A call to a _Telemetry Provider
|
||||
}
|
||||
```
|
||||
|
||||
In this case, the `domain` is the currently selected time-system, and the start and end dates are valid dates in that time system.
|
||||
|
||||
A telemetry provider's `request` method should return a promise for an array of telemetry datums. These datums must be sorted by `domain` in ascending order.
|
||||
|
||||
#### Request Strategies **draft**
|
||||
|
||||
To improve performance views may request a certain strategy for data reduction. These are intended to improve visualization performance by reducing the amount of data needed to be sent to the client. These strategies will be indicated by additional parameters in the request options. You may choose to handle them or ignore them.
|
||||
|
||||
Note: these strategies are currently being tested in core plugins and may change based on developer feedback.
|
||||
|
||||
##### `latest` request strategy
|
||||
|
||||
This request is a "depth based" strategy. When a view is only capable of
|
||||
displaying a single value (or perhaps the last ten values), then it can
|
||||
use the `latest` request strategy with a `size` parameter that specifies
|
||||
the number of results it desires. The `size` parameter is a hint; views
|
||||
must not assume the response will have the exact number of results requested.
|
||||
|
||||
example:
|
||||
```javascript
|
||||
{
|
||||
start: 1487981997240,
|
||||
end: 1487982897240,
|
||||
domain: 'utc',
|
||||
strategy: 'latest',
|
||||
size: 1
|
||||
}
|
||||
```
|
||||
|
||||
This strategy says "I want the lastest data point in this time range". A provider which recognizes this request should return only one value-- the latest-- in the requested time range. Depending on your back-end implementation, performing these queries in bulk can be a large performance increase. These are generally issued by views that are only capable of displaying a single value and only need to show the latest value.
|
||||
|
||||
##### `minmax` request strategy
|
||||
|
||||
example:
|
||||
```javascript
|
||||
{
|
||||
start: 1487981997240,
|
||||
end: 1487982897240,
|
||||
domain: 'utc',
|
||||
strategy: 'minmax',
|
||||
size: 720
|
||||
}
|
||||
```
|
||||
|
||||
MinMax queries are issued by plots, and may be issued by other types as well. The aim is to reduce the amount of data returned but still faithfully represent the full extent of the data. In order to do this, the view calculates the maximum data resolution it can display (i.e. the number of horizontal pixels in a plot) and sends that as the `size`. The response should include at least one minimum and one maximum value per point of resolution.
|
||||
|
||||
#### Telemetry Formats **draft**
|
||||
#### Telemetry Formats
|
||||
|
||||
Telemetry format objects define how to interpret and display telemetry data.
|
||||
They have a simple structure:
|
||||
@ -594,17 +484,6 @@ The key-value pairs of this object are described by the telemetry metadata of
|
||||
a domain object, as discussed in the [Telemetry Metadata](#telemetry-metadata)
|
||||
section.
|
||||
|
||||
#### Limit Evaluators **draft**
|
||||
|
||||
Limit evaluators allow a telemetry integrator to define how limits should be
|
||||
applied to telemetry from a given domain object. For an example of a limit
|
||||
evaluator, take a look at `examples/generator/SinewaveLimitProvider.js`.
|
||||
|
||||
### Telemetry Consumer APIs **draft**
|
||||
|
||||
The APIs for requesting telemetry from Open MCT -- e.g. for use in custom views -- are currently in draft state and are being revised. If you'd like to experiement with them before they are finalized, please contact the team via the contact-us link on our website.
|
||||
|
||||
|
||||
## Time API
|
||||
|
||||
Open MCT provides API for managing the temporal state of the application.
|
||||
@ -712,7 +591,7 @@ openmct.time.bounds({start: now - ONE_HOUR, now);
|
||||
To respond to bounds change events, listen for the [`'bounds'`](#time-events)
|
||||
event.
|
||||
|
||||
### Clocks
|
||||
## Clocks
|
||||
|
||||
The Time API can be set to follow a clock source which will cause the bounds
|
||||
to be updated automatically whenever the clock source "ticks". A clock is simply
|
||||
@ -731,7 +610,7 @@ be defined to tick on some remote timing source.
|
||||
The values provided by clocks are simple `number`s, which are interpreted in the
|
||||
context of the active [Time System](#defining-and-registering-time-systems).
|
||||
|
||||
#### Defining and registering clocks
|
||||
### Defining and registering clocks
|
||||
|
||||
A clock is an object that defines certain required metadata and functions:
|
||||
|
||||
@ -845,7 +724,7 @@ __Note:__ Setting the clock offsets will trigger an immediate bounds change, as
|
||||
new bounds will be calculated based on the `currentValue()` of the active clock.
|
||||
Clock offsets are only relevant when a clock source is active.
|
||||
|
||||
### Time Events
|
||||
## Time Events
|
||||
|
||||
The Time API is a standard event emitter; you can register callbacks for events using the `on` method and remove callbacks for events with the `off` method.
|
||||
|
||||
@ -887,7 +766,7 @@ The events emitted by the Time API are:
|
||||
* `clockOffsets`: The new [clock offsets](#clock-offsets).
|
||||
|
||||
|
||||
### The Time Conductor
|
||||
## The Time Conductor
|
||||
|
||||
The Time Conductor provides a user interface for managing time bounds in Open
|
||||
MCT. It allows a user to select from configured time systems and clocks, and to set bounds and clock offsets.
|
||||
|
@ -88,7 +88,7 @@ and [`gulp`](http://gulpjs.com/).
|
||||
|
||||
To build Open MCT for deployment:
|
||||
|
||||
`npm run prepare`
|
||||
`npm run prepublish`
|
||||
|
||||
This will compile and minify JavaScript sources, as well as copy over assets.
|
||||
The contents of the `dist` folder will contain a runnable Open MCT
|
||||
|
5
app.js
5
app.js
@ -19,7 +19,6 @@
|
||||
|
||||
// Defaults
|
||||
options.port = options.port || options.p || 8080;
|
||||
options.host = options.host || options.h || 'localhost'
|
||||
options.directory = options.directory || options.D || '.';
|
||||
['include', 'exclude', 'i', 'x'].forEach(function (opt) {
|
||||
options[opt] = options[opt] || [];
|
||||
@ -79,7 +78,7 @@
|
||||
app.use(express['static'](options.directory));
|
||||
|
||||
// Finally, open the HTTP server and log the instance to the console
|
||||
app.listen(options.port, options.host, function() {
|
||||
console.log('Open MCT application running at %s:%s', options.host, options.port)
|
||||
app.listen(options.port, function() {
|
||||
console.log('Open MCT application running at localhost:' + options.port)
|
||||
});
|
||||
}());
|
||||
|
@ -17,11 +17,12 @@
|
||||
"screenfull": "^3.0.0",
|
||||
"node-uuid": "^1.4.7",
|
||||
"comma-separated-values": "^3.6.4",
|
||||
"file-saver": "1.3.3",
|
||||
"file-saver": "^1.3.3",
|
||||
"zepto": "^1.1.6",
|
||||
"eventemitter3": "^1.2.0",
|
||||
"lodash": "3.10.1",
|
||||
"almond": "~0.3.2",
|
||||
"html2canvas": "^0.4.1",
|
||||
"moment-timezone": "^0.5.13"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,3 @@
|
||||
machine:
|
||||
node:
|
||||
version: 8.11.0
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- npm install -g npm@latest
|
||||
|
||||
deployment:
|
||||
production:
|
||||
branch: master
|
||||
|
@ -2283,7 +2283,7 @@ To install build dependencies (only needs to be run once):
|
||||
|
||||
To build:
|
||||
|
||||
`npm run prepare`
|
||||
`npm run prepublish`
|
||||
|
||||
This will compile and minify JavaScript sources, as well as copy over assets.
|
||||
The contents of the `dist` folder will contain a runnable Open MCT
|
||||
|
@ -1,121 +0,0 @@
|
||||
# Security Guide
|
||||
|
||||
Open MCT is a rich client with plugin support that executes as a single page
|
||||
web application in a browser environment. Security concerns and
|
||||
vulnerabilities associated with the web as a platform should be considered
|
||||
before deploying Open MCT (or any other web application) for mission or
|
||||
production usage.
|
||||
|
||||
This document describes several important points to consider when developing
|
||||
for or deploying Open MCT securely. Other resources such as
|
||||
[Open Web Application Security Project (OWASP)](https://www.owasp.org)
|
||||
provide a deeper and more general overview of security for web applications.
|
||||
|
||||
|
||||
## Security Model
|
||||
|
||||
Open MCT has been architected assuming the following deployment pattern:
|
||||
|
||||
* A tagged, tested Open MCT version will be used.
|
||||
* Externally authored plugins will be installed.
|
||||
* A server will provide persistent storage, telemetry, and other shared data.
|
||||
* Authorization, authentication, and auditing will be handled by a server.
|
||||
|
||||
|
||||
## Security Procedures
|
||||
|
||||
The Open MCT team secures our code base using a combination of code review,
|
||||
dependency review, and periodic security reviews. Static analysis performed
|
||||
during automated verification additionally safeguards against common
|
||||
coding errors which may result in vulnerabilities.
|
||||
|
||||
|
||||
### Code Review
|
||||
|
||||
All contributions are reviewed by internal team members. External
|
||||
contributors receive increased scrutiny for security and quality,
|
||||
and must sign a licensing agreement.
|
||||
|
||||
### Dependency Review
|
||||
|
||||
Before integrating third-party dependencies, they are reviewed for security
|
||||
and quality, with consideration given to authors and users of these
|
||||
dependencies, as well as review of open source code.
|
||||
|
||||
### Periodic Security Reviews
|
||||
|
||||
Open MCT's code, design, and architecture are periodically reviewed
|
||||
(approximately annually) for common security issues, such as the
|
||||
[OWASP Top Ten](https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project).
|
||||
|
||||
|
||||
## Security Concerns
|
||||
|
||||
Certain security concerns deserve special attention when deploying Open MCT,
|
||||
or when authoring plugins.
|
||||
|
||||
### Identity Spoofing
|
||||
|
||||
Open MCT issues calls to web services with the privileges of a logged in user.
|
||||
Compromised sources (either for Open MCT itself or a plugin) could
|
||||
therefore allow malicious code to execute with those privileges.
|
||||
|
||||
To avoid this:
|
||||
|
||||
* Serve Open MCT and other scripts over SSL (https rather than http)
|
||||
to prevent man-in-the-middle attacks.
|
||||
* Exercise precautions such as security reviews for any plugins or
|
||||
applications built for or with Open MCT to reject malicious changes.
|
||||
|
||||
### Information Disclosure
|
||||
|
||||
If Open MCT is used to handle or display sensitive data, any components
|
||||
(such as adapter plugins) must take care to avoid leaking or disclosing
|
||||
this information. For example, avoid sending sensitive data to third-party
|
||||
servers or insecure APIs.
|
||||
|
||||
### Data Tampering
|
||||
|
||||
The web application architecture leaves open the possibility that direct
|
||||
calls will be made to back-end services, circumventing Open MCT entirely.
|
||||
As such, Open MCT assumes that server components will perform any necessary
|
||||
data validation during calls issues to the server.
|
||||
|
||||
Additionally, plugins which serialize and write data to the server must
|
||||
escape that data to avoid database injection attacks, and similar.
|
||||
|
||||
### Repudiation
|
||||
|
||||
Open MCT assumes that servers log any relevant interactions and associates
|
||||
these with a user identity; the specific user actions taken within the
|
||||
application are assumed not to be of concern for auditing.
|
||||
|
||||
In the absence of server-side logging, users may disclaim (maliciously,
|
||||
mistakenly, or otherwise) actions taken within the system without any
|
||||
way to prove otherwise.
|
||||
|
||||
If keeping client-level interactions is important, this will need to be
|
||||
implemented via a plugin.
|
||||
|
||||
### Denial-of-service
|
||||
|
||||
Open MCT assumes that server-side components will be insulated against
|
||||
denial-of-service attacks. Services should only permit resource-intensive
|
||||
tasks to be initiated by known or trusted users.
|
||||
|
||||
### Elevation of Privilege
|
||||
|
||||
Corollary to the assumption that servers guide against identity spoofing,
|
||||
Open MCT assumes that services do not allow a user to act with
|
||||
inappropriately escalated privileges. Open MCT cannot protect against
|
||||
such escalation; in the clearest case, a malicious actor could interact
|
||||
with web services directly to exploit such a vulnerability.
|
||||
|
||||
## Additional Reading
|
||||
|
||||
The following resources have been used as a basis for identifying potential
|
||||
security threats to Open MCT deployments in preparation of this document:
|
||||
|
||||
* [STRIDE model](https://www.owasp.org/index.php/Threat_Risk_Modeling#STRIDE)
|
||||
* [Attack Surface Analysis Cheat Sheet](https://www.owasp.org/index.php/Attack_Surface_Analysis_Cheat_Sheet)
|
||||
* [XSS Prevention Cheat Sheet](https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet)
|
@ -60,8 +60,8 @@ define([
|
||||
"source": "eventGenerator",
|
||||
"domains": [
|
||||
{
|
||||
"key": "utc",
|
||||
"name": "Timestamp",
|
||||
"key": "time",
|
||||
"name": "Time",
|
||||
"format": "utc"
|
||||
}
|
||||
],
|
||||
|
@ -1,110 +0,0 @@
|
||||
define([
|
||||
'lodash'
|
||||
], function (
|
||||
_
|
||||
) {
|
||||
|
||||
var METADATA_BY_TYPE = {
|
||||
'generator': {
|
||||
values: [
|
||||
{
|
||||
key: "name",
|
||||
name: "Name"
|
||||
},
|
||||
{
|
||||
key: "utc",
|
||||
name: "Time",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "yesterday",
|
||||
name: "Yesterday",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "sin",
|
||||
name: "Sine",
|
||||
formatString: '%0.2f',
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "cos",
|
||||
name: "Cosine",
|
||||
formatString: '%0.2f',
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'example.state-generator': {
|
||||
values: [
|
||||
{
|
||||
key: "name",
|
||||
name: "Name"
|
||||
},
|
||||
{
|
||||
key: "utc",
|
||||
name: "Time",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "state",
|
||||
source: "value",
|
||||
name: "State",
|
||||
format: "enum",
|
||||
enumerations: [
|
||||
{
|
||||
value: 0,
|
||||
string: "OFF"
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
string: "ON"
|
||||
}
|
||||
],
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
name: "Value",
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
function GeneratorMetadataProvider() {
|
||||
|
||||
}
|
||||
|
||||
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
|
||||
return METADATA_BY_TYPE.hasOwnProperty(domainObject.type);
|
||||
};
|
||||
|
||||
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
return _.extend(
|
||||
{},
|
||||
domainObject.telemetry,
|
||||
METADATA_BY_TYPE[domainObject.type]
|
||||
);
|
||||
};
|
||||
|
||||
return GeneratorMetadataProvider;
|
||||
|
||||
});
|
@ -30,8 +30,7 @@ define([
|
||||
amplitude: 1,
|
||||
period: 10,
|
||||
offset: 0,
|
||||
dataRateInHz: 1,
|
||||
phase: 0
|
||||
dataRateInHz: 1
|
||||
};
|
||||
|
||||
function GeneratorProvider() {
|
||||
@ -51,12 +50,9 @@ define([
|
||||
'amplitude',
|
||||
'period',
|
||||
'offset',
|
||||
'dataRateInHz',
|
||||
'phase',
|
||||
'dataRateInHz'
|
||||
];
|
||||
|
||||
request = request || {};
|
||||
|
||||
var workerRequest = {};
|
||||
|
||||
props.forEach(function (prop) {
|
||||
@ -66,12 +62,12 @@ define([
|
||||
if (request && request.hasOwnProperty(prop)) {
|
||||
workerRequest[prop] = request[prop];
|
||||
}
|
||||
if (!workerRequest.hasOwnProperty(prop)) {
|
||||
if (!workerRequest[prop]) {
|
||||
workerRequest[prop] = REQUEST_DEFAULTS[prop];
|
||||
}
|
||||
workerRequest[prop] = Number(workerRequest[prop]);
|
||||
});
|
||||
workerRequest.name = domainObject.name;
|
||||
|
||||
return workerRequest;
|
||||
};
|
||||
|
||||
|
87
example/generator/SinewaveLimitCapability.js
Normal file
87
example/generator/SinewaveLimitCapability.js
Normal file
@ -0,0 +1,87 @@
|
||||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var RED = 0.9,
|
||||
YELLOW = 0.5,
|
||||
LIMITS = {
|
||||
rh: {
|
||||
cssClass: "s-limit-upr s-limit-red",
|
||||
low: RED,
|
||||
high: Number.POSITIVE_INFINITY,
|
||||
name: "Red High"
|
||||
},
|
||||
rl: {
|
||||
cssClass: "s-limit-lwr s-limit-red",
|
||||
high: -RED,
|
||||
low: Number.NEGATIVE_INFINITY,
|
||||
name: "Red Low"
|
||||
},
|
||||
yh: {
|
||||
cssClass: "s-limit-upr s-limit-yellow",
|
||||
low: YELLOW,
|
||||
high: RED,
|
||||
name: "Yellow High"
|
||||
},
|
||||
yl: {
|
||||
cssClass: "s-limit-lwr s-limit-yellow",
|
||||
low: -RED,
|
||||
high: -YELLOW,
|
||||
name: "Yellow Low"
|
||||
}
|
||||
};
|
||||
|
||||
function SinewaveLimitCapability(domainObject) {
|
||||
return {
|
||||
limits: function (range) {
|
||||
return LIMITS;
|
||||
},
|
||||
evaluate: function (datum, range) {
|
||||
range = range || 'sin';
|
||||
if (datum[range] > RED) {
|
||||
return LIMITS.rh;
|
||||
}
|
||||
if (datum[range] < -RED) {
|
||||
return LIMITS.rl;
|
||||
}
|
||||
if (datum[range] > YELLOW) {
|
||||
return LIMITS.yh;
|
||||
}
|
||||
if (datum[range] < -YELLOW) {
|
||||
return LIMITS.yl;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SinewaveLimitCapability.appliesTo = function (model) {
|
||||
return model.type === 'generator';
|
||||
};
|
||||
|
||||
return SinewaveLimitCapability;
|
||||
}
|
||||
);
|
@ -1,95 +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.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
|
||||
], function (
|
||||
|
||||
) {
|
||||
|
||||
var RED = {
|
||||
sin: 0.9,
|
||||
cos: 0.9
|
||||
},
|
||||
YELLOW = {
|
||||
sin: 0.5,
|
||||
cos: 0.5
|
||||
},
|
||||
LIMITS = {
|
||||
rh: {
|
||||
cssClass: "s-limit-upr s-limit-red",
|
||||
low: RED,
|
||||
high: Number.POSITIVE_INFINITY,
|
||||
name: "Red High"
|
||||
},
|
||||
rl: {
|
||||
cssClass: "s-limit-lwr s-limit-red",
|
||||
high: -RED,
|
||||
low: Number.NEGATIVE_INFINITY,
|
||||
name: "Red Low"
|
||||
},
|
||||
yh: {
|
||||
cssClass: "s-limit-upr s-limit-yellow",
|
||||
low: YELLOW,
|
||||
high: RED,
|
||||
name: "Yellow High"
|
||||
},
|
||||
yl: {
|
||||
cssClass: "s-limit-lwr s-limit-yellow",
|
||||
low: -RED,
|
||||
high: -YELLOW,
|
||||
name: "Yellow Low"
|
||||
}
|
||||
};
|
||||
|
||||
function SinewaveLimitProvider() {
|
||||
|
||||
}
|
||||
|
||||
SinewaveLimitProvider.prototype.supportsLimits = function (domainObject) {
|
||||
return domainObject.type === 'generator';
|
||||
};
|
||||
|
||||
SinewaveLimitProvider.prototype.getLimitEvaluator = function (domainObject) {
|
||||
return {
|
||||
evaluate: function (datum, valueMetadata) {
|
||||
var range = valueMetadata && valueMetadata.key;
|
||||
|
||||
if (datum[range] > RED[range]) {
|
||||
return LIMITS.rh;
|
||||
}
|
||||
if (datum[range] < -RED[range]) {
|
||||
return LIMITS.rl;
|
||||
}
|
||||
if (datum[range] > YELLOW[range]) {
|
||||
return LIMITS.yh;
|
||||
}
|
||||
if (datum[range] < -YELLOW[range]) {
|
||||
return LIMITS.yl;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
return SinewaveLimitProvider;
|
||||
});
|
@ -1,82 +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 (
|
||||
|
||||
) {
|
||||
|
||||
function StateGeneratorProvider() {
|
||||
|
||||
}
|
||||
|
||||
function pointForTimestamp(timestamp, duration, name) {
|
||||
return {
|
||||
name: name,
|
||||
utc: Math.floor(timestamp / duration) * duration,
|
||||
value: Math.floor(timestamp / duration) % 2
|
||||
};
|
||||
}
|
||||
|
||||
StateGeneratorProvider.prototype.supportsSubscribe = function (domainObject) {
|
||||
return domainObject.type === 'example.state-generator';
|
||||
};
|
||||
|
||||
StateGeneratorProvider.prototype.subscribe = function (domainObject, callback) {
|
||||
var duration = domainObject.telemetry.duration * 1000;
|
||||
|
||||
var interval = setInterval(function () {
|
||||
var now = Date.now();
|
||||
var datum = pointForTimestamp(now, duration, domainObject.name);
|
||||
datum.value += "";
|
||||
callback(datum);
|
||||
}, duration);
|
||||
|
||||
return function () {
|
||||
clearInterval(interval);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) {
|
||||
return domainObject.type === 'example.state-generator';
|
||||
};
|
||||
|
||||
StateGeneratorProvider.prototype.request = function (domainObject, options) {
|
||||
var start = options.start;
|
||||
var end = options.end;
|
||||
var duration = domainObject.telemetry.duration * 1000;
|
||||
if (options.strategy === 'latest' || options.size === 1) {
|
||||
start = end;
|
||||
}
|
||||
var data = [];
|
||||
while (start <= end && data.length < 5000) {
|
||||
data.push(pointForTimestamp(start, duration, domainObject.name));
|
||||
start += duration;
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
};
|
||||
|
||||
return StateGeneratorProvider;
|
||||
|
||||
});
|
@ -44,7 +44,9 @@ define([
|
||||
message = message.data;
|
||||
var callback = this.callbacks[message.id];
|
||||
if (callback) {
|
||||
callback(message);
|
||||
if (callback(message)) {
|
||||
delete this.callbacks[message.id];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -70,7 +72,6 @@ define([
|
||||
deferred.resolve = resolve;
|
||||
deferred.reject = reject;
|
||||
});
|
||||
var messageId;
|
||||
|
||||
function callback(message) {
|
||||
if (message.error) {
|
||||
@ -78,27 +79,33 @@ define([
|
||||
} else {
|
||||
deferred.resolve(message.data);
|
||||
}
|
||||
delete this.callbacks[messageId];
|
||||
return true;
|
||||
}
|
||||
|
||||
messageId = this.dispatch('request', request, callback.bind(this));
|
||||
this.dispatch('request', request, callback);
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
WorkerInterface.prototype.subscribe = function (request, cb) {
|
||||
function callback(message) {
|
||||
var isCancelled = false;
|
||||
|
||||
var callback = function (message) {
|
||||
if (isCancelled) {
|
||||
return true;
|
||||
}
|
||||
cb(message.data);
|
||||
};
|
||||
|
||||
var messageId = this.dispatch('subscribe', request, callback);
|
||||
var messageId = this.dispatch('subscribe', request, callback)
|
||||
|
||||
return function () {
|
||||
isCancelled = true;
|
||||
this.dispatch('unsubscribe', {
|
||||
id: messageId
|
||||
});
|
||||
delete this.callbacks[messageId];
|
||||
}.bind(this);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,11 +62,10 @@
|
||||
self.postMessage({
|
||||
id: message.id,
|
||||
data: {
|
||||
name: data.name,
|
||||
utc: nextStep,
|
||||
yesterday: nextStep - 60*60*24*1000,
|
||||
sin: sin(nextStep, data.period, data.amplitude, data.offset, data.phase),
|
||||
cos: cos(nextStep, data.period, data.amplitude, data.offset, data.phase)
|
||||
sin: sin(nextStep, data.period, data.amplitude, data.offset),
|
||||
cos: cos(nextStep, data.period, data.amplitude, data.offset)
|
||||
}
|
||||
});
|
||||
nextStep += step;
|
||||
@ -83,22 +82,21 @@
|
||||
}
|
||||
|
||||
function onRequest(message) {
|
||||
var request = message.data;
|
||||
if (request.end == undefined) {
|
||||
request.end = Date.now();
|
||||
var data = message.data;
|
||||
if (data.end == undefined) {
|
||||
data.end = Date.now();
|
||||
}
|
||||
if (request.start == undefined){
|
||||
request.start = request.end - FIFTEEN_MINUTES;
|
||||
if (data.start == undefined){
|
||||
data.start = data.end - FIFTEEN_MINUTES;
|
||||
}
|
||||
|
||||
var now = Date.now();
|
||||
var start = request.start;
|
||||
var end = request.end > now ? now : request.end;
|
||||
var amplitude = request.amplitude;
|
||||
var period = request.period;
|
||||
var offset = request.offset;
|
||||
var dataRateInHz = request.dataRateInHz;
|
||||
var phase = request.phase;
|
||||
var start = data.start;
|
||||
var end = data.end > now ? now : data.end;
|
||||
var amplitude = data.amplitude;
|
||||
var period = data.period;
|
||||
var offset = data.offset;
|
||||
var dataRateInHz = data.dataRateInHz;
|
||||
|
||||
var step = 1000 / dataRateInHz;
|
||||
var nextStep = start - (start % step) + step;
|
||||
@ -107,11 +105,10 @@
|
||||
|
||||
for (; nextStep < end && data.length < 5000; nextStep += step) {
|
||||
data.push({
|
||||
name: request.name,
|
||||
utc: nextStep,
|
||||
yesterday: nextStep - 60*60*24*1000,
|
||||
sin: sin(nextStep, period, amplitude, offset, phase),
|
||||
cos: cos(nextStep, period, amplitude, offset, phase)
|
||||
sin: sin(nextStep, period, amplitude, offset),
|
||||
cos: cos(nextStep, period, amplitude, offset)
|
||||
});
|
||||
}
|
||||
self.postMessage({
|
||||
@ -120,14 +117,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
function cos(timestamp, period, amplitude, offset, phase) {
|
||||
function cos(timestamp, period, amplitude, offset) {
|
||||
return amplitude *
|
||||
Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + offset;
|
||||
Math.cos(timestamp / period / 1000 * Math.PI * 2) + offset;
|
||||
}
|
||||
|
||||
function sin(timestamp, period, amplitude, offset, phase) {
|
||||
function sin(timestamp, period, amplitude, offset) {
|
||||
return amplitude *
|
||||
Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + offset;
|
||||
Math.sin(timestamp / period / 1000 * Math.PI * 2) + offset;
|
||||
}
|
||||
|
||||
function sendError(error, message) {
|
||||
|
@ -23,46 +23,29 @@
|
||||
|
||||
define([
|
||||
"./GeneratorProvider",
|
||||
"./SinewaveLimitProvider",
|
||||
"./StateGeneratorProvider",
|
||||
"./GeneratorMetadataProvider"
|
||||
"./SinewaveLimitCapability"
|
||||
], function (
|
||||
GeneratorProvider,
|
||||
SinewaveLimitProvider,
|
||||
StateGeneratorProvider,
|
||||
GeneratorMetadataProvider
|
||||
SinewaveLimitCapability
|
||||
) {
|
||||
|
||||
return function(openmct){
|
||||
|
||||
openmct.types.addType("example.state-generator", {
|
||||
name: "State Generator",
|
||||
description: "For development use. Generates test enumerated telemetry by cycling through a given set of states",
|
||||
cssClass: "icon-telemetry",
|
||||
creatable: true,
|
||||
form: [
|
||||
{
|
||||
name: "State Duration (seconds)",
|
||||
control: "textfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "duration",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"duration"
|
||||
],
|
||||
pattern: "^\\d*(\\.\\d*)?$"
|
||||
}
|
||||
],
|
||||
initialize: function (object) {
|
||||
object.telemetry = {
|
||||
duration: 5
|
||||
}
|
||||
var legacyExtensions = {
|
||||
"capabilities": [
|
||||
{
|
||||
"key": "limit",
|
||||
"implementation": SinewaveLimitCapability
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return function(openmct){
|
||||
//Register legacy extensions for things not yet supported by the new API
|
||||
Object.keys(legacyExtensions).forEach(function (type){
|
||||
var extensionsOfType = legacyExtensions[type];
|
||||
extensionsOfType.forEach(function (extension) {
|
||||
openmct.legacyExtension(type, extension)
|
||||
})
|
||||
});
|
||||
|
||||
openmct.telemetry.addProvider(new StateGeneratorProvider());
|
||||
|
||||
openmct.types.addType("generator", {
|
||||
name: "Sine Wave Generator",
|
||||
description: "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
|
||||
@ -71,58 +54,51 @@ define([
|
||||
form: [
|
||||
{
|
||||
name: "Period",
|
||||
control: "numberfield",
|
||||
control: "textfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "period",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"period"
|
||||
]
|
||||
],
|
||||
pattern: "^\\d*(\\.\\d*)?$"
|
||||
},
|
||||
{
|
||||
name: "Amplitude",
|
||||
control: "numberfield",
|
||||
control: "textfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "amplitude",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"amplitude"
|
||||
]
|
||||
],
|
||||
pattern: "^\\d*(\\.\\d*)?$"
|
||||
},
|
||||
{
|
||||
name: "Offset",
|
||||
control: "numberfield",
|
||||
control: "textfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "offset",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"offset"
|
||||
]
|
||||
],
|
||||
pattern: "^\\d*(\\.\\d*)?$"
|
||||
},
|
||||
{
|
||||
name: "Data Rate (hz)",
|
||||
control: "numberfield",
|
||||
control: "textfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "dataRateInHz",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"dataRateInHz"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Phase (radians)",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "phase",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"phase"
|
||||
]
|
||||
],
|
||||
pattern: "^\\d*(\\.\\d*)?$"
|
||||
}
|
||||
],
|
||||
initialize: function (object) {
|
||||
@ -131,14 +107,42 @@ define([
|
||||
amplitude: 1,
|
||||
offset: 0,
|
||||
dataRateInHz: 1,
|
||||
phase: 0
|
||||
values: [
|
||||
{
|
||||
key: "utc",
|
||||
name: "Time",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "yesterday",
|
||||
name: "Yesterday",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "sin",
|
||||
name: "Sine",
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "cos",
|
||||
name: "Cosine",
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
openmct.telemetry.addProvider(new GeneratorProvider());
|
||||
openmct.telemetry.addProvider(new GeneratorMetadataProvider());
|
||||
openmct.telemetry.addProvider(new SinewaveLimitProvider());
|
||||
};
|
||||
|
||||
});
|
||||
|
@ -48,9 +48,8 @@ define([
|
||||
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18748.jpg"
|
||||
];
|
||||
|
||||
function pointForTimestamp(timestamp, name) {
|
||||
function pointForTimestamp(timestamp) {
|
||||
return {
|
||||
name: name,
|
||||
utc: Math.floor(timestamp / 5000) * 5000,
|
||||
url: IMAGE_SAMPLES[Math.floor(timestamp / 5000) % IMAGE_SAMPLES.length]
|
||||
};
|
||||
@ -62,7 +61,7 @@ define([
|
||||
},
|
||||
subscribe: function (domainObject, callback) {
|
||||
var interval = setInterval(function () {
|
||||
callback(pointForTimestamp(Date.now(), domainObject.name));
|
||||
callback(pointForTimestamp(Date.now()));
|
||||
}, 5000);
|
||||
|
||||
return function (interval) {
|
||||
@ -80,8 +79,8 @@ define([
|
||||
var start = options.start;
|
||||
var end = options.end;
|
||||
var data = [];
|
||||
while (start <= end && data.length < 5000) {
|
||||
data.push(pointForTimestamp(start, domainObject.name));
|
||||
while (start < end && data.length < 5000) {
|
||||
data.push(pointForTimestamp(start));
|
||||
start += 5000;
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
@ -94,7 +93,7 @@ define([
|
||||
options.strategy === 'latest';
|
||||
},
|
||||
request: function (domainObject, options) {
|
||||
return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]);
|
||||
return Promise.resolve([pointForTimestamp(Date.now())]);
|
||||
}
|
||||
};
|
||||
|
||||
@ -110,10 +109,6 @@ define([
|
||||
initialize: function (object) {
|
||||
object.telemetry = {
|
||||
values: [
|
||||
{
|
||||
name: 'Name',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
name: 'Time',
|
||||
key: 'utc',
|
||||
|
146
example/plotOptions/bundle.js
Normal file
146
example/plotOptions/bundle.js
Normal file
@ -0,0 +1,146 @@
|
||||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'legacyRegistry',
|
||||
'../../platform/commonUI/browse/src/InspectorRegion',
|
||||
'../../platform/commonUI/regions/src/Region'
|
||||
], function (
|
||||
legacyRegistry,
|
||||
InspectorRegion,
|
||||
Region
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Add a 'plot options' region part to the inspector region for the
|
||||
* Telemetry Plot type only. {@link InspectorRegion} is a default region
|
||||
* implementation that is added automatically to all types. In order to
|
||||
* customize what appears in the inspector region, you can start from a
|
||||
* blank slate by using Region, or customize the default inspector
|
||||
* region by using {@link InspectorRegion}.
|
||||
*/
|
||||
var plotInspector = new InspectorRegion(),
|
||||
/**
|
||||
* Two region parts are defined here. One that appears only in browse
|
||||
* mode, and one that appears only in edit mode. For not they both point
|
||||
* to the same representation, but a different key could be used here to
|
||||
* include a customized representation for edit mode.
|
||||
*/
|
||||
plotOptionsBrowseRegion = new Region({
|
||||
name: "plot-options",
|
||||
title: "Plot Options",
|
||||
modes: ['browse'],
|
||||
content: {
|
||||
key: "plot-options-browse"
|
||||
}
|
||||
}),
|
||||
plotOptionsEditRegion = new Region({
|
||||
name: "plot-options",
|
||||
title: "Plot Options",
|
||||
modes: ['edit'],
|
||||
content: {
|
||||
key: "plot-options-browse"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Both parts are added, and policies of type 'region' will determine
|
||||
* which is shown based on domain object state. A default policy is
|
||||
* provided which will check the 'modes' attribute of the region part
|
||||
* definition.
|
||||
*/
|
||||
plotInspector.addRegion(plotOptionsBrowseRegion);
|
||||
plotInspector.addRegion(plotOptionsEditRegion);
|
||||
|
||||
legacyRegistry.register("example/plotType", {
|
||||
"name": "Plot Type",
|
||||
"description": "Example illustrating registration of a new object type",
|
||||
"extensions": {
|
||||
"types": [
|
||||
{
|
||||
"key": "plot",
|
||||
"name": "Example Telemetry Plot",
|
||||
"cssClass": "icon-telemetry-panel",
|
||||
"description": "For development use. A plot for displaying telemetry.",
|
||||
"priority": 10,
|
||||
"delegates": [
|
||||
"telemetry"
|
||||
],
|
||||
"features": "creation",
|
||||
"contains": [
|
||||
{
|
||||
"has": "telemetry"
|
||||
}
|
||||
],
|
||||
"model": {
|
||||
"composition": []
|
||||
},
|
||||
"inspector": plotInspector,
|
||||
"telemetry": {
|
||||
"source": "generator",
|
||||
"domains": [
|
||||
{
|
||||
"key": "time",
|
||||
"name": "Time"
|
||||
},
|
||||
{
|
||||
"key": "yesterday",
|
||||
"name": "Yesterday"
|
||||
},
|
||||
{
|
||||
"key": "delta",
|
||||
"name": "Delta",
|
||||
"format": "example.delta"
|
||||
}
|
||||
],
|
||||
"ranges": [
|
||||
{
|
||||
"key": "sin",
|
||||
"name": "Sine"
|
||||
},
|
||||
{
|
||||
"key": "cos",
|
||||
"name": "Cosine"
|
||||
}
|
||||
]
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"name": "Period",
|
||||
"control": "textfield",
|
||||
"cssClass": "l-input-sm l-numeric",
|
||||
"key": "period",
|
||||
"required": true,
|
||||
"property": [
|
||||
"telemetry",
|
||||
"period"
|
||||
],
|
||||
"pattern": "^\\d*(\\.\\d*)?$"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
@ -58,7 +58,11 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.w-mct-example > div { margin-bottom: $interiorMarginLg; }
|
||||
.w-mct-example {
|
||||
div {
|
||||
margin-bottom: $interiorMarginLg;
|
||||
}
|
||||
}
|
||||
|
||||
code,
|
||||
pre {
|
||||
@ -101,11 +105,11 @@
|
||||
padding-top: 1em;
|
||||
|
||||
.cols {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@include display(flex);
|
||||
@include flex-direction(row);
|
||||
|
||||
.col {
|
||||
flex: 1 1 auto;
|
||||
@include flex(1 1 auto);
|
||||
&:not(:last-child) {
|
||||
$v: $interiorMargin * 4;
|
||||
border-right: 1px solid $colorInteriorBorder;
|
||||
@ -199,7 +203,7 @@
|
||||
border-radius: 15%;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
@include transform(translateX(-50%));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,21 +149,12 @@
|
||||
<h2>Local Controls</h2>
|
||||
<div class="cols cols1-1">
|
||||
<div class="col">
|
||||
<p>Local controls are typically buttons and selects that provide actions in close proximity to a component.</p>
|
||||
<p>These controls can optionally be hidden to reduce clutter until the user hovers their cursor over an enclosing element. To use this approach, apply the class <code>.has-local-controls</code> to the element that should be aware of the hover and ensure that element encloses <code>.h-local-controls</code>.</p>
|
||||
<p>Local controls are typically buttons and selects that provide local control to an individual element. Typically, these controls are hidden in order to not block data display until the user hovers their cursor over an element, when the controls are displayed using a transition fade. Mousing out of the element fades the controls from view.</p>
|
||||
</div>
|
||||
<mct-example><div class="plot-display-area" style="padding: 10px; position: relative;">
|
||||
Some content in here
|
||||
<div class="h-local-controls h-local-controls-overlay-content l-btn-set">
|
||||
<mct-example><div class="plot-display-area" style="height: 100px; padding: 10px; position: relative;">Hover over me
|
||||
<div class="l-local-controls gl-plot-local-controls t-plot-display-controls">
|
||||
<a class="s-button icon-arrow-left" title="Restore previous pan/zoom"></a>
|
||||
<a class="s-button icon-reset" title="Reset pan/zoom"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plot-display-area has-local-controls" style="padding: 10px; position: relative;">
|
||||
Hover here
|
||||
<div class="h-local-controls h-local-controls-overlay-content local-controls-hidden l-btn-set">
|
||||
<a class="s-button icon-arrow-left" title="Restore previous pan/zoom"></a>
|
||||
<a class="s-button icon-reset" title="Reset pan/zoom"></a>
|
||||
<a class="s-button icon-arrows-out" title="Reset pan/zoom"></a>
|
||||
</div>
|
||||
</div></mct-example>
|
||||
</div>
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
/*global require,__dirname*/
|
||||
|
||||
require("v8-compile-cache");
|
||||
|
||||
var gulp = require('gulp'),
|
||||
sourcemaps = require('gulp-sourcemaps'),
|
||||
path = require('path'),
|
||||
@ -179,4 +177,4 @@ gulp.task('install', [ 'assets', 'scripts' ]);
|
||||
|
||||
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
|
||||
|
||||
gulp.task('build', [ 'verify', 'install' ]);
|
||||
gulp.task('build', [ 'verify', 'install' ]);
|
||||
|
124
index.html
124
index.html
@ -21,71 +21,65 @@
|
||||
-->
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title></title>
|
||||
<script src="bower_components/requirejs/require.js"> </script>
|
||||
<script>
|
||||
var THIRTY_MINUTES = 30 * 60 * 1000;
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title></title>
|
||||
<script src="bower_components/requirejs/require.js"> </script>
|
||||
<script>
|
||||
var THIRTY_MINUTES = 30 * 60 * 1000;
|
||||
|
||||
require(['openmct', './src/plugins/telemetryTable/plugin'], function (openmct, TelemetryTablePlugin) {
|
||||
[
|
||||
'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.Espresso());
|
||||
openmct.install(openmct.plugins.Generator());
|
||||
openmct.install(openmct.plugins.ExampleImagery());
|
||||
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||
openmct.install(openmct.plugins.ImportExport());
|
||||
openmct.install(openmct.plugins.AutoflowView({
|
||||
type: "telemetry.panel"
|
||||
}));
|
||||
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
|
||||
}
|
||||
require(['openmct'], function (openmct) {
|
||||
[
|
||||
'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.Espresso());
|
||||
openmct.install(openmct.plugins.Generator());
|
||||
openmct.install(openmct.plugins.ExampleImagery());
|
||||
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||
openmct.install(openmct.plugins.ImportExport());
|
||||
openmct.install(openmct.plugins.Conductor({
|
||||
menuOptions: [
|
||||
{
|
||||
name: "Fixed",
|
||||
timeSystem: 'utc',
|
||||
bounds: {
|
||||
start: Date.now() - THIRTY_MINUTES,
|
||||
end: Date.now()
|
||||
}
|
||||
]
|
||||
}));
|
||||
openmct.install(openmct.plugins.SummaryWidget());
|
||||
openmct.install(openmct.plugins.Notebook());
|
||||
openmct.install(TelemetryTablePlugin());
|
||||
openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0});
|
||||
openmct.time.timeSystem('utc');
|
||||
openmct.start();
|
||||
});
|
||||
</script>
|
||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
|
||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/openmct.css">
|
||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="shortcut icon" href="platform/commonUI/general/res/images/favicons/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<div class="l-splash-holder s-splash-holder">
|
||||
<div class="l-splash s-splash"></div>
|
||||
</div>
|
||||
</body>
|
||||
},
|
||||
{
|
||||
name: "Realtime",
|
||||
timeSystem: 'utc',
|
||||
clock: 'local',
|
||||
clockOffsets: {
|
||||
start: -25 * 60 * 1000,
|
||||
end: 5 * 60 * 1000
|
||||
}
|
||||
}
|
||||
]
|
||||
}));
|
||||
openmct.install(openmct.plugins.SummaryWidget());
|
||||
openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0});
|
||||
openmct.time.timeSystem('utc');
|
||||
openmct.start();
|
||||
});
|
||||
</script>
|
||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
|
||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/openmct.css">
|
||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="shortcut icon" href="platform/commonUI/general/res/images/favicons/favicon.ico">
|
||||
</head>
|
||||
<body class="user-environ">
|
||||
<div class="l-splash-holder s-splash-holder">
|
||||
<div class="l-splash s-splash"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -36,17 +36,14 @@ module.exports = function(config) {
|
||||
files: [
|
||||
{pattern: 'bower_components/**/*.js', included: false},
|
||||
{pattern: 'node_modules/d3-*/**/*.js', included: false},
|
||||
{pattern: 'node_modules/vue/**/*.js', included: false},
|
||||
{pattern: 'node_modules/printj/dist/*.js', included: false},
|
||||
{pattern: 'src/**/*', included: false},
|
||||
{pattern: 'node_modules/painterro/build/*.js', included: false},
|
||||
{pattern: 'node_modules/html2canvas/dist/*', included: false},
|
||||
{pattern: 'src/**/*.js', included: false},
|
||||
{pattern: 'example/**/*.html', included: false},
|
||||
{pattern: 'example/**/*.js', included: false},
|
||||
{pattern: 'example/**/*.json', included: false},
|
||||
{pattern: 'platform/**/*.js', included: false},
|
||||
{pattern: 'warp/**/*.js', included: false},
|
||||
{pattern: 'platform/**/*.html', included: false},
|
||||
{pattern: 'src/**/*.html', included: false},
|
||||
'test-main.js'
|
||||
],
|
||||
|
||||
@ -65,7 +62,7 @@ module.exports = function(config) {
|
||||
// Test results reporter to use
|
||||
// Possible values: 'dots', 'progress'
|
||||
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress', 'coverage', 'html'],
|
||||
reporters: ['progress', 'coverage', 'html', 'junit'],
|
||||
|
||||
// Web server port.
|
||||
port: 9876,
|
||||
@ -81,7 +78,7 @@ module.exports = function(config) {
|
||||
// Specify browsers to run tests in.
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: [
|
||||
'ChromeHeadless'
|
||||
'Chrome'
|
||||
],
|
||||
|
||||
// Code coverage reporting.
|
||||
@ -91,8 +88,7 @@ module.exports = function(config) {
|
||||
"dist/reports/coverage",
|
||||
check: {
|
||||
global: {
|
||||
lines: 80,
|
||||
excludes: ['src/plugins/plot/**/*.js']
|
||||
lines: 80
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -104,6 +100,10 @@ module.exports = function(config) {
|
||||
foldAll: false
|
||||
},
|
||||
|
||||
junitReporter: {
|
||||
outputDir: process.env.CIRCLE_TEST_REPORTS || 'dist/reports/junit'
|
||||
},
|
||||
|
||||
// Continuous Integration mode.
|
||||
// If true, Karma captures browsers, runs the tests and exits.
|
||||
singleRun: true
|
||||
|
68
notes.md
68
notes.md
@ -1,68 +0,0 @@
|
||||
* Delete old table
|
||||
* Update new table type and test backward compatibility.
|
||||
* re-evaluate TableConfiguration object. Name doesn't make sense right now, and some duplicated code for configuration handling in components.
|
||||
* Rebase over refactor branch
|
||||
* Move css to new table location
|
||||
* Test (see list of issues below)
|
||||
* Push WIP PR
|
||||
|
||||
* [X] Remove column sizing rows on object removal (should be trivial since tracking by object ID already).
|
||||
* [X] Look at optimizing styles in telemetry-table-row
|
||||
- Right now profiling does not highlight this as a bottleneck?
|
||||
* [X] Add title to table cells
|
||||
* [X] Add elipses for overflow on table cells
|
||||
* [X] On entry, filter boxes need to remove magnifying glass.
|
||||
* [X] auto-scroll
|
||||
* [X] Show / hide columns (ie. table configuration)
|
||||
* [X] Why aren't limits being applied until I scroll or do something?
|
||||
* [X] Handle window resizing
|
||||
* [X] Fix memory leaks
|
||||
* [X] Remove isFromObject and hasColumn from TelemetryTableRow
|
||||
* [X] Remove format caching
|
||||
* [X] Add filtering
|
||||
* If the new filter string starts with the old filter string, filter based on the list of previously filtered results, not the base list.
|
||||
* Add the clear filter button
|
||||
* [X] Cache formatted values for "just in time" formatting. I think cache on row. Opportunity to cache on column to benefit from multiple rows with the same value, but memory management becomes a problem then as cache could grow infinitely if the table is left to run.
|
||||
* [X] Do some more testing with multiple objects. Not working properly right now.
|
||||
* [X] Rows not being removed when object removed from composition
|
||||
* [X] Subscribe to realtime data
|
||||
* [X] Column widths should be done on receipt of FIRST DATA, not on receipt of historical data.
|
||||
* [X] Filter subscription data
|
||||
* [X] Export
|
||||
* [X] Add loading spinner
|
||||
* [X] in 'mounted', should not be necessary to bind to 'this'.
|
||||
* [X] Stop Vue from decorating EVERYTHING (but especially the telemetry collection)
|
||||
* [X] Need minimum width on tables. Provided by calcTableWidthPx in MCTTableController
|
||||
* [X] Limits
|
||||
|
||||
* Benchmark - loading 1 million rows
|
||||
- Old tables: ~90s
|
||||
- New tables: ~11s
|
||||
* 1 million rows in 11 secs vs 90s
|
||||
|
||||
To Test
|
||||
* Multiple instances of tables
|
||||
* Make sure time columns are being correctly merged
|
||||
* Test with MSL data sources
|
||||
* Test with tutorial data sources
|
||||
* Behavior at different widths.
|
||||
* Short tables
|
||||
* Test with bounds / clock / time system changes.
|
||||
* Memory leaks
|
||||
|
||||
Post WIP PR
|
||||
* Fix jitter on auto-scroll
|
||||
* Look at scroll-x again. Sounded like there might be some subtlety missing there (something to do with small columns?).
|
||||
* Split TelemetryTableComponent into more components. It's too large now.
|
||||
* Performance
|
||||
* Don't wrap row on load, do it on scroll.
|
||||
* On batch insert, check bounds once, rather than on each insert.
|
||||
* See if sticky headers can be simplified (eg. can we combine headers table with content table?)
|
||||
* Default sort behavior, and sticking to the bottom for realtime numerical
|
||||
* Look at setting top on tbody, instead of each tr
|
||||
* Replace all "mct-table" classes
|
||||
* Consider making the sizing row a separate component. Encapsulate all sizing logic in there.
|
||||
* consider making the header table a separate component.
|
||||
* Test where no time column present (what will it sort by)
|
||||
|
||||
* [X] Optimization - don't both sorting filtered rows initially, just copy over values from bounded row collection which have already been sorted.
|
22
openmct.js
22
openmct.js
@ -29,6 +29,7 @@ requirejs.config({
|
||||
"csv": "bower_components/comma-separated-values/csv.min",
|
||||
"EventEmitter": "bower_components/eventemitter3/index",
|
||||
"es6-promise": "bower_components/es6-promise/es6-promise.min",
|
||||
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
|
||||
"moment": "bower_components/moment/moment",
|
||||
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
|
||||
"moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data",
|
||||
@ -36,10 +37,9 @@ requirejs.config({
|
||||
"screenfull": "bower_components/screenfull/dist/screenfull.min",
|
||||
"text": "bower_components/text/text",
|
||||
"uuid": "bower_components/node-uuid/uuid",
|
||||
"vue": "node_modules/vue/dist/vue.min",
|
||||
"zepto": "bower_components/zepto/zepto.min",
|
||||
"lodash": "bower_components/lodash/lodash",
|
||||
"d3-selection": "node_modules/d3-selection/dist/d3-selection.min",
|
||||
"d3-selection": "node_modules/d3-selection/build/d3-selection.min",
|
||||
"d3-scale": "node_modules/d3-scale/build/d3-scale.min",
|
||||
"d3-axis": "node_modules/d3-axis/build/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/build/d3-array.min",
|
||||
@ -48,10 +48,7 @@ requirejs.config({
|
||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||
"html2canvas": "node_modules/html2canvas/dist/html2canvas.min",
|
||||
"painterro": "node_modules/painterro/build/painterro.min",
|
||||
"printj": "node_modules/printj/dist/printj.min"
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min"
|
||||
},
|
||||
"shim": {
|
||||
"angular": {
|
||||
@ -63,15 +60,12 @@ requirejs.config({
|
||||
"EventEmitter": {
|
||||
"exports": "EventEmitter"
|
||||
},
|
||||
"html2canvas": {
|
||||
"exports": "html2canvas"
|
||||
},
|
||||
"moment-duration-format": {
|
||||
"deps": ["moment"]
|
||||
},
|
||||
"painterro": {
|
||||
"exports": "Painterro"
|
||||
},
|
||||
"saveAs": {
|
||||
"exports": "saveAs"
|
||||
},
|
||||
"screenfull": {
|
||||
"exports": "screenfull"
|
||||
},
|
||||
@ -90,9 +84,6 @@ requirejs.config({
|
||||
},
|
||||
"d3-axis": {
|
||||
"exports": "d3-axis"
|
||||
},
|
||||
"dom-to-image": {
|
||||
"exports": "domtoimage"
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -106,7 +97,6 @@ define([
|
||||
var openmct = new MCT();
|
||||
|
||||
openmct.legacyRegistry = defaultRegistry;
|
||||
openmct.install(openmct.plugins.Plot());
|
||||
|
||||
if (typeof BUILD_CONSTANTS !== 'undefined') {
|
||||
openmct.install(buildInfo(BUILD_CONSTANTS));
|
||||
|
50
package.json
50
package.json
@ -1,23 +1,21 @@
|
||||
{
|
||||
"name": "openmct",
|
||||
"version": "0.14.0-SNAPSHOT",
|
||||
"version": "0.12.1-SNAPSHOT",
|
||||
"description": "The Open MCT core platform",
|
||||
"dependencies": {
|
||||
"d3-array": "1.2.x",
|
||||
"d3-axis": "1.0.x",
|
||||
"d3-collection": "1.0.x",
|
||||
"d3-color": "1.0.x",
|
||||
"d3-format": "1.2.x",
|
||||
"d3-interpolate": "1.1.x",
|
||||
"d3-scale": "1.0.x",
|
||||
"d3-selection": "1.3.x",
|
||||
"d3-time": "1.0.x",
|
||||
"d3-time-format": "2.1.x",
|
||||
"d3-array": "^1.0.2",
|
||||
"d3-axis": "^1.0.4",
|
||||
"d3-collection": "^1.0.2",
|
||||
"d3-color": "^1.0.2",
|
||||
"d3-format": "^1.0.2",
|
||||
"d3-interpolate": "^1.1.3",
|
||||
"d3-scale": "^1.0.4",
|
||||
"d3-selection": "^1.0.3",
|
||||
"d3-time": "^1.0.4",
|
||||
"d3-time-format": "^2.0.3",
|
||||
"express": "^4.13.1",
|
||||
"minimist": "^1.1.1",
|
||||
"painterro": "^0.2.65",
|
||||
"request": "^2.69.0",
|
||||
"vue": "^2.5.6"
|
||||
"request": "^2.69.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bower": "^1.7.7",
|
||||
@ -29,20 +27,20 @@
|
||||
"gulp-jshint-html-reporter": "^0.1.3",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-requirejs-optimize": "^0.3.1",
|
||||
"gulp-sass": "^3.1.0",
|
||||
"gulp-sass": "^2.2.0",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"html2canvas": "^1.0.0-alpha.12",
|
||||
"jasmine-core": "^3.1.0",
|
||||
"jasmine-core": "^2.3.0",
|
||||
"jscs-html-reporter": "^0.1.0",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.7.0",
|
||||
"karma": "^2.0.3",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-coverage": "^1.1.2",
|
||||
"karma": "^0.13.3",
|
||||
"karma-chrome-launcher": "^0.1.12",
|
||||
"karma-cli": "0.0.4",
|
||||
"karma-coverage": "^0.5.3",
|
||||
"karma-html-reporter": "^0.2.7",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-requirejs": "^1.1.0",
|
||||
"karma-jasmine": "^0.1.5",
|
||||
"karma-junit-reporter": "^0.3.8",
|
||||
"karma-requirejs": "^0.2.2",
|
||||
"lodash": "^3.10.1",
|
||||
"markdown-toc": "^0.11.7",
|
||||
"marked": "^0.3.5",
|
||||
@ -50,10 +48,8 @@
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.11.1",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"printj": "^1.1.0",
|
||||
"requirejs": "2.1.x",
|
||||
"split": "^1.0.0",
|
||||
"v8-compile-cache": "^1.1.0"
|
||||
"split": "^1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
@ -63,7 +59,7 @@
|
||||
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
||||
"otherdoc": "node docs/gendocs.js --in docs/src --out dist/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
|
||||
"docs": "npm run jsdoc ; npm run otherdoc",
|
||||
"prepare": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
|
||||
"prepublish": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<div class="s-text l-content">
|
||||
<h1 class="l-title s-title">Open MCT</h1>
|
||||
<div class="l-description s-description">
|
||||
<p>Open MCT, Copyright © 2014-2018, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.</p>
|
||||
<p>Open MCT, Copyright © 2014-2017, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.</p>
|
||||
<p>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 <a target="_blank" href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.</p>
|
||||
<p>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.</p>
|
||||
<p>Open MCT includes source code licensed under additional open source licenses. See the Open Source Licenses file included with this distribution or <a ng-click="about.openLicenses()">click here for licensing information</a>.</p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -113,8 +113,7 @@ define([
|
||||
"agentService",
|
||||
"$window",
|
||||
"$location",
|
||||
"$attrs",
|
||||
"navigationService"
|
||||
"$attrs"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -57,12 +57,7 @@
|
||||
</div>
|
||||
<mct-representation key="representation.selected.key"
|
||||
mct-object="representation.selected.key && domainObject"
|
||||
class="abs flex-elem grows object-holder-main scroll"
|
||||
mct-selectable="{
|
||||
item: domainObject.useCapability('adapter'),
|
||||
oldItem: domainObject
|
||||
}"
|
||||
mct-init-select>
|
||||
class="abs flex-elem grows object-holder-main scroll">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
<div class='split-pane-component t-object pane primary-pane left'>
|
||||
<mct-representation mct-object="navigatedObject"
|
||||
key="navigatedObject.getCapability('status').get('editing') ? 'edit-object' : 'browse-object'"
|
||||
class="abs holder holder-object t-main-view">
|
||||
class="abs holder holder-object">
|
||||
</mct-representation>
|
||||
<a class="mini-tab-icon anchor-right mobile-hide toggle-pane toggle-inspect flush-right"
|
||||
title="{{ modelPaneInspect.visible()? 'Hide' : 'Show' }} the Inspection pane"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -19,21 +19,12 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div ng-controller="InspectorController as controller">
|
||||
<div ng-controller="InspectorController">
|
||||
<div ng-repeat="region in regions">
|
||||
<mct-representation
|
||||
key="'object-properties'"
|
||||
mct-object="controller.selectedItem()"
|
||||
key="region.content.key"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel">
|
||||
</mct-representation>
|
||||
|
||||
<div ng-if="!controller.hasProviderView()">
|
||||
<mct-representation
|
||||
key="inspectorKey"
|
||||
mct-object="controller.selectedItem()"
|
||||
ng-model="ngModel">
|
||||
</mct-representation>
|
||||
</div>
|
||||
|
||||
<div class='inspector-provider-view'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -19,46 +19,43 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div ng-controller="ObjectInspectorController as controller" class="grid-properties">
|
||||
<ul class="l-inspector-part">
|
||||
<h2 class="first">Properties</h2>
|
||||
<li class="t-repeat grid-row"
|
||||
ng-repeat="data in metadata"
|
||||
ng-class="{ first:$index === 0 }">
|
||||
<div class="grid-cell label">{{ data.name }}</div>
|
||||
<div class="grid-cell value">{{ data.value }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="l-inspector-part" ng-if="contextutalParents.length > 0">
|
||||
<h2 title="The location of this linked object.">Location</h2>
|
||||
<li class="grid-row">
|
||||
<div class="label" ng-if="primaryParents.length > 0">This Link</div>
|
||||
<div class="grid-cell value">
|
||||
<div class="t-repeat inspector-location"
|
||||
ng-repeat="parent in contextutalParents"
|
||||
ng-class="{ last:($index + 1) === contextualParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-click="parent.getCapability('action').perform('navigate')"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</div>
|
||||
<div ng-controller="ObjectInspectorController as controller">
|
||||
<ul class="flex-elem grows l-inspector-part">
|
||||
<li>
|
||||
<em class="t-inspector-part-header">Properties</em>
|
||||
<div class="inspector-properties"
|
||||
ng-repeat="data in metadata"
|
||||
ng-class="{ first:$index === 0 }">
|
||||
<div class="label">{{ data.name }}</div>
|
||||
<div class="value">{{ data.value }}</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="grid-row" ng-if="primaryParents.length > 0">
|
||||
<div class="grid-cell label">Original</div>
|
||||
<div class="grid-cell value">
|
||||
<div class="t-repeat inspector-location value"
|
||||
ng-repeat="parent in primaryParents"
|
||||
ng-class="{ last:($index + 1) === primaryParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-click="parent.getCapability('action').perform('navigate')"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div>
|
||||
<li ng-if="contextutalParents.length > 0">
|
||||
<em class="t-inspector-part-header" title="The location of this linked object.">Location</em>
|
||||
<div ng-if="primaryParents.length > 0" class="section-header">This Object</div>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in contextutalParents"
|
||||
ng-class="{ last:($index + 1) === contextualParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = parent"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-if="primaryParents.length > 0">
|
||||
<div class="section-header">Object's Original</div>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in primaryParents"
|
||||
ng-class="{ last:($index + 1) === primaryParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = parent"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -47,8 +47,8 @@ define(
|
||||
urlService,
|
||||
defaultPath
|
||||
) {
|
||||
var initialPath = ($route.current.params.ids || defaultPath).split("/"),
|
||||
currentIds;
|
||||
var initialPath = ($route.current.params.ids || defaultPath).split("/");
|
||||
var currentIds;
|
||||
|
||||
$scope.treeModel = {
|
||||
selectedObject: undefined,
|
||||
@ -56,24 +56,7 @@ define(
|
||||
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;
|
||||
}
|
||||
return navigationService.shouldNavigate();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -24,14 +24,14 @@
|
||||
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) {
|
||||
function PaneController($scope, agentService, $window, $location, $attrs) {
|
||||
var self = this;
|
||||
this.agentService = agentService;
|
||||
var hideParameterPresent = $location.search().hasOwnProperty($attrs.hideParameter);
|
||||
@ -61,11 +61,6 @@ define(
|
||||
self.state = false;
|
||||
}
|
||||
};
|
||||
|
||||
if (navigationService && navigationService.addListener && !navigationListenerAdded) {
|
||||
navigationService.addListener(this.callback);
|
||||
navigationListenerAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -162,6 +162,7 @@ define(
|
||||
*/
|
||||
NavigationService.prototype.shouldWarnBeforeNavigate = function () {
|
||||
var reasons = [];
|
||||
|
||||
this.checks.forEach(function (checkFn) {
|
||||
var reason = checkFn();
|
||||
if (reason) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global console*/
|
||||
|
||||
/**
|
||||
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
||||
@ -49,19 +48,9 @@ define(
|
||||
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;
|
||||
});
|
||||
var calls = mockNavigationService.setNavigation.calls.length;
|
||||
waitsFor(function () {
|
||||
return mockNavigationService.setNavigation.calls.length > calls;
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,7 +78,7 @@ define(
|
||||
"urlService",
|
||||
["urlForLocation"]
|
||||
);
|
||||
mockUrlService.urlForLocation.and.callFake(function (mode, object) {
|
||||
mockUrlService.urlForLocation.andCallFake(function (mode, object) {
|
||||
if (object === mockDefaultRootObject) {
|
||||
return [mode, testDefaultRoot].join('/');
|
||||
}
|
||||
@ -117,7 +106,7 @@ define(
|
||||
"removeListener"
|
||||
].forEach(function (method) {
|
||||
spyOn(mockNavigationService, method)
|
||||
.and.callThrough();
|
||||
.andCallThrough();
|
||||
});
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"rootObjectContainer",
|
||||
@ -135,58 +124,60 @@ define(
|
||||
"nestedDomainObject",
|
||||
["getId", "getCapability", "getModel", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockObjectService.getObjects.and.returnValue(Promise.resolve({
|
||||
mockObjectService.getObjects.andReturn(Promise.resolve({
|
||||
ROOT: mockRootObject
|
||||
}));
|
||||
mockRootObject.useCapability.and.returnValue(Promise.resolve([
|
||||
mockRootObject.useCapability.andReturn(Promise.resolve([
|
||||
mockOtherDomainObject,
|
||||
mockDefaultRootObject
|
||||
]));
|
||||
mockRootObject.hasCapability.and.returnValue(true);
|
||||
mockDefaultRootObject.useCapability.and.returnValue(Promise.resolve([
|
||||
mockRootObject.hasCapability.andReturn(true);
|
||||
mockDefaultRootObject.useCapability.andReturn(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);
|
||||
mockDefaultRootObject.hasCapability.andReturn(true);
|
||||
mockOtherDomainObject.hasCapability.andReturn(false);
|
||||
mockNextObject.useCapability.andReturn(undefined);
|
||||
mockNextObject.hasCapability.andReturn(false);
|
||||
mockNextObject.getId.andReturn("next");
|
||||
mockDefaultRootObject.getId.andReturn(testDefaultRoot);
|
||||
|
||||
instantiateController();
|
||||
return waitsForNavigation();
|
||||
waitsForNavigation();
|
||||
});
|
||||
|
||||
it("uses composition to set the navigated object, if there is none", function () {
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
.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);
|
||||
.andReturn("something-other-than-the-" + testDefaultRoot);
|
||||
instantiateController();
|
||||
|
||||
return waitsForNavigation().then(function () {
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
//
|
||||
it("does not try to override navigation", function () {
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDefaultRootObject);
|
||||
mockNavigationService.getNavigation.andReturn(mockDefaultRootObject);
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
});
|
||||
waitsForNavigation();
|
||||
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](
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](
|
||||
mockOtherDomainObject
|
||||
);
|
||||
expect(mockScope.navigatedObject).toEqual(mockOtherDomainObject);
|
||||
@ -198,18 +189,19 @@ define(
|
||||
"$destroy",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
mockScope.$on.calls.mostRecent().args[1]();
|
||||
mockScope.$on.mostRecentCall.args[1]();
|
||||
|
||||
// Should remove the listener it added earlier
|
||||
expect(mockNavigationService.removeListener).toHaveBeenCalledWith(
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0]
|
||||
mockNavigationService.addListener.mostRecentCall.args[0]
|
||||
);
|
||||
});
|
||||
|
||||
it("uses route parameters to choose initially-navigated object", function () {
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/next";
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockNextObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockNextObject);
|
||||
@ -222,10 +214,12 @@ define(
|
||||
// it hits an invalid ID.
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/junk";
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -235,7 +229,8 @@ define(
|
||||
// should stop at it since remaining IDs cannot be loaded.
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/next/junk";
|
||||
instantiateController();
|
||||
return waitsForNavigation().then(function () {
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockNextObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockNextObject);
|
||||
@ -249,11 +244,11 @@ define(
|
||||
expect(mockRoute.current.pathParams.ids)
|
||||
.not
|
||||
.toBe(testDefaultRoot + '/next');
|
||||
mockLocation.path.and.callFake(function () {
|
||||
mockLocation.path.andCallFake(function () {
|
||||
expect(mockRoute.current.pathParams.ids)
|
||||
.toBe(testDefaultRoot + '/next');
|
||||
});
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](
|
||||
mockNextObject
|
||||
);
|
||||
expect(mockLocation.path).toHaveBeenCalledWith(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -20,6 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/BrowseObjectController"],
|
||||
function (BrowseObjectController) {
|
||||
@ -32,7 +33,7 @@ define(
|
||||
|
||||
// Utility function; look for a $watch on scope and fire it
|
||||
function fireWatch(expr, value) {
|
||||
mockScope.$watch.calls.all().forEach(function (call) {
|
||||
mockScope.$watch.calls.forEach(function (call) {
|
||||
if (call.args[0] === expr) {
|
||||
call.args[1](value);
|
||||
}
|
||||
@ -49,7 +50,7 @@ define(
|
||||
"$location",
|
||||
["path", "search"]
|
||||
);
|
||||
mockLocation.search.and.returnValue({});
|
||||
mockLocation.search.andReturn({});
|
||||
|
||||
controller = new BrowseObjectController(
|
||||
mockScope,
|
||||
@ -64,7 +65,7 @@ define(
|
||||
|
||||
// Allows the path index to be checked
|
||||
// prior to setting $route.current
|
||||
mockLocation.path.and.returnValue("/browse/");
|
||||
mockLocation.path.andReturn("/browse/");
|
||||
});
|
||||
|
||||
it("sets the active view from query parameters", function () {
|
||||
@ -78,10 +79,10 @@ define(
|
||||
{ key: 'xyz' }
|
||||
];
|
||||
|
||||
mockDomainObject.useCapability.and.callFake(function (c) {
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
return (c === 'view') && testViews;
|
||||
});
|
||||
mockLocation.search.and.returnValue({ view: 'def' });
|
||||
mockLocation.search.andReturn({ view: 'def' });
|
||||
|
||||
fireWatch('domainObject', mockDomainObject);
|
||||
expect(mockScope.representation.selected)
|
||||
|
@ -50,14 +50,14 @@ define(
|
||||
"navigationService",
|
||||
["getNavigation", "addListener"]
|
||||
);
|
||||
mockNavigationService.addListener.and.returnValue(mockNavigationUnlistener);
|
||||
mockNavigationService.addListener.andReturn(mockNavigationUnlistener);
|
||||
|
||||
mockStatusUnlistener = jasmine.createSpy("statusUnlistener");
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"statusCapability",
|
||||
["listen"]
|
||||
);
|
||||
mockStatusCapability.listen.and.returnValue(mockStatusUnlistener);
|
||||
mockStatusCapability.listen.andReturn(mockStatusUnlistener);
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
@ -68,13 +68,13 @@ define(
|
||||
'hasCapability'
|
||||
]
|
||||
);
|
||||
mockDomainObject.getId.and.returnValue("domainObject");
|
||||
mockDomainObject.getModel.and.returnValue({});
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.getCapability.and.returnValue(mockStatusCapability);
|
||||
mockDomainObject.getId.andReturn("domainObject");
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(mockStatusCapability);
|
||||
|
||||
mockLocation = jasmine.createSpyObj('location', ['search']);
|
||||
mockLocation.search.and.returnValue({});
|
||||
mockLocation.search.andReturn({});
|
||||
|
||||
mockAttrs = {};
|
||||
|
||||
@ -84,7 +84,7 @@ define(
|
||||
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);
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](mockDomainObject);
|
||||
expect(mockStatusCapability.listen).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
@ -93,8 +93,8 @@ define(
|
||||
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"]);
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](mockDomainObject);
|
||||
mockStatusCapability.listen.mostRecentCall.args[0](["editing"]);
|
||||
expect(controller.visible()).toBe(true);
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -60,8 +60,8 @@ define(
|
||||
mockActionContext.domainObject = mockDomainObject;
|
||||
mockActionContext.event = mockEvent;
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
mockDomainObject.getCapability.and.returnValue(mockContextMenuAction);
|
||||
mockContextMenuAction.perform.and.returnValue(jasmine.any(Function));
|
||||
mockDomainObject.getCapability.andReturn(mockContextMenuAction);
|
||||
mockContextMenuAction.perform.andReturn(jasmine.any(Function));
|
||||
|
||||
controller = new MenuArrowController(mockScope);
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -39,7 +39,7 @@ define(
|
||||
mockMutationCapability = jasmine.createSpyObj("mutation", ["mutate"]);
|
||||
mockTypeCapability = jasmine.createSpyObj("type", ["typeDef", "hasFeature"]);
|
||||
mockTypeCapability.typeDef = { name: ""};
|
||||
mockTypeCapability.hasFeature.and.callFake(function (feature) {
|
||||
mockTypeCapability.hasFeature.andCallFake(function (feature) {
|
||||
return feature === 'creation';
|
||||
});
|
||||
|
||||
@ -52,8 +52,8 @@ define(
|
||||
name: "Test name"
|
||||
};
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", ["getCapability", "getModel"]);
|
||||
mockDomainObject.getModel.and.returnValue(model);
|
||||
mockDomainObject.getCapability.and.callFake(function (key) {
|
||||
mockDomainObject.getModel.andReturn(model);
|
||||
mockDomainObject.getCapability.andCallFake(function (key) {
|
||||
return mockCapabilities[key];
|
||||
});
|
||||
|
||||
@ -62,7 +62,7 @@ define(
|
||||
};
|
||||
|
||||
mockCurrentTarget = jasmine.createSpyObj("currentTarget", ["blur", "textContent"]);
|
||||
mockCurrentTarget.blur.and.returnValue(mockCurrentTarget);
|
||||
mockCurrentTarget.blur.andReturn(mockCurrentTarget);
|
||||
|
||||
mockEvent = {
|
||||
which: {},
|
||||
@ -109,7 +109,7 @@ define(
|
||||
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
|
||||
mockMutationCapability.mutate.calls.mostRecent().args[0](model);
|
||||
mockMutationCapability.mutate.mostRecentCall.args[0](model);
|
||||
|
||||
expect(mockDomainObject.getModel().name).toBe("New name");
|
||||
});
|
||||
@ -127,7 +127,7 @@ define(
|
||||
});
|
||||
|
||||
it("disallows editting name when object is non-creatable", function () {
|
||||
mockTypeCapability.hasFeature.and.returnValue(false);
|
||||
mockTypeCapability.hasFeature.andReturn(false);
|
||||
|
||||
expect(controller.allowEdit()).toBe(false);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -53,8 +53,8 @@ define(
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.and.returnValue(id);
|
||||
mockDomainObject.getModel.and.returnValue({});
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
|
||||
return mockDomainObject;
|
||||
});
|
||||
@ -65,7 +65,7 @@ define(
|
||||
mockWindow = jasmine.createSpyObj("$window", ["open"]);
|
||||
|
||||
mockLocation = jasmine.createSpyObj('location', ['search']);
|
||||
mockLocation.search.and.returnValue({});
|
||||
mockLocation.search.andReturn({});
|
||||
|
||||
mockAttrs = {};
|
||||
});
|
||||
@ -83,9 +83,9 @@ define(
|
||||
});
|
||||
|
||||
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);
|
||||
mockAgentService.isMobile.andReturn(true);
|
||||
mockAgentService.isPhone.andReturn(true);
|
||||
mockAgentService.isPortrait.andReturn(true);
|
||||
controller = instantiateController();
|
||||
expect(controller.visible()).toBeTruthy();
|
||||
|
||||
@ -102,13 +102,13 @@ define(
|
||||
});
|
||||
|
||||
it("sets pane state to false when in location.search", function () {
|
||||
mockLocation.search.and.returnValue({'hideTree': true});
|
||||
mockLocation.search.andReturn({'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({});
|
||||
mockLocation.search.andReturn({});
|
||||
expect(instantiateController().visible()).toBe(true);
|
||||
expect(mockLocation.search).not.toHaveBeenCalledWith('hideTree', undefined);
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -34,6 +34,17 @@ define([
|
||||
mockDomainObject,
|
||||
action;
|
||||
|
||||
|
||||
function waitForCall() {
|
||||
var called = false;
|
||||
waitsFor(function () {
|
||||
return called;
|
||||
});
|
||||
return function () {
|
||||
called = true;
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
@ -52,24 +63,26 @@ define([
|
||||
});
|
||||
|
||||
it("sets navigation if it is allowed", function () {
|
||||
mockNavigationService.shouldNavigate.and.returnValue(true);
|
||||
return action.perform()
|
||||
.then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
mockNavigationService.shouldNavigate.andReturn(true);
|
||||
action.perform()
|
||||
.then(waitForCall());
|
||||
runs(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDomainObject, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("does not set navigation if it is not allowed", function () {
|
||||
mockNavigationService.shouldNavigate.and.returnValue(false);
|
||||
mockNavigationService.shouldNavigate.andReturn(false);
|
||||
var onSuccess = jasmine.createSpy('onSuccess');
|
||||
return action.perform()
|
||||
.then(onSuccess, function () {
|
||||
expect(onSuccess).not.toHaveBeenCalled();
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.not
|
||||
.toHaveBeenCalledWith(mockDomainObject);
|
||||
});
|
||||
action.perform()
|
||||
.then(onSuccess, waitForCall());
|
||||
runs(function () {
|
||||
expect(onSuccess).not.toHaveBeenCalled();
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.not
|
||||
.toHaveBeenCalledWith(mockDomainObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("is only applicable when a domain object is in context", function () {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -69,7 +69,7 @@ define(
|
||||
navigationService.addListener(callback);
|
||||
navigationService.setNavigation(testObject);
|
||||
navigationService.setNavigation(testObject);
|
||||
expect(callback.calls.count()).toEqual(1);
|
||||
expect(callback.calls.length).toEqual(1);
|
||||
});
|
||||
|
||||
it("stops notifying listeners after removal", function () {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -65,35 +65,34 @@ define([
|
||||
mockActionCapability = jasmine.createSpyObj('action', ['perform']);
|
||||
mockEditor = jasmine.createSpyObj('editor', ['isEditContextRoot']);
|
||||
|
||||
mockThrottle.and.callFake(function (fn) {
|
||||
mockThrottle.andCallFake(function (fn) {
|
||||
var mockThrottledFn =
|
||||
jasmine.createSpy('throttled-' + mockThrottledFns.length);
|
||||
mockThrottledFn.and.callFake(fn);
|
||||
mockThrottledFn.andCallFake(fn);
|
||||
mockThrottledFns.push(mockThrottledFn);
|
||||
return mockThrottledFn;
|
||||
});
|
||||
mockTopic.and.returnValue(mockMutationTopic);
|
||||
mockDomainObject.getId.and.returnValue(testId);
|
||||
mockDomainObject.getCapability.and.callFake(function (c) {
|
||||
mockTopic.andReturn(mockMutationTopic);
|
||||
mockDomainObject.getId.andReturn(testId);
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
context: mockContext,
|
||||
editor: mockEditor
|
||||
}[c];
|
||||
});
|
||||
mockDomainObject.hasCapability.and.callFake(function (c) {
|
||||
mockDomainObject.hasCapability.andCallFake(function (c) {
|
||||
return !!mockDomainObject.getCapability(c);
|
||||
});
|
||||
mockParentObject.getCapability.and.callFake(function (c) {
|
||||
mockParentObject.getCapability.andCallFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability
|
||||
}[c];
|
||||
});
|
||||
testParentComposition = [];
|
||||
mockParentObject.useCapability.and.returnValue(Promise.resolve(testParentComposition));
|
||||
|
||||
mockContext.getParent.and.returnValue(mockParentObject);
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
mockEditor.isEditContextRoot.and.returnValue(false);
|
||||
mockParentObject.useCapability.andReturn(Promise.resolve(testParentComposition));
|
||||
mockContext.getParent.andReturn(mockParentObject);
|
||||
mockNavigationService.getNavigation.andReturn(mockDomainObject);
|
||||
mockEditor.isEditContextRoot.andReturn(false);
|
||||
|
||||
return new OrphanNavigationHandler(
|
||||
mockThrottle,
|
||||
@ -107,7 +106,7 @@ define([
|
||||
expect(mockMutationTopic.listen)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
expect(mockThrottledFns.indexOf(
|
||||
mockMutationTopic.listen.calls.mostRecent().args[0]
|
||||
mockMutationTopic.listen.mostRecentCall.args[0]
|
||||
)).not.toEqual(-1);
|
||||
});
|
||||
|
||||
@ -115,7 +114,7 @@ define([
|
||||
expect(mockNavigationService.addListener)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
expect(mockThrottledFns.indexOf(
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0]
|
||||
mockNavigationService.addListener.mostRecentCall.args[0]
|
||||
)).not.toEqual(-1);
|
||||
});
|
||||
|
||||
@ -135,14 +134,28 @@ define([
|
||||
function itNavigatesAsExpected() {
|
||||
if (isOrphan && !isEditRoot) {
|
||||
it("navigates to the parent", function () {
|
||||
return Promise.resolve().then(function () {
|
||||
var done = false;
|
||||
waitsFor(function () {
|
||||
return done;
|
||||
});
|
||||
setTimeout(function () {
|
||||
done = true;
|
||||
}, 5);
|
||||
runs(function () {
|
||||
expect(mockActionCapability.perform)
|
||||
.toHaveBeenCalledWith('navigate');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
it("does nothing", function () {
|
||||
return Promise.resolve().then(function () {
|
||||
var done = false;
|
||||
waitsFor(function () {
|
||||
return done;
|
||||
});
|
||||
setTimeout(function () {
|
||||
done = true;
|
||||
}, 5);
|
||||
runs(function () {
|
||||
expect(mockActionCapability.perform)
|
||||
.not.toHaveBeenCalled();
|
||||
});
|
||||
@ -152,12 +165,12 @@ define([
|
||||
|
||||
describe(caseName, function () {
|
||||
beforeEach(function () {
|
||||
mockEditor.isEditContextRoot.and.returnValue(isEditRoot);
|
||||
mockEditor.isEditContextRoot.andReturn(isEditRoot);
|
||||
});
|
||||
|
||||
describe("when navigation changes", function () {
|
||||
beforeEach(function () {
|
||||
mockNavigationService.addListener.calls.mostRecent()
|
||||
mockNavigationService.addListener.mostRecentCall
|
||||
.args[0](mockDomainObject);
|
||||
});
|
||||
itNavigatesAsExpected();
|
||||
@ -165,7 +178,7 @@ define([
|
||||
|
||||
describe("when mutation occurs", function () {
|
||||
beforeEach(function () {
|
||||
mockMutationTopic.listen.calls.mostRecent()
|
||||
mockMutationTopic.listen.mostRecentCall
|
||||
.args[0](mockParentObject);
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -49,8 +49,8 @@ define(
|
||||
);
|
||||
mockDocument = [{}];
|
||||
|
||||
mockDomainObject.getModel.and.returnValue({ name: 'Test name' });
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
mockDomainObject.getModel.andReturn({ name: 'Test name' });
|
||||
mockNavigationService.getNavigation.andReturn(mockDomainObject);
|
||||
|
||||
titler = new WindowTitler(
|
||||
mockNavigationService,
|
||||
@ -64,12 +64,12 @@ define(
|
||||
jasmine.any(Function),
|
||||
jasmine.any(Function)
|
||||
);
|
||||
expect(mockRootScope.$watch.calls.mostRecent().args[0]())
|
||||
expect(mockRootScope.$watch.mostRecentCall.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");
|
||||
mockRootScope.$watch.mostRecentCall.args[1]("Some name");
|
||||
expect(mockDocument[0].title).toEqual("Some name");
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -4,10 +4,7 @@
|
||||
<div class="top-bar">
|
||||
<div class="title">{{ngModel.title}}</div>
|
||||
</div>
|
||||
<div class="hint" ng-hide="ngModel.hint === undefined">
|
||||
{{ngModel.hint}}
|
||||
<span ng-if="ngModel.timestamp !== undefined">[{{ngModel.timestamp}}]</span>
|
||||
</div>
|
||||
<div class="hint" ng-hide="ngModel.hint === undefined">{{ngModel.hint}}</div>
|
||||
<div class="message-body">
|
||||
<div class="message-action">
|
||||
{{ngModel.actionText}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -63,12 +63,12 @@ define(
|
||||
["find"]
|
||||
);
|
||||
mockBody = jasmine.createSpyObj('body', ['on', 'off']);
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
mockDocument.find.andReturn(mockBody);
|
||||
|
||||
mockDeferred.promise = "mock promise";
|
||||
|
||||
mockQ.defer.and.returnValue(mockDeferred);
|
||||
mockOverlayService.createOverlay.and.returnValue(mockOverlay);
|
||||
mockQ.defer.andReturn(mockDeferred);
|
||||
mockOverlayService.createOverlay.andReturn(mockOverlay);
|
||||
|
||||
dialogService = new DialogService(
|
||||
mockOverlayService,
|
||||
@ -85,7 +85,7 @@ define(
|
||||
|
||||
it("allows user input to be canceled", function () {
|
||||
dialogService.getUserInput({}, { someKey: "some value" });
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].cancel();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].cancel();
|
||||
expect(mockDeferred.reject).toHaveBeenCalled();
|
||||
expect(mockDeferred.resolve).not.toHaveBeenCalled();
|
||||
});
|
||||
@ -93,7 +93,7 @@ define(
|
||||
it("passes back the result of user input when confirmed", function () {
|
||||
var value = { someKey: 42 };
|
||||
dialogService.getUserInput({}, value);
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].confirm();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
expect(mockDeferred.resolve).toHaveBeenCalledWith(value);
|
||||
});
|
||||
@ -109,7 +109,7 @@ define(
|
||||
it("can show multiple dialogs if prior ones are dismissed", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].confirm();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
|
||||
dialogService.getUserInput({}, {});
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
@ -148,13 +148,13 @@ define(
|
||||
|
||||
it("destroys the event listener when the dialog is cancelled", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].cancel();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].cancel();
|
||||
expect(mockBody.off).toHaveBeenCalledWith("keydown", jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("cancels the dialog when an escape keydown event is triggered", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
mockBody.on.calls.mostRecent().args[1]({
|
||||
mockBody.on.mostRecentCall.args[1]({
|
||||
keyCode: 27
|
||||
});
|
||||
expect(mockDeferred.reject).toHaveBeenCalled();
|
||||
@ -163,7 +163,7 @@ define(
|
||||
|
||||
it("ignores non escape keydown events", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
mockBody.on.calls.mostRecent().args[1]({
|
||||
mockBody.on.mostRecentCall.args[1]({
|
||||
keyCode: 13
|
||||
});
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
@ -197,7 +197,7 @@ define(
|
||||
"overlay",
|
||||
["dismiss"]
|
||||
);
|
||||
mockOverlayService.createOverlay.and.returnValue(secondMockOverlay);
|
||||
mockOverlayService.createOverlay.andReturn(secondMockOverlay);
|
||||
secondDialogHandle = dialogService.showBlockingMessage(dialogModel);
|
||||
|
||||
//Dismiss the first dialog. It should only dismiss if it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -46,10 +46,10 @@ define(
|
||||
mockElement = jasmine.createSpyObj("element", ["remove"]);
|
||||
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
|
||||
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
mockCompile.and.returnValue(mockTemplate);
|
||||
mockRootScope.$new.and.returnValue(mockScope);
|
||||
mockTemplate.and.returnValue(mockElement);
|
||||
mockDocument.find.andReturn(mockBody);
|
||||
mockCompile.andReturn(mockTemplate);
|
||||
mockRootScope.$new.andReturn(mockScope);
|
||||
mockTemplate.andReturn(mockElement);
|
||||
|
||||
overlayService = new OverlayService(
|
||||
mockDocument,
|
||||
@ -61,7 +61,7 @@ define(
|
||||
it("prepends an mct-include to create overlays", function () {
|
||||
overlayService.createOverlay("test", {});
|
||||
expect(mockCompile).toHaveBeenCalled();
|
||||
expect(mockCompile.calls.mostRecent().args[0].indexOf("mct-include"))
|
||||
expect(mockCompile.mostRecentCall.args[0].indexOf("mct-include"))
|
||||
.not.toEqual(-1);
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -39,6 +39,7 @@ define([
|
||||
"./src/policies/EditableMovePolicy",
|
||||
"./src/policies/EditContextualActionPolicy",
|
||||
"./src/representers/EditRepresenter",
|
||||
"./src/representers/EditToolbarRepresenter",
|
||||
"./src/capabilities/EditorCapability",
|
||||
"./src/capabilities/TransactionCapabilityDecorator",
|
||||
"./src/services/TransactionManager",
|
||||
@ -77,6 +78,7 @@ define([
|
||||
EditableMovePolicy,
|
||||
EditContextualActionPolicy,
|
||||
EditRepresenter,
|
||||
EditToolbarRepresenter,
|
||||
EditorCapability,
|
||||
TransactionCapabilityDecorator,
|
||||
TransactionManager,
|
||||
@ -119,8 +121,7 @@ define([
|
||||
"key": "ElementsController",
|
||||
"implementation": ElementsController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"openmct"
|
||||
"$scope"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -298,6 +299,9 @@ define([
|
||||
{
|
||||
"key": "edit-elements",
|
||||
"template": elementsTemplate,
|
||||
"uses": [
|
||||
"composition"
|
||||
],
|
||||
"gestures": [
|
||||
"drop"
|
||||
]
|
||||
@ -379,6 +383,9 @@ define([
|
||||
"depends": [
|
||||
"$log"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": EditToolbarRepresenter
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
@ -416,17 +423,6 @@ define([
|
||||
"transactionService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
depends: [
|
||||
"toolbars[]",
|
||||
"openmct"
|
||||
],
|
||||
implementation: function (toolbars, openmct) {
|
||||
toolbars.forEach(openmct.toolbars.addProvider, openmct.toolbars);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -24,8 +24,7 @@
|
||||
<div class="items-select left flex-elem l-flex-row grows">
|
||||
<mct-representation key="'back-arrow'"
|
||||
mct-object="domainObject"
|
||||
class="flex-elem l-back">
|
||||
</mct-representation>
|
||||
class="flex-elem l-back"></mct-representation>
|
||||
<mct-representation key="'object-header'"
|
||||
mct-object="domainObject"
|
||||
class="l-flex-row flex-elem grows object-header">
|
||||
@ -49,8 +48,8 @@
|
||||
<!-- Toolbar and Save/Cancel buttons -->
|
||||
<div class="l-edit-controls flex-elem l-flex-row flex-align-end">
|
||||
<mct-toolbar name="mctToolbar"
|
||||
structure="editToolbar.structure"
|
||||
ng-model="editToolbar.state"
|
||||
structure="toolbar.structure"
|
||||
ng-model="toolbar.state"
|
||||
class="flex-elem grows">
|
||||
</mct-toolbar>
|
||||
<mct-representation key="'edit-action-buttons'"
|
||||
@ -62,11 +61,7 @@
|
||||
<mct-representation key="representation.selected.key"
|
||||
mct-object="representation.selected.key && domainObject"
|
||||
class="abs flex-elem grows object-holder-main scroll"
|
||||
mct-selectable="{
|
||||
item: domainObject.useCapability('adapter'),
|
||||
oldItem: domainObject
|
||||
}"
|
||||
mct-init-select>
|
||||
toolbar="toolbar">
|
||||
</mct-representation>
|
||||
</div><!--/ l-object-wrapper-inner -->
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -24,18 +24,10 @@
|
||||
class="flex-elem holder"
|
||||
ng-model="filterBy">
|
||||
</mct-include>
|
||||
<div class="flex-elem grows vscroll scroll-pad">
|
||||
<ul class="tree" id="inspector-elements-tree"
|
||||
ng-if="composition.length > 0">
|
||||
<div class="flex-elem grows vscroll">
|
||||
<ul class="tree">
|
||||
<li ng-repeat="containedObject in composition | filter:searchElements">
|
||||
<span class="tree-item">
|
||||
<span class="grippy-sm"
|
||||
ng-if="composition.length > 1"
|
||||
data-id="{{ containedObject.id }}"
|
||||
mct-drag-down="dragDown($event)"
|
||||
mct-drag="drag($event)"
|
||||
mct-drag-up="dragUp($event)">
|
||||
</span>
|
||||
<mct-representation
|
||||
class="rep-object-label"
|
||||
key="'label'"
|
||||
@ -44,6 +36,5 @@
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div ng-if="composition.length === 0">No contained elements</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user