Compare commits
236 Commits
open199-cs
...
nem_implem
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a74117294 | ||
|
|
f8aa123122 | ||
|
|
6d4a20c07a | ||
|
|
2c4d53883a | ||
|
|
c71aa43581 | ||
|
|
9cc03123b1 | ||
|
|
a6ecda9cab | ||
|
|
b20488e77d | ||
|
|
05a909f66f | ||
|
|
2436c32e6d | ||
|
|
02c984a0bc | ||
|
|
01772e4020 | ||
|
|
019e04f9ab | ||
|
|
668b508bb8 | ||
|
|
7d24c5319b | ||
|
|
83bdf7343d | ||
|
|
46e524a3b6 | ||
|
|
22b7bb07aa | ||
|
|
7a25733be0 | ||
|
|
b9146fbeac | ||
|
|
a49deb5ab1 | ||
|
|
9b63a63efc | ||
|
|
2358541d91 | ||
|
|
38b5756d8d | ||
|
|
c436bcce0a | ||
|
|
8e68914b56 | ||
|
|
f0a5a836d6 | ||
|
|
2b0f6dd577 | ||
|
|
30fec7c2ac | ||
|
|
3f4ed46c1c | ||
|
|
ba4c66866c | ||
|
|
fcee30c27e | ||
|
|
560825cc86 | ||
|
|
2df61998ab | ||
|
|
91b42fc0cc | ||
|
|
5eac0bc5d9 | ||
|
|
d397f0f283 | ||
|
|
0aae2c7b2c | ||
|
|
b5d7dbc088 | ||
|
|
5921883325 | ||
|
|
75d7240476 | ||
|
|
9d71715c43 | ||
|
|
b986a0a38d | ||
|
|
0d2b5160ac | ||
|
|
c99b6df9fc | ||
|
|
9c4c020f54 | ||
|
|
08c4302011 | ||
|
|
5f96861c44 | ||
|
|
995d71f901 | ||
|
|
82e4a53472 | ||
|
|
e7a41061c6 | ||
|
|
4848a61e21 | ||
|
|
6302e45c10 | ||
|
|
451157b653 | ||
|
|
ae89a169d0 | ||
|
|
941d0d0057 | ||
|
|
0296cfe3c1 | ||
|
|
f55168d1ac | ||
|
|
3c4fb8c43d | ||
|
|
ed7e16d341 | ||
|
|
9dc958b952 | ||
|
|
ed3ee1099d | ||
|
|
7fb506d4df | ||
|
|
67707678a8 | ||
|
|
930b13f9a0 | ||
|
|
b59fc43038 | ||
|
|
4579b4fabc | ||
|
|
9b32461240 | ||
|
|
7dc067741b | ||
|
|
d1f617a54e | ||
|
|
c4f99a6cab | ||
|
|
83e77303aa | ||
|
|
29a1c7dc5d | ||
|
|
65a1d7495d | ||
|
|
a98ab958c9 | ||
|
|
6e1cadf338 | ||
|
|
83a9b984e5 | ||
|
|
978df93ffd | ||
|
|
33b1c1689c | ||
|
|
0cfc070f3c | ||
|
|
21fd16ddf1 | ||
|
|
ce94db0a4b | ||
|
|
0d894a9f39 | ||
|
|
5ad150a17e | ||
|
|
b6acdb12ec | ||
|
|
604b29096d | ||
|
|
6200ceddf8 | ||
|
|
de88bf94d4 | ||
|
|
8077cdb834 | ||
|
|
7871af07c4 | ||
|
|
714ae3b9dc | ||
|
|
27fa56d838 | ||
|
|
e30a82432d | ||
|
|
19f07aa398 | ||
|
|
46f9b31cff | ||
|
|
e32feb29e2 | ||
|
|
89a93e2966 | ||
|
|
038322e9aa | ||
|
|
6cef663db5 | ||
|
|
b2f5861458 | ||
|
|
f8809ce67f | ||
|
|
3c97eb6014 | ||
|
|
3498b0a50a | ||
|
|
14c5a817a7 | ||
|
|
258c5d95e6 | ||
|
|
30a8ba5c11 | ||
|
|
33c372765f | ||
|
|
ed7e0d8b0a | ||
|
|
f3828ba516 | ||
|
|
2a48c25453 | ||
|
|
096da0cb94 | ||
|
|
ca8a07e1ae | ||
|
|
c02f965460 | ||
|
|
5f440bb6de | ||
|
|
fc729279ec | ||
|
|
dd0f9ab74e | ||
|
|
d2a4a85e04 | ||
|
|
37890280ae | ||
|
|
a6ceae4045 | ||
|
|
3447e735dc | ||
|
|
989c937ce1 | ||
|
|
e0608ddee0 | ||
|
|
b35224061f | ||
|
|
b25576aed8 | ||
|
|
d5f054e328 | ||
|
|
eb4959cf49 | ||
|
|
cce415fc51 | ||
|
|
00f96c314a | ||
|
|
fefd27162c | ||
|
|
b388c76e45 | ||
|
|
aaeaf3a096 | ||
|
|
57efe4e0d1 | ||
|
|
dd4dbc9326 | ||
|
|
6aa77ff468 | ||
|
|
f8099550bd | ||
|
|
96249e6bcc | ||
|
|
6e391098a3 | ||
|
|
baec0f9719 | ||
|
|
6aab9f4e34 | ||
|
|
1bf73935e4 | ||
|
|
49e51d0a62 | ||
|
|
3e7bc2f37f | ||
|
|
0f56fd2561 | ||
|
|
9f0114eb39 | ||
|
|
4b82893c36 | ||
|
|
734e979c94 | ||
|
|
983973843e | ||
|
|
3b427c31a2 | ||
|
|
cee0ecf0ef | ||
|
|
8e3c5db3bf | ||
|
|
11d8daf3ed | ||
|
|
9953e16415 | ||
|
|
fe600de0f7 | ||
|
|
386f1f20ff | ||
|
|
5e07951892 | ||
|
|
2514e44083 | ||
|
|
20d9c7158e | ||
|
|
d8e319ebf8 | ||
|
|
a39cbbd917 | ||
|
|
8df27a1c05 | ||
|
|
26cf9c14f4 | ||
|
|
03edd26e17 | ||
|
|
571f6d183a | ||
|
|
1292e39c46 | ||
|
|
6fe3f82fb1 | ||
|
|
da8fb99e82 | ||
|
|
c8d77bc2db | ||
|
|
b5e52fce75 | ||
|
|
3afcb52934 | ||
|
|
677b0cffec | ||
|
|
248bc68f0d | ||
|
|
02050fa3ef | ||
|
|
57d23c3696 | ||
|
|
8babfc5ca9 | ||
|
|
271b5d1a73 | ||
|
|
7d4e7a0925 | ||
|
|
92f5d5f190 | ||
|
|
1731b985fc | ||
|
|
bd4590ad9d | ||
|
|
55fc60ec82 | ||
|
|
ab075e9ad8 | ||
|
|
3ac1710d83 | ||
|
|
730878938e | ||
|
|
3fd4304de1 | ||
|
|
db7224486c | ||
|
|
424953c894 | ||
|
|
6d0f3c7faa | ||
|
|
434a52ded3 | ||
|
|
2ec906e2d4 | ||
|
|
405daf36b2 | ||
|
|
ffff13205a | ||
|
|
16efd85dfc | ||
|
|
1ef09ffbdd | ||
|
|
976ecce075 | ||
|
|
87a51a9eb3 | ||
|
|
91997ced01 | ||
|
|
7a4be9e67e | ||
|
|
eb942b0bf7 | ||
|
|
1cf23c7ad6 | ||
|
|
15ec9df538 | ||
|
|
096fee8b6d | ||
|
|
0635e7c38e | ||
|
|
fd3059b380 | ||
|
|
5a7349117a | ||
|
|
50134bbc7f | ||
|
|
3854df27d8 | ||
|
|
fc53dbd8a4 | ||
|
|
de59f191b8 | ||
|
|
3d3b250536 | ||
|
|
0fa6cbfc18 | ||
|
|
4f001f0b5d | ||
|
|
7cd255670e | ||
|
|
eabde6b2d0 | ||
|
|
37f466705a | ||
|
|
4e8101ba0b | ||
|
|
61a272b257 | ||
|
|
b4c0de84d8 | ||
|
|
c91e914c22 | ||
|
|
c2971fd485 | ||
|
|
7d94e20c8f | ||
|
|
8f8dd6c11f | ||
|
|
553e226a5d | ||
|
|
dfacf08e45 | ||
|
|
e7fa0e9f21 | ||
|
|
ccfafb6f89 | ||
|
|
097794d94f | ||
|
|
cd51c359eb | ||
|
|
2adf84b082 | ||
|
|
4c00d5d58f | ||
|
|
844d608fb9 | ||
|
|
d46eea64e4 | ||
|
|
4d4fe7f626 | ||
|
|
12760b63b9 | ||
|
|
8fae298fde | ||
|
|
7ddaa4614b | ||
|
|
f1bc15bf4f |
@@ -291,7 +291,7 @@ checklist.)
|
||||
1. Changes address original issue?
|
||||
2. Unit tests included and/or updated with changes?
|
||||
3. Command line build passes?
|
||||
4. Expect to pass code review?
|
||||
4. Changes have been smoke-tested?
|
||||
|
||||
### Reviewer Checklist
|
||||
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
"platform/execution",
|
||||
"platform/telemetry",
|
||||
"platform/features/clock",
|
||||
"platform/features/events",
|
||||
"platform/features/imagery",
|
||||
"platform/features/layout",
|
||||
"platform/features/pages",
|
||||
"platform/features/plot",
|
||||
"platform/features/scrolling",
|
||||
"platform/features/events",
|
||||
"platform/features/timeline",
|
||||
"platform/forms",
|
||||
"platform/identity",
|
||||
"platform/persistence/aggregator",
|
||||
|
||||
@@ -106,7 +106,7 @@ GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be define
|
||||
}
|
||||
|
||||
// Convert from Github-flavored Markdown to HTML
|
||||
function gfmifier() {
|
||||
function gfmifier(renderTOC) {
|
||||
var transform = new stream.Transform({ objectMode: true }),
|
||||
markdown = "";
|
||||
transform._transform = function (chunk, encoding, done) {
|
||||
@@ -114,9 +114,11 @@ GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be define
|
||||
done();
|
||||
};
|
||||
transform._flush = function (done) {
|
||||
// Prepend table of contents
|
||||
markdown =
|
||||
[ TOC_HEAD, toc(markdown).content, "", markdown ].join("\n");
|
||||
if (renderTOC){
|
||||
// Prepend table of contents
|
||||
markdown =
|
||||
[ TOC_HEAD, toc(markdown).content, "", markdown ].join("\n");
|
||||
}
|
||||
this.push(header);
|
||||
this.push(marked(markdown));
|
||||
this.push(footer);
|
||||
@@ -168,13 +170,16 @@ GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be define
|
||||
var destination = file.replace(options['in'], options.out)
|
||||
.replace(/md$/, "html"),
|
||||
destPath = path.dirname(destination),
|
||||
prefix = path.basename(destination).replace(/\.html$/, "");
|
||||
prefix = path.basename(destination).replace(/\.html$/, ""),
|
||||
//Determine whether TOC should be rendered for this file based
|
||||
//on regex provided as command line option
|
||||
renderTOC = file.match(options['suppress-toc'] || "") === null;
|
||||
|
||||
mkdirp(destPath, function (err) {
|
||||
fs.createReadStream(file, { encoding: 'utf8' })
|
||||
.pipe(split())
|
||||
.pipe(nomnomlifier(destPath, prefix))
|
||||
.pipe(gfmifier())
|
||||
.pipe(gfmifier(renderTOC))
|
||||
.pipe(fs.createWriteStream(destination, {
|
||||
encoding: 'utf8'
|
||||
}));
|
||||
|
||||
3
docs/src/design/index.md
Normal file
3
docs/src/design/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Design proposals:
|
||||
|
||||
* [API Redesign](proposals/APIRedesign.md)
|
||||
338
docs/src/design/planning/APIRefactor.md
Normal file
338
docs/src/design/planning/APIRefactor.md
Normal file
@@ -0,0 +1,338 @@
|
||||
# API Refactoring
|
||||
|
||||
This document summarizes a path toward implementing API changes
|
||||
from the [API Redesign](../proposals/APIRedesign.md) for Open MCT Web
|
||||
v1.0.0.
|
||||
|
||||
# Goals
|
||||
|
||||
These plans are intended to minimize:
|
||||
|
||||
* Waste; avoid allocating effort to temporary changes.
|
||||
* Downtime; avoid making changes in large increments that blocks
|
||||
delivery of new features for substantial periods of time.
|
||||
* Risk; ensure that changes can be validated quickly, avoid putting
|
||||
large effort into changes that have not been validated.
|
||||
|
||||
# Plan
|
||||
|
||||
```nomnoml
|
||||
#comment: This diagram is in nomnoml syntax and should be rendered.
|
||||
#comment: See https://github.com/nasa/openmctweb/issues/264#issuecomment-167166471
|
||||
|
||||
|
||||
[<start> Start]->[<state> Imperative bundle registration]
|
||||
|
||||
[<state> Imperative bundle registration]->[<state> Build and packaging]
|
||||
[<state> Imperative bundle registration]->[<state> Refactor API]
|
||||
|
||||
[<state> Build and packaging |
|
||||
[<start> Start]->[<state> Incorporate a build step]
|
||||
[<state> Incorporate a build step |
|
||||
[<start> Start]->[<state> Choose package manager]
|
||||
[<start> Start]->[<state> Choose build system]
|
||||
[<state> Choose build system]<->[<state> Choose package manager]
|
||||
[<state> Choose package manager]->[<state> Implement]
|
||||
[<state> Choose build system]->[<state> Implement]
|
||||
[<state> Implement]->[<end> End]
|
||||
]->[<state> Separate repositories]
|
||||
[<state> Separate repositories]->[<end> End]
|
||||
]->[<state> Release candidacy]
|
||||
|
||||
|
||||
[<start> Start]->[<state> Design registration API]
|
||||
|
||||
[<state> Design registration API |
|
||||
[<start> Start]->[<state> Decide on role of Angular]
|
||||
[<state> Decide on role of Angular]->[<state> Design API]
|
||||
[<state> Design API]->[<choice> Passes review?]
|
||||
[<choice> Passes review?] no ->[<state> Design API]
|
||||
[<choice> Passes review?]-> yes [<end> End]
|
||||
]->[<state> Refactor API]
|
||||
|
||||
[<state> Refactor API |
|
||||
[<start> Start]->[<state> Imperative extension registration]
|
||||
[<state> Imperative extension registration]->[<state> Refactor individual extensions]
|
||||
|
||||
[<state> Refactor individual extensions |
|
||||
[<start> Start]->[<state> Prioritize]
|
||||
[<state> Prioritize]->[<choice> Sufficient value added?]
|
||||
[<choice> Sufficient value added?] no ->[<end> End]
|
||||
[<choice> Sufficient value added?] yes ->[<state> Design]
|
||||
[<state> Design]->[<choice> Passes review?]
|
||||
[<choice> Passes review?] no ->[<state> Design]
|
||||
[<choice> Passes review?]-> yes [<state> Implement]
|
||||
[<state> Implement]->[<end> End]
|
||||
]->[<state> Remove legacy bundle support]
|
||||
|
||||
[<state> Remove legacy bundle support]->[<end> End]
|
||||
]->[<state> Release candidacy]
|
||||
|
||||
[<state> Release candidacy |
|
||||
[<start> Start]->[<state> Verify |
|
||||
[<start> Start]->[<choice> API well-documented?]
|
||||
[<start> Start]->[<choice> API well-tested?]
|
||||
[<choice> API well-documented?]-> no [<state> Write documentation]
|
||||
[<choice> API well-documented?] yes ->[<end> End]
|
||||
[<state> Write documentation]->[<choice> API well-documented?]
|
||||
[<choice> API well-tested?]-> no [<state> Write test cases]
|
||||
[<choice> API well-tested?]-> yes [<end> End]
|
||||
[<state> Write test cases]->[<choice> API well-tested?]
|
||||
]
|
||||
[<start> Start]->[<state> Validate |
|
||||
[<start> Start]->[<choice> Passes review?]
|
||||
[<start> Start]->[<state> Use internally]
|
||||
[<state> Use internally]->[<choice> Proves useful?]
|
||||
[<choice> Passes review?]-> no [<state> Address feedback]
|
||||
[<state> Address feedback]->[<choice> Passes review?]
|
||||
[<choice> Passes review?] yes -> [<end> End]
|
||||
[<choice> Proves useful?] yes -> [<end> End]
|
||||
[<choice> Proves useful?] no -> [<state> Fix problems]
|
||||
[<state> Fix problems]->[<state> Use internally]
|
||||
]
|
||||
[<state> Validate]->[<end> End]
|
||||
[<state> Verify]->[<end> End]
|
||||
]->[<state> Release]
|
||||
|
||||
[<state> Release]->[<end> End]
|
||||
```
|
||||
|
||||
## Step 1. Imperative bundle registration
|
||||
|
||||
Register whole bundles imperatively, using their current format.
|
||||
|
||||
For example, in each bundle add a `bundle.js` file:
|
||||
|
||||
```js
|
||||
define([
|
||||
'mctRegistry',
|
||||
'json!bundle.json'
|
||||
], function (mctRegistry, bundle) {
|
||||
mctRegistry.install(bundle, "path/to/bundle");
|
||||
});
|
||||
```
|
||||
|
||||
Where `mctRegistry.install` is placeholder API that wires into the
|
||||
existing bundle registration mechanisms. The main point of entry
|
||||
would need to be adapted to clearly depend on these bundles
|
||||
(in the require sense of a dependency), and the framework layer
|
||||
would need to implement and integrate with this transitional
|
||||
API.
|
||||
|
||||
Benefits:
|
||||
|
||||
* Achieves an API Redesign goal with minimal immediate effort.
|
||||
* Conversion to an imperative syntax may be trivially automated.
|
||||
* Minimal change; reuse existing bundle definitions, primarily.
|
||||
* Allows early validation of switch to imperative; unforeseen
|
||||
consequences of the change may be detected at this point.
|
||||
* Allows implementation effort to progress in parallel with decisions
|
||||
about API changes, including fundamental ones such as the role of
|
||||
Angular. May act in some sense as a prototype to inform those
|
||||
decisions.
|
||||
* Creates a location (framework layer) where subsequent changes to
|
||||
the manner in which extensions are registered may be centralized.
|
||||
When there is a one-to-one correspondence between the existing
|
||||
form of an extension and its post-refactor form, adapters can be
|
||||
written here to defer the task of making changes ubiquitously
|
||||
throughout bundles, allowing for earlier validation and
|
||||
verification of those changes, and avoiding ubiquitous changes
|
||||
which might require us to go dark. (Mitigates
|
||||
["greenfield paradox"](http://stepaheadsoftware.blogspot.com/2012/09/greenfield-or-refactor-legacy-code-base.html);
|
||||
want to add value with new API but don't want to discard value
|
||||
of tested/proven legacy codebase.)
|
||||
|
||||
Detriments:
|
||||
|
||||
* Requires transitional API to be implemented/supported; this is
|
||||
waste. May mitigate this by time-bounding the effort put into
|
||||
this step to ensure that waste is minimal.
|
||||
|
||||
Note that API changes at this point do not meaningfully reflect
|
||||
the desired 1.0.0 API, so no API reviews are necessary.
|
||||
|
||||
## Step 2. Incorporate a build step
|
||||
|
||||
After the previous step is completed, there should be a
|
||||
straightforward dependency graph among AMD modules, and an
|
||||
imperative (albeit transitional) API allowing for other plugins
|
||||
to register themselves. This should allow for a build step to
|
||||
be included in a straightforward fashion.
|
||||
|
||||
Some goals for this build step:
|
||||
|
||||
* Compile (and, preferably, optimize/minify) Open MCT Web
|
||||
sources into a single `.js` file.
|
||||
* It is desirable to do the same for HTML sources, but
|
||||
may wish to defer this until a subsequent refactoring
|
||||
step if appropriate.
|
||||
* Provide non-code assets in a format that can be reused by
|
||||
derivative projects in a straightforward fashion.
|
||||
|
||||
Should also consider which dependency/packaging manager should
|
||||
be used by dependent projects to obtain Open MCT Web. Approaches
|
||||
include:
|
||||
|
||||
1. Plain `npm`. Dependents then declare their dependency with
|
||||
`npm` and utilize built sources and assets in a documented
|
||||
fashion. (Note that there are
|
||||
[documented challenges](http://blog.npmjs.org/post/101775448305/npm-and-front-end-packaging)
|
||||
in using `npm` in this fashion.)
|
||||
2. Build with `npm`, but recommend dependents install using
|
||||
`bower`, as this is intended for front-end development. This may
|
||||
require checking in built products, however, which
|
||||
we wish to avoid (this could be solved by maintaining
|
||||
a separate repository for built products.)
|
||||
|
||||
In all cases, there is a related question of which build system
|
||||
to use for asset generation/management and compilation/minification/etc.
|
||||
|
||||
1. [`webpack`](https://webpack.github.io/)
|
||||
is well-suited in principle, as it is specifically
|
||||
designed for modules with non-JS dependencies. However,
|
||||
there may be limitations and/or undesired behavior here
|
||||
(for instance, CSS dependencies get in-lined as style tags,
|
||||
removing our ability to control ordering) so it may
|
||||
2. `gulp` or `grunt`. Commonplace, but both still require
|
||||
non-trivial coding and/or configuration in order to produce
|
||||
appropriate build artifacts.
|
||||
3. [Just `npm`](http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/).
|
||||
Reduces the amount of tooling being used, but may introduce
|
||||
some complexity (e.g. custom scripts) to the build process,
|
||||
and may reduce portability.
|
||||
|
||||
## Step 3. Separate repositories
|
||||
|
||||
Refactor existing applications built on Open MCT Web such that they
|
||||
are no longer forks, but instead separate projects with a dependency
|
||||
on the built artifacts from Step 2.
|
||||
|
||||
Note that this is achievable already using `bower` (see `warp-bower`
|
||||
branch at http://developer.nasa.gov/mct/warp for an example.)
|
||||
However, changes involved in switching to an imperative API and
|
||||
introducing a build process may change (and should simplify) the
|
||||
approach used to utilize Open MCT Web as a dependency, so these
|
||||
changes should be introduced first.
|
||||
|
||||
## Step 4. Design registration API
|
||||
|
||||
Design the registration API that will replace declarative extension
|
||||
categories and extensions (including Angular built-ins and composite
|
||||
services.)
|
||||
|
||||
This may occur in parallel with implementation steps.
|
||||
|
||||
It will be necessary
|
||||
to have a decision about the role of Angular at this point; are extensions
|
||||
registered via provider configuration (Angular), or directly in some
|
||||
exposed registry?
|
||||
|
||||
Success criteria here should be based on peer review. Scope of peer
|
||||
review should be based on perceived risk/uncertainty surrounding
|
||||
proposed changes, to avoid waste; may wish to limit this review to
|
||||
the internal team. (The extent to which external
|
||||
feedback is available is limited, but there is an inherent timeliness
|
||||
to external review; need to balance this.)
|
||||
|
||||
Benefits:
|
||||
|
||||
* Solves the "general case" early, allowing for early validation.
|
||||
|
||||
Note that in specific cases, it may be desirable to refactor some
|
||||
current "extension category" in a manner that will not appear as
|
||||
registries, _or_ to locate these in different
|
||||
namespaces, _or_ to remove/replace certain categories entirely.
|
||||
This work is deferred intentionally to allow for a solution of the
|
||||
general case.
|
||||
|
||||
## Step 5. Imperative extension registration
|
||||
|
||||
Register individual extensions imperatively, implementing API changes
|
||||
from the previous step. At this stage, _usage_ of the API may be confined
|
||||
to a transitional adapter in the framework layer; bundles may continue
|
||||
to utilize the transitional API for registering extensions in the
|
||||
legacy format.
|
||||
|
||||
An important, ongoing sub-task here will be to discover and define dependencies
|
||||
among bundles. Composite services and extension categories are presently
|
||||
"implicit"; after the API redesign, these will become "explicit", insofar
|
||||
as some specific component will be responsible for creating any registries.
|
||||
As such, "bundles" which _use_ specific registries will need to have an
|
||||
enforceable dependency (e.g. require) upon those "bundles" which
|
||||
_declare_ those registries.
|
||||
|
||||
## Step 6. Refactor individual extensions
|
||||
|
||||
Refactor individual extension categories and/or services that have
|
||||
been identified as needing changes. This includes, but is not
|
||||
necessarily limited to:
|
||||
|
||||
* Views/Representations/Templates (refactored into "components.")
|
||||
* Capabilities (refactored into "roles", potentially.)
|
||||
* Telemetry (from `TelemetrySeries` to `TelemetryService`.)
|
||||
|
||||
Changes should be made one category at a time (either serially
|
||||
or separately in parallel) and should involve a tight cycle of:
|
||||
|
||||
1. Prioritization/reprioritization; highest-value API improvements
|
||||
should be done first.
|
||||
2. Design.
|
||||
3. Review. Refactoring individual extensions will require significant
|
||||
effort (likely the most significant effort in the process) so changes
|
||||
should be validated early to minimize risk/waste.
|
||||
4. Implementation. These changes will not have a one-to-one relationship
|
||||
with existing extensions, so changes cannot be centralized; usages
|
||||
will need to be updated across all "bundles" instead of centralized
|
||||
in a legacy adapter. If changes are of sufficient complexity, some
|
||||
planning should be done to spread out the changes incrementally.
|
||||
|
||||
By necessity, these changes may break functionality in applications
|
||||
built using Open MCT Web. On a case-by-case basis, should consider
|
||||
providing temporary "legacy support" to allow downstream updates
|
||||
to occur as a separate task; the relevant trade here is between
|
||||
waste/effort required to maintain legacy support, versus the
|
||||
downtime which may be introduced by making these changes simultaneously
|
||||
across several repositories.
|
||||
|
||||
|
||||
## Step 7. Remove legacy bundle support
|
||||
|
||||
Update bundles to remove any usages of legacy support for bundles
|
||||
(including that used by dependent projects.) Then, remove legacy
|
||||
support from Open MCT Web.
|
||||
|
||||
## Step 8. Release candidacy
|
||||
|
||||
Once API changes are complete, Open MCT Web should enter a release
|
||||
candidacy cycle. Important things to look at here:
|
||||
|
||||
* Are changes really complete?
|
||||
* Are they sufficiently documented?
|
||||
* Are they sufficiently tested?
|
||||
* Are changes really sufficient?
|
||||
* Do reviewers think they are usable?
|
||||
* Does the development team find them useful in practice? This
|
||||
will require calendar time to ascertain; should allocate time
|
||||
for this, particularly in alignment with the sprint/release
|
||||
cycle.
|
||||
* Has learning curve been measurably decreased? Comparing a to-do
|
||||
list tutorial to [other examples(http://todomvc.com/) could
|
||||
provide an empirical basis to this. How much code is required?
|
||||
How much explanation is required? How many dependencies must
|
||||
be installed before initial setup?
|
||||
* Does the API offer sufficient power to implement the extensions we
|
||||
anticipate?
|
||||
* Any open API-related issues which should block a 1.0.0 release?
|
||||
|
||||
Any problems identified during release candidacy will require
|
||||
subsequent design changes and planning.
|
||||
|
||||
## Step 9. Release
|
||||
|
||||
Once API changes have been verified and validated, proceed
|
||||
with release, including:
|
||||
|
||||
* Tagging as version 1.0.0 (at an appropriate time in the
|
||||
sprint/release cycle.)
|
||||
* Close any open issues which have been resolved (or made obsolete)
|
||||
by API changes.
|
||||
1282
docs/src/design/proposals/APIRedesign.md
Normal file
1282
docs/src/design/proposals/APIRedesign.md
Normal file
File diff suppressed because it is too large
Load Diff
251
docs/src/design/proposals/APIRedesign_PeteRichards.md
Normal file
251
docs/src/design/proposals/APIRedesign_PeteRichards.md
Normal file
@@ -0,0 +1,251 @@
|
||||
<!-- 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** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||
|
||||
- [Reducing interface depth (the bundle.json version)](#reducing-interface-depth-the-bundlejson-version)
|
||||
- [Imperitive component registries](#imperitive-component-registries)
|
||||
- [Get rid of "extension category" concept.](#get-rid-of-extension-category-concept)
|
||||
- [Reduce number and depth of extension points](#reduce-number-and-depth-of-extension-points)
|
||||
- [Composite services should not be the default](#composite-services-should-not-be-the-default)
|
||||
- [Get rid of views, representations, and templates.](#get-rid-of-views-representations-and-templates)
|
||||
- [Reducing interface depth (The angular discussion)](#reducing-interface-depth-the-angular-discussion)
|
||||
- [More angular: for all services](#more-angular-for-all-services)
|
||||
- [Less angular: only for views](#less-angular-only-for-views)
|
||||
- [Standard packaging and build system](#standard-packaging-and-build-system)
|
||||
- [Use systemjs for module loading](#use-systemjs-for-module-loading)
|
||||
- [Use gulp or grunt for standard tooling](#use-gulp-or-grunt-for-standard-tooling)
|
||||
- [Package openmctweb as single versioned file.](#package-openmctweb-as-single-versioned-file)
|
||||
- [Misc Improvements](#misc-improvements)
|
||||
- [Refresh on navigation](#refresh-on-navigation)
|
||||
- [Move persistence adapter to promise rejection.](#move-persistence-adapter-to-promise-rejection)
|
||||
- [Remove bulk requests from providers](#remove-bulk-requests-from-providers)
|
||||
- [Notes on current API proposals:](#notes-on-current-api-proposals)
|
||||
- [[1] Footnote: The angular debacle](#1-footnote-the-angular-debacle)
|
||||
- ["Do or do not, there is no try"](#do-or-do-not-there-is-no-try)
|
||||
- [A lack of commitment](#a-lack-of-commitment)
|
||||
- [Commitment is good!](#commitment-is-good)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
|
||||
# Reducing interface depth (the bundle.json version)
|
||||
|
||||
## Imperitive component registries
|
||||
|
||||
Transition component registries to javascript, get rid of bundle.json and bundles.json. Prescribe a method for application configuration, but allow flexibility in how application configuration is defined.
|
||||
|
||||
Register components in an imperitive fashion, see angularApp.factory, angularApp.controller, etc. Alternatively, implement our own application object with new registries and it's own form of registering objects.
|
||||
|
||||
## Get rid of "extension category" concept.
|
||||
|
||||
The concept of an "extension category" is itself an extraneous concept-- an extra layer of interface depth, an extra thing to learn before you can say "hello world". Extension points should be clearly supported and documented with whatever interfaces make sense. Developers who wish to add something that is conceptually equivalent to an extension category can do so directly, in the manner that suites their needs, without us forcing a common method on them.
|
||||
|
||||
## Reduce number and depth of extension points
|
||||
|
||||
Clearly specify supported extension points (e.g. persistence, model providers, telemetry providers, routes, time systems), but don't claim that the system has a clear and perfect repeatable solution for unknown extension types. New extension categories can be implemented in whatever way makes sense, without prescribing "the one and only system for managing extensions".
|
||||
|
||||
The underlying problem here is we are predicting needs for extension points where none exist-- if we try and design the extension system before we know how it is used, we design the wrong thing and have to rewrite it later.
|
||||
|
||||
## Composite services should not be the default
|
||||
|
||||
Understanding composite services, and describing services as composite services can confuse developers. Aggregators are implemented once and forgotten, while decorators tend to be hacky, brittle solutions that are generally needed to avoid circular imports. While composite services are a useful construct, it reduces interface depth to implement them as registries + typed providers.
|
||||
|
||||
You can write a provider (provides "thing x" for "inputs y") with a simple interface. A provider has two or more methods:
|
||||
* a method which takes "inputs y" and returns True if it knows how to provide "thing x", false otherwise.
|
||||
* one or more methods which provide "thing x" for objects of "inputs y".
|
||||
|
||||
Actually checking whether a provider can respond to a request before asking it to do work allows for faster failure and clearer errors when no providers match the request.
|
||||
|
||||
## Get rid of views, representations, and templates.
|
||||
|
||||
Templates are an implementation detail that should be handled by module loaders. Views and representations become "components," and a new concept, "routes", is used to exposing specific views to end users.
|
||||
|
||||
`components` - building blocks for views, have clear inputs and outputs, and can be coupled to other components when it makes sense. (e.g. parent-child components such as menu and menu item), but should have ZERO knowledge of our data models or telemetry apis. They should define data models that enable them to do their job well while still being easy to test.
|
||||
|
||||
`routes` - a view type for a given domain object, e.g. a plot, table, display layout, etc. Can be described as "whatever shows in the main screen when you are viewing an object." Handle loading of data from a domain object and passing that data to the view components. Routes should support editing as it makes sense in their own context.
|
||||
|
||||
To facilitate testing:
|
||||
|
||||
* routes should be testable without having to test the actual view.
|
||||
* components should be independently testable with zero knowledge of our data models or telemetry APIs.
|
||||
|
||||
Component code should be organized side by side, such as:
|
||||
|
||||
```
|
||||
app
|
||||
|- components
|
||||
|- productDetail
|
||||
| |- productDetail.js
|
||||
| |- productDetail.css
|
||||
| |- productDetail.html
|
||||
| |- productDetailSpec.js
|
||||
|- productList
|
||||
|- checkout
|
||||
|- wishlist
|
||||
```
|
||||
|
||||
Components are not always reusable, and we shouldn't be overly concerned with making them so. If components are heavily reused, they should either be moved to a platform feature (e.g. notifications, indicators), or broken off as an external dependency (e.g. publish mct-plot as mct-plot.js).
|
||||
|
||||
|
||||
# Reducing interface depth (The angular discussion)
|
||||
|
||||
Two options here: use more angular, use less angular. Wrapping angular methods does not reduce interface depth and must be avoided.
|
||||
|
||||
The primary issue with angular is duplications of concerns-- both angular and the openmctweb platform implement the same tools side by side and it can be hard to comprehend-- it increases interface depth. For other concerns, see footnotes[1].
|
||||
|
||||
Wrapping angular methods for non-view related code is confusing to developers because of the random constraints angular places on these items-- developers ultimately have to understand both angular DI and our framework. For example, it's not possible to name the topic service "topicService" because angular expects Services to be implemented by Providers, which is different than our expectation.
|
||||
|
||||
To reduce interface depth, we can replace our own provider and registry patterns with angular patterns, or we can only utilize angular view logic, and only use our own DI patterns.
|
||||
|
||||
## More angular: for all services
|
||||
|
||||
Increasing our commitment to angular would mean using more of the angular factorys, services, etc, and less of our home grown tools. We'd implement our services and extension points as angular providers, and make them configurable via app.config.
|
||||
|
||||
As an example, registering a specific type of model provider in angular would look like:
|
||||
|
||||
```javascript
|
||||
mct.provider('model', modelProvider() { /* implementation */});
|
||||
|
||||
mct.config(['modelProvider', function (modelProvider) {
|
||||
modelProvider.providers.push(RootModelProvider);
|
||||
}]);
|
||||
```
|
||||
|
||||
## Less angular: only for views
|
||||
|
||||
If we wish to use less angular, I would recommend discontinuing use of all angular components that are not view related-- services, factories, $http, etc, and implementing them in our own paradigm. Otherwise, we end up with layered interfaces-- one of the goals we would like to avoid.
|
||||
|
||||
|
||||
# Standard packaging and build system
|
||||
|
||||
Standardize the packaging and build system, and completely separate the core platform from deployments. Prescribe a starting point for deployments, but allow flexibility.
|
||||
|
||||
## Use systemjs for module loading
|
||||
|
||||
Allow developers to use whatever module loading system they'd like to use, while still supporting all standard cases. We should also use this system for loading assets (css, scss, html templates), which makes it easier to implement a single file deployment using standard build tooling.
|
||||
|
||||
## Use gulp or grunt for standard tooling
|
||||
|
||||
Using gulp or grunt as a task runner would bring us in line with standard web developer workflows and help standardize rendering, deployment, and packaging. Additional tools can be added to the workflow at low cost, simplifying the set up of developer environments.
|
||||
|
||||
Gulp and grunt provide useful developer tooling such as live reload, automatic scss/less/etc compiliation, and ease of extensibility for standard production build processes. They're key in decoupling code.
|
||||
|
||||
## Package openmctweb as single versioned file.
|
||||
|
||||
Deployments should depend on a specific version of openmctweb, but otherwise be allowed to have their own deployment and development toolsets.
|
||||
|
||||
Customizations and deployments of openmctweb should not use the same build tooling as the core platform; instead they should be free to use their own build tools as they wish. (We would provide a template for an application, based on our experience with warp-for-rp and vista)
|
||||
|
||||
Installation and utilization of openmctweb should be as simple as downloading the js file, including it in your own html page, and then initializing an app and running it. If a developer would prefer, they could use bower or npm to handle installation.
|
||||
|
||||
Then, if we're using imperative methods for extending the application we can use the following for basic customization:
|
||||
|
||||
```html
|
||||
<script src="//localhost/openmctweb.js"></script>
|
||||
<script>
|
||||
// can configure from object
|
||||
var myApp = new OpenMCTWeb({
|
||||
persitence: {
|
||||
providers: [
|
||||
{
|
||||
type: 'elastic',
|
||||
uri: 'http://someElasticHost/'
|
||||
} // ...
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
// alternative configurations
|
||||
myApp.persistence.addProvider(MyPersistenceAdapter);
|
||||
myApp.model.addProvider(someProviderObject);
|
||||
|
||||
// Removing via method
|
||||
myApp.persistence.removeProvider('some method for removing functionality');
|
||||
// directly mutating providers
|
||||
myApp.persistence.providers = [ThisProviderStandsAlone];
|
||||
//
|
||||
myApp.run();
|
||||
</script>
|
||||
```
|
||||
|
||||
This packaging reduces the complexity of managing multiple deployed versions, and also allows us to provide users with incredibly simple tutorials-- they can use whatever tooling they like. For instance, a hello world tutorial may take the option of "exposing a new object in the tree".
|
||||
|
||||
```javascript
|
||||
var myApp = new OpenMCTWeb();
|
||||
myApp.roots.addRoot({
|
||||
id: 'myRoot',
|
||||
name: 'Hello World!',
|
||||
});
|
||||
myApp.routes.setDefault('myRoot');
|
||||
myApp.run();
|
||||
```
|
||||
|
||||
# Misc Improvements
|
||||
|
||||
## Refresh on navigation
|
||||
In cases where navigation events change the entire screen, we should be using routes and location changes to navigate between objects. We should be using href for all navigation events.
|
||||
|
||||
At the same time, navigating should refresh state of every visible object. A properly configured persistence store will handle caching with standard cache headers and 304 not modified responses, which will provide good performance of object reloads, while helping us ensure that objects are always in sync between clients.
|
||||
|
||||
View state (say, the expanded tree nodes) should not be tied to caching of data-- it should be something we intentionally persist and restore with each navigation. Data (such as object definitions) should be reloaded from server as necessary to restore state.
|
||||
|
||||
## Move persistence adapter to promise rejection.
|
||||
Simple: reject on fail, resolve on success.
|
||||
|
||||
## Remove bulk requests from providers
|
||||
|
||||
Aggregators can request multiple things at once, but individual providers should only have to implement handling at the level of a single request. Each provider can implement it's own internal batching, but it should support making requests at a finer level of detail.
|
||||
|
||||
Excessive wrapping of code with $q.all causes additional digest cycles and decreased performance.
|
||||
|
||||
For example, instead of every telemetry provider responding to a given telemetry request, aggregators should route each request to the first provider that can fulfill that request.
|
||||
|
||||
|
||||
# Notes on current API proposals:
|
||||
|
||||
* [RequireJS for Dependency Injection](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#requirejs-as-dependency-injector): requires other topics to be discussed first.
|
||||
* [Arbitrary HTML Views](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#arbitrary-html-views): think there is a place for it, requires other topics to be discussed first.
|
||||
* [Wrap Angular Services](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#wrap-angular-services): No, this is bad.
|
||||
* [Bundle definitions in Javascript](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#bundle-declarations-in-javascript): Points to a solution, but ultimately requires more discussion.
|
||||
* [pass around a dependency injector](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#pass-around-a-dependency-injector): No.
|
||||
* [remove partial constructors](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#remove-partial-constructors): Yes, this should be superseded by another proposal though. The entire concept was a messy solution to dependency injection issues caused by declarative syntax.
|
||||
* [Rename views to applications](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#rename-views-to-applications): Points to a problem that needs to be solved but I think the name is bad.
|
||||
* [Provide classes for extensions](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#provide-classes-for-extensions): Yes, in specific places
|
||||
* [Normalize naming conventions](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#normalize-naming-conventions): Yes.
|
||||
* [Expose no third-party APIs](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#expose-no-third-party-apis): Completely disagree, points to a real problem with poor angular integration.
|
||||
* [Register Extensions as Instances instead of Constructors](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#register-extensions-as-instances-instead-of-constructors): Superseded by the fact that we should not hope to implement a generic construct.
|
||||
* [Remove capability delegation](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#remove-capability-delegation): Yes.
|
||||
* [Nomenclature Change](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#nomenclature-change): Yes, hope to discuss the implications of this more clearly in other proposals.
|
||||
* [Capabilities as mixins](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#capabilities-as-mixins): Yes.
|
||||
* [Remove appliesTo methods](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#remove-applies-to-methods): No-- I think some level of this is necessary. I think a more holistic approach to policy is needed. it's a rather complicated system.
|
||||
* [Revise telemetry API](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#revise-telemetry-api): If we can rough out and agree to the specifics, then Yes. Needs discussion.
|
||||
* [Allow composite services to fail gracefully](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#allow-composite-services-to-fail-gracefully): No. As mentioned above, I think composite services themselves should be eliminated for a more purpose bound tool.
|
||||
* [Plugins as angular modules](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#plugins-as-angular-modules): Should we decide to embrace Angular completely, I would support this. Otherwise, no.
|
||||
* [Contextual Injection](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#contextual-injection): No, don't see a need.
|
||||
* [Add New Abstractions for Actions](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#add-new-abstractions-for-actions): Worth a discussion.
|
||||
* [Add gesture handlers](https://github.com/nasa/openmctweb/blob/api-redesign/docs/src/design/proposals/APIRedesign.md#add-gesture-handlers): Yes if we can agree on details. We need a platform implementation that is easy to use, but we should not reinvent the wheel.
|
||||
|
||||
|
||||
|
||||
# [1] Footnote: The angular debacle
|
||||
|
||||
## "Do or do not, there is no try"
|
||||
|
||||
A commonly voiced concern of embracing angular is the possibility of becoming dependent on a third party framework. This concern is itself detrimental-- if we're afraid of becoming dependent on a third party framework, then we will do a bad job of using the framework, and inevitably will want to stop using it.
|
||||
|
||||
If we're using a framework, we need to use it fully, or not use it at all.
|
||||
|
||||
## A lack of commitment
|
||||
|
||||
A number of the concerns we heard from developers and interns can be attributed to the tenuous relationship between the OpenMCTWeb platform and angular. We claimed to be angular, but we weren't really angular. Instead, we are caught between our incomplete framework paradigm and the angular paradigm. In many cases we reinvented the wheel or worked around functionality that angular provides, and ended up in a more confusing state.
|
||||
|
||||
## Commitment is good!
|
||||
|
||||
We could just be an application that is built with angular.
|
||||
|
||||
An application that is modular and extensible not because it reinvents tools for providing modularity and extensibility, but because it reuses existing tools for modularity and extensibility.
|
||||
|
||||
There are benefits to buying into the angular paradigm: shift documentation burden to external project, engage a larger talent pool available both as voluntary open source contributors and as experienced developers for hire, and gain access to an ecosystem of tools that we can use to increase the speed of development.
|
||||
|
||||
There are negatives too: Angular is a monolith, it has performance concerns, and an unclear future. If we can't live with it, we should look at alternatives.
|
||||
|
||||
164
docs/src/design/proposals/ImperativePlugins.md
Normal file
164
docs/src/design/proposals/ImperativePlugins.md
Normal file
@@ -0,0 +1,164 @@
|
||||
# Imperative Plugins
|
||||
|
||||
This is a design proposal for handling
|
||||
[bundle declarations in JavaScript](
|
||||
APIRedesign.md#bundle-declarations-in-javascript).
|
||||
|
||||
## Developer Use Cases
|
||||
|
||||
Developers will want to use bundles/plugins to (in rough order
|
||||
of occurrence):
|
||||
|
||||
1. Add new extension instances.
|
||||
2. Use existing services
|
||||
3. Add new service implementations.
|
||||
4. Decorate service implementations.
|
||||
5. Decorate extension instances.
|
||||
6. Add new types of services.
|
||||
7. Add new extension categories.
|
||||
|
||||
Notably, bullets 4 and 5 above are currently handled implicitly,
|
||||
which has been cited as a source of confusion.
|
||||
|
||||
## Interfaces
|
||||
|
||||
Two base classes may be used to satisfy these use cases:
|
||||
|
||||
* The `CompositeServiceFactory` provides composite service instances.
|
||||
Decorators may be added; the approach used for compositing may be
|
||||
modified; and individual services may be registered to support compositing.
|
||||
* The `ExtensionRegistry` allows for the simpler case where what is desired
|
||||
is an array of all instances of some kind of thing within the system.
|
||||
|
||||
Note that additional developer use cases may be supported by using the
|
||||
more general-purpose `Registry`
|
||||
|
||||
```nomnoml
|
||||
[Factory.<T, V>
|
||||
|
|
||||
- factoryFn : function (V) : T
|
||||
|
|
||||
+ decorate(decoratorFn : function (T, V) : T, options? : RegistrationOptions)
|
||||
]-:>[function (V) : T]
|
||||
|
||||
[RegistrationOptions |
|
||||
+ priority : number or string
|
||||
]
|
||||
|
||||
[Registry.<T, V>
|
||||
|
|
||||
- compositorFn : function (Array.<T>) : V
|
||||
|
|
||||
+ register(item : T, options? : RegistrationOptions)
|
||||
+ composite(compositorFn : function (Array.<T>) : V, options? : RegistrationOptions)
|
||||
]-:>[Factory.<V, Void>]
|
||||
[Factory.<V, Void>]-:>[Factory.<T, V>]
|
||||
|
||||
[ExtensionRegistry.<T>]-:>[Registry.<T, Array.<T>>]
|
||||
[Registry.<T, Array.<T>>]-:>[Registry.<T, V>]
|
||||
|
||||
[CompositeServiceFactory.<T>]-:>[Registry.<T, T>]
|
||||
[Registry.<T, T>]-:>[Registry.<T, V>]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### 1. Add new extension instances.
|
||||
|
||||
```js
|
||||
// Instance-style registration
|
||||
mct.types.register(new mct.Type({
|
||||
key: "timeline",
|
||||
name: "Timeline",
|
||||
description: "A container for activities ordered in time."
|
||||
});
|
||||
|
||||
// Factory-style registration
|
||||
mct.actions.register(function (domainObject) {
|
||||
return new RemoveAction(domainObject);
|
||||
}, { priority: 200 });
|
||||
```
|
||||
|
||||
### 2. Use existing services
|
||||
|
||||
```js
|
||||
mct.actions.register(function (domainObject) {
|
||||
var dialogService = mct.ui.dialogServiceFactory();
|
||||
return new PropertiesAction(dialogService, domainObject);
|
||||
});
|
||||
```
|
||||
|
||||
### 3. Add new service implementations
|
||||
|
||||
```js
|
||||
// Instance-style registration
|
||||
mct.persistenceServiceFactory.register(new LocalPersistenceService());
|
||||
|
||||
// Factory-style registration
|
||||
mct.persistenceServiceFactory.register(function () {
|
||||
var $http = angular.injector(['ng']).get('$http');
|
||||
return new LocalPersistenceService($http);
|
||||
});
|
||||
```
|
||||
|
||||
### 4. Decorate service implementations
|
||||
|
||||
```js
|
||||
mct.modelServiceFactory.decorate(function (modelService) {
|
||||
return new CachingModelDecorator(modelService);
|
||||
}, { priority: 100 });
|
||||
```
|
||||
|
||||
### 5. Decorate extension instances
|
||||
|
||||
```js
|
||||
mct.capabilities.decorate(function (capabilities) {
|
||||
return capabilities.map(decorateIfApplicable);
|
||||
});
|
||||
```
|
||||
|
||||
This use case is not well-supported by these API changes. The most
|
||||
common case for decoration is capabilities, which are under reconsideration;
|
||||
should consider handling decoration of capabilities in a different way.
|
||||
|
||||
### 6. Add new types of services
|
||||
|
||||
```js
|
||||
myModule.myServiceFactory = new mct.CompositeServiceFactory();
|
||||
|
||||
// In cases where a custom composition strategy is desired
|
||||
myModule.myServiceFactory.composite(function (services) {
|
||||
return new MyServiceCompositor(services);
|
||||
});
|
||||
```
|
||||
|
||||
### 7. Add new extension categories.
|
||||
|
||||
```js
|
||||
myModule.hamburgers = new mct.ExtensionRegistry();
|
||||
```
|
||||
|
||||
## Evaluation
|
||||
|
||||
### Benefits
|
||||
|
||||
* Encourages separation of registration from declaration (individual
|
||||
components are decoupled from the manner in which they are added
|
||||
to the architecture.)
|
||||
* Minimizes "magic." Dependencies are acquired, managed, and exposed
|
||||
using plain-old-JavaScript without any dependency injector present
|
||||
to obfuscate what is happening.
|
||||
* Offers comparable expressive power to existing APIs; can still
|
||||
extend the behavior of platform components in a variety of ways.
|
||||
* Does not force or limit formalisms to use;
|
||||
|
||||
### Detriments
|
||||
|
||||
* Does not encourage separation of dependency acquisition from
|
||||
declaration; that is, it would be quite natural using this API
|
||||
to acquire references to services during the constructor call
|
||||
to an extension or service. But, passing these in as constructor
|
||||
arguments is preferred (to separate implementation from architecture.)
|
||||
* Adds (negligible?) boilerplate relative to declarative syntax.
|
||||
* Relies on factories, increasing number of interfaces to be concerned
|
||||
with.
|
||||
138
docs/src/design/proposals/Roles.md
Normal file
138
docs/src/design/proposals/Roles.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# Roles
|
||||
|
||||
Roles are presented as an alternative formulation to capabilities
|
||||
(dynamic behavior associated with individual domain objects.)
|
||||
|
||||
Specific goals here:
|
||||
|
||||
* Dependencies of individual scripts should be clear.
|
||||
* Domain objects should be able to selectively exhibit a wide
|
||||
variety of behaviors.
|
||||
|
||||
## Developer Use Cases
|
||||
|
||||
1. Checking for the existence of behavior.
|
||||
2. Using behavior.
|
||||
3. Augmenting existing behaviors.
|
||||
4. Overriding existing behaviors.
|
||||
5. Adding new behaviors.
|
||||
|
||||
## Overview of Proposed Solution
|
||||
|
||||
Remove `getCapability` from domain objects; add roles as external
|
||||
services which can be applied to domain objects.
|
||||
|
||||
## Interfaces
|
||||
|
||||
```nomnoml
|
||||
[Factory.<T, V>
|
||||
|
|
||||
- factoryFn : function (V) : T
|
||||
|
|
||||
+ decorate(decoratorFn : function (T, V) : T, options? : RegistrationOptions)
|
||||
]-:>[function (V) : T]
|
||||
|
||||
[RegistrationOptions |
|
||||
+ priority : number or string
|
||||
]<:-[RoleOptions |
|
||||
+ validate : function (DomainObject) : boolean
|
||||
]
|
||||
|
||||
[Role.<T> |
|
||||
+ validate(domainObject : DomainObject) : boolean
|
||||
+ decorate(decoratorFn : function (T, V) : T, options? : RoleOptions)
|
||||
]-:>[Factory.<T, DomainObject>]
|
||||
[Factory.<T, DomainObject>]-:>[Factory.<T, V>]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### 1. Checking for the existence of behavior
|
||||
|
||||
```js
|
||||
function PlotViewPolicy(telemetryRole) {
|
||||
this.telemetryRole = telemetryRole;
|
||||
}
|
||||
PlotViewPolicy.prototype.allow = function (view, domainObject) {
|
||||
return this.telemetryRole.validate(domainObject);
|
||||
};
|
||||
```
|
||||
|
||||
### 2. Using behavior
|
||||
|
||||
```js
|
||||
PropertiesAction.prototype.perform = function () {
|
||||
var mutation = this.mutationRole(this.domainObject);
|
||||
return this.showDialog.then(function (newModel) {
|
||||
return mutation.mutate(function () {
|
||||
return newModel;
|
||||
});
|
||||
});
|
||||
};
|
||||
```
|
||||
|
||||
### 3. Augmenting existing behaviors
|
||||
|
||||
```js
|
||||
// Non-Angular style
|
||||
mct.roles.persistenceRole.decorate(function (persistence) {
|
||||
return new DecoratedPersistence(persistence);
|
||||
});
|
||||
|
||||
// Angular style
|
||||
myModule.decorate('persistenceRole', ['$delegate', function ($delegate) {
|
||||
return new DecoratedPersistence(persistence);
|
||||
}]);
|
||||
```
|
||||
|
||||
### 4. Overriding existing behaviors
|
||||
|
||||
```js
|
||||
// Non-Angular style
|
||||
mct.roles.persistenceRole.decorate(function (persistence, domainObject) {
|
||||
return domainObject.getModel().type === 'someType' ?
|
||||
new DifferentPersistence(domainObject) :
|
||||
persistence;
|
||||
}, {
|
||||
validate: function (domainObject, next) {
|
||||
return domainObject.getModel().type === 'someType' || next();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### 5. Adding new behaviors
|
||||
|
||||
```js
|
||||
function FooRole() {
|
||||
mct.Role.apply(this, [function (domainObject) {
|
||||
return new Foo(domainObject);
|
||||
}]);
|
||||
}
|
||||
|
||||
FooRole.prototype = Object.create(mct.Role.prototype);
|
||||
|
||||
FooRole.prototype.validate = function (domainObject) {
|
||||
return domainObject.getModel().type === 'some-type';
|
||||
};
|
||||
|
||||
//
|
||||
myModule.roles.fooRole = new FooRole();
|
||||
```
|
||||
|
||||
|
||||
## Evaluation
|
||||
|
||||
### Benefits
|
||||
|
||||
* Simplifies/standardizes augmentation or replacement of behavior associated
|
||||
with specific domain objects.
|
||||
* Minimizes number of abstractions; roles are just factories.
|
||||
* Clarifies dependencies; roles used must be declared/acquired in the
|
||||
same manner as services.
|
||||
|
||||
### Detriments
|
||||
|
||||
* Externalizes functionality which is conceptually associated with a
|
||||
domain object.
|
||||
* Relies on factories, increasing number of interfaces to be concerned
|
||||
with.
|
||||
@@ -941,6 +941,12 @@ look at field (see below) to determine which field in the model should be
|
||||
modified.
|
||||
* `ngRequired`: True if input is required.
|
||||
* `ngPattern`: The pattern to match against (for text entry)
|
||||
* `ngBlur`: A function that may be invoked to evaluate the expression
|
||||
associated with the `ng-blur` attribute associated with the control.
|
||||
* This should be called when the control has lost focus; for controls
|
||||
which simply wrap or augment `input` elements, this should be fired
|
||||
on `blur` events associated with those elements, while more complex
|
||||
custom controls may fire this at the end of more specific interactions.
|
||||
* `options`: The options for this control, as passed from the `options` property
|
||||
of an individual row definition.
|
||||
* `field`: Name of the field in `ngModel` which will hold the value for this
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title>Open MCT Web Documentation</title>
|
||||
</head>
|
||||
<body class="user-environ" ng-view>
|
||||
Sections:
|
||||
<ul>
|
||||
<li><a href="api/">API</a></li>
|
||||
<li><a href="architecture/">Architecture Overview</a></li>
|
||||
<li><a href="guide/">Developer Guide</a></li>
|
||||
<li><a href="tutorials/">Tutorials</a></li>
|
||||
<li><a href="process/">Development Process</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
35
docs/src/index.md
Normal file
35
docs/src/index.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Open MCT Web Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
Documentation is provided to support the use and development of
|
||||
Open MCT Web. It's recommended that before doing
|
||||
any development with Open MCT Web you take some time to familiarize yourself
|
||||
with the documentation below.
|
||||
|
||||
Open MCT Web provides functionality out of the box, but it's also a platform for
|
||||
building rich mission operations applications based on modern web technology.
|
||||
The platform is configured declaratively, and defines conventions for
|
||||
building on the provided capabilities by creating modular 'bundles' that
|
||||
extend the platform at a variety of extension points. The details of how to
|
||||
extend the platform are provided in the following documentation.
|
||||
|
||||
## Sections
|
||||
|
||||
* The [Architecture Overview](architecture/) describes the concepts used
|
||||
throughout Open MCT Web, and gives a high level overview of the platform's design.
|
||||
|
||||
* The [Developer's Guide](guide/) goes into more detail about how to use the
|
||||
platform and the functionality that it provides.
|
||||
|
||||
* The [Tutorials](tutorials/) give examples of extending the platform to add
|
||||
functionality,
|
||||
and integrate with data sources.
|
||||
|
||||
* The [API](api/) document is generated from inline documentation
|
||||
using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
|
||||
functions that make up the software platform.
|
||||
|
||||
* Finally, the [Development Process](process/) document describes the
|
||||
Open MCT Web software development cycle.
|
||||
|
||||
161
docs/src/process/cycle.md
Normal file
161
docs/src/process/cycle.md
Normal file
@@ -0,0 +1,161 @@
|
||||
# Development Cycle
|
||||
|
||||
Development of Open MCT Web occurs on an iterative cycle of
|
||||
sprints and releases.
|
||||
|
||||
* A _sprint_ is three weeks in duration, and represents a
|
||||
set of improvements that can be completed and tested by the
|
||||
development team. Software at the end of the sprint is
|
||||
"semi-stable"; it will have undergone reduced testing and may carry
|
||||
defects or usability issues of lower severity, particularly if
|
||||
there are workarounds.
|
||||
* A _release_ occurs every four sprints. Releases are stable, and
|
||||
will have undergone full acceptance testing to ensure that the
|
||||
software behaves correctly and usably.
|
||||
|
||||
## Roles
|
||||
|
||||
The sprint process assumes the presence of a __project manager.__
|
||||
The project manager is responsible for
|
||||
making tactical decisions about what development work will be
|
||||
performed, and for coordinating with stakeholders to arrive at
|
||||
higher-level strategic decisions about desired functionality
|
||||
and characteristics of the software, major external milestones,
|
||||
and so forth.
|
||||
|
||||
In the absence of a dedicated project manager, this role may be rotated
|
||||
among members of the development team on a per-sprint basis.
|
||||
|
||||
Responsibilities of the project manager including:
|
||||
|
||||
* Maintaining (with agreement of stakeholders) a "road map" of work
|
||||
planned for future releases/sprints; this should be higher-level,
|
||||
usually expressed as "themes",
|
||||
with just enough specificity to gauge feasibility of plans,
|
||||
relate work back to milestones, and identify longer-term
|
||||
dependencies.
|
||||
* Determining (with assistance from the rest of the team) which
|
||||
issues to work on in a given sprint and how they shall be
|
||||
assigned.
|
||||
* Pre-planning subsequent sprints to ensure that all members of the
|
||||
team always have a clear direction.
|
||||
* Scheduling and/or ensuring adherence to
|
||||
[process points](#process-points).
|
||||
* Responding to changes within the sprint (shifting priorities,
|
||||
new issues) and re-allocating work for the sprint as needed.
|
||||
|
||||
## Sprint Calendar
|
||||
|
||||
Certain [process points](#process-points) are regularly scheduled in
|
||||
the sprint cycle.
|
||||
|
||||
### Sprints by Release
|
||||
|
||||
Allocation of work among sprints should be planned relative to release
|
||||
goals and milestones. As a general guideline, higher-risk work (large
|
||||
new features which may carry new defects, major refactoring, design
|
||||
changes with uncertain effects on usability) should be allocated to
|
||||
earlier sprints, allowing for time in later sprints to ensure stability.
|
||||
|
||||
| Sprint | Focus |
|
||||
|:------:|:--------------------------------------------------------|
|
||||
| __1__ | Prototyping, design, experimentation. |
|
||||
| __2__ | New features, refinements, enhancements. |
|
||||
| __3__ | Feature completion, low-risk enhancements, bug fixing. |
|
||||
| __4__ | Stability & quality assurance. |
|
||||
|
||||
### Sprints 1-3
|
||||
|
||||
The first three sprints of a release are primarily centered around
|
||||
development work, with regular acceptance testing in the third
|
||||
week. During this third week, the top priority should be passing
|
||||
acceptance testing (e.g. by resolving any blockers found); any
|
||||
resources not needed for this effort should be used to begin work
|
||||
for the subsequent sprint.
|
||||
|
||||
| Week | Mon | Tue | Wed | Thu | Fri |
|
||||
|:-----:|:-------------------------:|:------:|:---:|:----------------------------:|:-----------:|
|
||||
| __1__ | Sprint plan | Tag-up | | | |
|
||||
| __2__ | | Tag-up | | | Code freeze |
|
||||
| __3__ | Per-sprint testing | Triage | | _Per-sprint testing*_ | Ship |
|
||||
|
||||
* If necessary.
|
||||
|
||||
### Sprint 4
|
||||
|
||||
The software must be stable at the end of the fourth sprint; because of
|
||||
this, the fourth sprint is scheduled differently, with a heightened
|
||||
emphasis on testing.
|
||||
|
||||
| Week | Mon | Tue | Wed | Thu | Fri |
|
||||
|-------:|:-------------------------:|:------:|:---:|:----------------------------:|:-----------:|
|
||||
| __1__ | Sprint plan | Tag-up | | | Code freeze |
|
||||
| __2__ | Per-release testing | Triage | | | |
|
||||
| __3__ | _Per-release testing*_ | Triage | | _Per-release testing*_ | Ship |
|
||||
|
||||
* If necessary.
|
||||
|
||||
## Process Points
|
||||
|
||||
* __Sprint plan.__ Project manager allocates issues based on
|
||||
theme(s) for sprint, then reviews with team. Each team member
|
||||
should have roughly two weeks of work allocated (to allow time
|
||||
in the third week for testing of work completed.)
|
||||
* Project manager should also sketch out subsequent sprint so
|
||||
that team may begin work for that sprint during the
|
||||
third week, since testing and blocker resolution is unlikely
|
||||
to require all available resources.
|
||||
* __Tag-up.__ Check in and status update among development team.
|
||||
May amend plan for sprint as-needed.
|
||||
* __Code freeze.__ Any new work from this sprint
|
||||
(features, bug fixes, enhancements) must be integrated by the
|
||||
end of the second week of the sprint. After code freeze
|
||||
(and until the end of the sprint) the only changes that should be
|
||||
merged into the master branch should directly address issues
|
||||
needed to pass acceptance testing.
|
||||
* [__Per-release Testing.__](testing/plan.md#per-release-testing)
|
||||
Structured testing with predefined
|
||||
success criteria. No release should ship without passing
|
||||
acceptance tests. Time is allocated in each sprint for subsequent
|
||||
rounds of acceptance testing if issues are identified during a
|
||||
prior round. Specific details of acceptance testing need to be
|
||||
agreed-upon with relevant stakeholders and delivery recipients,
|
||||
and should be flexible enough to allow changes to plans
|
||||
(e.g. deferring delivery of some feature in order to ensure
|
||||
stability of other features.) Baseline testing includes:
|
||||
* [__Testathon.__](testing/plan.md#user-testing)
|
||||
Multi-user testing, involving as many users as
|
||||
is feasible, plus development team. Open-ended; should verify
|
||||
completed work from this sprint, test exploratorily for
|
||||
regressions, et cetera.
|
||||
* [__Long-Duration Test.__](testing/plan.md#long-duration-testing) A
|
||||
test to verify that the software remains
|
||||
stable after running for longer durations. May include some
|
||||
combination of automated testing and user verification (e.g.
|
||||
checking to verify that software remains subjectively
|
||||
responsive at conclusion of test.)
|
||||
* [__Unit Testing.__](testing/plan.md#unit-testing)
|
||||
Automated testing integrated into the
|
||||
build. (These tests are verified to pass more often than once
|
||||
per sprint, as they run before any merge to master, but still
|
||||
play an important role in per-release testing.)
|
||||
* [__Per-sprint Testing.__](testing/plan.md#per-sprint-testing)
|
||||
Subset of Pre-release Testing
|
||||
which should be performed before shipping at the end of any
|
||||
sprint. Time is allocated for a second round of
|
||||
Pre-release Testing if the first round is not passed.
|
||||
* __Triage.__ Team reviews issues from acceptance testing and uses
|
||||
success criteria to determine whether or not they should block
|
||||
release, then formulates a plan to address these issues before
|
||||
the next round of acceptance testing. Focus here should be on
|
||||
ensuring software passes that testing in order to ship on time;
|
||||
may prefer to disable malfunctioning components and fix them
|
||||
in a subsequent sprint, for example.
|
||||
* __Ship.__ Tag a code snapshot that has passed acceptance
|
||||
testing and deploy that version. (Only true if acceptance
|
||||
testing has passed by this point; if acceptance testing has not
|
||||
been passed, will need to make ad hoc decisions with stakeholders,
|
||||
e.g. "extend the sprint" or "defer shipment until end of next
|
||||
sprint.")
|
||||
|
||||
|
||||
@@ -1,156 +1,13 @@
|
||||
# Development Cycle
|
||||
|
||||
Development of Open MCT Web occurs on an iterative cycle of
|
||||
sprints and releases.
|
||||
|
||||
* A _sprint_ is three weeks in duration, and represents a
|
||||
set of improvements that can be completed and tested by the
|
||||
development team. Software at the end of the sprint is
|
||||
"semi-stable"; it will have undergone reduced testing and may carry
|
||||
defects or usability issues of lower severity, particularly if
|
||||
there are workarounds.
|
||||
* A _release_ occurs every four sprints. Releases are stable, and
|
||||
will have undergone full acceptance testing to ensure that the
|
||||
software behaves correctly and usably.
|
||||
|
||||
## Roles
|
||||
|
||||
The sprint process assumes the presence of a __project manager.__
|
||||
The project manager is responsible for
|
||||
making tactical decisions about what development work will be
|
||||
performed, and for coordinating with stakeholders to arrive at
|
||||
higher-level strategic decisions about desired functionality
|
||||
and characteristics of the software, major external milestones,
|
||||
and so forth.
|
||||
|
||||
In the absence of a dedicated project manager, this role may be rotated
|
||||
among members of the development team on a per-sprint basis.
|
||||
|
||||
Responsibilities of the project manager including:
|
||||
|
||||
* Maintaining (with agreement of stakeholders) a "road map" of work
|
||||
planned for future releases/sprints; this should be higher-level,
|
||||
usually expressed as "themes",
|
||||
with just enough specificity to gauge feasibility of plans,
|
||||
relate work back to milestones, and identify longer-term
|
||||
dependencies.
|
||||
* Determining (with assistance from the rest of the team) which
|
||||
issues to work on in a given sprint and how they shall be
|
||||
assigned.
|
||||
* Pre-planning subsequent sprints to ensure that all members of the
|
||||
team always have a clear direction.
|
||||
* Scheduling and/or ensuring adherence to
|
||||
[process points](#process-points).
|
||||
* Responding to changes within the sprint (shifting priorities,
|
||||
new issues) and re-allocating work for the sprint as needed.
|
||||
|
||||
## Sprint Calendar
|
||||
|
||||
Certain [process points](#process-points) are regularly scheduled in
|
||||
the sprint cycle.
|
||||
|
||||
### Sprints by Release
|
||||
|
||||
Allocation of work among sprints should be planned relative to release
|
||||
goals and milestones. As a general guideline, higher-risk work (large
|
||||
new features which may carry new defects, major refactoring, design
|
||||
changes with uncertain effects on usability) should be allocated to
|
||||
earlier sprints, allowing for time in later sprints to ensure stability.
|
||||
|
||||
| Sprint | Focus |
|
||||
|:------:|:--------------------------------------------------------|
|
||||
| __1__ | Prototyping, design, experimentation. |
|
||||
| __2__ | New features, refinements, enhancements. |
|
||||
| __3__ | Feature completion, low-risk enhancements, bug fixing. |
|
||||
| __4__ | Stability & quality assurance. |
|
||||
|
||||
### Sprints 1-3
|
||||
|
||||
The first three sprints of a release are primarily centered around
|
||||
development work, with regular acceptance testing in the third
|
||||
week. During this third week, the top priority should be passing
|
||||
acceptance testing (e.g. by resolving any blockers found); any
|
||||
resources not needed for this effort should be used to begin work
|
||||
for the subsequent sprint.
|
||||
|
||||
| Week | Mon | Tue | Wed | Thu | Fri |
|
||||
|:-----:|:-------------------------:|:------:|:---:|:----------------------------:|:-----------:|
|
||||
| __1__ | Sprint plan | Tag-up | | | |
|
||||
| __2__ | | Tag-up | | | Code freeze |
|
||||
| __3__ | Sprint acceptance testing | Triage | | _Sprint acceptance testing*_ | Ship |
|
||||
|
||||
* If necessary.
|
||||
|
||||
### Sprint 4
|
||||
|
||||
The software must be stable at the end of the fourth sprint; because of
|
||||
this, the fourth sprint is scheduled differently, with a heightened
|
||||
emphasis on testing.
|
||||
|
||||
| Week | Mon | Tue | Wed | Thu | Fri |
|
||||
|-------:|:-------------------------:|:------:|:---:|:----------------------------:|:-----------:|
|
||||
| __1__ | Sprint plan | Tag-up | | | Code freeze |
|
||||
| __2__ | Acceptance testing | Triage | | | |
|
||||
| __3__ | _Acceptance testing*_ | Triage | | _Acceptance testing*_ | Ship |
|
||||
|
||||
* If necessary.
|
||||
|
||||
## Process Points
|
||||
|
||||
* __Sprint plan.__ Project manager allocates issues based on
|
||||
theme(s) for sprint, then reviews with team. Each team member
|
||||
should have roughly two weeks of work allocated (to allow time
|
||||
in the third week for testing of work completed.)
|
||||
* Project manager should also sketch out subsequent sprint so
|
||||
that team may begin work for that sprint during the
|
||||
third week, since testing and blocker resolution is unlikely
|
||||
to require all available resources.
|
||||
* __Tag-up.__ Check in and status update among development team.
|
||||
May amend plan for sprint as-needed.
|
||||
* __Code freeze.__ Any new work from this sprint
|
||||
(features, bug fixes, enhancements) must be integrated by the
|
||||
end of the second week of the sprint. After code freeze
|
||||
(and until the end of the sprint) the only changes that should be
|
||||
merged into the master branch should directly address issues
|
||||
needed to pass acceptance testing.
|
||||
* __Acceptance Testing.__ Structured testing with predefined
|
||||
success criteria. No release should ship without passing
|
||||
acceptance tests. Time is allocated in each sprint for subsequent
|
||||
rounds of acceptance testing if issues are identified during a
|
||||
prior round. Specific details of acceptance testing need to be
|
||||
agreed-upon with relevant stakeholders and delivery recipients,
|
||||
and should be flexible enough to allow changes to plans
|
||||
(e.g. deferring delivery of some feature in order to ensure
|
||||
stability of other features.) Baseline testing includes:
|
||||
* __Testathon.__ Multi-user testing, involving as many users as
|
||||
is feasible, plus development team. Open-ended; should verify
|
||||
completed work from this sprint, test exploratorily for
|
||||
regressions, et cetera.
|
||||
* __24-Hour Test.__ A test to verify that the software remains
|
||||
stable after running for longer durations. May include some
|
||||
combination of automated testing and user verification (e.g.
|
||||
checking to verify that software remains subjectively
|
||||
responsive at conclusion of test.)
|
||||
* __Automated Testing.__ Automated testing integrated into the
|
||||
build. (These tests are verified to pass more often than once
|
||||
per sprint, as they run before any merge to master, but still
|
||||
play an important role in acceptance testing.)
|
||||
* __Sprint Acceptance Testing.__ Subset of Acceptance Testing
|
||||
which should be performed before shipping at the end of any
|
||||
sprint. Time is allocated for a second round of
|
||||
Sprint Acceptance Testing if the first round is not passed.
|
||||
* __Triage.__ Team reviews issues from acceptance testing and uses
|
||||
success criteria to determine whether or not they should block
|
||||
release, then formulates a plan to address these issues before
|
||||
the next round of acceptance testing. Focus here should be on
|
||||
ensuring software passes that testing in order to ship on time;
|
||||
may prefer to disable malfunctioning components and fix them
|
||||
in a subsequent sprint, for example.
|
||||
* __Ship.__ Tag a code snapshot that has passed acceptance
|
||||
testing and deploy that version. (Only true if acceptance
|
||||
testing has passed by this point; if acceptance testing has not
|
||||
been passed, will need to make ad hoc decisions with stakeholders,
|
||||
e.g. "extend the sprint" or "defer shipment until end of next
|
||||
sprint.")
|
||||
# Development Process
|
||||
|
||||
The process used to develop Open MCT Web is described in the following
|
||||
documents:
|
||||
|
||||
* [Development Cycle](cycle.md): Describes how and when specific
|
||||
process points are repeated during development.
|
||||
* Testing is described in two documents:
|
||||
* The [Test Plan](testing/plan.md) summarizes the approaches used
|
||||
to test Open MCT Web.
|
||||
* The [Test Procedures](testing/procedures.md) document what
|
||||
specific tests are performed to verify correctness, and how
|
||||
they should be carried out.
|
||||
|
||||
127
docs/src/process/testing/plan.md
Normal file
127
docs/src/process/testing/plan.md
Normal file
@@ -0,0 +1,127 @@
|
||||
# Test Plan
|
||||
|
||||
## Test Levels
|
||||
|
||||
Testing for Open MCT Web includes:
|
||||
|
||||
* _Smoke testing_: Brief, informal testing to verify that no major issues
|
||||
or regressions are present in the software, or in specific features of
|
||||
the software.
|
||||
* _Unit testing_: Automated verification of the performance of individual
|
||||
software components.
|
||||
* _User testing_: Testing with a representative user base to verify
|
||||
that application behaves usably and as specified.
|
||||
* _Long-duration testing_: Testing which takes place over a long period
|
||||
of time to detect issues which are not readily noticeable during
|
||||
shorter test periods.
|
||||
|
||||
### Smoke Testing
|
||||
|
||||
Manual, non-rigorous testing of the software and/or specific features
|
||||
of interest. Verifies that the software runs and that basic functionality
|
||||
is present.
|
||||
|
||||
### Unit Testing
|
||||
|
||||
Unit tests are automated tests which exercise individual software
|
||||
components. Tests are subject to code review along with the actual
|
||||
implementation, to ensure that tests are applicable and useful.
|
||||
|
||||
Unit tests should meet
|
||||
[test standards](https://github.com/nasa/openmctweb/blob/master/CONTRIBUTING.md#test-standards)
|
||||
as described in the contributing guide.
|
||||
|
||||
### User Testing
|
||||
|
||||
User testing is performed at scheduled times involving target users
|
||||
of the software or reasonable representatives, along with members of
|
||||
the development team exercising known use cases. Users test the
|
||||
software directly; the software should be configured as similarly to
|
||||
its planned production configuration as is feasible without introducing
|
||||
other risks (e.g. damage to data in a production instance.)
|
||||
|
||||
User testing will focus on the following activities:
|
||||
|
||||
* Verifying issues resolved since the last test session.
|
||||
* Checking for regressions in areas related to recent changes.
|
||||
* Using major or important features of the software,
|
||||
as determined by the user.
|
||||
* General "trying to break things."
|
||||
|
||||
During user testing, users will
|
||||
[report issues](https://github.com/nasa/openmctweb/blob/master/CONTRIBUTING.md#issue-reporting)
|
||||
as they are encountered.
|
||||
|
||||
Desired outcomes of user testing are:
|
||||
|
||||
* Identified software defects.
|
||||
* Areas for usability improvement.
|
||||
* Feature requests (particularly missed requirements.)
|
||||
* Recorded issue verification.
|
||||
|
||||
### Long-duration Testing
|
||||
|
||||
Long-duration testing occurs over a twenty-four hour period. The
|
||||
software is run in one or more stressing cases representative of expected
|
||||
usage. After twenty-four hours, the software is evaluated for:
|
||||
|
||||
* Performance metrics: Have memory usage or CPU utilization increased
|
||||
during this time period in unexpected or undesirable ways?
|
||||
* Subjective usability: Does the software behave in the same way it did
|
||||
at the start of the test? Is it as responsive?
|
||||
|
||||
Any defects or unexpected behavior identified during testing should be
|
||||
[reported as issues](https://github.com/nasa/openmctweb/blob/master/CONTRIBUTING.md#issue-reporting)
|
||||
and reviewed for severity.
|
||||
|
||||
## Test Performance
|
||||
|
||||
Tests are performed at various levels of frequency.
|
||||
|
||||
* _Per-merge_: Performed before any new changes are integrated into
|
||||
the software.
|
||||
* _Per-sprint_: Performed at the end of every [sprint](../cycle.md).
|
||||
* _Per-release_: Performed at the end of every [release](../cycle.md).
|
||||
|
||||
### Per-merge Testing
|
||||
|
||||
Before changes are merged, the author of the changes must perform:
|
||||
|
||||
* _Smoke testing_ (both generally, and for areas which interact with
|
||||
the new changes.)
|
||||
* _Unit testing_ (as part of the automated build step.)
|
||||
|
||||
Changes are not merged until the author has affirmed that both
|
||||
forms of testing have been performed successfully; this is documented
|
||||
by the [Author Checklist](https://github.com/nasa/openmctweb/blob/master/CONTRIBUTING.md#author-checklist).
|
||||
|
||||
### Per-sprint Testing
|
||||
|
||||
Before a sprint is closed, the development team must additionally
|
||||
perform:
|
||||
|
||||
* A relevant subset of [_user testing_](procedures.md#user-test-procedures)
|
||||
identified by the acting [project manager](../cycle.md#roles).
|
||||
* [_Long-duration testing_](procedures.md#long-duration-testng)
|
||||
(specifically, for 24 hours.)
|
||||
|
||||
Issues are reported as a product of both forms of testing.
|
||||
|
||||
A sprint is not closed until both categories have been performed on
|
||||
the latest snapshot of the software, _and_ no issues labelled as
|
||||
["blocker"](https://github.com/nasa/openmctweb/blob/master/CONTRIBUTING.md#issue-reporting)
|
||||
remain open.
|
||||
|
||||
### Per-release Testing
|
||||
|
||||
As [per-sprint testing](#per-sprint-testing), except that _user testing_
|
||||
should cover all test cases, with less focus on changes from the specific
|
||||
sprint or release.
|
||||
|
||||
Per-release testing should also include any acceptance testing steps
|
||||
agreed upon with recipients of the software.
|
||||
|
||||
A release is not closed until both categories have been performed on
|
||||
the latest snapshot of the software, _and_ no issues labelled as
|
||||
["blocker" or "critical"](https://github.com/nasa/openmctweb/blob/master/CONTRIBUTING.md#issue-reporting)
|
||||
remain open.
|
||||
169
docs/src/process/testing/procedures.md
Normal file
169
docs/src/process/testing/procedures.md
Normal file
@@ -0,0 +1,169 @@
|
||||
# Test Procedures
|
||||
|
||||
## Introduction
|
||||
|
||||
This document is intended to be used:
|
||||
|
||||
* By testers, to verify that Open MCT Web behaves as specified.
|
||||
* By the development team, to document new test cases and to provide
|
||||
guidance on how to author these.
|
||||
|
||||
## Writing Procedures
|
||||
|
||||
### Template
|
||||
|
||||
Procedures for individual tests should use the following template,
|
||||
adapted from [https://swehb.nasa.gov/display/7150/SWE-114]().
|
||||
|
||||
Property | Value
|
||||
---------------|---------------------------------------------------------------
|
||||
Test ID |
|
||||
Relevant reqs. |
|
||||
Prerequisites |
|
||||
Test input |
|
||||
Instructions |
|
||||
Expectation |
|
||||
Eval. criteria |
|
||||
|
||||
For multi-line descriptions, use an asterisk or similar indicator to refer
|
||||
to a longer-form description below.
|
||||
|
||||
#### Example Procedure - Edit a Layout
|
||||
|
||||
Property | Value
|
||||
---------------|---------------------------------------------------------------
|
||||
Test ID | MCT-TEST-000X - Edit a layout
|
||||
Relevant reqs. | MCT-EDIT-000Y
|
||||
Prerequisites | Create a layout, as in MCT-TEST-000Z
|
||||
Test input | Domain object database XYZ
|
||||
Instructions | See below *
|
||||
Expectation | Change to editing context †
|
||||
Eval. criteria | Visual inspection
|
||||
|
||||
* Follow the following steps:
|
||||
|
||||
1. Verify that the created layout is currently navigated-to,
|
||||
as in MCT-TEST-00ZZ.
|
||||
2. Click the Edit button, identified by a pencil icon and the text "Edit"
|
||||
displayed on hover.
|
||||
|
||||
† Right-hand viewing area should be surrounded by a dashed
|
||||
blue border when a domain object is being edited.
|
||||
|
||||
### Guidelines
|
||||
|
||||
Test procedures should be written assuming minimal prior knowledge of the
|
||||
application: Non-standard terms should only be used when they are documented
|
||||
in [the glossary](#glossary), and shorthands used for user actions should
|
||||
be accompanied by useful references to test procedures describing those
|
||||
actions (when available) or descriptions in user documentation.
|
||||
|
||||
Test cases should be narrow in scope; if a list of steps is excessively
|
||||
long (or must be written vaguely to be kept short) it should be broken
|
||||
down into multiple tests which reference one another.
|
||||
|
||||
All requirements satisfied by Open MCT Web should be verifiable using
|
||||
one or more test procedures.
|
||||
|
||||
## Glossary
|
||||
|
||||
This section will contain terms used in test procedures. This may link to
|
||||
a common glossary, to avoid replication of content.
|
||||
|
||||
## Procedures
|
||||
|
||||
This section will contain specific test procedures. Presently, procedures
|
||||
are placeholders describing general patterns for setting up and conducting
|
||||
testing.
|
||||
|
||||
### User Testing Setup
|
||||
|
||||
These procedures describes a general pattern for setting up for user
|
||||
testing. Specific deployments should customize this pattern with
|
||||
relevant data and any additional steps necessary.
|
||||
|
||||
Property | Value
|
||||
---------------|---------------------------------------------------------------
|
||||
Test ID | MCT-TEST-SETUP0 - User Testing Setup
|
||||
Relevant reqs. | TBD
|
||||
Prerequisites | Build of relevant components
|
||||
Test input | Exemplary database; exemplary telemetry data set
|
||||
Instructions | See below
|
||||
Expectation | Able to load application in a web browser (Google Chrome)
|
||||
Eval. criteria | Visual inspection
|
||||
|
||||
Instructions:
|
||||
|
||||
1. Start telemetry server.
|
||||
2. Start ElasticSearch.
|
||||
3. Restore database snapshot to ElasticSearch.
|
||||
4. Start telemetry playback.
|
||||
5. Start HTTP server for client sources.
|
||||
|
||||
### User Test Procedures
|
||||
|
||||
Specific user test cases have not yet been authored. In their absence,
|
||||
user testing is conducted by:
|
||||
|
||||
* Reviewing the text of issues from the issue tracker to understand the
|
||||
desired behavior, and exercising this behavior in the running application.
|
||||
(For instance, by following steps to reproduce from the original issue.)
|
||||
* Issues which appear to be resolved should be marked as such with comments
|
||||
on the original issue (e.g. "verified during user testing MM/DD/YYYY".)
|
||||
* Issues which appear not to have been resolved should be reopened with an
|
||||
explanation of what unexpected behavior has been observed.
|
||||
* In cases where an issue appears resolved as-worded but other related
|
||||
undesirable behavior is observed during testing, a new issue should be
|
||||
opened, and linked to from a comment in the original issues.
|
||||
* General usage of new features and/or existing features which have undergone
|
||||
recent changes. Defects or problems with usability should be documented
|
||||
by filing issues in the issue tracker.
|
||||
* Open-ended testing to discover defects, identify usability issues, and
|
||||
generate feature requests.
|
||||
|
||||
### Long-Duration Testing
|
||||
|
||||
The purpose of long-duration testing is to identify performance issues
|
||||
and/or other defects which are sensitive to the amount of time the
|
||||
application is kept running. (Memory leaks, for instance.)
|
||||
|
||||
Property | Value
|
||||
---------------|---------------------------------------------------------------
|
||||
Test ID | MCT-TEST-LDT0 - Long-duration Testing
|
||||
Relevant reqs. | TBD
|
||||
Prerequisites | MCT-TEST-SETUP0
|
||||
Test input | (As for test setup.)
|
||||
Instructions | See "Instructions" below *
|
||||
Expectation | See "Expectations" below †
|
||||
Eval. criteria | Visual inspection
|
||||
|
||||
* Instructions:
|
||||
|
||||
1. Start `top` or a similar tool to measure CPU usage and memory utilization.
|
||||
2. Open several user-created displays (as many as would be realistically
|
||||
opened during actual usage in a stressing case) in some combination of
|
||||
separate tabs and windows (approximately as many tabs-per-window as
|
||||
total windows.)
|
||||
3. Ensure that playback data is set to run continuously for at least 24 hours
|
||||
(e.g. on a loop.)
|
||||
4. Record CPU usage and memory utilization.
|
||||
5. In at least one tab, try some general user interface gestures and make
|
||||
notes about the subjective experience of using the application. (Particularly,
|
||||
the degree of responsiveness.)
|
||||
6. Leave client displays open for 24 hours.
|
||||
7. Record CPU usage and memory utilization again.
|
||||
8. Make additional notes about the subjective experience of using the
|
||||
application (again, particularly responsiveness.)
|
||||
9. Check logs for any unexpected warnings or errors.
|
||||
|
||||
† Expectations:
|
||||
|
||||
* At the end of the test, CPU usage and memory usage should both be similar
|
||||
to their levels at the start of the test.
|
||||
* At the end of the test, subjective usage of the application should not
|
||||
be observably different from the way it was at the start of the test.
|
||||
(In particular, responsiveness should not decrease.)
|
||||
* Logs should not contain any unexpected warnings or errors ("expected"
|
||||
warnings or errors are those that have been documented and prioritized
|
||||
as known issues, or those that are explained by transient conditions
|
||||
external to the software, such as network outages.)
|
||||
@@ -1697,8 +1697,7 @@ Next, we utilize this functionality from the template:
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
'''
|
||||
|
||||
```
|
||||
__tutorials/bargraph/res/templates/bargraph.html__
|
||||
|
||||
Here, we utilize the functions we just provided from the controller to position
|
||||
|
||||
@@ -39,8 +39,11 @@ define(
|
||||
start = Date.now();
|
||||
|
||||
function update() {
|
||||
var secs = (Date.now() - start) / 1000;
|
||||
var now = Date.now(),
|
||||
secs = (now - start) / 1000;
|
||||
displayed = Math.round(digests / secs);
|
||||
start = now;
|
||||
digests = 0;
|
||||
}
|
||||
|
||||
function increment() {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"jshint": "jshint platform example || exit 0",
|
||||
"watch": "karma start",
|
||||
"jsdoc": "jsdoc -c jsdoc.json -r -d target/docs/api",
|
||||
"otherdoc": "node docs/gendocs.js --in docs/src --out target/docs",
|
||||
"otherdoc": "node docs/gendocs.js --in docs/src --out target/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
|
||||
"docs": "npm run jsdoc ; npm run otherdoc"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -102,6 +102,12 @@
|
||||
"implementation": "navigation/NavigationService.js"
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"implementation": "creation/CreationPolicy.js",
|
||||
"category": "creation"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"key": "navigate",
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span ng-controller="BrowseObjectController">
|
||||
<div class="object-browse-bar l-flex-row">
|
||||
<div ng-controller="BrowseObjectController" class="abs l-flex-col">
|
||||
<div class="holder flex-elem l-flex-row object-browse-bar ">
|
||||
<div class="items-select left flex-elem l-flex-row grows">
|
||||
<mct-representation key="'back-arrow'"
|
||||
mct-object="domainObject"
|
||||
@@ -43,8 +43,26 @@
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div>
|
||||
<mct-representation key="representation.selected.key"
|
||||
mct-object="representation.selected.key && domainObject"
|
||||
class="abs object-holder">
|
||||
</mct-representation>
|
||||
</span>
|
||||
<div class="holder l-flex-col flex-elem grows l-object-wrapper">
|
||||
<div class="holder l-flex-col flex-elem grows l-object-wrapper-inner">
|
||||
<!-- Toolbar and Save/Cancel buttons -->
|
||||
<div class="l-edit-controls flex-elem l-flex-row flex-align-end">
|
||||
<mct-toolbar name="mctToolbar"
|
||||
structure="toolbar.structure"
|
||||
ng-model="toolbar.state"
|
||||
class="flex-elem grows">
|
||||
</mct-toolbar>
|
||||
<mct-representation key="'edit-action-buttons'"
|
||||
mct-object="domainObject"
|
||||
class='flex-elem conclude-editing'>
|
||||
</mct-representation>
|
||||
|
||||
</div>
|
||||
<mct-representation key="representation.selected.key"
|
||||
mct-object="representation.selected.key && domainObject"
|
||||
class="abs flex-elem grows object-holder-main scroll"
|
||||
toolbar="toolbar">
|
||||
</mct-representation>
|
||||
</div><!--/ l-object-wrapper-inner -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
|
||||
<div class="abs holder-all browse-mode" ng-controller="BrowseController">
|
||||
<div class="abs holder-all" ng-controller="BrowseController">
|
||||
<mct-include key="'topbar-browse'"></mct-include>
|
||||
<div class="abs holder holder-main browse-area s-browse-area browse-wrapper"
|
||||
ng-controller="PaneController as modelPaneTree"
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
<div class="split-pane-component t-inspect pane right mobile-hide">
|
||||
<mct-representation key="'object-inspector'"
|
||||
mct-object="domainObject"
|
||||
mct-object="navigatedObject"
|
||||
ng-model="treeModel">
|
||||
</mct-representation>
|
||||
<a class="mini-tab-icon anchor-right mobile-hide toggle-pane toggle-inspect"
|
||||
|
||||
@@ -71,10 +71,14 @@ define(
|
||||
// Callback for updating the in-scope reference to the object
|
||||
// that is currently navigated-to.
|
||||
function setNavigation(domainObject) {
|
||||
//If the domain object has editor capability, retrieve the
|
||||
// original uneditable domain object
|
||||
var nonEditableObject = domainObject.hasCapability("editor") ? domainObject.getCapability("editor").getDomainObject() : domainObject;
|
||||
|
||||
$scope.navigatedObject = domainObject;
|
||||
$scope.treeModel.selectedObject = domainObject;
|
||||
$scope.treeModel.selectedObject = nonEditableObject;
|
||||
navigationService.setNavigation(domainObject);
|
||||
updateRoute(domainObject);
|
||||
updateRoute(nonEditableObject);
|
||||
}
|
||||
|
||||
function navigateTo(domainObject) {
|
||||
|
||||
@@ -69,7 +69,7 @@ define(
|
||||
|
||||
// Introduce one create action per type
|
||||
return this.typeService.listTypes().filter(function (type) {
|
||||
return type.hasFeature("creation");
|
||||
return self.policyService.allow("creation", type);
|
||||
}).map(function (type) {
|
||||
return new CreateAction(
|
||||
type,
|
||||
|
||||
45
platform/commonUI/browse/src/creation/CreationPolicy.js
Normal file
45
platform/commonUI/browse/src/creation/CreationPolicy.js
Normal file
@@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A policy for determining whether objects of a given type can be
|
||||
* created.
|
||||
* @constructor
|
||||
* @implements {Policy}
|
||||
* @memberof platform/commonUI/browse
|
||||
*/
|
||||
function CreationPolicy() {
|
||||
}
|
||||
|
||||
CreationPolicy.prototype.allow = function (type) {
|
||||
return type.hasFeature("creation");
|
||||
};
|
||||
|
||||
return CreationPolicy;
|
||||
}
|
||||
);
|
||||
@@ -50,6 +50,7 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "$on", "$watch" ]
|
||||
@@ -82,11 +83,11 @@ define(
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
||||
[ "getId", "hasCapability", "getCapability", "getModel", "useCapability" ]
|
||||
);
|
||||
mockNextObject = jasmine.createSpyObj(
|
||||
"nextObject",
|
||||
[ "getId", "getCapability", "getModel", "useCapability" ]
|
||||
[ "getId", "hasCapability", "getCapability", "getModel", "useCapability" ]
|
||||
);
|
||||
|
||||
mockObjectService.getObjects.andReturn(mockPromise({
|
||||
@@ -98,9 +99,13 @@ define(
|
||||
mockDomainObject.useCapability.andReturn(mockPromise([
|
||||
mockNextObject
|
||||
]));
|
||||
|
||||
mockNextObject.useCapability.andReturn(undefined);
|
||||
mockNextObject.getId.andReturn("next");
|
||||
mockNextObject.hasCapability.andReturn(false);
|
||||
|
||||
mockDomainObject.getId.andReturn("mine");
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
|
||||
controller = new BrowseController(
|
||||
mockScope,
|
||||
|
||||
@@ -33,6 +33,9 @@ define(
|
||||
var mockTypeService,
|
||||
mockDialogService,
|
||||
mockCreationService,
|
||||
mockPolicyService,
|
||||
mockCreationPolicy,
|
||||
mockPolicyMap = {},
|
||||
mockTypes,
|
||||
provider;
|
||||
|
||||
@@ -67,14 +70,32 @@ define(
|
||||
"creationService",
|
||||
[ "createObject" ]
|
||||
);
|
||||
mockPolicyService = jasmine.createSpyObj(
|
||||
"policyService",
|
||||
[ "allow" ]
|
||||
);
|
||||
|
||||
mockTypes = [ "A", "B", "C" ].map(createMockType);
|
||||
|
||||
mockTypes.forEach(function(type){
|
||||
mockPolicyMap[type.getName()] = true;
|
||||
});
|
||||
|
||||
mockCreationPolicy = function(type){
|
||||
return mockPolicyMap[type.getName()];
|
||||
};
|
||||
|
||||
mockPolicyService.allow.andCallFake(function(category, type){
|
||||
return category === "creation" && mockCreationPolicy(type) ? true : false;
|
||||
});
|
||||
|
||||
mockTypeService.listTypes.andReturn(mockTypes);
|
||||
|
||||
provider = new CreateActionProvider(
|
||||
mockTypeService,
|
||||
mockDialogService,
|
||||
mockCreationService
|
||||
mockCreationService,
|
||||
mockPolicyService
|
||||
);
|
||||
});
|
||||
|
||||
@@ -94,15 +115,15 @@ define(
|
||||
|
||||
it("does not expose non-creatable types", function () {
|
||||
// One of the types won't have the creation feature...
|
||||
mockTypes[1].hasFeature.andReturn(false);
|
||||
mockPolicyMap[mockTypes[0].getName()] = false;
|
||||
// ...so it should have been filtered out.
|
||||
expect(provider.getActions({
|
||||
key: "create",
|
||||
domainObject: {}
|
||||
}).length).toEqual(2);
|
||||
// Make sure it was creation which was used to check
|
||||
expect(mockTypes[1].hasFeature)
|
||||
.toHaveBeenCalledWith("creation");
|
||||
expect(mockPolicyService.allow)
|
||||
.toHaveBeenCalledWith("creation", mockTypes[0]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
53
platform/commonUI/browse/test/creation/CreationPolicySpec.js
Normal file
53
platform/commonUI/browse/test/creation/CreationPolicySpec.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/creation/CreationPolicy"],
|
||||
function (CreationPolicy) {
|
||||
"use strict";
|
||||
|
||||
describe("The creation policy", function () {
|
||||
var mockType,
|
||||
policy;
|
||||
|
||||
beforeEach(function () {
|
||||
mockType = jasmine.createSpyObj(
|
||||
'type',
|
||||
['hasFeature']
|
||||
);
|
||||
|
||||
policy = new CreationPolicy();
|
||||
});
|
||||
|
||||
it("allows creation of types with the creation feature", function () {
|
||||
mockType.hasFeature.andReturn(true);
|
||||
expect(policy.allow(mockType)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("disallows creation of types without the creation feature", function () {
|
||||
mockType.hasFeature.andReturn(false);
|
||||
expect(policy.allow(mockType)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -8,6 +8,7 @@
|
||||
"creation/CreateMenuController",
|
||||
"creation/CreateWizard",
|
||||
"creation/CreationService",
|
||||
"creation/CreationPolicy",
|
||||
"creation/LocatorController",
|
||||
"navigation/NavigateAction",
|
||||
"navigation/NavigationService",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
{
|
||||
"key": "edit",
|
||||
"implementation": "actions/EditAction.js",
|
||||
"depends": [ "$location", "navigationService", "$log" ],
|
||||
"depends": [ "$q", "navigationService", "$log" ],
|
||||
"description": "Edit this object.",
|
||||
"category": "view-control",
|
||||
"glyph": "p"
|
||||
@@ -67,7 +67,7 @@
|
||||
"implementation": "actions/SaveAction.js",
|
||||
"name": "Save",
|
||||
"description": "Save changes made to these objects.",
|
||||
"depends": [ "$location", "urlService" ],
|
||||
"depends": [ "navigationService" ],
|
||||
"priority": "mandatory"
|
||||
},
|
||||
{
|
||||
@@ -76,7 +76,7 @@
|
||||
"implementation": "actions/CancelAction.js",
|
||||
"name": "Cancel",
|
||||
"description": "Discard changes made to these objects.",
|
||||
"depends": [ "$location", "urlService" ]
|
||||
"depends": ["navigationService" ]
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
-->
|
||||
<span ng-controller="EditActionController">
|
||||
<span ng-repeat="currentAction in editActions">
|
||||
<a class='s-btn'
|
||||
<a class='s-btn t-{{currentAction.getMetadata().key}}'
|
||||
title='{{currentAction.getMetadata().name}}'
|
||||
ng-click="currentAction.perform()"
|
||||
ng-class="{ major: $index === 0, subtle: $index !== 0 }">
|
||||
{{currentAction.getMetadata().name}}
|
||||
ng-class="{ major: $index === 0 }">
|
||||
<span class="title-label">{{currentAction.getMetadata().name}}</span>
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
@@ -24,7 +24,9 @@
|
||||
<ul class="tree">
|
||||
<li ng-repeat="containedObject in composition">
|
||||
<span class="tree-item">
|
||||
<mct-representation key="'label'" mct-object="containedObject">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="containedObject"
|
||||
class="rep-object-label">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
@@ -33,10 +33,9 @@ define(
|
||||
* @memberof platform/commonUI/edit
|
||||
* @implements {Action}
|
||||
*/
|
||||
function CancelAction($location, urlService, context) {
|
||||
function CancelAction(navigationService, context) {
|
||||
this.domainObject = context.domainObject;
|
||||
this.$location = $location;
|
||||
this.urlService = urlService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,8 +46,7 @@ define(
|
||||
*/
|
||||
CancelAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject,
|
||||
$location = this.$location,
|
||||
urlService = this.urlService;
|
||||
navigationService = this.navigationService;
|
||||
|
||||
// Look up the object's "editor.completion" capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
@@ -64,13 +62,9 @@ define(
|
||||
return editor.cancel();
|
||||
}
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
function returnToBrowse() {
|
||||
$location.path($location.path(urlService.urlForLocation(
|
||||
"browse",
|
||||
domainObject
|
||||
)));
|
||||
//Return navigation state to the non-editable version of the object.
|
||||
function returnToBrowse(nonEditableDomainObject) {
|
||||
navigationService.setNavigation(nonEditableDomainObject);
|
||||
}
|
||||
|
||||
return doCancel(getEditorCapability())
|
||||
@@ -86,7 +80,7 @@ define(
|
||||
CancelAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject !== undefined &&
|
||||
domainObject.hasCapability("editor");
|
||||
domainObject.getCapability('status').get('editing');
|
||||
};
|
||||
|
||||
return CancelAction;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* Module defining EditAction. Created by vwoeltje on 11/14/14.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
['../objects/EditableDomainObject'],
|
||||
function (EditableDomainObject) {
|
||||
"use strict";
|
||||
|
||||
// A no-op action to return in the event that the action cannot
|
||||
@@ -46,7 +46,7 @@ define(
|
||||
* @constructor
|
||||
* @implements {Action}
|
||||
*/
|
||||
function EditAction($location, navigationService, $log, context) {
|
||||
function EditAction($q, navigationService, $log, context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
|
||||
// We cannot enter Edit mode if we have no domain object to
|
||||
@@ -63,16 +63,20 @@ define(
|
||||
}
|
||||
|
||||
this.domainObject = domainObject;
|
||||
this.$location = $location;
|
||||
this.navigationService = navigationService;
|
||||
this.$q = $q;
|
||||
}
|
||||
|
||||
EditAction.prototype.createEditableObject = function(domainObject) {
|
||||
return new EditableDomainObject(domainObject, this.$q);
|
||||
};
|
||||
|
||||
/**
|
||||
* Enter edit mode.
|
||||
*/
|
||||
EditAction.prototype.perform = function () {
|
||||
this.navigationService.setNavigation(this.domainObject);
|
||||
this.$location.path("/edit");
|
||||
this.domainObject.getCapability('status').set('editing', true);
|
||||
this.navigationService.setNavigation(this.createEditableObject(this.domainObject));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -85,8 +89,11 @@ define(
|
||||
var domainObject = (context || {}).domainObject,
|
||||
type = domainObject && domainObject.getCapability('type');
|
||||
|
||||
// Only allow creatable types to be edited
|
||||
return type && type.hasFeature('creation');
|
||||
// Only allow creatable types to be edited, and objects that are
|
||||
// not already being edited
|
||||
return type
|
||||
&& type.hasFeature('creation')
|
||||
&& !domainObject.getCapability('status').get('editing');
|
||||
};
|
||||
|
||||
return EditAction;
|
||||
|
||||
@@ -34,10 +34,9 @@ define(
|
||||
* @implements {Action}
|
||||
* @memberof platform/commonUI/edit
|
||||
*/
|
||||
function SaveAction($location, urlService, context) {
|
||||
function SaveAction(navigationService, context) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.$location = $location;
|
||||
this.urlService = urlService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,8 +48,7 @@ define(
|
||||
*/
|
||||
SaveAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject,
|
||||
$location = this.$location,
|
||||
urlService = this.urlService;
|
||||
navigationService = this.navigationService;
|
||||
|
||||
// Invoke any save behavior introduced by the editor capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
@@ -62,11 +60,8 @@ define(
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
function returnToBrowse() {
|
||||
return $location.path(urlService.urlForLocation(
|
||||
"browse",
|
||||
domainObject
|
||||
));
|
||||
function returnToBrowse(nonEditableDomainObject) {
|
||||
navigationService.setNavigation(nonEditableDomainObject);
|
||||
}
|
||||
|
||||
return doSave().then(returnToBrowse);
|
||||
@@ -81,7 +76,7 @@ define(
|
||||
SaveAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject !== undefined &&
|
||||
domainObject.hasCapability("editor");
|
||||
domainObject.getCapability("status").get("editing");
|
||||
};
|
||||
|
||||
return SaveAction;
|
||||
|
||||
@@ -50,7 +50,7 @@ define(
|
||||
// Simply trigger refresh of in-view objects; do not
|
||||
// write anything to database.
|
||||
persistence.persist = function () {
|
||||
cache.markDirty(editableObject);
|
||||
return cache.markDirty(editableObject);
|
||||
};
|
||||
|
||||
// Delegate refresh to the original object; this avoids refreshing
|
||||
|
||||
@@ -95,9 +95,16 @@ define(
|
||||
return domainObject.getCapability('persistence').persist();
|
||||
}
|
||||
|
||||
return nonrecursive ?
|
||||
resolvePromise(doMutate()).then(doPersist) :
|
||||
resolvePromise(cache.saveAll());
|
||||
function saveChanges() {
|
||||
return nonrecursive ?
|
||||
resolvePromise(doMutate()).then(doPersist) :
|
||||
resolvePromise(cache.saveAll());
|
||||
}
|
||||
|
||||
return saveChanges().then(function(){
|
||||
domainObject.getCapability('status').set('editing', false);
|
||||
return domainObject;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -109,7 +116,8 @@ define(
|
||||
* @memberof platform/commonUI/edit.EditorCapability#
|
||||
*/
|
||||
EditorCapability.prototype.cancel = function () {
|
||||
return resolvePromise(undefined);
|
||||
this.domainObject.getCapability('status').set('editing', false);
|
||||
return resolvePromise(this.domainObject);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -121,6 +129,10 @@ define(
|
||||
return this.cache.dirty();
|
||||
};
|
||||
|
||||
EditorCapability.prototype.getDomainObject = function () {
|
||||
return this.domainObject;
|
||||
};
|
||||
|
||||
return EditorCapability;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -111,6 +111,7 @@ define(
|
||||
*/
|
||||
EditableDomainObjectCache.prototype.markDirty = function (domainObject) {
|
||||
this.dirtyObjects[domainObject.getId()] = domainObject;
|
||||
return this.$q.when(true);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,6 +47,7 @@ define(
|
||||
*/
|
||||
function EditRepresenter($q, $log, scope) {
|
||||
var self = this;
|
||||
this.scope = scope;
|
||||
|
||||
// Mutate and persist a new version of a domain object's model.
|
||||
function doPersist(model) {
|
||||
@@ -100,6 +101,7 @@ define(
|
||||
this.key = (representation || {}).key;
|
||||
// Track the represented object
|
||||
this.domainObject = representedObject;
|
||||
this.scope.editMode = representedObject.hasCapability("status") && representedObject.getCapability("status").get("editing");
|
||||
// Ensure existing watches are released
|
||||
this.destroy();
|
||||
};
|
||||
|
||||
@@ -27,10 +27,11 @@ define(
|
||||
"use strict";
|
||||
|
||||
describe("The Cancel action", function () {
|
||||
var mockLocation,
|
||||
mockDomainObject,
|
||||
var mockDomainObject,
|
||||
mockCapabilities,
|
||||
mockEditorCapability,
|
||||
mockUrlService,
|
||||
mockStatusCapability,
|
||||
mockNavigationService,
|
||||
actionContext,
|
||||
action;
|
||||
|
||||
@@ -43,45 +44,50 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
"$location",
|
||||
[ "path" ]
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getCapability", "hasCapability" ]
|
||||
[ "getCapability" ]
|
||||
);
|
||||
mockEditorCapability = jasmine.createSpyObj(
|
||||
"editor",
|
||||
[ "save", "cancel" ]
|
||||
);
|
||||
mockUrlService = jasmine.createSpyObj(
|
||||
"urlService",
|
||||
["urlForLocation"]
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"status",
|
||||
[ "get"]
|
||||
);
|
||||
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
["setNavigation"]
|
||||
);
|
||||
mockCapabilities = {
|
||||
"editor": mockEditorCapability,
|
||||
"status": mockStatusCapability
|
||||
};
|
||||
actionContext = {
|
||||
domainObject: mockDomainObject
|
||||
};
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(mockEditorCapability);
|
||||
mockEditorCapability.cancel.andReturn(mockPromise(true));
|
||||
mockDomainObject.getCapability.andCallFake(function(capability){
|
||||
return mockCapabilities[capability];
|
||||
});
|
||||
|
||||
action = new CancelAction(mockLocation, mockUrlService, actionContext);
|
||||
mockEditorCapability.cancel.andReturn(mockPromise(mockDomainObject));
|
||||
mockStatusCapability.get.andReturn(true);
|
||||
|
||||
action = new CancelAction( mockNavigationService, actionContext);
|
||||
|
||||
});
|
||||
|
||||
it("only applies to domain object with an editor capability", function () {
|
||||
it("only applies to domain object that is being edited", function () {
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeTruthy();
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.getCapability.andReturn(undefined);
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("invokes the editor capability's save functionality when performed", function () {
|
||||
it("invokes the editor capability's cancel functionality when" +
|
||||
" performed", function () {
|
||||
// Verify precondition
|
||||
expect(mockEditorCapability.cancel).not.toHaveBeenCalled();
|
||||
action.perform();
|
||||
@@ -95,8 +101,8 @@ define(
|
||||
|
||||
it("returns to browse when performed", function () {
|
||||
action.perform();
|
||||
expect(mockLocation.path).toHaveBeenCalledWith(
|
||||
mockUrlService.urlForLocation("browse", mockDomainObject)
|
||||
expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(
|
||||
mockDomainObject
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,27 +19,41 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,describe,it,expect,beforeEach,jasmine*/
|
||||
/*global define,describe,it,expect,beforeEach,jasmine,spyOn*/
|
||||
|
||||
define(
|
||||
["../../src/actions/EditAction"],
|
||||
[
|
||||
"../../src/actions/EditAction"
|
||||
],
|
||||
function (EditAction) {
|
||||
"use strict";
|
||||
|
||||
describe("The Edit action", function () {
|
||||
var mockLocation,
|
||||
mockNavigationService,
|
||||
var mockNavigationService,
|
||||
mockLog,
|
||||
mockDomainObject,
|
||||
mockStatusCapability,
|
||||
mockType,
|
||||
actionContext,
|
||||
mockCapabilities,
|
||||
mockQ,
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
then: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
"$location",
|
||||
[ "path" ]
|
||||
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"statusCapability",
|
||||
[ "get", "set" ]
|
||||
);
|
||||
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
[ "setNavigation", "getNavigation" ]
|
||||
@@ -50,20 +64,41 @@ define(
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getModel", "getCapability" ]
|
||||
[ "getId", "getModel", "getCapability", "hasCapability" ]
|
||||
);
|
||||
mockType = jasmine.createSpyObj(
|
||||
"type",
|
||||
[ "hasFeature" ]
|
||||
);
|
||||
|
||||
mockDomainObject.getCapability.andReturn(mockType);
|
||||
mockQ = jasmine.createSpyObj(
|
||||
"q",
|
||||
[ "when", "all" ]
|
||||
);
|
||||
|
||||
mockQ.when.andReturn(function(value){
|
||||
return mockPromise(value);
|
||||
});
|
||||
|
||||
mockQ.all.andReturn(mockPromise(undefined));
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function(capability){
|
||||
return mockCapabilities[capability];
|
||||
});
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.getId.andReturn("testId");
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
|
||||
mockCapabilities = {
|
||||
"status": mockStatusCapability,
|
||||
"type": mockType
|
||||
};
|
||||
|
||||
actionContext = { domainObject: mockDomainObject };
|
||||
|
||||
action = new EditAction(
|
||||
mockLocation,
|
||||
mockQ,
|
||||
mockNavigationService,
|
||||
mockLog,
|
||||
actionContext
|
||||
@@ -77,15 +112,30 @@ define(
|
||||
expect(mockType.hasFeature).toHaveBeenCalledWith('creation');
|
||||
});
|
||||
|
||||
it("changes URL path to edit mode when performed", function () {
|
||||
it("is only applicable when domain object is not in edit mode", function () {
|
||||
// Indicates whether object is in edit mode
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
expect(EditAction.appliesTo(actionContext)).toBeTruthy();
|
||||
mockStatusCapability.get.andReturn(true);
|
||||
expect(EditAction.appliesTo(actionContext)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("navigates to editable domain object", function () {
|
||||
spyOn(action, 'createEditableObject');
|
||||
|
||||
action.perform();
|
||||
expect(mockLocation.path).toHaveBeenCalledWith("/edit");
|
||||
|
||||
expect(mockNavigationService.setNavigation).toHaveBeenCalled();
|
||||
expect(action.createEditableObject).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("ensures that the edited object is navigated-to", function () {
|
||||
var navigatedObject;
|
||||
action.perform();
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDomainObject);
|
||||
navigatedObject = mockNavigationService.setNavigation.mostRecentCall.args[0];
|
||||
expect(navigatedObject.getId())
|
||||
.toEqual(mockDomainObject.getId());
|
||||
expect(navigatedObject).not.toBe(mockDomainObject);
|
||||
});
|
||||
|
||||
it("logs a warning if constructed when inapplicable", function () {
|
||||
@@ -94,7 +144,7 @@ define(
|
||||
|
||||
// Should not have hit an exception...
|
||||
new EditAction(
|
||||
mockLocation,
|
||||
mockQ,
|
||||
mockNavigationService,
|
||||
mockLog,
|
||||
{}
|
||||
@@ -104,8 +154,6 @@ define(
|
||||
expect(mockLog.warn).toHaveBeenCalled();
|
||||
|
||||
// And should not have had other interactions
|
||||
expect(mockLocation.path)
|
||||
.not.toHaveBeenCalled();
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -27,10 +27,11 @@ define(
|
||||
"use strict";
|
||||
|
||||
describe("The Save action", function () {
|
||||
var mockLocation,
|
||||
mockDomainObject,
|
||||
var mockDomainObject,
|
||||
mockNavigationService,
|
||||
mockStatusCapability,
|
||||
mockEditorCapability,
|
||||
mockUrlService,
|
||||
mockCapabilities,
|
||||
actionContext,
|
||||
action;
|
||||
|
||||
@@ -43,10 +44,6 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
"$location",
|
||||
[ "path" ]
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getCapability", "hasCapability" ]
|
||||
@@ -55,30 +52,39 @@ define(
|
||||
"editor",
|
||||
[ "save", "cancel" ]
|
||||
);
|
||||
mockUrlService = jasmine.createSpyObj(
|
||||
"urlService",
|
||||
["urlForLocation"]
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"statusCapability",
|
||||
["get"]
|
||||
);
|
||||
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"mockNavigationService",
|
||||
[ "setNavigation"]
|
||||
);
|
||||
mockCapabilities = {
|
||||
"editor": mockEditorCapability,
|
||||
"status": mockStatusCapability
|
||||
};
|
||||
|
||||
actionContext = {
|
||||
domainObject: mockDomainObject
|
||||
};
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(mockEditorCapability);
|
||||
mockEditorCapability.save.andReturn(mockPromise(true));
|
||||
mockDomainObject.getCapability.andCallFake(function(capability){
|
||||
return mockCapabilities[capability];
|
||||
});
|
||||
|
||||
action = new SaveAction(mockLocation, mockUrlService, actionContext);
|
||||
mockEditorCapability.save.andReturn(mockPromise(mockDomainObject));
|
||||
mockStatusCapability.get.andReturn(true);
|
||||
|
||||
action = new SaveAction(mockNavigationService, actionContext);
|
||||
|
||||
});
|
||||
|
||||
it("only applies to domain object with an editor capability", function () {
|
||||
it("only applies to domain object that is being edited", function () {
|
||||
expect(SaveAction.appliesTo(actionContext)).toBeTruthy();
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.getCapability.andReturn(undefined);
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
expect(SaveAction.appliesTo(actionContext)).toBeFalsy();
|
||||
});
|
||||
|
||||
@@ -96,8 +102,8 @@ define(
|
||||
|
||||
it("returns to browse when performed", function () {
|
||||
action.perform();
|
||||
expect(mockLocation.path).toHaveBeenCalledWith(
|
||||
mockUrlService.urlForLocation("browse", mockDomainObject)
|
||||
expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(
|
||||
mockDomainObject
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,6 +31,7 @@ define(
|
||||
mockEditableObject,
|
||||
mockDomainObject,
|
||||
mockCache,
|
||||
mockPromise,
|
||||
capability;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -50,7 +51,9 @@ define(
|
||||
"cache",
|
||||
[ "markDirty" ]
|
||||
);
|
||||
mockPromise = jasmine.createSpyObj("promise", ["then"]);
|
||||
|
||||
mockCache.markDirty.andReturn(mockPromise);
|
||||
mockDomainObject.getCapability.andReturn(mockPersistence);
|
||||
|
||||
capability = new EditablePersistenceCapability(
|
||||
@@ -84,6 +87,10 @@ define(
|
||||
expect(mockPersistence.refresh).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns a promise from persist", function () {
|
||||
expect(capability.persist().then).toEqual(jasmine.any(Function));
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -28,6 +28,8 @@ define(
|
||||
|
||||
describe("The editor capability", function () {
|
||||
var mockPersistence,
|
||||
mockStatusCapability,
|
||||
mockCapabilities,
|
||||
mockEditableObject,
|
||||
mockDomainObject,
|
||||
mockCache,
|
||||
@@ -40,6 +42,14 @@ define(
|
||||
"persistence",
|
||||
[ "persist" ]
|
||||
);
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"status",
|
||||
[ "set" ]
|
||||
);
|
||||
mockCapabilities = {
|
||||
"persistence":mockPersistence,
|
||||
"status": mockStatusCapability
|
||||
};
|
||||
mockEditableObject = {
|
||||
getModel: function () { return model; }
|
||||
};
|
||||
@@ -53,7 +63,9 @@ define(
|
||||
);
|
||||
mockCallback = jasmine.createSpy("callback");
|
||||
|
||||
mockDomainObject.getCapability.andReturn(mockPersistence);
|
||||
mockDomainObject.getCapability.andCallFake(function(capability){
|
||||
return mockCapabilities[capability];
|
||||
});
|
||||
|
||||
model = { someKey: "some value", x: 42 };
|
||||
|
||||
@@ -96,6 +108,19 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
it("resets the editing status on successful save", function () {
|
||||
capability.save().then(mockCallback);
|
||||
|
||||
// Wait for promise to resolve
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
}, 250);
|
||||
|
||||
runs(function () {
|
||||
expect(mockStatusCapability.set).toHaveBeenCalledWith('editing', false);
|
||||
});
|
||||
});
|
||||
|
||||
it("has no interactions on cancel", function () {
|
||||
capability.cancel().then(mockCallback);
|
||||
|
||||
@@ -111,6 +136,19 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
it("resets editing status on cancel", function () {
|
||||
capability.cancel().then(mockCallback);
|
||||
|
||||
// Wait for promise to resolve
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
}, 250);
|
||||
|
||||
runs(function () {
|
||||
expect(mockStatusCapability.set).toHaveBeenCalledWith('editing', false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,7 +32,9 @@ define(
|
||||
mockScope,
|
||||
testRepresentation,
|
||||
mockDomainObject,
|
||||
mockStatusCapability,
|
||||
mockPersistence,
|
||||
mockCapabilities,
|
||||
representer;
|
||||
|
||||
function mockPromise(value) {
|
||||
@@ -57,11 +59,21 @@ define(
|
||||
]);
|
||||
mockPersistence =
|
||||
jasmine.createSpyObj("persistence", ["persist"]);
|
||||
mockStatusCapability = jasmine.createSpyObj("domainObject", [
|
||||
"get"]);
|
||||
|
||||
mockCapabilities = {
|
||||
"persistence": mockPersistence,
|
||||
"status": mockStatusCapability
|
||||
};
|
||||
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.useCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(mockPersistence);
|
||||
mockStatusCapability.get.andReturn(true);
|
||||
mockDomainObject.getCapability.andCallFake(function(capability){
|
||||
return mockCapabilities[capability];
|
||||
});
|
||||
|
||||
representer = new EditRepresenter(mockQ, mockLog, mockScope);
|
||||
representer.represent(testRepresentation, mockDomainObject);
|
||||
@@ -98,6 +110,14 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
it("sets an 'editMode' flag on scope if the object is editable", function() {
|
||||
expect(mockScope.editMode).toBe(true);
|
||||
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
representer.represent(testRepresentation, mockDomainObject);
|
||||
expect(mockScope.editMode).toBeFalsy();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
{
|
||||
"implementation": "StyleSheetLoader.js",
|
||||
"depends": [ "stylesheets[]", "$document", "THEME" ]
|
||||
},
|
||||
{
|
||||
"implementation": "UnsupportedBrowserWarning.js",
|
||||
"depends": [ "notificationService", "agentService" ]
|
||||
}
|
||||
],
|
||||
"stylesheets": [
|
||||
@@ -112,10 +116,6 @@
|
||||
"implementation": "controllers/GetterSetterController.js",
|
||||
"depends": [ "$scope" ]
|
||||
},
|
||||
{
|
||||
"key": "SplitPaneController",
|
||||
"implementation": "controllers/SplitPaneController.js"
|
||||
},
|
||||
{
|
||||
"key": "SelectorController",
|
||||
"implementation": "controllers/SelectorController.js",
|
||||
@@ -225,10 +225,6 @@
|
||||
"templateUrl": "templates/subtree.html",
|
||||
"uses": [ "composition" ]
|
||||
},
|
||||
{
|
||||
"key": "test",
|
||||
"templateUrl": "templates/test.html"
|
||||
},
|
||||
{
|
||||
"key": "tree-node",
|
||||
"templateUrl": "templates/tree-node.html",
|
||||
|
||||
@@ -35,24 +35,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.l-autoflow-header {
|
||||
bottom: auto;
|
||||
height: $headerH;
|
||||
line-height: $headerH;
|
||||
min-width: $colW;
|
||||
span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
min-width: $colW;
|
||||
.t-last-update {
|
||||
overflow: hidden;
|
||||
}
|
||||
.s-btn.change-column-width {
|
||||
@include trans-prop-nice-fade(500ms);
|
||||
opacity: 0;
|
||||
}
|
||||
.l-filter {
|
||||
margin-left: $interiorMargin;
|
||||
display: block;
|
||||
margin-right: $interiorMargin;
|
||||
input.t-filter-input {
|
||||
width: 100px;
|
||||
width: 150px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,4 +126,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.frame {
|
||||
&.child-frame.panel {
|
||||
.autoflow .l-autoflow-header .l-filter {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ $itemPadLR: 5px;
|
||||
$treeVCW: 10px;
|
||||
$treeTypeIconH: 1.4em; // was 16px
|
||||
$treeTypeIconHPx: 16px;
|
||||
$treeTypeIconW: 20px;
|
||||
$treeTypeIconW: 18px;
|
||||
$treeContextTriggerW: 20px;
|
||||
// Tabular
|
||||
$tabularHeaderH: 22px; //18px
|
||||
|
||||
@@ -31,10 +31,6 @@ a.disabled {
|
||||
border-bottom: 1px solid rgba(#fff, 0.3);
|
||||
}
|
||||
|
||||
.outline {
|
||||
@include boxOutline();
|
||||
}
|
||||
|
||||
.test-stripes {
|
||||
@include bgDiagonalStripes();
|
||||
}
|
||||
@@ -51,14 +47,11 @@ a.disabled {
|
||||
@include animation-name(pulse, 0.2);
|
||||
}
|
||||
|
||||
@include keyframes(pulse) {
|
||||
0% { opacity: 0.5; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
|
||||
@mixin pulse($dur: 500ms, $iteration: infinite) {
|
||||
//@include customKeyframes(pulse, 0.2);
|
||||
@mixin pulse($dur: 500ms, $iteration: infinite, $opacity0: 0.5, $opacity100: 1) {
|
||||
@include keyframes(pulse) {
|
||||
0% { opacity: $opacity0; }
|
||||
100% { opacity: $opacity100; }
|
||||
}
|
||||
@include animation-name(pulse);
|
||||
@include animation-duration($dur);
|
||||
@include animation-direction(alternate);
|
||||
@@ -66,6 +59,19 @@ a.disabled {
|
||||
@include animation-timing-function(ease-in-out);
|
||||
}
|
||||
|
||||
@mixin pulseBorder($c: red, $dur: 500ms, $iteration: infinite, $delay: 0s, $opacity0: 0, $opacity100: 1) {
|
||||
@include keyframes(pulseBorder) {
|
||||
0% { border-color: rgba($c, $opacity0); }
|
||||
100% { border-color: rgba($c, $opacity100); }
|
||||
}
|
||||
@include animation-name(pulseBorder);
|
||||
@include animation-duration($dur);
|
||||
@include animation-direction(alternate);
|
||||
@include animation-iteration-count($iteration);
|
||||
@include animation-timing-function(ease);
|
||||
@include animation-delay($delay);
|
||||
}
|
||||
|
||||
.pulse {
|
||||
@include pulse(750ms);
|
||||
}
|
||||
@@ -121,7 +121,12 @@ mct-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.scrolling {
|
||||
.ellipsis {
|
||||
@include ellipsize();
|
||||
}
|
||||
|
||||
.scrolling,
|
||||
.scroll {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,31 +73,34 @@
|
||||
}
|
||||
|
||||
.l-icon-alert {
|
||||
display: none !important; // Remove this when alerts are enabled
|
||||
display: none !important;
|
||||
&:before {
|
||||
color: $colorAlert;
|
||||
content: "!";
|
||||
}
|
||||
}
|
||||
|
||||
// NEW!!
|
||||
.t-item-icon {
|
||||
// Used in grid-item.html, tree-item, inspector location, more?
|
||||
@extend .ui-symbol;
|
||||
@extend .icon;
|
||||
display: inline-block;
|
||||
line-height: normal; // This is Ok for the symbolsfont
|
||||
position: relative;
|
||||
.t-item-icon-glyph {
|
||||
position: absolute;
|
||||
}
|
||||
&.l-icon-link {
|
||||
&:before {
|
||||
color: $colorIconLink;
|
||||
content: "\f4";
|
||||
height: auto; width: auto;
|
||||
position: absolute;
|
||||
left: 0; top: 0; right: 0; bottom: 10%;
|
||||
@include transform-origin(bottom, left);
|
||||
@include transform(scale(0.3));
|
||||
z-index: 2;
|
||||
.t-item-icon-glyph {
|
||||
&:before {
|
||||
color: $colorIconLink;
|
||||
content: "\f4";
|
||||
height: auto; width: auto;
|
||||
position: absolute;
|
||||
left: 0; top: 0; right: 0; bottom: 10%;
|
||||
@include transform-origin(bottom, left);
|
||||
@include transform(scale(0.3));
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
.l-inspect,
|
||||
.l-inspect table tr td {
|
||||
font-size: 0.7rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.l-inspect {
|
||||
@@ -31,6 +31,9 @@
|
||||
background: $colorInspectorBg;
|
||||
color: $colorInspectorFg;
|
||||
line-height: 140%;
|
||||
|
||||
.flex-elem.holder:not(:last-child) { margin-bottom: $interiorMargin; }
|
||||
|
||||
.pane-header {
|
||||
color: pushBack($colorInspectorFg, 20%);
|
||||
font-size: 0.8rem;
|
||||
@@ -43,6 +46,16 @@
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
.split-layout {
|
||||
.split-pane-component.pane {
|
||||
&.bottom {
|
||||
height: 30%;
|
||||
min-height: 20%;
|
||||
max-height: 80%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
@include box-sizing(border-box);
|
||||
@@ -84,12 +97,20 @@
|
||||
}
|
||||
|
||||
.inspector-location {
|
||||
//line-height: 180%;
|
||||
.location-item {
|
||||
$h: 1.2em;
|
||||
@include box-sizing(border-box);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
line-height: $h;
|
||||
position: relative;
|
||||
padding: 2px 4px;
|
||||
.t-object-label {
|
||||
.t-item-icon {
|
||||
height: $h;
|
||||
width: 0.7rem;
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background: $colorItemTreeHoverBg;
|
||||
color: $colorItemTreeHoverFg;
|
||||
@@ -104,9 +125,40 @@
|
||||
display: inline-block;
|
||||
font-family: symbolsfont;
|
||||
font-size: 8px;
|
||||
font-style: normal !important;
|
||||
line-height: inherit;
|
||||
margin-left: $interiorMarginSm;
|
||||
width: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.holder-elements {
|
||||
.current-elements {
|
||||
position: relative;
|
||||
.tree-item {
|
||||
.t-object-label {
|
||||
// Elements pool is a flat list, so don't indent items.
|
||||
font-size: 0.75rem;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.l-inspect {
|
||||
.splitter-inspect-panel,
|
||||
.split-pane-component.pane.bottom {
|
||||
@include trans-prop-nice(opacity, 250ms); // Not working as desired currently; entire inspector seems to be destroyed and recreated when switching into and out of edit mode.
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.s-status-editing .l-inspect {
|
||||
.location-item { pointer-events: none; }
|
||||
.splitter-inspect-panel,
|
||||
.split-pane-component.pane.bottom {
|
||||
opacity: 1;
|
||||
pointer-events: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
@import "overlay/overlay";
|
||||
@import "mobile/overlay/overlay";
|
||||
@import "tree/tree";
|
||||
@import "object-label";
|
||||
@import "mobile/tree";
|
||||
@import "user-environ/frame";
|
||||
@import "user-environ/top-bar";
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@mixin trans-prop-nice-resize($t: 0.5s, $tf: ease-in-out) {
|
||||
@include transition-property(height, width, top, right, bottom, left, opacity);
|
||||
@include transition-duration($t);
|
||||
@include transition-timing-function($tf);
|
||||
}
|
||||
|
||||
@mixin trans-prop-nice-resize-h($dur: 500ms, $delay: 0) {
|
||||
@include transition-property(height, bottom, top);
|
||||
@include transition-duration($dur);
|
||||
@@ -300,7 +306,7 @@
|
||||
@include desktop {
|
||||
@if $bgHov != none {
|
||||
&:not(.disabled):hover {
|
||||
background: $bgHov;
|
||||
@include background-image($bgHov);
|
||||
>.icon {
|
||||
color: lighten($ic, $ltGamma);
|
||||
}
|
||||
@@ -309,11 +315,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@mixin input-base($bg: $colorBodyBg, $fg: $colorBodyFg) {
|
||||
@mixin input-base($bg: $colorInputBg, $fg: $colorInputFg, $shdw: rgba(black, 0.6) 0 1px 3px) {
|
||||
@include appearance(none);
|
||||
@include border-radius($controlCr);
|
||||
@include box-sizing(border-box);
|
||||
@include box-shadow(inset rgba(black, 0.4) 0 1px 3px);
|
||||
@include box-shadow(inset $shdw);
|
||||
background: $bg;
|
||||
border: none;
|
||||
color: $fg;
|
||||
@@ -323,7 +329,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@mixin nice-input($bg: $colorBodyBg, $fg: $colorBodyFg) {
|
||||
@mixin nice-input($bg: $colorInputBg, $fg: $colorInputFg) {
|
||||
@include input-base($bg, $fg);
|
||||
padding: 0 $interiorMarginSm;
|
||||
}
|
||||
|
||||
69
platform/commonUI/general/res/sass/_object-label.scss
Normal file
69
platform/commonUI/general/res/sass/_object-label.scss
Normal file
@@ -0,0 +1,69 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
// mct-representation surrounding an object-label key="'label'"
|
||||
.rep-object-label {
|
||||
@include flex-direction(row);
|
||||
@include flex(1 1 auto);
|
||||
height: inherit;
|
||||
line-height: inherit;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.t-object-label {
|
||||
.t-item-icon {
|
||||
margin-right: $interiorMargin;
|
||||
}
|
||||
}
|
||||
|
||||
mct-representation {
|
||||
&.s-status-pending {
|
||||
.t-object-label {
|
||||
.t-item-icon {
|
||||
&:before {
|
||||
$spinBW: 4px;
|
||||
$spinD: 0;
|
||||
@include spinner($spinBW);
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
padding: 30%;
|
||||
width: $spinD;
|
||||
height: $spinD;
|
||||
}
|
||||
.t-item-icon-glyph {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.t-title-label {
|
||||
font-style: italic;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.selected mct-representation.s-status-pending .t-object-label .t-item-icon:before {
|
||||
border-color: rgba($colorItemTreeSelectedFg, 0.25);
|
||||
border-top-color: rgba($colorItemTreeSelectedFg, 1.0);
|
||||
}
|
||||
@@ -35,6 +35,7 @@ $pad: $interiorMargin * $baseRatio;
|
||||
@include box-sizing(border-box);
|
||||
padding: 0 $pad;
|
||||
font-size: 0.7rem;
|
||||
vertical-align: top;
|
||||
|
||||
.icon {
|
||||
font-size: 0.8rem;
|
||||
@@ -70,6 +71,18 @@ $pad: $interiorMargin * $baseRatio;
|
||||
&.pause-play {
|
||||
|
||||
}
|
||||
&.t-save:before {
|
||||
content:'\e612';
|
||||
font-family: symbolsfont;
|
||||
margin-right: $interiorMarginSm;
|
||||
}
|
||||
&.t-cancel {
|
||||
.title-label { display: none; }
|
||||
&:before {
|
||||
content:'\78';
|
||||
font-family: symbolsfont;
|
||||
}
|
||||
}
|
||||
|
||||
&.pause-play {
|
||||
.icon:before {
|
||||
@@ -95,10 +108,7 @@ $pad: $interiorMargin * $baseRatio;
|
||||
|
||||
.s-icon-btn {
|
||||
@extend .ui-symbol;
|
||||
color: $colorBtnIcon;
|
||||
&:hover {
|
||||
color: lighten($colorBtnIcon, $ltGamma);
|
||||
}
|
||||
// Color and styling additionally in _controls.scss
|
||||
}
|
||||
|
||||
.mini-tab {
|
||||
|
||||
@@ -187,7 +187,8 @@ label.checkbox.custom {
|
||||
}
|
||||
}
|
||||
|
||||
.context-available {
|
||||
.context-available,
|
||||
.s-icon-btn {
|
||||
$c: $colorKey;
|
||||
color: $c;
|
||||
&:hover {
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
}
|
||||
|
||||
.status.block {
|
||||
$transDelay: 1.5s;
|
||||
$transSpeed: .25s;
|
||||
color: $colorStatusDefault;
|
||||
cursor: default;
|
||||
display: inline-block;
|
||||
@@ -44,13 +46,47 @@
|
||||
.status-indicator,
|
||||
.label,
|
||||
.count {
|
||||
//@include test(#00ff00);
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
&.no-icon {
|
||||
.status-indicator {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.float-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
&.subtle {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.status-indicator {
|
||||
margin-right: $interiorMarginSm;
|
||||
}
|
||||
|
||||
&:not(.no-collapse) {
|
||||
.label {
|
||||
// Max-width silliness is necessary for width transition
|
||||
@include trans-prop-nice(max-width, $transSpeed, $transDelay);
|
||||
overflow: hidden;
|
||||
max-width: 0px;
|
||||
}
|
||||
&:hover {
|
||||
.label {
|
||||
@include trans-prop-nice(max-width, $transSpeed, 0s);
|
||||
max-width: 450px;
|
||||
width: auto;
|
||||
}
|
||||
.count {
|
||||
@include trans-prop-nice(max-width, $transSpeed, 0s);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.ok .status-indicator,
|
||||
&.info .status-indicator {
|
||||
color: $colorStatusInfo;
|
||||
@@ -63,26 +99,11 @@
|
||||
&.error .status-indicator {
|
||||
color: $colorStatusError;
|
||||
}
|
||||
.label {
|
||||
// Max-width silliness is necessary for width transition
|
||||
@include trans-prop-nice(max-width, .25s);
|
||||
overflow: hidden;
|
||||
max-width: 0px;
|
||||
}
|
||||
.count {
|
||||
@include trans-prop-nice(opacity, .25s);
|
||||
@include trans-prop-nice(opacity, $transSpeed, $transDelay);
|
||||
font-weight: bold;
|
||||
opacity: 1;
|
||||
}
|
||||
&:hover {
|
||||
.label {
|
||||
max-width: 450px;
|
||||
width: auto;
|
||||
}
|
||||
.count {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Styles for messages and message banners */
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.l-time-controller-visible {
|
||||
|
||||
}
|
||||
|
||||
mct-include.l-time-controller {
|
||||
$minW: 500px;
|
||||
$knobHOffset: 0px;
|
||||
@@ -22,10 +18,10 @@ mct-include.l-time-controller {
|
||||
$r2H: nth($ueTimeControlH,2);
|
||||
$r3H: nth($ueTimeControlH,3);
|
||||
|
||||
@include absPosDefault();
|
||||
//@include absPosDefault();
|
||||
//@include test();
|
||||
display: block;
|
||||
top: auto;
|
||||
//top: auto;
|
||||
height: $r1H + $r2H + $r3H + ($interiorMargin * 2);
|
||||
min-width: $minW;
|
||||
font-size: 0.8rem;
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
.s-status-editing .l-object-wrapper,
|
||||
.edit-main {
|
||||
// .s-status-editing .l-object-wrapper is relevant to New Edit Mode;
|
||||
// .edit-main is legacy for old edit mode.
|
||||
$handleD: 15px;
|
||||
$cr: 5px;
|
||||
.edit-corner,
|
||||
@@ -92,12 +94,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.frame.child-frame.panel {
|
||||
&:hover {
|
||||
@include boxShdwLarge();
|
||||
border-color: $colorKey;
|
||||
//z-index: 2;
|
||||
.view-switcher {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@@ -1,46 +1,32 @@
|
||||
.l-time-display {
|
||||
$transTime: 200ms;
|
||||
// Layout
|
||||
line-height: 140%;
|
||||
&:hover {
|
||||
.l-btn.control {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.l-elem-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
.l-elem {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
&.l-timer {
|
||||
.l-elem.l-value {
|
||||
@include trans-prop-nice(left, $transTime);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
.ui-symbol.direction {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
&:hover .l-elem.l-value {
|
||||
left: 20px;
|
||||
.control {
|
||||
@include trans-prop-nice((width, opacity), $transTime);
|
||||
line-height: inherit;
|
||||
margin-right: 0;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
}
|
||||
&:hover .control {
|
||||
margin-right: $interiorMargin;
|
||||
opacity: 1;
|
||||
width: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
// Look-and-feel
|
||||
.l-elem {
|
||||
.value.active,
|
||||
&.value.active {
|
||||
color: $colorKeyFg;
|
||||
}
|
||||
}
|
||||
.l-btn.control {
|
||||
@include trans-prop-nice-fade($transTime);
|
||||
opacity: 0;
|
||||
font-size: 0.65em;
|
||||
vertical-align: top;
|
||||
//line-height: 1em;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: pullForward($colorBodyFg, 50%);
|
||||
font-weight: 400;
|
||||
.direction {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
}
|
||||
|
||||
.form {
|
||||
// @include test(orange);
|
||||
color: $colorFormText;
|
||||
.form-section {
|
||||
position: relative;
|
||||
@@ -112,12 +111,8 @@
|
||||
|
||||
.selector-list {
|
||||
// Used in create overlay to display tree view
|
||||
@include nice-input($colorInputBg, $colorInputFg);
|
||||
@include nice-input();
|
||||
$h: 150px;
|
||||
//@include border-radius($basicCr);
|
||||
//@include box-sizing(border-box);
|
||||
//background: rgba(black, 0.2);
|
||||
//padding: $interiorMargin;
|
||||
position: relative;
|
||||
height: $h;
|
||||
// max-width: 50%;
|
||||
@@ -162,13 +157,9 @@ label.form-control.checkbox {
|
||||
}
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
@include nice-input($colorInputBg, $colorInputFg);
|
||||
&.filter {
|
||||
&.ng-dirty {
|
||||
// background: red;
|
||||
}
|
||||
}
|
||||
input[type="text"],
|
||||
input[type="search"] {
|
||||
@include nice-input();
|
||||
&.numeric {
|
||||
text-align: right;
|
||||
}
|
||||
@@ -176,7 +167,6 @@ input[type="text"] {
|
||||
|
||||
textarea {
|
||||
@include nice-textarea($colorInputBg, $colorInputFg);
|
||||
// font-size: 0.9em;
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
@@ -21,20 +21,7 @@
|
||||
*****************************************************************************/
|
||||
.filter,
|
||||
.t-filter {
|
||||
input.filter,
|
||||
input.t-filter-input {
|
||||
@include subdued-input();
|
||||
}
|
||||
input.t-filter-input {
|
||||
height: $formInputH;
|
||||
width: 200px;
|
||||
&:not(.ng-dirty) {
|
||||
// TO-DO: Update compass install to support this
|
||||
// @include input-placeholder {
|
||||
// color: rgba(#fff, 0.3);
|
||||
// font-style: italic;
|
||||
// }
|
||||
}
|
||||
&:not(.ng-dirty) + .t-a-clear {
|
||||
display: none;
|
||||
}
|
||||
@@ -76,13 +63,6 @@
|
||||
background-color: $colorKey;
|
||||
}
|
||||
}
|
||||
// &:not(ng-dirty)
|
||||
}
|
||||
|
||||
.l-filter {
|
||||
// Holds an input and a clear button
|
||||
display:inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
@@ -100,4 +80,75 @@
|
||||
.icon-filter {
|
||||
font-size: 1.4em;
|
||||
}
|
||||
}
|
||||
|
||||
.l-filter {
|
||||
$iconEdgeM: 4px;
|
||||
$iconD: $formInputH - ($iconEdgeM * 2);
|
||||
// Adds a magnifying glass before, holds an input and a clear button
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
|
||||
input[type="search"] {
|
||||
padding: 2px ($iconD + $interiorMargin);
|
||||
}
|
||||
.clear-icon,
|
||||
.menu-icon,
|
||||
&:before {
|
||||
@include box-sizing(border-box);
|
||||
display: inline-block;
|
||||
line-height: inherit;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
@include transform(translateY(-50%));
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&:before {
|
||||
// Magnify glass icon
|
||||
content:'\4d';
|
||||
left: $interiorMargin;
|
||||
@include trans-prop-nice(color, 250ms);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.clear-icon {
|
||||
right: $iconEdgeM;
|
||||
// Icon is visible only when there is text input
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
&.show {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: pullForward($colorInputIcon, 10%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.s-filter {
|
||||
input[type="search"] {
|
||||
@include input-base();
|
||||
}
|
||||
.clear-icon,
|
||||
.menu-icon,
|
||||
&:before {
|
||||
color: $colorInputIcon;
|
||||
cursor: pointer;
|
||||
font-family: symbolsfont;
|
||||
@include trans-prop-nice((opacity, color), 150ms);
|
||||
}
|
||||
// Make icon lighten when hovering over search bar
|
||||
&:hover:before {
|
||||
color: pullForward($colorInputIcon, 10%);
|
||||
}
|
||||
|
||||
.clear-icon {
|
||||
// 'x' in circle icon
|
||||
&:before {
|
||||
content: '\e607';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,21 +24,27 @@
|
||||
100% { transform: rotate(359deg); }
|
||||
}
|
||||
|
||||
@mixin wait-spinner2($b: 5px, $c: $colorAlt1) {
|
||||
@mixin spinner($b: 5px) {
|
||||
@include keyframes(rotateCentered) {
|
||||
0% { transform: translateX(-50%) translateY(-50%) rotate(0deg); }
|
||||
100% { transform: translateX(-50%) translateY(-50%) rotate(359deg); }
|
||||
}
|
||||
0% { @include transform(translateX(-50%) translateY(-50%) rotate(0deg)); }
|
||||
100% { @include transform(translateX(-50%) translateY(-50%) rotate(359deg)); }
|
||||
}
|
||||
@include animation-name(rotateCentered);
|
||||
@include animation-duration(0.5s);
|
||||
@include animation-iteration-count(infinite);
|
||||
@include animation-timing-function(linear);
|
||||
@include transform-origin(center);
|
||||
border-style: solid;
|
||||
border-width: $b;
|
||||
@include border-radius(100%);
|
||||
}
|
||||
|
||||
|
||||
@mixin wait-spinner2($b: 5px, $c: $colorAlt1) {
|
||||
@include spinner($b);
|
||||
@include box-sizing(border-box);
|
||||
border-color: rgba($c, 0.25);
|
||||
border-top-color: rgba($c, 1.0);
|
||||
border-style: solid;
|
||||
border-width: 5px;
|
||||
@include border-radius(100%);
|
||||
@include box-sizing(border-box);
|
||||
display: block;
|
||||
position: absolute;
|
||||
height: 0; width: 0;
|
||||
|
||||
@@ -31,34 +31,34 @@ $tabletItemH: floor($ueBrowseGridItemLg/3);
|
||||
|
||||
/************************** MOBILE TREE MENU DIMENSIONS */
|
||||
$mobileTreeItemH: 35px;
|
||||
$mobileTreeItemIndent: 20px;
|
||||
$mobileTreeItemIndent: 15px;
|
||||
$mobileTreeRightArrowW: 30px;
|
||||
|
||||
/************************** DEVICE WIDTHS */
|
||||
// IMPORTANT! Usage assumes that ranges are mutually exclusive and have no gaps
|
||||
$phoMaxW: 514px;
|
||||
$tabMinW: 515px;
|
||||
$tabMaxW: 1280px;
|
||||
$desktopMinW: 1281px;
|
||||
$phoMaxW: 767px;
|
||||
$tabMinW: 768px;
|
||||
$tabMaxW: 1024px;
|
||||
$desktopMinW: 1025px;
|
||||
|
||||
/************************** MEDIA QUERIES: WINDOW CHECKS FOR SPECIFIC ORIENTATIONS FOR EACH DEVICE */
|
||||
$screenPortrait: "screen and (orientation: portrait)";
|
||||
$screenLandscape: "screen and (orientation: landscape)";
|
||||
$screenPortrait: "(orientation: portrait)";
|
||||
$screenLandscape: "(orientation: landscape)";
|
||||
|
||||
$mobileDevice: "(max-device-width: #{$tabMaxW})";
|
||||
//$mobileDevice: "(max-device-width: #{$tabMaxW})";
|
||||
|
||||
$phoneCheck: "(max-device-width: #{$phoMaxW})";
|
||||
$tabletCheck: $mobileDevice;
|
||||
$desktopCheck: "(min-device-width: #{$desktopMinW})";
|
||||
$tabletCheck: "(min-device-width: #{$tabMinW}) and (max-device-width: #{$tabMaxW})";
|
||||
$desktopCheck: "(min-device-width: #{$desktopMinW}) and (-webkit-min-device-pixel-ratio: 1)";
|
||||
|
||||
/************************** MEDIA QUERIES: WINDOWS FOR SPECIFIC ORIENTATIONS FOR EACH DEVICE */
|
||||
$phonePortrait: "#{$screenPortrait} and #{$phoneCheck} and #{$mobileDevice}";
|
||||
$phoneLandscape: "#{$screenLandscape} and #{$phoneCheck} and #{$mobileDevice}";
|
||||
$phonePortrait: "only screen and #{$screenPortrait} and #{$phoneCheck}";
|
||||
$phoneLandscape: "only screen and #{$screenLandscape} and #{$phoneCheck}";
|
||||
|
||||
$tabletPortrait: "#{$screenPortrait} and #{$tabletCheck} and #{$mobileDevice}";
|
||||
$tabletLandscape: "#{$screenLandscape} and #{$tabletCheck} and #{$mobileDevice}";
|
||||
$tabletPortrait: "only screen and #{$screenPortrait} and #{$tabletCheck}";
|
||||
$tabletLandscape: "only screen and #{$screenLandscape} and #{$tabletCheck}";
|
||||
|
||||
$desktop: "screen and #{$desktopCheck}";
|
||||
$desktop: "only screen and #{$desktopCheck}";
|
||||
|
||||
/************************** DEVICE PARAMETERS FOR MENUS/REPRESENTATIONS */
|
||||
$proporMenuOnly: 90%;
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
|
||||
.object-browse-bar {
|
||||
left: 45px !important;
|
||||
margin-left: 45px;
|
||||
.context-available {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
@@ -30,25 +30,30 @@
|
||||
}
|
||||
.tree-item,
|
||||
.search-result-item {
|
||||
height: $mobileTreeItemH;
|
||||
line-height: $mobileTreeItemH;
|
||||
margin-bottom: 0px;
|
||||
height: $mobileTreeItemH !important;
|
||||
line-height: $mobileTreeItemH !important;
|
||||
margin-bottom: 0px !important;
|
||||
.view-control {
|
||||
//@include test(red);
|
||||
position: absolute;
|
||||
font-size: 1.1em;
|
||||
height: $mobileTreeItemH;
|
||||
line-height: inherit;
|
||||
right: 0px;
|
||||
width: $mobileTreeRightArrowW;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
margin-right: 0;
|
||||
order: 2;
|
||||
width: $mobileTreeItemH;
|
||||
&.has-children {
|
||||
&:before {
|
||||
content: "\7d";
|
||||
left: 50%;
|
||||
@include transform(translateX(-50%) rotate(90deg));
|
||||
}
|
||||
&.expanded:before {
|
||||
@include transform(translateX(-50%) rotate(270deg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.label,
|
||||
.t-object-label {
|
||||
left: 0;
|
||||
right: $mobileTreeRightArrowW + $interiorMargin; // Allows tree item name to stop prior to the arrow
|
||||
line-height: inherit;
|
||||
.t-item-icon.l-icon-link .t-item-icon-glyph:before {
|
||||
bottom: 20%; // Shift up due to height of mobile menu items
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@include phone {
|
||||
.search {
|
||||
.search-holder {
|
||||
.search-bar {
|
||||
// Hide menu-icon and adjust spacing when in phone mode
|
||||
.menu-icon {
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
left: $interiorMarginSm;
|
||||
@include trans-prop-nice(color, 250ms);
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
// Make icon lighten when hovering over search bar
|
||||
@@ -127,7 +128,7 @@
|
||||
}
|
||||
|
||||
.active-filter-display {
|
||||
$s: 0.65em;
|
||||
$s: 0.7em;
|
||||
$p: $interiorMargin;
|
||||
@include box-sizing(border-box);
|
||||
line-height: 130%;
|
||||
@@ -146,7 +147,6 @@
|
||||
|
||||
.search-results {
|
||||
@include trans-prop-nice((opacity, visibility), 250ms);
|
||||
margin-top: $interiorMarginLg; // Always include margin here to fend off the search input
|
||||
padding-right: $interiorMargin;
|
||||
.hint {
|
||||
margin-bottom: $interiorMarginLg;
|
||||
|
||||
@@ -35,23 +35,35 @@ ul.tree {
|
||||
.tree-item,
|
||||
.search-result-item {
|
||||
$runningItemW: 0;
|
||||
@extend .l-flex-row;
|
||||
@include box-sizing(border-box);
|
||||
@include border-radius($basicCr);
|
||||
@include single-transition(background-color, 0.25s);
|
||||
display: block;
|
||||
font-size: 0.8rem;
|
||||
height: $menuLineH;
|
||||
line-height: $menuLineH;
|
||||
margin-bottom: $interiorMarginSm;
|
||||
padding: 0 $interiorMarginSm;
|
||||
position: relative;
|
||||
|
||||
.view-control {
|
||||
color: $colorItemTreeVC;
|
||||
display: inline-block;
|
||||
margin-left: $interiorMargin;
|
||||
font-size: 0.75em;
|
||||
font-size: 0.75em;
|
||||
margin-right: $interiorMargin;
|
||||
height: 100%;
|
||||
line-height: inherit;
|
||||
width: $treeVCW;
|
||||
$runningItemW: $interiorMargin + $treeVCW;
|
||||
&.has-children {
|
||||
&:before {
|
||||
position: absolute;
|
||||
@include trans-prop-nice(transform, 100ms);
|
||||
content: "\3e";
|
||||
@include transform-origin(center);
|
||||
}
|
||||
&.expanded:before {
|
||||
@include transform(rotate(90deg));
|
||||
}
|
||||
}
|
||||
@include desktop {
|
||||
&:hover {
|
||||
color: $colorItemTreeVCHover !important;
|
||||
@@ -59,64 +71,17 @@ ul.tree {
|
||||
}
|
||||
}
|
||||
|
||||
.label,
|
||||
.t-object-label {
|
||||
display: block;
|
||||
@include absPosDefault();
|
||||
line-height: $menuLineH;
|
||||
|
||||
.t-item-icon {
|
||||
@include txtShdwSubtle($shdwItemTreeIcon);
|
||||
font-size: $treeTypeIconH;
|
||||
color: $colorItemTreeIcon;
|
||||
position: absolute;
|
||||
left: $interiorMargin;
|
||||
top: 50%;
|
||||
width: $treeTypeIconH;
|
||||
@include transform(translateY(-50%));
|
||||
width: $treeTypeIconW;
|
||||
}
|
||||
|
||||
.type-icon {
|
||||
//@include absPosDefault(0, false);
|
||||
$d: $treeTypeIconH;
|
||||
@include txtShdwSubtle($shdwItemTreeIcon);
|
||||
font-size: $treeTypeIconH;
|
||||
color: $colorItemTreeIcon;
|
||||
left: $interiorMargin;
|
||||
position: absolute;
|
||||
@include verticalCenterBlock($menuLineHPx, $treeTypeIconHPx);
|
||||
line-height: 100%;
|
||||
right: auto; width: $treeTypeIconH;
|
||||
|
||||
.icon {
|
||||
&.l-icon-link,
|
||||
&.l-icon-alert {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
&.l-icon-alert {
|
||||
$d: 8px;
|
||||
@include ancillaryIcon($d, $colorAlert);
|
||||
top: 1px;
|
||||
right: -2px;
|
||||
}
|
||||
&.l-icon-link {
|
||||
$d: 8px;
|
||||
@include ancillaryIcon($d, $colorIconLink);
|
||||
left: -3px;
|
||||
bottom: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.title-label,
|
||||
.t-title-label {
|
||||
@include absPosDefault();
|
||||
display: block;
|
||||
left: $runningItemW + ($interiorMargin * 3);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@include ellipsize();
|
||||
}
|
||||
}
|
||||
|
||||
&.selected {
|
||||
@@ -126,12 +91,11 @@ ul.tree {
|
||||
color: $colorItemTreeSelectedVC;
|
||||
}
|
||||
.t-object-label .t-item-icon {
|
||||
color: $colorItemTreeSelectedFg; //$colorItemTreeIconHover;
|
||||
color: $colorItemTreeSelectedFg;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.selected) {
|
||||
// NOTE: [Mobile] Removed Hover on Mobile
|
||||
@include desktop {
|
||||
&:hover {
|
||||
background: $colorItemTreeHoverBg;
|
||||
@@ -160,8 +124,57 @@ ul.tree {
|
||||
}
|
||||
}
|
||||
|
||||
.tree-item {
|
||||
.t-object-label {
|
||||
left: $interiorMargin + $treeVCW;
|
||||
}
|
||||
}
|
||||
mct-representation {
|
||||
&.s-status-pending {
|
||||
.t-object-label {
|
||||
.t-item-icon {
|
||||
&:before {
|
||||
$spinBW: 4px;
|
||||
@include spinner($spinBW);
|
||||
border-color: rgba($colorItemTreeIcon, 0.25);
|
||||
border-top-color: rgba($colorItemTreeIcon, 1.0);
|
||||
}
|
||||
.t-item-icon-glyph {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.t-title-label {
|
||||
font-style: italic;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.selected mct-representation.s-status-pending .t-object-label .t-item-icon:before {
|
||||
border-color: rgba($colorItemTreeSelectedFg, 0.25);
|
||||
border-top-color: rgba($colorItemTreeSelectedFg, 1.0);
|
||||
}
|
||||
|
||||
.tree .s-status-editing,
|
||||
.search-results .s-status-editing {
|
||||
// Item is being edited
|
||||
.tree-item,
|
||||
.search-result-item {
|
||||
background: $colorItemTreeEditingBg;
|
||||
pointer-events: none;
|
||||
&:before {
|
||||
// Pencil icon
|
||||
@extend .ui-symbol;
|
||||
@include pulse($dur: 1s, $opacity0: 0.25);
|
||||
color: $colorItemTreeEditingFg;
|
||||
content: '\70';
|
||||
margin-right: $interiorMarginSm;
|
||||
}
|
||||
.t-object-label {
|
||||
.t-item-icon,
|
||||
.t-title-label {
|
||||
color: $colorItemTreeEditingFg;
|
||||
@include text-shadow(none);
|
||||
}
|
||||
.t-title-label {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
.view-control, + .tree-item-subtree { display: none; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
&.child-frame.panel {
|
||||
background: $colorBodyBg;
|
||||
border: 1px solid $bc;
|
||||
z-index: 0; // Needed to prevent child-frame controls from showing through when another child-frame is above
|
||||
&:hover {
|
||||
border-color: lighten($bc, 10%);
|
||||
}
|
||||
|
||||
@@ -77,38 +77,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
// from _bottom-bar.scss
|
||||
.ue-bottom-bar {
|
||||
@include absPosDefault(0);// New status bar design
|
||||
top: auto;
|
||||
height: $ueFooterH;
|
||||
line-height: $ueFooterH - ($interiorMargin * 2);
|
||||
background: $colorFooterBg;
|
||||
color: lighten($colorBodyBg, 30%);
|
||||
font-size: .7rem;
|
||||
.status-holder {
|
||||
@include box-sizing(border-box);
|
||||
@include absPosDefault($interiorMargin);
|
||||
@include ellipsize();
|
||||
right: 120px;
|
||||
text-transform: uppercase;
|
||||
z-index: 1;
|
||||
}
|
||||
.app-logo {
|
||||
@include box-sizing(border-box);
|
||||
@include absPosDefault($interiorMargin);
|
||||
cursor: pointer;
|
||||
left: auto;
|
||||
width: $ueAppLogoW;
|
||||
z-index: 2;
|
||||
&.logo-openmctweb {
|
||||
background: url($dirImgs + 'logo-openmctweb.svg') no-repeat center center;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ue-bottom-bar {
|
||||
@include absPosDefault(0);// New status bar design
|
||||
top: auto;
|
||||
height: $ueFooterH;
|
||||
line-height: $ueFooterH - ($interiorMargin * 2);
|
||||
background: $colorFooterBg;
|
||||
color: lighten($colorBodyBg, 30%);
|
||||
font-size: .7rem;
|
||||
.status-holder {
|
||||
@include box-sizing(border-box);
|
||||
@include absPosDefault($interiorMargin);
|
||||
@include ellipsize();
|
||||
right: 120px;
|
||||
text-transform: uppercase;
|
||||
z-index: 1;
|
||||
}
|
||||
.app-logo {
|
||||
@include box-sizing(border-box);
|
||||
@include absPosDefault($interiorMargin);
|
||||
cursor: pointer;
|
||||
left: auto;
|
||||
width: $ueAppLogoW;
|
||||
z-index: 2;
|
||||
&.logo-openmctweb {
|
||||
background: url($dirImgs + 'logo-openmctweb.svg') no-repeat center center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.edit-mode {
|
||||
// Old edit mode
|
||||
.split-layout {
|
||||
.split-pane-component.pane.right {
|
||||
width: 15%;
|
||||
@@ -172,7 +172,7 @@
|
||||
&.toggle-inspect.anchor-right {
|
||||
right: $bodyMargin;
|
||||
&:after {
|
||||
content: '\e615'; // e615: Crosshair icon; was e608: Info "i" icon
|
||||
content: '\e615'; // Eye icon
|
||||
}
|
||||
&.collapsed {
|
||||
right: $interiorMargin;
|
||||
@@ -197,6 +197,16 @@
|
||||
right: 0;
|
||||
bottom: $bodyMargin;
|
||||
left: $bodyMargin;
|
||||
.create-btn-holder {
|
||||
&.s-status-editing {
|
||||
display: none;
|
||||
& + .search-holder .search-bar {
|
||||
// .search-holder is adjacent sibling to .create-btn-holder
|
||||
// Add right margin when create button is hidden, to make room for the collapse pane 'x' button
|
||||
margin-right: $interiorMarginLg * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.holder.holder-object-and-inspector {
|
||||
@@ -208,25 +218,50 @@
|
||||
top: $bodyMargin;
|
||||
bottom: $bodyMargin;
|
||||
}
|
||||
.holder-inspector-elements {
|
||||
.holder-inspector {
|
||||
top: $bodyMargin;
|
||||
bottom: $bodyMargin;
|
||||
left: $bodyMargin;
|
||||
right: $bodyMargin;
|
||||
}
|
||||
.holder-elements {
|
||||
top: 0;
|
||||
bottom: $bodyMargin;
|
||||
left: $bodyMargin;
|
||||
right: $bodyMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.object-holder {
|
||||
@include absPosDefault(0, auto);
|
||||
top: $ueTopBarH + $interiorMarginLg;
|
||||
&.l-controls-visible {
|
||||
&.l-time-controller-visible {
|
||||
bottom: nth($ueTimeControlH,1) + nth($ueTimeControlH,2) +nth($ueTimeControlH,3) + ($interiorMargin * 3);
|
||||
}
|
||||
|
||||
.l-object-wrapper {
|
||||
@extend .abs;
|
||||
|
||||
.object-holder-main {
|
||||
@extend .abs;
|
||||
}
|
||||
.l-edit-controls {
|
||||
//@include trans-prop-nice((opacity, height), 0.25s);
|
||||
border-bottom: 1px solid $colorInteriorBorder;
|
||||
line-height: $ueEditToolBarH;
|
||||
height: 0px;
|
||||
opacity: 0;
|
||||
.tool-bar {
|
||||
right: $interiorMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.l-object-wrapper-inner {
|
||||
@include trans-prop-nice-resize(0.25s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.object-browse-bar .s-btn,
|
||||
.top-bar .buttons-main .s-btn,
|
||||
.top-bar .s-menu-btn,
|
||||
@@ -247,7 +282,6 @@
|
||||
|
||||
/***************************************************** OBJECT BROWSE BAR */
|
||||
.object-browse-bar {
|
||||
@include absPosDefault(0, visible); // Must use visible to avoid hiding view switcher menu
|
||||
@include box-sizing(border-box);
|
||||
height: $ueTopBarH;
|
||||
line-height: $ueTopBarH;
|
||||
@@ -255,21 +289,20 @@
|
||||
|
||||
.left {
|
||||
padding-right: $interiorMarginLg;
|
||||
.l-back {
|
||||
.l-back:not(.s-status-editing) {
|
||||
margin-right: $interiorMarginLg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When the tree is hidden, these are the
|
||||
// classes used for the left menu and the
|
||||
// right representation.
|
||||
// When the tree is hidden, these are the classes used for the left menu and the right representation.
|
||||
.pane-tree-hidden {
|
||||
// Sets the left tree menu when the tree is hidden.
|
||||
.tree-holder,
|
||||
.splitter-treeview,
|
||||
.holder-treeview-elements {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,12 +331,10 @@
|
||||
|
||||
.pane-inspect-hidden {
|
||||
.l-object-and-inspector {
|
||||
.t-inspect {
|
||||
z-index: 1 !important; // Move down so that primary pane elements are clickable
|
||||
}
|
||||
.l-inspect,
|
||||
.splitter-inspect {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,3 +374,22 @@
|
||||
min-width: 200px; // Needed for nice display when primary pane is constrained severely via splitters
|
||||
}
|
||||
}
|
||||
|
||||
.s-status-editing {
|
||||
.l-object-wrapper {
|
||||
@include pulseBorder($colorEditAreaFg, $dur: 1s, $opacity0: 0.3);
|
||||
@include border-radius($controlCr);
|
||||
background-color: $colorEditAreaBg;
|
||||
border-color: $colorEditAreaFg;
|
||||
border-width: 2px;
|
||||
border-style: dotted;
|
||||
.l-object-wrapper-inner {
|
||||
@include absPosDefault(3px, hidden);
|
||||
}
|
||||
.l-edit-controls {
|
||||
height: $ueEditToolBarH + $interiorMargin;
|
||||
margin-bottom: $interiorMargin;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
.tool-bar {
|
||||
border-bottom: 1px solid $colorInteriorBorder;
|
||||
&.btn-bar {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.l-control-group {
|
||||
height: $btnToolbarH;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,7 @@
|
||||
.edit-mode {
|
||||
.top-bar {
|
||||
.buttons-main {
|
||||
// background: red;
|
||||
// width: 600px;
|
||||
// Old edit mode
|
||||
white-space: nowrap;
|
||||
&.abs {
|
||||
bottom: auto;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span ng-controller="SplitPaneController as splitter">
|
||||
<div class="splitter" ng-style="splitter.style()"
|
||||
mct-drag="splitter.move(delta.x)">
|
||||
</div>
|
||||
<div class='split-pane-component items pane' style="right:0;"
|
||||
ng-style="splitter.style()"
|
||||
ng-transclude>
|
||||
</div>
|
||||
</span>
|
||||
@@ -1,7 +1,29 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
Open MCT Web includes source code licensed under additional open source
|
||||
licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span class="s-btn"
|
||||
ng-controller="DateTimeFieldController">
|
||||
<input type="text"
|
||||
ng-model="textValue"
|
||||
ng-blur="restoreTextValue(); ngBlur()"
|
||||
ng-class="{ error: textInvalid }">
|
||||
</input>
|
||||
<a class="ui-symbol icon icon-calendar"
|
||||
@@ -11,8 +33,8 @@
|
||||
<mct-popup ng-if="picker.active">
|
||||
<div mct-click-elsewhere="picker.active = false">
|
||||
<mct-control key="'datetime-picker'"
|
||||
ng-model="ngModel"
|
||||
field="field"
|
||||
ng-model="pickerModel"
|
||||
field="'value'"
|
||||
options="{ hours: true }">
|
||||
</mct-control>
|
||||
</div>
|
||||
|
||||
@@ -20,15 +20,13 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<!-- look at action-button for example -->
|
||||
<span class="t-filter l-filter"
|
||||
<span class="t-filter l-filter s-filter"
|
||||
ng-controller="GetterSetterController">
|
||||
<input type="search"
|
||||
class="t-filter-input"
|
||||
ng-model="getterSetter.value"
|
||||
placeholder="Filter..."/>
|
||||
<a class="ui-symbol t-a-clear s-a-clear"
|
||||
ng-show="getterSetter.value !== ''"
|
||||
ng-model="getterSetter.value"/>
|
||||
<a class="clear-icon"
|
||||
ng-class="{show: !(getterSetter.value === '' || getterSetter.value === undefined)}"
|
||||
ng-click="getterSetter.value = ''">
|
||||
x
|
||||
</a>
|
||||
</span>
|
||||
@@ -20,12 +20,14 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div ng-controller="TimeRangeController">
|
||||
<div class="l-time-range-inputs-holder">
|
||||
<form class="l-time-range-inputs-holder"
|
||||
ng-submit="updateBoundsFromForm()">
|
||||
<span class="l-time-range-inputs-elem ui-symbol type-icon">C</span>
|
||||
<span class="l-time-range-input">
|
||||
<mct-control key="'datetime-field'"
|
||||
structure="{ format: parameters.format }"
|
||||
ng-model="ngModel.outer"
|
||||
ng-model="formModel"
|
||||
ng-blur="updateBoundsFromForm()"
|
||||
field="'start'"
|
||||
class="time-range-start">
|
||||
</mct-control>
|
||||
@@ -36,12 +38,15 @@
|
||||
<span class="l-time-range-input" ng-controller="ToggleController as t2">
|
||||
<mct-control key="'datetime-field'"
|
||||
structure="{ format: parameters.format }"
|
||||
ng-model="ngModel.outer"
|
||||
ng-model="formModel"
|
||||
ng-blur="updateBoundsFromForm()"
|
||||
field="'end'"
|
||||
class="time-range-end">
|
||||
</mct-control>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<input type="submit" class="hidden">
|
||||
</form>
|
||||
|
||||
<div class="l-time-range-slider-holder">
|
||||
<div class="l-time-range-slider">
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
|
||||
<!--<div ng-init="reps = [1,2,3]"></div>-->
|
||||
<div class='status block'
|
||||
title="{{ngModel.getDescription()}}"
|
||||
ng-click='ngModel.configure()'
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span class="t-object-label">
|
||||
<span class="t-item-icon" ng-class="{ 'l-icon-link':location.isLink() }">{{type.getGlyph()}}</span>
|
||||
<span class='t-title-label'>{{model.name}}</span>
|
||||
</span>
|
||||
<div class="t-object-label l-flex-row flex-elem grows">
|
||||
<div class="t-item-icon flex-elem" ng-class="{ 'l-icon-link':location.isLink() }">
|
||||
<div class="t-item-icon-glyph">{{type.getGlyph()}}</div>
|
||||
</div>
|
||||
<div class='t-title-label flex-elem grows'>{{model.name}}</div>
|
||||
</div>
|
||||
|
||||
@@ -20,44 +20,61 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span class="l-inspect" ng-controller="ObjectInspectorController as controller">
|
||||
<div class="abs holder holder-inspector-elements l-flex-col">
|
||||
<div class="pane-header flex-elem">Inspection</div>
|
||||
<ul class="flex-elem grows vscroll">
|
||||
<li>
|
||||
<em>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 ng-controller="PaneController as modelPaneEdit">
|
||||
<mct-split-pane class='abs contents split-layout' anchor='bottom'>
|
||||
<div class="split-pane-component pane top">
|
||||
<div class="abs holder holder-inspector l-flex-col">
|
||||
<div class="pane-header flex-elem">Inspection</div>
|
||||
<ul class="flex-elem grows vscroll">
|
||||
<li>
|
||||
<em>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 ng-if="contextutalParents.length > 0">
|
||||
<em title="The location of this linked object.">Location</em>
|
||||
<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">
|
||||
<em title="The location of the original object that this was linked from.">Original Location</em>
|
||||
<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><!--/ holder-inspector -->
|
||||
</div><!--/ split-pane-component -->
|
||||
<mct-splitter class="splitter-inspect-panel mobile-hide"></mct-splitter>
|
||||
<div class="split-pane-component pane bottom">
|
||||
<div class="abs holder holder-elements l-flex-col">
|
||||
<em class="flex-elem">Elements</em>
|
||||
<mct-representation
|
||||
key="'edit-elements'"
|
||||
mct-object="domainObject"
|
||||
class="flex-elem holder grows vscroll current-elements">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li ng-if="contextutalParents.length > 0">
|
||||
<em title="The location of this linked object.">Location</em>
|
||||
<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">
|
||||
<em title="The location of the original object that this was linked from.">Original Location</em>
|
||||
<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>
|
||||
</mct-split-pane>
|
||||
</div><!--/ PaneController -->
|
||||
</span>
|
||||
|
||||
@@ -26,41 +26,18 @@
|
||||
ng-class="{selected: treeNode.isSelected()}"
|
||||
>
|
||||
<span
|
||||
mct-device="desktop"
|
||||
class='ui-symbol view-control'
|
||||
class='ui-symbol view-control flex-elem'
|
||||
ng-class="{ 'has-children': model.composition !== undefined, expanded: toggle.isActive() }"
|
||||
ng-click="toggle.toggle(); treeNode.trackExpansion()"
|
||||
ng-if="model.composition !== undefined"
|
||||
>
|
||||
{{toggle.isActive() ? "v" : ">"}}
|
||||
</span>
|
||||
|
||||
<mct-representation
|
||||
mct-device="desktop"
|
||||
class="mobile-hide"
|
||||
class="rep-object-label"
|
||||
key="'label'"
|
||||
mct-object="domainObject"
|
||||
ng-click="treeNode.select()"
|
||||
>
|
||||
</mct-representation>
|
||||
<mct-representation
|
||||
mct-device="mobile"
|
||||
class="desktop-hide"
|
||||
key="'label'"
|
||||
mct-object="domainObject"
|
||||
ng-click="(model.composition === undefined) && treeNode.select();
|
||||
toggle.toggle();
|
||||
treeNode.trackExpansion();"
|
||||
>
|
||||
</mct-representation>
|
||||
|
||||
<span
|
||||
mct-device="mobile"
|
||||
class='ui-symbol view-control'
|
||||
ng-model="ngModel"
|
||||
ng-click="treeNode.select()"
|
||||
>
|
||||
}
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
class="tree-item-subtree"
|
||||
|
||||
64
platform/commonUI/general/src/UnsupportedBrowserWarning.js
Normal file
64
platform/commonUI/general/src/UnsupportedBrowserWarning.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* This bundle provides various general-purpose UI elements, including
|
||||
* platform styling.
|
||||
* @namespace platform/commonUI/general
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var WARNING_TITLE = "Unsupported browser",
|
||||
WARNING_DESCRIPTION = [
|
||||
"This software has been developed and tested",
|
||||
"using the latest Google Chrome,",
|
||||
"and may be unstable in other browsers."
|
||||
].join(" "),
|
||||
MOBILE_BROWSER = "Safari",
|
||||
DESKTOP_BROWSER = "Chrome";
|
||||
|
||||
/**
|
||||
* Shows a warning if a user's browser is unsupported.
|
||||
* @memberof platform/commonUI/general
|
||||
* @constructor
|
||||
* @param {NotificationService} notificationService the notification
|
||||
* service
|
||||
*/
|
||||
function UnsupportedBrowserWarning(notificationService, agentService) {
|
||||
var testToBrowser = agentService.isMobile() ?
|
||||
MOBILE_BROWSER : DESKTOP_BROWSER;
|
||||
|
||||
if (!agentService.isBrowser(testToBrowser)) {
|
||||
notificationService.alert({
|
||||
title: WARNING_TITLE,
|
||||
actionText: WARNING_DESCRIPTION
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return UnsupportedBrowserWarning;
|
||||
}
|
||||
);
|
||||
@@ -53,7 +53,9 @@ define(
|
||||
formatter.parse($scope.textValue) !== value) {
|
||||
$scope.textValue = formatter.format(value);
|
||||
$scope.textInvalid = false;
|
||||
$scope.lastValidValue = $scope.textValue;
|
||||
}
|
||||
$scope.pickerModel = { value: value };
|
||||
}
|
||||
|
||||
function updateFromView(textValue) {
|
||||
@@ -61,6 +63,17 @@ define(
|
||||
if (!$scope.textInvalid) {
|
||||
$scope.ngModel[$scope.field] =
|
||||
formatter.parse(textValue);
|
||||
$scope.lastValidValue = $scope.textValue;
|
||||
}
|
||||
}
|
||||
|
||||
function updateFromPicker(value) {
|
||||
if (value !== $scope.ngModel[$scope.field]) {
|
||||
$scope.ngModel[$scope.field] = value;
|
||||
updateFromModel(value);
|
||||
if ($scope.ngBlur) {
|
||||
$scope.ngBlur();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +82,18 @@ define(
|
||||
updateFromModel($scope.ngModel[$scope.field]);
|
||||
}
|
||||
|
||||
function restoreTextValue() {
|
||||
$scope.textValue = $scope.lastValidValue;
|
||||
updateFromView($scope.textValue);
|
||||
}
|
||||
|
||||
$scope.restoreTextValue = restoreTextValue;
|
||||
|
||||
$scope.picker = { active: false };
|
||||
|
||||
$scope.$watch('structure.format', setFormat);
|
||||
$scope.$watch('ngModel[field]', updateFromModel);
|
||||
$scope.$watch('pickerModel.value', updateFromPicker);
|
||||
$scope.$watch('textValue', updateFromView);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var DEFAULT_MAXIMUM = 1000,
|
||||
DEFAULT_MINIMUM = 120;
|
||||
|
||||
/**
|
||||
* Controller for the splitter in Browse mode. Current implementation
|
||||
* uses many hard-coded constants; this could be generalized.
|
||||
* @memberof platform/commonUI/general
|
||||
* @constructor
|
||||
*/
|
||||
function SplitPaneController() {
|
||||
this.current = 200;
|
||||
this.start = 200;
|
||||
this.assigned = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current position of the splitter, in pixels
|
||||
* from the left edge.
|
||||
* @returns {number} position of the splitter, in pixels
|
||||
*/
|
||||
SplitPaneController.prototype.state = function (defaultState) {
|
||||
// Set the state to the desired default, if we don't have a
|
||||
// "real" current state yet.
|
||||
if (arguments.length > 0 && !this.assigned) {
|
||||
this.current = defaultState;
|
||||
this.assigned = true;
|
||||
}
|
||||
return this.current;
|
||||
};
|
||||
|
||||
/**
|
||||
* Begin moving the splitter; this will note the splitter's
|
||||
* current position, which is necessary for correct
|
||||
* interpretation of deltas provided by mct-drag.
|
||||
*/
|
||||
SplitPaneController.prototype.startMove = function () {
|
||||
this.start = this.current;
|
||||
};
|
||||
|
||||
/**
|
||||
* Move the splitter a number of pixels to the right
|
||||
* (negative numbers move the splitter to the left.)
|
||||
* This movement is relative to the position of the
|
||||
* splitter when startMove was last invoked.
|
||||
* @param {number} delta number of pixels to move
|
||||
*/
|
||||
SplitPaneController.prototype.move = function (delta, minimum, maximum) {
|
||||
// Ensure defaults for minimum/maximum
|
||||
maximum = isNaN(maximum) ? DEFAULT_MAXIMUM : maximum;
|
||||
minimum = isNaN(minimum) ? DEFAULT_MINIMUM : minimum;
|
||||
|
||||
// Update current splitter state
|
||||
this.current = Math.min(
|
||||
maximum,
|
||||
Math.max(minimum, this.start + delta)
|
||||
);
|
||||
};
|
||||
|
||||
return SplitPaneController;
|
||||
}
|
||||
);
|
||||
@@ -175,6 +175,13 @@ define(
|
||||
updateViewFromModel($scope.ngModel);
|
||||
}
|
||||
|
||||
function updateFormModel() {
|
||||
$scope.formModel = {
|
||||
start: (($scope.ngModel || {}).outer || {}).start,
|
||||
end: (($scope.ngModel || {}).outer || {}).end
|
||||
};
|
||||
}
|
||||
|
||||
function updateOuterStart(t) {
|
||||
var ngModel = $scope.ngModel;
|
||||
|
||||
@@ -192,6 +199,7 @@ define(
|
||||
ngModel.inner.end
|
||||
);
|
||||
|
||||
updateFormModel();
|
||||
updateViewForInnerSpanFromModel(ngModel);
|
||||
updateTicks();
|
||||
}
|
||||
@@ -213,6 +221,7 @@ define(
|
||||
ngModel.inner.start
|
||||
);
|
||||
|
||||
updateFormModel();
|
||||
updateViewForInnerSpanFromModel(ngModel);
|
||||
updateTicks();
|
||||
}
|
||||
@@ -223,6 +232,14 @@ define(
|
||||
updateTicks();
|
||||
}
|
||||
|
||||
function updateBoundsFromForm() {
|
||||
$scope.ngModel = $scope.ngModel || {};
|
||||
$scope.ngModel.outer = {
|
||||
start: $scope.formModel.start,
|
||||
end: $scope.formModel.end
|
||||
};
|
||||
}
|
||||
|
||||
$scope.startLeftDrag = startLeftDrag;
|
||||
$scope.startRightDrag = startRightDrag;
|
||||
$scope.startMiddleDrag = startMiddleDrag;
|
||||
@@ -230,10 +247,13 @@ define(
|
||||
$scope.rightDrag = rightDrag;
|
||||
$scope.middleDrag = middleDrag;
|
||||
|
||||
$scope.updateBoundsFromForm = updateBoundsFromForm;
|
||||
|
||||
$scope.ticks = [];
|
||||
|
||||
// Initialize scope to defaults
|
||||
updateViewFromModel($scope.ngModel);
|
||||
updateFormModel();
|
||||
|
||||
$scope.$watchCollection("ngModel", updateViewFromModel);
|
||||
$scope.$watch("spanWidth", updateSpanWidth);
|
||||
|
||||
@@ -204,7 +204,7 @@ define(
|
||||
// And poll for position changes enforced by styles
|
||||
activeInterval = $interval(function () {
|
||||
getSetPosition(getSetPosition());
|
||||
}, POLLING_INTERVAL, false);
|
||||
}, POLLING_INTERVAL, 0, false);
|
||||
|
||||
// ...and stop polling when we're destroyed.
|
||||
$scope.$on('$destroy', function () {
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../src/UnsupportedBrowserWarning"],
|
||||
function (UnsupportedBrowserWarning) {
|
||||
"use strict";
|
||||
|
||||
var MOBILE_BROWSER = "Safari",
|
||||
DESKTOP_BROWSER = "Chrome",
|
||||
UNSUPPORTED_BROWSERS = [
|
||||
"Firefox",
|
||||
"IE",
|
||||
"Opera",
|
||||
"Iceweasel"
|
||||
];
|
||||
|
||||
describe("The unsupported browser warning", function () {
|
||||
var mockNotificationService,
|
||||
mockAgentService,
|
||||
testAgent;
|
||||
|
||||
function instantiateWith(browser) {
|
||||
testAgent = "Mozilla/5.0 " + browser + "/12.34.56";
|
||||
return new UnsupportedBrowserWarning(
|
||||
mockNotificationService,
|
||||
mockAgentService
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
testAgent = "chrome";
|
||||
mockNotificationService = jasmine.createSpyObj(
|
||||
"notificationService",
|
||||
[ "alert" ]
|
||||
);
|
||||
mockAgentService = jasmine.createSpyObj(
|
||||
"agentService",
|
||||
[ "isMobile", "isBrowser" ]
|
||||
);
|
||||
mockAgentService.isBrowser.andCallFake(function (substr) {
|
||||
substr = substr.toLowerCase();
|
||||
return testAgent.toLowerCase().indexOf(substr) !== -1;
|
||||
});
|
||||
});
|
||||
|
||||
[ false, true ].forEach(function (isMobile) {
|
||||
var deviceType = isMobile ? "mobile" : "desktop",
|
||||
goodBrowser = isMobile ? MOBILE_BROWSER : DESKTOP_BROWSER,
|
||||
badBrowsers = UNSUPPORTED_BROWSERS.concat([
|
||||
isMobile ? DESKTOP_BROWSER : MOBILE_BROWSER
|
||||
]);
|
||||
|
||||
describe("on " + deviceType + " devices", function () {
|
||||
beforeEach(function () {
|
||||
mockAgentService.isMobile.andReturn(isMobile);
|
||||
});
|
||||
|
||||
it("is not shown for " + goodBrowser, function () {
|
||||
instantiateWith(goodBrowser);
|
||||
expect(mockNotificationService.alert)
|
||||
.not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
badBrowsers.forEach(function (badBrowser) {
|
||||
it("is shown for " + badBrowser, function () {
|
||||
instantiateWith(badBrowser);
|
||||
expect(mockNotificationService.alert)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -67,21 +67,13 @@ define(
|
||||
mockScope.ngModel = { testField: 12321 };
|
||||
mockScope.field = "testField";
|
||||
mockScope.structure = { format: "someFormat" };
|
||||
mockScope.ngBlur = jasmine.createSpy('blur');
|
||||
|
||||
controller = new DateTimeFieldController(
|
||||
mockScope,
|
||||
mockFormatService
|
||||
);
|
||||
});
|
||||
|
||||
it("updates models from user-entered text", function () {
|
||||
var newText = "1977-05-25 17:30:00";
|
||||
|
||||
mockScope.textValue = newText;
|
||||
fireWatch("textValue", newText);
|
||||
expect(mockScope.ngModel.testField)
|
||||
.toEqual(mockFormat.parse(newText));
|
||||
expect(mockScope.textInvalid).toBeFalsy();
|
||||
fireWatch("ngModel[field]", mockScope.ngModel.testField);
|
||||
});
|
||||
|
||||
it("updates text from model values", function () {
|
||||
@@ -91,16 +83,55 @@ define(
|
||||
expect(mockScope.textValue).toEqual("1977-05-25 17:30:00");
|
||||
});
|
||||
|
||||
describe("when valid text is entered", function () {
|
||||
var newText;
|
||||
|
||||
beforeEach(function () {
|
||||
newText = "1977-05-25 17:30:00";
|
||||
mockScope.textValue = newText;
|
||||
fireWatch("textValue", newText);
|
||||
});
|
||||
|
||||
it("updates models from user-entered text", function () {
|
||||
expect(mockScope.ngModel.testField)
|
||||
.toEqual(mockFormat.parse(newText));
|
||||
expect(mockScope.textInvalid).toBeFalsy();
|
||||
});
|
||||
|
||||
it("does not indicate a blur event", function () {
|
||||
expect(mockScope.ngBlur).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when a date is chosen via the date picker", function () {
|
||||
var newValue;
|
||||
|
||||
beforeEach(function () {
|
||||
newValue = 12345654321;
|
||||
mockScope.pickerModel.value = newValue;
|
||||
fireWatch("pickerModel.value", newValue);
|
||||
});
|
||||
|
||||
it("updates models", function () {
|
||||
expect(mockScope.ngModel.testField).toEqual(newValue);
|
||||
});
|
||||
|
||||
it("fires a blur event", function () {
|
||||
expect(mockScope.ngBlur).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes toggle state for date-time picker", function () {
|
||||
expect(mockScope.picker.active).toBe(false);
|
||||
});
|
||||
|
||||
describe("when user input is invalid", function () {
|
||||
var newText, oldValue;
|
||||
var newText, oldText, oldValue;
|
||||
|
||||
beforeEach(function () {
|
||||
newText = "Not a date";
|
||||
oldValue = mockScope.ngModel.testField;
|
||||
oldText = mockScope.textValue;
|
||||
mockScope.textValue = newText;
|
||||
fireWatch("textValue", newText);
|
||||
});
|
||||
@@ -116,6 +147,11 @@ define(
|
||||
it("does not modify user input", function () {
|
||||
expect(mockScope.textValue).toEqual(newText);
|
||||
});
|
||||
|
||||
it("restores valid text values on request", function () {
|
||||
mockScope.restoreTextValue();
|
||||
expect(mockScope.textValue).toEqual(oldText);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not modify valid but irregular user input", function () {
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/controllers/DateTimePickerController"],
|
||||
function (DateTimePickerController) {
|
||||
["../../src/controllers/DateTimePickerController", "moment"],
|
||||
function (DateTimePickerController, moment) {
|
||||
"use strict";
|
||||
|
||||
describe("The DateTimePickerController", function () {
|
||||
@@ -39,6 +39,14 @@ define(
|
||||
});
|
||||
}
|
||||
|
||||
function fireWatchCollection(expr, value) {
|
||||
mockScope.$watchCollection.calls.forEach(function (call) {
|
||||
if (call.args[0] === expr) {
|
||||
call.args[1](value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
@@ -57,6 +65,131 @@ define(
|
||||
);
|
||||
});
|
||||
|
||||
it("updates value in model when values in scope change", function () {
|
||||
mockScope.date = {
|
||||
year: 1998,
|
||||
month: 0,
|
||||
day: 6
|
||||
};
|
||||
mockScope.time = {
|
||||
hours: 12,
|
||||
minutes: 34,
|
||||
seconds: 56
|
||||
};
|
||||
fireWatchCollection("date", mockScope.date);
|
||||
expect(mockScope.ngModel[mockScope.field])
|
||||
.toEqual(moment.utc("1998-01-06 12:34:56").valueOf());
|
||||
});
|
||||
|
||||
describe("once initialized with model state", function () {
|
||||
var testTime = moment.utc("1998-01-06 12:34:56").valueOf();
|
||||
|
||||
beforeEach(function () {
|
||||
fireWatch("ngModel[field]", testTime);
|
||||
});
|
||||
|
||||
it("exposes date/time values in scope", function () {
|
||||
expect(mockScope.date.year).toEqual(1998);
|
||||
expect(mockScope.date.month).toEqual(0); // Months are zero-indexed
|
||||
expect(mockScope.date.day).toEqual(6);
|
||||
expect(mockScope.time.hours).toEqual(12);
|
||||
expect(mockScope.time.minutes).toEqual(34);
|
||||
expect(mockScope.time.seconds).toEqual(56);
|
||||
});
|
||||
|
||||
it("provides names for time properties", function () {
|
||||
Object.keys(mockScope.time).forEach(function (key) {
|
||||
expect(mockScope.nameFor(key))
|
||||
.toEqual(jasmine.any(String));
|
||||
});
|
||||
});
|
||||
|
||||
it("provides options for time properties", function () {
|
||||
Object.keys(mockScope.time).forEach(function (key) {
|
||||
expect(mockScope.optionsFor(key))
|
||||
.toEqual(jasmine.any(Array));
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes times to populate calendar as a table", function () {
|
||||
// Verify that data structure is as expected by template
|
||||
expect(mockScope.table).toEqual(jasmine.any(Array));
|
||||
expect(mockScope.table[0]).toEqual(jasmine.any(Array));
|
||||
expect(mockScope.table[0][0]).toEqual({
|
||||
year: jasmine.any(Number),
|
||||
month: jasmine.any(Number),
|
||||
day: jasmine.any(Number),
|
||||
dayOfYear: jasmine.any(Number)
|
||||
});
|
||||
});
|
||||
|
||||
it("contains the current date in its initial table", function () {
|
||||
var matchingCell;
|
||||
// Should be able to find the selected date
|
||||
mockScope.table.forEach(function (row) {
|
||||
row.forEach(function (cell) {
|
||||
if (cell.dayOfYear === 6) {
|
||||
matchingCell = cell;
|
||||
}
|
||||
});
|
||||
});
|
||||
expect(matchingCell).toEqual({
|
||||
year: 1998,
|
||||
month: 0,
|
||||
day: 6,
|
||||
dayOfYear: 6
|
||||
});
|
||||
});
|
||||
|
||||
it("allows the displayed month to be advanced", function () {
|
||||
// Around the edges of the displayed calendar we
|
||||
// may be in previous or subsequent month, so
|
||||
// test around the middle.
|
||||
var i, originalMonth = mockScope.table[2][0].month;
|
||||
|
||||
function mod12(month) {
|
||||
return ((month % 12) + 12) % 12;
|
||||
}
|
||||
|
||||
for (i = 1; i <= 12; i += 1) {
|
||||
mockScope.changeMonth(1);
|
||||
expect(mockScope.table[2][0].month)
|
||||
.toEqual(mod12(originalMonth + i));
|
||||
}
|
||||
|
||||
for (i = 11; i >= -12; i -= 1) {
|
||||
mockScope.changeMonth(-1);
|
||||
expect(mockScope.table[2][0].month)
|
||||
.toEqual(mod12(originalMonth + i));
|
||||
}
|
||||
});
|
||||
|
||||
it("allows checking if a cell is in the current month", function () {
|
||||
expect(mockScope.isInCurrentMonth(mockScope.table[2][0]))
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
it("allows cells to be selected", function () {
|
||||
mockScope.select(mockScope.table[2][0]);
|
||||
expect(mockScope.isSelected(mockScope.table[2][0]))
|
||||
.toBe(true);
|
||||
mockScope.select(mockScope.table[2][1]);
|
||||
expect(mockScope.isSelected(mockScope.table[2][0]))
|
||||
.toBe(false);
|
||||
expect(mockScope.isSelected(mockScope.table[2][1]))
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
it("allows cells to be compared", function () {
|
||||
var table = mockScope.table;
|
||||
expect(mockScope.dateEquals(table[2][0], table[2][1]))
|
||||
.toBe(false);
|
||||
expect(mockScope.dateEquals(table[2][1], table[2][1]))
|
||||
.toBe(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/controllers/SplitPaneController"],
|
||||
function (SplitPaneController) {
|
||||
"use strict";
|
||||
|
||||
describe("The split pane controller", function () {
|
||||
var controller;
|
||||
|
||||
beforeEach(function () {
|
||||
controller = new SplitPaneController();
|
||||
});
|
||||
|
||||
it("has an initial position", function () {
|
||||
expect(controller.state() > 0).toBeTruthy();
|
||||
});
|
||||
|
||||
it("can be moved", function () {
|
||||
var initialState = controller.state();
|
||||
controller.startMove();
|
||||
controller.move(50);
|
||||
expect(controller.state()).toEqual(initialState + 50);
|
||||
});
|
||||
|
||||
it("clamps its position", function () {
|
||||
var initialState = controller.state();
|
||||
controller.startMove();
|
||||
// Move some really extreme number
|
||||
controller.move(-100000);
|
||||
// Shouldn't have moved below 0...
|
||||
expect(controller.state() > 0).toBeTruthy();
|
||||
// ...but should have moved left somewhere
|
||||
expect(controller.state() < initialState).toBeTruthy();
|
||||
|
||||
// Then do the same to the right
|
||||
controller.move(100000);
|
||||
// Shouldn't have moved below 0...
|
||||
expect(controller.state() < 100000).toBeTruthy();
|
||||
// ...but should have moved left somewhere
|
||||
expect(controller.state() > initialState).toBeTruthy();
|
||||
});
|
||||
|
||||
it("accepts a default state", function () {
|
||||
// Should use default state the first time...
|
||||
expect(controller.state(12321)).toEqual(12321);
|
||||
// ...but not after it's been initialized
|
||||
expect(controller.state(42)).toEqual(12321);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -91,6 +91,39 @@ define(
|
||||
.toHaveBeenCalledWith("ngModel", jasmine.any(Function));
|
||||
});
|
||||
|
||||
describe("when changes are made via form entry", function () {
|
||||
beforeEach(function () {
|
||||
mockScope.ngModel = {
|
||||
outer: { start: DAY * 2, end: DAY * 3 },
|
||||
inner: { start: DAY * 2.25, end: DAY * 2.75 }
|
||||
};
|
||||
mockScope.formModel = {
|
||||
start: DAY * 10000,
|
||||
end: DAY * 11000
|
||||
};
|
||||
// These watches may not exist, but Angular would fire
|
||||
// them if they did.
|
||||
fireWatchCollection("formModel", mockScope.formModel);
|
||||
fireWatch("formModel.start", mockScope.formModel.start);
|
||||
fireWatch("formModel.end", mockScope.formModel.end);
|
||||
});
|
||||
|
||||
it("does not immediately make changes to the model", function () {
|
||||
expect(mockScope.ngModel.outer.start)
|
||||
.not.toEqual(mockScope.formModel.start);
|
||||
expect(mockScope.ngModel.outer.end)
|
||||
.not.toEqual(mockScope.formModel.end);
|
||||
});
|
||||
|
||||
it("updates model bounds on request", function () {
|
||||
mockScope.updateBoundsFromForm();
|
||||
expect(mockScope.ngModel.outer.start)
|
||||
.toEqual(mockScope.formModel.start);
|
||||
expect(mockScope.ngModel.outer.end)
|
||||
.toEqual(mockScope.formModel.end);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when dragged", function () {
|
||||
beforeEach(function () {
|
||||
mockScope.ngModel = {
|
||||
|
||||
@@ -34,14 +34,14 @@ define(
|
||||
mockElement,
|
||||
testAttrs,
|
||||
mockBody,
|
||||
mockParentEl,
|
||||
mockPlainEl,
|
||||
testRect,
|
||||
mctClickElsewhere;
|
||||
|
||||
function testEvent(x, y) {
|
||||
return {
|
||||
pageX: x,
|
||||
pageY: y,
|
||||
clientX: x,
|
||||
clientY: y,
|
||||
preventDefault: jasmine.createSpy("preventDefault")
|
||||
};
|
||||
}
|
||||
@@ -55,8 +55,8 @@ define(
|
||||
jasmine.createSpyObj("element", JQLITE_METHODS);
|
||||
mockBody =
|
||||
jasmine.createSpyObj("body", JQLITE_METHODS);
|
||||
mockParentEl =
|
||||
jasmine.createSpyObj("parent", ["getBoundingClientRect"]);
|
||||
mockPlainEl =
|
||||
jasmine.createSpyObj("htmlElement", ["getBoundingClientRect"]);
|
||||
|
||||
testAttrs = {
|
||||
mctClickElsewhere: "some Angular expression"
|
||||
@@ -67,6 +67,8 @@ define(
|
||||
width: 60,
|
||||
height: 75
|
||||
};
|
||||
mockElement[0] = mockPlainEl;
|
||||
mockPlainEl.getBoundingClientRect.andReturn(testRect);
|
||||
|
||||
mockDocument.find.andReturn(mockBody);
|
||||
|
||||
@@ -78,6 +80,49 @@ define(
|
||||
expect(mctClickElsewhere.restrict).toEqual("A");
|
||||
});
|
||||
|
||||
it("detaches listeners when destroyed", function () {
|
||||
expect(mockBody.off).not.toHaveBeenCalled();
|
||||
mockScope.$on.calls.forEach(function (call) {
|
||||
if (call.args[0] === '$destroy') {
|
||||
call.args[1]();
|
||||
}
|
||||
});
|
||||
expect(mockBody.off).toHaveBeenCalled();
|
||||
expect(mockBody.off.mostRecentCall.args)
|
||||
.toEqual(mockBody.on.mostRecentCall.args);
|
||||
});
|
||||
|
||||
it("listens for mousedown on the document's body", function () {
|
||||
expect(mockBody.on)
|
||||
.toHaveBeenCalledWith('mousedown', jasmine.any(Function));
|
||||
});
|
||||
|
||||
describe("when a click occurs outside the element's bounds", function () {
|
||||
beforeEach(function () {
|
||||
mockBody.on.mostRecentCall.args[1](testEvent(
|
||||
testRect.left + testRect.width + 10,
|
||||
testRect.top + testRect.height + 10
|
||||
));
|
||||
});
|
||||
|
||||
it("triggers an evaluation of its related Angular expression", function () {
|
||||
expect(mockScope.$eval)
|
||||
.toHaveBeenCalledWith(testAttrs.mctClickElsewhere);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when a click occurs within the element's bounds", function () {
|
||||
beforeEach(function () {
|
||||
mockBody.on.mostRecentCall.args[1](testEvent(
|
||||
testRect.left + testRect.width / 2,
|
||||
testRect.top + testRect.height / 2
|
||||
));
|
||||
});
|
||||
|
||||
it("triggers no evaluation", function () {
|
||||
expect(mockScope.$eval).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
208
platform/commonUI/general/test/directives/MCTSplitPaneSpec.js
Normal file
208
platform/commonUI/general/test/directives/MCTSplitPaneSpec.js
Normal file
@@ -0,0 +1,208 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/directives/MCTSplitPane"],
|
||||
function (MCTSplitPane) {
|
||||
'use strict';
|
||||
|
||||
var JQLITE_METHODS = [
|
||||
'on',
|
||||
'addClass',
|
||||
'children',
|
||||
'eq',
|
||||
'toggleClass',
|
||||
'css'
|
||||
];
|
||||
|
||||
describe("The mct-split-pane directive", function () {
|
||||
var mockParse,
|
||||
mockLog,
|
||||
mockInterval,
|
||||
mockParsed,
|
||||
mctSplitPane;
|
||||
|
||||
beforeEach(function () {
|
||||
mockParse = jasmine.createSpy('$parse');
|
||||
mockLog =
|
||||
jasmine.createSpyObj('$log', ['warn', 'info', 'debug']);
|
||||
mockInterval = jasmine.createSpy('$interval');
|
||||
mockInterval.cancel = jasmine.createSpy('mockCancel');
|
||||
mockParsed = jasmine.createSpy('parsed');
|
||||
mockParsed.assign = jasmine.createSpy('assign');
|
||||
|
||||
mockParse.andReturn(mockParsed);
|
||||
|
||||
mctSplitPane = new MCTSplitPane(
|
||||
mockParse,
|
||||
mockLog,
|
||||
mockInterval
|
||||
);
|
||||
});
|
||||
|
||||
it("is only applicable as an element", function () {
|
||||
expect(mctSplitPane.restrict).toEqual("E");
|
||||
});
|
||||
|
||||
describe("when its controller is applied", function () {
|
||||
var mockScope,
|
||||
mockElement,
|
||||
testAttrs,
|
||||
mockChildren,
|
||||
mockFirstPane,
|
||||
mockSplitter,
|
||||
mockSecondPane,
|
||||
controller;
|
||||
|
||||
function fireOn(eventType) {
|
||||
mockScope.$on.calls.forEach(function (call) {
|
||||
if (call.args[0] === eventType) {
|
||||
call.args[1]();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope =
|
||||
jasmine.createSpyObj('$scope', ['$apply', '$watch', '$on']);
|
||||
mockElement =
|
||||
jasmine.createSpyObj('element', JQLITE_METHODS);
|
||||
testAttrs = {};
|
||||
mockChildren =
|
||||
jasmine.createSpyObj('children', JQLITE_METHODS);
|
||||
mockFirstPane =
|
||||
jasmine.createSpyObj('firstPane', JQLITE_METHODS);
|
||||
mockSplitter =
|
||||
jasmine.createSpyObj('splitter', JQLITE_METHODS);
|
||||
mockSecondPane =
|
||||
jasmine.createSpyObj('secondPane', JQLITE_METHODS);
|
||||
|
||||
mockElement.children.andReturn(mockChildren);
|
||||
mockElement[0] = {
|
||||
offsetWidth: 12321,
|
||||
offsetHeight: 45654
|
||||
};
|
||||
mockChildren.eq.andCallFake(function (i) {
|
||||
return [mockFirstPane, mockSplitter, mockSecondPane][i];
|
||||
});
|
||||
mockFirstPane[0] = { offsetWidth: 123, offsetHeight: 456 };
|
||||
mockSplitter[0] = {
|
||||
nodeName: 'mct-splitter',
|
||||
offsetWidth: 10,
|
||||
offsetHeight: 456
|
||||
};
|
||||
mockSecondPane[0] = { offsetWidth: 10, offsetHeight: 456 };
|
||||
|
||||
mockChildren[0] = mockFirstPane[0];
|
||||
mockChildren[1] = mockSplitter[0];
|
||||
mockChildren[3] = mockSecondPane[0];
|
||||
mockChildren.length = 3;
|
||||
|
||||
controller = mctSplitPane.controller[3](
|
||||
mockScope,
|
||||
mockElement,
|
||||
testAttrs
|
||||
);
|
||||
});
|
||||
|
||||
it("sets an interval which does not trigger digests", function () {
|
||||
expect(mockInterval.mostRecentCall.args[3]).toBe(false);
|
||||
});
|
||||
|
||||
it("exposes its splitter's initial position", function () {
|
||||
expect(controller.position()).toEqual(
|
||||
mockFirstPane[0].offsetWidth + mockSplitter[0].offsetWidth
|
||||
);
|
||||
});
|
||||
|
||||
it("exposes the current anchoring mode", function () {
|
||||
expect(controller.anchor()).toEqual({
|
||||
edge : 'left',
|
||||
opposite : 'right',
|
||||
dimension : 'width',
|
||||
orientation : 'vertical'
|
||||
});
|
||||
});
|
||||
|
||||
it("allows classes to be toggled on contained elements", function () {
|
||||
controller.toggleClass('resizing');
|
||||
expect(mockChildren.toggleClass)
|
||||
.toHaveBeenCalledWith('resizing');
|
||||
});
|
||||
|
||||
it("allows positions to be set", function () {
|
||||
var testValue = mockChildren[0].offsetWidth + 50;
|
||||
controller.position(testValue);
|
||||
expect(mockFirstPane.css).toHaveBeenCalledWith(
|
||||
'width',
|
||||
(testValue - mockSplitter[0].offsetWidth) + 'px'
|
||||
);
|
||||
});
|
||||
|
||||
it("issues no warnings under nominal usage", function () {
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("warns if no mct-splitter is present", function () {
|
||||
mockSplitter[0].nodeName = "not-mct-splitter";
|
||||
controller = mctSplitPane.controller[3](
|
||||
mockScope,
|
||||
mockElement,
|
||||
testAttrs
|
||||
);
|
||||
expect(mockLog.warn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("warns if an unknown anchor key is given", function () {
|
||||
testAttrs.anchor = "middle";
|
||||
controller = mctSplitPane.controller[3](
|
||||
mockScope,
|
||||
mockElement,
|
||||
testAttrs
|
||||
);
|
||||
expect(mockLog.warn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updates positions on a timer", function () {
|
||||
mockFirstPane[0].offsetWidth += 100;
|
||||
// Should not reflect the change yet
|
||||
expect(controller.position()).not.toEqual(
|
||||
mockFirstPane[0].offsetWidth + mockSplitter[0].offsetWidth
|
||||
);
|
||||
mockInterval.mostRecentCall.args[0]();
|
||||
expect(controller.position()).toEqual(
|
||||
mockFirstPane[0].offsetWidth + mockSplitter[0].offsetWidth
|
||||
);
|
||||
});
|
||||
|
||||
it("cancels the active interval when scope is destroyed", function () {
|
||||
expect(mockInterval.cancel).not.toHaveBeenCalled();
|
||||
fireOn('$destroy');
|
||||
expect(mockInterval.cancel).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
113
platform/commonUI/general/test/directives/MCTSplitterSpec.js
Normal file
113
platform/commonUI/general/test/directives/MCTSplitterSpec.js
Normal file
@@ -0,0 +1,113 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/directives/MCTSplitter"],
|
||||
function (MCTSplitter) {
|
||||
'use strict';
|
||||
|
||||
describe("The mct-splitter directive", function () {
|
||||
var mctSplitter;
|
||||
|
||||
beforeEach(function () {
|
||||
mctSplitter = new MCTSplitter();
|
||||
});
|
||||
|
||||
it("is applicable to elements", function () {
|
||||
expect(mctSplitter.restrict).toEqual("E");
|
||||
});
|
||||
|
||||
it("depends on the mct-split-pane controller", function () {
|
||||
expect(mctSplitter.require).toEqual("^mctSplitPane");
|
||||
});
|
||||
|
||||
describe("when linked", function () {
|
||||
var mockScope,
|
||||
mockElement,
|
||||
testAttrs,
|
||||
mockSplitPane;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
[ '$on', '$watch' ]
|
||||
);
|
||||
mockElement = jasmine.createSpyObj(
|
||||
'element',
|
||||
[ 'addClass' ]
|
||||
);
|
||||
testAttrs = {};
|
||||
mockSplitPane = jasmine.createSpyObj(
|
||||
'mctSplitPane',
|
||||
[ 'position', 'toggleClass', 'anchor' ]
|
||||
);
|
||||
|
||||
mctSplitter.link(
|
||||
mockScope,
|
||||
mockElement,
|
||||
testAttrs,
|
||||
mockSplitPane
|
||||
);
|
||||
});
|
||||
|
||||
it("adds a splitter class", function () {
|
||||
expect(mockElement.addClass)
|
||||
.toHaveBeenCalledWith('splitter');
|
||||
});
|
||||
|
||||
describe("and then manipulated", function () {
|
||||
var testPosition;
|
||||
|
||||
beforeEach(function () {
|
||||
testPosition = 12321;
|
||||
mockSplitPane.position.andReturn(testPosition);
|
||||
mockSplitPane.anchor.andReturn({
|
||||
orientation: 'vertical',
|
||||
reversed: false
|
||||
});
|
||||
mockScope.splitter.startMove();
|
||||
});
|
||||
|
||||
it("adds a 'resizing' class", function () {
|
||||
expect(mockSplitPane.toggleClass)
|
||||
.toHaveBeenCalledWith('resizing');
|
||||
});
|
||||
|
||||
it("repositions during drag", function () {
|
||||
mockScope.splitter.move([ 10, 0 ]);
|
||||
expect(mockSplitPane.position)
|
||||
.toHaveBeenCalledWith(testPosition + 10);
|
||||
});
|
||||
|
||||
it("removes the 'resizing' class when finished", function () {
|
||||
mockSplitPane.toggleClass.reset();
|
||||
mockScope.splitter.endMove();
|
||||
expect(mockSplitPane.toggleClass)
|
||||
.toHaveBeenCalledWith('resizing');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -8,7 +8,6 @@
|
||||
"controllers/GetterSetterController",
|
||||
"controllers/ObjectInspectorController",
|
||||
"controllers/SelectorController",
|
||||
"controllers/SplitPaneController",
|
||||
"controllers/TimeRangeController",
|
||||
"controllers/ToggleController",
|
||||
"controllers/TreeNodeController",
|
||||
@@ -19,8 +18,11 @@
|
||||
"directives/MCTPopup",
|
||||
"directives/MCTResize",
|
||||
"directives/MCTScroll",
|
||||
"directives/MCTSplitPane",
|
||||
"directives/MCTSplitter",
|
||||
"services/Popup",
|
||||
"services/PopupService",
|
||||
"services/UrlService",
|
||||
"StyleSheetLoader"
|
||||
"StyleSheetLoader",
|
||||
"UnsupportedBrowserWarning"
|
||||
]
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
"implementation": "AgentService.js",
|
||||
"depends": [ "$window" ]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
"implementation": "DeviceClassifier.js",
|
||||
"depends": [ "agentService", "$document" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ define(
|
||||
var userAgent = $window.navigator.userAgent,
|
||||
matches = userAgent.match(/iPad|iPhone|Android/i) || [];
|
||||
|
||||
this.userAgent = userAgent;
|
||||
this.mobileName = matches[0];
|
||||
this.$window = $window;
|
||||
this.touchEnabled = ($window.ontouchstart !== undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,6 +93,26 @@ define(
|
||||
return !this.isPortrait();
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the user's device supports a touch interface.
|
||||
* @returns {boolean} true if touch is supported
|
||||
*/
|
||||
AgentService.prototype.isTouch = function () {
|
||||
return this.touchEnabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the user agent matches a certain named device,
|
||||
* as indicated by checking for a case-insensitive substring
|
||||
* match.
|
||||
* @param {string} name the name to check for
|
||||
* @returns {boolean} true if the user agent includes that name
|
||||
*/
|
||||
AgentService.prototype.isBrowser = function (name) {
|
||||
name = name.toLowerCase();
|
||||
return this.userAgent.toLowerCase().indexOf(name) !== -1;
|
||||
};
|
||||
|
||||
return AgentService;
|
||||
}
|
||||
);
|
||||
|
||||
59
platform/commonUI/mobile/src/DeviceClassifier.js
Normal file
59
platform/commonUI/mobile/src/DeviceClassifier.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
define(
|
||||
['./DeviceMatchers'],
|
||||
function (DeviceMatchers) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Runs at application startup and adds a subset of the following
|
||||
* CSS classes to the body of the document, depending on device
|
||||
* attributes:
|
||||
*
|
||||
* * `mobile`: Phones or tablets.
|
||||
* * `phone`: Phones specifically.
|
||||
* * `tablet`: Tablets specifically.
|
||||
* * `desktop`: Non-mobile devices.
|
||||
* * `portrait`: Devices in a portrait-style orientation.
|
||||
* * `landscape`: Devices in a landscape-style orientation.
|
||||
* * `touch`: Device supports touch events.
|
||||
*
|
||||
* @param {platform/commonUI/mobile.AgentService} agentService
|
||||
* the service used to examine the user agent
|
||||
* @param $document Angular's jqLite-wrapped document element
|
||||
* @constructor
|
||||
*/
|
||||
function MobileClassifier(agentService, $document) {
|
||||
var body = $document.find('body');
|
||||
Object.keys(DeviceMatchers).forEach(function (key) {
|
||||
if (DeviceMatchers[key](agentService)) {
|
||||
body.addClass(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return MobileClassifier;
|
||||
|
||||
}
|
||||
);
|
||||
60
platform/commonUI/mobile/src/DeviceMatchers.js
Normal file
60
platform/commonUI/mobile/src/DeviceMatchers.js
Normal file
@@ -0,0 +1,60 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
define(function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* An object containing key-value pairs, where keys are symbolic of
|
||||
* device attributes, and values are functions that take the
|
||||
* `agentService` as inputs and return boolean values indicating
|
||||
* whether or not the current device has these attributes.
|
||||
*
|
||||
* For internal use by the mobile support bundle.
|
||||
*
|
||||
* @memberof platform/commonUI/mobile
|
||||
* @private
|
||||
*/
|
||||
return {
|
||||
mobile: function (agentService) {
|
||||
return agentService.isMobile();
|
||||
},
|
||||
phone: function (agentService) {
|
||||
return agentService.isPhone();
|
||||
},
|
||||
tablet: function (agentService) {
|
||||
return agentService.isTablet();
|
||||
},
|
||||
desktop: function (agentService) {
|
||||
return !agentService.isMobile();
|
||||
},
|
||||
portrait: function (agentService) {
|
||||
return agentService.isPortrait();
|
||||
},
|
||||
landscape: function (agentService) {
|
||||
return agentService.isLandscape();
|
||||
},
|
||||
touch: function (agentService) {
|
||||
return agentService.isTouch();
|
||||
}
|
||||
};
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user