mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 03:00:13 +00:00
Compare commits
54 Commits
scatter-pl
...
create-new
Author | SHA1 | Date | |
---|---|---|---|
a53a669154 | |||
0602613b6e | |||
7620432388 | |||
fc8663c049 | |||
adfe30a891 | |||
5218e350c3 | |||
88615e92d2 | |||
12477a220b | |||
9582fb2b06 | |||
3c075b7ff2 | |||
081edfbd70 | |||
04cc8f7aa2 | |||
a1d206bfc3 | |||
ef9c6d5fed | |||
15a75ac134 | |||
cde3994979 | |||
1a10c966e0 | |||
9288880e47 | |||
d2c5476cdd | |||
8d21d420ae | |||
cc22fd4e9d | |||
4a046b3eea | |||
b0702ceff5 | |||
5af14cd3b9 | |||
d7eb4c17ca | |||
8c9fe2d36b | |||
3246480f82 | |||
8055e050b6 | |||
b0f73fff0d | |||
755cf21d3f | |||
95457a1981 | |||
da0ed95662 | |||
c8919708bb | |||
cc5bfda730 | |||
433dee0314 | |||
013eba744d | |||
29de11167f | |||
eaa9514453 | |||
b8f278cabf | |||
63bb183bec | |||
9d2c7a6de5 | |||
07fb20c32f | |||
90a6bbc13e | |||
73e38f1955 | |||
de8f8d174d | |||
b187762d55 | |||
45a152df86 | |||
a3e78bbf91 | |||
374e4afc32 | |||
2f8a0c2c2b | |||
163043635e | |||
ec9fd59d4a | |||
e03ea25392 | |||
56c16ed263 |
40
.circleci/config.yml
Normal file
40
.circleci/config.yml
Normal file
@ -0,0 +1,40 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/node:8-browsers
|
||||
environment:
|
||||
CHROME_BIN: "/usr/bin/google-chrome"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Update npm
|
||||
command: 'sudo npm install -g npm@latest'
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}-{{ checksum "bower.json" }}
|
||||
- run:
|
||||
name: Installing dependencies (npm install)
|
||||
command: npm install
|
||||
- save_cache:
|
||||
key: dependency-cache-{{ checksum "package.json" }}-{{ checksum "bower.json" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- bower_components
|
||||
- run:
|
||||
name: npm run test
|
||||
command: npm run test
|
||||
- run:
|
||||
name: npm run lint
|
||||
command: npm run lint
|
||||
- run:
|
||||
name: npm run checkstyle
|
||||
command: npm run checkstyle
|
||||
- store_artifacts:
|
||||
path: dist
|
||||
prefix: dist
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
test:
|
||||
jobs:
|
||||
- build
|
88
API.md
88
API.md
@ -37,7 +37,7 @@
|
||||
- [Time Systems and Bounds](#time-systems-and-bounds)
|
||||
- [Defining and Registering Time Systems](#defining-and-registering-time-systems)
|
||||
- [Getting and Setting the Active Time System](#getting-and-setting-the-active-time-system)
|
||||
- [Time Bounds](#time-bounds)
|
||||
- [Time Bounds](#time-bounds)
|
||||
- [Clocks](#clocks)
|
||||
- [Defining and registering clocks](#defining-and-registering-clocks)
|
||||
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
||||
@ -48,6 +48,10 @@
|
||||
- [The Time Conductor](#the-time-conductor)
|
||||
- [Time Conductor Configuration](#time-conductor-configuration)
|
||||
- [Example conductor configuration](#example-conductor-configuration)
|
||||
- [Indicators](#indicators)
|
||||
- [The URL Status Indicator](#the-url-status-indicator)
|
||||
- [Creating a Simple Indicator](#creating-a-simple-indicator)
|
||||
- [Custom Indicators](#custom-indicators)
|
||||
- [Included Plugins](#included-plugins)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
@ -688,7 +692,7 @@ openmct.time.timeSystem(utcTimeSystem, bounds);
|
||||
Setting the active time system will trigger a [`'timeSystem'`](#time-events)
|
||||
event. If you supplied bounds, a [`'bounds'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
||||
|
||||
### Time Bounds
|
||||
#### Time Bounds
|
||||
|
||||
The TimeAPI provides a getter/setter for querying and setting time bounds. Time
|
||||
bounds are simply an object with a `start` and an end `end` attribute.
|
||||
@ -977,6 +981,72 @@ openmct.install(openmct.plugins.Conductor({
|
||||
}));
|
||||
```
|
||||
|
||||
## Indicators
|
||||
|
||||
Indicators are small widgets that reside at the bottom of the screen and are visible from
|
||||
every screen in Open MCT. They can be used to convey system state using an icon and text.
|
||||
Typically an indicator will display an icon (customizable with a CSS class) that will
|
||||
reveal additional information when the mouse cursor is hovered over it.
|
||||
|
||||
### The URL Status Indicator
|
||||
|
||||
A common use case for indicators is to convey the state of some external system such as a
|
||||
persistence backend or HTTP server. So long as this system is accessible via HTTP request,
|
||||
Open MCT provides a general purpose indicator to show whether the server is available and
|
||||
returing a 2xx status code. The URL Status Indicator is made available as a default plugin. See
|
||||
[Included Plugins](#included-plugins) below for details on how to install and configure the
|
||||
URL Status Indicator.
|
||||
|
||||
### Creating a Simple Indicator
|
||||
|
||||
A simple indicator with an icon and some text can be created and added with minimal code. An indicator
|
||||
of this type exposes functions for customizing the text, icon, and style of the indicator.
|
||||
|
||||
eg.
|
||||
``` javascript
|
||||
var myIndicator = openmct.indicators.simpleIndicator();
|
||||
myIndicator.text("Hello World!");
|
||||
openmct.indicators.add(myIndicator);
|
||||
```
|
||||
|
||||
This will create a new indicator and add it to the bottom of the screen in Open MCT.
|
||||
By default, the indicator will appear as an information icon. Hovering over the icon will
|
||||
reveal the text set via the call to `.text()`. The Indicator object returned by the API
|
||||
call exposes a number of functions for customizing the content and appearance of the indicator:
|
||||
|
||||
* `.text([text])`: Gets or sets the text shown when the user hovers over the indicator.
|
||||
Accepts an __optional__ `string` argument that, if provided, will be used to set the text.
|
||||
Hovering over the indicator will expand it to its full size, revealing this text alongside
|
||||
the icon. Returns the currently set text as a `string`.
|
||||
* `.description([description])`: Gets or sets the indicator's description. Accepts an
|
||||
__optional__ `string` argument that, if provided, will be used to set the text. The description
|
||||
allows for more detail to be provided in a tooltip when the user hovers over the indicator.
|
||||
Returns the currently set text as a `string`.
|
||||
* `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an __optional__
|
||||
`string` parameter to be used to set the class applied to the indicator. Any of
|
||||
[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs)
|
||||
may be used here, or a custom CSS class can be provided. Returns the currently defined CSS
|
||||
class as a `string`.
|
||||
* `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional __
|
||||
`string` parameter to be used to set a status class applied to the indicator. May be used to apply
|
||||
different colors to indicate status.
|
||||
|
||||
### Custom Indicators
|
||||
|
||||
A completely custom indicator can be added by simple providing a DOM element to place alongside other indicators.
|
||||
|
||||
``` javascript
|
||||
var domNode = document.createElement('div');
|
||||
domNode.innerText = new Date().toString();
|
||||
setInterval(function () {
|
||||
domNode.innerText = new Date().toString();
|
||||
}, 1000);
|
||||
|
||||
openmct.indicators.add({
|
||||
element: domNode
|
||||
});
|
||||
```
|
||||
|
||||
## Included Plugins
|
||||
|
||||
Open MCT is packaged along with a few general-purpose plugins:
|
||||
@ -1000,18 +1070,18 @@ openmct.install(openmct.plugins.CouchDB('http://localhost:9200'))
|
||||
* `openmct.plugins.Espresso` and `openmct.plugins.Snow` are two different
|
||||
themes (dark and light) available for Open MCT. Note that at least one
|
||||
of these themes must be installed for Open MCT to appear correctly.
|
||||
* `openmct.plugins.URLIndicatorPlugin` adds an indicator which shows the
|
||||
* `openmct.plugins.URLIndicator` adds an indicator which shows the
|
||||
availability of a URL with the following options:
|
||||
- `url` : URL to indicate the status of
|
||||
- `cssClass`: Icon to show in the status bar, defaults to `icon-database`, [list of all icons](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home?view=items)
|
||||
- `iconClass`: Icon to show in the status bar, defaults to `icon-database`, [list of all icons](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home?view=items)
|
||||
- `interval`: Interval between checking the connection, defaults to `10000`
|
||||
- `label` Name showing up as text in the status bar, defaults to url
|
||||
```javascript
|
||||
openmct.install(openmct.plugins.URLIndicatorPlugin({
|
||||
url: 'http://google.com',
|
||||
cssClass: 'check',
|
||||
interval: 10000,
|
||||
label: 'Google'
|
||||
openmct.install(openmct.plugins.URLIndicator({
|
||||
url: 'http://localhost:8080',
|
||||
iconClass: 'check',
|
||||
interval: 10000,
|
||||
label: 'Localhost'
|
||||
})
|
||||
);
|
||||
```
|
||||
|
5
app.js
5
app.js
@ -19,6 +19,7 @@
|
||||
|
||||
// Defaults
|
||||
options.port = options.port || options.p || 8080;
|
||||
options.host = options.host || options.h || 'localhost'
|
||||
options.directory = options.directory || options.D || '.';
|
||||
['include', 'exclude', 'i', 'x'].forEach(function (opt) {
|
||||
options[opt] = options[opt] || [];
|
||||
@ -78,7 +79,7 @@
|
||||
app.use(express['static'](options.directory));
|
||||
|
||||
// Finally, open the HTTP server and log the instance to the console
|
||||
app.listen(options.port, function() {
|
||||
console.log('Open MCT application running at localhost:' + options.port)
|
||||
app.listen(options.port, options.host, function() {
|
||||
console.log('Open MCT application running at %s:%s', options.host, options.port)
|
||||
});
|
||||
}());
|
||||
|
@ -22,7 +22,6 @@
|
||||
"eventemitter3": "^1.2.0",
|
||||
"lodash": "3.10.1",
|
||||
"almond": "~0.3.2",
|
||||
"html2canvas": "^0.4.1",
|
||||
"moment-timezone": "^0.5.13"
|
||||
}
|
||||
}
|
||||
}
|
27
circle.yml
27
circle.yml
@ -1,27 +0,0 @@
|
||||
machine:
|
||||
node:
|
||||
version: 8.11.0
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- npm install -g npm@latest
|
||||
|
||||
deployment:
|
||||
production:
|
||||
branch: master
|
||||
commands:
|
||||
- npm install canvas nomnoml
|
||||
- ./build-docs.sh
|
||||
openmctweb-staging-deux:
|
||||
branch: mobile
|
||||
heroku:
|
||||
appname: openmctweb-staging-deux
|
||||
test:
|
||||
post:
|
||||
- gulp lint
|
||||
- gulp checkstyle
|
||||
|
||||
general:
|
||||
branches:
|
||||
ignore:
|
||||
- gh-pages
|
@ -60,8 +60,8 @@ define([
|
||||
"source": "eventGenerator",
|
||||
"domains": [
|
||||
{
|
||||
"key": "time",
|
||||
"name": "Time",
|
||||
"key": "utc",
|
||||
"name": "Timestamp",
|
||||
"format": "utc"
|
||||
}
|
||||
],
|
||||
|
@ -30,6 +30,7 @@ define([
|
||||
{
|
||||
key: "sin",
|
||||
name: "Sine",
|
||||
formatString: '%0.2f',
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
@ -37,6 +38,7 @@ define([
|
||||
{
|
||||
key: "cos",
|
||||
name: "Cosine",
|
||||
formatString: '%0.2f',
|
||||
hints: {
|
||||
range: 2
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ define([
|
||||
var data = [];
|
||||
while (start <= end && data.length < 5000) {
|
||||
data.push(pointForTimestamp(start, duration, domainObject.name));
|
||||
start += 5000;
|
||||
start += duration;
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
};
|
||||
|
@ -38,7 +38,8 @@ define([
|
||||
"provides": "identityService",
|
||||
"type": "provider",
|
||||
"depends": [
|
||||
"dialogService"
|
||||
"dialogService",
|
||||
"$q"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -55,21 +55,37 @@ define(
|
||||
* @implements {IdentityService}
|
||||
* @memberof platform/identity
|
||||
*/
|
||||
function ExampleIdentityProvider(dialogService) {
|
||||
// Handle rejected dialog messages by treating the
|
||||
// current user as undefined.
|
||||
function echo(v) { return v; }
|
||||
function giveUndefined() { return undefined; }
|
||||
function ExampleIdentityProvider(dialogService, $q) {
|
||||
this.dialogService = dialogService;
|
||||
this.$q = $q;
|
||||
|
||||
this.userPromise =
|
||||
dialogService.getUserInput(DIALOG_STRUCTURE, DEFAULT_IDENTITY)
|
||||
.then(echo, giveUndefined);
|
||||
this.returnUser = this.returnUser.bind(this);
|
||||
this.returnUndefined = this.returnUndefined.bind(this);
|
||||
}
|
||||
|
||||
ExampleIdentityProvider.prototype.getUser = function () {
|
||||
return this.userPromise;
|
||||
if (this.user) {
|
||||
return this.$q.when(this.user);
|
||||
} else {
|
||||
return this.dialogService.getUserInput(DIALOG_STRUCTURE, DEFAULT_IDENTITY)
|
||||
.then(this.returnUser, this.returnUndefined);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ExampleIdentityProvider.prototype.returnUser = function (user) {
|
||||
return this.user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ExampleIdentityProvider.prototype.returnUndefined = function () {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return ExampleIdentityProvider;
|
||||
}
|
||||
);
|
||||
|
@ -1,9 +1,9 @@
|
||||
<span class="status block" ng-controller="DialogLaunchController">
|
||||
<span class="h-indicator" ng-controller="DialogLaunchController">
|
||||
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
|
||||
<span class="status-indicator icon-box-with-arrow"></span><span class="label">
|
||||
<a ng-click="launchProgress(true)">Known</a> |
|
||||
<a ng-click="launchProgress(false)">Unknown</a> |
|
||||
<a ng-click="launchError()">Error</a> |
|
||||
<div class="ls-indicator icon-box-with-arrow s-status-available"><span class="label">
|
||||
<a ng-click="launchProgress(true)">Known</a>
|
||||
<a ng-click="launchProgress(false)">Unknown</a>
|
||||
<a ng-click="launchError()">Error</a>
|
||||
<a ng-click="launchInfo()">Info</a>
|
||||
</span><span class="count"></span>
|
||||
</span></div>
|
||||
</span>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<span class="status block" ng-controller="NotificationLaunchController">
|
||||
<span class="h-indicator" ng-controller="NotificationLaunchController">
|
||||
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
|
||||
<span class="status-indicator icon-bell"></span><span class="label">
|
||||
<a ng-click="newInfo()">Success</a> |
|
||||
<a ng-click="newError()">Error</a> |
|
||||
<a ng-click="newAlert()">Alert</a> |
|
||||
<div class="ls-indicator icon-bell s-status-available"><span class="label">
|
||||
<a ng-click="newInfo()">Success</a>
|
||||
<a ng-click="newError()">Error</a>
|
||||
<a ng-click="newAlert()">Alert</a>
|
||||
<a ng-click="newProgress()">Progress</a>
|
||||
</span><span class="count"></span>
|
||||
</span></div>
|
||||
</span>
|
||||
|
@ -58,7 +58,10 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.w-mct-example > div { margin-bottom: $interiorMarginLg; }
|
||||
.w-mct-example {
|
||||
color: #ccc;
|
||||
> div { margin-bottom: $interiorMarginLg; }
|
||||
}
|
||||
|
||||
code,
|
||||
pre {
|
||||
|
@ -149,12 +149,21 @@
|
||||
<h2>Local Controls</h2>
|
||||
<div class="cols cols1-1">
|
||||
<div class="col">
|
||||
<p>Local controls are typically buttons and selects that provide local control to an individual element. Typically, these controls are hidden in order to not block data display until the user hovers their cursor over an element, when the controls are displayed using a transition fade. Mousing out of the element fades the controls from view.</p>
|
||||
<p>Local controls are typically buttons and selects that provide actions in close proximity to a component.</p>
|
||||
<p>These controls can optionally be hidden to reduce clutter until the user hovers their cursor over an enclosing element. To use this approach, apply the class <code>.has-local-controls</code> to the element that should be aware of the hover and ensure that element encloses <code>.h-local-controls</code>.</p>
|
||||
</div>
|
||||
<mct-example><div class="plot-display-area" style="height: 100px; padding: 10px; position: relative;">Hover over me
|
||||
<div class="l-local-controls gl-plot-local-controls t-plot-display-controls">
|
||||
<mct-example><div class="plot-display-area" style="padding: 10px; position: relative;">
|
||||
Some content in here
|
||||
<div class="h-local-controls h-local-controls-overlay-content l-btn-set">
|
||||
<a class="s-button icon-arrow-left" title="Restore previous pan/zoom"></a>
|
||||
<a class="s-button icon-arrows-out" title="Reset pan/zoom"></a>
|
||||
<a class="s-button icon-reset" title="Reset pan/zoom"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plot-display-area has-local-controls" style="padding: 10px; position: relative;">
|
||||
Hover here
|
||||
<div class="h-local-controls h-local-controls-overlay-content local-controls-hidden l-btn-set">
|
||||
<a class="s-button icon-arrow-left" title="Restore previous pan/zoom"></a>
|
||||
<a class="s-button icon-reset" title="Reset pan/zoom"></a>
|
||||
</div>
|
||||
</div></mct-example>
|
||||
</div>
|
||||
|
@ -20,12 +20,12 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<style>
|
||||
.w-mct-example div[class*="s-limit"],
|
||||
.w-mct-example div[class*="s-status"],
|
||||
.w-mct-example div[class*="s-unsynced"],
|
||||
.w-mct-example span[class*="s-status"],
|
||||
.w-mct-example div[class*="s-limit"],
|
||||
.w-mct-example span[class*="s-limit"] {
|
||||
border-radius: 4px;
|
||||
padding: 3px 7px;
|
||||
border-radius: 3px;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
.w-mct-example table {
|
||||
width: 100%;
|
||||
@ -36,65 +36,12 @@
|
||||
<h1>Status Indication</h1>
|
||||
|
||||
<div class="l-section">
|
||||
<h2>Overview</h2>
|
||||
<p>Many elements in Open MCT need to articulate a dynamic status; Open MCT provides the following styles and conventions to handle this:</p>
|
||||
<ul>
|
||||
<li><strong>Limits</strong>: when telemetry values exceed minimum or maximum values, they can be violating limits. Limit styles include both color and iconography; color is used to indicate severity while icons are used to indicate direction, upper or lower.</li>
|
||||
<li><strong>Status</strong>: Open MCT also provides a number or built-in Status styles allowing telemetry or other displayed information to be visually classified by type. Common uses for these classes are to visually denote event records.</li>
|
||||
<li><strong>Synchronization</strong>: When the system is displaying real-time data, it is very important that displays clearly indicate when they are not doing so, such as when a plot if frozen while panning or zooming. Open MCT provides a style for this.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="l-section">
|
||||
<h2>Limits</h2>
|
||||
<h2>Status Classes</h2>
|
||||
<div class="cols cols1-1">
|
||||
<div class="col">
|
||||
<p>Limit CSS classes can be applied to any block or inline element. Open MCT limit classes set color and optionally an icon, but don't effect other properties. Yellow and red limit classes can be used as is, or allow the application of any custom icon available in Open MCT's glyphs library. "Level" limit classes - upper and lower - always use an icon in addition to a color; Open MCT doesn't support level limits without color.</p>
|
||||
<ul>
|
||||
<li>Color only</li>
|
||||
<ul>
|
||||
<li><code>s-limit-yellow</code>: A yellow limit.</li>
|
||||
<li><code>s-limit-red</code>: A red limit.</li>
|
||||
</ul>
|
||||
<li>Color and icon</li>
|
||||
<ul>
|
||||
<li><code>s-limit-yellow-icon</code>: A yellow limit with icon.</li>
|
||||
<li><code>s-limit-red-icon</code>: A red limit with icon.</li>
|
||||
</ul>
|
||||
<li>Upper and lower limit indicators. Must be used with a color limit class to be visible.</li>
|
||||
<ul>
|
||||
<li><code>s-limit-upr</code>: Upper limit.
|
||||
</li>
|
||||
<li><code>s-limit-lwr</code>: Lower limit.
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<mct-example><div class="s-limit-yellow">Yellow limit</div>
|
||||
<div class="s-limit-red">Red limit</div>
|
||||
<div class="s-limit-yellow-icon">Yellow limit with icon</div>
|
||||
<div class="s-limit-red-icon">Red limit with icon</div>
|
||||
<div class="s-limit-yellow s-limit-lwr">Lower yellow limit</div>
|
||||
<div class="s-limit-red s-limit-upr">Upper red limit</div>
|
||||
<div class="s-limit-red icon-bell">Red Limit with a custom icon</div>
|
||||
<div>Some text with an <span class="s-limit-yellow-icon">inline element</span> showing a yellow limit.</div>
|
||||
|
||||
<!-- Limits applied in a table -->
|
||||
<table>
|
||||
<tr class='header'><td>Name</td><td>Value 1</td><td>Value 2</td></tr>
|
||||
<tr><td>ENG_PWR 4991</td><td>7.023</td><td class="s-limit-yellow s-limit-upr">70.23</td></tr>
|
||||
<tr><td>ENG_PWR 4992</td><td>49.784</td><td class="s-limit-red s-limit-lwr">-121.22</td></tr>
|
||||
<tr><td>ENG_PWR 4993</td><td class="s-limit-yellow icon-bell">0.451</td><td>1.007</td></tr>
|
||||
</table>
|
||||
</mct-example>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="l-section">
|
||||
<h2>Status</h2>
|
||||
<div class="cols cols1-1">
|
||||
<div class="col">
|
||||
<p>Classes here can be applied to elements as needed.</p>
|
||||
<p>Status classes allow any block or inline-block element to be decorated in order to articulate a
|
||||
status. Provided classes include color-only and color plus icon; custom icons can easily be
|
||||
employed by using a color-only status class in combination with an <a class="link" href="#/browse/styleguide:home/glyphs?tc.mode=local&tc.timeSystem=utc&tc.startDelta=1800000&tc.endDelta=0&view=styleguide.glyphs">glyph</a>.</p>
|
||||
<ul>
|
||||
<li>Color only</li>
|
||||
<ul>
|
||||
@ -106,37 +53,175 @@
|
||||
</ul>
|
||||
<li>Color and icon</li>
|
||||
<ul>
|
||||
<li><code>s-status-warning-hi-icon</code></li>
|
||||
<li><code>s-status-warning-lo-icon</code></li>
|
||||
<li><code>s-status-diagnostic-icon</code></li>
|
||||
<li><code>s-status-info-icon</code></li>
|
||||
<li><code>s-status-ok-icon</code></li>
|
||||
<li><code>s-status-icon-warning-hi</code></li>
|
||||
<li><code>s-status-icon-warning-lo</code></li>
|
||||
<li><code>s-status-icon-diagnostic</code></li>
|
||||
<li><code>s-status-icon-info</code></li>
|
||||
<li><code>s-status-icon-ok</code></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<mct-example><div class="s-status-warning-hi">WARNING HI</div>
|
||||
<mct-example><!-- Color alone examples -->
|
||||
<div class="s-status-warning-hi">WARNING HI</div>
|
||||
<div class="s-status-warning-lo">WARNING LOW</div>
|
||||
<div class="s-status-diagnostic">DIAGNOSTIC</div>
|
||||
<div class="s-status-info">INFO</div>
|
||||
<div class="s-status-ok">OK</div>
|
||||
<div class="s-status-warning-hi-icon">WARNING HI with icon</div>
|
||||
<div class="s-status-warning-lo-icon">WARNING LOW with icon</div>
|
||||
<div class="s-status-diagnostic-icon">DIAGNOSTIC with icon</div>
|
||||
<div class="s-status-info-icon">INFO with icon</div>
|
||||
<div class="s-status-ok-icon">OK with icon</div>
|
||||
<div class="s-status-warning-hi icon-gear">WARNING HI with custom icon</div>
|
||||
|
||||
<!-- Color and icon examples -->
|
||||
<div class="s-status-icon-warning-hi">WARNING HI with icon</div>
|
||||
<div class="s-status-icon-warning-lo">WARNING LOW with icon</div>
|
||||
<div class="s-status-icon-diagnostic">DIAGNOSTIC with icon</div>
|
||||
<div class="s-status-icon-info">INFO with icon</div>
|
||||
<div class="s-status-icon-ok">OK with icon</div>
|
||||
<div class="s-status-warning-hi icon-alert-triangle">WARNING HI with custom icon</div>
|
||||
<div>Some text with an <span class="s-status-icon-diagnostic">inline element</span> showing a Diagnostic status.</div>
|
||||
</mct-example>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="l-section">
|
||||
<h2>Synchronization</h2>
|
||||
<h2>Limit Classes</h2>
|
||||
<div class="cols cols1-1">
|
||||
<div class="col">
|
||||
<p>When the system is operating in real-time streaming mode, it is important for views that display real-time data to clearly articulate when they are not, such as when a user zooms or pans a plot view, freezing that view. In that case, the CSS class <code>s-unsynced</code> should be applied to that view.</p>
|
||||
<p>Limit classes are a specialized form of status, specifically meant to be applied to telemetry
|
||||
displays to indicate that a limit threshold has been violated. Open MCT provides both severity
|
||||
and direction classes; severity (yellow and red) can be used alone or in combination
|
||||
with direction (upper or lower). Direction classes cannot be used on their own.</p>
|
||||
<p>Like Status classes, Limits can be used as color-only, or color plus icon. Custom icons can
|
||||
be applied in the same fashion as described above.</p>
|
||||
<ul>
|
||||
<li>Severity color alone</li>
|
||||
<ul>
|
||||
<li><code>s-limit-yellow</code>: A yellow limit.</li>
|
||||
<li><code>s-limit-red</code>: A red limit.</li>
|
||||
</ul>
|
||||
<li>Severity color and icon</li>
|
||||
<ul>
|
||||
<li><code>s-limit-icon-yellow</code>: A yellow limit with icon.</li>
|
||||
<li><code>s-limit-icon-red</code>: A red limit with icon.</li>
|
||||
</ul>
|
||||
<li>Direction indicators. MUST be used with a "color alone" limit class. See
|
||||
examples for more.</li>
|
||||
<ul>
|
||||
<li><code>s-limit-upr</code>: Upper limit.</li>
|
||||
<li><code>s-limit-lwr</code>: Lower limit.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<mct-example><div class="s-unsynced">This element is unsynced</div>
|
||||
<mct-example><!-- Color alone examples -->
|
||||
<div class="s-limit-yellow">Yellow limit</div>
|
||||
<div class="s-limit-red">Red limit</div>
|
||||
|
||||
<!-- Color and icon examples -->
|
||||
<div class="s-limit-icon-yellow">Yellow limit with icon</div>
|
||||
<div class="s-limit-icon-red">Red limit with icon</div>
|
||||
<div class="s-limit-red icon-alert-rect">Red Limit with a custom icon</div>
|
||||
<div>Some text with an <span class="s-limit-icon-yellow">inline element</span> showing a yellow limit.</div>
|
||||
|
||||
<!-- Severity and direction examples -->
|
||||
<div class="s-limit-yellow s-limit-lwr">Lower yellow limit</div>
|
||||
<div class="s-limit-red s-limit-upr">Upper red limit</div>
|
||||
|
||||
<!-- Limits applied in a table -->
|
||||
<table>
|
||||
<tr class='header'><td>Name</td><td>Value 1</td><td>Value 2</td></tr>
|
||||
<tr><td>ENG_PWR 4991</td><td>7.023</td><td class="s-limit-yellow s-limit-upr">70.23</td></tr>
|
||||
<tr><td>ENG_PWR 4992</td><td>49.784</td><td class="s-limit-red s-limit-lwr">-121.22</td></tr>
|
||||
<tr><td>ENG_PWR 4993</td><td class="s-limit-yellow icon-alert-triangle">0.451</td><td>1.007</td></tr>
|
||||
</table>
|
||||
</mct-example>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="l-section">
|
||||
<h2>Status Bar Indicators</h2>
|
||||
<div class="cols cols1-1">
|
||||
<div class="col">
|
||||
<p>Indicators are small iconic notification elements that appear in the Status Bar area of
|
||||
the application at the window's bottom. Indicators should be used to articulate the state of a
|
||||
system and optionally provide gestures related to that system. They use a combination of icon and
|
||||
color to identify themselves and articulate a state respectively.</p>
|
||||
<h3>Recommendations</h3>
|
||||
<ul>
|
||||
<li><strong>Keep the icon consistent</strong>. The icon is the principal identifier of the system and is a valuable
|
||||
recall aid for the user. Don't change the icon as a system's state changes, use color and
|
||||
text for that purpose.</li>
|
||||
<li><strong>Don't use the same icon more than once</strong>. Select meaningful and distinct icons so the user
|
||||
will be able to quickly identify what they're looking for.</li>
|
||||
</ul>
|
||||
|
||||
<h3>States</h3>
|
||||
<ul>
|
||||
<li><strong>Disabled</strong>: The system is not available to the user.</li>
|
||||
<li><strong>Off / Available</strong>: The system is accessible to the user but is not currently
|
||||
"On" or has not been configured. If the Indicator directly provides gestures
|
||||
related to the system, such as opening a configuration dialog box, then use
|
||||
"Available"; if the user must act elsewhere or the system isn't user-controllable,
|
||||
use "Off".</li>
|
||||
<li><strong>On</strong>: The system is enabled or configured; it is having an effect on the larger application.</li>
|
||||
<li><strong>Alert / Error</strong>: There has been a problem with the system. Generally, "Alert"
|
||||
should be used to call attention to an issue that isn't critical, while "Error"
|
||||
should be used to call attention to a problem that the user should really be aware of or do
|
||||
something about.</li>
|
||||
</ul>
|
||||
|
||||
<h3>Structure</h3>
|
||||
<p>Indicators consist of a <code>.ls-indicator</code>
|
||||
wrapper element with <code>.icon-*</code> classes for the type of thing they represent and
|
||||
<code>.s-status-*</code> classes to articulate the current state. Title attributes should be used
|
||||
to provide more verbose information about the thing and/or its status.</p>
|
||||
<p>The wrapper encloses a <code>.label</code> element that is displayed on hover. This element should
|
||||
include a brief statement of the current status, and can also include clickable elements
|
||||
as <code><a></code> tags. An optional <code>.count</code> element can be included to display
|
||||
information such as a number of messages.</p>
|
||||
<p>Icon classes are as defined on the
|
||||
<a class="link" href="#/browse/styleguide:home/glyphs?tc.mode=local&tc.timeSystem=utc&tc.startDelta=1800000&tc.endDelta=0&view=styleguide.glyphs">
|
||||
Glyphs page</a>. Status classes applicable to Indicators are as follows:</p>
|
||||
<ul>
|
||||
<li><code>s-status-disabled</code></li>
|
||||
<li><code>s-status-off</code></li>
|
||||
<li><code>s-status-available</code></li>
|
||||
<li><code>s-status-on</code></li>
|
||||
<li><code>s-status-alert</code></li>
|
||||
<li><code>s-status-error</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
<mct-example><div class="s-ue-bottom-bar status-holder s-status-bar">
|
||||
<span class="ls-indicator icon-database s-status-disabled" title="The system is currently disabled.">
|
||||
<span class="label">System not enabled.</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="s-ue-bottom-bar status-holder s-status-bar">
|
||||
<span class="ls-indicator icon-database s-status-available" title="Configure data connection.">
|
||||
<span class="label">Data connection available
|
||||
<a class="icon-gear">Configure</a>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="s-ue-bottom-bar status-holder s-status-bar">
|
||||
<span class="ls-indicator icon-database s-status-on" title="Data connected.">
|
||||
<span class="label">Connected to Skynet
|
||||
<a class="icon-gear">Change</a>
|
||||
<a>Disconnect</a>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="s-ue-bottom-bar status-holder s-status-bar">
|
||||
<span class="ls-indicator icon-database s-status-alert" title="System is self-aware.">
|
||||
<span class="label">Skynet at Turing Level 5</span>
|
||||
</span>
|
||||
<span class="ls-indicator icon-bell s-status-error" title="You have alerts.">
|
||||
<span class="label">
|
||||
<a class="icon-alert-triangle">View Alerts</a>
|
||||
</span>
|
||||
<span class="count">495</span>
|
||||
</span>
|
||||
</div>
|
||||
</mct-example>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -54,7 +54,7 @@ define(
|
||||
return "icon-object-unknown";
|
||||
},
|
||||
getText: function () {
|
||||
return latest;
|
||||
return "" + latest;
|
||||
},
|
||||
getDescription: function () {
|
||||
return "";
|
||||
|
@ -69,9 +69,11 @@
|
||||
]
|
||||
}));
|
||||
openmct.install(openmct.plugins.SummaryWidget());
|
||||
openmct.install(openmct.plugins.Notebook());
|
||||
openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0});
|
||||
openmct.time.timeSystem('utc');
|
||||
openmct.start();
|
||||
window.openmct = openmct;
|
||||
});
|
||||
</script>
|
||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
|
||||
|
@ -37,7 +37,10 @@ module.exports = function(config) {
|
||||
{pattern: 'bower_components/**/*.js', included: false},
|
||||
{pattern: 'node_modules/d3-*/**/*.js', included: false},
|
||||
{pattern: 'node_modules/vue/**/*.js', included: false},
|
||||
{pattern: 'node_modules/printj/dist/*.js', included: false},
|
||||
{pattern: 'src/**/*', included: false},
|
||||
{pattern: 'node_modules/painterro/build/*.js', included: false},
|
||||
{pattern: 'node_modules/html2canvas/dist/*', included: false},
|
||||
{pattern: 'example/**/*.html', included: false},
|
||||
{pattern: 'example/**/*.js', included: false},
|
||||
{pattern: 'example/**/*.json', included: false},
|
||||
@ -62,7 +65,7 @@ module.exports = function(config) {
|
||||
// Test results reporter to use
|
||||
// Possible values: 'dots', 'progress'
|
||||
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress', 'coverage', 'html', 'junit'],
|
||||
reporters: ['progress', 'coverage', 'html'],
|
||||
|
||||
// Web server port.
|
||||
port: 9876,
|
||||
@ -78,7 +81,7 @@ module.exports = function(config) {
|
||||
// Specify browsers to run tests in.
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: [
|
||||
'Chrome'
|
||||
'ChromeHeadless'
|
||||
],
|
||||
|
||||
// Code coverage reporting.
|
||||
@ -101,10 +104,6 @@ module.exports = function(config) {
|
||||
foldAll: false
|
||||
},
|
||||
|
||||
junitReporter: {
|
||||
outputDir: process.env.CIRCLE_TEST_REPORTS || 'dist/reports/junit'
|
||||
},
|
||||
|
||||
// Continuous Integration mode.
|
||||
// If true, Karma captures browsers, runs the tests and exits.
|
||||
singleRun: true
|
||||
|
15
openmct.js
15
openmct.js
@ -29,7 +29,6 @@ requirejs.config({
|
||||
"csv": "bower_components/comma-separated-values/csv.min",
|
||||
"EventEmitter": "bower_components/eventemitter3/index",
|
||||
"es6-promise": "bower_components/es6-promise/es6-promise.min",
|
||||
"html2canvas": "bower_components/html2canvas/build/html2canvas.min",
|
||||
"moment": "bower_components/moment/moment",
|
||||
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
|
||||
"moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data",
|
||||
@ -49,7 +48,10 @@ requirejs.config({
|
||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min"
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||
"html2canvas": "node_modules/html2canvas/dist/html2canvas.min",
|
||||
"painterro": "node_modules/painterro/build/painterro.min",
|
||||
"printj": "node_modules/printj/dist/printj.min"
|
||||
},
|
||||
"shim": {
|
||||
"angular": {
|
||||
@ -61,12 +63,12 @@ requirejs.config({
|
||||
"EventEmitter": {
|
||||
"exports": "EventEmitter"
|
||||
},
|
||||
"html2canvas": {
|
||||
"exports": "html2canvas"
|
||||
},
|
||||
"moment-duration-format": {
|
||||
"deps": ["moment"]
|
||||
},
|
||||
"painterro": {
|
||||
"exports": "Painterro"
|
||||
},
|
||||
"saveAs": {
|
||||
"exports": "saveAs"
|
||||
},
|
||||
@ -88,6 +90,9 @@ requirejs.config({
|
||||
},
|
||||
"d3-axis": {
|
||||
"exports": "d3-axis"
|
||||
},
|
||||
"dom-to-image": {
|
||||
"exports": "domtoimage"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
20
package.json
20
package.json
@ -15,6 +15,7 @@
|
||||
"d3-time-format": "2.1.x",
|
||||
"express": "^4.13.1",
|
||||
"minimist": "^1.1.1",
|
||||
"painterro": "^0.2.65",
|
||||
"request": "^2.69.0",
|
||||
"vue": "^2.5.6"
|
||||
},
|
||||
@ -30,18 +31,18 @@
|
||||
"gulp-requirejs-optimize": "^0.3.1",
|
||||
"gulp-sass": "^3.1.0",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"jasmine-core": "^2.3.0",
|
||||
"html2canvas": "^1.0.0-alpha.12",
|
||||
"jasmine-core": "^3.1.0",
|
||||
"jscs-html-reporter": "^0.1.0",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.7.0",
|
||||
"karma": "^0.13.3",
|
||||
"karma-chrome-launcher": "^0.1.12",
|
||||
"karma-cli": "0.0.4",
|
||||
"karma-coverage": "^0.5.3",
|
||||
"karma": "^2.0.3",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-coverage": "^1.1.2",
|
||||
"karma-html-reporter": "^0.2.7",
|
||||
"karma-jasmine": "^0.1.5",
|
||||
"karma-junit-reporter": "^0.3.8",
|
||||
"karma-requirejs": "^0.2.2",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-requirejs": "^1.1.0",
|
||||
"lodash": "^3.10.1",
|
||||
"markdown-toc": "^0.11.7",
|
||||
"marked": "^0.3.5",
|
||||
@ -49,6 +50,7 @@
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.11.1",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"printj": "^1.1.0",
|
||||
"requirejs": "2.1.x",
|
||||
"split": "^1.0.0",
|
||||
"v8-compile-cache": "^1.1.0"
|
||||
@ -57,6 +59,8 @@
|
||||
"start": "node app.js",
|
||||
"test": "karma start --single-run",
|
||||
"jshint": "jshint platform example",
|
||||
"lint": "./node_modules/gulp/bin/gulp.js lint",
|
||||
"checkstyle": "./node_modules/gulp/bin/gulp.js checkstyle",
|
||||
"watch": "karma start",
|
||||
"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'",
|
||||
|
@ -65,7 +65,7 @@
|
||||
<div class='split-pane-component t-object pane primary-pane left'>
|
||||
<mct-representation mct-object="navigatedObject"
|
||||
key="navigatedObject.getCapability('status').get('editing') ? 'edit-object' : 'browse-object'"
|
||||
class="abs holder holder-object">
|
||||
class="abs holder holder-object t-main-view">
|
||||
</mct-representation>
|
||||
<a class="mini-tab-icon anchor-right mobile-hide toggle-pane toggle-inspect flush-right"
|
||||
title="{{ modelPaneInspect.visible()? 'Hide' : 'Show' }} the Inspection pane"
|
||||
|
@ -19,41 +19,46 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div ng-controller="ObjectInspectorController as controller">
|
||||
<ul class="flex-elem grows l-inspector-part">
|
||||
<li>
|
||||
<em class="t-inspector-part-header">Properties</em>
|
||||
<div class="inspector-properties"
|
||||
ng-repeat="data in metadata"
|
||||
ng-class="{ first:$index === 0 }">
|
||||
<div class="label">{{ data.name }}</div>
|
||||
<div class="value">{{ data.value }}</div>
|
||||
<div ng-controller="ObjectInspectorController as controller" class="grid-properties">
|
||||
<ul class="l-inspector-part">
|
||||
<h2 class="first">Properties</h2>
|
||||
<li class="t-repeat grid-row"
|
||||
ng-repeat="data in metadata"
|
||||
ng-class="{ first:$index === 0 }">
|
||||
<div class="grid-cell label">{{ data.name }}</div>
|
||||
<div class="grid-cell value">{{ data.value }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="l-inspector-part" ng-if="contextutalParents.length > 0">
|
||||
<h2 title="The location of this linked object.">Location</h2>
|
||||
<li class="grid-row">
|
||||
<div class="label" ng-if="primaryParents.length > 0">This Link</div>
|
||||
<div class="grid-cell value">
|
||||
<div class="t-repeat inspector-location"
|
||||
ng-repeat="parent in contextutalParents"
|
||||
ng-class="{ last:($index + 1) === contextualParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-click="parent.getCapability('action').perform('navigate')"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li ng-if="contextutalParents.length > 0">
|
||||
<em class="t-inspector-part-header" title="The location of this linked object.">Location</em>
|
||||
<div ng-if="primaryParents.length > 0" class="section-header">This Object</div>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in contextutalParents"
|
||||
ng-class="{ last:($index + 1) === contextualParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-click="parent.getCapability('action').perform('navigate')"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-if="primaryParents.length > 0">
|
||||
<div class="section-header">Object's Original</div>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in primaryParents"
|
||||
ng-class="{ last:($index + 1) === primaryParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-click="parent.getCapability('action').perform('navigate')"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
<li class="grid-row" ng-if="primaryParents.length > 0">
|
||||
<div class="grid-cell label">Original</div>
|
||||
<div class="grid-cell value">
|
||||
<div class="t-repeat inspector-location value"
|
||||
ng-repeat="parent in primaryParents"
|
||||
ng-class="{ last:($index + 1) === primaryParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-click="parent.getCapability('action').perform('navigate')"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -47,8 +47,8 @@ define(
|
||||
urlService,
|
||||
defaultPath
|
||||
) {
|
||||
var initialPath = ($route.current.params.ids || defaultPath).split("/");
|
||||
var currentIds;
|
||||
var initialPath = ($route.current.params.ids || defaultPath).split("/"),
|
||||
currentIds;
|
||||
|
||||
$scope.treeModel = {
|
||||
selectedObject: undefined,
|
||||
@ -56,7 +56,24 @@ define(
|
||||
navigationService.setNavigation(object, true);
|
||||
},
|
||||
allowSelection: function (object) {
|
||||
return navigationService.shouldNavigate();
|
||||
var domainObjectInView = navigationService.getNavigation(),
|
||||
isInEditMode = domainObjectInView.getCapability('status').get('editing');
|
||||
|
||||
if (isInEditMode) {
|
||||
|
||||
var actions = object.getCapability('action'),
|
||||
previewAction = actions.getActions({key: 'mct-preview-action'})[0];
|
||||
|
||||
if (previewAction && previewAction.perform) {
|
||||
previewAction.perform();
|
||||
return false;
|
||||
} else {
|
||||
return navigationService.shouldNavigate();
|
||||
}
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -162,7 +162,6 @@ define(
|
||||
*/
|
||||
NavigationService.prototype.shouldWarnBeforeNavigate = function () {
|
||||
var reasons = [];
|
||||
|
||||
this.checks.forEach(function (checkFn) {
|
||||
var reason = checkFn();
|
||||
if (reason) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global console*/
|
||||
|
||||
/**
|
||||
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
||||
@ -48,9 +49,19 @@ define(
|
||||
controller;
|
||||
|
||||
function waitsForNavigation() {
|
||||
var calls = mockNavigationService.setNavigation.calls.length;
|
||||
waitsFor(function () {
|
||||
return mockNavigationService.setNavigation.calls.length > calls;
|
||||
return new Promise(function (resolve) {
|
||||
mockNavigationService.setNavigation.and.callFake(function (obj) {
|
||||
var returnValue;
|
||||
try {
|
||||
returnValue = NavigationService.prototype.setNavigation.call(mockNavigationService, obj);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
//Not rejecting because 'setNavigation' has been called, which is what's being tested here.
|
||||
//Rejecting will fail tests.
|
||||
}
|
||||
resolve();
|
||||
return returnValue;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -78,7 +89,7 @@ define(
|
||||
"urlService",
|
||||
["urlForLocation"]
|
||||
);
|
||||
mockUrlService.urlForLocation.andCallFake(function (mode, object) {
|
||||
mockUrlService.urlForLocation.and.callFake(function (mode, object) {
|
||||
if (object === mockDefaultRootObject) {
|
||||
return [mode, testDefaultRoot].join('/');
|
||||
}
|
||||
@ -106,7 +117,7 @@ define(
|
||||
"removeListener"
|
||||
].forEach(function (method) {
|
||||
spyOn(mockNavigationService, method)
|
||||
.andCallThrough();
|
||||
.and.callThrough();
|
||||
});
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"rootObjectContainer",
|
||||
@ -124,60 +135,58 @@ define(
|
||||
"nestedDomainObject",
|
||||
["getId", "getCapability", "getModel", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockObjectService.getObjects.andReturn(Promise.resolve({
|
||||
mockObjectService.getObjects.and.returnValue(Promise.resolve({
|
||||
ROOT: mockRootObject
|
||||
}));
|
||||
mockRootObject.useCapability.andReturn(Promise.resolve([
|
||||
mockRootObject.useCapability.and.returnValue(Promise.resolve([
|
||||
mockOtherDomainObject,
|
||||
mockDefaultRootObject
|
||||
]));
|
||||
mockRootObject.hasCapability.andReturn(true);
|
||||
mockDefaultRootObject.useCapability.andReturn(Promise.resolve([
|
||||
mockRootObject.hasCapability.and.returnValue(true);
|
||||
mockDefaultRootObject.useCapability.and.returnValue(Promise.resolve([
|
||||
mockNextObject
|
||||
]));
|
||||
mockDefaultRootObject.hasCapability.andReturn(true);
|
||||
mockOtherDomainObject.hasCapability.andReturn(false);
|
||||
mockNextObject.useCapability.andReturn(undefined);
|
||||
mockNextObject.hasCapability.andReturn(false);
|
||||
mockNextObject.getId.andReturn("next");
|
||||
mockDefaultRootObject.getId.andReturn(testDefaultRoot);
|
||||
mockDefaultRootObject.hasCapability.and.returnValue(true);
|
||||
mockOtherDomainObject.hasCapability.and.returnValue(false);
|
||||
mockNextObject.useCapability.and.returnValue(undefined);
|
||||
mockNextObject.hasCapability.and.returnValue(false);
|
||||
mockNextObject.getId.and.returnValue("next");
|
||||
mockDefaultRootObject.getId.and.returnValue(testDefaultRoot);
|
||||
|
||||
instantiateController();
|
||||
waitsForNavigation();
|
||||
return waitsForNavigation();
|
||||
});
|
||||
|
||||
it("uses composition to set the navigated object, if there is none", function () {
|
||||
instantiateController();
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("navigates to a root-level object, even when default path is not found", function () {
|
||||
mockDefaultRootObject.getId
|
||||
.andReturn("something-other-than-the-" + testDefaultRoot);
|
||||
.and.returnValue("something-other-than-the-" + testDefaultRoot);
|
||||
instantiateController();
|
||||
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
//
|
||||
it("does not try to override navigation", function () {
|
||||
mockNavigationService.getNavigation.andReturn(mockDefaultRootObject);
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDefaultRootObject);
|
||||
instantiateController();
|
||||
waitsForNavigation();
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
});
|
||||
});
|
||||
//
|
||||
|
||||
it("updates scope when navigated object changes", function () {
|
||||
// Should have registered a listener - call it
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](
|
||||
mockOtherDomainObject
|
||||
);
|
||||
expect(mockScope.navigatedObject).toEqual(mockOtherDomainObject);
|
||||
@ -189,19 +198,18 @@ define(
|
||||
"$destroy",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
mockScope.$on.mostRecentCall.args[1]();
|
||||
mockScope.$on.calls.mostRecent().args[1]();
|
||||
|
||||
// Should remove the listener it added earlier
|
||||
expect(mockNavigationService.removeListener).toHaveBeenCalledWith(
|
||||
mockNavigationService.addListener.mostRecentCall.args[0]
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0]
|
||||
);
|
||||
});
|
||||
|
||||
it("uses route parameters to choose initially-navigated object", function () {
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/next";
|
||||
instantiateController();
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockNextObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockNextObject);
|
||||
@ -214,12 +222,10 @@ define(
|
||||
// it hits an invalid ID.
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/junk";
|
||||
instantiateController();
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockDefaultRootObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDefaultRootObject);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -229,8 +235,7 @@ define(
|
||||
// should stop at it since remaining IDs cannot be loaded.
|
||||
mockRoute.current.params.ids = testDefaultRoot + "/next/junk";
|
||||
instantiateController();
|
||||
waitsForNavigation();
|
||||
runs(function () {
|
||||
return waitsForNavigation().then(function () {
|
||||
expect(mockScope.navigatedObject).toBe(mockNextObject);
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockNextObject);
|
||||
@ -244,11 +249,11 @@ define(
|
||||
expect(mockRoute.current.pathParams.ids)
|
||||
.not
|
||||
.toBe(testDefaultRoot + '/next');
|
||||
mockLocation.path.andCallFake(function () {
|
||||
mockLocation.path.and.callFake(function () {
|
||||
expect(mockRoute.current.pathParams.ids)
|
||||
.toBe(testDefaultRoot + '/next');
|
||||
});
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](
|
||||
mockNextObject
|
||||
);
|
||||
expect(mockLocation.path).toHaveBeenCalledWith(
|
||||
|
@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define(
|
||||
["../src/BrowseObjectController"],
|
||||
function (BrowseObjectController) {
|
||||
@ -33,7 +32,7 @@ define(
|
||||
|
||||
// Utility function; look for a $watch on scope and fire it
|
||||
function fireWatch(expr, value) {
|
||||
mockScope.$watch.calls.forEach(function (call) {
|
||||
mockScope.$watch.calls.all().forEach(function (call) {
|
||||
if (call.args[0] === expr) {
|
||||
call.args[1](value);
|
||||
}
|
||||
@ -50,7 +49,7 @@ define(
|
||||
"$location",
|
||||
["path", "search"]
|
||||
);
|
||||
mockLocation.search.andReturn({});
|
||||
mockLocation.search.and.returnValue({});
|
||||
|
||||
controller = new BrowseObjectController(
|
||||
mockScope,
|
||||
@ -65,7 +64,7 @@ define(
|
||||
|
||||
// Allows the path index to be checked
|
||||
// prior to setting $route.current
|
||||
mockLocation.path.andReturn("/browse/");
|
||||
mockLocation.path.and.returnValue("/browse/");
|
||||
});
|
||||
|
||||
it("sets the active view from query parameters", function () {
|
||||
@ -79,10 +78,10 @@ define(
|
||||
{ key: 'xyz' }
|
||||
];
|
||||
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
mockDomainObject.useCapability.and.callFake(function (c) {
|
||||
return (c === 'view') && testViews;
|
||||
});
|
||||
mockLocation.search.andReturn({ view: 'def' });
|
||||
mockLocation.search.and.returnValue({ view: 'def' });
|
||||
|
||||
fireWatch('domainObject', mockDomainObject);
|
||||
expect(mockScope.representation.selected)
|
||||
|
@ -50,14 +50,14 @@ define(
|
||||
"navigationService",
|
||||
["getNavigation", "addListener"]
|
||||
);
|
||||
mockNavigationService.addListener.andReturn(mockNavigationUnlistener);
|
||||
mockNavigationService.addListener.and.returnValue(mockNavigationUnlistener);
|
||||
|
||||
mockStatusUnlistener = jasmine.createSpy("statusUnlistener");
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
"statusCapability",
|
||||
["listen"]
|
||||
);
|
||||
mockStatusCapability.listen.andReturn(mockStatusUnlistener);
|
||||
mockStatusCapability.listen.and.returnValue(mockStatusUnlistener);
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
@ -68,13 +68,13 @@ define(
|
||||
'hasCapability'
|
||||
]
|
||||
);
|
||||
mockDomainObject.getId.andReturn("domainObject");
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andReturn(mockStatusCapability);
|
||||
mockDomainObject.getId.and.returnValue("domainObject");
|
||||
mockDomainObject.getModel.and.returnValue({});
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.getCapability.and.returnValue(mockStatusCapability);
|
||||
|
||||
mockLocation = jasmine.createSpyObj('location', ['search']);
|
||||
mockLocation.search.andReturn({});
|
||||
mockLocation.search.and.returnValue({});
|
||||
|
||||
mockAttrs = {};
|
||||
|
||||
@ -84,7 +84,7 @@ define(
|
||||
it("listens for changes to navigation and attaches a status" +
|
||||
" listener", function () {
|
||||
expect(mockNavigationService.addListener).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](mockDomainObject);
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](mockDomainObject);
|
||||
expect(mockStatusCapability.listen).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
@ -93,8 +93,8 @@ define(
|
||||
controller.toggle();
|
||||
// test pre-condition that inspector is hidden
|
||||
expect(controller.visible()).toBe(false);
|
||||
mockNavigationService.addListener.mostRecentCall.args[0](mockDomainObject);
|
||||
mockStatusCapability.listen.mostRecentCall.args[0](["editing"]);
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0](mockDomainObject);
|
||||
mockStatusCapability.listen.calls.mostRecent().args[0](["editing"]);
|
||||
expect(controller.visible()).toBe(true);
|
||||
});
|
||||
|
||||
|
@ -60,8 +60,8 @@ define(
|
||||
mockActionContext.domainObject = mockDomainObject;
|
||||
mockActionContext.event = mockEvent;
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
mockDomainObject.getCapability.andReturn(mockContextMenuAction);
|
||||
mockContextMenuAction.perform.andReturn(jasmine.any(Function));
|
||||
mockDomainObject.getCapability.and.returnValue(mockContextMenuAction);
|
||||
mockContextMenuAction.perform.and.returnValue(jasmine.any(Function));
|
||||
|
||||
controller = new MenuArrowController(mockScope);
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ define(
|
||||
mockMutationCapability = jasmine.createSpyObj("mutation", ["mutate"]);
|
||||
mockTypeCapability = jasmine.createSpyObj("type", ["typeDef", "hasFeature"]);
|
||||
mockTypeCapability.typeDef = { name: ""};
|
||||
mockTypeCapability.hasFeature.andCallFake(function (feature) {
|
||||
mockTypeCapability.hasFeature.and.callFake(function (feature) {
|
||||
return feature === 'creation';
|
||||
});
|
||||
|
||||
@ -52,8 +52,8 @@ define(
|
||||
name: "Test name"
|
||||
};
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", ["getCapability", "getModel"]);
|
||||
mockDomainObject.getModel.andReturn(model);
|
||||
mockDomainObject.getCapability.andCallFake(function (key) {
|
||||
mockDomainObject.getModel.and.returnValue(model);
|
||||
mockDomainObject.getCapability.and.callFake(function (key) {
|
||||
return mockCapabilities[key];
|
||||
});
|
||||
|
||||
@ -62,7 +62,7 @@ define(
|
||||
};
|
||||
|
||||
mockCurrentTarget = jasmine.createSpyObj("currentTarget", ["blur", "textContent"]);
|
||||
mockCurrentTarget.blur.andReturn(mockCurrentTarget);
|
||||
mockCurrentTarget.blur.and.returnValue(mockCurrentTarget);
|
||||
|
||||
mockEvent = {
|
||||
which: {},
|
||||
@ -109,7 +109,7 @@ define(
|
||||
|
||||
expect(mockMutationCapability.mutate).toHaveBeenCalledWith(jasmine.any(Function));
|
||||
|
||||
mockMutationCapability.mutate.mostRecentCall.args[0](model);
|
||||
mockMutationCapability.mutate.calls.mostRecent().args[0](model);
|
||||
|
||||
expect(mockDomainObject.getModel().name).toBe("New name");
|
||||
});
|
||||
@ -127,7 +127,7 @@ define(
|
||||
});
|
||||
|
||||
it("disallows editting name when object is non-creatable", function () {
|
||||
mockTypeCapability.hasFeature.andReturn(false);
|
||||
mockTypeCapability.hasFeature.and.returnValue(false);
|
||||
|
||||
expect(controller.allowEdit()).toBe(false);
|
||||
|
||||
|
@ -53,8 +53,8 @@ define(
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.getId.and.returnValue(id);
|
||||
mockDomainObject.getModel.and.returnValue({});
|
||||
|
||||
return mockDomainObject;
|
||||
});
|
||||
@ -65,7 +65,7 @@ define(
|
||||
mockWindow = jasmine.createSpyObj("$window", ["open"]);
|
||||
|
||||
mockLocation = jasmine.createSpyObj('location', ['search']);
|
||||
mockLocation.search.andReturn({});
|
||||
mockLocation.search.and.returnValue({});
|
||||
|
||||
mockAttrs = {};
|
||||
});
|
||||
@ -83,9 +83,9 @@ define(
|
||||
});
|
||||
|
||||
it("collapses on navigation changes on portrait-oriented phones", function () {
|
||||
mockAgentService.isMobile.andReturn(true);
|
||||
mockAgentService.isPhone.andReturn(true);
|
||||
mockAgentService.isPortrait.andReturn(true);
|
||||
mockAgentService.isMobile.and.returnValue(true);
|
||||
mockAgentService.isPhone.and.returnValue(true);
|
||||
mockAgentService.isPortrait.and.returnValue(true);
|
||||
controller = instantiateController();
|
||||
expect(controller.visible()).toBeTruthy();
|
||||
|
||||
@ -102,13 +102,13 @@ define(
|
||||
});
|
||||
|
||||
it("sets pane state to false when in location.search", function () {
|
||||
mockLocation.search.andReturn({'hideTree': true});
|
||||
mockLocation.search.and.returnValue({'hideTree': true});
|
||||
expect(instantiateController().visible()).toBe(false);
|
||||
expect(mockLocation.search).toHaveBeenCalledWith('hideTree', undefined);
|
||||
});
|
||||
|
||||
it("sets state to true when not found in location.search", function () {
|
||||
mockLocation.search.andReturn({});
|
||||
mockLocation.search.and.returnValue({});
|
||||
expect(instantiateController().visible()).toBe(true);
|
||||
expect(mockLocation.search).not.toHaveBeenCalledWith('hideTree', undefined);
|
||||
});
|
||||
|
@ -34,17 +34,6 @@ define([
|
||||
mockDomainObject,
|
||||
action;
|
||||
|
||||
|
||||
function waitForCall() {
|
||||
var called = false;
|
||||
waitsFor(function () {
|
||||
return called;
|
||||
});
|
||||
return function () {
|
||||
called = true;
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
@ -63,26 +52,24 @@ define([
|
||||
});
|
||||
|
||||
it("sets navigation if it is allowed", function () {
|
||||
mockNavigationService.shouldNavigate.andReturn(true);
|
||||
action.perform()
|
||||
.then(waitForCall());
|
||||
runs(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
mockNavigationService.shouldNavigate.and.returnValue(true);
|
||||
return action.perform()
|
||||
.then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.toHaveBeenCalledWith(mockDomainObject, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("does not set navigation if it is not allowed", function () {
|
||||
mockNavigationService.shouldNavigate.andReturn(false);
|
||||
mockNavigationService.shouldNavigate.and.returnValue(false);
|
||||
var onSuccess = jasmine.createSpy('onSuccess');
|
||||
action.perform()
|
||||
.then(onSuccess, waitForCall());
|
||||
runs(function () {
|
||||
expect(onSuccess).not.toHaveBeenCalled();
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.not
|
||||
.toHaveBeenCalledWith(mockDomainObject);
|
||||
});
|
||||
return action.perform()
|
||||
.then(onSuccess, function () {
|
||||
expect(onSuccess).not.toHaveBeenCalled();
|
||||
expect(mockNavigationService.setNavigation)
|
||||
.not
|
||||
.toHaveBeenCalledWith(mockDomainObject);
|
||||
});
|
||||
});
|
||||
|
||||
it("is only applicable when a domain object is in context", function () {
|
||||
|
@ -69,7 +69,7 @@ define(
|
||||
navigationService.addListener(callback);
|
||||
navigationService.setNavigation(testObject);
|
||||
navigationService.setNavigation(testObject);
|
||||
expect(callback.calls.length).toEqual(1);
|
||||
expect(callback.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it("stops notifying listeners after removal", function () {
|
||||
|
@ -65,34 +65,35 @@ define([
|
||||
mockActionCapability = jasmine.createSpyObj('action', ['perform']);
|
||||
mockEditor = jasmine.createSpyObj('editor', ['isEditContextRoot']);
|
||||
|
||||
mockThrottle.andCallFake(function (fn) {
|
||||
mockThrottle.and.callFake(function (fn) {
|
||||
var mockThrottledFn =
|
||||
jasmine.createSpy('throttled-' + mockThrottledFns.length);
|
||||
mockThrottledFn.andCallFake(fn);
|
||||
mockThrottledFn.and.callFake(fn);
|
||||
mockThrottledFns.push(mockThrottledFn);
|
||||
return mockThrottledFn;
|
||||
});
|
||||
mockTopic.andReturn(mockMutationTopic);
|
||||
mockDomainObject.getId.andReturn(testId);
|
||||
mockDomainObject.getCapability.andCallFake(function (c) {
|
||||
mockTopic.and.returnValue(mockMutationTopic);
|
||||
mockDomainObject.getId.and.returnValue(testId);
|
||||
mockDomainObject.getCapability.and.callFake(function (c) {
|
||||
return {
|
||||
context: mockContext,
|
||||
editor: mockEditor
|
||||
}[c];
|
||||
});
|
||||
mockDomainObject.hasCapability.andCallFake(function (c) {
|
||||
mockDomainObject.hasCapability.and.callFake(function (c) {
|
||||
return !!mockDomainObject.getCapability(c);
|
||||
});
|
||||
mockParentObject.getCapability.andCallFake(function (c) {
|
||||
mockParentObject.getCapability.and.callFake(function (c) {
|
||||
return {
|
||||
action: mockActionCapability
|
||||
}[c];
|
||||
});
|
||||
testParentComposition = [];
|
||||
mockParentObject.useCapability.andReturn(Promise.resolve(testParentComposition));
|
||||
mockContext.getParent.andReturn(mockParentObject);
|
||||
mockNavigationService.getNavigation.andReturn(mockDomainObject);
|
||||
mockEditor.isEditContextRoot.andReturn(false);
|
||||
mockParentObject.useCapability.and.returnValue(Promise.resolve(testParentComposition));
|
||||
|
||||
mockContext.getParent.and.returnValue(mockParentObject);
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
mockEditor.isEditContextRoot.and.returnValue(false);
|
||||
|
||||
return new OrphanNavigationHandler(
|
||||
mockThrottle,
|
||||
@ -106,7 +107,7 @@ define([
|
||||
expect(mockMutationTopic.listen)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
expect(mockThrottledFns.indexOf(
|
||||
mockMutationTopic.listen.mostRecentCall.args[0]
|
||||
mockMutationTopic.listen.calls.mostRecent().args[0]
|
||||
)).not.toEqual(-1);
|
||||
});
|
||||
|
||||
@ -114,7 +115,7 @@ define([
|
||||
expect(mockNavigationService.addListener)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
expect(mockThrottledFns.indexOf(
|
||||
mockNavigationService.addListener.mostRecentCall.args[0]
|
||||
mockNavigationService.addListener.calls.mostRecent().args[0]
|
||||
)).not.toEqual(-1);
|
||||
});
|
||||
|
||||
@ -134,28 +135,14 @@ define([
|
||||
function itNavigatesAsExpected() {
|
||||
if (isOrphan && !isEditRoot) {
|
||||
it("navigates to the parent", function () {
|
||||
var done = false;
|
||||
waitsFor(function () {
|
||||
return done;
|
||||
});
|
||||
setTimeout(function () {
|
||||
done = true;
|
||||
}, 5);
|
||||
runs(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
expect(mockActionCapability.perform)
|
||||
.toHaveBeenCalledWith('navigate');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
it("does nothing", function () {
|
||||
var done = false;
|
||||
waitsFor(function () {
|
||||
return done;
|
||||
});
|
||||
setTimeout(function () {
|
||||
done = true;
|
||||
}, 5);
|
||||
runs(function () {
|
||||
return Promise.resolve().then(function () {
|
||||
expect(mockActionCapability.perform)
|
||||
.not.toHaveBeenCalled();
|
||||
});
|
||||
@ -165,12 +152,12 @@ define([
|
||||
|
||||
describe(caseName, function () {
|
||||
beforeEach(function () {
|
||||
mockEditor.isEditContextRoot.andReturn(isEditRoot);
|
||||
mockEditor.isEditContextRoot.and.returnValue(isEditRoot);
|
||||
});
|
||||
|
||||
describe("when navigation changes", function () {
|
||||
beforeEach(function () {
|
||||
mockNavigationService.addListener.mostRecentCall
|
||||
mockNavigationService.addListener.calls.mostRecent()
|
||||
.args[0](mockDomainObject);
|
||||
});
|
||||
itNavigatesAsExpected();
|
||||
@ -178,7 +165,7 @@ define([
|
||||
|
||||
describe("when mutation occurs", function () {
|
||||
beforeEach(function () {
|
||||
mockMutationTopic.listen.mostRecentCall
|
||||
mockMutationTopic.listen.calls.mostRecent()
|
||||
.args[0](mockParentObject);
|
||||
});
|
||||
|
||||
|
@ -49,8 +49,8 @@ define(
|
||||
);
|
||||
mockDocument = [{}];
|
||||
|
||||
mockDomainObject.getModel.andReturn({ name: 'Test name' });
|
||||
mockNavigationService.getNavigation.andReturn(mockDomainObject);
|
||||
mockDomainObject.getModel.and.returnValue({ name: 'Test name' });
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
|
||||
titler = new WindowTitler(
|
||||
mockNavigationService,
|
||||
@ -64,12 +64,12 @@ define(
|
||||
jasmine.any(Function),
|
||||
jasmine.any(Function)
|
||||
);
|
||||
expect(mockRootScope.$watch.mostRecentCall.args[0]())
|
||||
expect(mockRootScope.$watch.calls.mostRecent().args[0]())
|
||||
.toEqual('Test name');
|
||||
});
|
||||
|
||||
it("sets the title to the name of the navigated object", function () {
|
||||
mockRootScope.$watch.mostRecentCall.args[1]("Some name");
|
||||
mockRootScope.$watch.calls.mostRecent().args[1]("Some name");
|
||||
expect(mockDocument[0].title).toEqual("Some name");
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,10 @@
|
||||
<div class="top-bar">
|
||||
<div class="title">{{ngModel.title}}</div>
|
||||
</div>
|
||||
<div class="hint" ng-hide="ngModel.hint === undefined">{{ngModel.hint}}</div>
|
||||
<div class="hint" ng-hide="ngModel.hint === undefined">
|
||||
{{ngModel.hint}}
|
||||
<span ng-if="ngModel.timestamp !== undefined">[{{ngModel.timestamp}}]</span>
|
||||
</div>
|
||||
<div class="message-body">
|
||||
<div class="message-action">
|
||||
{{ngModel.actionText}}
|
||||
|
@ -63,12 +63,12 @@ define(
|
||||
["find"]
|
||||
);
|
||||
mockBody = jasmine.createSpyObj('body', ['on', 'off']);
|
||||
mockDocument.find.andReturn(mockBody);
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
|
||||
mockDeferred.promise = "mock promise";
|
||||
|
||||
mockQ.defer.andReturn(mockDeferred);
|
||||
mockOverlayService.createOverlay.andReturn(mockOverlay);
|
||||
mockQ.defer.and.returnValue(mockDeferred);
|
||||
mockOverlayService.createOverlay.and.returnValue(mockOverlay);
|
||||
|
||||
dialogService = new DialogService(
|
||||
mockOverlayService,
|
||||
@ -85,7 +85,7 @@ define(
|
||||
|
||||
it("allows user input to be canceled", function () {
|
||||
dialogService.getUserInput({}, { someKey: "some value" });
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].cancel();
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].cancel();
|
||||
expect(mockDeferred.reject).toHaveBeenCalled();
|
||||
expect(mockDeferred.resolve).not.toHaveBeenCalled();
|
||||
});
|
||||
@ -93,7 +93,7 @@ define(
|
||||
it("passes back the result of user input when confirmed", function () {
|
||||
var value = { someKey: 42 };
|
||||
dialogService.getUserInput({}, value);
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].confirm();
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
expect(mockDeferred.resolve).toHaveBeenCalledWith(value);
|
||||
});
|
||||
@ -109,7 +109,7 @@ define(
|
||||
it("can show multiple dialogs if prior ones are dismissed", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].confirm();
|
||||
dialogService.getUserInput({}, {});
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
@ -148,13 +148,13 @@ define(
|
||||
|
||||
it("destroys the event listener when the dialog is cancelled", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].cancel();
|
||||
mockOverlayService.createOverlay.calls.mostRecent().args[1].cancel();
|
||||
expect(mockBody.off).toHaveBeenCalledWith("keydown", jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("cancels the dialog when an escape keydown event is triggered", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
mockBody.on.mostRecentCall.args[1]({
|
||||
mockBody.on.calls.mostRecent().args[1]({
|
||||
keyCode: 27
|
||||
});
|
||||
expect(mockDeferred.reject).toHaveBeenCalled();
|
||||
@ -163,7 +163,7 @@ define(
|
||||
|
||||
it("ignores non escape keydown events", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
mockBody.on.mostRecentCall.args[1]({
|
||||
mockBody.on.calls.mostRecent().args[1]({
|
||||
keyCode: 13
|
||||
});
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
@ -197,7 +197,7 @@ define(
|
||||
"overlay",
|
||||
["dismiss"]
|
||||
);
|
||||
mockOverlayService.createOverlay.andReturn(secondMockOverlay);
|
||||
mockOverlayService.createOverlay.and.returnValue(secondMockOverlay);
|
||||
secondDialogHandle = dialogService.showBlockingMessage(dialogModel);
|
||||
|
||||
//Dismiss the first dialog. It should only dismiss if it
|
||||
|
@ -46,10 +46,10 @@ define(
|
||||
mockElement = jasmine.createSpyObj("element", ["remove"]);
|
||||
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
|
||||
|
||||
mockDocument.find.andReturn(mockBody);
|
||||
mockCompile.andReturn(mockTemplate);
|
||||
mockRootScope.$new.andReturn(mockScope);
|
||||
mockTemplate.andReturn(mockElement);
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
mockCompile.and.returnValue(mockTemplate);
|
||||
mockRootScope.$new.and.returnValue(mockScope);
|
||||
mockTemplate.and.returnValue(mockElement);
|
||||
|
||||
overlayService = new OverlayService(
|
||||
mockDocument,
|
||||
@ -61,7 +61,7 @@ define(
|
||||
it("prepends an mct-include to create overlays", function () {
|
||||
overlayService.createOverlay("test", {});
|
||||
expect(mockCompile).toHaveBeenCalled();
|
||||
expect(mockCompile.mostRecentCall.args[0].indexOf("mct-include"))
|
||||
expect(mockCompile.calls.mostRecent().args[0].indexOf("mct-include"))
|
||||
.not.toEqual(-1);
|
||||
});
|
||||
|
||||
|
@ -33,13 +33,13 @@ define([
|
||||
"./src/actions/SaveAndStopEditingAction",
|
||||
"./src/actions/SaveAsAction",
|
||||
"./src/actions/CancelAction",
|
||||
"./src/actions/CreateNewFolderAction",
|
||||
"./src/policies/EditActionPolicy",
|
||||
"./src/policies/EditPersistableObjectsPolicy",
|
||||
"./src/policies/EditableLinkPolicy",
|
||||
"./src/policies/EditableMovePolicy",
|
||||
"./src/policies/EditContextualActionPolicy",
|
||||
"./src/representers/EditRepresenter",
|
||||
"./src/representers/EditToolbarRepresenter",
|
||||
"./src/capabilities/EditorCapability",
|
||||
"./src/capabilities/TransactionCapabilityDecorator",
|
||||
"./src/services/TransactionManager",
|
||||
@ -72,13 +72,13 @@ define([
|
||||
SaveAndStopEditingAction,
|
||||
SaveAsAction,
|
||||
CancelAction,
|
||||
CreateNewFolderAction,
|
||||
EditActionPolicy,
|
||||
EditPersistableObjectsPolicy,
|
||||
EditableLinkPolicy,
|
||||
EditableMovePolicy,
|
||||
EditContextualActionPolicy,
|
||||
EditRepresenter,
|
||||
EditToolbarRepresenter,
|
||||
EditorCapability,
|
||||
TransactionCapabilityDecorator,
|
||||
TransactionManager,
|
||||
@ -147,7 +147,10 @@ define([
|
||||
"depends": [
|
||||
"$scope",
|
||||
"$timeout",
|
||||
"objectService"
|
||||
"objectService",
|
||||
"typeService",
|
||||
"policyService",
|
||||
"instantiate"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -190,6 +193,7 @@ define([
|
||||
"name": "Remove",
|
||||
"description": "Remove this object from its containing object.",
|
||||
"depends": [
|
||||
"dialogService",
|
||||
"navigationService"
|
||||
]
|
||||
},
|
||||
@ -243,6 +247,14 @@ define([
|
||||
"cssClass": "icon-x no-label",
|
||||
"description": "Discard changes made to these objects.",
|
||||
"depends": []
|
||||
},
|
||||
{
|
||||
"key": "create-new-folder",
|
||||
"implementation": CreateNewFolderAction,
|
||||
"description": "Creates a new folder.",
|
||||
"depends": [
|
||||
"typeService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
@ -381,12 +393,6 @@ define([
|
||||
"depends": [
|
||||
"$log"
|
||||
]
|
||||
},
|
||||
{
|
||||
"implementation": EditToolbarRepresenter,
|
||||
"depends": [
|
||||
"openmct"
|
||||
]
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
@ -424,6 +430,17 @@ define([
|
||||
"transactionService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
depends: [
|
||||
"toolbars[]",
|
||||
"openmct"
|
||||
],
|
||||
implementation: function (toolbars, openmct) {
|
||||
toolbars.forEach(openmct.toolbars.addProvider, openmct.toolbars);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2009-2016, United States Government
|
||||
<!--span
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -19,19 +19,15 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<div class="l-title s-title">
|
||||
{{parameters.title}}
|
||||
</div>
|
||||
<div class="l-graph-area">
|
||||
<div class="l-labels-holder l-flex-col">
|
||||
<div class="t-resource-graph-tick-label tick-label-y flex-elem">
|
||||
{{parameters.high}}
|
||||
</div>
|
||||
<div class="t-resource-graph-tick-label tick-label-y flex-elem">
|
||||
{{parameters.middle}}
|
||||
</div>
|
||||
<div class="t-resource-graph-tick-label tick-label-y flex-elem">
|
||||
{{parameters.low}}
|
||||
</div>
|
||||
</div>
|
||||
<div name="newFolder" ng-controller="LocatorController">
|
||||
<div ng-if="!createNewFolder">
|
||||
<a class="s-button icon-folder-new" ng-click="createNewFolderClickHandler()" >
|
||||
<span class="title-label">New Folder</span>
|
||||
</a>
|
||||
</div>
|
||||
<div ng-if="createNewFolder">
|
||||
<span><input type="text" ng-model="newFolderName" name="newFolderName"></span>
|
||||
<a class="s-button" ng-click="createClickHandler()">Create</a>
|
||||
<a class="s-button icon-x" ng-click="cancelClickHandler()"></a>
|
||||
</div>
|
||||
</div>
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
@ -26,4 +26,22 @@
|
||||
ng-model="treeModel">
|
||||
</mct-representation>
|
||||
</div>
|
||||
|
||||
<!-- Create New Folder Action -->
|
||||
<div class="newFolderCreation" style="margin-top:10px; position:absolute; left:0px;">
|
||||
|
||||
<!-- New folder button, triggers create new folder action. -->
|
||||
<div ng-show="!newFolderCreationTriggered">
|
||||
<a class="s-button icon-folder-new" ng-class="{disabled: !validParent()}" ng-click="newFolderButtonClickHandler()">
|
||||
<span class="text-label">New Folder</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Get folder name -->
|
||||
<div ng-show="newFolderCreationTriggered">
|
||||
<input type="text" ng-model="newFolderNameInput">
|
||||
<a class="s-button" ng-class="{ disabled: !validParent() || !validFolderName() }" ng-click="newFolderCreateButtonClickHandler()">Create</a>
|
||||
<a class="s-button icon-x" ng-click="newFolderCancelButtonClickHandler()"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,7 +24,8 @@
|
||||
<div class="items-select left flex-elem l-flex-row grows">
|
||||
<mct-representation key="'back-arrow'"
|
||||
mct-object="domainObject"
|
||||
class="flex-elem l-back"></mct-representation>
|
||||
class="flex-elem l-back">
|
||||
</mct-representation>
|
||||
<mct-representation key="'object-header'"
|
||||
mct-object="domainObject"
|
||||
class="l-flex-row flex-elem grows object-header">
|
||||
@ -48,8 +49,8 @@
|
||||
<!-- Toolbar and Save/Cancel buttons -->
|
||||
<div class="l-edit-controls flex-elem l-flex-row flex-align-end">
|
||||
<mct-toolbar name="mctToolbar"
|
||||
structure="toolbar.structure"
|
||||
ng-model="toolbar.state"
|
||||
structure="editToolbar.structure"
|
||||
ng-model="editToolbar.state"
|
||||
class="flex-elem grows">
|
||||
</mct-toolbar>
|
||||
<mct-representation key="'edit-action-buttons'"
|
||||
@ -61,7 +62,6 @@
|
||||
<mct-representation key="representation.selected.key"
|
||||
mct-object="representation.selected.key && domainObject"
|
||||
class="abs flex-elem grows object-holder-main scroll"
|
||||
toolbar="toolbar"
|
||||
mct-selectable="{
|
||||
item: domainObject.useCapability('adapter'),
|
||||
oldItem: domainObject
|
||||
|
@ -24,7 +24,7 @@
|
||||
class="flex-elem holder"
|
||||
ng-model="filterBy">
|
||||
</mct-include>
|
||||
<div class="flex-elem grows vscroll">
|
||||
<div class="flex-elem grows vscroll scroll-pad">
|
||||
<ul class="tree" id="inspector-elements-tree"
|
||||
ng-if="composition.length > 0">
|
||||
<li ng-repeat="containedObject in composition | filter:searchElements">
|
||||
|
89
platform/commonUI/edit/src/actions/CreateNewFolderAction.js
Normal file
89
platform/commonUI/edit/src/actions/CreateNewFolderAction.js
Normal file
@ -0,0 +1,89 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define([
|
||||
|
||||
],
|
||||
function (
|
||||
|
||||
) {
|
||||
|
||||
/**
|
||||
* The CreateNewFolderAction; action is triggered by the new folder button in the locator.
|
||||
*
|
||||
* @constructor
|
||||
* @implements {Action}
|
||||
* @memberof platform/commonUI/edit
|
||||
*/
|
||||
function CreateNewFolderAction(
|
||||
typeService,
|
||||
context
|
||||
) {
|
||||
this.parent = (context || {}).domainObject;
|
||||
this.typeService = typeService;
|
||||
this.type = typeService.getType('folder');
|
||||
}
|
||||
|
||||
CreateNewFolderAction.prototype.perform = function (folderName) {
|
||||
var parent = this.parent,
|
||||
typeService = this.typeService,
|
||||
newModel = this.type.getInitialModel(),
|
||||
folderType = typeService.getType('folder');
|
||||
|
||||
newModel.type = folderType.getKey();
|
||||
newModel.name = folderName;
|
||||
|
||||
function instantiateObject() {
|
||||
var newObject = parent.useCapability('instantiation', newModel);
|
||||
newObject.useCapability('mutation', function () {
|
||||
newModel.location = parent.getId();
|
||||
});
|
||||
return addToParentAndReturn(newObject);
|
||||
}
|
||||
|
||||
function addToParentAndReturn(newObject) {
|
||||
return parent.getCapability('composition').add(newObject)
|
||||
.then(function () {
|
||||
return newObject;
|
||||
});
|
||||
}
|
||||
|
||||
return instantiateObject(newModel, parent);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this action is applicable in a given context.
|
||||
* This will ensure that a domain object is present in the context,
|
||||
* and that this domain object is in Edit mode.
|
||||
* @returns true if applicable
|
||||
*/
|
||||
CreateNewFolderAction.appliesTo = function (context) {
|
||||
var parent = (context || {}).domainObject;
|
||||
return parent && parent.hasCapability('editor');
|
||||
|
||||
};
|
||||
|
||||
return CreateNewFolderAction;
|
||||
}
|
||||
);
|
||||
|
@ -23,111 +23,119 @@
|
||||
/**
|
||||
* Module defining RemoveAction. Created by vwoeltje on 11/17/14.
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
define([
|
||||
'./RemoveDialog'
|
||||
], function (
|
||||
RemoveDialog
|
||||
) {
|
||||
|
||||
/**
|
||||
* Construct an action which will remove the provided object manifestation.
|
||||
* The object will be removed from its parent's composition; the parent
|
||||
* is looked up via the "context" capability (so this will be the
|
||||
* immediate ancestor by which this specific object was reached.)
|
||||
*
|
||||
* @param {DomainObject} object the object to be removed
|
||||
* @param {ActionContext} context the context in which this action is performed
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
* @implements {Action}
|
||||
/**
|
||||
* Construct an action which will remove the provided object manifestation.
|
||||
* The object will be removed from its parent's composition; the parent
|
||||
* is looked up via the "context" capability (so this will be the
|
||||
* immediate ancestor by which this specific object was reached.)
|
||||
*
|
||||
* @param {DialogService} dialogService a service which will show the dialog
|
||||
* @param {NavigationService} navigationService a service that maintains the current navigation state
|
||||
* @param {ActionContext} context the context in which this action is performed
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
* @implements {Action}
|
||||
*/
|
||||
function RemoveAction(dialogService, navigationService, context) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.dialogService = dialogService;
|
||||
this.navigationService = navigationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform this action.
|
||||
*/
|
||||
RemoveAction.prototype.perform = function () {
|
||||
var dialog,
|
||||
dialogService = this.dialogService,
|
||||
domainObject = this.domainObject,
|
||||
navigationService = this.navigationService;
|
||||
/*
|
||||
* Check whether an object ID matches the ID of the object being
|
||||
* removed (used to filter a parent's composition to handle the
|
||||
* removal.)
|
||||
*/
|
||||
function RemoveAction(navigationService, context) {
|
||||
this.domainObject = (context || {}).domainObject;
|
||||
this.navigationService = navigationService;
|
||||
function isNotObject(otherObjectId) {
|
||||
return otherObjectId !== domainObject.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform this action.
|
||||
* @return {Promise} a promise which will be
|
||||
* fulfilled when the action has completed.
|
||||
/*
|
||||
* Mutate a parent object such that it no longer contains the object
|
||||
* which is being removed.
|
||||
*/
|
||||
RemoveAction.prototype.perform = function () {
|
||||
var navigationService = this.navigationService,
|
||||
domainObject = this.domainObject;
|
||||
/*
|
||||
* Check whether an object ID matches the ID of the object being
|
||||
* removed (used to filter a parent's composition to handle the
|
||||
* removal.)
|
||||
*/
|
||||
function isNotObject(otherObjectId) {
|
||||
return otherObjectId !== domainObject.getId();
|
||||
}
|
||||
function doMutate(model) {
|
||||
model.composition = model.composition.filter(isNotObject);
|
||||
}
|
||||
|
||||
/*
|
||||
* Mutate a parent object such that it no longer contains the object
|
||||
* which is being removed.
|
||||
*/
|
||||
function doMutate(model) {
|
||||
model.composition = model.composition.filter(isNotObject);
|
||||
}
|
||||
/*
|
||||
* Checks current object and ascendants of current
|
||||
* object with object being removed, if the current
|
||||
* object or any in the current object's path is being removed,
|
||||
* navigate back to parent of removed object.
|
||||
*/
|
||||
function checkObjectNavigation(object, parentObject) {
|
||||
// Traverse object starts at current location
|
||||
var traverseObject = (navigationService).getNavigation(),
|
||||
context;
|
||||
|
||||
/*
|
||||
* Checks current object and ascendants of current
|
||||
* object with object being removed, if the current
|
||||
* object or any in the current object's path is being removed,
|
||||
* navigate back to parent of removed object.
|
||||
*/
|
||||
function checkObjectNavigation(object, parentObject) {
|
||||
// Traverse object starts at current location
|
||||
var traverseObject = (navigationService).getNavigation(),
|
||||
context;
|
||||
|
||||
// Stop when object is not defined (above ROOT)
|
||||
while (traverseObject) {
|
||||
// If object currently traversed to is object being removed
|
||||
// navigate to parent of current object and then exit loop
|
||||
if (traverseObject.getId() === object.getId()) {
|
||||
navigationService.setNavigation(parentObject);
|
||||
return;
|
||||
}
|
||||
// Traverses to parent of current object, moving
|
||||
// up the ascendant path
|
||||
context = traverseObject.getCapability('context');
|
||||
traverseObject = context && context.getParent();
|
||||
// Stop when object is not defined (above ROOT)
|
||||
while (traverseObject) {
|
||||
// If object currently traversed to is object being removed
|
||||
// navigate to parent of current object and then exit loop
|
||||
if (traverseObject.getId() === object.getId()) {
|
||||
navigationService.setNavigation(parentObject);
|
||||
return;
|
||||
}
|
||||
// Traverses to parent of current object, moving
|
||||
// up the ascendant path
|
||||
context = traverseObject.getCapability('context');
|
||||
traverseObject = context && context.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the object from its parent, as identified by its context
|
||||
* capability. Based on object's location and selected object's location
|
||||
* user may be navigated to existing parent object
|
||||
*/
|
||||
function removeFromContext(object) {
|
||||
var contextCapability = object.getCapability('context'),
|
||||
parent = contextCapability.getParent();
|
||||
/*
|
||||
* Remove the object from its parent, as identified by its context
|
||||
* capability. Based on object's location and selected object's location
|
||||
* user may be navigated to existing parent object
|
||||
*/
|
||||
function removeFromContext(object) {
|
||||
var contextCapability = object.getCapability('context'),
|
||||
parent = contextCapability.getParent();
|
||||
|
||||
// If currently within path of removed object(s),
|
||||
// navigates to existing object up tree
|
||||
checkObjectNavigation(object, parent);
|
||||
// If currently within path of removed object(s),
|
||||
// navigates to existing object up tree
|
||||
checkObjectNavigation(object, parent);
|
||||
|
||||
return parent.useCapability('mutation', doMutate);
|
||||
}
|
||||
return parent.useCapability('mutation', doMutate);
|
||||
}
|
||||
|
||||
return removeFromContext(domainObject);
|
||||
};
|
||||
/*
|
||||
* Pass in the function to remove the domain object so it can be
|
||||
* associated with an 'OK' button press
|
||||
*/
|
||||
dialog = new RemoveDialog(dialogService, domainObject, removeFromContext);
|
||||
dialog.show();
|
||||
};
|
||||
|
||||
// Object needs to have a parent for Remove to be applicable
|
||||
RemoveAction.appliesTo = function (context) {
|
||||
var object = (context || {}).domainObject,
|
||||
contextCapability = object && object.getCapability("context"),
|
||||
parent = contextCapability && contextCapability.getParent(),
|
||||
parentType = parent && parent.getCapability('type'),
|
||||
parentCreatable = parentType && parentType.hasFeature('creation');
|
||||
// Object needs to have a parent for Remove to be applicable
|
||||
RemoveAction.appliesTo = function (context) {
|
||||
var object = (context || {}).domainObject,
|
||||
contextCapability = object && object.getCapability("context"),
|
||||
parent = contextCapability && contextCapability.getParent(),
|
||||
parentType = parent && parent.getCapability('type'),
|
||||
parentCreatable = parentType && parentType.hasFeature('creation');
|
||||
|
||||
// Only creatable types should be modifiable
|
||||
return parent !== undefined &&
|
||||
Array.isArray(parent.getModel().composition) &&
|
||||
parentCreatable;
|
||||
};
|
||||
// Only creatable types should be modifiable
|
||||
return parent !== undefined &&
|
||||
Array.isArray(parent.getModel().composition) &&
|
||||
parentCreatable;
|
||||
};
|
||||
|
||||
return RemoveAction;
|
||||
}
|
||||
);
|
||||
return RemoveAction;
|
||||
});
|
||||
|
77
platform/commonUI/edit/src/actions/RemoveDialog.js
Normal file
77
platform/commonUI/edit/src/actions/RemoveDialog.js
Normal file
@ -0,0 +1,77 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define([], function () {
|
||||
|
||||
/**
|
||||
* @callback removeCallback
|
||||
* @param {DomainObject} domainObject the domain object to be removed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Construct a new Remove dialog.
|
||||
*
|
||||
* @param {DialogService} dialogService the service that shows the dialog
|
||||
* @param {DomainObject} domainObject the domain object to be removed
|
||||
* @param {removeCallback} removeCallback callback that handles removal of the domain object
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
*/
|
||||
function RemoveDialog(dialogService, domainObject, removeCallback) {
|
||||
this.dialogService = dialogService;
|
||||
this.domainObject = domainObject;
|
||||
this.removeCallback = removeCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a dialog to confirm the removal of a domain object.
|
||||
*/
|
||||
RemoveDialog.prototype.show = function () {
|
||||
var dialog,
|
||||
domainObject = this.domainObject,
|
||||
removeCallback = this.removeCallback,
|
||||
model = {
|
||||
title: 'Remove ' + domainObject.getModel().name,
|
||||
actionText: 'Warning! This action will permanently remove this object. Are you sure you want to continue?',
|
||||
severity: 'alert',
|
||||
primaryOption: {
|
||||
label: 'OK',
|
||||
callback: function () {
|
||||
removeCallback(domainObject);
|
||||
dialog.dismiss();
|
||||
}
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: 'Cancel',
|
||||
callback: function () {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
dialog = this.dialogService.showBlockingMessage(model);
|
||||
};
|
||||
|
||||
return RemoveDialog;
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -31,7 +31,7 @@ define(
|
||||
* @memberof platform/commonUI/browse
|
||||
* @constructor
|
||||
*/
|
||||
function LocatorController($scope, $timeout, objectService) {
|
||||
function LocatorController($scope, $timeout, objectService, typeService, policyService, instantiate) {
|
||||
// Populate values needed by the locator control. These are:
|
||||
// * rootObject: The top-level object, since we want to show
|
||||
// the full tree
|
||||
@ -66,8 +66,8 @@ define(
|
||||
|
||||
// Restrict which locations can be selected
|
||||
if (domainObject &&
|
||||
$scope.structure &&
|
||||
$scope.structure.validate) {
|
||||
$scope.structure &&
|
||||
$scope.structure.validate) {
|
||||
if (!$scope.structure.validate(domainObject)) {
|
||||
setLocatingObject(priorObject, undefined);
|
||||
return;
|
||||
@ -81,11 +81,64 @@ define(
|
||||
!!$scope.treeModel.selectedObject
|
||||
);
|
||||
}
|
||||
|
||||
// Check if create new folder is a valid action for selected object
|
||||
$scope.validParent = function () {
|
||||
if ($scope.treeModel.selectedObject) {
|
||||
return policyService.allow(
|
||||
"composition",
|
||||
$scope.treeModel.selectedObject,
|
||||
instantiate(typeService.getType('folder').getInitialModel())
|
||||
);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$scope.newFolderButtonClickHandler = function () {
|
||||
$scope.newFolderCreationTriggered = true;
|
||||
};
|
||||
|
||||
$scope.newFolderCancelButtonClickHandler = function () {
|
||||
$scope.newFolderCreationTriggered = false;
|
||||
resetNewFolderNameInput();
|
||||
};
|
||||
|
||||
// Get expected input pattern for folder name
|
||||
var folderNamePattern = new RegExp(
|
||||
typeService.getType('folder').getProperties()[0].propertyDefinition.pattern
|
||||
);
|
||||
|
||||
// Validate folder name externally to avoid affecting overall form validation
|
||||
$scope.validFolderName = function () {
|
||||
return $scope.newFolderNameInput && folderNamePattern.test($scope.newFolderNameInput);
|
||||
};
|
||||
|
||||
function selectAndScrollToNewFolder(newFolder) {
|
||||
$scope.treeModel.selectedObject = newFolder;
|
||||
}
|
||||
|
||||
function resetNewFolderNameInput() {
|
||||
$scope.newFolderNameInput = "Unnamed Folder";
|
||||
$scope.newFolderCreationTriggered = false;
|
||||
}
|
||||
|
||||
|
||||
// Create new folder, update selection to new folder and reset new folder button
|
||||
$scope.newFolderCreateButtonClickHandler = function () {
|
||||
var createNewFolderAction = $scope.treeModel.selectedObject.getCapability('action').getActions('create-new-folder')[0];
|
||||
createNewFolderAction.perform($scope.newFolderNameInput)
|
||||
.then(selectAndScrollToNewFolder)
|
||||
.then(resetNewFolderNameInput);
|
||||
};
|
||||
|
||||
// Initial state for the tree's model
|
||||
$scope.treeModel =
|
||||
{ selectedObject: $scope.ngModel[$scope.field] };
|
||||
$scope.treeModel = { selectedObject: $scope.ngModel[$scope.field] };
|
||||
|
||||
//Initial values for new folder action
|
||||
$scope.newFolderNameInput = "Unnamed Folder";
|
||||
$scope.newFolderCreationTriggered = false;
|
||||
|
||||
// Watch for changes from the tree
|
||||
$scope.$watch("treeModel.selectedObject", setLocatingObject);
|
||||
|
@ -20,192 +20,110 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
// Utility functions for reducing truth arrays
|
||||
function and(a, b) {
|
||||
return a && b;
|
||||
}
|
||||
function or(a, b) {
|
||||
return a || b;
|
||||
}
|
||||
|
||||
[
|
||||
'../../../../../src/api/objects/object-utils',
|
||||
'lodash'
|
||||
],
|
||||
function (
|
||||
objectUtils,
|
||||
_
|
||||
) {
|
||||
|
||||
/**
|
||||
* Provides initial structure and state (as suitable for provision
|
||||
* to the `mct-toolbar` directive) for a view's tool bar, based on
|
||||
* that view's declaration of what belongs in its tool bar and on
|
||||
* to the `mct-toolbar` directive) for a view's toolbar, based on
|
||||
* that view's declaration of what belongs in its toolbar and on
|
||||
* the current selection.
|
||||
*
|
||||
* @param structure toolbar structure, as provided by view definition
|
||||
* @param {Function} commit callback to invoke after changes
|
||||
* @param $scope the Angular scope
|
||||
* @param {Object} openmct the openmct object
|
||||
* @param structure the toolbar structure
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
*/
|
||||
function EditToolbar(structure, commit) {
|
||||
function EditToolbar($scope, openmct, structure) {
|
||||
this.toolbarStructure = [];
|
||||
this.properties = [];
|
||||
this.toolbarState = [];
|
||||
this.openmct = openmct;
|
||||
this.domainObjectsById = {};
|
||||
this.unobserveObjects = [];
|
||||
this.stateTracker = [];
|
||||
|
||||
$scope.$watchCollection(this.getState.bind(this), this.handleStateChanges.bind(this));
|
||||
$scope.$on("$destroy", this.destroy.bind(this));
|
||||
|
||||
this.updateToolbar(structure);
|
||||
this.registerListeners(structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the toolbar with a new structure.
|
||||
*
|
||||
* @param {Array} structure the toolbar structure
|
||||
*/
|
||||
EditToolbar.prototype.updateToolbar = function (structure) {
|
||||
var self = this;
|
||||
|
||||
// Generate a new key for an item's property
|
||||
function addKey(property) {
|
||||
self.properties.push(property);
|
||||
function addKey(item) {
|
||||
self.stateTracker.push({
|
||||
id: objectUtils.makeKeyString(item.domainObject.identifier),
|
||||
domainObject: item.domainObject,
|
||||
property: item.property
|
||||
});
|
||||
self.properties.push(item.property);
|
||||
|
||||
return self.properties.length - 1; // Return index of property
|
||||
}
|
||||
|
||||
// Invoke all functions in selections with the given name
|
||||
function invoke(method, value) {
|
||||
if (method) {
|
||||
// Make the change in the selection
|
||||
self.selection.forEach(function (selected) {
|
||||
if (typeof selected[method] === 'function') {
|
||||
selected[method](value);
|
||||
}
|
||||
});
|
||||
// ...and commit!
|
||||
commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare a toolbar item based on current selection
|
||||
function convertItem(item) {
|
||||
var converted = Object.create(item || {});
|
||||
|
||||
if (item.property) {
|
||||
converted.key = addKey(item.property);
|
||||
converted.key = addKey(item);
|
||||
}
|
||||
|
||||
if (item.method) {
|
||||
converted.click = function (v) {
|
||||
invoke(item.method, v);
|
||||
converted.click = function (value) {
|
||||
item.method(value);
|
||||
};
|
||||
}
|
||||
|
||||
return converted;
|
||||
}
|
||||
|
||||
// Prepare a toolbar section
|
||||
function convertSection(section) {
|
||||
var converted = Object.create(section || {});
|
||||
converted.items =
|
||||
((section || {}).items || [])
|
||||
.map(convertItem);
|
||||
return converted;
|
||||
}
|
||||
|
||||
this.toolbarState = [];
|
||||
this.selection = undefined;
|
||||
this.properties = [];
|
||||
this.toolbarStructure = Object.create(structure || {});
|
||||
this.toolbarStructure.sections =
|
||||
((structure || {}).sections || []).map(convertSection);
|
||||
}
|
||||
|
||||
// Check if all elements of the selection which have this
|
||||
// property have the same value for this property.
|
||||
EditToolbar.prototype.isConsistent = function (property) {
|
||||
var self = this,
|
||||
consistent = true,
|
||||
observed = false,
|
||||
state;
|
||||
|
||||
// Check if a given element of the selection is consistent
|
||||
// with previously-observed elements for this property.
|
||||
function checkConsistency(selected) {
|
||||
var next;
|
||||
// Ignore selections which don't have this property
|
||||
if (selected[property] !== undefined) {
|
||||
// Look up state of this element in the selection
|
||||
next = self.lookupState(property, selected);
|
||||
// Detect inconsistency
|
||||
if (observed) {
|
||||
consistent = consistent && (next === state);
|
||||
}
|
||||
// Track state for next iteration
|
||||
state = next;
|
||||
observed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through selections
|
||||
self.selection.forEach(checkConsistency);
|
||||
|
||||
return consistent;
|
||||
};
|
||||
|
||||
// Used to filter out items which are applicable (or not)
|
||||
// to the current selection.
|
||||
EditToolbar.prototype.isApplicable = function (item) {
|
||||
var property = (item || {}).property,
|
||||
method = (item || {}).method,
|
||||
exclusive = !!(item || {}).exclusive;
|
||||
|
||||
// Check if a selected item defines this property
|
||||
function hasProperty(selected) {
|
||||
return (property && (selected[property] !== undefined)) ||
|
||||
(method && (typeof selected[method] === 'function'));
|
||||
}
|
||||
|
||||
return this.selection.map(hasProperty).reduce(
|
||||
exclusive ? and : or,
|
||||
exclusive
|
||||
) && this.isConsistent(property);
|
||||
};
|
||||
|
||||
|
||||
// Look up the current value associated with a property
|
||||
EditToolbar.prototype.lookupState = function (property, selected) {
|
||||
var value = selected[property];
|
||||
return (typeof value === 'function') ? value() : value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the current selection. Visibility of sections
|
||||
* and items in the toolbar will be updated to match this.
|
||||
* @param {Array} s the new selection
|
||||
*/
|
||||
EditToolbar.prototype.setSelection = function (s) {
|
||||
var self = this;
|
||||
|
||||
// Show/hide controls in this section per applicability
|
||||
function refreshSectionApplicability(section) {
|
||||
var count = 0;
|
||||
// Show/hide each item
|
||||
(section.items || []).forEach(function (item) {
|
||||
item.hidden = !self.isApplicable(item);
|
||||
count += item.hidden ? 0 : 1;
|
||||
});
|
||||
// Hide this section if there are no applicable items
|
||||
section.hidden = !count;
|
||||
}
|
||||
|
||||
// Get initial value for a given property
|
||||
function initializeState(property) {
|
||||
var result;
|
||||
// Look through all selections for this property;
|
||||
// values should all match by the time we perform
|
||||
// this lookup anyway.
|
||||
self.selection.forEach(function (selected) {
|
||||
result = (selected[property] !== undefined) ?
|
||||
self.lookupState(property, selected) :
|
||||
result;
|
||||
structure.forEach(function (item) {
|
||||
if (item.property === property) {
|
||||
result = _.get(item.domainObject, item.property);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
this.selection = s;
|
||||
this.toolbarStructure.sections.forEach(refreshSectionApplicability);
|
||||
// Tracks the domain object and property for every element in the state array
|
||||
this.stateTracker = [];
|
||||
this.toolbarStructure = structure.map(convertItem);
|
||||
this.toolbarState = this.properties.map(initializeState);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the structure of the toolbar, as appropriate to
|
||||
* Gets the structure of the toolbar, as appropriate to
|
||||
* pass to `mct-toolbar`.
|
||||
* @returns the toolbar structure
|
||||
*
|
||||
* @returns {Array} the toolbar structure
|
||||
*/
|
||||
EditToolbar.prototype.getStructure = function () {
|
||||
return this.toolbarStructure;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the current state of the toolbar, as appropriate
|
||||
* Gets the current state of the toolbar, as appropriate
|
||||
* to two-way bind to the state handled by `mct-toolbar`.
|
||||
*
|
||||
* @returns {Array} state of the toolbar
|
||||
*/
|
||||
EditToolbar.prototype.getState = function () {
|
||||
@ -213,48 +131,124 @@ define(
|
||||
};
|
||||
|
||||
/**
|
||||
* Update state within the current selection.
|
||||
* Mutates the domain object's property with a new value.
|
||||
*
|
||||
* @param {Object} dominObject the domain object
|
||||
* @param {string} property the domain object's property to update
|
||||
* @param value the property's new value
|
||||
*/
|
||||
EditToolbar.prototype.updateDomainObject = function (domainObject, property, value) {
|
||||
this.openmct.objects.mutate(domainObject, property, value);
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates state with the new value.
|
||||
*
|
||||
* @param {number} index the index of the corresponding
|
||||
* element in the state array
|
||||
* @param value the new value to convey to the selection
|
||||
* @param value the new value to update the state array with
|
||||
*/
|
||||
EditToolbar.prototype.updateState = function (index, value) {
|
||||
this.toolbarState[index] = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register listeners for domain objects to watch for updates.
|
||||
*
|
||||
* @param {Array} the toolbar structure
|
||||
*/
|
||||
EditToolbar.prototype.registerListeners = function (structure) {
|
||||
var self = this;
|
||||
|
||||
// Update value for this property in all elements of the
|
||||
// selection which have this property.
|
||||
function updateProperties(property, val) {
|
||||
var changed = false;
|
||||
|
||||
// Update property in a selected element
|
||||
function updateProperty(selected) {
|
||||
// Ignore selected elements which don't have this property
|
||||
if (selected[property] !== undefined) {
|
||||
// Check if this is a setter, or just assignable
|
||||
if (typeof selected[property] === 'function') {
|
||||
changed =
|
||||
changed || (selected[property]() !== val);
|
||||
selected[property](val);
|
||||
} else {
|
||||
changed =
|
||||
changed || (selected[property] !== val);
|
||||
selected[property] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update property in all selected elements
|
||||
self.selection.forEach(updateProperty);
|
||||
|
||||
// Return whether or not anything changed
|
||||
return changed;
|
||||
function observeObject(domainObject, id) {
|
||||
var unobserveObject = self.openmct.objects.observe(domainObject, '*', function (newObject) {
|
||||
self.domainObjectsById[id].newObject = JSON.parse(JSON.stringify(newObject));
|
||||
self.scheduleStateUpdate();
|
||||
});
|
||||
self.unobserveObjects.push(unobserveObject);
|
||||
}
|
||||
|
||||
return updateProperties(this.properties[index], value);
|
||||
structure.forEach(function (item) {
|
||||
var domainObject = item.domainObject;
|
||||
var id = objectUtils.makeKeyString(domainObject.identifier);
|
||||
|
||||
if (!self.domainObjectsById[id]) {
|
||||
self.domainObjectsById[id] = {
|
||||
domainObject: domainObject,
|
||||
properties: []
|
||||
};
|
||||
observeObject(domainObject, id);
|
||||
}
|
||||
|
||||
self.domainObjectsById[id].properties.push(item.property);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Delays updating the state.
|
||||
*/
|
||||
EditToolbar.prototype.scheduleStateUpdate = function () {
|
||||
if (this.stateUpdateScheduled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stateUpdateScheduled = true;
|
||||
setTimeout(this.updateStateAfterMutation.bind(this));
|
||||
};
|
||||
|
||||
EditToolbar.prototype.updateStateAfterMutation = function () {
|
||||
this.stateTracker.forEach(function (state, index) {
|
||||
if (!this.domainObjectsById[state.id].newObject) {
|
||||
return;
|
||||
}
|
||||
|
||||
var domainObject = this.domainObjectsById[state.id].domainObject;
|
||||
var newObject = this.domainObjectsById[state.id].newObject;
|
||||
var currentValue = _.get(domainObject, state.property);
|
||||
var newValue = _.get(newObject, state.property);
|
||||
|
||||
state.domainObject = newObject;
|
||||
|
||||
if (currentValue !== newValue) {
|
||||
this.updateState(index, newValue);
|
||||
}
|
||||
}, this);
|
||||
|
||||
Object.values(this.domainObjectsById).forEach(function (tracker) {
|
||||
if (tracker.newObject) {
|
||||
tracker.domainObject = tracker.newObject;
|
||||
}
|
||||
delete tracker.newObject;
|
||||
});
|
||||
this.stateUpdateScheduled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the listeners.
|
||||
*/
|
||||
EditToolbar.prototype.deregisterListeners = function () {
|
||||
this.unobserveObjects.forEach(function (unobserveObject) {
|
||||
unobserveObject();
|
||||
});
|
||||
this.unobserveObjects = [];
|
||||
};
|
||||
|
||||
EditToolbar.prototype.handleStateChanges = function (state) {
|
||||
(state || []).map(function (newValue, index) {
|
||||
var domainObject = this.stateTracker[index].domainObject;
|
||||
var property = this.stateTracker[index].property;
|
||||
var currentValue = _.get(domainObject, property);
|
||||
|
||||
if (currentValue !== newValue) {
|
||||
this.updateDomainObject(domainObject, property, newValue);
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
EditToolbar.prototype.destroy = function () {
|
||||
this.deregisterListeners();
|
||||
};
|
||||
|
||||
return EditToolbar;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
@ -1,154 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
['./EditToolbar', './EditToolbarSelection'],
|
||||
function (EditToolbar, EditToolbarSelection) {
|
||||
|
||||
// No operation
|
||||
var NOOP_REPRESENTER = {
|
||||
represent: function () {},
|
||||
destroy: function () {}
|
||||
};
|
||||
|
||||
/**
|
||||
* The EditToolbarRepresenter populates the toolbar in Edit mode
|
||||
* based on a view's definition.
|
||||
* @param {Scope} scope the Angular scope of the representation
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
* @implements {Representer}
|
||||
*/
|
||||
function EditToolbarRepresenter(openmct, scope, element, attrs) {
|
||||
var self = this;
|
||||
|
||||
// Mark changes as ready to persist
|
||||
function commit(message) {
|
||||
if (scope.commit) {
|
||||
scope.commit(message);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle changes to the current selection
|
||||
function updateSelection(selection) {
|
||||
// Only update if there is a toolbar to update
|
||||
if (self.toolbar) {
|
||||
// Make sure selection is array-like
|
||||
selection = Array.isArray(selection) ?
|
||||
selection :
|
||||
(selection ? [selection] : []);
|
||||
|
||||
// Update the toolbar's selection
|
||||
self.toolbar.setSelection(selection);
|
||||
|
||||
// ...and expose its structure/state
|
||||
self.toolbarObject.structure =
|
||||
self.toolbar.getStructure();
|
||||
self.toolbarObject.state =
|
||||
self.toolbar.getState();
|
||||
}
|
||||
}
|
||||
|
||||
// Get state (to watch it)
|
||||
function getState() {
|
||||
return self.toolbarObject.state;
|
||||
}
|
||||
|
||||
// Update selection models to match changed toolbar state
|
||||
function updateState(state) {
|
||||
// Update underlying state based on toolbar changes
|
||||
var changed = (state || []).map(function (value, index) {
|
||||
return self.toolbar.updateState(index, value);
|
||||
}).reduce(function (a, b) {
|
||||
return a || b;
|
||||
}, false);
|
||||
|
||||
// Only commit if something actually changed
|
||||
if (changed) {
|
||||
// Commit the changes.
|
||||
commit("Changes from toolbar.");
|
||||
}
|
||||
}
|
||||
this.clearExposedToolbar = function () {
|
||||
// Clear exposed toolbar state (if any)
|
||||
if (attrs.toolbar) {
|
||||
delete scope.$parent[attrs.toolbar];
|
||||
}
|
||||
};
|
||||
this.exposeToolbar = function () {
|
||||
scope.$parent[self.attrs.toolbar] = self.toolbarObject;
|
||||
};
|
||||
|
||||
this.commit = commit;
|
||||
this.attrs = attrs;
|
||||
this.updateSelection = updateSelection;
|
||||
this.toolbar = undefined;
|
||||
this.toolbarObject = {};
|
||||
this.openmct = openmct;
|
||||
this.scope = scope;
|
||||
|
||||
// If this representation exposes a toolbar, set up watches
|
||||
// to synchronize with it.
|
||||
if (attrs && attrs.toolbar) {
|
||||
// Detect and handle changes to state from the toolbar
|
||||
scope.$watchCollection(getState, updateState);
|
||||
// Watch for changes in the current selection state
|
||||
scope.$watchCollection("selection.all()", updateSelection);
|
||||
// Expose toolbar state under that name
|
||||
scope.$parent[attrs.toolbar] = this.toolbarObject;
|
||||
} else {
|
||||
// No toolbar declared, so do nothing.
|
||||
return NOOP_REPRESENTER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Represent a domain object using this definition
|
||||
EditToolbarRepresenter.prototype.represent = function (representation) {
|
||||
// Get the newest toolbar definition from the view
|
||||
var definition = (representation || {}).toolbar || {};
|
||||
|
||||
// If we have been asked to expose toolbar state...
|
||||
if (this.attrs.toolbar) {
|
||||
// Initialize toolbar object
|
||||
this.toolbar = new EditToolbar(definition, this.commit);
|
||||
// Ensure toolbar state is exposed
|
||||
this.exposeToolbar();
|
||||
}
|
||||
|
||||
// Add toolbar selection to scope.
|
||||
this.scope.selection = new EditToolbarSelection(
|
||||
this.scope,
|
||||
this.openmct
|
||||
);
|
||||
// Initialize toolbar to current selection
|
||||
this.updateSelection(this.scope.selection.all());
|
||||
};
|
||||
|
||||
// Destroy; remove toolbar object from parent scope
|
||||
EditToolbarRepresenter.prototype.destroy = function () {
|
||||
this.clearExposedToolbar();
|
||||
};
|
||||
|
||||
return EditToolbarRepresenter;
|
||||
}
|
||||
);
|
@ -1,157 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
/**
|
||||
* Tracks selection state for editable views. Selection is
|
||||
* implemented such that (from the toolbar's perspective)
|
||||
* up to two objects can be "selected" at any given time:
|
||||
*
|
||||
* * The view proxy (see the `proxy` method), which provides
|
||||
* an interface for interacting with the view itself (e.g.
|
||||
* for buttons like "Add")
|
||||
* * The selection, for single selected elements within the
|
||||
* view.
|
||||
*
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
*/
|
||||
function EditToolbarSelection($scope, openmct) {
|
||||
this.selection = [{}];
|
||||
this.selecting = false;
|
||||
this.selectedObj = undefined;
|
||||
this.openmct = openmct;
|
||||
var self = this;
|
||||
|
||||
function setSelection(selection) {
|
||||
var selected = selection[0];
|
||||
|
||||
if (selected && selected.context.toolbar) {
|
||||
self.select(selected.context.toolbar);
|
||||
} else {
|
||||
self.deselect();
|
||||
}
|
||||
|
||||
if (selected && selected.context.viewProxy) {
|
||||
self.proxy(selected.context.viewProxy);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.$on("$destroy", function () {
|
||||
self.openmct.selection.off('change', setSelection);
|
||||
});
|
||||
|
||||
this.openmct.selection.on('change', setSelection);
|
||||
setSelection(this.openmct.selection.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an object is currently selected.
|
||||
* @param {*} obj the object to check for selection
|
||||
* @returns {boolean} true if selected, otherwise false
|
||||
*/
|
||||
EditToolbarSelection.prototype.selected = function (obj) {
|
||||
return (obj === this.selectedObj) || (obj === this.selection[0]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Select an object.
|
||||
* @param obj the object to select
|
||||
* @returns {boolean} true if selection changed
|
||||
*/
|
||||
EditToolbarSelection.prototype.select = function (obj) {
|
||||
// Proxy is always selected
|
||||
if (obj === this.selection[0]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear any existing selection
|
||||
this.deselect();
|
||||
|
||||
// Note the current selection state
|
||||
this.selectedObj = obj;
|
||||
this.selecting = true;
|
||||
|
||||
// Add the selection
|
||||
this.selection.push(obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the current selection.
|
||||
* @returns {boolean} true if selection changed
|
||||
*/
|
||||
EditToolbarSelection.prototype.deselect = function () {
|
||||
// Nothing to do if we don't have a selected object
|
||||
if (this.selecting) {
|
||||
// Clear state tracking
|
||||
this.selecting = false;
|
||||
this.selectedObj = undefined;
|
||||
|
||||
// Remove the selection
|
||||
this.selection.pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the currently-selected object.
|
||||
* @returns the currently selected object
|
||||
*/
|
||||
EditToolbarSelection.prototype.get = function () {
|
||||
return this.selectedObj;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get/set the view proxy (for toolbar actions taken upon
|
||||
* the view itself.)
|
||||
* @param [proxy] the view proxy (if setting)
|
||||
* @returns the current view proxy
|
||||
*/
|
||||
EditToolbarSelection.prototype.proxy = function (p) {
|
||||
if (arguments.length > 0) {
|
||||
this.selection[0] = p;
|
||||
}
|
||||
return this.selection[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an array containing all selections, including the
|
||||
* selection proxy. It is generally not advisable to
|
||||
* mutate this array directly.
|
||||
* @returns {Array} all selections
|
||||
*/
|
||||
EditToolbarSelection.prototype.all = function () {
|
||||
return this.selection;
|
||||
};
|
||||
|
||||
return EditToolbarSelection;
|
||||
}
|
||||
);
|
@ -49,7 +49,7 @@ define(
|
||||
"getModel"
|
||||
]
|
||||
);
|
||||
mockDomainObject.getModel.andReturn({});
|
||||
mockDomainObject.getModel.and.returnValue({});
|
||||
|
||||
mockParentObject = jasmine.createSpyObj(
|
||||
"parentObject",
|
||||
@ -57,7 +57,7 @@ define(
|
||||
"getCapability"
|
||||
]
|
||||
);
|
||||
mockParentObject.getCapability.andCallFake(function (name) {
|
||||
mockParentObject.getCapability.and.callFake(function (name) {
|
||||
return parentCapabilities[name];
|
||||
});
|
||||
|
||||
@ -77,14 +77,14 @@ define(
|
||||
"getOriginal"
|
||||
]
|
||||
);
|
||||
capabilities.location.getOriginal.andReturn(mockPromise(mockDomainObject));
|
||||
capabilities.location.getOriginal.and.returnValue(mockPromise(mockDomainObject));
|
||||
capabilities.context = jasmine.createSpyObj(
|
||||
"contextCapability",
|
||||
[
|
||||
"getParent"
|
||||
]
|
||||
);
|
||||
capabilities.context.getParent.andReturn(mockParentObject);
|
||||
capabilities.context.getParent.and.returnValue(mockParentObject);
|
||||
|
||||
parentCapabilities.action = jasmine.createSpyObj(
|
||||
"actionCapability",
|
||||
@ -97,37 +97,37 @@ define(
|
||||
domainObject: mockDomainObject
|
||||
};
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function (name) {
|
||||
mockDomainObject.getCapability.and.callFake(function (name) {
|
||||
return capabilities[name];
|
||||
});
|
||||
|
||||
mockDomainObject.hasCapability.andCallFake(function (name) {
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return !!capabilities[name];
|
||||
});
|
||||
|
||||
capabilities.editor.finish.andReturn(mockPromise(true));
|
||||
capabilities.editor.finish.and.returnValue(mockPromise(true));
|
||||
|
||||
action = new CancelAction(actionContext);
|
||||
|
||||
});
|
||||
|
||||
it("only applies to domain object that is being edited", function () {
|
||||
capabilities.editor.isEditContextRoot.andReturn(true);
|
||||
capabilities.editor.isEditContextRoot.and.returnValue(true);
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeTruthy();
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
capabilities.editor.isEditContextRoot.andReturn(false);
|
||||
capabilities.editor.isEditContextRoot.and.returnValue(false);
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.hasCapability.and.returnValue(false);
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("invokes the editor capability's cancel functionality when" +
|
||||
" performed", function () {
|
||||
mockDomainObject.getModel.andReturn({persisted: 1});
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 1});
|
||||
//Return true from navigate action
|
||||
capabilities.action.perform.andReturn(mockPromise(true));
|
||||
capabilities.action.perform.and.returnValue(mockPromise(true));
|
||||
action.perform();
|
||||
|
||||
// Should have called finish
|
||||
@ -138,15 +138,15 @@ define(
|
||||
});
|
||||
|
||||
it("navigates to object if existing using navigate action", function () {
|
||||
mockDomainObject.getModel.andReturn({persisted: 1});
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 1});
|
||||
//Return true from navigate action
|
||||
capabilities.action.perform.andReturn(mockPromise(true));
|
||||
capabilities.action.perform.and.returnValue(mockPromise(true));
|
||||
action.perform();
|
||||
expect(capabilities.action.perform).toHaveBeenCalledWith("navigate");
|
||||
});
|
||||
|
||||
it("navigates to parent if new using navigate action", function () {
|
||||
mockDomainObject.getModel.andReturn({persisted: undefined});
|
||||
mockDomainObject.getModel.and.returnValue({persisted: undefined});
|
||||
action.perform();
|
||||
expect(parentCapabilities.action.perform).toHaveBeenCalledWith("navigate");
|
||||
});
|
||||
|
117
platform/commonUI/edit/test/actions/CreateNewFolderActionSpec.js
Normal file
117
platform/commonUI/edit/test/actions/CreateNewFolderActionSpec.js
Normal file
@ -0,0 +1,117 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
['../../src/actions/CreateNewFolderAction'],
|
||||
function (CreateNewFolderAction) {
|
||||
|
||||
describe("The Create New Folder Action", function () {
|
||||
var mockDomainObject,
|
||||
mockNewObject,
|
||||
mockType,
|
||||
testModel,
|
||||
mockFolderName,
|
||||
mockTypeService,
|
||||
mockActionContext,
|
||||
mockCompositionCapability,
|
||||
action;
|
||||
function mockPromise(value) {
|
||||
return (value && value.then) ? value : {
|
||||
then: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
}
|
||||
};
|
||||
}
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[
|
||||
"getCapability",
|
||||
"useCapability",
|
||||
"hasCapability",
|
||||
"getId"
|
||||
]
|
||||
);
|
||||
mockNewObject = jasmine.createSpyObj(
|
||||
"newObject",
|
||||
[
|
||||
"getCapability",
|
||||
"useCapability",
|
||||
"hasCapability",
|
||||
"getId"
|
||||
]
|
||||
);
|
||||
mockType = jasmine.createSpyObj(
|
||||
"type",
|
||||
[
|
||||
"getKey",
|
||||
"getInitialModel"
|
||||
]
|
||||
);
|
||||
testModel = {
|
||||
type: mockType,
|
||||
name: "Name",
|
||||
location: "someLocation"
|
||||
};
|
||||
mockFolderName = "Name";
|
||||
mockTypeService = jasmine.createSpyObj(
|
||||
"typeService",
|
||||
["getType"]
|
||||
);
|
||||
mockActionContext = { domainObject: mockDomainObject };
|
||||
mockCompositionCapability = jasmine.createSpyObj(
|
||||
"composition",
|
||||
["add"]
|
||||
);
|
||||
mockType.getKey.and.returnValue("test");
|
||||
mockType.getInitialModel.and.returnValue(testModel);
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return (capability === 'composition') && mockCompositionCapability;
|
||||
});
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockCompositionCapability.add.and.returnValue(mockPromise(true));
|
||||
mockDomainObject.useCapability.and.callFake(function (capability) {
|
||||
return (capability === 'instantiation') && mockNewObject;
|
||||
});
|
||||
mockTypeService.getType.and.returnValue(mockType);
|
||||
mockDomainObject.getId.and.returnValue("id");
|
||||
action = new CreateNewFolderAction(mockTypeService, mockActionContext);
|
||||
});
|
||||
it("uses the instantiation capability when performed", function () {
|
||||
action.perform(mockFolderName);
|
||||
expect(mockDomainObject.useCapability)
|
||||
.toHaveBeenCalledWith("instantiation", jasmine.any(Object));
|
||||
});
|
||||
it("adds new objects to the parent's composition", function () {
|
||||
action.perform(mockFolderName);
|
||||
expect(mockDomainObject.getCapability).toHaveBeenCalledWith("composition");
|
||||
expect(mockCompositionCapability.add).toHaveBeenCalled();
|
||||
});
|
||||
it("is only applicable when a domain object is in context", function () {
|
||||
expect(CreateNewFolderAction.appliesTo(mockActionContext)).toBeTruthy();
|
||||
expect(CreateNewFolderAction.appliesTo({})).toBeFalsy();
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith('editor');
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -66,11 +66,11 @@ define(
|
||||
editor: mockEditor
|
||||
};
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function (name) {
|
||||
mockDomainObject.getCapability.and.callFake(function (name) {
|
||||
return capabilities[name];
|
||||
});
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
actionContext = { domainObject: mockDomainObject };
|
||||
|
||||
@ -92,9 +92,9 @@ define(
|
||||
});
|
||||
|
||||
it("is only applicable to objects not already in edit mode", function () {
|
||||
mockEditor.isEditContextRoot.andReturn(false);
|
||||
mockEditor.isEditContextRoot.and.returnValue(false);
|
||||
expect(EditAction.appliesTo(actionContext)).toBe(true);
|
||||
mockEditor.isEditContextRoot.andReturn(true);
|
||||
mockEditor.isEditContextRoot.and.returnValue(true);
|
||||
expect(EditAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
|
@ -71,14 +71,14 @@ define(
|
||||
mockActionCapability = jasmine.createSpyObj("actionCapability", ["getActions"]);
|
||||
mockEditAction = jasmine.createSpyObj("editAction", ["perform"]);
|
||||
|
||||
mockDomainObject.getId.andReturn("test");
|
||||
mockDomainObject.getCapability.andReturn(mockContext);
|
||||
mockContext.getParent.andReturn(mockParent);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockType.getKey.andReturn("layout");
|
||||
mockComposition.invoke.andReturn(mockPromise(true));
|
||||
mockComposition.add.andReturn(mockPromise(true));
|
||||
mockActionCapability.getActions.andReturn([]);
|
||||
mockDomainObject.getId.and.returnValue("test");
|
||||
mockDomainObject.getCapability.and.returnValue(mockContext);
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
mockType.getKey.and.returnValue("layout");
|
||||
mockComposition.invoke.and.returnValue(mockPromise(true));
|
||||
mockComposition.add.and.returnValue(mockPromise(true));
|
||||
mockActionCapability.getActions.and.returnValue([]);
|
||||
|
||||
capabilities = {
|
||||
composition: mockComposition,
|
||||
@ -105,14 +105,14 @@ define(
|
||||
});
|
||||
|
||||
it("enables edit mode for objects that have an edit action", function () {
|
||||
mockActionCapability.getActions.andReturn([mockEditAction]);
|
||||
mockActionCapability.getActions.and.returnValue([mockEditAction]);
|
||||
action.perform();
|
||||
expect(mockEditAction.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("Does not enable edit mode for objects that do not have an" +
|
||||
" edit action", function () {
|
||||
mockActionCapability.getActions.andReturn([]);
|
||||
mockActionCapability.getActions.and.returnValue([]);
|
||||
action.perform();
|
||||
expect(mockEditAction.perform).not.toHaveBeenCalled();
|
||||
expect(mockComposition.add)
|
||||
|
@ -71,8 +71,8 @@ define(
|
||||
}
|
||||
};
|
||||
|
||||
capabilities.type.hasFeature.andReturn(true);
|
||||
capabilities.mutation.andReturn(true);
|
||||
capabilities.type.hasFeature.and.returnValue(true);
|
||||
capabilities.mutation.and.returnValue(true);
|
||||
|
||||
action = new PropertiesAction(dialogService, context);
|
||||
});
|
||||
@ -80,7 +80,7 @@ define(
|
||||
it("mutates an object when performed", function () {
|
||||
action.perform();
|
||||
expect(capabilities.mutation).toHaveBeenCalled();
|
||||
capabilities.mutation.mostRecentCall.args[0]({});
|
||||
capabilities.mutation.calls.mostRecent().args[0]({});
|
||||
});
|
||||
|
||||
it("does not muate object upon cancel", function () {
|
||||
|
@ -25,50 +25,37 @@ define(
|
||||
function (RemoveAction) {
|
||||
|
||||
describe("The Remove action", function () {
|
||||
var mockQ,
|
||||
mockNavigationService,
|
||||
mockDomainObject,
|
||||
mockParent,
|
||||
mockChildObject,
|
||||
mockGrandchildObject,
|
||||
mockRootObject,
|
||||
mockContext,
|
||||
mockChildContext,
|
||||
mockGrandchildContext,
|
||||
mockRootContext,
|
||||
mockMutation,
|
||||
mockType,
|
||||
var action,
|
||||
actionContext,
|
||||
model,
|
||||
capabilities,
|
||||
action;
|
||||
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
then: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
}
|
||||
};
|
||||
}
|
||||
mockContext,
|
||||
mockDialogService,
|
||||
mockDomainObject,
|
||||
mockMutation,
|
||||
mockNavigationService,
|
||||
mockParent,
|
||||
mockType,
|
||||
model;
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
["getId", "getCapability", "getModel"]
|
||||
);
|
||||
mockChildObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
mockGrandchildObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
mockQ = { when: mockPromise };
|
||||
|
||||
mockMutation = jasmine.createSpyObj("mutation", ["invoke"]);
|
||||
mockType = jasmine.createSpyObj("type", ["hasFeature"]);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
capabilities = {
|
||||
mutation: mockMutation,
|
||||
type: mockType
|
||||
};
|
||||
|
||||
model = {
|
||||
composition: ["a", "test", "b"]
|
||||
};
|
||||
|
||||
mockParent = {
|
||||
getModel: function () {
|
||||
return model;
|
||||
@ -80,12 +67,12 @@ define(
|
||||
return capabilities[k].invoke(v);
|
||||
}
|
||||
};
|
||||
mockContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockChildContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockGrandchildContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockRootContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockMutation = jasmine.createSpyObj("mutation", ["invoke"]);
|
||||
mockType = jasmine.createSpyObj("type", ["hasFeature"]);
|
||||
|
||||
mockDialogService = jasmine.createSpyObj(
|
||||
"dialogService",
|
||||
["showBlockingMessage"]
|
||||
);
|
||||
|
||||
mockNavigationService = jasmine.createSpyObj(
|
||||
"navigationService",
|
||||
[
|
||||
@ -95,31 +82,27 @@ define(
|
||||
"removeListener"
|
||||
]
|
||||
);
|
||||
mockNavigationService.getNavigation.andReturn(mockDomainObject);
|
||||
mockNavigationService.getNavigation.and.returnValue(mockDomainObject);
|
||||
|
||||
mockContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
|
||||
mockDomainObject.getId.andReturn("test");
|
||||
mockDomainObject.getCapability.andReturn(mockContext);
|
||||
mockContext.getParent.andReturn(mockParent);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockDomainObject.getId.and.returnValue("test");
|
||||
mockDomainObject.getCapability.and.returnValue(mockContext);
|
||||
mockDomainObject.getModel.and.returnValue({name: 'test object'});
|
||||
|
||||
capabilities = {
|
||||
mutation: mockMutation,
|
||||
type: mockType
|
||||
};
|
||||
model = {
|
||||
composition: ["a", "test", "b"]
|
||||
};
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
actionContext = { domainObject: mockDomainObject };
|
||||
|
||||
action = new RemoveAction(mockNavigationService, actionContext);
|
||||
action = new RemoveAction(mockDialogService, mockNavigationService, actionContext);
|
||||
});
|
||||
|
||||
it("only applies to objects with parents", function () {
|
||||
expect(RemoveAction.appliesTo(actionContext)).toBeTruthy();
|
||||
|
||||
mockContext.getParent.andReturn(undefined);
|
||||
mockContext.getParent.and.returnValue(undefined);
|
||||
|
||||
expect(RemoveAction.appliesTo(actionContext)).toBeFalsy();
|
||||
|
||||
@ -127,83 +110,146 @@ define(
|
||||
expect(mockType.hasFeature).toHaveBeenCalledWith('creation');
|
||||
});
|
||||
|
||||
it("mutates the parent when performed", function () {
|
||||
action.perform();
|
||||
expect(mockMutation.invoke)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("changes composition from its mutation function", function () {
|
||||
var mutator, result;
|
||||
action.perform();
|
||||
mutator = mockMutation.invoke.mostRecentCall.args[0];
|
||||
result = mutator(model);
|
||||
|
||||
// Should not have cancelled the mutation
|
||||
expect(result).not.toBe(false);
|
||||
|
||||
// Simulate mutate's behavior (remove can either return a
|
||||
// new model or modify this one in-place)
|
||||
result = result || model;
|
||||
|
||||
// Should have removed "test" - that was our
|
||||
// mock domain object's id.
|
||||
expect(result.composition).toEqual(["a", "b"]);
|
||||
});
|
||||
|
||||
it("removes parent of object currently navigated to", function () {
|
||||
// Navigates to child object
|
||||
mockNavigationService.getNavigation.andReturn(mockChildObject);
|
||||
|
||||
// Test is id of object being removed
|
||||
// Child object has different id
|
||||
mockDomainObject.getId.andReturn("test");
|
||||
mockChildObject.getId.andReturn("not test");
|
||||
|
||||
// Sets context for the child and domainObject
|
||||
mockDomainObject.getCapability.andReturn(mockContext);
|
||||
mockChildObject.getCapability.andReturn(mockChildContext);
|
||||
|
||||
// Parents of child and domainObject are set
|
||||
mockContext.getParent.andReturn(mockParent);
|
||||
mockChildContext.getParent.andReturn(mockDomainObject);
|
||||
|
||||
mockType.hasFeature.andReturn(true);
|
||||
it("shows a blocking message dialog", function () {
|
||||
mockParent = jasmine.createSpyObj(
|
||||
"parent",
|
||||
["getModel", "getCapability", "useCapability"]
|
||||
);
|
||||
|
||||
action.perform();
|
||||
|
||||
// Expects navigation to parent of domainObject (removed object)
|
||||
expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(mockParent);
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
|
||||
// Also check that no mutation happens at this point
|
||||
expect(mockParent.useCapability).not.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("checks if removing object not in ascendent path (reaches ROOT)", function () {
|
||||
// Navigates to grandchild of ROOT
|
||||
mockNavigationService.getNavigation.andReturn(mockGrandchildObject);
|
||||
describe("after the remove callback is triggered", function () {
|
||||
var mockChildContext,
|
||||
mockChildObject,
|
||||
mockDialogHandle,
|
||||
mockGrandchildContext,
|
||||
mockGrandchildObject,
|
||||
mockRootContext,
|
||||
mockRootObject;
|
||||
|
||||
// domainObject (grandparent) is set as ROOT, child and grandchild
|
||||
// are set objects not being removed
|
||||
mockDomainObject.getId.andReturn("test 1");
|
||||
mockRootObject.getId.andReturn("ROOT");
|
||||
mockChildObject.getId.andReturn("not test 2");
|
||||
mockGrandchildObject.getId.andReturn("not test 3");
|
||||
beforeEach(function () {
|
||||
mockChildObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
|
||||
// Sets context for the grandchild, child, and domainObject
|
||||
mockRootObject.getCapability.andReturn(mockRootContext);
|
||||
mockChildObject.getCapability.andReturn(mockChildContext);
|
||||
mockGrandchildObject.getCapability.andReturn(mockGrandchildContext);
|
||||
mockDialogHandle = jasmine.createSpyObj(
|
||||
"dialogHandle",
|
||||
["dismiss"]
|
||||
);
|
||||
|
||||
// Parents of grandchild and child are set
|
||||
mockChildContext.getParent.andReturn(mockRootObject);
|
||||
mockGrandchildContext.getParent.andReturn(mockChildObject);
|
||||
mockGrandchildObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getId", "getCapability"]
|
||||
);
|
||||
|
||||
action.perform();
|
||||
mockChildContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockGrandchildContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
mockRootContext = jasmine.createSpyObj("context", ["getParent"]);
|
||||
|
||||
mockDialogService.showBlockingMessage.and.returnValue(mockDialogHandle);
|
||||
});
|
||||
|
||||
it("mutates the parent when performed", function () {
|
||||
action.perform();
|
||||
mockDialogService.showBlockingMessage.calls.mostRecent().args[0]
|
||||
.primaryOption.callback();
|
||||
|
||||
expect(mockMutation.invoke)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("changes composition from its mutation function", function () {
|
||||
var mutator, result;
|
||||
|
||||
action.perform();
|
||||
mockDialogService.showBlockingMessage.calls.mostRecent().args[0]
|
||||
.primaryOption.callback();
|
||||
|
||||
mutator = mockMutation.invoke.calls.mostRecent().args[0];
|
||||
result = mutator(model);
|
||||
|
||||
// Should not have cancelled the mutation
|
||||
expect(result).not.toBe(false);
|
||||
|
||||
// Simulate mutate's behavior (remove can either return a
|
||||
// new model or modify this one in-place)
|
||||
result = result || model;
|
||||
|
||||
// Should have removed "test" - that was our
|
||||
// mock domain object's id.
|
||||
expect(result.composition).toEqual(["a", "b"]);
|
||||
});
|
||||
|
||||
it("removes parent of object currently navigated to", function () {
|
||||
// Navigates to child object
|
||||
mockNavigationService.getNavigation.and.returnValue(mockChildObject);
|
||||
|
||||
// Test is id of object being removed
|
||||
// Child object has different id
|
||||
mockDomainObject.getId.and.returnValue("test");
|
||||
mockChildObject.getId.and.returnValue("not test");
|
||||
|
||||
// Sets context for the child and domainObject
|
||||
mockDomainObject.getCapability.and.returnValue(mockContext);
|
||||
mockChildObject.getCapability.and.returnValue(mockChildContext);
|
||||
|
||||
// Parents of child and domainObject are set
|
||||
mockContext.getParent.and.returnValue(mockParent);
|
||||
mockChildContext.getParent.and.returnValue(mockDomainObject);
|
||||
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
action.perform();
|
||||
mockDialogService.showBlockingMessage.calls.mostRecent().args[0]
|
||||
.primaryOption.callback();
|
||||
|
||||
// Expects navigation to parent of domainObject (removed object)
|
||||
expect(mockNavigationService.setNavigation).toHaveBeenCalledWith(mockParent);
|
||||
});
|
||||
|
||||
it("checks if removing object not in ascendent path (reaches ROOT)", function () {
|
||||
// Navigates to grandchild of ROOT
|
||||
mockNavigationService.getNavigation.and.returnValue(mockGrandchildObject);
|
||||
|
||||
// domainObject (grandparent) is set as ROOT, child and grandchild
|
||||
// are set objects not being removed
|
||||
mockDomainObject.getId.and.returnValue("test 1");
|
||||
mockRootObject.getId.and.returnValue("ROOT");
|
||||
mockChildObject.getId.and.returnValue("not test 2");
|
||||
mockGrandchildObject.getId.and.returnValue("not test 3");
|
||||
|
||||
// Sets context for the grandchild, child, and domainObject
|
||||
mockRootObject.getCapability.and.returnValue(mockRootContext);
|
||||
mockChildObject.getCapability.and.returnValue(mockChildContext);
|
||||
mockGrandchildObject.getCapability.and.returnValue(mockGrandchildContext);
|
||||
|
||||
// Parents of grandchild and child are set
|
||||
mockChildContext.getParent.and.returnValue(mockRootObject);
|
||||
mockGrandchildContext.getParent.and.returnValue(mockChildObject);
|
||||
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
|
||||
action.perform();
|
||||
mockDialogService.showBlockingMessage.calls.mostRecent().args[0]
|
||||
.primaryOption.callback();
|
||||
|
||||
// Expects no navigation to occur
|
||||
expect(mockNavigationService.setNavigation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// Expects no navigation to occur
|
||||
expect(mockNavigationService.setNavigation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -19,7 +19,7 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global describe,it,expect,beforeEach,jasmine,waitsFor,runs*/
|
||||
/*global describe,it,expect,beforeEach,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/actions/SaveAction"],
|
||||
@ -81,13 +81,13 @@ define(
|
||||
["info", "error"]
|
||||
);
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andCallFake(function (capability) {
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.getModel.andReturn({persisted: 0});
|
||||
mockEditorCapability.save.andReturn(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 0});
|
||||
mockEditorCapability.save.and.returnValue(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
|
||||
action = new SaveAction(mockDialogService, mockNotificationService, actionContext);
|
||||
});
|
||||
@ -96,14 +96,14 @@ define(
|
||||
expect(SaveAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.getCapability.andReturn(undefined);
|
||||
mockDomainObject.hasCapability.and.returnValue(false);
|
||||
mockDomainObject.getCapability.and.returnValue(undefined);
|
||||
expect(SaveAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("only applies to domain object that has already been persisted",
|
||||
function () {
|
||||
mockDomainObject.getModel.andReturn({persisted: undefined});
|
||||
mockDomainObject.getModel.and.returnValue({persisted: undefined});
|
||||
expect(SaveAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
@ -118,11 +118,11 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
mockDialogHandle = jasmine.createSpyObj("dialogHandle", ["dismiss"]);
|
||||
mockDialogService.showBlockingMessage.andReturn(mockDialogHandle);
|
||||
mockDialogService.showBlockingMessage.and.returnValue(mockDialogHandle);
|
||||
});
|
||||
|
||||
it("shows a dialog while saving", function () {
|
||||
mockEditorCapability.save.andReturn(new Promise(function () {
|
||||
mockEditorCapability.save.and.returnValue(new Promise(function () {
|
||||
}));
|
||||
action.perform();
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
@ -137,12 +137,8 @@ define(
|
||||
|
||||
it("notifies if saving succeeded", function () {
|
||||
var mockCallback = jasmine.createSpy("callback");
|
||||
mockEditorCapability.save.andReturn(Promise.resolve("success"));
|
||||
action.perform().then(mockCallback);
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
runs(function () {
|
||||
mockEditorCapability.save.and.returnValue(Promise.resolve());
|
||||
return action.perform().then(mockCallback).then(function () {
|
||||
expect(mockNotificationService.info).toHaveBeenCalled();
|
||||
expect(mockNotificationService.error).not.toHaveBeenCalled();
|
||||
});
|
||||
@ -150,12 +146,8 @@ define(
|
||||
|
||||
it("notifies if saving failed", function () {
|
||||
var mockCallback = jasmine.createSpy("callback");
|
||||
mockEditorCapability.save.andReturn(Promise.reject("some failure reason"));
|
||||
action.perform().then(mockCallback);
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
runs(function () {
|
||||
mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason"));
|
||||
return action.perform().then(mockCallback).then(function () {
|
||||
expect(mockNotificationService.error).toHaveBeenCalled();
|
||||
expect(mockNotificationService.info).not.toHaveBeenCalled();
|
||||
});
|
||||
|
@ -86,13 +86,13 @@ define(
|
||||
["info", "error"]
|
||||
);
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andCallFake(function (capability) {
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.getModel.andReturn({ persisted: 0 });
|
||||
mockEditorCapability.save.andReturn(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockDomainObject.getModel.and.returnValue({ persisted: 0 });
|
||||
mockEditorCapability.save.and.returnValue(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
|
||||
action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext);
|
||||
});
|
||||
@ -102,18 +102,18 @@ define(
|
||||
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.getCapability.andReturn(undefined);
|
||||
mockDomainObject.hasCapability.and.returnValue(false);
|
||||
mockDomainObject.getCapability.and.returnValue(undefined);
|
||||
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("only applies to domain object that has already been persisted", function () {
|
||||
mockDomainObject.getModel.andReturn({ persisted: undefined });
|
||||
mockDomainObject.getModel.and.returnValue({ persisted: undefined });
|
||||
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("does not close the editor before completing the save", function () {
|
||||
mockEditorCapability.save.andReturn(new Promise(function () {
|
||||
mockEditorCapability.save.and.returnValue(new Promise(function () {
|
||||
}));
|
||||
action.perform();
|
||||
expect(mockEditorCapability.save).toHaveBeenCalled();
|
||||
|
@ -19,7 +19,7 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global describe,it,expect,beforeEach,jasmine,runs,waitsFor,spyOn*/
|
||||
/*global describe,it,expect,beforeEach,jasmine,spyOn*/
|
||||
|
||||
define(
|
||||
["../../src/actions/SaveAsAction"],
|
||||
@ -63,12 +63,12 @@ define(
|
||||
"getId"
|
||||
]
|
||||
);
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.getCapability.andCallFake(function (capability) {
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.getModel.andReturn({location: 'a', persisted: undefined});
|
||||
mockDomainObject.getId.andReturn(0);
|
||||
mockDomainObject.getModel.and.returnValue({location: 'a', persisted: undefined});
|
||||
mockDomainObject.getId.and.returnValue(0);
|
||||
|
||||
mockClonedObject = jasmine.createSpyObj(
|
||||
"clonedObject",
|
||||
@ -76,7 +76,7 @@ define(
|
||||
"getId"
|
||||
]
|
||||
);
|
||||
mockClonedObject.getId.andReturn(1);
|
||||
mockClonedObject.getId.and.returnValue(1);
|
||||
|
||||
mockParent = jasmine.createSpyObj(
|
||||
"parentObject",
|
||||
@ -91,9 +91,9 @@ define(
|
||||
"editor",
|
||||
["save", "finish", "isEditContextRoot"]
|
||||
);
|
||||
mockEditorCapability.save.andReturn(mockPromise(true));
|
||||
mockEditorCapability.finish.andReturn(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockEditorCapability.save.and.returnValue(mockPromise(true));
|
||||
mockEditorCapability.finish.and.returnValue(mockPromise(true));
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
capabilities.editor = mockEditorCapability;
|
||||
|
||||
mockActionCapability = jasmine.createSpyObj(
|
||||
@ -106,7 +106,7 @@ define(
|
||||
"objectService",
|
||||
["getObjects"]
|
||||
);
|
||||
mockObjectService.getObjects.andReturn(mockPromise({'a': mockParent}));
|
||||
mockObjectService.getObjects.and.returnValue(mockPromise({'a': mockParent}));
|
||||
|
||||
mockDialogService = jasmine.createSpyObj(
|
||||
"dialogService",
|
||||
@ -115,7 +115,7 @@ define(
|
||||
"showBlockingMessage"
|
||||
]
|
||||
);
|
||||
mockDialogService.getUserInput.andReturn(mockPromise(undefined));
|
||||
mockDialogService.getUserInput.and.returnValue(mockPromise(undefined));
|
||||
|
||||
mockCopyService = jasmine.createSpyObj(
|
||||
"copyService",
|
||||
@ -123,7 +123,7 @@ define(
|
||||
"perform"
|
||||
]
|
||||
);
|
||||
mockCopyService.perform.andReturn(mockPromise(mockClonedObject));
|
||||
mockCopyService.perform.and.returnValue(mockPromise(mockClonedObject));
|
||||
|
||||
mockNotificationService = jasmine.createSpyObj(
|
||||
"notificationService",
|
||||
@ -146,10 +146,10 @@ define(
|
||||
actionContext);
|
||||
|
||||
spyOn(action, "getObjectService");
|
||||
action.getObjectService.andReturn(mockObjectService);
|
||||
action.getObjectService.and.returnValue(mockObjectService);
|
||||
|
||||
spyOn(action, "createWizard");
|
||||
action.createWizard.andReturn({
|
||||
action.createWizard.and.returnValue({
|
||||
getFormStructure: noop,
|
||||
getInitialFormValue: noop,
|
||||
populateObjectFromInput: function () {
|
||||
@ -163,8 +163,8 @@ define(
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.getCapability.andReturn(undefined);
|
||||
mockDomainObject.hasCapability.and.returnValue(false);
|
||||
mockDomainObject.getCapability.and.returnValue(undefined);
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
@ -173,35 +173,27 @@ define(
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
mockDomainObject.getModel.andReturn({persisted: 0});
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 0});
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("uses the editor capability to save the object", function () {
|
||||
mockEditorCapability.save.andReturn(new Promise(function () {}));
|
||||
runs(function () {
|
||||
action.perform();
|
||||
});
|
||||
waitsFor(function () {
|
||||
return mockEditorCapability.save.calls.length > 0;
|
||||
}, "perform() should call EditorCapability.save");
|
||||
runs(function () {
|
||||
expect(mockEditorCapability.finish).not.toHaveBeenCalled();
|
||||
mockEditorCapability.save.and.returnValue(Promise.resolve());
|
||||
|
||||
return action.perform().then(function () {
|
||||
expect(mockEditorCapability.save).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the editor capability to finish editing the object", function () {
|
||||
runs(function () {
|
||||
action.perform();
|
||||
return action.perform().then(function () {
|
||||
expect(mockEditorCapability.finish.calls.count()).toBeGreaterThan(0);
|
||||
});
|
||||
waitsFor(function () {
|
||||
return mockEditorCapability.finish.calls.length > 0;
|
||||
}, "perform() should call EditorCapability.finish");
|
||||
});
|
||||
|
||||
it("returns to browse after save", function () {
|
||||
spyOn(action, "save");
|
||||
action.save.andReturn(mockPromise(mockDomainObject));
|
||||
action.save.and.returnValue(mockPromise(mockDomainObject));
|
||||
action.perform();
|
||||
expect(mockActionCapability.perform).toHaveBeenCalledWith(
|
||||
"navigate"
|
||||
@ -218,48 +210,33 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
mockDialogHandle = jasmine.createSpyObj("dialogHandle", ["dismiss"]);
|
||||
mockDialogService.showBlockingMessage.andReturn(mockDialogHandle);
|
||||
mockDialogService.showBlockingMessage.and.returnValue(mockDialogHandle);
|
||||
});
|
||||
|
||||
it("shows a blocking dialog indicating that saving is in progress", function () {
|
||||
mockEditorCapability.save.andReturn(new Promise(function () {}));
|
||||
mockEditorCapability.save.and.returnValue(new Promise(function () {}));
|
||||
action.perform();
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
expect(mockDialogHandle.dismiss).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("hides the blocking dialog after saving finishes", function () {
|
||||
var mockCallback = jasmine.createSpy();
|
||||
action.perform().then(mockCallback);
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
runs(function () {
|
||||
return action.perform().then(function () {
|
||||
expect(mockDialogService.showBlockingMessage).toHaveBeenCalled();
|
||||
expect(mockDialogHandle.dismiss).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("notifies if saving succeeded", function () {
|
||||
var mockCallback = jasmine.createSpy();
|
||||
action.perform().then(mockCallback);
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
runs(function () {
|
||||
return action.perform().then(function () {
|
||||
expect(mockNotificationService.info).toHaveBeenCalled();
|
||||
expect(mockNotificationService.error).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("notifies if saving failed", function () {
|
||||
mockCopyService.perform.andReturn(Promise.reject("some failure reason"));
|
||||
var mockCallback = jasmine.createSpy();
|
||||
action.perform().then(mockCallback);
|
||||
waitsFor(function () {
|
||||
return mockCallback.calls.length > 0;
|
||||
});
|
||||
runs(function () {
|
||||
mockCopyService.perform.and.returnValue(Promise.reject("some failure reason"));
|
||||
action.perform().then(function () {
|
||||
expect(mockNotificationService.error).toHaveBeenCalled();
|
||||
expect(mockNotificationService.info).not.toHaveBeenCalled();
|
||||
});
|
||||
|
@ -60,8 +60,8 @@ define(
|
||||
"cancel"
|
||||
]
|
||||
);
|
||||
mockTransactionService.commit.andReturn(fastPromise());
|
||||
mockTransactionService.cancel.andReturn(fastPromise());
|
||||
mockTransactionService.commit.and.returnValue(fastPromise());
|
||||
mockTransactionService.cancel.and.returnValue(fastPromise());
|
||||
mockTransactionService.isActive = jasmine.createSpy('isActive');
|
||||
|
||||
mockStatusCapability = jasmine.createSpyObj(
|
||||
@ -76,23 +76,23 @@ define(
|
||||
"contextCapability",
|
||||
["getParent"]
|
||||
);
|
||||
mockContextCapability.getParent.andReturn(mockParentObject);
|
||||
mockContextCapability.getParent.and.returnValue(mockParentObject);
|
||||
|
||||
capabilities = {
|
||||
context: mockContextCapability,
|
||||
status: mockStatusCapability
|
||||
};
|
||||
|
||||
mockDomainObject.hasCapability.andCallFake(function (name) {
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return capabilities[name] !== undefined;
|
||||
});
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function (name) {
|
||||
mockDomainObject.getCapability.and.callFake(function (name) {
|
||||
return capabilities[name];
|
||||
});
|
||||
|
||||
mockParentObject.getCapability.andReturn(mockParentStatus);
|
||||
mockParentObject.hasCapability.andReturn(false);
|
||||
mockParentObject.getCapability.and.returnValue(mockParentStatus);
|
||||
mockParentObject.hasCapability.and.returnValue(false);
|
||||
|
||||
capability = new EditorCapability(
|
||||
mockTransactionService,
|
||||
@ -112,18 +112,18 @@ define(
|
||||
|
||||
it("uses editing status to determine editing context root", function () {
|
||||
capability.edit();
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
mockStatusCapability.get.and.returnValue(false);
|
||||
expect(capability.isEditContextRoot()).toBe(false);
|
||||
mockStatusCapability.get.andReturn(true);
|
||||
mockStatusCapability.get.and.returnValue(true);
|
||||
expect(capability.isEditContextRoot()).toBe(true);
|
||||
});
|
||||
|
||||
it("inEditingContext returns true if parent object is being" +
|
||||
" edited", function () {
|
||||
mockStatusCapability.get.andReturn(false);
|
||||
mockParentStatus.get.andReturn(false);
|
||||
mockStatusCapability.get.and.returnValue(false);
|
||||
mockParentStatus.get.and.returnValue(false);
|
||||
expect(capability.inEditContext()).toBe(false);
|
||||
mockParentStatus.get.andReturn(true);
|
||||
mockParentStatus.get.and.returnValue(true);
|
||||
expect(capability.inEditContext()).toBe(true);
|
||||
});
|
||||
|
||||
@ -142,7 +142,7 @@ define(
|
||||
|
||||
describe("finish", function () {
|
||||
beforeEach(function () {
|
||||
mockTransactionService.isActive.andReturn(true);
|
||||
mockTransactionService.isActive.and.returnValue(true);
|
||||
capability.edit();
|
||||
capability.finish();
|
||||
});
|
||||
@ -156,7 +156,7 @@ define(
|
||||
|
||||
describe("finish", function () {
|
||||
beforeEach(function () {
|
||||
mockTransactionService.isActive.andReturn(false);
|
||||
mockTransactionService.isActive.and.returnValue(false);
|
||||
capability.edit();
|
||||
});
|
||||
|
||||
@ -175,15 +175,15 @@ define(
|
||||
var model = {};
|
||||
|
||||
beforeEach(function () {
|
||||
mockDomainObject.getModel.andReturn(model);
|
||||
mockDomainObject.getModel.and.returnValue(model);
|
||||
capability.edit();
|
||||
capability.finish();
|
||||
});
|
||||
it("returns true if the object has been modified since it" +
|
||||
" was last persisted", function () {
|
||||
mockTransactionService.size.andReturn(0);
|
||||
mockTransactionService.size.and.returnValue(0);
|
||||
expect(capability.dirty()).toBe(false);
|
||||
mockTransactionService.size.andReturn(1);
|
||||
mockTransactionService.size.and.returnValue(1);
|
||||
expect(capability.dirty()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ define(
|
||||
mockQ = {};
|
||||
mockTransactionService = {};
|
||||
mockCapabilityService = jasmine.createSpyObj("capabilityService", ["getCapabilities"]);
|
||||
mockCapabilityService.getCapabilities.andReturn({
|
||||
mockCapabilityService.getCapabilities.and.returnValue({
|
||||
persistence: function () {}
|
||||
});
|
||||
|
||||
|
@ -47,7 +47,7 @@ define(
|
||||
testId = "test-id";
|
||||
|
||||
mockQ = jasmine.createSpyObj("$q", ["when"]);
|
||||
mockQ.when.andCallFake(function (val) {
|
||||
mockQ.when.and.callFake(function (val) {
|
||||
return fastPromise(val);
|
||||
});
|
||||
mockTransactionManager = jasmine.createSpyObj(
|
||||
@ -58,15 +58,15 @@ define(
|
||||
"persistenceCapability",
|
||||
["persist", "refresh", "getSpace"]
|
||||
);
|
||||
mockPersistence.persist.andReturn(fastPromise());
|
||||
mockPersistence.refresh.andReturn(fastPromise());
|
||||
mockPersistence.persist.and.returnValue(fastPromise());
|
||||
mockPersistence.refresh.and.returnValue(fastPromise());
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getModel", "getId"]
|
||||
);
|
||||
mockDomainObject.getModel.andReturn({persisted: 1});
|
||||
mockDomainObject.getId.andReturn(testId);
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 1});
|
||||
mockDomainObject.getId.and.returnValue(testId);
|
||||
|
||||
capability = new TransactionalPersistenceCapability(
|
||||
mockQ,
|
||||
@ -78,24 +78,24 @@ define(
|
||||
|
||||
it("if no transaction is active, passes through to persistence" +
|
||||
" provider", function () {
|
||||
mockTransactionManager.isActive.andReturn(false);
|
||||
mockTransactionManager.isActive.and.returnValue(false);
|
||||
capability.persist();
|
||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("if transaction is active, persist and cancel calls are" +
|
||||
" queued", function () {
|
||||
mockTransactionManager.isActive.andReturn(true);
|
||||
mockTransactionManager.isActive.and.returnValue(true);
|
||||
capability.persist();
|
||||
expect(mockTransactionManager.addToTransaction).toHaveBeenCalled();
|
||||
mockTransactionManager.addToTransaction.mostRecentCall.args[1]();
|
||||
mockTransactionManager.addToTransaction.calls.mostRecent().args[1]();
|
||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
||||
mockTransactionManager.addToTransaction.mostRecentCall.args[2]();
|
||||
mockTransactionManager.addToTransaction.calls.mostRecent().args[2]();
|
||||
expect(mockPersistence.refresh).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("wraps getSpace", function () {
|
||||
mockPersistence.getSpace.andReturn('foo');
|
||||
mockPersistence.getSpace.and.returnValue('foo');
|
||||
expect(capability.getSpace()).toEqual('foo');
|
||||
});
|
||||
|
||||
|
@ -38,7 +38,7 @@ define(
|
||||
jasmine.createSpyObj("mockSaveAction", ["getMetadata", "perform"])
|
||||
];
|
||||
mockedSaveActions.forEach(function (action) {
|
||||
action.getMetadata.andReturn(mockSaveActionMetadata);
|
||||
action.getMetadata.and.returnValue(mockSaveActionMetadata);
|
||||
});
|
||||
return mockedSaveActions;
|
||||
} else if (actionContext.category === "conclude-editing") {
|
||||
@ -54,14 +54,14 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
mockActions = jasmine.createSpyObj("action", ["getActions"]);
|
||||
mockActions.getActions.andCallFake(fakeGetActions);
|
||||
mockActions.getActions.and.callFake(fakeGetActions);
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
|
||||
mockScope.action = mockActions;
|
||||
controller = new EditActionController(mockScope);
|
||||
});
|
||||
|
||||
function makeControllerUpdateActions() {
|
||||
mockScope.$watch.mostRecentCall.args[1]();
|
||||
mockScope.$watch.calls.mostRecent().args[1]();
|
||||
}
|
||||
|
||||
it("watches scope that may change applicable actions", function () {
|
||||
|
@ -61,17 +61,17 @@ define(
|
||||
mockLocation = jasmine.createSpyObj('$location',
|
||||
["search"]
|
||||
);
|
||||
mockLocation.search.andReturn({"view": "fixed"});
|
||||
mockLocation.search.and.returnValue({"view": "fixed"});
|
||||
mockNavigationService = jasmine.createSpyObj('navigationService',
|
||||
["checkBeforeNavigation"]
|
||||
);
|
||||
|
||||
removeCheck = jasmine.createSpy('removeCheck');
|
||||
mockNavigationService.checkBeforeNavigation.andReturn(removeCheck);
|
||||
mockNavigationService.checkBeforeNavigation.and.returnValue(removeCheck);
|
||||
|
||||
mockObject.getId.andReturn("test");
|
||||
mockObject.getModel.andReturn({ name: "Test object" });
|
||||
mockObject.getCapability.andCallFake(function (key) {
|
||||
mockObject.getId.and.returnValue("test");
|
||||
mockObject.getModel.and.returnValue({ name: "Test object" });
|
||||
mockObject.getCapability.and.callFake(function (key) {
|
||||
return mockCapabilities[key];
|
||||
});
|
||||
|
||||
@ -81,10 +81,10 @@ define(
|
||||
{ key: 'xyz' }
|
||||
];
|
||||
|
||||
mockObject.useCapability.andCallFake(function (c) {
|
||||
mockObject.useCapability.and.callFake(function (c) {
|
||||
return (c === 'view') && testViews;
|
||||
});
|
||||
mockLocation.search.andReturn({ view: 'def' });
|
||||
mockLocation.search.and.returnValue({ view: 'def' });
|
||||
|
||||
mockScope.domainObject = mockObject;
|
||||
|
||||
@ -99,17 +99,17 @@ define(
|
||||
expect(mockNavigationService.checkBeforeNavigation)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
|
||||
var checkFn = mockNavigationService.checkBeforeNavigation.mostRecentCall.args[0];
|
||||
var checkFn = mockNavigationService.checkBeforeNavigation.calls.mostRecent().args[0];
|
||||
|
||||
mockEditorCapability.isEditContextRoot.andReturn(false);
|
||||
mockEditorCapability.dirty.andReturn(false);
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(false);
|
||||
mockEditorCapability.dirty.and.returnValue(false);
|
||||
|
||||
expect(checkFn()).toBe("Continuing will cause the loss of any unsaved changes.");
|
||||
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
expect(checkFn()).toBe("Continuing will cause the loss of any unsaved changes.");
|
||||
|
||||
mockEditorCapability.dirty.andReturn(true);
|
||||
mockEditorCapability.dirty.and.returnValue(true);
|
||||
expect(checkFn())
|
||||
.toBe("Continuing will cause the loss of any unsaved changes.");
|
||||
|
||||
@ -119,7 +119,7 @@ define(
|
||||
expect(mockScope.$on)
|
||||
.toHaveBeenCalledWith("$destroy", jasmine.any(Function));
|
||||
|
||||
mockScope.$on.mostRecentCall.args[1]();
|
||||
mockScope.$on.calls.mostRecent().args[1]();
|
||||
|
||||
expect(mockEditorCapability.finish).toHaveBeenCalled();
|
||||
expect(removeCheck).toHaveBeenCalled();
|
||||
|
@ -41,13 +41,13 @@ define(
|
||||
['getTrueRoot']
|
||||
);
|
||||
|
||||
mockDomainObject.getId.andReturn('test-id');
|
||||
mockDomainObject.getCapability.andReturn(mockContext);
|
||||
mockDomainObject.getId.and.returnValue('test-id');
|
||||
mockDomainObject.getCapability.and.returnValue(mockContext);
|
||||
|
||||
// Return a new instance of the root object each time
|
||||
mockContext.getTrueRoot.andCallFake(function () {
|
||||
mockContext.getTrueRoot.and.callFake(function () {
|
||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||
mockRoot.getId.andReturn('root-id');
|
||||
mockRoot.getId.and.returnValue('root-id');
|
||||
return mockRoot;
|
||||
});
|
||||
|
||||
@ -63,7 +63,7 @@ define(
|
||||
});
|
||||
|
||||
it("exposes the root object found via the object's context capability", function () {
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
|
||||
// Verify that the correct capability was used
|
||||
expect(mockDomainObject.getCapability)
|
||||
@ -76,10 +76,10 @@ define(
|
||||
it("preserves the same root instance to avoid excessive refreshing", function () {
|
||||
var firstRoot;
|
||||
// Expose the domain object
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
firstRoot = controller.getRoot();
|
||||
// Update!
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
// Should still have the same object instance, to avoid
|
||||
// triggering the watch used by the template we're supporting
|
||||
expect(controller.getRoot()).toBe(firstRoot);
|
||||
@ -90,18 +90,18 @@ define(
|
||||
it("updates the root when it changes", function () {
|
||||
var firstRoot;
|
||||
// Expose the domain object
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
firstRoot = controller.getRoot();
|
||||
|
||||
// Change the exposed root
|
||||
mockContext.getTrueRoot.andCallFake(function () {
|
||||
mockContext.getTrueRoot.and.callFake(function () {
|
||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||
mockRoot.getId.andReturn('other-root-id');
|
||||
mockRoot.getId.and.returnValue('other-root-id');
|
||||
return mockRoot;
|
||||
});
|
||||
|
||||
// Update!
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
|
||||
// Should still have the same object instance, to avoid
|
||||
// triggering the watch used by the template we're supporting
|
||||
|
@ -63,13 +63,13 @@ define(
|
||||
mockMutationCapability = jasmine.createSpyObj("mutationCapability", [
|
||||
"listen"
|
||||
]);
|
||||
mockMutationCapability.listen.andReturn(mockUnlisten);
|
||||
mockMutationCapability.listen.and.returnValue(mockUnlisten);
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", [
|
||||
"getCapability",
|
||||
"useCapability"
|
||||
]);
|
||||
mockDomainObject.useCapability.andReturn(mockCompositionCapability);
|
||||
mockDomainObject.getCapability.andReturn(mockMutationCapability);
|
||||
mockDomainObject.useCapability.and.returnValue(mockCompositionCapability);
|
||||
mockDomainObject.getCapability.and.returnValue(mockMutationCapability);
|
||||
|
||||
mockScope = jasmine.createSpyObj("$scope", ['$on']);
|
||||
mockSelection = jasmine.createSpyObj("selection", [
|
||||
@ -77,7 +77,7 @@ define(
|
||||
'off',
|
||||
'get'
|
||||
]);
|
||||
mockSelection.get.andReturn([]);
|
||||
mockSelection.get.and.returnValue([]);
|
||||
mockOpenMCT = {
|
||||
selection: mockSelection
|
||||
};
|
||||
@ -88,7 +88,7 @@ define(
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(ElementsController.prototype, 'refreshComposition').andCallThrough();
|
||||
spyOn(ElementsController.prototype, 'refreshComposition').and.callThrough();
|
||||
|
||||
controller = new ElementsController(mockScope, mockOpenMCT);
|
||||
});
|
||||
@ -123,29 +123,29 @@ define(
|
||||
});
|
||||
|
||||
it("refreshes composition on selection", function () {
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
mockOpenMCT.selection.on.calls.mostRecent().args[1](selectable);
|
||||
|
||||
expect(ElementsController.prototype.refreshComposition).toHaveBeenCalledWith(mockDomainObject);
|
||||
});
|
||||
|
||||
it("listens on mutation and refreshes composition", function () {
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
mockOpenMCT.selection.on.calls.mostRecent().args[1](selectable);
|
||||
|
||||
expect(mockDomainObject.getCapability).toHaveBeenCalledWith('mutation');
|
||||
expect(mockMutationCapability.listen).toHaveBeenCalled();
|
||||
expect(ElementsController.prototype.refreshComposition.calls.length).toBe(1);
|
||||
expect(ElementsController.prototype.refreshComposition.calls.count()).toBe(1);
|
||||
|
||||
mockMutationCapability.listen.mostRecentCall.args[0](mockDomainObject);
|
||||
mockMutationCapability.listen.calls.mostRecent().args[0](mockDomainObject);
|
||||
|
||||
expect(ElementsController.prototype.refreshComposition.calls.length).toBe(2);
|
||||
expect(ElementsController.prototype.refreshComposition.calls.count()).toBe(2);
|
||||
});
|
||||
|
||||
it("cleans up mutation listener when selection changes", function () {
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
mockOpenMCT.selection.on.calls.mostRecent().args[1](selectable);
|
||||
|
||||
expect(mockMutationCapability.listen).toHaveBeenCalled();
|
||||
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
mockOpenMCT.selection.on.calls.mostRecent().args[1](selectable);
|
||||
|
||||
expect(mockUnlisten).toHaveBeenCalled();
|
||||
});
|
||||
@ -156,7 +156,7 @@ define(
|
||||
elementProxy: {}
|
||||
}
|
||||
};
|
||||
mockOpenMCT.selection.on.mostRecentCall.args[1](selectable);
|
||||
mockOpenMCT.selection.on.calls.mostRecent().args[1](selectable);
|
||||
|
||||
expect(mockDomainObject.getCapability).not.toHaveBeenCalledWith('mutation');
|
||||
});
|
||||
@ -167,13 +167,13 @@ define(
|
||||
firstCompositionCallback,
|
||||
secondCompositionCallback;
|
||||
|
||||
spyOn(mockCompositionCapability, "then").andCallThrough();
|
||||
spyOn(mockCompositionCapability, "then").and.callThrough();
|
||||
|
||||
controller.refreshComposition(mockDomainObject);
|
||||
controller.refreshComposition(mockDomainObject);
|
||||
|
||||
firstCompositionCallback = mockCompositionCapability.then.calls[0].args[0];
|
||||
secondCompositionCallback = mockCompositionCapability.then.calls[1].args[0];
|
||||
firstCompositionCallback = mockCompositionCapability.then.calls.all()[0].args[0];
|
||||
secondCompositionCallback = mockCompositionCapability.then.calls.all()[1].args[0];
|
||||
secondCompositionCallback(secondMockCompositionObjects);
|
||||
firstCompositionCallback(mockCompositionObjects);
|
||||
|
||||
|
@ -51,9 +51,9 @@ define(
|
||||
"hasFeature"
|
||||
]
|
||||
);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockType.getName.andReturn(name);
|
||||
mockType.getKey.andReturn(name);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
mockType.getName.and.returnValue(name);
|
||||
mockType.getKey.and.returnValue(name);
|
||||
return mockType;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ define(
|
||||
mockTypeMap[type.getKey()] = type;
|
||||
});
|
||||
|
||||
mockTypeService.getType.andCallFake(function (key) {
|
||||
mockTypeService.getType.and.callFake(function (key) {
|
||||
return mockTypeMap[key];
|
||||
});
|
||||
|
||||
|
@ -49,8 +49,8 @@ define(
|
||||
"hasFeature"
|
||||
]
|
||||
);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockType.getName.andReturn(name);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
mockType.getName.and.returnValue(name);
|
||||
return mockType;
|
||||
}
|
||||
|
||||
@ -74,11 +74,11 @@ define(
|
||||
return mockPolicyMap[type.getName()];
|
||||
};
|
||||
|
||||
mockPolicyService.allow.andCallFake(function (category, type) {
|
||||
mockPolicyService.allow.and.callFake(function (category, type) {
|
||||
return category === "creation" && mockCreationPolicy(type) ? true : false;
|
||||
});
|
||||
|
||||
mockTypeService.listTypes.andReturn(mockTypes);
|
||||
mockTypeService.listTypes.and.returnValue(mockTypes);
|
||||
|
||||
provider = new CreateActionProvider(
|
||||
mockTypeService,
|
||||
|
@ -77,10 +77,10 @@ define(
|
||||
"useCapability"
|
||||
]
|
||||
);
|
||||
mockDomainObject.hasCapability.andCallFake(function (name) {
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return !!capabilities[name];
|
||||
});
|
||||
mockDomainObject.getCapability.andCallFake(function (name) {
|
||||
mockDomainObject.getCapability.and.callFake(function (name) {
|
||||
return capabilities[name];
|
||||
});
|
||||
mockSaveAction = jasmine.createSpyObj(
|
||||
@ -117,14 +117,14 @@ define(
|
||||
mockContext = {
|
||||
domainObject: mockParent
|
||||
};
|
||||
mockParent.useCapability.andReturn(mockDomainObject);
|
||||
mockParent.useCapability.and.returnValue(mockDomainObject);
|
||||
|
||||
mockType.getKey.andReturn("test");
|
||||
mockType.getCssClass.andReturn("icon-telemetry");
|
||||
mockType.getDescription.andReturn("a test type");
|
||||
mockType.getName.andReturn("Test");
|
||||
mockType.getProperties.andReturn([]);
|
||||
mockType.getInitialModel.andReturn({});
|
||||
mockType.getKey.and.returnValue("test");
|
||||
mockType.getCssClass.and.returnValue("icon-telemetry");
|
||||
mockType.getDescription.and.returnValue("a test type");
|
||||
mockType.getName.and.returnValue("Test");
|
||||
mockType.getProperties.and.returnValue([]);
|
||||
mockType.getInitialModel.and.returnValue({});
|
||||
|
||||
action = new CreateAction(
|
||||
mockType,
|
||||
@ -144,7 +144,7 @@ define(
|
||||
describe("the perform function", function () {
|
||||
var promise = jasmine.createSpyObj("promise", ["then"]);
|
||||
beforeEach(function () {
|
||||
capabilities.action.getActions.andReturn([mockEditAction]);
|
||||
capabilities.action.getActions.and.returnValue([mockEditAction]);
|
||||
});
|
||||
|
||||
it("uses the instantiation capability when performed", function () {
|
||||
@ -159,30 +159,30 @@ define(
|
||||
|
||||
it("uses the save-as action if object does not have an edit action" +
|
||||
" available", function () {
|
||||
capabilities.action.getActions.andReturn([]);
|
||||
capabilities.action.perform.andReturn(mockPromise(undefined));
|
||||
capabilities.editor.save.andReturn(promise);
|
||||
capabilities.action.getActions.and.returnValue([]);
|
||||
capabilities.action.perform.and.returnValue(mockPromise(undefined));
|
||||
capabilities.editor.save.and.returnValue(promise);
|
||||
action.perform();
|
||||
expect(capabilities.action.perform).toHaveBeenCalledWith("save-as");
|
||||
});
|
||||
|
||||
describe("uses to editor capability", function () {
|
||||
beforeEach(function () {
|
||||
capabilities.action.getActions.andReturn([]);
|
||||
capabilities.action.perform.andReturn(promise);
|
||||
capabilities.editor.save.andReturn(promise);
|
||||
capabilities.action.getActions.and.returnValue([]);
|
||||
capabilities.action.perform.and.returnValue(promise);
|
||||
capabilities.editor.save.and.returnValue(promise);
|
||||
});
|
||||
|
||||
it("to save the edit if user saves dialog", function () {
|
||||
action.perform();
|
||||
expect(promise.then).toHaveBeenCalled();
|
||||
promise.then.mostRecentCall.args[0]();
|
||||
promise.then.calls.mostRecent().args[0]();
|
||||
expect(capabilities.editor.save).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("to finish the edit if user cancels dialog", function () {
|
||||
action.perform();
|
||||
promise.then.mostRecentCall.args[1]();
|
||||
promise.then.calls.mostRecent().args[1]();
|
||||
expect(capabilities.editor.finish).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -49,10 +49,10 @@ define(
|
||||
it("populates the scope with create actions", function () {
|
||||
mockScope.action = mockActions;
|
||||
|
||||
mockActions.getActions.andReturn(["a", "b", "c"]);
|
||||
mockActions.getActions.and.returnValue(["a", "b", "c"]);
|
||||
|
||||
// Call the watch
|
||||
mockScope.$watch.mostRecentCall.args[1]();
|
||||
mockScope.$watch.calls.mostRecent().args[1]();
|
||||
|
||||
// Should have grouped and ungrouped actions in scope now
|
||||
expect(mockScope.createActions.length).toEqual(3);
|
||||
|
@ -41,10 +41,10 @@ define(
|
||||
"property" + name,
|
||||
["getDefinition", "getValue", "setValue"]
|
||||
);
|
||||
mockProperty.getDefinition.andReturn({
|
||||
mockProperty.getDefinition.and.returnValue({
|
||||
control: "textfield"
|
||||
});
|
||||
mockProperty.getValue.andReturn(name);
|
||||
mockProperty.getValue.and.returnValue(name);
|
||||
return mockProperty;
|
||||
}
|
||||
|
||||
@ -74,12 +74,12 @@ define(
|
||||
|
||||
testModel = { someKey: "some value" };
|
||||
|
||||
mockType.getKey.andReturn("test");
|
||||
mockType.getCssClass.andReturn("icon-telemetry");
|
||||
mockType.getDescription.andReturn("a test type");
|
||||
mockType.getName.andReturn("Test");
|
||||
mockType.getInitialModel.andReturn(testModel);
|
||||
mockType.getProperties.andReturn(mockProperties);
|
||||
mockType.getKey.and.returnValue("test");
|
||||
mockType.getCssClass.and.returnValue("icon-telemetry");
|
||||
mockType.getDescription.and.returnValue("a test type");
|
||||
mockType.getName.and.returnValue("Test");
|
||||
mockType.getInitialModel.and.returnValue(testModel);
|
||||
mockType.getProperties.and.returnValue(mockProperties);
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
@ -87,9 +87,9 @@ define(
|
||||
);
|
||||
|
||||
//Mocking the getCapability('type') call
|
||||
mockDomainObject.getCapability.andReturn(mockType);
|
||||
mockDomainObject.useCapability.andReturn();
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
mockDomainObject.getCapability.and.returnValue(mockType);
|
||||
mockDomainObject.useCapability.and.returnValue();
|
||||
mockDomainObject.getModel.and.returnValue(testModel);
|
||||
|
||||
wizard = new CreateWizard(
|
||||
mockDomainObject,
|
||||
@ -147,9 +147,11 @@ define(
|
||||
"C": "ValueC"
|
||||
},
|
||||
compareModel = wizard.createModel(formValue);
|
||||
//populateObjectFromInput adds a .location attribute that is not added by createModel.
|
||||
compareModel.location = undefined;
|
||||
wizard.populateObjectFromInput(formValue);
|
||||
expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function));
|
||||
expect(mockDomainObject.useCapability.mostRecentCall.args[1]()).toEqual(compareModel);
|
||||
expect(mockDomainObject.useCapability.calls.mostRecent().args[1]()).toEqual(compareModel);
|
||||
});
|
||||
|
||||
it("validates selection types using policy", function () {
|
||||
@ -168,7 +170,7 @@ define(
|
||||
rows = structure.sections[sections.length - 1].rows,
|
||||
locationRow = rows[rows.length - 1];
|
||||
|
||||
mockDomainObj.getCapability.andReturn(mockOtherType);
|
||||
mockDomainObj.getCapability.and.returnValue(mockOtherType);
|
||||
locationRow.validate(mockDomainObj);
|
||||
|
||||
// Should check policy to see if the user-selected location
|
||||
|
@ -38,12 +38,12 @@ define(
|
||||
});
|
||||
|
||||
it("allows creation of types with the creation feature", function () {
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
expect(policy.allow(mockType)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("disallows creation of types without the creation feature", function () {
|
||||
mockType.hasFeature.andReturn(false);
|
||||
mockType.hasFeature.and.returnValue(false);
|
||||
expect(policy.allow(mockType)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
@ -103,33 +103,33 @@ define(
|
||||
["persist", "getSpace"]
|
||||
);
|
||||
|
||||
mockParentObject.getCapability.andCallFake(function (key) {
|
||||
mockParentObject.getCapability.and.callFake(function (key) {
|
||||
return mockCapabilities[key];
|
||||
});
|
||||
mockParentObject.useCapability.andCallFake(function (key, value) {
|
||||
mockParentObject.useCapability.and.callFake(function (key, value) {
|
||||
return mockCapabilities[key].invoke(value);
|
||||
});
|
||||
mockParentObject.getId.andReturn('parentId');
|
||||
mockParentObject.getId.and.returnValue('parentId');
|
||||
|
||||
mockNewObject.getId.andReturn('newId');
|
||||
mockNewObject.getCapability.andCallFake(function (c) {
|
||||
mockNewObject.getId.and.returnValue('newId');
|
||||
mockNewObject.getCapability.and.callFake(function (c) {
|
||||
return c === 'persistence' ?
|
||||
mockNewPersistenceCapability : undefined;
|
||||
});
|
||||
|
||||
mockPersistenceCapability.persist
|
||||
.andReturn(mockPromise(true));
|
||||
.and.returnValue(mockPromise(true));
|
||||
mockNewPersistenceCapability.persist
|
||||
.andReturn(mockPromise(true));
|
||||
.and.returnValue(mockPromise(true));
|
||||
|
||||
mockMutationCapability.invoke.andReturn(mockPromise(true));
|
||||
mockPersistenceCapability.getSpace.andReturn("testSpace");
|
||||
mockCompositionCapability.invoke.andReturn(
|
||||
mockMutationCapability.invoke.and.returnValue(mockPromise(true));
|
||||
mockPersistenceCapability.getSpace.and.returnValue("testSpace");
|
||||
mockCompositionCapability.invoke.and.returnValue(
|
||||
mockPromise([mockNewObject])
|
||||
);
|
||||
mockCompositionCapability.add.andReturn(mockPromise(true));
|
||||
mockCreationCapability.instantiate.andReturn(mockNewObject);
|
||||
mockCreationCapability.invoke.andCallFake(function (model) {
|
||||
mockCompositionCapability.add.and.returnValue(mockPromise(true));
|
||||
mockCreationCapability.instantiate.and.returnValue(mockNewObject);
|
||||
mockCreationCapability.invoke.and.callFake(function (model) {
|
||||
return mockCreationCapability.instantiate(model);
|
||||
});
|
||||
|
||||
@ -163,10 +163,10 @@ define(
|
||||
mockCallback = jasmine.createSpy('callback');
|
||||
|
||||
// Act as if the object had been created
|
||||
mockCompositionCapability.add.andCallFake(function (id) {
|
||||
mockDomainObject.getId.andReturn(id);
|
||||
mockCompositionCapability.add.and.callFake(function (id) {
|
||||
mockDomainObject.getId.and.returnValue(id);
|
||||
mockCompositionCapability.invoke
|
||||
.andReturn(mockPromise([mockDomainObject]));
|
||||
.and.returnValue(mockPromise([mockDomainObject]));
|
||||
return mockPromise(mockDomainObject);
|
||||
});
|
||||
|
||||
@ -200,7 +200,7 @@ define(
|
||||
// created object - this is an error.
|
||||
var model = { someKey: "some value" };
|
||||
|
||||
mockCompositionCapability.add.andReturn(mockPromise(false));
|
||||
mockCompositionCapability.add.and.returnValue(mockPromise(false));
|
||||
|
||||
creationService.createObject(model, mockParentObject);
|
||||
|
||||
|
@ -31,26 +31,63 @@ define(
|
||||
var mockScope,
|
||||
mockTimeout,
|
||||
mockDomainObject,
|
||||
mockFolderObject,
|
||||
mockRootObject,
|
||||
mockContext,
|
||||
mockActions,
|
||||
mockObjectService,
|
||||
mockTypeService,
|
||||
mockType,
|
||||
mockInstantiate,
|
||||
mockPolicyService,
|
||||
getObjectsPromise,
|
||||
testModel,
|
||||
capabilities,
|
||||
mockCreateNewFolderAction,
|
||||
mockActionCapability,
|
||||
mockProperties,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
["$watch"]
|
||||
["$watch", "validParent"]
|
||||
);
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
mockInstantiate = jasmine.createSpy("instantiate");
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
["getCapability"]
|
||||
[
|
||||
"useCapability",
|
||||
"getModel",
|
||||
"getCapability"
|
||||
]
|
||||
);
|
||||
mockFolderObject = jasmine.createSpyObj(
|
||||
"folderObject",
|
||||
[
|
||||
"useCapability",
|
||||
"getModel",
|
||||
"getCapability"
|
||||
]
|
||||
);
|
||||
mockCreateNewFolderAction = jasmine.createSpyObj(
|
||||
"createNewFolderAction",
|
||||
[
|
||||
"perform"
|
||||
]
|
||||
);
|
||||
mockRootObject = jasmine.createSpyObj(
|
||||
"rootObject",
|
||||
["getCapability"]
|
||||
);
|
||||
mockActionCapability = jasmine.createSpyObj(
|
||||
"actionCapability",
|
||||
[
|
||||
"getActions",
|
||||
"perform"
|
||||
]
|
||||
);
|
||||
mockContext = jasmine.createSpyObj(
|
||||
"context",
|
||||
["getRoot"]
|
||||
@ -59,25 +96,70 @@ define(
|
||||
"objectService",
|
||||
["getObjects"]
|
||||
);
|
||||
mockTypeService = jasmine.createSpyObj(
|
||||
"typeService",
|
||||
["getType"]
|
||||
);
|
||||
mockPolicyService = jasmine.createSpyObj(
|
||||
"policyService",
|
||||
["allow"]
|
||||
);
|
||||
getObjectsPromise = jasmine.createSpyObj(
|
||||
"promise",
|
||||
["then"]
|
||||
);
|
||||
|
||||
mockDomainObject.getCapability.andReturn(mockContext);
|
||||
mockContext.getRoot.andReturn(mockRootObject);
|
||||
mockObjectService.getObjects.andReturn(getObjectsPromise);
|
||||
|
||||
mockType = jasmine.createSpyObj(
|
||||
"type",
|
||||
[
|
||||
"getKey",
|
||||
"getProperties",
|
||||
"getInitialModel"
|
||||
]
|
||||
);
|
||||
testModel = { someKey: "some value" };
|
||||
mockProperties = ['a', 'b', 'c'].map(function (k) {
|
||||
var mockProperty = jasmine.createSpyObj(
|
||||
'property-' + k,
|
||||
['propertyDefinition']
|
||||
);
|
||||
mockProperty.propertyDefinition = {
|
||||
key: "name",
|
||||
pattern: "test"
|
||||
};
|
||||
return mockProperty;
|
||||
});
|
||||
capabilities = {
|
||||
"action" : mockActionCapability,
|
||||
"context": mockContext
|
||||
};
|
||||
mockActions = [mockCreateNewFolderAction];
|
||||
mockContext.getRoot.and.returnValue(mockRootObject);
|
||||
mockObjectService.getObjects.and.returnValue(getObjectsPromise);
|
||||
mockTypeService.getType.and.callFake(function (typename) {
|
||||
return mockType;
|
||||
});
|
||||
mockInstantiate.and.returnValue(mockFolderObject);
|
||||
mockType.getKey.and.returnValue("test");
|
||||
mockType.getInitialModel.and.returnValue(testModel);
|
||||
mockType.getProperties.and.returnValue(mockProperties);
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.useCapability.and.returnValue();
|
||||
mockDomainObject.getModel.and.returnValue(testModel);
|
||||
mockFolderObject.getCapability.and.returnValue(capabilities);
|
||||
mockFolderObject.useCapability.and.returnValue();
|
||||
mockFolderObject.getModel.and.returnValue(testModel);
|
||||
mockScope.ngModel = {};
|
||||
mockScope.field = "someField";
|
||||
|
||||
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
|
||||
controller = new LocatorController(mockScope, mockTimeout, mockObjectService, mockTypeService, mockPolicyService, mockInstantiate);
|
||||
});
|
||||
describe("when context is available", function () {
|
||||
|
||||
beforeEach(function () {
|
||||
mockContext.getRoot.andReturn(mockRootObject);
|
||||
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
|
||||
mockContext.getRoot.and.returnValue(mockRootObject);
|
||||
controller = new LocatorController(mockScope, mockTimeout, mockObjectService, mockTypeService, mockPolicyService, mockInstantiate);
|
||||
});
|
||||
|
||||
it("adds a treeModel to scope", function () {
|
||||
@ -96,8 +178,8 @@ define(
|
||||
it("changes its own model on embedded model updates", function () {
|
||||
// Need to pass on selection changes as updates to
|
||||
// the control's value
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockScope.ngModel.someField).toEqual(mockDomainObject);
|
||||
expect(mockScope.rootObject).toEqual(mockRootObject);
|
||||
|
||||
@ -109,11 +191,11 @@ define(
|
||||
|
||||
it("rejects changes which fail validation", function () {
|
||||
mockScope.structure = { validate: jasmine.createSpy('validate') };
|
||||
mockScope.structure.validate.andReturn(false);
|
||||
mockScope.structure.validate.and.returnValue(false);
|
||||
|
||||
// Pass selection change
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
|
||||
expect(mockScope.structure.validate).toHaveBeenCalled();
|
||||
// Change should have been rejected
|
||||
@ -126,13 +208,13 @@ define(
|
||||
['$setValidity']
|
||||
);
|
||||
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockScope.ngModelController.$setValidity)
|
||||
.toHaveBeenCalledWith(jasmine.any(String), true);
|
||||
|
||||
mockScope.$watch.mostRecentCall.args[1](undefined);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](undefined);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockScope.ngModelController.$setValidity)
|
||||
.toHaveBeenCalledWith(jasmine.any(String), false);
|
||||
});
|
||||
@ -141,27 +223,27 @@ define(
|
||||
var defaultRoot = "DEFAULT_ROOT";
|
||||
|
||||
beforeEach(function () {
|
||||
mockContext.getRoot.andReturn(undefined);
|
||||
getObjectsPromise.then.andCallFake(function (callback) {
|
||||
mockContext.getRoot.and.returnValue(undefined);
|
||||
getObjectsPromise.then.and.callFake(function (callback) {
|
||||
callback({'ROOT': defaultRoot});
|
||||
});
|
||||
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
|
||||
controller = new LocatorController(mockScope, mockTimeout, mockObjectService, mockTypeService, mockPolicyService, mockInstantiate);
|
||||
});
|
||||
|
||||
it("provides a default context where none is available", function () {
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockScope.rootObject).toBe(defaultRoot);
|
||||
});
|
||||
|
||||
it("does not issue redundant requests for the root object", function () {
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.mostRecentCall.args[1](undefined);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
expect(mockObjectService.getObjects.calls.length)
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](undefined);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
mockScope.$watch.calls.mostRecent().args[1](mockDomainObject);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockObjectService.getObjects.calls.count())
|
||||
.toEqual(1);
|
||||
});
|
||||
|
||||
@ -169,3 +251,4 @@ define(
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -58,10 +58,10 @@ define(
|
||||
mockEditAction = jasmine.createSpyObj('edit', ['getMetadata']);
|
||||
mockPropertiesAction = jasmine.createSpyObj('edit', ['getMetadata']);
|
||||
|
||||
mockDomainObject.getCapability.andCallFake(function (capability) {
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.hasCapability.andCallFake(function (capability) {
|
||||
mockDomainObject.hasCapability.and.callFake(function (capability) {
|
||||
return !!capabilities[capability];
|
||||
});
|
||||
|
||||
@ -71,13 +71,13 @@ define(
|
||||
plotView = { key: "plot", editable: false };
|
||||
testViews = [];
|
||||
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
mockDomainObject.useCapability.and.callFake(function (c) {
|
||||
// Provide test views, only for the view capability
|
||||
return c === 'view' && testViews;
|
||||
});
|
||||
|
||||
mockEditAction.getMetadata.andReturn({ key: 'edit' });
|
||||
mockPropertiesAction.getMetadata.andReturn({ key: 'properties' });
|
||||
mockEditAction.getMetadata.and.returnValue({ key: 'edit' });
|
||||
mockPropertiesAction.getMetadata.and.returnValue({ key: 'properties' });
|
||||
|
||||
testContext = {
|
||||
domainObject: mockDomainObject,
|
||||
@ -111,20 +111,20 @@ define(
|
||||
it("disallows the edit action when object is already being" +
|
||||
" edited", function () {
|
||||
testViews = [editableView];
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("allows editing of panels in plot view", function () {
|
||||
testViews = [plotView];
|
||||
mockTypeCapability.getKey.andReturn('telemetry.panel');
|
||||
mockTypeCapability.getKey.and.returnValue('telemetry.panel');
|
||||
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
||||
});
|
||||
|
||||
it("disallows editing of plot view when object not a panel type", function () {
|
||||
testViews = [plotView];
|
||||
mockTypeCapability.getKey.andReturn('something.else');
|
||||
mockTypeCapability.getKey.and.returnValue('something.else');
|
||||
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
});
|
||||
|
@ -41,20 +41,20 @@ define(
|
||||
mockEditorCapability = jasmine.createSpyObj("editorCapability", ["isEditContextRoot", "inEditContext"]);
|
||||
|
||||
navigatedObject = jasmine.createSpyObj("navigatedObject", ["hasCapability", "getCapability"]);
|
||||
navigatedObject.getCapability.andReturn(mockEditorCapability);
|
||||
navigatedObject.hasCapability.andReturn(false);
|
||||
navigatedObject.getCapability.and.returnValue(mockEditorCapability);
|
||||
navigatedObject.hasCapability.and.returnValue(false);
|
||||
|
||||
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", ["hasCapability", "getCapability"]);
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
mockDomainObject.getCapability.andReturn(mockEditorCapability);
|
||||
mockDomainObject.hasCapability.and.returnValue(false);
|
||||
mockDomainObject.getCapability.and.returnValue(mockEditorCapability);
|
||||
|
||||
navigationService = jasmine.createSpyObj("navigationService", ["getNavigation"]);
|
||||
navigationService.getNavigation.andReturn(navigatedObject);
|
||||
navigationService.getNavigation.and.returnValue(navigatedObject);
|
||||
|
||||
metadata = {key: "move"};
|
||||
mockAction = jasmine.createSpyObj("action", ["getMetadata"]);
|
||||
mockAction.getMetadata.andReturn(metadata);
|
||||
mockAction.getMetadata.and.returnValue(metadata);
|
||||
|
||||
context = {domainObject: mockDomainObject};
|
||||
|
||||
@ -67,8 +67,8 @@ define(
|
||||
|
||||
it('Allows "window" action when navigated object in edit mode,' +
|
||||
' but selected object not in edit mode ', function () {
|
||||
navigatedObject.hasCapability.andReturn(true);
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
navigatedObject.hasCapability.and.returnValue(true);
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
metadata.key = "window";
|
||||
expect(policy.allow(mockAction, context)).toBe(true);
|
||||
});
|
||||
@ -79,12 +79,12 @@ define(
|
||||
var mockParent = jasmine.createSpyObj("parentObject", ["hasCapability"]),
|
||||
mockContextCapability = jasmine.createSpyObj("contextCapability", ["getParent"]);
|
||||
|
||||
mockParent.hasCapability.andReturn(true);
|
||||
mockContextCapability.getParent.andReturn(mockParent);
|
||||
navigatedObject.hasCapability.andReturn(true);
|
||||
mockParent.hasCapability.and.returnValue(true);
|
||||
mockContextCapability.getParent.and.returnValue(mockParent);
|
||||
navigatedObject.hasCapability.and.returnValue(true);
|
||||
|
||||
mockDomainObject.getCapability.andReturn(mockContextCapability);
|
||||
mockDomainObject.hasCapability.andCallFake(function (capability) {
|
||||
mockDomainObject.getCapability.and.returnValue(mockContextCapability);
|
||||
mockDomainObject.hasCapability.and.callFake(function (capability) {
|
||||
switch (capability) {
|
||||
case "editor": return false;
|
||||
case "context": return true;
|
||||
@ -97,19 +97,19 @@ define(
|
||||
|
||||
it('Disallows "move" action when navigated object in edit mode,' +
|
||||
' but selected object not in edit mode ', function () {
|
||||
navigatedObject.hasCapability.andReturn(true);
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockEditorCapability.inEditContext.andReturn(false);
|
||||
navigatedObject.hasCapability.and.returnValue(true);
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
mockEditorCapability.inEditContext.and.returnValue(false);
|
||||
metadata.key = "move";
|
||||
expect(policy.allow(mockAction, context)).toBe(false);
|
||||
});
|
||||
|
||||
it('Disallows copy action when navigated object and' +
|
||||
' selected object in edit mode', function () {
|
||||
navigatedObject.hasCapability.andReturn(true);
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
mockEditorCapability.isEditContextRoot.andReturn(true);
|
||||
mockEditorCapability.inEditContext.andReturn(true);
|
||||
navigatedObject.hasCapability.and.returnValue(true);
|
||||
mockDomainObject.hasCapability.and.returnValue(true);
|
||||
mockEditorCapability.isEditContextRoot.and.returnValue(true);
|
||||
mockEditorCapability.inEditContext.and.returnValue(true);
|
||||
|
||||
metadata.key = "copy";
|
||||
expect(policy.allow(mockAction, context)).toBe(false);
|
||||
|
@ -54,11 +54,11 @@ define(
|
||||
mockPropertiesAction = jasmine.createSpyObj('properties', ['getMetadata']);
|
||||
mockOtherAction = jasmine.createSpyObj('other', ['getMetadata']);
|
||||
|
||||
mockEditAction.getMetadata.andReturn({ key: 'edit' });
|
||||
mockPropertiesAction.getMetadata.andReturn({ key: 'properties' });
|
||||
mockOtherAction.getMetadata.andReturn({key: 'other'});
|
||||
mockEditAction.getMetadata.and.returnValue({ key: 'edit' });
|
||||
mockPropertiesAction.getMetadata.and.returnValue({ key: 'properties' });
|
||||
mockOtherAction.getMetadata.and.returnValue({key: 'other'});
|
||||
|
||||
mockDomainObject.getId.andReturn('test:testId');
|
||||
mockDomainObject.getId.and.returnValue('test:testId');
|
||||
|
||||
testContext = {
|
||||
domainObject: mockDomainObject,
|
||||
@ -69,7 +69,7 @@ define(
|
||||
});
|
||||
|
||||
it("Applies to edit action", function () {
|
||||
mockObjectAPI.getProvider.andReturn({});
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
|
||||
policy.allow(mockEditAction, testContext);
|
||||
@ -77,7 +77,7 @@ define(
|
||||
});
|
||||
|
||||
it("Applies to properties action", function () {
|
||||
mockObjectAPI.getProvider.andReturn({});
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
|
||||
policy.allow(mockPropertiesAction, testContext);
|
||||
@ -85,7 +85,7 @@ define(
|
||||
});
|
||||
|
||||
it("does not apply to other actions", function () {
|
||||
mockObjectAPI.getProvider.andReturn({});
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(mockObjectAPI.getProvider).not.toHaveBeenCalled();
|
||||
|
||||
policy.allow(mockOtherAction, testContext);
|
||||
@ -93,10 +93,10 @@ define(
|
||||
});
|
||||
|
||||
it("Tests object provider for editability", function () {
|
||||
mockObjectAPI.getProvider.andReturn({});
|
||||
mockObjectAPI.getProvider.and.returnValue({});
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(false);
|
||||
expect(mockObjectAPI.getProvider).toHaveBeenCalled();
|
||||
mockObjectAPI.getProvider.andReturn({save: function () {}});
|
||||
mockObjectAPI.getProvider.and.returnValue({save: function () {}});
|
||||
expect(policy.allow(mockEditAction, testContext)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -35,12 +35,12 @@ define(
|
||||
'domainObject',
|
||||
['hasCapability', 'getCapability']
|
||||
);
|
||||
mockDomainObject.getCapability.andReturn({
|
||||
mockDomainObject.getCapability.and.returnValue({
|
||||
inEditContext: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mockDomainObject.hasCapability.andCallFake(function (c) {
|
||||
mockDomainObject.hasCapability.and.callFake(function (c) {
|
||||
return (c === 'editor') && testMode;
|
||||
});
|
||||
|
||||
|
@ -52,8 +52,8 @@ define([
|
||||
'useCapability'
|
||||
]);
|
||||
|
||||
domainObject.getId.andReturn('anId');
|
||||
domainObject.getModel.andReturn({name: 'anObject'});
|
||||
domainObject.getId.and.returnValue('anId');
|
||||
domainObject.getModel.and.returnValue({name: 'anObject'});
|
||||
|
||||
representation = {
|
||||
key: 'someRepresentation'
|
||||
@ -75,7 +75,7 @@ define([
|
||||
expect(domainObject.useCapability)
|
||||
.toHaveBeenCalledWith('mutation', jasmine.any(Function));
|
||||
|
||||
var mutateValue = domainObject.useCapability.calls[0].args[1]();
|
||||
var mutateValue = domainObject.useCapability.calls.all()[0].args[1]();
|
||||
|
||||
expect(mutateValue.configuration.someRepresentation)
|
||||
.toEqual({some: 'config'});
|
||||
|
@ -1,156 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
["../../src/representers/EditToolbarRepresenter"],
|
||||
function (EditToolbarRepresenter) {
|
||||
|
||||
describe("The Edit mode toolbar representer", function () {
|
||||
var mockScope,
|
||||
mockElement,
|
||||
testAttrs,
|
||||
mockUnwatch,
|
||||
representer,
|
||||
mockOpenMCT,
|
||||
mockSelection;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
['$on', '$watch', '$watchCollection', "commit", "$apply"]
|
||||
);
|
||||
mockElement = {};
|
||||
testAttrs = { toolbar: 'testToolbar' };
|
||||
mockScope.$parent = jasmine.createSpyObj(
|
||||
'$parent',
|
||||
['$watch', '$watchCollection']
|
||||
);
|
||||
mockUnwatch = jasmine.createSpy('unwatch');
|
||||
|
||||
mockScope.$parent.$watchCollection.andReturn(mockUnwatch);
|
||||
|
||||
mockSelection = jasmine.createSpyObj("selection", [
|
||||
'on',
|
||||
'off',
|
||||
'get'
|
||||
]);
|
||||
mockSelection.get.andReturn([]);
|
||||
mockOpenMCT = {
|
||||
selection: mockSelection
|
||||
};
|
||||
|
||||
representer = new EditToolbarRepresenter(
|
||||
mockOpenMCT,
|
||||
mockScope,
|
||||
mockElement,
|
||||
testAttrs
|
||||
);
|
||||
});
|
||||
|
||||
it("exposes toolbar state under a attr-defined name", function () {
|
||||
// A structure/state object should have been added to the
|
||||
// parent scope under the name provided in the "toolbar"
|
||||
// attribute
|
||||
expect(mockScope.$parent.testToolbar).toBeDefined();
|
||||
});
|
||||
|
||||
it("is robust against lack of a toolbar definition", function () {
|
||||
expect(function () {
|
||||
representer.represent({});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("watches for toolbar state changes", function () {
|
||||
representer.represent({});
|
||||
expect(mockScope.$watchCollection).toHaveBeenCalledWith(
|
||||
jasmine.any(Function),
|
||||
jasmine.any(Function)
|
||||
);
|
||||
expect(mockScope.$watchCollection.calls[0].args[0]())
|
||||
.toBe(mockScope.$parent.testToolbar.state);
|
||||
});
|
||||
|
||||
it("removes state from parent scope on destroy", function () {
|
||||
// Verify precondition
|
||||
expect(mockScope.$parent.testToolbar).toBeDefined();
|
||||
// Destroy the representer
|
||||
representer.destroy();
|
||||
// Should have removed toolbar state from view
|
||||
expect(mockScope.$parent.testToolbar).toBeUndefined();
|
||||
});
|
||||
|
||||
// Verify a simple interaction between selection state and toolbar
|
||||
// state; more complicated interactions are tested in EditToolbar.
|
||||
it("conveys state changes", function () {
|
||||
var testObject = { k: 123 };
|
||||
|
||||
// Provide a view which has a toolbar
|
||||
representer.represent({
|
||||
toolbar: { sections: [{ items: [{ property: 'k' }] }] }
|
||||
});
|
||||
|
||||
// Update the selection
|
||||
mockScope.selection.select(testObject);
|
||||
expect(mockScope.$watchCollection.mostRecentCall.args[0])
|
||||
.toEqual('selection.all()'); // Make sure we're using right watch
|
||||
mockScope.$watchCollection.mostRecentCall.args[1]([testObject]);
|
||||
|
||||
// Update the state
|
||||
mockScope.$parent.testToolbar.state[0] = 456;
|
||||
// Invoke the first watch (assumed to be for toolbar state)
|
||||
mockScope.$watchCollection.calls[0].args[1](
|
||||
mockScope.$parent.testToolbar.state
|
||||
);
|
||||
|
||||
// Should have updated the original object
|
||||
expect(testObject.k).toEqual(456);
|
||||
|
||||
// Should have committed the change
|
||||
expect(mockScope.commit).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not commit if nothing changed", function () {
|
||||
var testObject = { k: 123 };
|
||||
|
||||
// Provide a view which has a toolbar
|
||||
representer.represent({
|
||||
toolbar: { sections: [{ items: [{ property: 'k' }] }] }
|
||||
});
|
||||
|
||||
// Update the selection
|
||||
mockScope.selection.select(testObject);
|
||||
expect(mockScope.$watchCollection.mostRecentCall.args[0])
|
||||
.toEqual('selection.all()'); // Make sure we're using right watch
|
||||
mockScope.$watchCollection.mostRecentCall.args[1]([testObject]);
|
||||
|
||||
// Invoke the first watch (assumed to be for toolbar state)
|
||||
mockScope.$watchCollection.calls[0].args[1](
|
||||
mockScope.$parent.testToolbar.state
|
||||
);
|
||||
|
||||
// Should have committed the change
|
||||
expect(mockScope.commit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -1,128 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
define(
|
||||
['../../src/representers/EditToolbarSelection'],
|
||||
function (EditToolbarSelection) {
|
||||
|
||||
describe("The Edit mode selection manager", function () {
|
||||
var testProxy,
|
||||
testElement,
|
||||
otherElement,
|
||||
selection,
|
||||
mockSelection,
|
||||
mockOpenMCT,
|
||||
mockScope;
|
||||
|
||||
beforeEach(function () {
|
||||
testProxy = { someKey: "some value" };
|
||||
testElement = { someOtherKey: "some other value" };
|
||||
otherElement = { yetAnotherKey: 42 };
|
||||
mockSelection = jasmine.createSpyObj("selection", [
|
||||
// 'select',
|
||||
'on',
|
||||
'off',
|
||||
'get'
|
||||
]);
|
||||
mockSelection.get.andReturn([]);
|
||||
mockOpenMCT = {
|
||||
selection: mockSelection
|
||||
};
|
||||
mockScope = jasmine.createSpyObj('$scope', [
|
||||
'$on',
|
||||
'$apply'
|
||||
]);
|
||||
|
||||
selection = new EditToolbarSelection(mockScope, mockOpenMCT);
|
||||
selection.proxy(testProxy);
|
||||
});
|
||||
|
||||
it("adds the proxy to the selection array", function () {
|
||||
expect(selection.all()).toEqual([testProxy]);
|
||||
});
|
||||
|
||||
it("exposes view proxy", function () {
|
||||
expect(selection.proxy()).toBe(testProxy);
|
||||
});
|
||||
|
||||
it("includes selected objects alongside the proxy", function () {
|
||||
selection.select(testElement);
|
||||
expect(selection.all()).toEqual([testProxy, testElement]);
|
||||
});
|
||||
|
||||
it("allows elements to be deselected", function () {
|
||||
selection.select(testElement);
|
||||
selection.deselect();
|
||||
expect(selection.all()).toEqual([testProxy]);
|
||||
});
|
||||
|
||||
it("replaces old selections with new ones", function () {
|
||||
selection.select(testElement);
|
||||
selection.select(otherElement);
|
||||
expect(selection.all()).toEqual([testProxy, otherElement]);
|
||||
});
|
||||
|
||||
it("allows retrieval of the current selection", function () {
|
||||
selection.select(testElement);
|
||||
expect(selection.get()).toBe(testElement);
|
||||
selection.select(otherElement);
|
||||
expect(selection.get()).toBe(otherElement);
|
||||
});
|
||||
|
||||
it("can check if an element is selected", function () {
|
||||
selection.select(testElement);
|
||||
expect(selection.selected(testElement)).toBeTruthy();
|
||||
expect(selection.selected(otherElement)).toBeFalsy();
|
||||
selection.select(otherElement);
|
||||
expect(selection.selected(testElement)).toBeFalsy();
|
||||
expect(selection.selected(otherElement)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("considers the proxy to be selected", function () {
|
||||
expect(selection.selected(testProxy)).toBeTruthy();
|
||||
selection.select(testElement);
|
||||
// Even when something else is selected...
|
||||
expect(selection.selected(testProxy)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("treats selection of the proxy as a no-op", function () {
|
||||
selection.select(testProxy);
|
||||
expect(selection.all()).toEqual([testProxy]);
|
||||
});
|
||||
|
||||
it("cleans up selection on scope destroy", function () {
|
||||
expect(mockScope.$on).toHaveBeenCalledWith(
|
||||
'$destroy',
|
||||
jasmine.any(Function)
|
||||
);
|
||||
|
||||
mockScope.$on.mostRecentCall.args[1]();
|
||||
|
||||
expect(mockOpenMCT.selection.off).toHaveBeenCalledWith(
|
||||
'change',
|
||||
jasmine.any(Function)
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -25,7 +25,10 @@ define(
|
||||
function (EditToolbar) {
|
||||
|
||||
describe("An Edit mode toolbar", function () {
|
||||
var mockCommit,
|
||||
var mockOpenMCT,
|
||||
mockScope,
|
||||
mockObjects,
|
||||
mockDomainObject,
|
||||
testStructure,
|
||||
testAB,
|
||||
testABC,
|
||||
@ -35,35 +38,30 @@ define(
|
||||
testM,
|
||||
toolbar;
|
||||
|
||||
function getVisibility(obj) {
|
||||
return !obj.hidden;
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockCommit = jasmine.createSpy('commit');
|
||||
testStructure = {
|
||||
sections: [
|
||||
{
|
||||
items: [
|
||||
{ name: "A", property: "a", exclusive: true },
|
||||
{ name: "B", property: "b", exclusive: true },
|
||||
{ name: "C", property: "c", exclusive: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ name: "X", property: "x" },
|
||||
{ name: "Y", property: "y", exclusive: true },
|
||||
{ name: "Z", property: "z", exclusive: true }
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ name: "M", method: "m", exclusive: true }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
mockOpenMCT = jasmine.createSpy('openmct', ['objects']);
|
||||
mockObjects = jasmine.createSpyObj('objects', ['observe']);
|
||||
mockObjects.observe.and.returnValue();
|
||||
mockOpenMCT.objects = mockObjects;
|
||||
mockScope = jasmine.createSpyObj("$scope", [
|
||||
"$watchCollection",
|
||||
"$on"
|
||||
]);
|
||||
mockScope.$watchCollection.and.returnValue();
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", [
|
||||
'identifier'
|
||||
]);
|
||||
|
||||
testStructure = [
|
||||
{ name: "A", property: "a", domainObject: mockDomainObject },
|
||||
{ name: "B", property: "b", domainObject: mockDomainObject },
|
||||
{ name: "C", property: "c", domainObject: mockDomainObject },
|
||||
{ name: "X", property: "x", domainObject: mockDomainObject },
|
||||
{ name: "Y", property: "y", domainObject: mockDomainObject },
|
||||
{ name: "Z", property: "z", domainObject: mockDomainObject },
|
||||
{ name: "M", method: "m", domainObject: mockDomainObject }
|
||||
];
|
||||
|
||||
testAB = { a: 0, b: 1 };
|
||||
testABC = { a: 0, b: 1, c: 2 };
|
||||
testABC2 = { a: 4, b: 1, c: 2 }; // For inconsistent-state checking
|
||||
@ -71,151 +69,17 @@ define(
|
||||
testABCYZ = { a: 0, b: 1, c: 2, y: 'Y!', z: 'Z!' };
|
||||
testM = { m: jasmine.createSpy("method") };
|
||||
|
||||
toolbar = new EditToolbar(testStructure, mockCommit);
|
||||
});
|
||||
|
||||
it("provides properties from the original structure", function () {
|
||||
expect(
|
||||
new EditToolbar(testStructure, [testABC])
|
||||
.getStructure()
|
||||
.sections[0]
|
||||
.items[1]
|
||||
.name
|
||||
).toEqual("B");
|
||||
});
|
||||
|
||||
// This is needed by mct-toolbar
|
||||
it("adds keys to form structure", function () {
|
||||
expect(
|
||||
new EditToolbar(testStructure, [testABC])
|
||||
.getStructure()
|
||||
.sections[0]
|
||||
.items[1]
|
||||
.key
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
|
||||
it("marks empty sections as hidden", function () {
|
||||
// Verify that all sections are included when applicable...
|
||||
toolbar.setSelection([testABCXYZ]);
|
||||
expect(toolbar.getStructure().sections.map(getVisibility))
|
||||
.toEqual([true, true, false]);
|
||||
|
||||
// ...but omitted when only some are applicable
|
||||
toolbar.setSelection([testABC]);
|
||||
expect(toolbar.getStructure().sections.map(getVisibility))
|
||||
.toEqual([true, false, false]);
|
||||
});
|
||||
|
||||
it("reads properties from selections", function () {
|
||||
var structure, state;
|
||||
|
||||
toolbar.setSelection([testABC]);
|
||||
|
||||
structure = toolbar.getStructure();
|
||||
state = toolbar.getState();
|
||||
|
||||
expect(state[structure.sections[0].items[0].key])
|
||||
.toEqual(testABC.a);
|
||||
expect(state[structure.sections[0].items[1].key])
|
||||
.toEqual(testABC.b);
|
||||
expect(state[structure.sections[0].items[2].key])
|
||||
.toEqual(testABC.c);
|
||||
});
|
||||
|
||||
it("reads properties from getters", function () {
|
||||
var structure, state;
|
||||
|
||||
testABC.a = function () {
|
||||
return "from a getter!";
|
||||
};
|
||||
|
||||
toolbar.setSelection([testABC]);
|
||||
structure = toolbar.getStructure();
|
||||
state = toolbar.getState();
|
||||
|
||||
expect(state[structure.sections[0].items[0].key])
|
||||
.toEqual("from a getter!");
|
||||
});
|
||||
|
||||
it("sets properties on update", function () {
|
||||
toolbar.setSelection([testABC]);
|
||||
toolbar.updateState(
|
||||
toolbar.getStructure().sections[0].items[0].key,
|
||||
"new value"
|
||||
);
|
||||
// Should have updated the underlying object
|
||||
expect(testABC.a).toEqual("new value");
|
||||
});
|
||||
|
||||
it("invokes setters on update", function () {
|
||||
var structure;
|
||||
|
||||
testABC.a = jasmine.createSpy('a');
|
||||
|
||||
toolbar.setSelection([testABC]);
|
||||
structure = toolbar.getStructure();
|
||||
|
||||
toolbar.updateState(
|
||||
structure.sections[0].items[0].key,
|
||||
"new value"
|
||||
);
|
||||
// Should have updated the underlying object
|
||||
expect(testABC.a).toHaveBeenCalledWith("new value");
|
||||
});
|
||||
|
||||
it("provides a return value describing update status", function () {
|
||||
// Should return true if actually updated, otherwise false
|
||||
var key;
|
||||
toolbar.setSelection([testABC]);
|
||||
key = toolbar.getStructure().sections[0].items[0].key;
|
||||
expect(toolbar.updateState(key, testABC.a)).toBeFalsy();
|
||||
expect(toolbar.updateState(key, "new value")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("removes inapplicable items", function () {
|
||||
// First, verify with all items
|
||||
toolbar.setSelection([testABC]);
|
||||
expect(toolbar.getStructure().sections[0].items.map(getVisibility))
|
||||
.toEqual([true, true, true]);
|
||||
// Then, try with some items omitted
|
||||
toolbar.setSelection([testABC, testAB]);
|
||||
expect(toolbar.getStructure().sections[0].items.map(getVisibility))
|
||||
.toEqual([true, true, false]);
|
||||
});
|
||||
|
||||
it("removes inconsistent states", function () {
|
||||
// Only two of three values match among these selections
|
||||
toolbar.setSelection([testABC, testABC2]);
|
||||
expect(toolbar.getStructure().sections[0].items.map(getVisibility))
|
||||
.toEqual([false, true, true]);
|
||||
});
|
||||
|
||||
it("allows inclusive items", function () {
|
||||
// One inclusive item is in the set, property 'x' of the
|
||||
// second section; make sure items are pruned down
|
||||
// when only some of the selection has x,y,z properties
|
||||
toolbar.setSelection([testABC, testABCXYZ]);
|
||||
expect(toolbar.getStructure().sections[1].items.map(getVisibility))
|
||||
.toEqual([true, false, false]);
|
||||
});
|
||||
|
||||
it("removes inclusive items when there are no matches", function () {
|
||||
toolbar.setSelection([testABCYZ]);
|
||||
expect(toolbar.getStructure().sections[1].items.map(getVisibility))
|
||||
.toEqual([false, true, true]);
|
||||
toolbar = new EditToolbar(mockScope, mockOpenMCT, testStructure);
|
||||
});
|
||||
|
||||
it("adds click functions when a method is specified", function () {
|
||||
toolbar.setSelection([testM]);
|
||||
// Verify precondition
|
||||
expect(testM.m).not.toHaveBeenCalled();
|
||||
// Click!
|
||||
toolbar.getStructure().sections[2].items[0].click();
|
||||
// Should have called the underlying function
|
||||
expect(testM.m).toHaveBeenCalled();
|
||||
// Should also have committed the change
|
||||
expect(mockCommit).toHaveBeenCalled();
|
||||
var structure = toolbar.getStructure();
|
||||
expect(structure[6].click).toBeDefined();
|
||||
});
|
||||
|
||||
it("adds key for controls that define a property", function () {
|
||||
var structure = toolbar.getStructure();
|
||||
expect(structure[0].key).toEqual(0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -44,10 +44,10 @@ define(
|
||||
testId = 'test-id';
|
||||
mockPromise = jasmine.createSpyObj('promise', ['then']);
|
||||
|
||||
mockOnCommit.andReturn(mockPromise);
|
||||
mockOnCancel.andReturn(mockPromise);
|
||||
mockOnCommit.and.returnValue(mockPromise);
|
||||
mockOnCancel.and.returnValue(mockPromise);
|
||||
|
||||
mockTransactionService.addToTransaction.andCallFake(function () {
|
||||
mockTransactionService.addToTransaction.and.callFake(function () {
|
||||
var mockRemove =
|
||||
jasmine.createSpy('remove-' + mockRemoves.length);
|
||||
mockRemoves.push(mockRemove);
|
||||
@ -59,7 +59,7 @@ define(
|
||||
|
||||
it("delegates isActive calls", function () {
|
||||
[false, true].forEach(function (state) {
|
||||
mockTransactionService.isActive.andReturn(state);
|
||||
mockTransactionService.isActive.and.returnValue(state);
|
||||
expect(manager.isActive()).toBe(state);
|
||||
});
|
||||
});
|
||||
@ -84,12 +84,12 @@ define(
|
||||
it("invokes passed-in callbacks from its own callbacks", function () {
|
||||
expect(mockOnCommit).not.toHaveBeenCalled();
|
||||
mockTransactionService.addToTransaction
|
||||
.mostRecentCall.args[0]();
|
||||
.calls.mostRecent().args[0]();
|
||||
expect(mockOnCommit).toHaveBeenCalled();
|
||||
|
||||
expect(mockOnCancel).not.toHaveBeenCalled();
|
||||
mockTransactionService.addToTransaction
|
||||
.mostRecentCall.args[1]();
|
||||
.calls.mostRecent().args[1]();
|
||||
expect(mockOnCancel).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@ -99,7 +99,7 @@ define(
|
||||
jasmine.createSpy(),
|
||||
jasmine.createSpy()
|
||||
);
|
||||
expect(mockTransactionService.addToTransaction.calls.length)
|
||||
expect(mockTransactionService.addToTransaction.calls.count())
|
||||
.toEqual(1);
|
||||
});
|
||||
|
||||
@ -109,7 +109,7 @@ define(
|
||||
jasmine.createSpy(),
|
||||
jasmine.createSpy()
|
||||
);
|
||||
expect(mockTransactionService.addToTransaction.calls.length)
|
||||
expect(mockTransactionService.addToTransaction.calls.count())
|
||||
.toEqual(2);
|
||||
});
|
||||
|
||||
|
@ -40,7 +40,7 @@ define(
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = jasmine.createSpyObj("$q", ["all"]);
|
||||
mockQ.all.andReturn(fastPromise());
|
||||
mockQ.all.and.returnValue(fastPromise());
|
||||
mockLog = jasmine.createSpyObj("$log", ["error"]);
|
||||
transactionService = new TransactionService(mockQ, mockLog);
|
||||
});
|
||||
|
@ -92,7 +92,7 @@ define(
|
||||
|
||||
describe("and an exception is encountered during commit", function () {
|
||||
beforeEach(function () {
|
||||
mockCommit.andCallFake(function () {
|
||||
mockCommit.and.callFake(function () {
|
||||
throw new Error("test error");
|
||||
});
|
||||
transaction.commit();
|
||||
|
@ -115,8 +115,10 @@ define([
|
||||
UTCTimeFormat.prototype.format = function (value) {
|
||||
if (arguments.length > 1) {
|
||||
return getScaledFormat(value);
|
||||
} else {
|
||||
} else if (value !== undefined) {
|
||||
return moment.utc(value).format(DATE_FORMAT) + "Z";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,6 @@ define([
|
||||
"./src/controllers/ContextMenuController",
|
||||
"./src/controllers/ClickAwayController",
|
||||
"./src/controllers/ViewSwitcherController",
|
||||
"./src/controllers/BottomBarController",
|
||||
"./src/controllers/GetterSetterController",
|
||||
"./src/controllers/SelectorController",
|
||||
"./src/controllers/ObjectInspectorController",
|
||||
@ -49,11 +48,14 @@ define([
|
||||
"./src/directives/MCTSplitPane",
|
||||
"./src/directives/MCTSplitter",
|
||||
"./src/directives/MCTTree",
|
||||
"./src/directives/MCTIndicators",
|
||||
"./src/directives/MCTPreview",
|
||||
"./src/actions/MCTPreviewAction",
|
||||
"./src/filters/ReverseFilter",
|
||||
"text!./res/templates/bottombar.html",
|
||||
"text!./res/templates/controls/action-button.html",
|
||||
"text!./res/templates/controls/input-filter.html",
|
||||
"text!./res/templates/indicator.html",
|
||||
"text!./res/templates/angular-indicator.html",
|
||||
"text!./res/templates/message-banner.html",
|
||||
"text!./res/templates/progress-bar.html",
|
||||
"text!./res/templates/controls/time-controller.html",
|
||||
@ -69,6 +71,7 @@ define([
|
||||
"text!./res/templates/controls/selector.html",
|
||||
"text!./res/templates/controls/datetime-picker.html",
|
||||
"text!./res/templates/controls/datetime-field.html",
|
||||
"text!./res/templates/preview.html",
|
||||
'legacyRegistry'
|
||||
], function (
|
||||
UrlService,
|
||||
@ -84,7 +87,6 @@ define([
|
||||
ContextMenuController,
|
||||
ClickAwayController,
|
||||
ViewSwitcherController,
|
||||
BottomBarController,
|
||||
GetterSetterController,
|
||||
SelectorController,
|
||||
ObjectInspectorController,
|
||||
@ -99,6 +101,9 @@ define([
|
||||
MCTSplitPane,
|
||||
MCTSplitter,
|
||||
MCTTree,
|
||||
MCTIndicators,
|
||||
MCTPreview,
|
||||
MCTPreviewAction,
|
||||
ReverseFilter,
|
||||
bottombarTemplate,
|
||||
actionButtonTemplate,
|
||||
@ -119,6 +124,7 @@ define([
|
||||
selectorTemplate,
|
||||
datetimePickerTemplate,
|
||||
datetimeFieldTemplate,
|
||||
previewTemplate,
|
||||
legacyRegistry
|
||||
) {
|
||||
|
||||
@ -275,13 +281,6 @@ define([
|
||||
"$timeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "BottomBarController",
|
||||
"implementation": BottomBarController,
|
||||
"depends": [
|
||||
"indicators[]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "GetterSetterController",
|
||||
"implementation": GetterSetterController,
|
||||
@ -395,7 +394,37 @@ define([
|
||||
{
|
||||
"key": "mctTree",
|
||||
"implementation": MCTTree,
|
||||
"depends": ['gestureService']
|
||||
"depends": ['gestureService', 'openmct']
|
||||
},
|
||||
{
|
||||
"key": "mctIndicators",
|
||||
"implementation": MCTIndicators,
|
||||
"depends": ['openmct']
|
||||
},
|
||||
{
|
||||
"key": "mctPreview",
|
||||
"implementation": MCTPreview,
|
||||
"depends": [
|
||||
"$document"
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"key": "mct-preview-action",
|
||||
"implementation": MCTPreviewAction,
|
||||
"name": "Preview",
|
||||
"cssClass": "hide-in-t-main-view icon-eye-open",
|
||||
"description": "Preview in large dialog",
|
||||
"category": [
|
||||
"contextual",
|
||||
"view-control"
|
||||
],
|
||||
"depends": [
|
||||
"$compile",
|
||||
"$rootScope"
|
||||
],
|
||||
"priority": "preferred"
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
@ -511,6 +540,10 @@ define([
|
||||
{
|
||||
"key": "object-inspector",
|
||||
"template": objectInspectorTemplate
|
||||
},
|
||||
{
|
||||
"key": "mct-preview",
|
||||
"template": previewTemplate
|
||||
}
|
||||
],
|
||||
"controls": [
|
||||
|
@ -2,7 +2,7 @@
|
||||
"metadata": {
|
||||
"name": "openmct-symbols-16px",
|
||||
"lastOpened": 0,
|
||||
"created": 1506973656040
|
||||
"created": 1529545133464
|
||||
},
|
||||
"iconSets": [
|
||||
{
|
||||
@ -40,7 +40,7 @@
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 44,
|
||||
"order": 141,
|
||||
"prevSize": 24,
|
||||
"name": "icon-arrow-right",
|
||||
"id": 39,
|
||||
@ -48,7 +48,7 @@
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 41,
|
||||
"order": 142,
|
||||
"prevSize": 24,
|
||||
"name": "icon-arrow-double-up",
|
||||
"id": 36,
|
||||
@ -213,7 +213,7 @@
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 29,
|
||||
"order": 144,
|
||||
"prevSize": 24,
|
||||
"name": "icon-person",
|
||||
"id": 24,
|
||||
@ -221,7 +221,7 @@
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 86,
|
||||
"order": 147,
|
||||
"prevSize": 24,
|
||||
"name": "icon-plus",
|
||||
"id": 81,
|
||||
@ -268,13 +268,21 @@
|
||||
"code": 59697,
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 148,
|
||||
"id": 118,
|
||||
"name": "icon-arrow-right-equilateral",
|
||||
"prevSize": 24,
|
||||
"code": 59698,
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 48,
|
||||
"prevSize": 24,
|
||||
"name": "icon-arrows-out",
|
||||
"id": 43,
|
||||
"code": 921600,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 49,
|
||||
@ -282,7 +290,7 @@
|
||||
"name": "icon-arrows-right-left",
|
||||
"id": 44,
|
||||
"code": 921601,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 50,
|
||||
@ -290,7 +298,7 @@
|
||||
"name": "icon-arrows-up-down",
|
||||
"id": 45,
|
||||
"code": 921602,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 9,
|
||||
@ -298,7 +306,7 @@
|
||||
"name": "icon-bullet",
|
||||
"id": 4,
|
||||
"code": 921604,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 25,
|
||||
@ -306,7 +314,7 @@
|
||||
"name": "icon-calendar",
|
||||
"id": 20,
|
||||
"code": 921605,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 30,
|
||||
@ -314,7 +322,7 @@
|
||||
"name": "icon-chain-links",
|
||||
"id": 25,
|
||||
"code": 921606,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 109,
|
||||
@ -322,7 +330,7 @@
|
||||
"prevSize": 24,
|
||||
"code": 921607,
|
||||
"name": "icon-pane-collapse-left",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 110,
|
||||
@ -330,7 +338,7 @@
|
||||
"prevSize": 24,
|
||||
"code": 921608,
|
||||
"name": "icon-pane-collapse-right",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 5,
|
||||
@ -338,7 +346,7 @@
|
||||
"prevSize": 24,
|
||||
"code": 921609,
|
||||
"name": "icon-download",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 60,
|
||||
@ -346,7 +354,7 @@
|
||||
"name": "icon-duplicate",
|
||||
"id": 55,
|
||||
"code": 921616,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 61,
|
||||
@ -354,7 +362,7 @@
|
||||
"name": "icon-folder-new",
|
||||
"id": 56,
|
||||
"code": 921617,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 64,
|
||||
@ -362,7 +370,7 @@
|
||||
"name": "icon-fullscreen-expand",
|
||||
"id": 59,
|
||||
"code": 921618,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 63,
|
||||
@ -370,7 +378,7 @@
|
||||
"name": "icon-fullscreen-collapse",
|
||||
"id": 58,
|
||||
"code": 921619,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 67,
|
||||
@ -378,23 +386,23 @@
|
||||
"name": "icon-layers",
|
||||
"id": 62,
|
||||
"code": 921620,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 69,
|
||||
"order": 145,
|
||||
"prevSize": 24,
|
||||
"name": "icon-line-horz",
|
||||
"id": 64,
|
||||
"code": 921621,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 73,
|
||||
"order": 146,
|
||||
"prevSize": 24,
|
||||
"name": "icon-magnify",
|
||||
"id": 68,
|
||||
"code": 921622,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 71,
|
||||
@ -402,7 +410,7 @@
|
||||
"name": "icon-magnify-in",
|
||||
"id": 66,
|
||||
"code": 921623,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 72,
|
||||
@ -410,7 +418,7 @@
|
||||
"name": "icon-magnify-out",
|
||||
"id": 67,
|
||||
"code": 921624,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 74,
|
||||
@ -418,7 +426,7 @@
|
||||
"name": "icon-menu",
|
||||
"id": 69,
|
||||
"code": 921625,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 75,
|
||||
@ -426,7 +434,7 @@
|
||||
"name": "icon-move",
|
||||
"id": 70,
|
||||
"code": 921632,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 76,
|
||||
@ -434,7 +442,7 @@
|
||||
"name": "icon-new-window",
|
||||
"id": 71,
|
||||
"code": 921633,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 26,
|
||||
@ -442,7 +450,7 @@
|
||||
"name": "icon-paint-bucket",
|
||||
"id": 21,
|
||||
"code": 921634,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 81,
|
||||
@ -450,7 +458,7 @@
|
||||
"name": "icon-pause",
|
||||
"id": 76,
|
||||
"code": 921635,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 82,
|
||||
@ -458,7 +466,7 @@
|
||||
"name": "icon-pencil",
|
||||
"id": 77,
|
||||
"code": 921636,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 84,
|
||||
@ -466,7 +474,7 @@
|
||||
"name": "icon-play",
|
||||
"id": 79,
|
||||
"code": 921637,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 85,
|
||||
@ -474,7 +482,7 @@
|
||||
"name": "icon-plot-resource",
|
||||
"id": 80,
|
||||
"code": 921638,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 27,
|
||||
@ -482,7 +490,7 @@
|
||||
"name": "icon-pointer-left",
|
||||
"id": 22,
|
||||
"code": 921639,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 28,
|
||||
@ -490,7 +498,7 @@
|
||||
"name": "icon-pointer-right",
|
||||
"id": 23,
|
||||
"code": 921640,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 32,
|
||||
@ -498,7 +506,7 @@
|
||||
"name": "icon-refresh",
|
||||
"id": 27,
|
||||
"code": 921641,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 16,
|
||||
@ -506,7 +514,7 @@
|
||||
"name": "icon-save",
|
||||
"id": 11,
|
||||
"code": 921648,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 88,
|
||||
@ -514,7 +522,7 @@
|
||||
"name": "icon-sine",
|
||||
"id": 83,
|
||||
"code": 921649,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 102,
|
||||
@ -522,7 +530,7 @@
|
||||
"name": "icon-T",
|
||||
"id": 84,
|
||||
"code": 921650,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 92,
|
||||
@ -530,7 +538,7 @@
|
||||
"name": "icon-thumbs-strip",
|
||||
"id": 87,
|
||||
"code": 921651,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 96,
|
||||
@ -538,7 +546,7 @@
|
||||
"name": "icon-two-parts-both",
|
||||
"id": 91,
|
||||
"code": 921652,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 97,
|
||||
@ -546,7 +554,7 @@
|
||||
"name": "icon-two-parts-one-only",
|
||||
"id": 92,
|
||||
"code": 921653,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 21,
|
||||
@ -554,7 +562,7 @@
|
||||
"name": "icon-resync",
|
||||
"id": 16,
|
||||
"code": 921654,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 120,
|
||||
@ -562,7 +570,7 @@
|
||||
"name": "icon-reset",
|
||||
"prevSize": 24,
|
||||
"code": 921655,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 121,
|
||||
@ -570,7 +578,7 @@
|
||||
"name": "icon-x-in-circle",
|
||||
"prevSize": 24,
|
||||
"code": 921656,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 118,
|
||||
@ -578,7 +586,7 @@
|
||||
"name": "icon-brightness",
|
||||
"prevSize": 24,
|
||||
"code": 921657,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 119,
|
||||
@ -586,7 +594,7 @@
|
||||
"name": "icon-contrast",
|
||||
"prevSize": 24,
|
||||
"code": 921664,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 124,
|
||||
@ -594,7 +602,7 @@
|
||||
"name": "icon-expand",
|
||||
"prevSize": 24,
|
||||
"code": 921665,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 125,
|
||||
@ -602,7 +610,7 @@
|
||||
"name": "icon-list-view",
|
||||
"prevSize": 24,
|
||||
"code": 921666,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 133,
|
||||
@ -610,7 +618,7 @@
|
||||
"name": "icon-grid-snap-to",
|
||||
"prevSize": 24,
|
||||
"code": 921667,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 128,
|
||||
@ -618,7 +626,7 @@
|
||||
"name": "icon-grid-snap-no",
|
||||
"prevSize": 24,
|
||||
"code": 921668,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 131,
|
||||
@ -626,7 +634,7 @@
|
||||
"name": "icon-frame-show",
|
||||
"prevSize": 24,
|
||||
"code": 921669,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 130,
|
||||
@ -634,7 +642,7 @@
|
||||
"name": "icon-frame-hide",
|
||||
"prevSize": 24,
|
||||
"code": 921670,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 138,
|
||||
@ -642,7 +650,7 @@
|
||||
"name": "icon-import",
|
||||
"prevSize": 24,
|
||||
"code": 921671,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 136,
|
||||
@ -650,7 +658,7 @@
|
||||
"name": "icon-export",
|
||||
"prevSize": 24,
|
||||
"code": 921672,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 37,
|
||||
@ -658,7 +666,7 @@
|
||||
"name": "icon-activity",
|
||||
"id": 32,
|
||||
"code": 921856,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 36,
|
||||
@ -666,7 +674,7 @@
|
||||
"name": "icon-activity-mode",
|
||||
"id": 31,
|
||||
"code": 921857,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 52,
|
||||
@ -674,7 +682,7 @@
|
||||
"name": "icon-autoflow-tabular",
|
||||
"id": 47,
|
||||
"code": 921858,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 55,
|
||||
@ -682,7 +690,7 @@
|
||||
"name": "icon-clock",
|
||||
"id": 50,
|
||||
"code": 921859,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 58,
|
||||
@ -690,7 +698,7 @@
|
||||
"name": "icon-database",
|
||||
"id": 53,
|
||||
"code": 921860,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 57,
|
||||
@ -698,7 +706,7 @@
|
||||
"name": "icon-database-query",
|
||||
"id": 52,
|
||||
"code": 921861,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 17,
|
||||
@ -706,7 +714,7 @@
|
||||
"name": "icon-dataset",
|
||||
"id": 12,
|
||||
"code": 921862,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 22,
|
||||
@ -714,7 +722,7 @@
|
||||
"name": "icon-datatable",
|
||||
"id": 17,
|
||||
"code": 921863,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 59,
|
||||
@ -722,7 +730,7 @@
|
||||
"name": "icon-dictionary",
|
||||
"id": 54,
|
||||
"code": 921864,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 62,
|
||||
@ -730,7 +738,7 @@
|
||||
"name": "icon-folder",
|
||||
"id": 57,
|
||||
"code": 921865,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 66,
|
||||
@ -738,7 +746,7 @@
|
||||
"name": "icon-image",
|
||||
"id": 61,
|
||||
"code": 921872,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 68,
|
||||
@ -746,7 +754,7 @@
|
||||
"name": "icon-layout",
|
||||
"id": 63,
|
||||
"code": 921873,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 77,
|
||||
@ -754,7 +762,7 @@
|
||||
"name": "icon-object",
|
||||
"id": 72,
|
||||
"code": 921874,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 78,
|
||||
@ -762,7 +770,7 @@
|
||||
"name": "icon-object-unknown",
|
||||
"id": 73,
|
||||
"code": 921875,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 79,
|
||||
@ -770,7 +778,7 @@
|
||||
"name": "icon-packet",
|
||||
"id": 74,
|
||||
"code": 921876,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 80,
|
||||
@ -778,7 +786,7 @@
|
||||
"name": "icon-page",
|
||||
"id": 75,
|
||||
"code": 921877,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 135,
|
||||
@ -786,7 +794,7 @@
|
||||
"name": "icon-plot-overlay",
|
||||
"prevSize": 24,
|
||||
"code": 921878,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 113,
|
||||
@ -794,7 +802,7 @@
|
||||
"name": "icon-plot-stacked",
|
||||
"prevSize": 24,
|
||||
"code": 921879,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 10,
|
||||
@ -802,7 +810,7 @@
|
||||
"name": "icon-session",
|
||||
"id": 5,
|
||||
"code": 921880,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 24,
|
||||
@ -810,7 +818,7 @@
|
||||
"name": "icon-tabular",
|
||||
"id": 19,
|
||||
"code": 921881,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 7,
|
||||
@ -818,7 +826,7 @@
|
||||
"name": "icon-tabular-lad",
|
||||
"id": 2,
|
||||
"code": 921888,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 6,
|
||||
@ -826,7 +834,7 @@
|
||||
"name": "icon-tabular-lad-set",
|
||||
"id": 1,
|
||||
"code": 921889,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 8,
|
||||
@ -834,7 +842,7 @@
|
||||
"name": "icon-tabular-realtime",
|
||||
"id": 3,
|
||||
"code": 921890,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 23,
|
||||
@ -842,7 +850,7 @@
|
||||
"name": "icon-tabular-scrolling",
|
||||
"id": 18,
|
||||
"code": 921891,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 112,
|
||||
@ -850,7 +858,7 @@
|
||||
"name": "icon-telemetry",
|
||||
"id": 86,
|
||||
"code": 921892,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 90,
|
||||
@ -858,7 +866,7 @@
|
||||
"name": "icon-telemetry-panel",
|
||||
"id": 85,
|
||||
"code": 921893,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 93,
|
||||
@ -866,7 +874,7 @@
|
||||
"name": "icon-timeline",
|
||||
"id": 88,
|
||||
"code": 921894,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 116,
|
||||
@ -874,7 +882,7 @@
|
||||
"name": "icon-timer-v1.5",
|
||||
"prevSize": 24,
|
||||
"code": 921895,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 11,
|
||||
@ -882,7 +890,7 @@
|
||||
"name": "icon-topic",
|
||||
"id": 6,
|
||||
"code": 921896,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 115,
|
||||
@ -890,7 +898,7 @@
|
||||
"name": "icon-box-with-dashed-lines",
|
||||
"id": 29,
|
||||
"code": 921897,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 126,
|
||||
@ -898,7 +906,7 @@
|
||||
"name": "icon-summary-widget",
|
||||
"prevSize": 24,
|
||||
"code": 921904,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 139,
|
||||
@ -906,7 +914,7 @@
|
||||
"name": "icon-notebook",
|
||||
"prevSize": 24,
|
||||
"code": 921905,
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -1639,6 +1647,26 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 118,
|
||||
"paths": [
|
||||
"M962 512l-896 512v-1024z"
|
||||
],
|
||||
"attrs": [
|
||||
{}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
"isMulticolor2": false,
|
||||
"grid": 16,
|
||||
"tags": [
|
||||
"icon-arrow-right-equilateral"
|
||||
],
|
||||
"colorPermutations": {
|
||||
"1161751207457516161751": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths": [
|
||||
"M0 512l256 256v-512z",
|
||||
@ -1938,7 +1966,7 @@
|
||||
},
|
||||
{
|
||||
"paths": [
|
||||
"M1024 896l-201.662-201.662c47.922-72.498 73.662-157.434 73.662-246.338 0-119.666-46.6-232.168-131.216-316.784s-197.118-131.216-316.784-131.216-232.168 46.6-316.784 131.216-131.216 197.118-131.216 316.784 46.6 232.168 131.216 316.784 197.118 131.216 316.784 131.216c88.904 0 173.84-25.74 246.338-73.662l201.662 201.662 128-128zM448 704c-141.16 0-256-114.842-256-256 0-141.16 114.84-256 256-256 141.158 0 256 114.84 256 256 0 141.158-114.842 256-256 256z"
|
||||
"M1024 896l-256.8-256.8c42.4-66.6 65-144 64.8-223.2 0-229.8-186.2-416-416-416s-416 186.2-416 416 186.2 416 416 416c79 0.2 156.4-22.4 223.2-64.8l256.8 256.8 128-128zM212.4 619.6c-112.4-112.4-112.4-294.8 0-407.2s294.8-112.4 407.2 0 112.4 294.8 0 407.2c-54 54-127.2 84.4-203.6 84.4-76.4 0.2-149.8-30.2-203.6-84.4z"
|
||||
],
|
||||
"grid": 16,
|
||||
"tags": [
|
||||
@ -1946,15 +1974,26 @@
|
||||
],
|
||||
"defaultCode": 77,
|
||||
"id": 68,
|
||||
"attrs": [],
|
||||
"attrs": [
|
||||
{
|
||||
"fill": "rgb(0, 161, 75)"
|
||||
}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
"isMulticolor2": false,
|
||||
"colorPermutations": {
|
||||
"1161751207457516161751": []
|
||||
"1161751207457516161751": [
|
||||
{
|
||||
"f": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths": [
|
||||
"M640 384h-128v-128h-128v128h-128v128h128v128h128v-128h128z",
|
||||
"M1024 896l-201.662-201.662c47.922-72.498 73.662-157.434 73.662-246.338 0-119.666-46.6-232.168-131.216-316.784s-197.118-131.216-316.784-131.216c-119.666 0-232.168 46.6-316.784 131.216s-131.216 197.118-131.216 316.784c0 119.666 46.6 232.168 131.216 316.784s197.118 131.216 316.784 131.216c88.904 0 173.84-25.74 246.338-73.662l201.662 201.662 128-128zM448 704c-141.16 0-256-114.842-256-256 0-141.16 114.84-256 256-256 141.158 0 256 114.84 256 256 0 141.158-114.842 256-256 256z"
|
||||
"M1024 896l-256.86-256.86c40.681-62.963 64.861-139.898 64.861-222.481 0-0.232-0-0.464-0.001-0.696l0 0.036c0-229.76-186.24-416-416-416s-416 186.24-416 416 186.24 416 416 416c0.196 0 0.427 0.001 0.659 0.001 82.583 0 159.518-24.18 224.112-65.846l-1.631 0.985 256.86 256.86zM212.36 619.64c-52.114-52.117-84.346-124.114-84.346-203.64 0-159.058 128.942-288 288-288s288 128.942 288 288c0 159.058-128.942 288-288 288-0.005 0-0.010-0-0.014-0l0.001 0c-0.242 0.001-0.529 0.001-0.815 0.001-79.271 0-151.010-32.251-202.811-84.348l-0.013-0.014z",
|
||||
"M224 352h384v128h-384v-128z",
|
||||
"M352 224h128v384h-128v-384z"
|
||||
],
|
||||
"grid": 16,
|
||||
"tags": [
|
||||
@ -1962,15 +2001,37 @@
|
||||
],
|
||||
"defaultCode": 88,
|
||||
"id": 66,
|
||||
"attrs": [],
|
||||
"attrs": [
|
||||
{
|
||||
"fill": "rgb(0, 161, 75)"
|
||||
},
|
||||
{
|
||||
"fill": "rgb(0, 161, 75)"
|
||||
},
|
||||
{
|
||||
"fill": "rgb(0, 161, 75)"
|
||||
}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
"isMulticolor2": false,
|
||||
"colorPermutations": {
|
||||
"1161751207457516161751": []
|
||||
"1161751207457516161751": [
|
||||
{
|
||||
"f": 1
|
||||
},
|
||||
{
|
||||
"f": 1
|
||||
},
|
||||
{
|
||||
"f": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths": [
|
||||
"M256 384h384v128h-384v-128z",
|
||||
"M1024 896l-201.662-201.662c47.922-72.498 73.662-157.434 73.662-246.338 0-119.666-46.6-232.168-131.216-316.784s-197.118-131.216-316.784-131.216c-119.666 0-232.168 46.6-316.784 131.216s-131.216 197.118-131.216 316.784c0 119.666 46.6 232.168 131.216 316.784s197.118 131.216 316.784 131.216c88.904 0 173.84-25.74 246.338-73.662l201.662 201.662 128-128zM448 704c-141.16 0-256-114.842-256-256 0-141.16 114.84-256 256-256 141.158 0 256 114.84 256 256 0 141.158-114.842 256-256 256z"
|
||||
"M767.2 639.2c42.4-66.6 65-144 64.8-223.2 0-229.8-186.2-416-416-416s-416 186.2-416 416 186.2 416 416 416c79 0.2 156.4-22.4 223.2-64.8l256.8 256.8 128-128-256.8-256.8zM619.6 619.6c-54 54-127.2 84.4-203.6 84.4-76.4 0.2-149.8-30.2-203.6-84.4-112.4-112.4-112.4-294.8 0-407.2s294.8-112.4 407.2 0c112.4 112.4 112.4 294.8 0 407.2z",
|
||||
"M224 352h384v128h-384v-128z"
|
||||
],
|
||||
"grid": 16,
|
||||
"tags": [
|
||||
@ -1978,16 +2039,32 @@
|
||||
],
|
||||
"defaultCode": 89,
|
||||
"id": 67,
|
||||
"attrs": [],
|
||||
"attrs": [
|
||||
{
|
||||
"fill": "rgb(0, 161, 75)"
|
||||
},
|
||||
{
|
||||
"fill": "rgb(0, 161, 75)"
|
||||
}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
"isMulticolor2": false,
|
||||
"colorPermutations": {
|
||||
"1161751207457516161751": []
|
||||
"1161751207457516161751": [
|
||||
{
|
||||
"f": 1
|
||||
},
|
||||
{
|
||||
"f": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"paths": [
|
||||
"M0 0h1024v256h-1024v-256z",
|
||||
"M0 384h1024v256h-1024v-256z",
|
||||
"M0 768h1024v256h-1024v-256z"
|
||||
"M0 128h1024v128h-1024v-128z",
|
||||
"M0 448h1024v128h-1024v-128z",
|
||||
"M0 768h1024v128h-1024v-128z"
|
||||
],
|
||||
"grid": 16,
|
||||
"tags": [
|
||||
@ -1995,9 +2072,19 @@
|
||||
],
|
||||
"defaultCode": 109,
|
||||
"id": 69,
|
||||
"attrs": [],
|
||||
"attrs": [
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
"isMulticolor2": false,
|
||||
"colorPermutations": {
|
||||
"1161751207457516161751": []
|
||||
"1161751207457516161751": [
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Binary file not shown.
@ -39,6 +39,7 @@
|
||||
<glyph unicode="" glyph-name="icon-brackets" d="M832 960h-192v-192h191.66l0.34-0.34v-639.32l-0.34-0.34h-191.66v-192h192c105.6 0 192 86.4 192 192v640c0 105.6-86.4 192-192 192zM384 128h-191.66l-0.34 0.34v639.32l0.34 0.34h191.66v192h-192c-105.6 0-192-86.4-192-192v-640c0-105.6 86.4-192 192-192h192v192z" />
|
||||
<glyph unicode="" glyph-name="icon-crosshair" d="M574 962h-128v-320h128v320zM1022 514h-320v-128h320v128zM574 258h-128v-320h128v320zM318 514h-320v-128h320v128z" />
|
||||
<glyph unicode="" glyph-name="icon-grippy-v2" horiz-adv-x="586" d="M146.4 777.2c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM146.4 557.8c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM146.4 338.2c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM146.4 118.8c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM365.8 886.8c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM365.8 667.4c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM365.8 448c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM365.8 228.6c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM365.8 9.2c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM585.2 777.2c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM585.2 557.8c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM585.2 338.2c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2zM585.2 118.8c0-40.427-32.773-73.2-73.2-73.2s-73.2 32.773-73.2 73.2c0 40.427 32.773 73.2 73.2 73.2s73.2-32.773 73.2-73.2z" />
|
||||
<glyph unicode="" glyph-name="icon-arrow-right-equilateral" d="M962 448l-896-512v1024z" />
|
||||
<glyph unicode="󡀀" glyph-name="icon-arrows-out" d="M0 448l256-256v512zM512 960l-256-256h512zM512-64l256 256h-512zM768 704v-512l256 256z" />
|
||||
<glyph unicode="󡀁" glyph-name="icon-arrows-right-left" d="M1024 448l-448-512v1024zM448 960l-448-512 448-512z" />
|
||||
<glyph unicode="󡀂" glyph-name="icon-arrows-up-down" d="M512 960l512-448h-1024zM0 384l512-448 512 448z" />
|
||||
@ -54,10 +55,10 @@
|
||||
<glyph unicode="󡀓" glyph-name="icon-fullscreen-collapse" d="M191.656 128c0.118-0.1 0.244-0.224 0.344-0.344v-191.656h192v192c0 105.6-86.4 192-192 192h-192v-192h191.656zM192 768.344c-0.1-0.118-0.224-0.244-0.344-0.344h-191.656v-192h192c105.6 0 192 86.4 192 192v192h-192v-191.656zM832 576h192v192h-191.656c-0.118 0.1-0.244 0.226-0.344 0.344v191.656h-192v-192c0-105.6 86.4-192 192-192zM832 127.656c0.1 0.118 0.224 0.244 0.344 0.344h191.656v192h-192c-105.6 0-192-86.4-192-192v-192h192v191.656z" />
|
||||
<glyph unicode="󡀔" glyph-name="icon-layers" d="M1024 576l-512 384-512-384 512-384zM512 64l-426.666 320-85.334-64 512-384 512 384-85.334 64z" />
|
||||
<glyph unicode="󡀕" glyph-name="icon-line-horz" d="M64 384c-35.346 0-64 28.654-64 64s28.654 64 64 64h896c35.346 0 64-28.654 64-64s-28.654-64-64-64h-896z" />
|
||||
<glyph unicode="󡀖" glyph-name="icon-magnify" d="M1024 64l-201.662 201.662c47.922 72.498 73.662 157.434 73.662 246.338 0 119.666-46.6 232.168-131.216 316.784s-197.118 131.216-316.784 131.216-232.168-46.6-316.784-131.216-131.216-197.118-131.216-316.784 46.6-232.168 131.216-316.784 197.118-131.216 316.784-131.216c88.904 0 173.84 25.74 246.338 73.662l201.662-201.662 128 128zM448 256c-141.16 0-256 114.842-256 256 0 141.16 114.84 256 256 256 141.158 0 256-114.84 256-256 0-141.158-114.842-256-256-256z" />
|
||||
<glyph unicode="󡀗" glyph-name="icon-magnify-in" d="M640 576h-128v128h-128v-128h-128v-128h128v-128h128v128h128zM1024 64l-201.662 201.662c47.922 72.498 73.662 157.434 73.662 246.338 0 119.666-46.6 232.168-131.216 316.784s-197.118 131.216-316.784 131.216c-119.666 0-232.168-46.6-316.784-131.216s-131.216-197.118-131.216-316.784c0-119.666 46.6-232.168 131.216-316.784s197.118-131.216 316.784-131.216c88.904 0 173.84 25.74 246.338 73.662l201.662-201.662 128 128zM448 256c-141.16 0-256 114.842-256 256 0 141.16 114.84 256 256 256 141.158 0 256-114.84 256-256 0-141.158-114.842-256-256-256z" />
|
||||
<glyph unicode="󡀘" glyph-name="icon-magnify-out" d="M256 576h384v-128h-384v128zM1024 64l-201.662 201.662c47.922 72.498 73.662 157.434 73.662 246.338 0 119.666-46.6 232.168-131.216 316.784s-197.118 131.216-316.784 131.216c-119.666 0-232.168-46.6-316.784-131.216s-131.216-197.118-131.216-316.784c0-119.666 46.6-232.168 131.216-316.784s197.118-131.216 316.784-131.216c88.904 0 173.84 25.74 246.338 73.662l201.662-201.662 128 128zM448 256c-141.16 0-256 114.842-256 256 0 141.16 114.84 256 256 256 141.158 0 256-114.84 256-256 0-141.158-114.842-256-256-256z" />
|
||||
<glyph unicode="󡀙" glyph-name="icon-menu" d="M0 960h1024v-256h-1024v256zM0 576h1024v-256h-1024v256zM0 192h1024v-256h-1024v256z" />
|
||||
<glyph unicode="󡀖" glyph-name="icon-magnify" d="M1024 64l-256.8 256.8c42.4 66.6 65 144 64.8 223.2 0 229.8-186.2 416-416 416s-416-186.2-416-416 186.2-416 416-416c79-0.2 156.4 22.4 223.2 64.8l256.8-256.8 128 128zM212.4 340.4c-112.4 112.4-112.4 294.8 0 407.2s294.8 112.4 407.2 0 112.4-294.8 0-407.2c-54-54-127.2-84.4-203.6-84.4-76.4-0.2-149.8 30.2-203.6 84.4z" />
|
||||
<glyph unicode="󡀗" glyph-name="icon-magnify-in" d="M1024 64l-256.86 256.86c40.681 62.963 64.861 139.898 64.861 222.481 0 0.232 0 0.464-0.001 0.696v-0.036c0 229.76-186.24 416-416 416s-416-186.24-416-416 186.24-416 416-416c0.196 0 0.427-0.001 0.659-0.001 82.583 0 159.518 24.18 224.112 65.846l-1.631-0.985 256.86-256.86zM212.36 340.36c-52.114 52.117-84.346 124.114-84.346 203.64 0 159.058 128.942 288 288 288s288-128.942 288-288c0-159.058-128.942-288-288-288-0.005 0-0.010 0-0.014 0h0.001c-0.242-0.001-0.529-0.001-0.815-0.001-79.271 0-151.010 32.251-202.811 84.348l-0.013 0.014zM224 608h384v-128h-384v128zM352 736h128v-384h-128v384z" />
|
||||
<glyph unicode="󡀘" glyph-name="icon-magnify-out" d="M767.2 320.8c42.4 66.6 65 144 64.8 223.2 0 229.8-186.2 416-416 416s-416-186.2-416-416 186.2-416 416-416c79-0.2 156.4 22.4 223.2 64.8l256.8-256.8 128 128-256.8 256.8zM619.6 340.4c-54-54-127.2-84.4-203.6-84.4-76.4-0.2-149.8 30.2-203.6 84.4-112.4 112.4-112.4 294.8 0 407.2s294.8 112.4 407.2 0c112.4-112.4 112.4-294.8 0-407.2zM224 608h384v-128h-384v128z" />
|
||||
<glyph unicode="󡀙" glyph-name="icon-menu" d="M0 832h1024v-128h-1024v128zM0 512h1024v-128h-1024v128zM0 192h1024v-128h-1024v128z" />
|
||||
<glyph unicode="󡀠" glyph-name="icon-move" d="M293.4 448l218.6 218.6 256-256v421.4c0 70.4-57.6 128-128 128h-512c-70.4 0-128-57.6-128-128v-512c0-70.4 57.6-128 128-128h421.4l-256 256zM1024 512h-128v-320l-384 384-128-128 384-384h-320v-128h576z" />
|
||||
<glyph unicode="󡀡" glyph-name="icon-new-window" d="M448 960v-128h320l-384-384 128-128 384 384v-320h128v576zM576 285.726v-157.382c-0.1-0.118-0.226-0.244-0.344-0.344h-383.312c-0.118 0.1-0.244 0.226-0.344 0.344v383.312c0.1 0.118 0.226 0.244 0.344 0.344h157.382l192 192h-349.726c-105.6 0-192-86.4-192-192v-384c0-105.6 86.4-192 192-192h384c105.6 0 192 86.4 192 192v349.726l-192-192z" />
|
||||
<glyph unicode="󡀢" glyph-name="icon-paint-bucket" d="M544 736v-224c0-88.4-71.6-160-160-160s-160 71.6-160 160v97.2l-197.4-196.4c-50-50-12.4-215.2 112.4-340s290-162.4 340-112.4l417 423.6-352 352zM896-64c70.6 0 128 57.4 128 128 0 108.6-128 192-128 192s-128-83.4-128-192c0-70.6 57.4-128 128-128zM384 448c-35.4 0-64 28.6-64 64v384c0 35.4 28.6 64 64 64s64-28.6 64-64v-384c0-35.4-28.6-64-64-64z" />
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Binary file not shown.
Binary file not shown.
@ -157,3 +157,57 @@
|
||||
.t-popup {
|
||||
z-index: 75;
|
||||
}
|
||||
|
||||
/********************************************* GRID STYLES */
|
||||
.grid-two-column {
|
||||
display: grid;
|
||||
grid-row-gap: 0;
|
||||
grid-template-columns: 1fr 2fr;
|
||||
align-items: top;
|
||||
}
|
||||
|
||||
.grid-two-column-span-cols {
|
||||
grid-column: 1 / 3;
|
||||
}
|
||||
|
||||
.grid-elem {
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid $colorInteriorBorder;
|
||||
}
|
||||
&.label {
|
||||
background-color: rgba(0,0,128,0.2);
|
||||
}
|
||||
&.value {
|
||||
background-color: rgba(0,128,0,0.2);
|
||||
}
|
||||
}
|
||||
|
||||
// Properties grids
|
||||
.grid-properties {
|
||||
@extend .grid-two-column;
|
||||
}
|
||||
|
||||
.grid-row {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.grid-span-all {
|
||||
@extend .grid-two-column-span-cols;
|
||||
}
|
||||
|
||||
.grid-row {
|
||||
.grid-cell {
|
||||
padding: 3px $interiorMarginLg 3px 0;
|
||||
&[title] {
|
||||
// When a cell has a title, assume it's helpful text
|
||||
cursor: help;
|
||||
}
|
||||
}
|
||||
&.force-border,
|
||||
&:not(:first-of-type) {
|
||||
// Row borders, effected via border-top on child elements of the row
|
||||
.grid-cell {
|
||||
border-top: 1px solid $colorInspectorSectionHeaderBg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,25 +37,9 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
//.top-bar .btn-browse .badge {
|
||||
// Moved to _controls.scss .btn.browse-btn
|
||||
// border-radius: $controlCr * 1.5;
|
||||
// $d: 20px;
|
||||
// display: block;
|
||||
// font-size: 1em;
|
||||
// line-height: $d;
|
||||
//// margin-top: -4px;
|
||||
//
|
||||
// position: absolute;
|
||||
// top: 5px; left: 5px; bottom: 5px; right: auto;
|
||||
// width: $d; height: auto;
|
||||
//}
|
||||
|
||||
.super-menu .badge {
|
||||
@include background-image(linear-gradient(lighten($colorCreateBtn, 10%), $colorCreateBtn));
|
||||
border-radius: $controlCr;
|
||||
@include boxShdwSubtle();
|
||||
// display: inline-block;
|
||||
// margin-right: 10px !important;
|
||||
padding: 2px 7px;
|
||||
}
|
||||
|
@ -43,10 +43,10 @@ $ueColMargin: 1.5%;
|
||||
$ueAppLogoW: 80px;
|
||||
$ueEditToolBarH: 25px;
|
||||
$ueCollapsedPaneEdgeM: 22px;
|
||||
$uePaneMiniTabH: 22px;
|
||||
$uePaneMiniTabW: 8px;
|
||||
$uePaneMiniTabFontSize: 8px;
|
||||
$uePaneMiniTabCollapsedW: 18px;
|
||||
$uePaneMiniTabH: 36px;
|
||||
$uePaneMiniTabW: 10px;
|
||||
$uePaneMiniTabFontSize: 9px;
|
||||
$uePaneMiniTabCollapsedW: 22px;
|
||||
$ueEditLeftPaneW: 75%;
|
||||
$treeSearchInputBarH: 25px;
|
||||
/*************** Panes */
|
||||
@ -70,7 +70,7 @@ $ueBrowseGridItemTopBarH: 20px;
|
||||
$ueBrowseGridItemBottomBarH: 30px;
|
||||
$itemPadLR: 5px;
|
||||
/*************** Tree */
|
||||
$treeVCW: 10px;
|
||||
$treeVCW: 16px;
|
||||
$treeTypeIconH: 1.4em; // was 16px
|
||||
$treeTypeIconHPx: 16px;
|
||||
$treeTypeIconW: 18px;
|
||||
@ -111,7 +111,7 @@ $bubbleMaxW: 300px;
|
||||
$reqSymbolW: 15px;
|
||||
$reqSymbolM: $interiorMargin * 2;
|
||||
$reqSymbolFontSize: 0.75em;
|
||||
$inputTextPTopBtm: 3px;
|
||||
$inputTextPTopBtm: 2px;
|
||||
$inputTextPLeftRight: 5px;
|
||||
$inputTextP: $inputTextPTopBtm $inputTextPLeftRight;
|
||||
/*************** Wait Spinner Defaults */
|
||||
@ -132,7 +132,7 @@ $menuLineHPx: 24px;
|
||||
$btnStdH: 25px;
|
||||
$btnToolbarH: $btnStdH;
|
||||
$controlBarH: $btnStdH;
|
||||
$btnFrameH: 16px;
|
||||
$btnFrameH: 18px;
|
||||
|
||||
/************************** PATHS */
|
||||
// Paths need to be relative to /platform/commonUI/theme/<theme-name>/css/ directory
|
||||
|
@ -141,7 +141,6 @@ a.disabled {
|
||||
|
||||
.s-status-missing {
|
||||
// Labels. Expects .s-status-missing to be applied to mct-representation that contains
|
||||
// .t-object-label
|
||||
.t-object-label .t-item-icon:before {
|
||||
content: $glyph-icon-object-unknown;
|
||||
}
|
||||
@ -200,7 +199,16 @@ a.disabled {
|
||||
}
|
||||
|
||||
.vscroll {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
&.scroll-pad {
|
||||
padding-right: $interiorMargin;
|
||||
}
|
||||
}
|
||||
|
||||
.vscroll--persist {
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.slidable {
|
||||
@ -224,8 +232,13 @@ a.disabled {
|
||||
box-shadow: rgba(#000, 0.7) 0 4px 10px 2px;
|
||||
}
|
||||
|
||||
.capitalize {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.hide,
|
||||
.hidden {
|
||||
.hidden,
|
||||
.t-main-view .hide-in-t-main-view {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@ -234,14 +247,16 @@ a.disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.off {
|
||||
.invisible {
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0 !important;
|
||||
transform: scale(0);
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.sep {
|
||||
|
@ -33,6 +33,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
[class*="icon-"].labeled {
|
||||
// Moved from .s-button and generalized
|
||||
&:before {
|
||||
// Fend off label from icon when it's included
|
||||
margin-right: $interiorMarginSm;
|
||||
}
|
||||
}
|
||||
|
||||
/************************** CHAR UNICODES */
|
||||
|
||||
$glyph-icon-alert-rect: '\e900';
|
||||
@ -67,6 +75,7 @@ $glyph-icon-x: '\e928';
|
||||
$glyph-icon-brackets: '\e929';
|
||||
$glyph-icon-crosshair: '\e930';
|
||||
$glyph-icon-grippy: '\e931';
|
||||
$glyph-icon-arrow-right-equilateral: '\e932';
|
||||
$glyph-icon-arrows-out: '\e1000';
|
||||
$glyph-icon-arrows-right-left: '\e1001';
|
||||
$glyph-icon-arrows-up-down: '\e1002';
|
||||
@ -182,6 +191,7 @@ $glyph-icon-notebook: '\e1131';
|
||||
.icon-brackets { @include glyphBefore($glyph-icon-brackets); }
|
||||
.icon-crosshair { @include glyphBefore($glyph-icon-crosshair); }
|
||||
.icon-grippy { @include glyphBefore($glyph-icon-grippy); }
|
||||
.icon-arrow-right-equilateral { @include glyphBefore($glyph-icon-arrow-right-equilateral); }
|
||||
.icon-arrows-out { @include glyphBefore($glyph-icon-arrows-out); }
|
||||
.icon-arrows-right-left { @include glyphBefore($glyph-icon-arrows-right-left); }
|
||||
.icon-arrows-up-down { @include glyphBefore($glyph-icon-arrows-up-down); }
|
||||
|
@ -19,23 +19,15 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/* Styles for the Inspector pane */
|
||||
|
||||
.l-inspect,
|
||||
.l-inspect table tr td {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* New grid layout for the Inspector pane */
|
||||
.l-inspect {
|
||||
// Overall layout
|
||||
@extend .abs;
|
||||
background: $colorInspectorBg;
|
||||
color: $colorInspectorFg;
|
||||
line-height: 140%;
|
||||
|
||||
.flex-elem.holder:not(:last-child) {
|
||||
margin-bottom: $interiorMargin;
|
||||
}
|
||||
|
||||
.pane-header {
|
||||
color: pushBack($colorInspectorFg, 20%);
|
||||
font-size: 0.8rem;
|
||||
@ -50,80 +42,48 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.l-inspector-part {
|
||||
box-sizing: border-box;
|
||||
padding-right: $interiorMargin;
|
||||
.tree .form {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.tree {
|
||||
.grid-properties {
|
||||
margin-left: $treeVCW + $interiorMarginLg;
|
||||
}
|
||||
.section-header {
|
||||
background: none;
|
||||
color: $colorInspectorPropName;
|
||||
border-radius: unset;
|
||||
font-size: inherit;
|
||||
padding: $interiorMarginSm 0;
|
||||
}
|
||||
|
||||
mct-form:not(:last-child) .form {
|
||||
border-bottom: 1px solid $colorInspectorSectionHeaderBg;
|
||||
}
|
||||
|
||||
.form {
|
||||
margin-bottom: $interiorMarginSm;
|
||||
padding-bottom: $interiorMarginLg;
|
||||
.l-section-body {
|
||||
margin-bottom: 0;
|
||||
&:not(.first) {
|
||||
border-top: 1px solid $colorFormLines;
|
||||
}
|
||||
}
|
||||
.form-row {
|
||||
align-items: center;
|
||||
border: none !important;
|
||||
margin-bottom: 0 !important;
|
||||
padding: $interiorMarginSm 0;
|
||||
.label {
|
||||
min-width: 80px;
|
||||
}
|
||||
input[type='text'],
|
||||
input[type='search'] {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul li,
|
||||
em.t-inspector-part-header {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
ul li {
|
||||
margin-bottom: $interiorMarginLg;
|
||||
}
|
||||
|
||||
em.t-inspector-part-header {
|
||||
border-radius: $basicCr;
|
||||
background-color: $colorInspectorSectionHeaderBg;
|
||||
color: $colorInspectorSectionHeaderFg;
|
||||
margin-bottom: $interiorMargin;
|
||||
padding: floor($formTBPad * .75) $formLRPad;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.inspector-properties {
|
||||
&:not(.first) {
|
||||
border-top: 1px solid $colorInspectorSectionHeaderBg;
|
||||
}
|
||||
padding: $interiorMarginSm 0;
|
||||
.grid-properties {
|
||||
.label {
|
||||
color: $colorInspectorPropName;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.value {
|
||||
color: $colorInspectorPropVal;
|
||||
word-break: break-all;
|
||||
&:first-child {
|
||||
// If there is no preceding .label element, make value span columns
|
||||
@extend .grid-two-column-span-cols;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.inspector-location {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
h2 {
|
||||
// Headers for .l-inspector-part elements
|
||||
@extend .grid-two-column-span-cols;
|
||||
border-radius: $controlCr;
|
||||
background-color: $colorInspectorSectionHeaderBg;
|
||||
color: $colorInspectorSectionHeaderFg;
|
||||
font-size: 0.8rem;
|
||||
font-weight: normal;
|
||||
margin: $interiorMarginLg 0 $interiorMarginSm 0;
|
||||
padding: floor($formTBPad * .75) $formLRPad;
|
||||
text-transform: uppercase;
|
||||
&.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,6 +122,34 @@
|
||||
width: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
// Elements pool
|
||||
.holder-elements {
|
||||
.current-elements {
|
||||
position: relative;
|
||||
.tree-item {
|
||||
.t-object-label {
|
||||
// Elements pool is a flat list, so don't indent items.
|
||||
font-size: 0.75rem;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Styles for the Inspector pane */
|
||||
|
||||
.l-inspect,
|
||||
.l-inspect table tr td {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.l-inspect {
|
||||
.flex-elem.holder:not(:last-child) {
|
||||
margin-bottom: $interiorMargin;
|
||||
}
|
||||
|
||||
.holder-elements {
|
||||
.current-elements {
|
||||
position: relative;
|
||||
|
@ -42,6 +42,7 @@
|
||||
@import "controls/lists";
|
||||
@import "controls/menus";
|
||||
@import "controls/messages";
|
||||
@import "controls/indicators";
|
||||
@import "mobile/controls/menus";
|
||||
|
||||
/********************************* FORMS */
|
||||
|
@ -299,7 +299,7 @@
|
||||
color: $ic;
|
||||
}
|
||||
@if $bgHov != none {
|
||||
&:not(.disabled):hover {
|
||||
&:not([disabled="true"]):not(.disabled):hover {
|
||||
background: $bgHov;
|
||||
color: $fgHov;
|
||||
>.icon,
|
||||
@ -334,7 +334,7 @@
|
||||
color: $fg;
|
||||
}
|
||||
|
||||
@mixin nice-input($bg: $colorInputBg, $fg: $colorInputFg, $shdw: rgba(black, 0.6) 0 1px 3px) {
|
||||
@mixin nice-input($bg: $colorInputBg, $fg: $colorInputFg, $shdw: rgba(black, 0.5) 0 0px 2px) {
|
||||
@include s-input($bg, $fg, $shdw);
|
||||
border: none;
|
||||
outline: none;
|
||||
|
@ -20,66 +20,120 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*************************************************** MIXINS */
|
||||
@mixin formulateStatusColors($c) {
|
||||
@mixin elementStatusColors($c) {
|
||||
// Sets bg and icon colors for elements
|
||||
background: rgba($c, 0.4) !important;
|
||||
&:before { color: $c !important; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************** GENERAL */
|
||||
.s-limit-yellow,
|
||||
.s-limit-red,
|
||||
.s-limit-yellow-icon,
|
||||
.s-limit-red-icon,
|
||||
.s-status-warning-lo,
|
||||
.s-status-warning-hi,
|
||||
.s-status-diagnostic,
|
||||
.s-status-command,
|
||||
.s-status-info,
|
||||
.s-status-ok,
|
||||
.s-status-warning-lo-icon,
|
||||
.s-status-warning-hi-icon,
|
||||
.s-status-diagnostic-icon,
|
||||
.s-status-command-icon,
|
||||
.s-status-info-icon,
|
||||
.s-status-ok-icon {
|
||||
@include trans-prop-nice($props: background, $dur: 500ms);
|
||||
background: rgba($c, 0.5) !important;
|
||||
&:before {
|
||||
content:'';
|
||||
font-family: symbolsfont;
|
||||
font-size: 0.8em;
|
||||
margin-right: $interiorMarginSm;
|
||||
color: $c !important;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin indicatorStatusColors($c) {
|
||||
&:before, .count {
|
||||
color: $c;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************** GENERAL */
|
||||
.s-limit-upr,
|
||||
.s-limit-lwr,
|
||||
[class*='s-limit-icon'],
|
||||
[class*='s-status-icon'] {
|
||||
&:before {
|
||||
content:'';
|
||||
display: inline-block;
|
||||
font-family: symbolsfont;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************** LIMITS */
|
||||
.s-limit-yellow, .s-limit-yellow-icon {
|
||||
@include formulateStatusColors($colorWarningLo);
|
||||
[class*='s-limit'] {
|
||||
&[class*='icon-'] {
|
||||
&:before {
|
||||
margin-right: $interiorMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.s-limit-red, .s-limit-red-icon {
|
||||
@include formulateStatusColors($colorWarningHi);
|
||||
.s-limit-yellow, .s-limit-icon-yellow {
|
||||
@include elementStatusColors($colorWarningLo);
|
||||
}
|
||||
|
||||
.s-limit-upr:before { content: $glyph-icon-arrow-double-up; }
|
||||
.s-limit-lwr:before { content: $glyph-icon-arrow-double-down; }
|
||||
.s-limit-yellow-icon:before,
|
||||
.s-limit-red-icon:before { content: $glyph-icon-alert-triangle; }
|
||||
.s-limit-red, .s-limit-icon-red {
|
||||
@include elementStatusColors($colorWarningHi);
|
||||
}
|
||||
|
||||
.s-limit {
|
||||
&-upr,
|
||||
&-lwr {
|
||||
&:before {
|
||||
margin-right: $interiorMargin;
|
||||
}
|
||||
}
|
||||
|
||||
&-upr:before { content: $glyph-icon-arrow-double-up; }
|
||||
&-lwr:before { content: $glyph-icon-arrow-double-down; }
|
||||
|
||||
&-icon-yellow,
|
||||
&-icon-red {
|
||||
&:before {
|
||||
content: $glyph-icon-alert-triangle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************** STATUS */
|
||||
.s-status-warning-hi, .s-status-warning-hi-icon { @include formulateStatusColors($colorWarningHi); }
|
||||
.s-status-warning-lo, .s-status-warning-lo-icon { @include formulateStatusColors($colorWarningLo); }
|
||||
.s-status-diagnostic, .s-status-diagnostic-icon { @include formulateStatusColors($colorDiagnostic); }
|
||||
.s-status-info, .s-status-info-icon { @include formulateStatusColors($colorInfo); }
|
||||
.s-status-ok, .s-status-ok-icon { @include formulateStatusColors($colorOk); }
|
||||
[class*='s-status'] {
|
||||
&[class*='icon-'] {
|
||||
&:before {
|
||||
margin-right: $interiorMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.s-status-warning-hi-icon:before { content: $glyph-icon-alert-triangle; }
|
||||
.s-status-warning-lo-icon:before { content: $glyph-icon-alert-rect; }
|
||||
.s-status-diagnostic-icon:before { content: $glyph-icon-eye-open; }
|
||||
.s-status-info-icon:before { content: $glyph-icon-info; }
|
||||
.s-status-ok-icon:before { content: $glyph-icon-check; }
|
||||
.s-status-warning-hi, .s-status-icon-warning-hi { @include elementStatusColors($colorWarningHi); }
|
||||
.s-status-warning-lo, .s-status-icon-warning-lo { @include elementStatusColors($colorWarningLo); }
|
||||
.s-status-diagnostic, .s-status-icon-diagnostic { @include elementStatusColors($colorDiagnostic); }
|
||||
.s-status-info, .s-status-icon-info { @include elementStatusColors($colorInfo); }
|
||||
.s-status-ok, .s-status-icon-ok { @include elementStatusColors($colorOk); }
|
||||
|
||||
.s-status-icon-warning-hi:before { content: $glyph-icon-alert-triangle; }
|
||||
.s-status-icon-warning-lo:before { content: $glyph-icon-alert-rect; }
|
||||
.s-status-icon-diagnostic:before { content: $glyph-icon-eye-open; }
|
||||
.s-status-icon-info:before { content: $glyph-icon-info; }
|
||||
.s-status-icon-ok:before { content: $glyph-icon-check; }
|
||||
|
||||
/*************************************************** INDICATOR COLORING */
|
||||
.ls-indicator {
|
||||
&.s-status-info {
|
||||
@include indicatorStatusColors($colorInfo);
|
||||
}
|
||||
|
||||
&.s-status-disabled {
|
||||
@include indicatorStatusColors($colorIndicatorDisabled);
|
||||
}
|
||||
|
||||
&.s-status-available {
|
||||
@include indicatorStatusColors($colorIndicatorAvailable);
|
||||
}
|
||||
|
||||
&.s-status-on,
|
||||
&.s-status-enabled {
|
||||
@include indicatorStatusColors($colorIndicatorOn);
|
||||
}
|
||||
|
||||
&.s-status-off {
|
||||
@include indicatorStatusColors($colorIndicatorOff);
|
||||
}
|
||||
|
||||
&.s-status-caution,
|
||||
&.s-status-warning,
|
||||
&.s-status-alert {
|
||||
@include indicatorStatusColors($colorStatusAlert);
|
||||
}
|
||||
|
||||
&.s-status-error {
|
||||
@include indicatorStatusColors($colorStatusError);
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user