Compare commits
1 Commits
eslint-one
...
square-wav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
344cbbb92d |
@@ -2,7 +2,7 @@ version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/node:13-browsers
|
||||
- image: circleci/node:8-browsers
|
||||
environment:
|
||||
CHROME_BIN: "/usr/bin/google-chrome"
|
||||
steps:
|
||||
@@ -11,17 +11,17 @@ jobs:
|
||||
name: Update npm
|
||||
command: 'sudo npm install -g npm@latest'
|
||||
- restore_cache:
|
||||
key: dependency-cache-13-{{ checksum "package.json" }}
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Installing dependencies (npm install)
|
||||
command: npm install
|
||||
- save_cache:
|
||||
key: dependency-cache-13-{{ checksum "package.json" }}
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- run:
|
||||
name: npm run test:coverage
|
||||
command: npm run test:coverage
|
||||
name: npm run test
|
||||
command: npm run test
|
||||
- run:
|
||||
name: npm run lint
|
||||
command: npm run lint
|
||||
|
||||
66
.eslintrc.js
66
.eslintrc.js
@@ -1,4 +1,3 @@
|
||||
const LEGACY_FILES = ["platform/**", "example/**"];
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
@@ -11,8 +10,7 @@ module.exports = {
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:vue/recommended",
|
||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
||||
"plugin:vue/recommended"
|
||||
],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
@@ -24,9 +22,6 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"you-dont-need-lodash-underscore/omit": "off",
|
||||
"you-dont-need-lodash-underscore/throttle": "off",
|
||||
"you-dont-need-lodash-underscore/flatten": "off",
|
||||
"no-bitwise": "error",
|
||||
"curly": "error",
|
||||
"eqeqeq": "error",
|
||||
@@ -71,58 +66,6 @@ module.exports = {
|
||||
],
|
||||
"dot-notation": "error",
|
||||
"indent": ["error", 4],
|
||||
|
||||
// https://eslint.org/docs/rules/no-case-declarations
|
||||
"no-case-declarations": "error",
|
||||
// https://eslint.org/docs/rules/max-classes-per-file
|
||||
"max-classes-per-file": ["error", 1],
|
||||
// https://eslint.org/docs/rules/no-eq-null
|
||||
"no-eq-null": "error",
|
||||
// https://eslint.org/docs/rules/no-eval
|
||||
"no-eval": "error",
|
||||
// https://eslint.org/docs/rules/no-floating-decimal
|
||||
"no-floating-decimal": "error",
|
||||
// https://eslint.org/docs/rules/no-implicit-globals
|
||||
"no-implicit-globals": "error",
|
||||
// https://eslint.org/docs/rules/no-implied-eval
|
||||
"no-implied-eval": "error",
|
||||
// https://eslint.org/docs/rules/no-lone-blocks
|
||||
"no-lone-blocks": "error",
|
||||
// https://eslint.org/docs/rules/no-loop-func
|
||||
"no-loop-func": "error",
|
||||
// https://eslint.org/docs/rules/no-new-func
|
||||
"no-new-func": "error",
|
||||
// https://eslint.org/docs/rules/no-new-wrappers
|
||||
"no-new-wrappers": "error",
|
||||
// https://eslint.org/docs/rules/no-octal-escape
|
||||
"no-octal-escape": "error",
|
||||
// https://eslint.org/docs/rules/no-proto
|
||||
"no-proto": "error",
|
||||
// https://eslint.org/docs/rules/no-return-await
|
||||
"no-return-await": "error",
|
||||
// https://eslint.org/docs/rules/no-script-url
|
||||
"no-script-url": "error",
|
||||
// https://eslint.org/docs/rules/no-self-compare
|
||||
"no-self-compare": "error",
|
||||
// https://eslint.org/docs/rules/no-sequences
|
||||
"no-sequences": "error",
|
||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||
"no-unmodified-loop-condition": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-call
|
||||
"no-useless-call": "error",
|
||||
// https://eslint.org/docs/rules/wrap-iife
|
||||
"wrap-iife": "error",
|
||||
// https://eslint.org/docs/rules/no-nested-ternary
|
||||
"no-nested-ternary": "error",
|
||||
// https://eslint.org/docs/rules/switch-colon-spacing
|
||||
"switch-colon-spacing": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||
"no-useless-computed-key": "error",
|
||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
||||
"rest-spread-spacing": ["error"],
|
||||
// https://eslint.org/docs/rules/one-var
|
||||
"one-var": ["error", "never"],
|
||||
|
||||
"vue/html-indent": [
|
||||
"error",
|
||||
4,
|
||||
@@ -169,13 +112,6 @@ module.exports = {
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
"files": LEGACY_FILES,
|
||||
"rules": {
|
||||
// https://eslint.org/docs/rules/no-nested-ternary
|
||||
"no-nested-ternary": "off",
|
||||
"no-var": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -37,7 +37,4 @@ protractor/logs
|
||||
# npm-debug log
|
||||
npm-debug.log
|
||||
|
||||
# karma reports
|
||||
report.*.json
|
||||
|
||||
package-lock.json
|
||||
|
||||
4
API.md
4
API.md
@@ -427,8 +427,8 @@ Each telemetry value description has an object defining hints. Keys in this thi
|
||||
|
||||
Known hints:
|
||||
|
||||
* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
||||
* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
||||
* `domain`: Indicates that the value represents the "input" of a datum. Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
||||
* `range`: Indicates that the value is the "output" of a datum. Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
||||
* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
||||
|
||||
##### The Time Conductor and Telemetry
|
||||
|
||||
200
CONTRIBUTING.md
200
CONTRIBUTING.md
@@ -103,7 +103,7 @@ the name chosen could not be mistaken for a topic or master branch.
|
||||
### Merging
|
||||
|
||||
When development is complete on an issue, the first step toward merging it
|
||||
back into the master branch is to file a Pull Request (PR). The contributions
|
||||
back into the master branch is to file a Pull Request. The contributions
|
||||
should meet code, test, and commit message standards as described below,
|
||||
and the pull request should include a completed author checklist, also
|
||||
as described below. Pull requests may be assigned to specific team
|
||||
@@ -114,15 +114,6 @@ request. When the reviewer is satisfied, they should add a comment to
|
||||
the pull request containing the reviewer checklist (from below) and complete
|
||||
the merge back to the master branch.
|
||||
|
||||
Additionally:
|
||||
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, create one.
|
||||
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
||||
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
||||
* When a pull request is merged, and the corresponding issue closed, the __reviewer__ must add the tag “unverified” to the original issue. This will indicate that although the issue is closed, it has not been tested yet.
|
||||
* Every PR must have two reviewers assigned, though only one approval is necessary for merge.
|
||||
* Changes to API require approval by a senior developer.
|
||||
* When creating a PR, it is the author's responsibility to apply any priority label from the issue to the PR as well. This helps with prioritization.
|
||||
|
||||
## Standards
|
||||
|
||||
Contributions to Open MCT are expected to meet the following standards.
|
||||
@@ -131,104 +122,97 @@ changes.
|
||||
|
||||
### Code Standards
|
||||
|
||||
JavaScript sources in Open MCT must satisfy the ESLint rules defined in
|
||||
this repository. This is verified by the command line build.
|
||||
JavaScript sources in Open MCT must satisfy JSLint under its default
|
||||
settings. This is verified by the command line build.
|
||||
|
||||
#### Code Guidelines
|
||||
|
||||
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
||||
JavaScript sources in Open MCT should:
|
||||
|
||||
* Use four spaces for indentation. Tabs should not be used.
|
||||
* Include JSDoc for any exposed API (e.g. public methods, constructors).
|
||||
* Include non-JSDoc comments as-needed for explaining private variables,
|
||||
methods, or algorithms when they are non-obvious.
|
||||
* Define one public class per script, expressed as a constructor function
|
||||
returned from an AMD-style module.
|
||||
* Follow “Java-like” naming conventions. These includes:
|
||||
* Classes should use camel case, first letter capitalized
|
||||
(e.g. SomeClassName).
|
||||
* Methods, variables, fields, and function names should use camel case,
|
||||
first letter lower-case (e.g. someVariableName).
|
||||
* Constants (variables or fields which are meant to be declared and
|
||||
initialized statically, and never changed) should use only capital
|
||||
letters, with underscores between words (e.g. SOME_CONSTANT).
|
||||
* File names should be the name of the exported class, plus a .js extension
|
||||
(e.g. SomeClassName.js).
|
||||
* Avoid anonymous functions, except when functions are short (a few lines)
|
||||
and/or their inclusion makes sense within the flow of the code
|
||||
(e.g. as arguments to a forEach call).
|
||||
* Avoid deep nesting (especially of functions), except where necessary
|
||||
(e.g. due to closure scope).
|
||||
* End with a single new-line character.
|
||||
* Expose public methods by declaring them on the class's prototype.
|
||||
* Within a given function's scope, do not mix declarations and imperative
|
||||
code, and present these in the following order:
|
||||
* First, variable declarations and initialization.
|
||||
* Second, function declarations.
|
||||
* Third, imperative statements.
|
||||
* Finally, the returned value.
|
||||
|
||||
1. Write clean code. Here’s a good summary - https://github.com/ryanmcdermott/clean-code-javascript.
|
||||
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
||||
1. Include non-JSDoc comments as-needed for explaining private variables,
|
||||
methods, or algorithms when they are non-obvious. Otherwise code
|
||||
should be self-documenting.
|
||||
1. Classes and Vue components should use camel case, first letter capitalized
|
||||
(e.g. SomeClassName).
|
||||
1. Methods, variables, fields, events, and function names should use camelCase,
|
||||
first letter lower-case (e.g. someVariableName).
|
||||
1. Source files that export functions should use camelCase, first letter lower-case (eg. testTools.js)
|
||||
1. Constants (variables or fields which are meant to be declared and
|
||||
initialized statically, and never changed) should use only capital
|
||||
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
||||
1. File names should be the name of the exported class, plus a .js extension
|
||||
(e.g. SomeClassName.js).
|
||||
1. Avoid anonymous functions, except when functions are short (one or two lines)
|
||||
and their inclusion makes sense within the flow of the code
|
||||
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
||||
1. Named functions are preferred over functions assigned to variables.
|
||||
eg.
|
||||
```JavaScript
|
||||
function renameObject(object, newName) {
|
||||
Object.name = newName;
|
||||
}
|
||||
```
|
||||
is preferable to
|
||||
```JavaScript
|
||||
const rename = (object, newName) => {
|
||||
Object.name = newName;
|
||||
}
|
||||
```
|
||||
1. Avoid deep nesting (especially of functions), except where necessary
|
||||
(e.g. due to closure scope).
|
||||
1. End with a single new-line character.
|
||||
1. Always use ES6 `Class`es and inheritence rather than the pre-ES6 prototypal
|
||||
pattern.
|
||||
1. Within a given function's scope, do not mix declarations and imperative
|
||||
code, and present these in the following order:
|
||||
* First, variable declarations and initialization.
|
||||
* Secondly, imperative statements.
|
||||
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
||||
1. Avoid the use of "magic" values.
|
||||
eg.
|
||||
```JavaScript
|
||||
Const UNAUTHORIZED = 401
|
||||
if (responseCode === UNAUTHORIZED)
|
||||
```
|
||||
is preferable to
|
||||
```JavaScript
|
||||
if (responseCode === 401)
|
||||
```
|
||||
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
||||
1. Test specs should reside alongside the source code they test, not in a separate directory.
|
||||
1. Organize code by feature, not by type.
|
||||
eg.
|
||||
```
|
||||
- telemetryTable
|
||||
- row
|
||||
TableRow.js
|
||||
TableRowCollection.js
|
||||
TableRow.vue
|
||||
- column
|
||||
TableColumn.js
|
||||
TableColumn.vue
|
||||
plugin.js
|
||||
pluginSpec.js
|
||||
```
|
||||
is preferable to
|
||||
```
|
||||
- telemetryTable
|
||||
- components
|
||||
TableRow.vue
|
||||
TableColumn.vue
|
||||
- collections
|
||||
TableRowCollection.js
|
||||
TableColumn.js
|
||||
TableRow.js
|
||||
plugin.js
|
||||
pluginSpec.js
|
||||
```
|
||||
Deviations from Open MCT code style guidelines require two-party agreement,
|
||||
typically from the author of the change and its reviewer.
|
||||
|
||||
#### Code Example
|
||||
|
||||
```js
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* Bundles should declare themselves as namespaces in whichever source
|
||||
* file is most like the "main point of entry" to the bundle.
|
||||
* @namespace some/bundle
|
||||
*/
|
||||
define(
|
||||
['./OtherClass'],
|
||||
function (OtherClass) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A summary of how to use this class goes here.
|
||||
*
|
||||
* @constructor
|
||||
* @memberof some/bundle
|
||||
*/
|
||||
function ExampleClass() {
|
||||
}
|
||||
|
||||
// Methods which are not intended for external use should
|
||||
// not have JSDoc (or should be marked @private)
|
||||
ExampleClass.prototype.privateMethod = function () {
|
||||
};
|
||||
|
||||
/**
|
||||
* A summary of this method goes here.
|
||||
* @param {number} n a parameter
|
||||
* @returns {number} a return value
|
||||
*/
|
||||
ExampleClass.prototype.publicMethod = function (n) {
|
||||
return n * 2;
|
||||
}
|
||||
|
||||
return ExampleClass;
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Test Standards
|
||||
|
||||
Automated testing shall occur whenever changes are merged into the main
|
||||
development branch and must be confirmed alongside any pull request.
|
||||
|
||||
Automated tests are tests which exercise plugins, API, and utility classes.
|
||||
Tests are subject to code review along with the actual implementation, to
|
||||
ensure that tests are applicable and useful.
|
||||
Automated tests are typically unit 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.
|
||||
|
||||
Examples of useful tests:
|
||||
* Tests which replicate bugs (or their root causes) to verify their
|
||||
@@ -238,26 +222,8 @@ Examples of useful tests:
|
||||
* Tests which verify expected interactions with other components in the
|
||||
system.
|
||||
|
||||
#### Guidelines
|
||||
* 100% statement coverage is achievable and desirable.
|
||||
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
|
||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
||||
* Where builtin functions have been mocked, be sure to clear them between tests.
|
||||
* Test at an appropriate level of isolation. Eg.
|
||||
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
||||
* You do not need to test that the view switcher works, there should be separate tests for that.
|
||||
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
||||
* Use your best judgement when deciding on appropriate scope.
|
||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
||||
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
|
||||
|
||||
#### Examples
|
||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
||||
During automated testing, code coverage metrics will be reported. Line
|
||||
coverage must remain at or above 80%.
|
||||
|
||||
### Commit Message Standards
|
||||
|
||||
@@ -326,7 +292,6 @@ checklist).
|
||||
2. Unit tests included and/or updated with changes?
|
||||
3. Command line build passes?
|
||||
4. Changes have been smoke-tested?
|
||||
5. Testing instructions included?
|
||||
|
||||
### Reviewer Checklist
|
||||
|
||||
@@ -334,4 +299,3 @@ checklist).
|
||||
2. Appropriate unit tests included?
|
||||
3. Code style and in-line documentation are appropriate?
|
||||
4. Commit messages meet standards?
|
||||
5. Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Open MCT License
|
||||
|
||||
Open MCT, Copyright (c) 2014-2020, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||
Open MCT, Copyright (c) 2014-2019, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||
|
||||
Open MCT is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
|
||||
@@ -125,22 +125,3 @@ 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.
|
||||
|
||||
### Testathons
|
||||
Testathons can be used as a means of performing per-sprint and per-release testing.
|
||||
|
||||
#### Timing
|
||||
For per-sprint testing, a testathon is typically performed at the beginning of the third week of a sprint, and again later that week to verify any fixes. For per-release testing, a testathon is typically performed prior to any formal testing processes that are applicable to that release.
|
||||
|
||||
#### Process
|
||||
|
||||
1. Prior to the scheduled testathon, a list will be compiled of all issues that are closed and unverified.
|
||||
2. For each issue, testers should review the associated PR for testing instructions. See the contributing guide for instructions on [pull requests](https://github.com/nasa/openmct/blob/master/CONTRIBUTING.md#merging).
|
||||
3. As each issue is verified via testing, any team members testing it should leave a comment on that issue indicating that it has been verified fixed.
|
||||
4. If a bug is found that relates to an issue being tested, notes should be included on the associated issue, and the issue should be reopened. Bug notes should include reproduction steps.
|
||||
5. For any bugs that are not obviously related to any of the issues under test, a new issue should be created with details about the bug, including reproduction steps. If unsure about whether a bug relates to an issue being tested, just create a new issue.
|
||||
6. At the end of the testathon, triage will take place, where all tested issues will be reviewed.
|
||||
7. If verified fixed, an issue will remain closed, and will have the “unverified” label removed.
|
||||
8. For any bugs found, a severity will be assigned.
|
||||
9. A second testathon will be scheduled for later in the week that will aim to address all issues identified as blockers, as well as any other issues scoped by the team during triage.
|
||||
10. Any issues that were not tested will remain "unverified" and will be picked up in the next testathon.
|
||||
|
||||
@@ -35,9 +35,9 @@ define(
|
||||
|
||||
function EventTelemetry(request, interval) {
|
||||
|
||||
var latestObservedTime = Date.now();
|
||||
var count = Math.floor((latestObservedTime - firstObservedTime) / interval);
|
||||
var generatorData = {};
|
||||
var latestObservedTime = Date.now(),
|
||||
count = Math.floor((latestObservedTime - firstObservedTime) / interval),
|
||||
generatorData = {};
|
||||
|
||||
generatorData.getPointCount = function () {
|
||||
return count;
|
||||
@@ -49,8 +49,8 @@ define(
|
||||
};
|
||||
|
||||
generatorData.getRangeValue = function (i, range) {
|
||||
var domainDelta = this.getDomainValue(i) - firstObservedTime;
|
||||
var ind = i % messages.length;
|
||||
var domainDelta = this.getDomainValue(i) - firstObservedTime,
|
||||
ind = i % messages.length;
|
||||
return messages[ind] + " - [" + domainDelta.toString() + "]";
|
||||
};
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ define(
|
||||
* @constructor
|
||||
*/
|
||||
function EventTelemetryProvider($q, $timeout) {
|
||||
var subscriptions = [];
|
||||
var genInterval = 1000;
|
||||
var generating = false;
|
||||
var subscriptions = [],
|
||||
genInterval = 1000,
|
||||
generating = false;
|
||||
|
||||
//
|
||||
function matchesSource(request) {
|
||||
|
||||
@@ -40,23 +40,23 @@ define([], function () {
|
||||
}
|
||||
|
||||
ExportTelemetryAsCSVAction.prototype.perform = function () {
|
||||
var context = this.context;
|
||||
var domainObject = context.domainObject;
|
||||
var telemetry = domainObject.getCapability("telemetry");
|
||||
var metadata = telemetry.getMetadata();
|
||||
var domains = metadata.domains;
|
||||
var ranges = metadata.ranges;
|
||||
var exportService = this.exportService;
|
||||
var context = this.context,
|
||||
domainObject = context.domainObject,
|
||||
telemetry = domainObject.getCapability("telemetry"),
|
||||
metadata = telemetry.getMetadata(),
|
||||
domains = metadata.domains,
|
||||
ranges = metadata.ranges,
|
||||
exportService = this.exportService;
|
||||
|
||||
function getName(domainOrRange) {
|
||||
return domainOrRange.name;
|
||||
}
|
||||
|
||||
telemetry.requestData({}).then(function (series) {
|
||||
var headers = domains.map(getName).concat(ranges.map(getName));
|
||||
var rows = [];
|
||||
var row;
|
||||
var i;
|
||||
var headers = domains.map(getName).concat(ranges.map(getName)),
|
||||
rows = [],
|
||||
row,
|
||||
i;
|
||||
|
||||
function copyDomainsToRow(telemetryRow, index) {
|
||||
domains.forEach(function (domain) {
|
||||
|
||||
@@ -5,6 +5,38 @@ define([
|
||||
) {
|
||||
|
||||
var METADATA_BY_TYPE = {
|
||||
'squareWaveGenerator': {
|
||||
values: [
|
||||
{
|
||||
key: "name",
|
||||
name: "Name"
|
||||
},
|
||||
{
|
||||
key: "utc",
|
||||
name: "Time",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "yesterday",
|
||||
name: "Yesterday",
|
||||
format: "utc",
|
||||
hints: {
|
||||
domain: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "square",
|
||||
name: "Square",
|
||||
formatString: '%d',
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'generator': {
|
||||
values: [
|
||||
{
|
||||
@@ -28,16 +60,6 @@ define([
|
||||
domain: 2
|
||||
}
|
||||
},
|
||||
// Need to enable "LocalTimeSystem" plugin to make use of this
|
||||
// {
|
||||
// key: "local",
|
||||
// name: "Time",
|
||||
// format: "local-format",
|
||||
// source: "utc",
|
||||
// hints: {
|
||||
// domain: 3
|
||||
// }
|
||||
// },
|
||||
{
|
||||
key: "sin",
|
||||
name: "Sine",
|
||||
@@ -60,8 +82,7 @@ define([
|
||||
values: [
|
||||
{
|
||||
key: "name",
|
||||
name: "Name",
|
||||
format: "string"
|
||||
name: "Name"
|
||||
},
|
||||
{
|
||||
key: "utc",
|
||||
@@ -71,15 +92,6 @@ define([
|
||||
domain: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "local",
|
||||
name: "Time",
|
||||
format: "utc",
|
||||
source: "utc",
|
||||
hints: {
|
||||
domain: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "state",
|
||||
source: "value",
|
||||
@@ -119,7 +131,7 @@ define([
|
||||
};
|
||||
|
||||
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
return Object.assign(
|
||||
return _.extend(
|
||||
{},
|
||||
domainObject.telemetry,
|
||||
METADATA_BY_TYPE[domainObject.type]
|
||||
|
||||
@@ -28,39 +28,39 @@ define([
|
||||
) {
|
||||
|
||||
var RED = {
|
||||
sin: 0.9,
|
||||
cos: 0.9
|
||||
};
|
||||
var YELLOW = {
|
||||
sin: 0.5,
|
||||
cos: 0.5
|
||||
};
|
||||
var LIMITS = {
|
||||
rh: {
|
||||
cssClass: "is-limit--upr is-limit--red",
|
||||
low: RED,
|
||||
high: Number.POSITIVE_INFINITY,
|
||||
name: "Red High"
|
||||
sin: 0.9,
|
||||
cos: 0.9
|
||||
},
|
||||
rl: {
|
||||
cssClass: "is-limit--lwr is-limit--red",
|
||||
high: -RED,
|
||||
low: Number.NEGATIVE_INFINITY,
|
||||
name: "Red Low"
|
||||
YELLOW = {
|
||||
sin: 0.5,
|
||||
cos: 0.5
|
||||
},
|
||||
yh: {
|
||||
cssClass: "is-limit--upr is-limit--yellow",
|
||||
low: YELLOW,
|
||||
high: RED,
|
||||
name: "Yellow High"
|
||||
},
|
||||
yl: {
|
||||
cssClass: "is-limit--lwr is-limit--yellow",
|
||||
low: -RED,
|
||||
high: -YELLOW,
|
||||
name: "Yellow Low"
|
||||
}
|
||||
};
|
||||
LIMITS = {
|
||||
rh: {
|
||||
cssClass: "is-limit--upr is-limit--red",
|
||||
low: RED,
|
||||
high: Number.POSITIVE_INFINITY,
|
||||
name: "Red High"
|
||||
},
|
||||
rl: {
|
||||
cssClass: "is-limit--lwr is-limit--red",
|
||||
high: -RED,
|
||||
low: Number.NEGATIVE_INFINITY,
|
||||
name: "Red Low"
|
||||
},
|
||||
yh: {
|
||||
cssClass: "is-limit--upr is-limit--yellow",
|
||||
low: YELLOW,
|
||||
high: RED,
|
||||
name: "Yellow High"
|
||||
},
|
||||
yl: {
|
||||
cssClass: "is-limit--lwr is-limit--yellow",
|
||||
low: -RED,
|
||||
high: -YELLOW,
|
||||
name: "Yellow Low"
|
||||
}
|
||||
};
|
||||
|
||||
function SinewaveLimitProvider() {
|
||||
|
||||
|
||||
68
example/generator/SquareWaveGeneratorProvider.js
Normal file
68
example/generator/SquareWaveGeneratorProvider.js
Normal file
@@ -0,0 +1,68 @@
|
||||
define([
|
||||
'./WorkerInterface'
|
||||
], function (
|
||||
WorkerInterface
|
||||
) {
|
||||
var REQUEST_DEFAULTS = {
|
||||
amplitude: 1,
|
||||
period: 10,
|
||||
offset: 0,
|
||||
dataRateInHz: 1,
|
||||
phase: 0
|
||||
};
|
||||
|
||||
function SquareWaveGeneratorProvider() {
|
||||
this.workerInterface = new WorkerInterface();
|
||||
}
|
||||
|
||||
SquareWaveGeneratorProvider.prototype.canProvideTelemetry = function (domainObject) {
|
||||
return domainObject.type === 'squareWaveGenerator';
|
||||
};
|
||||
|
||||
SquareWaveGeneratorProvider.prototype.supportsRequest =
|
||||
SquareWaveGeneratorProvider.prototype.supportsSubscribe =
|
||||
SquareWaveGeneratorProvider.prototype.canProvideTelemetry;
|
||||
|
||||
SquareWaveGeneratorProvider.prototype.makeWorkerRequest = function (domainObject, request) {
|
||||
var props = [
|
||||
'amplitude',
|
||||
'period',
|
||||
'offset',
|
||||
'dataRateInHz',
|
||||
'phase',
|
||||
];
|
||||
|
||||
request = request || {};
|
||||
|
||||
var workerRequest = {};
|
||||
|
||||
props.forEach(function (prop) {
|
||||
if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) {
|
||||
workerRequest[prop] = domainObject.telemetry[prop];
|
||||
}
|
||||
if (request && request.hasOwnProperty(prop)) {
|
||||
workerRequest[prop] = request[prop];
|
||||
}
|
||||
if (!workerRequest.hasOwnProperty(prop)) {
|
||||
workerRequest[prop] = REQUEST_DEFAULTS[prop];
|
||||
}
|
||||
workerRequest[prop] = Number(workerRequest[prop]);
|
||||
});
|
||||
workerRequest.name = domainObject.name;
|
||||
return workerRequest;
|
||||
};
|
||||
|
||||
SquareWaveGeneratorProvider.prototype.request = function (domainObject, request) {
|
||||
var workerRequest = this.makeWorkerRequest(domainObject, request);
|
||||
workerRequest.start = request.start;
|
||||
workerRequest.end = request.end;
|
||||
return this.workerInterface.request(workerRequest);
|
||||
};
|
||||
|
||||
SquareWaveGeneratorProvider.prototype.subscribe = function (domainObject, callback) {
|
||||
var workerRequest = this.makeWorkerRequest(domainObject, {});
|
||||
return this.workerInterface.subscribe(workerRequest, callback);
|
||||
};
|
||||
|
||||
return SquareWaveGeneratorProvider;
|
||||
});
|
||||
@@ -66,7 +66,8 @@
|
||||
utc: nextStep,
|
||||
yesterday: nextStep - 60*60*24*1000,
|
||||
sin: sin(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness),
|
||||
cos: cos(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness)
|
||||
cos: cos(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness),
|
||||
square: square(nextStep, data.period, data.amplitude, data.offset, data.phase)
|
||||
}
|
||||
});
|
||||
nextStep += step;
|
||||
@@ -112,7 +113,8 @@
|
||||
utc: nextStep,
|
||||
yesterday: nextStep - 60*60*24*1000,
|
||||
sin: sin(nextStep, period, amplitude, offset, phase, randomness),
|
||||
cos: cos(nextStep, period, amplitude, offset, phase, randomness)
|
||||
cos: cos(nextStep, period, amplitude, offset, phase, randomness),
|
||||
square: square(nextStep, period, amplitude, offset, phase)
|
||||
});
|
||||
}
|
||||
self.postMessage({
|
||||
@@ -121,6 +123,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
function square(timestamp, period, amplitude, offset, phase) {
|
||||
var sinValue = Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + offset;
|
||||
var value = sinValue > 0 ? amplitude : -amplitude;
|
||||
return value;
|
||||
}
|
||||
|
||||
function cos(timestamp, period, amplitude, offset, phase, randomness) {
|
||||
return amplitude *
|
||||
Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
|
||||
|
||||
@@ -25,11 +25,13 @@ define([
|
||||
"./GeneratorProvider",
|
||||
"./SinewaveLimitProvider",
|
||||
"./StateGeneratorProvider",
|
||||
"./SquareWaveGeneratorProvider",
|
||||
"./GeneratorMetadataProvider"
|
||||
], function (
|
||||
GeneratorProvider,
|
||||
SinewaveLimitProvider,
|
||||
StateGeneratorProvider,
|
||||
SquareWaveGeneratorProvider,
|
||||
GeneratorMetadataProvider
|
||||
) {
|
||||
|
||||
@@ -62,6 +64,80 @@ define([
|
||||
|
||||
openmct.telemetry.addProvider(new StateGeneratorProvider());
|
||||
|
||||
openmct.types.addType("squareWaveGenerator", {
|
||||
name: "Square Wave Generator",
|
||||
description: "For development use. Generates example streaming telemetry data using a simple sqaure wave algorithm.",
|
||||
cssClass: "icon-generator-telemetry",
|
||||
creatable: true,
|
||||
form: [
|
||||
{
|
||||
name: "Period",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "period",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"period"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Amplitude",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "amplitude",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"amplitude"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Offset",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "offset",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"offset"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Data Rate (hz)",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "dataRateInHz",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"dataRateInHz"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Phase (radians)",
|
||||
control: "numberfield",
|
||||
cssClass: "l-input-sm l-numeric",
|
||||
key: "phase",
|
||||
required: true,
|
||||
property: [
|
||||
"telemetry",
|
||||
"phase"
|
||||
]
|
||||
}
|
||||
],
|
||||
initialize: function (object) {
|
||||
object.telemetry = {
|
||||
period: 10,
|
||||
amplitude: 5,
|
||||
offset: 0,
|
||||
dataRateInHz: 10,
|
||||
phase: 0
|
||||
};
|
||||
}
|
||||
});
|
||||
openmct.telemetry.addProvider(new SquareWaveGeneratorProvider());
|
||||
|
||||
openmct.types.addType("generator", {
|
||||
name: "Sine Wave Generator",
|
||||
description: "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
|
||||
|
||||
@@ -25,24 +25,24 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var DEFAULT_IDENTITY = { key: "user", name: "Example User" };
|
||||
var DIALOG_STRUCTURE = {
|
||||
name: "Identify Yourself",
|
||||
sections: [{ rows: [
|
||||
{
|
||||
name: "User ID",
|
||||
control: "textfield",
|
||||
key: "key",
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "Human name",
|
||||
control: "textfield",
|
||||
key: "name",
|
||||
required: true
|
||||
}
|
||||
]}]
|
||||
};
|
||||
var DEFAULT_IDENTITY = { key: "user", name: "Example User" },
|
||||
DIALOG_STRUCTURE = {
|
||||
name: "Identify Yourself",
|
||||
sections: [{ rows: [
|
||||
{
|
||||
name: "User ID",
|
||||
control: "textfield",
|
||||
key: "key",
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "Human name",
|
||||
control: "textfield",
|
||||
key: "name",
|
||||
required: true
|
||||
}
|
||||
]}]
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,7 +52,6 @@ define([
|
||||
return {
|
||||
name: name,
|
||||
utc: Math.floor(timestamp / 5000) * 5000,
|
||||
local: Math.floor(timestamp / 5000) * 5000,
|
||||
url: IMAGE_SAMPLES[Math.floor(timestamp / 5000) % IMAGE_SAMPLES.length]
|
||||
};
|
||||
}
|
||||
@@ -79,7 +78,7 @@ define([
|
||||
},
|
||||
request: function (domainObject, options) {
|
||||
var start = options.start;
|
||||
var end = Math.min(options.end, Date.now());
|
||||
var end = options.end;
|
||||
var data = [];
|
||||
while (start <= end && data.length < 5000) {
|
||||
data.push(pointForTimestamp(start, domainObject.name));
|
||||
@@ -119,14 +118,6 @@ define([
|
||||
name: 'Time',
|
||||
key: 'utc',
|
||||
format: 'utc',
|
||||
hints: {
|
||||
domain: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Local Time',
|
||||
key: 'local',
|
||||
format: 'local-format',
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ define(
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
var PREFIX = "msl_tlm:";
|
||||
var FORMAT_MAPPINGS = {
|
||||
float: "number",
|
||||
integer: "number",
|
||||
string: "string"
|
||||
};
|
||||
var PREFIX = "msl_tlm:",
|
||||
FORMAT_MAPPINGS = {
|
||||
float: "number",
|
||||
integer: "number",
|
||||
string: "string"
|
||||
};
|
||||
|
||||
function RemsTelemetryModelProvider(adapter) {
|
||||
|
||||
@@ -64,8 +64,8 @@ define(
|
||||
}
|
||||
|
||||
function addInstrument(subsystem, spacecraftId) {
|
||||
var measurements = (subsystem.measurements || []);
|
||||
var instrumentId = makeId(subsystem);
|
||||
var measurements = (subsystem.measurements || []),
|
||||
instrumentId = makeId(subsystem);
|
||||
|
||||
models[instrumentId] = {
|
||||
type: "msl.instrument",
|
||||
|
||||
@@ -42,9 +42,9 @@ define (
|
||||
* object that wraps the telemetry returned from the telemetry source.
|
||||
*/
|
||||
RemsTelemetryProvider.prototype.requestTelemetry = function (requests) {
|
||||
var packaged = {};
|
||||
var relevantReqs;
|
||||
var adapter = this.adapter;
|
||||
var packaged = {},
|
||||
relevantReqs,
|
||||
adapter = this.adapter;
|
||||
|
||||
function matchesSource(request) {
|
||||
return (request.source === SOURCE);
|
||||
|
||||
@@ -30,8 +30,8 @@ define(
|
||||
function (MSLDataDictionary, module) {
|
||||
"use strict";
|
||||
|
||||
var TERRESTRIAL_DATE = "terrestrial_date";
|
||||
var LOCAL_DATA = "../data/rems.json";
|
||||
var TERRESTRIAL_DATE = "terrestrial_date",
|
||||
LOCAL_DATA = "../data/rems.json";
|
||||
|
||||
/**
|
||||
* Fetches historical data from the REMS instrument on the Curiosity
|
||||
@@ -69,8 +69,8 @@ define(
|
||||
* @private
|
||||
*/
|
||||
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
|
||||
var self = this;
|
||||
var id = request.key;
|
||||
var self = this,
|
||||
id = request.key;
|
||||
|
||||
var dataTransforms = this.dataTransforms;
|
||||
|
||||
|
||||
@@ -44,31 +44,31 @@ define(
|
||||
periodically with the progress of an ongoing process.
|
||||
*/
|
||||
$scope.launchProgress = function (knownProgress) {
|
||||
var dialog;
|
||||
var model = {
|
||||
title: "Progress Dialog Example",
|
||||
progress: 0,
|
||||
hint: "Do not navigate away from this page or close this browser tab while this operation is in progress.",
|
||||
actionText: "Calculating...",
|
||||
unknownProgress: !knownProgress,
|
||||
unknownDuration: false,
|
||||
severity: "info",
|
||||
options: [
|
||||
{
|
||||
label: "Cancel Operation",
|
||||
callback: function () {
|
||||
$log.debug("Operation cancelled");
|
||||
dialog.dismiss();
|
||||
var dialog,
|
||||
model = {
|
||||
title: "Progress Dialog Example",
|
||||
progress: 0,
|
||||
hint: "Do not navigate away from this page or close this browser tab while this operation is in progress.",
|
||||
actionText: "Calculating...",
|
||||
unknownProgress: !knownProgress,
|
||||
unknownDuration: false,
|
||||
severity: "info",
|
||||
options: [
|
||||
{
|
||||
label: "Cancel Operation",
|
||||
callback: function () {
|
||||
$log.debug("Operation cancelled");
|
||||
dialog.dismiss();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Do something else...",
|
||||
callback: function () {
|
||||
$log.debug("Something else pressed");
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Do something else...",
|
||||
callback: function () {
|
||||
$log.debug("Something else pressed");
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
]
|
||||
};
|
||||
|
||||
function incrementProgress() {
|
||||
model.progress = Math.min(100, Math.floor(model.progress + Math.random() * 30));
|
||||
@@ -96,28 +96,28 @@ define(
|
||||
Demonstrates launching an error dialog
|
||||
*/
|
||||
$scope.launchError = function () {
|
||||
var dialog;
|
||||
var model = {
|
||||
title: "Error Dialog Example",
|
||||
actionText: "Something happened, and it was not good.",
|
||||
severity: "error",
|
||||
options: [
|
||||
{
|
||||
label: "Try Again",
|
||||
callback: function () {
|
||||
$log.debug("Try Again Pressed");
|
||||
dialog.dismiss();
|
||||
var dialog,
|
||||
model = {
|
||||
title: "Error Dialog Example",
|
||||
actionText: "Something happened, and it was not good.",
|
||||
severity: "error",
|
||||
options: [
|
||||
{
|
||||
label: "Try Again",
|
||||
callback: function () {
|
||||
$log.debug("Try Again Pressed");
|
||||
dialog.dismiss();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Cancel",
|
||||
callback: function () {
|
||||
$log.debug("Cancel Pressed");
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Cancel",
|
||||
callback: function () {
|
||||
$log.debug("Cancel Pressed");
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
]
|
||||
};
|
||||
dialog = dialogService.showBlockingMessage(model);
|
||||
|
||||
if (!dialog) {
|
||||
@@ -129,21 +129,21 @@ define(
|
||||
Demonstrates launching an error dialog
|
||||
*/
|
||||
$scope.launchInfo = function () {
|
||||
var dialog;
|
||||
var model = {
|
||||
title: "Info Dialog Example",
|
||||
actionText: "This is an example of a blocking info" +
|
||||
" dialog. This dialog can be used to draw the user's" +
|
||||
" attention to an event.",
|
||||
severity: "info",
|
||||
primaryOption: {
|
||||
label: "OK",
|
||||
callback: function () {
|
||||
$log.debug("OK Pressed");
|
||||
dialog.dismiss();
|
||||
var dialog,
|
||||
model = {
|
||||
title: "Info Dialog Example",
|
||||
actionText: "This is an example of a blocking info" +
|
||||
" dialog. This dialog can be used to draw the user's" +
|
||||
" attention to an event.",
|
||||
severity: "info",
|
||||
primaryOption: {
|
||||
label: "OK",
|
||||
callback: function () {
|
||||
$log.debug("OK Pressed");
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
dialog = dialogService.showBlockingMessage(model);
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ define(
|
||||
|
||||
|
||||
function BrowserPersistenceProvider($q, SPACE) {
|
||||
var spaces = SPACE ? [SPACE] : [];
|
||||
var caches = {};
|
||||
var promises = {
|
||||
as: function (value) {
|
||||
return $q.when(value);
|
||||
}
|
||||
};
|
||||
var spaces = SPACE ? [SPACE] : [],
|
||||
caches = {},
|
||||
promises = {
|
||||
as: function (value) {
|
||||
return $q.when(value);
|
||||
}
|
||||
};
|
||||
|
||||
spaces.forEach(function (space) {
|
||||
caches[space] = {};
|
||||
|
||||
@@ -33,10 +33,10 @@ define(
|
||||
* "foo."
|
||||
*/
|
||||
allow: function (action, context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
var model = (domainObject && domainObject.getModel()) || {};
|
||||
var name = model.name || "";
|
||||
var metadata = action.getMetadata() || {};
|
||||
var domainObject = (context || {}).domainObject,
|
||||
model = (domainObject && domainObject.getModel()) || {},
|
||||
name = model.name || "",
|
||||
metadata = action.getMetadata() || {};
|
||||
return metadata.key !== 'remove' || name.indexOf('foo') < 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,13 +34,13 @@ define(
|
||||
* @implements {Indicator}
|
||||
*/
|
||||
function DigestIndicator($interval, $rootScope) {
|
||||
var digests = 0;
|
||||
var displayed = 0;
|
||||
var start = Date.now();
|
||||
var digests = 0,
|
||||
displayed = 0,
|
||||
start = Date.now();
|
||||
|
||||
function update() {
|
||||
var now = Date.now();
|
||||
var secs = (now - start) / 1000;
|
||||
var now = Date.now(),
|
||||
secs = (now - start) / 1000;
|
||||
displayed = Math.round(digests / secs);
|
||||
start = now;
|
||||
digests = 0;
|
||||
|
||||
45
index.html
45
index.html
@@ -34,8 +34,8 @@
|
||||
<body>
|
||||
</body>
|
||||
<script>
|
||||
const THIRTY_SECONDS = 30 * 1000;
|
||||
const THIRTY_MINUTES = THIRTY_SECONDS * 60;
|
||||
const FIVE_MINUTES = 5 * 60 * 1000;
|
||||
const THIRTY_MINUTES = 30 * 60 * 1000;
|
||||
|
||||
[
|
||||
'example/eventGenerator'
|
||||
@@ -63,39 +63,7 @@
|
||||
bounds: {
|
||||
start: Date.now() - THIRTY_MINUTES,
|
||||
end: Date.now()
|
||||
},
|
||||
// commonly used bounds can be stored in history
|
||||
// bounds (start and end) can accept either a milliseconds number
|
||||
// or a callback function returning a milliseconds number
|
||||
// a function is useful for invoking Date.now() at exact moment of preset selection
|
||||
presets: [
|
||||
{
|
||||
label: 'Last Day',
|
||||
bounds: {
|
||||
start: () => Date.now() - 1000 * 60 * 60 * 24,
|
||||
end: () => Date.now()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Last 2 hours',
|
||||
bounds: {
|
||||
start: () => Date.now() - 1000 * 60 * 60 * 2,
|
||||
end: () => Date.now()
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Last hour',
|
||||
bounds: {
|
||||
start: () => Date.now() - 1000 * 60 * 60,
|
||||
end: () => Date.now()
|
||||
}
|
||||
}
|
||||
],
|
||||
// maximum recent bounds to retain in conductor history
|
||||
records: 10,
|
||||
// maximum duration between start and end bounds
|
||||
// for utc-based time systems this is in milliseconds
|
||||
limit: 1000 * 60 * 60 * 24
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Realtime",
|
||||
@@ -103,7 +71,7 @@
|
||||
clock: 'local',
|
||||
clockOffsets: {
|
||||
start: - THIRTY_MINUTES,
|
||||
end: THIRTY_SECONDS
|
||||
end: FIVE_MINUTES
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -113,10 +81,7 @@
|
||||
openmct.install(openmct.plugins.LADTable());
|
||||
openmct.install(openmct.plugins.Filters(['table', 'telemetry.plot.overlay']));
|
||||
openmct.install(openmct.plugins.ObjectMigration());
|
||||
openmct.install(openmct.plugins.ClearData(
|
||||
['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked'],
|
||||
{indicator: true}
|
||||
));
|
||||
openmct.install(openmct.plugins.ClearData(['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked']));
|
||||
openmct.start();
|
||||
</script>
|
||||
</html>
|
||||
|
||||
@@ -23,28 +23,17 @@
|
||||
/*global module,process*/
|
||||
|
||||
const devMode = process.env.NODE_ENV !== 'production';
|
||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'FirefoxHeadless'];
|
||||
const coverageEnabled = process.env.COVERAGE === 'true';
|
||||
const reporters = ['progress', 'html'];
|
||||
|
||||
if (coverageEnabled) {
|
||||
reporters.push('coverage-istanbul');
|
||||
}
|
||||
const browsers = [process.env.NODE_ENV === 'debug' ? 'ChromeDebugging' : 'ChromeHeadless'];
|
||||
|
||||
module.exports = (config) => {
|
||||
const webpackConfig = require('./webpack.config.js');
|
||||
delete webpackConfig.output;
|
||||
|
||||
if (!devMode || coverageEnabled) {
|
||||
if (!devMode) {
|
||||
webpackConfig.module.rules.push({
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules|example|lib|dist/,
|
||||
use: {
|
||||
loader: 'istanbul-instrumenter-loader',
|
||||
options: {
|
||||
esModules: true
|
||||
}
|
||||
}
|
||||
exclude: /node_modules|example/,
|
||||
use: 'istanbul-instrumenter-loader'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,7 +45,11 @@ module.exports = (config) => {
|
||||
'src/**/*Spec.js'
|
||||
],
|
||||
port: 9876,
|
||||
reporters: reporters,
|
||||
reporters: [
|
||||
'progress',
|
||||
'coverage',
|
||||
'html'
|
||||
],
|
||||
browsers: browsers,
|
||||
customLaunchers: {
|
||||
ChromeDebugging: {
|
||||
@@ -68,34 +61,33 @@ module.exports = (config) => {
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
coverageReporter: {
|
||||
dir: process.env.CIRCLE_ARTIFACTS ?
|
||||
process.env.CIRCLE_ARTIFACTS + '/coverage' :
|
||||
"dist/reports/coverage",
|
||||
check: {
|
||||
global: {
|
||||
lines: 80,
|
||||
excludes: ['src/plugins/plot/**/*.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
// HTML test reporting.
|
||||
htmlReporter: {
|
||||
outputDir: "dist/reports/tests",
|
||||
preserveDescribeNesting: true,
|
||||
foldAll: false
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
fixWebpackSourcePaths: true,
|
||||
dir: process.env.CIRCLE_ARTIFACTS ?
|
||||
process.env.CIRCLE_ARTIFACTS + '/coverage' :
|
||||
"dist/reports/coverage",
|
||||
reports: ['html', 'lcovonly', 'text-summary'],
|
||||
thresholds: {
|
||||
global: {
|
||||
lines: 62
|
||||
}
|
||||
}
|
||||
},
|
||||
preprocessors: {
|
||||
'platform/**/*Spec.js': ['webpack', 'sourcemap'],
|
||||
'src/**/*Spec.js': ['webpack', 'sourcemap']
|
||||
// add webpack as preprocessor
|
||||
'platform/**/*Spec.js': [ 'webpack', 'sourcemap' ],
|
||||
'src/**/*Spec.js': [ 'webpack', 'sourcemap' ]
|
||||
},
|
||||
webpack: webpackConfig,
|
||||
webpackMiddleware: {
|
||||
stats: 'errors-only',
|
||||
logLevel: 'warn'
|
||||
},
|
||||
singleRun: true,
|
||||
browserNoActivityTimeout: 90000
|
||||
singleRun: true
|
||||
});
|
||||
}
|
||||
|
||||
21
package.json
21
package.json
@@ -4,7 +4,7 @@
|
||||
"description": "The Open MCT core platform",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"angular": ">=1.8.0",
|
||||
"angular": "1.7.9",
|
||||
"angular-route": "1.4.14",
|
||||
"babel-eslint": "8.2.6",
|
||||
"comma-separated-values": "^3.6.4",
|
||||
@@ -24,7 +24,6 @@
|
||||
"d3-time-format": "2.1.x",
|
||||
"eslint": "5.2.0",
|
||||
"eslint-plugin-vue": "^6.0.0",
|
||||
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
|
||||
"eventemitter3": "^1.2.0",
|
||||
"exports-loader": "^0.7.0",
|
||||
"express": "^4.13.1",
|
||||
@@ -41,26 +40,24 @@
|
||||
"jsdoc": "^3.3.2",
|
||||
"karma": "^2.0.3",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "^1.3.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-coverage": "^1.1.2",
|
||||
"karma-coverage-istanbul-reporter": "^2.1.1",
|
||||
"karma-html-reporter": "^0.2.7",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"location-bar": "^3.0.1",
|
||||
"lodash": "^4.17.12",
|
||||
"lodash": "^3.10.1",
|
||||
"markdown-toc": "^0.11.7",
|
||||
"marked": "^0.3.5",
|
||||
"mini-css-extract-plugin": "^0.4.1",
|
||||
"minimist": "^1.1.1",
|
||||
"moment": "2.25.3",
|
||||
"moment": "^2.11.1",
|
||||
"moment-duration-format": "^2.2.2",
|
||||
"moment-timezone": "0.5.28",
|
||||
"moment-timezone": "^0.5.21",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"node-sass": "^4.9.2",
|
||||
"painterro": "^1.0.35",
|
||||
"painterro": "^0.2.65",
|
||||
"printj": "^1.2.1",
|
||||
"raw-loader": "^0.5.1",
|
||||
"request": "^2.69.0",
|
||||
@@ -78,17 +75,15 @@
|
||||
"zepto": "^1.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rm -rf ./dist",
|
||||
"start": "node app.js",
|
||||
"lint": "eslint platform example src --ext .js,.vue openmct.js",
|
||||
"lint:fix": "eslint platform example src --ext .js,.vue openmct.js --fix",
|
||||
"build:prod": "cross-env NODE_ENV=production webpack",
|
||||
"build:dev": "webpack",
|
||||
"build:watch": "webpack --watch",
|
||||
"test": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --single-run",
|
||||
"test:debug": "cross-env NODE_ENV=debug karma start --no-single-run",
|
||||
"test:coverage": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" COVERAGE=true karma start --single-run",
|
||||
"test:watch": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run",
|
||||
"test": "karma start --single-run",
|
||||
"test-debug": "cross-env NODE_ENV=debug karma start --no-single-run",
|
||||
"test:watch": "karma start --no-single-run",
|
||||
"verify": "concurrently 'npm:test' 'npm:lint'",
|
||||
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
||||
"otherdoc": "node docs/gendocs.js --in docs/src --out dist/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
|
||||
|
||||
@@ -25,9 +25,9 @@ define(
|
||||
function (AboutController) {
|
||||
|
||||
describe("The About controller", function () {
|
||||
var testVersions;
|
||||
var mockWindow;
|
||||
var controller;
|
||||
var testVersions,
|
||||
mockWindow,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
testVersions = [
|
||||
|
||||
@@ -25,8 +25,8 @@ define(
|
||||
function (LicenseController) {
|
||||
|
||||
describe("The License controller", function () {
|
||||
var testLicenses;
|
||||
var controller;
|
||||
var testLicenses,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
testLicenses = [
|
||||
|
||||
@@ -25,8 +25,8 @@ define(
|
||||
function (LogoController) {
|
||||
|
||||
describe("The About controller", function () {
|
||||
var mockOverlayService;
|
||||
var controller;
|
||||
var mockOverlayService,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockOverlayService = jasmine.createSpyObj(
|
||||
|
||||
@@ -30,9 +30,9 @@ define([
|
||||
) {
|
||||
|
||||
describe("The navigate action", function () {
|
||||
var mockNavigationService;
|
||||
var mockDomainObject;
|
||||
var action;
|
||||
var mockNavigationService,
|
||||
mockDomainObject,
|
||||
action;
|
||||
|
||||
beforeEach(function () {
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
|
||||
@@ -28,8 +28,8 @@ define(
|
||||
function (NavigationService) {
|
||||
|
||||
describe("The navigation service", function () {
|
||||
let $window;
|
||||
let navigationService;
|
||||
var $window,
|
||||
navigationService;
|
||||
|
||||
beforeEach(function () {
|
||||
$window = jasmine.createSpyObj('$window', ['confirm']);
|
||||
@@ -37,8 +37,8 @@ define(
|
||||
});
|
||||
|
||||
it("stores navigation state", function () {
|
||||
var testObject = { someKey: 42 };
|
||||
var otherObject = { someKey: "some value" };
|
||||
var testObject = { someKey: 42 },
|
||||
otherObject = { someKey: "some value" };
|
||||
expect(navigationService.getNavigation())
|
||||
.toBeUndefined();
|
||||
navigationService.setNavigation(testObject);
|
||||
@@ -52,8 +52,8 @@ define(
|
||||
});
|
||||
|
||||
it("notifies listeners on change", function () {
|
||||
var testObject = { someKey: 42 };
|
||||
var callback = jasmine.createSpy("callback");
|
||||
var testObject = { someKey: 42 },
|
||||
callback = jasmine.createSpy("callback");
|
||||
|
||||
navigationService.addListener(callback);
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
@@ -63,8 +63,8 @@ define(
|
||||
});
|
||||
|
||||
it("does not notify listeners when no changes occur", function () {
|
||||
var testObject = { someKey: 42 };
|
||||
var callback = jasmine.createSpy("callback");
|
||||
var testObject = { someKey: 42 },
|
||||
callback = jasmine.createSpy("callback");
|
||||
|
||||
navigationService.addListener(callback);
|
||||
navigationService.setNavigation(testObject);
|
||||
@@ -73,8 +73,8 @@ define(
|
||||
});
|
||||
|
||||
it("stops notifying listeners after removal", function () {
|
||||
var testObject = { someKey: 42 };
|
||||
var callback = jasmine.createSpy("callback");
|
||||
var testObject = { someKey: 42 },
|
||||
callback = jasmine.createSpy("callback");
|
||||
|
||||
navigationService.addListener(callback);
|
||||
navigationService.removeListener(callback);
|
||||
|
||||
@@ -24,18 +24,18 @@ define([
|
||||
'../../src/navigation/OrphanNavigationHandler'
|
||||
], function (OrphanNavigationHandler) {
|
||||
describe("OrphanNavigationHandler", function () {
|
||||
var mockTopic;
|
||||
var mockThrottle;
|
||||
var mockMutationTopic;
|
||||
var mockNavigationService;
|
||||
var mockDomainObject;
|
||||
var mockParentObject;
|
||||
var mockContext;
|
||||
var mockActionCapability;
|
||||
var mockEditor;
|
||||
var testParentComposition;
|
||||
var testId;
|
||||
var mockThrottledFns;
|
||||
var mockTopic,
|
||||
mockThrottle,
|
||||
mockMutationTopic,
|
||||
mockNavigationService,
|
||||
mockDomainObject,
|
||||
mockParentObject,
|
||||
mockContext,
|
||||
mockActionCapability,
|
||||
mockEditor,
|
||||
testParentComposition,
|
||||
testId,
|
||||
mockThrottledFns;
|
||||
|
||||
beforeEach(function () {
|
||||
testId = 'some-identifier';
|
||||
|
||||
@@ -25,12 +25,12 @@ define(
|
||||
function (NewTabAction) {
|
||||
|
||||
describe("The new tab action", function () {
|
||||
var actionSelected;
|
||||
var actionCurrent;
|
||||
var mockWindow;
|
||||
var mockContextCurrent;
|
||||
var mockContextSelected;
|
||||
var mockUrlService;
|
||||
var actionSelected,
|
||||
actionCurrent,
|
||||
mockWindow,
|
||||
mockContextCurrent,
|
||||
mockContextSelected,
|
||||
mockUrlService;
|
||||
|
||||
beforeEach(function () {
|
||||
mockWindow = jasmine.createSpyObj("$window", ["open", "location"]);
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
</mct-form>
|
||||
</div>
|
||||
<div class="c-overlay__button-bar">
|
||||
<button class='c-button c-button--major'
|
||||
<a class='c-button c-button--major'
|
||||
ng-class="{ disabled: !createForm.$valid }"
|
||||
ng-click="ngModel.confirm()">
|
||||
OK
|
||||
</button>
|
||||
<button class='c-button '
|
||||
</a>
|
||||
<a class='c-button '
|
||||
ng-click="ngModel.cancel()">
|
||||
Cancel
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -6,12 +6,6 @@
|
||||
ng-show="ngModel.dialog.messages.length > 1 ||
|
||||
ngModel.dialog.messages.length == 0">s</span>
|
||||
</div>
|
||||
<button
|
||||
ng-if="ngModel.dialog.topBarButton"
|
||||
class="c-button c-button--major"
|
||||
ng-click="ngModel.topBarButton.onClick">
|
||||
{{ ngModel.topBarButton.label }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="w-messages c-overlay__messages">
|
||||
<mct-include
|
||||
@@ -22,7 +16,7 @@
|
||||
<button ng-repeat="dialogAction in ngModel.dialog.actions"
|
||||
class="c-button c-button--major"
|
||||
ng-click="dialogAction.action()">
|
||||
{{ dialogAction.label }}
|
||||
{{dialogAction.label}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
</mct-include>
|
||||
</div>
|
||||
<div class="c-overlay__button-bar">
|
||||
<button ng-repeat="option in ngModel.dialog.options"
|
||||
<a ng-repeat="option in ngModel.dialog.options"
|
||||
href=''
|
||||
class="s-button lg"
|
||||
title="{{option.description}}"
|
||||
ng-click="ngModel.confirm(option.key)"
|
||||
ng-class="{ major: $first, subtle: !$first }">
|
||||
{{option.name}}
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</mct-container>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="c-overlay__outer">
|
||||
<button ng-click="ngModel.cancel()"
|
||||
ng-if="ngModel.cancel"
|
||||
class="c-click-icon c-overlay__close-button icon-x"></button>
|
||||
class="c-click-icon c-overlay__close-button icon-x-in-circle"></button>
|
||||
<div class="c-overlay__contents" ng-transclude></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -62,10 +62,10 @@ define(
|
||||
DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) {
|
||||
// We will return this result as a promise, because user
|
||||
// input is asynchronous.
|
||||
var deferred = this.$q.defer();
|
||||
var self = this;
|
||||
var overlay;
|
||||
var handleEscKeydown;
|
||||
var deferred = this.$q.defer(),
|
||||
self = this,
|
||||
overlay,
|
||||
handleEscKeydown;
|
||||
|
||||
// Confirm function; this will be passed in to the
|
||||
// overlay-dialog template and associated with a
|
||||
@@ -247,12 +247,12 @@ define(
|
||||
if (this.canShowDialog(dialogModel)) {
|
||||
// Add the overlay using the OverlayService, which
|
||||
// will handle actual insertion into the DOM
|
||||
var self = this;
|
||||
var overlay = this.overlayService.createOverlay(
|
||||
"overlay-blocking-message",
|
||||
dialogModel,
|
||||
"t-dialog-sm"
|
||||
);
|
||||
var self = this,
|
||||
overlay = this.overlayService.createOverlay(
|
||||
"overlay-blocking-message",
|
||||
dialogModel,
|
||||
"t-dialog-sm"
|
||||
);
|
||||
|
||||
this.activeOverlay = overlay;
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ define(
|
||||
*/
|
||||
OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) {
|
||||
// Create a new scope for this overlay
|
||||
var scope = this.newScope();
|
||||
var element;
|
||||
var scope = this.newScope(),
|
||||
element;
|
||||
|
||||
// Stop showing the overlay; additionally, release the scope
|
||||
// that it uses.
|
||||
|
||||
@@ -28,14 +28,14 @@ define(
|
||||
function (DialogService) {
|
||||
|
||||
describe("The dialog service", function () {
|
||||
var mockOverlayService;
|
||||
var mockQ;
|
||||
var mockLog;
|
||||
var mockOverlay;
|
||||
var mockDeferred;
|
||||
var mockDocument;
|
||||
var mockBody;
|
||||
var dialogService;
|
||||
var mockOverlayService,
|
||||
mockQ,
|
||||
mockLog,
|
||||
mockOverlay,
|
||||
mockDeferred,
|
||||
mockDocument,
|
||||
mockBody,
|
||||
dialogService;
|
||||
|
||||
beforeEach(function () {
|
||||
mockOverlayService = jasmine.createSpyObj(
|
||||
@@ -188,8 +188,8 @@ define(
|
||||
});
|
||||
|
||||
it("individual dialogs can be dismissed", function () {
|
||||
var secondDialogHandle;
|
||||
var secondMockOverlay;
|
||||
var secondDialogHandle,
|
||||
secondMockOverlay;
|
||||
|
||||
dialogHandle.dismiss();
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@ define(
|
||||
function (OverlayService) {
|
||||
|
||||
describe("The overlay service", function () {
|
||||
var mockDocument;
|
||||
var mockCompile;
|
||||
var mockRootScope;
|
||||
var mockBody;
|
||||
var mockTemplate;
|
||||
var mockElement;
|
||||
var mockScope;
|
||||
var mockTimeout;
|
||||
var overlayService;
|
||||
var mockDocument,
|
||||
mockCompile,
|
||||
mockRootScope,
|
||||
mockBody,
|
||||
mockTemplate,
|
||||
mockElement,
|
||||
mockScope,
|
||||
mockTimeout,
|
||||
overlayService;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDocument = jasmine.createSpyObj("$document", ["find"]);
|
||||
|
||||
@@ -86,8 +86,8 @@ define(
|
||||
* will be performed; should contain a `domainObject` property
|
||||
*/
|
||||
EditAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
var type = domainObject && domainObject.getCapability('type');
|
||||
var domainObject = (context || {}).domainObject,
|
||||
type = domainObject && domainObject.getCapability('type');
|
||||
|
||||
// Only allow editing of types that support it and are not already
|
||||
// being edited
|
||||
|
||||
@@ -37,8 +37,8 @@ define(
|
||||
}
|
||||
|
||||
EditAndComposeAction.prototype.perform = function () {
|
||||
var self = this;
|
||||
var editAction = this.domainObject.getCapability('action').getActions("edit")[0];
|
||||
var self = this,
|
||||
editAction = this.domainObject.getCapability('action').getActions("edit")[0];
|
||||
|
||||
// Link these objects
|
||||
function doLink() {
|
||||
|
||||
@@ -46,9 +46,9 @@ define(
|
||||
}
|
||||
|
||||
PropertiesAction.prototype.perform = function () {
|
||||
var type = this.domainObject.getCapability('type');
|
||||
var domainObject = this.domainObject;
|
||||
var dialogService = this.dialogService;
|
||||
var type = this.domainObject.getCapability('type'),
|
||||
domainObject = this.domainObject,
|
||||
dialogService = this.dialogService;
|
||||
|
||||
// Update the domain object model based on user input
|
||||
function updateModel(userInput, dialog) {
|
||||
@@ -81,14 +81,9 @@ define(
|
||||
* context.
|
||||
*/
|
||||
PropertiesAction.appliesTo = function (context) {
|
||||
|
||||
var domainObject = (context || {}).domainObject;
|
||||
var type = domainObject && domainObject.getCapability('type');
|
||||
var creatable = type && type.hasFeature('creation');
|
||||
|
||||
if (domainObject && domainObject.model && domainObject.model.locked) {
|
||||
return false;
|
||||
}
|
||||
var domainObject = (context || {}).domainObject,
|
||||
type = domainObject && domainObject.getCapability('type'),
|
||||
creatable = type && type.hasFeature('creation');
|
||||
|
||||
// Only allow creatable types to be edited
|
||||
return domainObject && creatable;
|
||||
|
||||
@@ -49,9 +49,9 @@ define(
|
||||
* @memberof platform/commonUI/edit.SaveAction#
|
||||
*/
|
||||
SaveAction.prototype.perform = function () {
|
||||
var self = this;
|
||||
var domainObject = this.domainObject;
|
||||
var dialog = new SaveInProgressDialog(this.dialogService);
|
||||
var self = this,
|
||||
domainObject = this.domainObject,
|
||||
dialog = new SaveInProgressDialog(this.dialogService);
|
||||
|
||||
// Invoke any save behavior introduced by the editor capability;
|
||||
// this is introduced by EditableDomainObject which is
|
||||
|
||||
@@ -50,8 +50,8 @@ define(
|
||||
* @memberof platform/commonUI/edit.SaveAndStopEditingAction#
|
||||
*/
|
||||
SaveAndStopEditingAction.prototype.perform = function () {
|
||||
var domainObject = this.domainObject;
|
||||
var saveAction = new SaveAction(this.dialogService, this.notificationService, this.context);
|
||||
var domainObject = this.domainObject,
|
||||
saveAction = new SaveAction(this.dialogService, this.notificationService, this.context);
|
||||
|
||||
function closeEditor() {
|
||||
return domainObject.getCapability("editor").finish();
|
||||
|
||||
@@ -99,11 +99,11 @@ function (
|
||||
* @private
|
||||
*/
|
||||
SaveAsAction.prototype.save = function () {
|
||||
var self = this;
|
||||
var domainObject = this.domainObject;
|
||||
var copyService = this.copyService;
|
||||
var dialog = new SaveInProgressDialog(this.dialogService);
|
||||
var toUndirty = [];
|
||||
var self = this,
|
||||
domainObject = this.domainObject,
|
||||
copyService = this.copyService,
|
||||
dialog = new SaveInProgressDialog(this.dialogService),
|
||||
toUndirty = [];
|
||||
|
||||
function doWizardSave(parent) {
|
||||
var wizard = self.createWizard(parent);
|
||||
|
||||
@@ -49,10 +49,10 @@ define(
|
||||
* transaction is in progress.
|
||||
*/
|
||||
TransactionCapabilityDecorator.prototype.getCapabilities = function () {
|
||||
var self = this;
|
||||
var capabilities = this.capabilityService.getCapabilities
|
||||
.apply(this.capabilityService, arguments);
|
||||
var persistenceCapability = capabilities.persistence;
|
||||
var self = this,
|
||||
capabilities = this.capabilityService.getCapabilities
|
||||
.apply(this.capabilityService, arguments),
|
||||
persistenceCapability = capabilities.persistence;
|
||||
|
||||
capabilities.persistence = function (domainObject) {
|
||||
var original =
|
||||
|
||||
@@ -29,8 +29,8 @@ define(
|
||||
function () {
|
||||
|
||||
function cancelEditing(domainObject) {
|
||||
var navigatedObject = domainObject;
|
||||
var editorCapability = navigatedObject &&
|
||||
var navigatedObject = domainObject,
|
||||
editorCapability = navigatedObject &&
|
||||
navigatedObject.getCapability("editor");
|
||||
|
||||
return editorCapability &&
|
||||
|
||||
@@ -34,12 +34,12 @@ define(
|
||||
|
||||
// Update root object based on represented object
|
||||
function updateRoot(domainObject) {
|
||||
var root = self.rootDomainObject;
|
||||
var context = domainObject &&
|
||||
domainObject.getCapability('context');
|
||||
var newRoot = context && context.getTrueRoot();
|
||||
var oldId = root && root.getId();
|
||||
var newId = newRoot && newRoot.getId();
|
||||
var root = self.rootDomainObject,
|
||||
context = domainObject &&
|
||||
domainObject.getCapability('context'),
|
||||
newRoot = context && context.getTrueRoot(),
|
||||
oldId = root && root.getId(),
|
||||
newId = newRoot && newRoot.getId();
|
||||
|
||||
// Only update if this has actually changed,
|
||||
// to avoid excessive refreshing.
|
||||
|
||||
@@ -63,9 +63,9 @@ define(
|
||||
* This will prompt for user input first.
|
||||
*/
|
||||
CreateAction.prototype.perform = function () {
|
||||
var newModel = this.type.getInitialModel();
|
||||
var openmct = this.openmct;
|
||||
var newObject;
|
||||
var newModel = this.type.getInitialModel(),
|
||||
openmct = this.openmct,
|
||||
newObject;
|
||||
|
||||
function onCancel() {
|
||||
openmct.editor.cancel();
|
||||
@@ -78,13 +78,13 @@ define(
|
||||
}
|
||||
|
||||
function navigateAndEdit(object) {
|
||||
let objectPath = object.getCapability('context').getPath();
|
||||
let url = '#/browse/' + objectPath
|
||||
.slice(1)
|
||||
.map(function (o) {
|
||||
return o && openmct.objects.makeKeyString(o.getId());
|
||||
})
|
||||
.join('/');
|
||||
let objectPath = object.getCapability('context').getPath(),
|
||||
url = '#/browse/' + objectPath
|
||||
.slice(1)
|
||||
.map(function (o) {
|
||||
return o && openmct.objects.makeKeyString(o.getId());
|
||||
})
|
||||
.join('/');
|
||||
|
||||
window.location.href = url;
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ define(
|
||||
}
|
||||
|
||||
CreateActionProvider.prototype.getActions = function (actionContext) {
|
||||
var context = actionContext || {};
|
||||
var key = context.key;
|
||||
var destination = context.domainObject;
|
||||
var self = this;
|
||||
var context = actionContext || {},
|
||||
key = context.key,
|
||||
destination = context.domainObject,
|
||||
self = this;
|
||||
|
||||
// We only provide Create actions, and we need a
|
||||
// domain object to serve as the container for the
|
||||
|
||||
@@ -55,8 +55,8 @@ define(
|
||||
* show in the create dialog
|
||||
*/
|
||||
CreateWizard.prototype.getFormStructure = function (includeLocation) {
|
||||
var sections = [];
|
||||
var domainObject = this.domainObject;
|
||||
var sections = [],
|
||||
domainObject = this.domainObject;
|
||||
|
||||
function validateLocation(parent) {
|
||||
return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
|
||||
@@ -107,8 +107,8 @@ define(
|
||||
* @returns {DomainObject}
|
||||
*/
|
||||
CreateWizard.prototype.populateObjectFromInput = function (formValue) {
|
||||
var parent = this.getLocation(formValue);
|
||||
var formModel = this.createModel(formValue);
|
||||
var parent = this.getLocation(formValue),
|
||||
formModel = this.createModel(formValue);
|
||||
|
||||
formModel.location = parent.getId();
|
||||
this.domainObject.useCapability("mutation", function () {
|
||||
@@ -126,10 +126,10 @@ define(
|
||||
*/
|
||||
CreateWizard.prototype.getInitialFormValue = function () {
|
||||
// Start with initial values for properties
|
||||
var model = this.model;
|
||||
var formValue = this.properties.map(function (property) {
|
||||
return property.getValue(model);
|
||||
});
|
||||
var model = this.model,
|
||||
formValue = this.properties.map(function (property) {
|
||||
return property.getValue(model);
|
||||
});
|
||||
|
||||
// Include the createParent
|
||||
formValue.createParent = this.parent;
|
||||
|
||||
@@ -63,17 +63,17 @@ define(
|
||||
* object has been created
|
||||
*/
|
||||
CreationService.prototype.createObject = function (model, parent) {
|
||||
var persistence = parent.getCapability("persistence");
|
||||
var newObject = parent.useCapability("instantiation", model);
|
||||
var newObjectPersistence = newObject.getCapability("persistence");
|
||||
var self = this;
|
||||
var persistence = parent.getCapability("persistence"),
|
||||
newObject = parent.useCapability("instantiation", model),
|
||||
newObjectPersistence = newObject.getCapability("persistence"),
|
||||
self = this;
|
||||
|
||||
// Add the newly-created object's id to the parent's
|
||||
// composition, so that it will subsequently appear
|
||||
// as a child contained by that parent.
|
||||
function addToComposition() {
|
||||
var compositionCapability = parent.getCapability('composition');
|
||||
var addResult = compositionCapability &&
|
||||
var compositionCapability = parent.getCapability('composition'),
|
||||
addResult = compositionCapability &&
|
||||
compositionCapability.add(newObject);
|
||||
|
||||
return self.$q.when(addResult).then(function (result) {
|
||||
|
||||
@@ -39,8 +39,8 @@ define(
|
||||
// used for bi-directional object selection.
|
||||
function setLocatingObject(domainObject, priorObject) {
|
||||
var context = domainObject &&
|
||||
domainObject.getCapability("context");
|
||||
var contextRoot = context && context.getRoot();
|
||||
domainObject.getCapability("context"),
|
||||
contextRoot = context && context.getRoot();
|
||||
|
||||
if (contextRoot && contextRoot !== $scope.rootObject) {
|
||||
$scope.rootObject = undefined;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
['objectUtils'],
|
||||
['../../../../../src/api/objects/object-utils'],
|
||||
function (objectUtils) {
|
||||
|
||||
/**
|
||||
@@ -36,6 +36,8 @@ define(
|
||||
}
|
||||
|
||||
EditPersistableObjectsPolicy.prototype.allow = function (action, context) {
|
||||
var identifier;
|
||||
var provider;
|
||||
var domainObject = context.domainObject;
|
||||
var key = action.getMetadata().key;
|
||||
var category = (context || {}).category;
|
||||
@@ -44,8 +46,9 @@ define(
|
||||
// is also invoked during the create process which should be allowed,
|
||||
// because it may be saved elsewhere
|
||||
if ((key === 'edit' && category === 'view-control') || key === 'properties') {
|
||||
let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId());
|
||||
return this.openmct.objects.isPersistable(newStyleObject);
|
||||
identifier = objectUtils.parseKeyString(domainObject.getId());
|
||||
provider = this.openmct.objects.getProvider(identifier);
|
||||
return provider.save !== undefined;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -58,9 +58,9 @@ define(
|
||||
* @param {String} message a message to log with the commit message.
|
||||
*/
|
||||
EditRepresenter.prototype.commit = function (message) {
|
||||
var model = this.$scope.model;
|
||||
var configuration = this.$scope.configuration;
|
||||
var domainObject = this.domainObject;
|
||||
var model = this.$scope.model,
|
||||
configuration = this.$scope.configuration,
|
||||
domainObject = this.domainObject;
|
||||
|
||||
this.$log.debug([
|
||||
"Committing ",
|
||||
|
||||
@@ -25,12 +25,12 @@ define(
|
||||
function (CancelAction) {
|
||||
|
||||
describe("The Cancel action", function () {
|
||||
var mockDomainObject;
|
||||
var mockParentObject;
|
||||
var capabilities = {};
|
||||
var parentCapabilities = {};
|
||||
var actionContext;
|
||||
var action;
|
||||
var mockDomainObject,
|
||||
mockParentObject,
|
||||
capabilities = {},
|
||||
parentCapabilities = {},
|
||||
actionContext,
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
|
||||
@@ -25,15 +25,15 @@ define(
|
||||
function (EditAction) {
|
||||
|
||||
describe("The Edit action", function () {
|
||||
var mockLocation;
|
||||
var mockNavigationService;
|
||||
var mockLog;
|
||||
var mockDomainObject;
|
||||
var mockType;
|
||||
var mockEditor;
|
||||
var actionContext;
|
||||
var capabilities;
|
||||
var action;
|
||||
var mockLocation,
|
||||
mockNavigationService,
|
||||
mockLog,
|
||||
mockDomainObject,
|
||||
mockType,
|
||||
mockEditor,
|
||||
actionContext,
|
||||
capabilities,
|
||||
action;
|
||||
|
||||
beforeEach(function () {
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
|
||||
@@ -25,17 +25,17 @@ define(
|
||||
function (EditAndComposeAction) {
|
||||
|
||||
describe("The Link action", function () {
|
||||
var mockDomainObject;
|
||||
var mockParent;
|
||||
var mockContext;
|
||||
var mockComposition;
|
||||
var mockActionCapability;
|
||||
var mockEditAction;
|
||||
var mockType;
|
||||
var actionContext;
|
||||
var model;
|
||||
var capabilities;
|
||||
var action;
|
||||
var mockDomainObject,
|
||||
mockParent,
|
||||
mockContext,
|
||||
mockComposition,
|
||||
mockActionCapability,
|
||||
mockEditAction,
|
||||
mockType,
|
||||
actionContext,
|
||||
model,
|
||||
capabilities,
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
|
||||
@@ -25,13 +25,7 @@ define(
|
||||
function (PropertiesAction) {
|
||||
|
||||
describe("Properties action", function () {
|
||||
var capabilities;
|
||||
var model;
|
||||
var object;
|
||||
var context;
|
||||
var input;
|
||||
var dialogService;
|
||||
var action;
|
||||
var capabilities, model, object, context, input, dialogService, action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
|
||||
@@ -26,10 +26,7 @@ define(
|
||||
|
||||
describe("Properties dialog", function () {
|
||||
|
||||
var type;
|
||||
var properties;
|
||||
var model;
|
||||
var dialog;
|
||||
var type, properties, model, dialog;
|
||||
|
||||
beforeEach(function () {
|
||||
type = {
|
||||
|
||||
@@ -26,14 +26,14 @@ define(
|
||||
function (SaveAction) {
|
||||
|
||||
describe("The Save action", function () {
|
||||
var mockDomainObject;
|
||||
var mockEditorCapability;
|
||||
var actionContext;
|
||||
var mockDialogService;
|
||||
var mockNotificationService;
|
||||
var mockActionCapability;
|
||||
var capabilities = {};
|
||||
var action;
|
||||
var mockDomainObject,
|
||||
mockEditorCapability,
|
||||
actionContext,
|
||||
mockDialogService,
|
||||
mockNotificationService,
|
||||
mockActionCapability,
|
||||
capabilities = {},
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
|
||||
@@ -32,14 +32,14 @@ define(
|
||||
// depends on is not mocked, so we mock some
|
||||
// of SaveAction's own dependencies to make
|
||||
// it run.
|
||||
var mockDomainObject;
|
||||
var mockEditorCapability;
|
||||
var actionContext;
|
||||
var dialogService;
|
||||
var notificationService;
|
||||
var mockActionCapability;
|
||||
var capabilities = {};
|
||||
var action;
|
||||
var mockDomainObject,
|
||||
mockEditorCapability,
|
||||
actionContext,
|
||||
dialogService,
|
||||
notificationService,
|
||||
mockActionCapability,
|
||||
capabilities = {},
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
|
||||
@@ -26,18 +26,18 @@ define(
|
||||
function (SaveAsAction) {
|
||||
|
||||
xdescribe("The Save As action", function () {
|
||||
var mockDomainObject;
|
||||
var mockClonedObject;
|
||||
var mockEditorCapability;
|
||||
var mockActionCapability;
|
||||
var mockObjectService;
|
||||
var mockDialogService;
|
||||
var mockCopyService;
|
||||
var mockNotificationService;
|
||||
var mockParent;
|
||||
var actionContext;
|
||||
var capabilities = {};
|
||||
var action;
|
||||
var mockDomainObject,
|
||||
mockClonedObject,
|
||||
mockEditorCapability,
|
||||
mockActionCapability,
|
||||
mockObjectService,
|
||||
mockDialogService,
|
||||
mockCopyService,
|
||||
mockNotificationService,
|
||||
mockParent,
|
||||
actionContext,
|
||||
capabilities = {},
|
||||
action;
|
||||
|
||||
function noop() {}
|
||||
|
||||
|
||||
@@ -25,14 +25,14 @@ define(
|
||||
function (EditorCapability) {
|
||||
|
||||
xdescribe("The editor capability", function () {
|
||||
var mockDomainObject;
|
||||
var capabilities;
|
||||
var mockParentObject;
|
||||
var mockTransactionService;
|
||||
var mockStatusCapability;
|
||||
var mockParentStatus;
|
||||
var mockContextCapability;
|
||||
var capability;
|
||||
var mockDomainObject,
|
||||
capabilities,
|
||||
mockParentObject,
|
||||
mockTransactionService,
|
||||
mockStatusCapability,
|
||||
mockParentStatus,
|
||||
mockContextCapability,
|
||||
capability;
|
||||
|
||||
function fastPromise(val) {
|
||||
return {
|
||||
|
||||
@@ -28,10 +28,10 @@ define(
|
||||
function (TransactionalPersistenceCapability, TransactionCapabilityDecorator) {
|
||||
|
||||
describe("The transaction capability decorator", function () {
|
||||
var mockQ;
|
||||
var mockTransactionService;
|
||||
var mockCapabilityService;
|
||||
var provider;
|
||||
var mockQ,
|
||||
mockTransactionService,
|
||||
mockCapabilityService,
|
||||
provider;
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = {};
|
||||
|
||||
@@ -36,12 +36,12 @@ define(
|
||||
}
|
||||
|
||||
describe("The transactional persistence decorator", function () {
|
||||
var mockQ;
|
||||
var mockTransactionManager;
|
||||
var mockPersistence;
|
||||
var mockDomainObject;
|
||||
var testId;
|
||||
var capability;
|
||||
var mockQ,
|
||||
mockTransactionManager,
|
||||
mockPersistence,
|
||||
mockDomainObject,
|
||||
testId,
|
||||
capability;
|
||||
|
||||
beforeEach(function () {
|
||||
testId = "test-id";
|
||||
|
||||
@@ -48,9 +48,9 @@ define(
|
||||
}
|
||||
}
|
||||
|
||||
var mockScope;
|
||||
var mockActions;
|
||||
var controller;
|
||||
var mockScope,
|
||||
mockActions,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
||||
|
||||
@@ -25,16 +25,16 @@ define(
|
||||
function (EditObjectController) {
|
||||
|
||||
describe("The Edit Object controller", function () {
|
||||
var mockScope;
|
||||
var mockObject;
|
||||
var testViews;
|
||||
var mockEditorCapability;
|
||||
var mockLocation;
|
||||
var mockNavigationService;
|
||||
var removeCheck;
|
||||
var mockStatusCapability;
|
||||
var mockCapabilities;
|
||||
var controller;
|
||||
var mockScope,
|
||||
mockObject,
|
||||
testViews,
|
||||
mockEditorCapability,
|
||||
mockLocation,
|
||||
mockNavigationService,
|
||||
removeCheck,
|
||||
mockStatusCapability,
|
||||
mockCapabilities,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
|
||||
@@ -25,10 +25,10 @@ define(
|
||||
function (EditPanesController) {
|
||||
|
||||
describe("The Edit Panes controller", function () {
|
||||
var mockScope;
|
||||
var mockDomainObject;
|
||||
var mockContext;
|
||||
var controller;
|
||||
var mockScope,
|
||||
mockDomainObject,
|
||||
mockContext,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
||||
|
||||
@@ -28,12 +28,12 @@ define(
|
||||
function (CreateActionProvider) {
|
||||
|
||||
describe("The create action provider", function () {
|
||||
var mockTypeService;
|
||||
var mockPolicyService;
|
||||
var mockCreationPolicy;
|
||||
var mockPolicyMap = {};
|
||||
var mockTypes;
|
||||
var provider;
|
||||
var mockTypeService,
|
||||
mockPolicyService,
|
||||
mockCreationPolicy,
|
||||
mockPolicyMap = {},
|
||||
mockTypes,
|
||||
provider;
|
||||
|
||||
function createMockType(name) {
|
||||
var mockType = jasmine.createSpyObj(
|
||||
|
||||
@@ -28,13 +28,13 @@ define(
|
||||
function (CreateAction) {
|
||||
|
||||
xdescribe("The create action", function () {
|
||||
var mockType;
|
||||
var mockParent;
|
||||
var mockContext;
|
||||
var mockDomainObject;
|
||||
var capabilities = {};
|
||||
var mockEditAction;
|
||||
var action;
|
||||
var mockType,
|
||||
mockParent,
|
||||
mockContext,
|
||||
mockDomainObject,
|
||||
capabilities = {},
|
||||
mockEditAction,
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
|
||||
@@ -28,9 +28,9 @@ define(
|
||||
function (CreateMenuController) {
|
||||
|
||||
describe("The create menu controller", function () {
|
||||
var mockScope;
|
||||
var mockActions;
|
||||
var controller;
|
||||
var mockScope,
|
||||
mockActions,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
||||
|
||||
@@ -28,13 +28,13 @@ define(
|
||||
function (CreateWizard) {
|
||||
|
||||
xdescribe("The create wizard", function () {
|
||||
var mockType;
|
||||
var mockParent;
|
||||
var mockProperties;
|
||||
var mockPolicyService;
|
||||
var testModel;
|
||||
var mockDomainObject;
|
||||
var wizard;
|
||||
var mockType,
|
||||
mockParent,
|
||||
mockProperties,
|
||||
mockPolicyService,
|
||||
testModel,
|
||||
mockDomainObject,
|
||||
wizard;
|
||||
|
||||
function createMockProperty(name) {
|
||||
var mockProperty = jasmine.createSpyObj(
|
||||
@@ -142,11 +142,11 @@ define(
|
||||
|
||||
it("populates the model on the associated object", function () {
|
||||
var formValue = {
|
||||
"A": "ValueA",
|
||||
"B": "ValueB",
|
||||
"C": "ValueC"
|
||||
};
|
||||
var compareModel = wizard.createModel(formValue);
|
||||
"A": "ValueA",
|
||||
"B": "ValueB",
|
||||
"C": "ValueC"
|
||||
},
|
||||
compareModel = wizard.createModel(formValue);
|
||||
//populateObjectFromInput adds a .location attribute that is not added by createModel.
|
||||
compareModel.location = undefined;
|
||||
wizard.populateObjectFromInput(formValue);
|
||||
@@ -156,19 +156,19 @@ define(
|
||||
|
||||
it("validates selection types using policy", function () {
|
||||
var mockDomainObj = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
['getCapability']
|
||||
);
|
||||
var mockOtherType = jasmine.createSpyObj(
|
||||
'otherType',
|
||||
['getKey']
|
||||
);
|
||||
'domainObject',
|
||||
['getCapability']
|
||||
),
|
||||
mockOtherType = jasmine.createSpyObj(
|
||||
'otherType',
|
||||
['getKey']
|
||||
),
|
||||
|
||||
//Create a form structure with location
|
||||
var structure = wizard.getFormStructure(true);
|
||||
var sections = structure.sections;
|
||||
var rows = structure.sections[sections.length - 1].rows;
|
||||
var locationRow = rows[rows.length - 1];
|
||||
//Create a form structure with location
|
||||
structure = wizard.getFormStructure(true),
|
||||
sections = structure.sections,
|
||||
rows = structure.sections[sections.length - 1].rows,
|
||||
locationRow = rows[rows.length - 1];
|
||||
|
||||
mockDomainObj.getCapability.and.returnValue(mockOtherType);
|
||||
locationRow.validate(mockDomainObj);
|
||||
|
||||
@@ -25,8 +25,8 @@ define(
|
||||
function (CreationPolicy) {
|
||||
|
||||
describe("The creation policy", function () {
|
||||
var mockType;
|
||||
var policy;
|
||||
var mockType,
|
||||
policy;
|
||||
|
||||
beforeEach(function () {
|
||||
mockType = jasmine.createSpyObj(
|
||||
|
||||
@@ -28,18 +28,18 @@ define(
|
||||
function (CreationService) {
|
||||
|
||||
describe("The creation service", function () {
|
||||
var mockQ;
|
||||
var mockLog;
|
||||
var mockParentObject;
|
||||
var mockNewObject;
|
||||
var mockMutationCapability;
|
||||
var mockPersistenceCapability;
|
||||
var mockCompositionCapability;
|
||||
var mockContextCapability;
|
||||
var mockCreationCapability;
|
||||
var mockCapabilities;
|
||||
var mockNewPersistenceCapability;
|
||||
var creationService;
|
||||
var mockQ,
|
||||
mockLog,
|
||||
mockParentObject,
|
||||
mockNewObject,
|
||||
mockMutationCapability,
|
||||
mockPersistenceCapability,
|
||||
mockCompositionCapability,
|
||||
mockContextCapability,
|
||||
mockCreationCapability,
|
||||
mockCapabilities,
|
||||
mockNewPersistenceCapability,
|
||||
creationService;
|
||||
|
||||
function mockPromise(value) {
|
||||
return (value && value.then) ? value : {
|
||||
@@ -157,10 +157,10 @@ define(
|
||||
|
||||
it("provides the newly-created object", function () {
|
||||
var mockDomainObject = jasmine.createSpyObj(
|
||||
'newDomainObject',
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
var mockCallback = jasmine.createSpy('callback');
|
||||
'newDomainObject',
|
||||
['getId', 'getModel', 'getCapability']
|
||||
),
|
||||
mockCallback = jasmine.createSpy('callback');
|
||||
|
||||
// Act as if the object had been created
|
||||
mockCompositionCapability.add.and.callFake(function (id) {
|
||||
@@ -180,8 +180,8 @@ define(
|
||||
|
||||
it("warns if parent has no persistence capability", function () {
|
||||
// Callbacks
|
||||
var success = jasmine.createSpy("success");
|
||||
var failure = jasmine.createSpy("failure");
|
||||
var success = jasmine.createSpy("success"),
|
||||
failure = jasmine.createSpy("failure");
|
||||
|
||||
mockCapabilities.persistence = undefined;
|
||||
creationService.createObject({}, mockParentObject).then(
|
||||
|
||||
@@ -28,14 +28,14 @@ define(
|
||||
function (LocatorController) {
|
||||
|
||||
describe("The locator controller", function () {
|
||||
var mockScope;
|
||||
var mockTimeout;
|
||||
var mockDomainObject;
|
||||
var mockRootObject;
|
||||
var mockContext;
|
||||
var mockObjectService;
|
||||
var getObjectsPromise;
|
||||
var controller;
|
||||
var mockScope,
|
||||
mockTimeout,
|
||||
mockDomainObject,
|
||||
mockRootObject,
|
||||
mockContext,
|
||||
mockObjectService,
|
||||
getObjectsPromise,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
|
||||
@@ -25,14 +25,14 @@ define(
|
||||
function (EditPersistableObjectsPolicy) {
|
||||
|
||||
describe("The Edit persistable objects policy", function () {
|
||||
var mockDomainObject;
|
||||
var mockEditAction;
|
||||
var mockPropertiesAction;
|
||||
var mockOtherAction;
|
||||
var mockAPI;
|
||||
var mockObjectAPI;
|
||||
var testContext;
|
||||
var policy;
|
||||
var mockDomainObject,
|
||||
mockEditAction,
|
||||
mockPropertiesAction,
|
||||
mockOtherAction,
|
||||
mockAPI,
|
||||
mockObjectAPI,
|
||||
testContext,
|
||||
policy;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
@@ -43,7 +43,7 @@ define(
|
||||
);
|
||||
|
||||
mockObjectAPI = jasmine.createSpyObj('objectAPI', [
|
||||
'isPersistable'
|
||||
'getProvider'
|
||||
]);
|
||||
|
||||
mockAPI = {
|
||||
@@ -69,31 +69,34 @@ define(
|
||||
});
|
||||
|
||||
it("Applies to edit action", function () {
|
||||
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
|
||||
policy.allow(mockEditAction, testContext);
|
||||
expect(mockObjectAPI.isPersistable).toHaveBeenCalled();
|
||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("Applies to properties action", function () {
|
||||
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
|
||||
policy.allow(mockPropertiesAction, testContext);
|
||||
expect(mockObjectAPI.isPersistable).toHaveBeenCalled();
|
||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not apply to other actions", function () {
|
||||
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
|
||||
policy.allow(mockOtherAction, testContext);
|
||||
expect(mockObjectAPI.isPersistable).not.toHaveBeenCalled();
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("Tests object provider for editability", function () {
|
||||
mockObjectAPI.isPersistable.and.returnValue(false);
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
expect(mockObjectAPI.isPersistable).toHaveBeenCalled();
|
||||
mockObjectAPI.isPersistable.and.returnValue(true);
|
||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
||||
mockObjectAPI.getProvider.and.returnValue({save: function () {}});
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,9 +26,9 @@ define([
|
||||
EditRepresenter
|
||||
) {
|
||||
describe('EditRepresenter', function () {
|
||||
var $log;
|
||||
var $scope;
|
||||
var representer;
|
||||
var $log,
|
||||
$scope,
|
||||
representer;
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -42,8 +42,8 @@ define([
|
||||
});
|
||||
|
||||
describe('representation', function () {
|
||||
var domainObject;
|
||||
var representation;
|
||||
var domainObject,
|
||||
representation;
|
||||
|
||||
beforeEach(function () {
|
||||
domainObject = jasmine.createSpyObj('domainObject', [
|
||||
|
||||
@@ -25,8 +25,8 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
|
||||
var TRANSACTION_METHODS = ['add', 'commit', 'cancel', 'size'];
|
||||
|
||||
describe("A NestedTransaction", function () {
|
||||
var mockTransaction;
|
||||
var nestedTransaction;
|
||||
var mockTransaction,
|
||||
nestedTransaction;
|
||||
|
||||
beforeEach(function () {
|
||||
mockTransaction =
|
||||
@@ -42,8 +42,8 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
|
||||
});
|
||||
|
||||
describe("when callbacks are added", function () {
|
||||
var mockCommit;
|
||||
var mockCancel;
|
||||
var mockCommit,
|
||||
mockCancel;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCommit = jasmine.createSpy('commit');
|
||||
|
||||
@@ -25,13 +25,13 @@ define(
|
||||
["../../src/services/TransactionManager"],
|
||||
function (TransactionManager) {
|
||||
describe("TransactionManager", function () {
|
||||
var mockTransactionService;
|
||||
var testId;
|
||||
var mockOnCommit;
|
||||
var mockOnCancel;
|
||||
var mockRemoves;
|
||||
var mockPromise;
|
||||
var manager;
|
||||
var mockTransactionService,
|
||||
testId,
|
||||
mockOnCommit,
|
||||
mockOnCancel,
|
||||
mockRemoves,
|
||||
mockPromise,
|
||||
manager;
|
||||
|
||||
beforeEach(function () {
|
||||
mockRemoves = [];
|
||||
|
||||
@@ -26,9 +26,9 @@ define(
|
||||
function (TransactionService) {
|
||||
|
||||
describe("The Transaction Service", function () {
|
||||
var mockQ;
|
||||
var mockLog;
|
||||
var transactionService;
|
||||
var mockQ,
|
||||
mockLog,
|
||||
transactionService;
|
||||
|
||||
function fastPromise(val) {
|
||||
return {
|
||||
@@ -52,8 +52,8 @@ define(
|
||||
});
|
||||
|
||||
it("addToTransaction queues onCommit and onCancel functions", function () {
|
||||
var onCommit = jasmine.createSpy('onCommit');
|
||||
var onCancel = jasmine.createSpy('onCancel');
|
||||
var onCommit = jasmine.createSpy('onCommit'),
|
||||
onCancel = jasmine.createSpy('onCancel');
|
||||
|
||||
transactionService.startTransaction();
|
||||
transactionService.addToTransaction(onCommit, onCancel);
|
||||
@@ -61,8 +61,8 @@ define(
|
||||
});
|
||||
|
||||
it("size function returns size of commit and cancel queues", function () {
|
||||
var onCommit = jasmine.createSpy('onCommit');
|
||||
var onCancel = jasmine.createSpy('onCancel');
|
||||
var onCommit = jasmine.createSpy('onCommit'),
|
||||
onCancel = jasmine.createSpy('onCancel');
|
||||
|
||||
transactionService.startTransaction();
|
||||
transactionService.addToTransaction(onCommit, onCancel);
|
||||
|
||||
@@ -26,8 +26,8 @@ define(
|
||||
function (Transaction) {
|
||||
|
||||
describe("A Transaction", function () {
|
||||
var mockLog;
|
||||
var transaction;
|
||||
var mockLog,
|
||||
transaction;
|
||||
|
||||
beforeEach(function () {
|
||||
mockLog = jasmine.createSpyObj(
|
||||
@@ -42,9 +42,9 @@ define(
|
||||
});
|
||||
|
||||
describe("when callbacks are added", function () {
|
||||
var mockCommit;
|
||||
var mockCancel;
|
||||
var remove;
|
||||
var mockCommit,
|
||||
mockCancel,
|
||||
remove;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCommit = jasmine.createSpy('commit');
|
||||
|
||||
@@ -26,10 +26,10 @@ define([
|
||||
moment
|
||||
) {
|
||||
|
||||
var DATE_FORMAT = "HH:mm:ss";
|
||||
var DATE_FORMATS = [
|
||||
DATE_FORMAT
|
||||
];
|
||||
var DATE_FORMAT = "HH:mm:ss",
|
||||
DATE_FORMATS = [
|
||||
DATE_FORMAT
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,14 +26,14 @@ define([
|
||||
moment
|
||||
) {
|
||||
|
||||
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS";
|
||||
var DATE_FORMATS = [
|
||||
DATE_FORMAT,
|
||||
DATE_FORMAT + "Z",
|
||||
"YYYY-MM-DD HH:mm:ss",
|
||||
"YYYY-MM-DD HH:mm",
|
||||
"YYYY-MM-DD"
|
||||
];
|
||||
var DATE_FORMAT = "YYYY-MM-DD HH:mm:ss.SSS",
|
||||
DATE_FORMATS = [
|
||||
DATE_FORMAT,
|
||||
DATE_FORMAT + "Z",
|
||||
"YYYY-MM-DD HH:mm:ss",
|
||||
"YYYY-MM-DD HH:mm",
|
||||
"YYYY-MM-DD"
|
||||
];
|
||||
|
||||
/**
|
||||
* @typedef Scale
|
||||
|
||||
@@ -27,9 +27,9 @@ define(
|
||||
var KEYS = ['a', 'b', 'c'];
|
||||
|
||||
describe("The FormatProvider", function () {
|
||||
var mockFormats;
|
||||
var mockFormatInstances;
|
||||
var provider;
|
||||
var mockFormats,
|
||||
mockFormatInstances,
|
||||
provider;
|
||||
|
||||
beforeEach(function () {
|
||||
mockFormatInstances = KEYS.map(function (k) {
|
||||
|
||||
@@ -19,13 +19,7 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div class="c-object-label"
|
||||
ng-class="{ 'is-missing': model.status === 'missing' }"
|
||||
>
|
||||
<div class="c-object-label__type-icon {{type.getCssClass()}}"
|
||||
ng-class="{ 'l-icon-link':location.isLink() }"
|
||||
>
|
||||
<span class="is-missing__indicator" title="This item is missing"></span>
|
||||
</div>
|
||||
<div class="c-object-label">
|
||||
<div class="c-object-label__type-icon {{type.getCssClass()}}" ng-class="{ 'l-icon-link':location.isLink() }"></div>
|
||||
<div class='c-object-label__name'>{{model.name}}</div>
|
||||
</div>
|
||||
|
||||
@@ -41,19 +41,19 @@ define(
|
||||
* stylesheets will be found
|
||||
*/
|
||||
function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
|
||||
var head = $document.find('head');
|
||||
var document = $document[0];
|
||||
var head = $document.find('head'),
|
||||
document = $document[0];
|
||||
|
||||
// Procedure for adding a single stylesheet
|
||||
function addStyleSheet(stylesheet) {
|
||||
// Create a link element, and construct full path
|
||||
var link = document.createElement('link');
|
||||
var path = [
|
||||
assetPath,
|
||||
stylesheet.bundle.path,
|
||||
stylesheet.bundle.resources,
|
||||
stylesheet.stylesheetUrl
|
||||
].join("/");
|
||||
var link = document.createElement('link'),
|
||||
path = [
|
||||
assetPath,
|
||||
stylesheet.bundle.path,
|
||||
stylesheet.bundle.resources,
|
||||
stylesheet.stylesheetUrl
|
||||
].join("/");
|
||||
|
||||
// Initialize attributes on the link
|
||||
link.setAttribute("rel", "stylesheet");
|
||||
|
||||
@@ -48,12 +48,12 @@ define(
|
||||
// Separate out the actions that have been retrieved
|
||||
// into groups, and populate scope with this.
|
||||
function groupActions(actions) {
|
||||
var groups = {};
|
||||
var ungrouped = [];
|
||||
var groups = {},
|
||||
ungrouped = [];
|
||||
|
||||
function assignToGroup(action) {
|
||||
var metadata = action.getMetadata();
|
||||
var group = metadata.group;
|
||||
var metadata = action.getMetadata(),
|
||||
group = metadata.group;
|
||||
if (group) {
|
||||
groups[group] = groups[group] || [];
|
||||
groups[group].push(action);
|
||||
@@ -73,9 +73,9 @@ define(
|
||||
// Callback for when state which might influence action groupings
|
||||
// changes.
|
||||
function updateGroups() {
|
||||
var actionCapability = $scope.action;
|
||||
var params = $scope.parameters || {};
|
||||
var category = params.category;
|
||||
var actionCapability = $scope.action,
|
||||
params = $scope.parameters || {},
|
||||
category = params.category;
|
||||
|
||||
if (actionCapability && category) {
|
||||
// Get actions by capability, and group them
|
||||
|
||||
@@ -25,22 +25,22 @@ define(
|
||||
function (moment) {
|
||||
|
||||
var TIME_NAMES = {
|
||||
'hours': "Hour",
|
||||
'minutes': "Minute",
|
||||
'seconds': "Second"
|
||||
};
|
||||
var MONTHS = moment.months();
|
||||
var TIME_OPTIONS = (function makeRanges() {
|
||||
var arr = [];
|
||||
while (arr.length < 60) {
|
||||
arr.push(arr.length);
|
||||
}
|
||||
return {
|
||||
hours: arr.slice(0, 24),
|
||||
minutes: arr,
|
||||
seconds: arr
|
||||
};
|
||||
}());
|
||||
'hours': "Hour",
|
||||
'minutes': "Minute",
|
||||
'seconds': "Second"
|
||||
},
|
||||
MONTHS = moment.months(),
|
||||
TIME_OPTIONS = (function makeRanges() {
|
||||
var arr = [];
|
||||
while (arr.length < 60) {
|
||||
arr.push(arr.length);
|
||||
}
|
||||
return {
|
||||
hours: arr.slice(0, 24),
|
||||
minutes: arr,
|
||||
seconds: arr
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* Controller to support the date-time picker.
|
||||
@@ -65,15 +65,15 @@ define(
|
||||
* Months are zero-indexed, day-of-months are one-indexed.
|
||||
*/
|
||||
function DateTimePickerController($scope, now) {
|
||||
var year;
|
||||
var month; // For picker state, not model state
|
||||
var interacted = false;
|
||||
var year,
|
||||
month, // For picker state, not model state
|
||||
interacted = false;
|
||||
|
||||
function generateTable() {
|
||||
var m = moment.utc({ year: year, month: month }).day(0);
|
||||
var table = [];
|
||||
var row;
|
||||
var col;
|
||||
var m = moment.utc({ year: year, month: month }).day(0),
|
||||
table = [],
|
||||
row,
|
||||
col;
|
||||
|
||||
for (row = 0; row < 6; row += 1) {
|
||||
table.push([]);
|
||||
|
||||
@@ -40,9 +40,9 @@ define(
|
||||
|
||||
// Gets an array of the contextual parents/ancestors of the selected object
|
||||
function getContextualPath() {
|
||||
var currentObj = $scope.domainObject;
|
||||
var currentParent;
|
||||
var parents = [];
|
||||
var currentObj = $scope.domainObject,
|
||||
currentParent,
|
||||
parents = [];
|
||||
|
||||
currentParent = currentObj &&
|
||||
currentObj.hasCapability('context') &&
|
||||
|
||||
@@ -35,10 +35,10 @@ define(
|
||||
* @param $scope Angular scope for this controller
|
||||
*/
|
||||
function SelectorController(objectService, $scope) {
|
||||
var treeModel = {};
|
||||
var listModel = {};
|
||||
var previousSelected;
|
||||
var self = this;
|
||||
var treeModel = {},
|
||||
listModel = {},
|
||||
previousSelected,
|
||||
self = this;
|
||||
|
||||
// For watch; look at the user's selection in the tree
|
||||
function getTreeSelection() {
|
||||
@@ -126,8 +126,8 @@ define(
|
||||
* @param {DomainObject} the domain object to select
|
||||
*/
|
||||
SelectorController.prototype.select = function (domainObject) {
|
||||
var id = domainObject && domainObject.getId();
|
||||
var list = this.getField() || [];
|
||||
var id = domainObject && domainObject.getId(),
|
||||
list = this.getField() || [];
|
||||
// Only select if we have a valid id,
|
||||
// and it isn't already selected
|
||||
if (id && list.indexOf(id) === -1) {
|
||||
@@ -140,8 +140,8 @@ define(
|
||||
* @param {DomainObject} the domain object to select
|
||||
*/
|
||||
SelectorController.prototype.deselect = function (domainObject) {
|
||||
var id = domainObject && domainObject.getId();
|
||||
var list = this.getField() || [];
|
||||
var id = domainObject && domainObject.getId(),
|
||||
list = this.getField() || [];
|
||||
// Only change if this was a valid id,
|
||||
// for an object which was already selected
|
||||
if (id && list.indexOf(id) !== -1) {
|
||||
|
||||
@@ -101,12 +101,7 @@ define([
|
||||
};
|
||||
|
||||
TimeRangeController.prototype.updateTicks = function () {
|
||||
var i;
|
||||
var p;
|
||||
var ts;
|
||||
var start;
|
||||
var end;
|
||||
var span;
|
||||
var i, p, ts, start, end, span;
|
||||
end = this.$scope.ngModel.outer.end;
|
||||
start = this.$scope.ngModel.outer.start;
|
||||
span = end - start;
|
||||
@@ -202,9 +197,9 @@ define([
|
||||
};
|
||||
|
||||
TimeRangeController.prototype.middleDrag = function (pixels) {
|
||||
var delta = this.toMillis(pixels);
|
||||
var edge = delta < 0 ? 'start' : 'end';
|
||||
var opposite = delta < 0 ? 'end' : 'start';
|
||||
var delta = this.toMillis(pixels),
|
||||
edge = delta < 0 ? 'start' : 'end',
|
||||
opposite = delta < 0 ? 'end' : 'start';
|
||||
|
||||
// Adjust the position of the edge in the direction of drag
|
||||
this.$scope.ngModel.inner[edge] = clamp(
|
||||
|
||||
@@ -59,8 +59,8 @@ define(
|
||||
* @constructor
|
||||
*/
|
||||
function TreeNodeController($scope, $timeout) {
|
||||
var self = this;
|
||||
var selectedObject = ($scope.ngModel || {}).selectedObject;
|
||||
var self = this,
|
||||
selectedObject = ($scope.ngModel || {}).selectedObject;
|
||||
|
||||
// Look up the id for a domain object. A convenience
|
||||
// for mapping; additionally does some undefined-checking.
|
||||
@@ -86,14 +86,14 @@ define(
|
||||
// Consider the currently-navigated object and update
|
||||
// parameters which support display.
|
||||
function checkSelection() {
|
||||
var nodeObject = $scope.domainObject;
|
||||
var navObject = selectedObject;
|
||||
var nodeContext = nodeObject &&
|
||||
nodeObject.getCapability('context');
|
||||
var navContext = navObject &&
|
||||
navObject.getCapability('context');
|
||||
var nodePath;
|
||||
var navPath;
|
||||
var nodeObject = $scope.domainObject,
|
||||
navObject = selectedObject,
|
||||
nodeContext = nodeObject &&
|
||||
nodeObject.getCapability('context'),
|
||||
navContext = navObject &&
|
||||
navObject.getCapability('context'),
|
||||
nodePath,
|
||||
navPath;
|
||||
|
||||
// Deselect; we will reselect below, iff we are
|
||||
// exactly at the end of the path.
|
||||
|
||||
@@ -42,13 +42,13 @@ define(
|
||||
var body = $document.find('body');
|
||||
|
||||
function clickBody(event) {
|
||||
var x = event.clientX;
|
||||
var y = event.clientY;
|
||||
var rect = element[0].getBoundingClientRect();
|
||||
var xMin = rect.left;
|
||||
var xMax = xMin + rect.width;
|
||||
var yMin = rect.top;
|
||||
var yMax = yMin + rect.height;
|
||||
var x = event.clientX,
|
||||
y = event.clientY,
|
||||
rect = element[0].getBoundingClientRect(),
|
||||
xMin = rect.left,
|
||||
xMax = xMin + rect.width,
|
||||
yMin = rect.top,
|
||||
yMax = yMin + rect.height;
|
||||
|
||||
if (x < xMin || x > xMax || y < yMin || y > yMax) {
|
||||
scope.$apply(function () {
|
||||
|
||||
@@ -62,10 +62,10 @@ define(
|
||||
// Populate initial scope based on attributes requested
|
||||
// by the container definition
|
||||
link: function (scope, element, attrs) {
|
||||
var key = attrs.key;
|
||||
var container = containerMap[key];
|
||||
var alias = "container";
|
||||
var copiedAttributes = {};
|
||||
var key = attrs.key,
|
||||
container = containerMap[key],
|
||||
alias = "container",
|
||||
copiedAttributes = {};
|
||||
|
||||
if (container) {
|
||||
alias = container.alias || alias;
|
||||
@@ -78,8 +78,8 @@ define(
|
||||
},
|
||||
|
||||
template: function (element, attrs) {
|
||||
var key = attrs.key;
|
||||
var container = containerMap[key];
|
||||
var key = attrs.key,
|
||||
container = containerMap[key];
|
||||
return container ? container.template : "";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,12 +54,12 @@ define(
|
||||
// mouse event handlers; mousedown and mouseup cannot
|
||||
// only be attached to the element being linked, as the
|
||||
// mouse may leave this element during the drag.
|
||||
var body = $document.find('body');
|
||||
var isMobile = agentService.isMobile();
|
||||
var touchEvents;
|
||||
var initialPosition;
|
||||
var $event;
|
||||
var delta;
|
||||
var body = $document.find('body'),
|
||||
isMobile = agentService.isMobile(),
|
||||
touchEvents,
|
||||
initialPosition,
|
||||
$event,
|
||||
delta;
|
||||
|
||||
if (isMobile) {
|
||||
touchEvents = {
|
||||
|
||||
@@ -44,10 +44,10 @@ define(
|
||||
*/
|
||||
function MCTPopup($compile, popupService) {
|
||||
function link(scope, element, attrs, ctrl, transclude) {
|
||||
var div = $compile(TEMPLATE)(scope);
|
||||
var rect = element.parent()[0].getBoundingClientRect();
|
||||
var position = [rect.left, rect.top];
|
||||
var popup = popupService.display(div, position);
|
||||
var div = $compile(TEMPLATE)(scope),
|
||||
rect = element.parent()[0].getBoundingClientRect(),
|
||||
position = [rect.left, rect.top],
|
||||
popup = popupService.display(div, position);
|
||||
|
||||
div.addClass('t-popup');
|
||||
transclude(function (clone) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user