Merge branch 'open-master' into open1291

Merge in latest from master branch into topic branch
for WTD-1291.
This commit is contained in:
Victor Woeltjen 2015-06-23 11:33:27 -07:00
commit e4db4d3802
61 changed files with 2232 additions and 423 deletions

View File

@ -7,7 +7,9 @@
"platform/commonUI/edit",
"platform/commonUI/dialog",
"platform/commonUI/general",
"platform/commonUI/inspect",
"platform/containment",
"platform/execution",
"platform/telemetry",
"platform/features/layout",
"platform/features/pages",
@ -16,7 +18,6 @@
"platform/forms",
"platform/persistence/queue",
"platform/policy",
"platform/entanglement",
"example/persistence",
"example/generator"

1
example/worker/README.md Normal file
View File

@ -0,0 +1 @@
Example of running a Web Worker using the `workerService`.

View File

@ -0,0 +1,16 @@
{
"extensions": {
"indicators": [
{
"implementation": "FibonacciIndicator.js",
"depends": [ "workerService", "$rootScope" ]
}
],
"workers": [
{
"key": "example.fibonacci",
"scriptUrl": "FibonacciWorker.js"
}
]
}
}

View File

@ -0,0 +1,70 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* Displays Fibonacci numbers in the status area.
* @constructor
*/
function FibonacciIndicator(workerService, $rootScope) {
var latest,
counter = 0,
worker = workerService.run('example.fibonacci');
function requestNext() {
worker.postMessage([counter]);
counter += 1;
}
function handleResponse(event) {
latest = event.data;
$rootScope.$apply();
requestNext();
}
worker.onmessage = handleResponse;
requestNext();
return {
getGlyph: function () {
return "?";
},
getText: function () {
return latest;
},
getGlyphClass: function () {
return "";
},
getDescription: function () {
return "";
}
};
}
return FibonacciIndicator;
}
);

View File

@ -0,0 +1,15 @@
/*global self*/
(function () {
"use strict";
// Calculate fibonacci numbers inefficiently.
// We can do this because we're on a background thread, and
// won't halt the UI.
function fib(n) {
return n < 2 ? n : (fib(n - 1) + fib(n - 2));
}
self.onmessage = function (event) {
self.postMessage(fib(event.data));
};
}());

View File

@ -2,19 +2,26 @@
"extensions": {
"routes": [
{
"when": "/browse",
"templateUrl": "templates/browse.html"
"when": "/browse/:ids*",
"templateUrl": "templates/browse.html",
"reloadOnSearch": false
},
{
"when": "",
"templateUrl": "templates/browse.html"
"templateUrl": "templates/browse.html",
"reloadOnSearch": false
}
],
"controllers": [
{
"key": "BrowseController",
"implementation": "BrowseController.js",
"depends": [ "$scope", "objectService", "navigationService" ]
"depends": [ "$scope", "$route", "$location", "objectService", "navigationService" ]
},
{
"key": "BrowseObjectController",
"implementation": "BrowseObjectController.js",
"depends": [ "$scope", "$location", "$route" ]
},
{
"key": "CreateMenuController",
@ -57,7 +64,8 @@
{
"key": "grid-item",
"templateUrl": "templates/items/grid-item.html",
"uses": [ "type", "action" ]
"uses": [ "type", "action" ],
"gestures": [ "info", "menu" ]
},
{
"key": "object-header",
@ -150,4 +158,4 @@
}
]
}
}
}

View File

@ -19,7 +19,7 @@
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<span>
<span ng-controller="BrowseObjectController">
<div class="object-browse-bar bar abs">
<div class="items-select left abs">
<mct-representation key="'object-header'" mct-object="domainObject">
@ -44,4 +44,4 @@
mct-object="representation.selected.key && domainObject">
</mct-representation>
</div>
</span>
</span>

View File

@ -29,7 +29,8 @@ define(
function () {
"use strict";
var ROOT_OBJECT = "ROOT";
var ROOT_ID = "ROOT",
DEFAULT_PATH = "mine";
/**
* The BrowseController is used to populate the initial scope in Browse
@ -40,35 +41,98 @@ define(
*
* @constructor
*/
function BrowseController($scope, objectService, navigationService) {
function BrowseController($scope, $route, $location, objectService, navigationService) {
var path = [ROOT_ID].concat(
($route.current.params.ids || DEFAULT_PATH).split("/")
);
function updateRoute(domainObject) {
var context = domainObject &&
domainObject.getCapability('context'),
objectPath = context ? context.getPath() : [],
ids = objectPath.map(function (domainObject) {
return domainObject.getId();
}),
priorRoute = $route.current,
// Act as if params HADN'T changed to avoid page reload
unlisten;
unlisten = $scope.$on('$locationChangeSuccess', function () {
$route.current = priorRoute;
unlisten();
});
$location.path("/browse/" + ids.slice(1).join("/"));
}
// Callback for updating the in-scope reference to the object
// that is currently navigated-to.
function setNavigation(domainObject) {
$scope.navigatedObject = domainObject;
$scope.treeModel.selectedObject = domainObject;
navigationService.setNavigation(domainObject);
updateRoute(domainObject);
}
function navigateTo(domainObject) {
// Check if an object has been navigated-to already...
// If not, or if an ID path has been explicitly set in the URL,
// navigate to the URL-specified object.
if (!navigationService.getNavigation() || $route.current.params.ids) {
// If not, pick a default as the last
// root-level component (usually "mine")
navigationService.setNavigation(domainObject);
$scope.navigatedObject = domainObject;
} else {
// Otherwise, just expose the currently navigated object.
$scope.navigatedObject = navigationService.getNavigation();
updateRoute($scope.navigatedObject);
}
}
function findObject(domainObjects, id) {
var i;
for (i = 0; i < domainObjects.length; i += 1) {
if (domainObjects[i].getId() === id) {
return domainObjects[i];
}
}
}
// Navigate to the domain object identified by path[index],
// which we expect to find in the composition of the passed
// domain object.
function doNavigate(domainObject, index) {
var composition = domainObject.useCapability("composition");
if (composition) {
composition.then(function (c) {
var nextObject = findObject(c, path[index]);
if (nextObject) {
if (index + 1 >= path.length) {
navigateTo(nextObject);
} else {
doNavigate(nextObject, index + 1);
}
} else {
// Couldn't find the next element of the path
// so navigate to the last path object we did find
navigateTo(domainObject);
}
});
} else {
// Similar to above case; this object has no composition,
// so navigate to it instead of subsequent path elements.
navigateTo(domainObject);
}
}
// Load the root object, put it in the scope.
// Also, load its immediate children, and (possibly)
// navigate to one of them, so that navigation state has
// a useful initial value.
objectService.getObjects([ROOT_OBJECT]).then(function (objects) {
var composition = objects[ROOT_OBJECT].useCapability("composition");
$scope.domainObject = objects[ROOT_OBJECT];
if (composition) {
composition.then(function (c) {
// Check if an object has been navigated-to already...
if (!navigationService.getNavigation()) {
// If not, pick a default as the last
// root-level component (usually "mine")
navigationService.setNavigation(c[c.length - 1]);
} else {
// Otherwise, just expose it in the scope
$scope.navigatedObject = navigationService.getNavigation();
}
});
}
objectService.getObjects([path[0]]).then(function (objects) {
$scope.domainObject = objects[path[0]];
doNavigate($scope.domainObject, 1);
});
// Provide a model for the tree to modify
@ -91,4 +155,4 @@ define(
return BrowseController;
}
);
);

View File

@ -0,0 +1,69 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
define(
[],
function () {
"use strict";
/**
* Controller for the `browse-object` representation of a domain
* object (the right-hand side of Browse mode.)
* @constructor
*/
function BrowseObjectController($scope, $location, $route) {
function setViewForDomainObject(domainObject) {
var locationViewKey = $location.search().view;
function selectViewIfMatching(view) {
if (view.key === locationViewKey) {
$scope.representation = $scope.representation || {};
$scope.representation.selected = view;
}
}
if (locationViewKey) {
((domainObject && domainObject.useCapability('view')) || [])
.forEach(selectViewIfMatching);
}
}
function updateQueryParam(viewKey) {
var unlisten, priorRoute = $route.current;
if (viewKey) {
$location.search('view', viewKey);
unlisten = $scope.$on('$locationChangeSuccess', function () {
$route.current = priorRoute;
unlisten();
});
}
}
$scope.$watch('domainObject', setViewForDomainObject);
$scope.$watch('representation.selected.key', updateQueryParam);
}
return BrowseObjectController;
}
);

View File

@ -31,10 +31,13 @@ define(
describe("The browse controller", function () {
var mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService,
mockRootObject,
mockDomainObject,
mockNextObject,
controller;
function mockPromise(value) {
@ -50,6 +53,11 @@ define(
"$scope",
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
[ "path" ]
);
mockObjectService = jasmine.createSpyObj(
"objectService",
[ "getObjects" ]
@ -71,25 +79,38 @@ define(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockNextObject = jasmine.createSpyObj(
"nextObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockObjectService.getObjects.andReturn(mockPromise({
ROOT: mockRootObject
}));
mockRootObject.useCapability.andReturn(mockPromise([
mockDomainObject
]));
mockDomainObject.useCapability.andReturn(mockPromise([
mockNextObject
]));
mockNextObject.useCapability.andReturn(undefined);
mockNextObject.getId.andReturn("next");
mockDomainObject.getId.andReturn("mine");
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
});
it("uses composition to set the navigated object, if there is none", function () {
mockRootObject.useCapability.andReturn(mockPromise([
mockDomainObject
]));
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
@ -98,12 +119,11 @@ define(
});
it("does not try to override navigation", function () {
// This behavior is needed if object navigation has been
// determined by query string parameters
mockRootObject.useCapability.andReturn(mockPromise([null]));
mockNavigationService.getNavigation.andReturn(mockDomainObject);
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
@ -130,6 +150,76 @@ define(
);
});
it("uses route parameters to choose initially-navigated object", function () {
mockRoute.current.params.ids = "mine/next";
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
expect(mockScope.navigatedObject).toBe(mockNextObject);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockNextObject);
});
it("handles invalid IDs by going as far as possible", function () {
// Idea here is that if we get a bad path of IDs,
// browse controller should traverse down it until
// it hits an invalid ID.
mockRoute.current.params.ids = "mine/junk";
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
expect(mockScope.navigatedObject).toBe(mockDomainObject);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockDomainObject);
});
it("handles compositionless objects by going as far as possible", function () {
// Idea here is that if we get a path which passes
// through an object without a composition, browse controller
// should stop at it since remaining IDs cannot be loaded.
mockRoute.current.params.ids = "mine/next/junk";
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
expect(mockScope.navigatedObject).toBe(mockNextObject);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockNextObject);
});
it("updates the displayed route to reflect current navigation", function () {
var mockContext = jasmine.createSpyObj('context', ['getPath']),
mockUnlisten = jasmine.createSpy('unlisten');
mockContext.getPath.andReturn(
[mockRootObject, mockDomainObject, mockNextObject]
);
mockNextObject.getCapability.andCallFake(function (c) {
return c === 'context' && mockContext;
});
mockScope.$on.andReturn(mockUnlisten);
// Provide a navigation change
mockNavigationService.addListener.mostRecentCall.args[0](
mockNextObject
);
expect(mockLocation.path).toHaveBeenCalledWith("/browse/mine/next");
// Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();
});
});
}
);
);

View File

@ -0,0 +1,99 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
["../src/BrowseObjectController"],
function (BrowseObjectController) {
"use strict";
describe("The browse object controller", function () {
var mockScope,
mockLocation,
mockRoute,
mockUnlisten,
controller;
// Utility function; look for a $watch on scope and fire it
function fireWatch(expr, value) {
mockScope.$watch.calls.forEach(function (call) {
if (call.args[0] === expr) {
call.args[1](value);
}
});
}
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
[ "path", "search" ]
);
mockUnlisten = jasmine.createSpy("unlisten");
mockScope.$on.andReturn(mockUnlisten);
controller = new BrowseObjectController(
mockScope,
mockLocation,
mockRoute
);
});
it("updates query parameters when selected view changes", function () {
fireWatch("representation.selected.key", "xyz");
expect(mockLocation.search).toHaveBeenCalledWith('view', "xyz");
// Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();
});
it("sets the active view from query parameters", function () {
var mockDomainObject = jasmine.createSpyObj(
"domainObject",
['getId', 'getModel', 'getCapability', 'useCapability']
),
testViews = [
{ key: 'abc' },
{ key: 'def', someKey: 'some value' },
{ key: 'xyz' }
];
mockDomainObject.useCapability.andCallFake(function (c) {
return (c === 'view') && testViews;
});
mockLocation.search.andReturn({ view: 'def' });
fireWatch('domainObject', mockDomainObject);
expect(mockScope.representation.selected)
.toEqual(testViews[1]);
});
});
}
);

View File

@ -1,5 +1,6 @@
[
"BrowseController",
"BrowseObjectController",
"creation/CreateAction",
"creation/CreateActionProvider",
"creation/CreateMenuController",
@ -10,4 +11,4 @@
"navigation/NavigationService",
"windowing/FullscreenAction",
"windowing/WindowTitler"
]
]

View File

@ -181,7 +181,7 @@
"key": "label",
"templateUrl": "templates/label.html",
"uses": [ "type" ],
"gestures": [ "drag", "menu" ]
"gestures": [ "drag", "menu", "info" ]
},
{
"key": "node",

View File

@ -84,7 +84,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* line 5, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 5, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
@ -105,38 +105,38 @@ time, mark, audio, video {
font-size: 100%;
vertical-align: baseline; }
/* line 22, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 22, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
html {
line-height: 1; }
/* line 24, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 24, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
ol, ul {
list-style: none; }
/* line 26, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 26, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
table {
border-collapse: collapse;
border-spacing: 0; }
/* line 28, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 28, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
caption, th, td {
text-align: left;
font-weight: normal;
vertical-align: middle; }
/* line 30, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 30, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
q, blockquote {
quotes: none; }
/* line 103, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 103, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
q:before, q:after, blockquote:before, blockquote:after {
content: "";
content: none; }
/* line 32, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 32, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
a img {
border: none; }
/* line 116, ../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
/* line 116, ../../../../../../../../../../Library/Ruby/Gems/2.0.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary {
display: block; }
@ -328,6 +328,10 @@ span {
*/ }
/* line 72, ../sass/_global.scss */
mct-container {
display: block; }
/* line 76, ../sass/_global.scss */
.abs, .btn-menu span.l-click-area {
position: absolute;
top: 0;
@ -337,51 +341,51 @@ span {
height: auto;
width: auto; }
/* line 82, ../sass/_global.scss */
/* line 86, ../sass/_global.scss */
.code, .codehilite {
font-family: "Lucida Console", monospace;
font-size: 0.7em;
line-height: 150%;
white-space: pre; }
/* line 89, ../sass/_global.scss */
/* line 93, ../sass/_global.scss */
.codehilite {
background-color: rgba(255, 255, 255, 0.1);
padding: 1em; }
/* line 95, ../sass/_global.scss */
/* line 99, ../sass/_global.scss */
.align-right {
text-align: right; }
/* line 99, ../sass/_global.scss */
/* line 103, ../sass/_global.scss */
.centered {
text-align: center; }
/* line 103, ../sass/_global.scss */
/* line 107, ../sass/_global.scss */
.no-margin {
margin: 0; }
/* line 107, ../sass/_global.scss */
/* line 111, ../sass/_global.scss */
.colorKey {
color: #0099cc; }
/* line 111, ../sass/_global.scss */
/* line 115, ../sass/_global.scss */
.ds {
-moz-box-shadow: rgba(0, 0, 0, 0.7) 0 4px 10px 2px;
-webkit-box-shadow: rgba(0, 0, 0, 0.7) 0 4px 10px 2px;
box-shadow: rgba(0, 0, 0, 0.7) 0 4px 10px 2px; }
/* line 115, ../sass/_global.scss */
/* line 119, ../sass/_global.scss */
.hide,
.hidden {
display: none !important; }
/* line 121, ../sass/_global.scss */
/* line 125, ../sass/_global.scss */
.paused:not(.s-btn):not(.icon-btn) {
border-color: #c56f01 !important;
color: #c56f01 !important; }
/* line 127, ../sass/_global.scss */
/* line 131, ../sass/_global.scss */
.sep {
color: rgba(255, 255, 255, 0.2); }
@ -1737,16 +1741,6 @@ a.l-btn,
a.l-btn span {
display: inline-block; }
/* line 153, ../sass/controls/_buttons.scss */
.l-btn {
padding: 0 7.5px; }
/* line 155, ../sass/controls/_buttons.scss */
.l-btn.sm {
padding: 0 5px; }
/* line 158, ../sass/controls/_buttons.scss */
.l-btn.vsm {
padding: 0 2.5px; }
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
@ -2621,7 +2615,7 @@ label.checkbox.custom {
position: absolute;
height: 200px;
width: 170px;
z-index: 59; }
z-index: 70; }
/* line 172, ../sass/controls/_menus.scss */
.context-menu-holder .context-menu-wrapper {
position: absolute;
@ -2641,6 +2635,212 @@ label.checkbox.custom {
right: 0;
width: auto; }
/* line 1, ../sass/controls/_time-controller.scss */
.l-time-controller {
position: relative;
margin: 10px 0;
min-width: 400px; }
/* line 12, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-inputs-holder,
.l-time-controller .l-time-range-slider {
font-size: 0.8em; }
/* line 17, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-inputs-holder,
.l-time-controller .l-time-range-slider-holder,
.l-time-controller .l-time-range-ticks-holder {
margin-bottom: 5px;
position: relative; }
/* line 24, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider,
.l-time-controller .l-time-range-ticks {
overflow: visible;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: auto;
height: auto; }
/* line 30, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-inputs-holder {
height: 20px; }
/* line 34, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider,
.l-time-controller .l-time-range-ticks {
left: 90px;
right: 90px; }
/* line 40, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider-holder {
height: 30px; }
/* line 42, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider-holder .range-holder {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
background: none;
border: none;
height: 75%; }
/* line 50, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder {
height: 10px; }
/* line 52, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks {
border-top: 1px solid #4d4d4d; }
/* line 54, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks .tick {
background-color: #4d4d4d;
border: none;
width: 1px;
margin-left: -1px; }
/* line 59, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks .tick:first-child {
margin-left: 0; }
/* line 62, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks .tick .l-time-range-tick-label {
color: gray;
font-size: 0.7em;
position: absolute;
margin-left: -25px;
text-align: center;
top: 10px;
width: 50px;
z-index: 2; }
/* line 76, ../sass/controls/_time-controller.scss */
.l-time-controller .knob {
width: 9px; }
/* line 78, ../sass/controls/_time-controller.scss */
.l-time-controller .knob .range-value {
position: absolute;
top: 50%;
margin-top: -7px;
white-space: nowrap;
width: 75px; }
/* line 87, ../sass/controls/_time-controller.scss */
.l-time-controller .knob:hover .range-value {
color: #0099cc; }
/* line 90, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-l {
margin-left: -4.5px; }
/* line 92, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-l .range-value {
text-align: right;
right: 14px; }
/* line 97, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-r {
margin-right: -4.5px; }
/* line 99, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-r .range-value {
left: 14px; }
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* line 26, ../sass/edit/_editor.scss */
.edit-main .edit-corner,
.edit-main .edit-handle {
position: absolute;
z-index: 2; }
/* line 32, ../sass/edit/_editor.scss */
.edit-main .edit-corner {
width: 15px;
height: 15px; }
/* line 35, ../sass/edit/_editor.scss */
.edit-main .edit-corner.edit-resize-nw {
-moz-border-radius-bottomright: 5px;
-webkit-border-bottom-right-radius: 5px;
border-bottom-right-radius: 5px;
cursor: nw-resize;
top: 0;
left: 0; }
/* line 40, ../sass/edit/_editor.scss */
.edit-main .edit-corner.edit-resize-se {
-moz-border-radius-topleft: 5px;
-webkit-border-top-left-radius: 5px;
border-top-left-radius: 5px;
cursor: se-resize;
bottom: 0;
right: 0; }
/* line 45, ../sass/edit/_editor.scss */
.edit-main .edit-corner.edit-resize-sw {
-moz-border-radius-topright: 5px;
-webkit-border-top-right-radius: 5px;
border-top-right-radius: 5px;
cursor: sw-resize;
bottom: 0;
left: 0; }
/* line 53, ../sass/edit/_editor.scss */
.edit-main .edit-handle {
top: 15px;
right: 15px;
bottom: 15px;
left: 15px; }
/* line 55, ../sass/edit/_editor.scss */
.edit-main .edit-handle.edit-move {
cursor: move;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1; }
/* line 65, ../sass/edit/_editor.scss */
.edit-main .edit-handle.edit-resize-n {
top: 0px;
bottom: auto;
height: 15px;
cursor: n-resize; }
/* line 70, ../sass/edit/_editor.scss */
.edit-main .edit-handle.edit-resize-e {
right: 0px;
left: auto;
width: 15px;
cursor: e-resize; }
/* line 75, ../sass/edit/_editor.scss */
.edit-main .edit-handle.edit-resize-s {
bottom: 0px;
top: auto;
height: 15px;
cursor: s-resize; }
/* line 80, ../sass/edit/_editor.scss */
.edit-main .edit-handle.edit-resize-w {
left: 0px;
right: auto;
width: 15px;
cursor: w-resize; }
/* line 89, ../sass/edit/_editor.scss */
.edit-main .frame.child-frame.panel:hover {
-moz-box-shadow: rgba(0, 0, 0, 0.7) 0 3px 10px;
-webkit-box-shadow: rgba(0, 0, 0, 0.7) 0 3px 10px;
box-shadow: rgba(0, 0, 0, 0.7) 0 3px 10px;
border-color: #0099cc;
z-index: 2; }
/* line 93, ../sass/edit/_editor.scss */
.edit-main .frame.child-frame.panel:hover .view-switcher {
opacity: 1; }
/* line 96, ../sass/edit/_editor.scss */
.edit-main .frame.child-frame.panel:hover .edit-corner {
background-color: rgba(0, 153, 204, 0.8); }
/* line 98, ../sass/edit/_editor.scss */
.edit-main .frame.child-frame.panel:hover .edit-corner:hover {
background-color: #0099cc; }
/* line 1, ../sass/features/_imagery.scss */
.l-image-main-wrapper,
.l-image-main,
@ -2856,103 +3056,6 @@ label.checkbox.custom {
font-size: 0.9em;
line-height: 1em; }
/* line 1, ../sass/controls/_time-controller.scss */
.l-time-controller {
position: relative;
margin: 10px 0;
min-width: 400px; }
/* line 12, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-inputs-holder,
.l-time-controller .l-time-range-slider {
font-size: 0.8em; }
/* line 17, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-inputs-holder,
.l-time-controller .l-time-range-slider-holder,
.l-time-controller .l-time-range-ticks-holder {
margin-bottom: 5px;
position: relative; }
/* line 24, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider,
.l-time-controller .l-time-range-ticks {
overflow: visible;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: auto;
height: auto; }
/* line 30, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-inputs-holder {
height: 20px; }
/* line 34, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider,
.l-time-controller .l-time-range-ticks {
left: 90px;
right: 90px; }
/* line 40, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider-holder {
height: 30px; }
/* line 42, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-slider-holder .range-holder {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
background: none;
border: none;
height: 75%; }
/* line 50, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder {
height: 10px; }
/* line 52, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks {
border-top: 1px solid #4d4d4d; }
/* line 54, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks .tick {
background-color: #4d4d4d;
border: none;
width: 1px;
margin-left: -1px; }
/* line 59, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks .tick:first-child {
margin-left: 0; }
/* line 62, ../sass/controls/_time-controller.scss */
.l-time-controller .l-time-range-ticks-holder .l-time-range-ticks .tick .l-time-range-tick-label {
color: gray;
font-size: 0.7em;
position: absolute;
margin-left: -25px;
text-align: center;
top: 10px;
width: 50px;
z-index: 2; }
/* line 76, ../sass/controls/_time-controller.scss */
.l-time-controller .knob {
width: 9px; }
/* line 78, ../sass/controls/_time-controller.scss */
.l-time-controller .knob .range-value {
position: absolute;
top: 50%;
margin-top: -7px;
white-space: nowrap;
width: 75px; }
/* line 87, ../sass/controls/_time-controller.scss */
.l-time-controller .knob:hover .range-value {
color: #0099cc; }
/* line 90, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-l {
margin-left: -4.5px; }
/* line 92, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-l .range-value {
text-align: right;
right: 14px; }
/* line 97, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-r {
margin-right: -4.5px; }
/* line 99, ../sass/controls/_time-controller.scss */
.l-time-controller .knob.knob-r .range-value {
left: 14px; }
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
@ -3992,21 +4095,15 @@ input[type="text"] {
left: 5px; }
/* line 54, ../sass/user-environ/_frame.scss */
.frame.frame-template .view-switcher {
opacity: 0; }
/* line 58, ../sass/user-environ/_frame.scss */
opacity: 0;
z-index: 10; }
/* line 59, ../sass/user-environ/_frame.scss */
.frame.frame-template:hover .view-switcher {
opacity: 1; }
/* line 66, ../sass/user-environ/_frame.scss */
/* line 67, ../sass/user-environ/_frame.scss */
.frame .view-switcher .name {
display: none; }
/* line 73, ../sass/user-environ/_frame.scss */
.edit-main .frame.child-frame.panel:hover {
border-color: #0099cc;
-moz-box-shadow: rgba(0, 0, 0, 0.7) 0 3px 10px;
-webkit-box-shadow: rgba(0, 0, 0, 0.7) 0 3px 10px;
box-shadow: rgba(0, 0, 0, 0.7) 0 3px 10px; }
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
@ -4225,137 +4322,105 @@ input[type="text"] {
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* line 24, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper {
position: absolute;
z-index: 70; }
/* line 27, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-bubble {
padding: 5px 10px; }
/* line 29, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-bubble .l-btn.close {
padding: 0 2px;
position: absolute;
right: 5px;
top: 5px; }
.bubble-container {
pointer-events: none; }
/* line 31, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper {
-moz-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
-webkit-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
position: relative;
z-index: 50; }
/* line 36, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .arw {
position: absolute; }
/* line 38, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .arw.arw-up {
bottom: 100%; }
/* line 42, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .arw.arw-down {
top: 100%; }
/* line 47, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble {
.l-infobubble-wrapper .l-infobubble {
display: inline-block;
max-width: 250px; }
/* line 51, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble:before {
min-width: 100px;
max-width: 300px;
padding: 5px 10px; }
/* line 41, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble:before {
content: "";
position: absolute;
width: 0;
height: 0; }
/* line 57, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble table {
/* line 47, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble table {
width: 100%; }
/* line 60, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble table tr td {
/* line 50, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble table tr td {
padding: 2px 0;
vertical-align: top; }
/* line 67, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble table tr td.label {
/* line 57, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble table tr td.label {
padding-right: 10px;
white-space: nowrap; }
/* line 71, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble table tr td.value {
/* line 61, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble table tr td.value {
white-space: nowrap; }
/* line 75, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble table tr td.align-wrap {
/* line 65, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble table tr td.align-wrap {
white-space: normal; }
/* line 81, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper .l-infobubble .title {
/* line 71, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .l-infobubble .title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-bottom: 5px; }
/* line 88, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper.arw-left {
/* line 78, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-left {
margin-left: 20px; }
/* line 90, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper.arw-left .l-infobubble::before {
/* line 80, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-left .l-infobubble::before {
right: 100%;
width: 0;
height: 0;
border-top: 6.66667px solid transparent;
border-bottom: 6.66667px solid transparent;
border-right: 10px solid #ddd; }
/* line 96, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper.arw-right {
/* line 86, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-right {
margin-right: 20px; }
/* line 98, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper.arw-right .l-infobubble::before {
/* line 88, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-right .l-infobubble::before {
left: 100%;
width: 0;
height: 0;
border-top: 6.66667px solid transparent;
border-bottom: 6.66667px solid transparent;
border-left: 10px solid #ddd; }
/* line 105, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper.arw-top .l-infobubble::before {
/* line 95, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-top .l-infobubble::before {
top: 20px; }
/* line 111, ../sass/helpers/_bubbles.scss */
.l-bubble-wrapper.arw-btm .l-infobubble::before {
/* line 101, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-btm .l-infobubble::before {
bottom: 20px; }
/* line 121, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper {
position: absolute;
left: 10px;
right: 10px;
height: 183px;
width: auto; }
/* line 128, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper .l-thumbsbubble {
overflow: hidden;
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
width: auto;
height: auto; }
/* line 130, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper .l-thumbsbubble .l-image-thumbs-wrapper {
height: auto;
top: 5px !important;
right: 25px;
bottom: 5px !important;
left: 5px; }
/* line 135, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper .arw {
/* line 106, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-down {
margin-bottom: 10px; }
/* line 108, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-down .l-infobubble::before {
left: 50%;
top: 100%;
margin-left: -5px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 7.5px solid #ddd; }
/* line 117, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper .arw {
z-index: 2; }
/* line 140, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper.arw-up .arw.arw-down, .l-thumbsbubble-wrapper.arw-down .arw.arw-up {
/* line 120, ../sass/helpers/_bubbles.scss */
.l-infobubble-wrapper.arw-up .arw.arw-down, .l-infobubble-wrapper.arw-down .arw.arw-up {
display: none; }
/* line 150, ../sass/helpers/_bubbles.scss */
.s-bubble {
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
-webkit-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px; }
/* line 156, ../sass/helpers/_bubbles.scss */
/* line 127, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper .arw-up {
width: 0;
height: 0;
border-left: 6.66667px solid transparent;
border-right: 6.66667px solid transparent;
border-bottom: 10px solid #4d4d4d; }
/* line 159, ../sass/helpers/_bubbles.scss */
/* line 130, ../sass/helpers/_bubbles.scss */
.l-thumbsbubble-wrapper .arw-down {
width: 0;
height: 0;
@ -4363,27 +4428,33 @@ input[type="text"] {
border-right: 6.66667px solid transparent;
border-top: 10px solid #4d4d4d; }
/* line 163, ../sass/helpers/_bubbles.scss */
/* line 134, ../sass/helpers/_bubbles.scss */
.s-infobubble {
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
-webkit-box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
box-shadow: rgba(0, 0, 0, 0.4) 0 1px 5px;
background: #ddd;
color: #666;
font-size: 0.8rem; }
/* line 168, ../sass/helpers/_bubbles.scss */
/* line 141, ../sass/helpers/_bubbles.scss */
.s-infobubble .title {
color: #333333;
font-weight: bold; }
/* line 173, ../sass/helpers/_bubbles.scss */
/* line 146, ../sass/helpers/_bubbles.scss */
.s-infobubble tr td {
border-top: 1px solid #c4c4c4;
font-size: 0.9em; }
/* line 177, ../sass/helpers/_bubbles.scss */
/* line 150, ../sass/helpers/_bubbles.scss */
.s-infobubble tr:first-child td {
border-top: none; }
/* line 181, ../sass/helpers/_bubbles.scss */
/* line 154, ../sass/helpers/_bubbles.scss */
.s-infobubble .value {
color: #333333; }
/* line 186, ../sass/helpers/_bubbles.scss */
/* line 159, ../sass/helpers/_bubbles.scss */
.s-thumbsbubble {
background: #4d4d4d;
color: #b3b3b3; }

View File

@ -67,6 +67,8 @@ $colorLimitRed: #aa0000;
$colorTelemFresh: #fff;
$colorTelemStale: #888;
$styleTelemState: italic;
$colorInfoBubbleFg: #666;
$colorInfoBubbleBg: #ddd;
// Ratios
$ltGamma: 20%;
@ -150,6 +152,9 @@ $imageThumbPad: 1px;
// Bubbles
$bubbleArwSize: 10px;
$bubblePad: $interiorMargin;
$bubbleMinW: 100px;
$bubbleMaxW: 300px;
// Timing
$controlFadeMs: 100ms;
$controlFadeMs: 100ms;

View File

@ -69,6 +69,10 @@ span {
*/
}
mct-container {
display: block;
}
.abs {
position: absolute;
top: 0;

View File

@ -45,9 +45,10 @@
@import "controls/controls";
@import "controls/lists";
@import "controls/menus";
@import "controls/time-controller";
@import "edit/editor";
@import "features/imagery";
@import "features/time-display";
@import "controls/time-controller";
@import "forms/mixins";
@import "forms/elems";
@import "forms/validation";

View File

@ -148,14 +148,4 @@ a.btn span,
a.l-btn,
a.l-btn span {
display: inline-block;
}
.l-btn {
padding: 0 $pad;
&.sm {
padding: 0 $interiorMargin;
}
&.vsm {
padding: 0 $interiorMargin/2;
}
}

View File

@ -168,7 +168,7 @@
position: absolute;
height: 200px;
width: 170px;
z-index: 59;
z-index: 70;
.context-menu-wrapper {
position: absolute;
height: 100%;

View File

@ -19,3 +19,86 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
.edit-main {
$handleD: 15px;
$cr: 5px;
.edit-corner,
.edit-handle {
position: absolute;
z-index: 2;
}
.edit-corner {
width: $handleD;
height: $handleD;
&.edit-resize-nw {
@include border-bottom-right-radius($cr);
cursor: nw-resize;
top: 0; left: 0;
}
&.edit-resize-se {
@include border-top-left-radius($cr);
cursor: se-resize;
bottom: 0; right: 0;
}
&.edit-resize-sw {
@include border-top-right-radius($cr);
cursor: sw-resize;
bottom: 0; left: 0;
}
}
.edit-handle {
top: $handleD; right: $handleD; bottom: $handleD; left: $handleD;
&.edit-move {
$m: 0; //$handleD;
cursor: move;
left: $m;
right: $m;
top: $m;
bottom: $m;
z-index: 1;
}
&.edit-resize-n {
top: 0px; bottom: auto;
height: $handleD;
cursor: n-resize;
}
&.edit-resize-e {
right: 0px; left: auto;
width: $handleD;
cursor: e-resize;
}
&.edit-resize-s {
bottom: 0px; top: auto;
height: $handleD;
cursor: s-resize;
}
&.edit-resize-w {
left: 0px; right: auto;
width: $handleD;
cursor: w-resize;
}
}
.frame.child-frame.panel {
&:hover {
@include boxShdwLarge();
border-color: $colorKey;
z-index: 2;
.view-switcher {
opacity: 1;
}
.edit-corner {
background-color: rgba($colorKey, 0.8);
&:hover {
background-color: rgba($colorKey, 1);
}
}
}
}
}

View File

@ -19,35 +19,25 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
//************************************************* GENERAL
.bubble-container {
pointer-events: none;
}
//************************************************* LAYOUT
.l-bubble-wrapper {
position: absolute;
z-index: 70;
.l-bubble {
padding: $bubblePad $bubblePad*2;
.l-btn.close {
padding: 0 2px;
position: absolute;
right: $interiorMargin;
top: $interiorMargin;
}
}
.arw {
position: absolute;
&.arw-up {
bottom: 100%;
}
&.arw-down {
top: 100%;
}
}
.l-infobubble-wrapper {
$arwSize: 5px;
@include box-shadow(rgba(black, 0.4) 0 1px 5px);
position: relative;
z-index: 50;
.l-infobubble {
display: inline-block;
max-width: 250px;
//padding: 5px 10px;
min-width: $bubbleMinW;
max-width: $bubbleMaxW;
padding: 5px 10px;
&:before {
content:"";
position: absolute;
@ -114,27 +104,17 @@
}
&.arw-down {
}
}
.l-thumbsbubble-wrapper {
$closeBtnD: 15px;
position: absolute;
left: $interiorMarginLg;
right: $interiorMarginLg;
height: $imageThumbsWrapperH + $bubblePad*2 + $interiorMargin;
width: auto;
.l-thumbsbubble {
@include absPosDefault();
.l-image-thumbs-wrapper {
height: auto;
top: $bubblePad !important; right: $closeBtnD + ($interiorMargin*2); bottom: $bubblePad !important; left: $bubblePad;
margin-bottom: $arwSize*2;
.l-infobubble::before {
left: 50%;
top: 100%;
margin-left: -1 * $arwSize;
border-left: $arwSize solid transparent;
border-right: $arwSize solid transparent;
border-top: ($arwSize * 1.5) solid $colorInfoBubbleBg;
}
}
.arw {
//left: 50%;
//margin-left: $bubbleArwSize / -2;
z-index: 2;
}
&.arw-up .arw.arw-down,
@ -143,15 +123,6 @@
//************************************************* LOOK AND FEEL
.s-bubble-wrapper {
//@include box-shadow(rgba(black, 0.4) 0 1px 5px);
}
.s-bubble {
@include border-radius($basicCr);
@include box-shadow(rgba(black, 0.4) 0 1px 5px);
}
.l-thumbsbubble-wrapper {
.arw-up {
@include triangle('up', $bubbleArwSize, 1.5, $colorThumbsBubbleBg);
@ -162,6 +133,8 @@
}
.s-infobubble {
$emFg: darken($colorInfoBubbleFg, 20%);
@include border-radius($basicCr);
@include box-shadow(rgba(black, 0.4) 0 1px 5px);
background: $colorInfoBubbleBg;
color: $colorInfoBubbleFg;
font-size: 0.8rem;

View File

@ -54,6 +54,7 @@
.view-switcher {
//display: none;
opacity: 0;
z-index: 10;
}
&:hover .view-switcher {
// Show the view switcher on frame hover
@ -68,10 +69,3 @@
}
}
}
.edit-main .frame.child-frame.panel {
&:hover {
border-color: $colorKey;
@include boxShdwLarge();
}
}

View File

@ -53,12 +53,14 @@ define(
// Get list of views, read from capability
function updateOptions(views) {
$timeout(function () {
$scope.ngModel.selected = findMatchingOption(
views || [],
($scope.ngModel || {}).selected
);
}, 0);
if (Array.isArray(views)) {
$timeout(function () {
$scope.ngModel.selected = findMatchingOption(
views,
($scope.ngModel || {}).selected
);
}, 0);
}
}
// Update view options when the in-scope results of using the
@ -68,4 +70,4 @@ define(
return ViewSwitcherController;
}
);
);

View File

@ -1,20 +1,50 @@
{
"extensions": {
"types": [
"templates": [
{
"key": "infobubble",
"name": "Info Bubble",
"glyph": "\u00EA",
"description": "Static markup for info bubbles",
"features": [ "creation" ]
"key": "info-table",
"templateUrl": "info-table.html"
},
{
"key": "info-bubble",
"templateUrl": "info-bubble.html"
}
],
"views": [
"containers": [
{
"templateUrl": "infobubble.html",
"name": "Info Bubble",
"type": "infobubble",
"key": "infobubble"
"key": "bubble",
"templateUrl": "bubble.html",
"attributes": [ "bubbleTitle", "bubbleLayout" ],
"alias": "bubble"
}
],
"gestures": [
{
"key": "info",
"implementation": "gestures/InfoGesture.js",
"depends": [
"$timeout",
"infoService",
"INFO_HOVER_DELAY"
]
}
],
"services": [
{
"key": "infoService",
"implementation": "services/InfoService.js",
"depends": [
"$compile",
"$document",
"$window",
"$rootScope"
]
}
],
"constants": [
{
"key": "INFO_HOVER_DELAY",
"value": 2000
}
]
}

View File

@ -0,0 +1,9 @@
<div class="t-infobubble s-infobubble l-infobubble-wrapper {{bubble.bubbleLayout}}">
<div class="l-infobubble">
<div ng-show="bubble.bubbleTitle.length > 0"
class="title">
{{bubble.bubbleTitle}}
</div>
<span ng-transclude></span>
</div>
</div>

View File

@ -0,0 +1,9 @@
<mct-container
key="bubble"
bubble-title="{{parameters.title}}"
bubble-layout="{{parameters.layout}}"
>
<mct-include key="info-table"
ng-model="ngModel">
</mct-include>
</mct-container>

View File

@ -0,0 +1,8 @@
<table>
<tr ng-repeat="property in ngModel">
<td class="label">{{property.name}}</td>
<td title="{{property.value}}" class="value align-{{property.align}}">
{{property.value}}
</td>
</tr>
</table>

View File

@ -0,0 +1,36 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define({
BUBBLE_TEMPLATE: "<mct-container key=\"bubble\" " +
"bubble-title=\"{{bubbleTitle}}\" " +
"bubble-layout=\"{{bubbleLayout}}\" " +
"class=\"bubble-container\">" +
"<mct-include key=\"bubbleTemplate\" ng-model=\"bubbleModel\">" +
"</mct-include>" +
"</mct-container>",
// Pixel offset for bubble, to align arrow position
BUBBLE_OFFSET: [ 0, -26 ],
// Max width and margins allowed for bubbles; defined in /platform/commonUI/general/res/sass/_constants.scss
BUBBLE_MARGIN_LR: 10,
BUBBLE_MAX_WIDTH: 300
});

View File

@ -0,0 +1,121 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* The `info` gesture displays domain object metadata in a
* bubble on hover.
*
* @constructor
* @param $timeout Angular's `$timeout`
* @param {InfoService} infoService a service which shows info bubbles
* @param {number} DELAY delay, in milliseconds, before bubble appears
* @param element jqLite-wrapped DOM element
* @param {DomainObject} domainObject the domain object for which to
* show information
*/
function InfoGesture($timeout, infoService, DELAY, element, domainObject) {
var dismissBubble,
pendingBubble,
mousePosition,
scopeOff;
function trackPosition(event) {
// Record mouse position, so bubble can be shown at latest
// mouse position (not just where the mouse entered)
mousePosition = [ event.clientX, event.clientY ];
}
function hideBubble() {
// If a bubble is showing, dismiss it
if (dismissBubble) {
dismissBubble();
element.off('mouseleave', hideBubble);
dismissBubble = undefined;
}
// If a bubble will be shown on a timeout, cancel that
if (pendingBubble) {
$timeout.cancel(pendingBubble);
element.off('mousemove', trackPosition);
element.off('mouseleave', hideBubble);
pendingBubble = undefined;
}
// Also clear mouse position so we don't have a ton of tiny
// arrays allocated while user mouses over things
mousePosition = undefined;
}
function showBubble(event) {
trackPosition(event);
// Also need to track position during hover
element.on('mousemove', trackPosition);
// Show the bubble, after a suitable delay (if mouse has
// left before this time is up, this will be canceled.)
pendingBubble = $timeout(function () {
dismissBubble = infoService.display(
"info-table",
domainObject.getModel().name,
domainObject.useCapability('metadata'),
mousePosition
);
element.off('mousemove', trackPosition);
pendingBubble = undefined;
}, DELAY);
element.on('mouseleave', hideBubble);
}
// Show bubble (on a timeout) on mouse over
element.on('mouseenter', showBubble);
// Also make sure we dismiss bubble if representation is destroyed
// before the mouse actually leaves it
scopeOff = element.scope().$on('$destroy', hideBubble);
return {
/**
* Detach any event handlers associated with this gesture.
* @memberof InfoGesture
* @method
*/
destroy: function () {
// Dismiss any active bubble...
hideBubble();
// ...and detach listeners
element.off('mouseenter', showBubble);
scopeOff();
}
};
}
return InfoGesture;
}
);

View File

@ -0,0 +1,95 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
['../InfoConstants'],
function (InfoConstants) {
"use strict";
var BUBBLE_TEMPLATE = InfoConstants.BUBBLE_TEMPLATE,
OFFSET = InfoConstants.BUBBLE_OFFSET;
/**
* Displays informative content ("info bubbles") for the user.
* @constructor
*/
function InfoService($compile, $document, $window, $rootScope) {
function display(templateKey, title, content, position) {
var body = $document.find('body'),
scope = $rootScope.$new(),
winDim = [$window.innerWidth, $window.innerHeight],
bubbleSpaceLR = InfoConstants.BUBBLE_MARGIN_LR + InfoConstants.BUBBLE_MAX_WIDTH,
goLeft = position[0] > (winDim[0] - bubbleSpaceLR),
goUp = position[1] > (winDim[1] / 2),
bubble;
// Pass model & container parameters into the scope
scope.bubbleModel = content;
scope.bubbleTemplate = templateKey;
scope.bubbleLayout = (goUp ? 'arw-btm' : 'arw-top') + ' ' +
(goLeft ? 'arw-right' : 'arw-left');
scope.bubbleTitle = title;
// Create the context menu
bubble = $compile(BUBBLE_TEMPLATE)(scope);
// Position the bubble
bubble.css('position', 'absolute');
if (goLeft) {
bubble.css('right', (winDim[0] - position[0] + OFFSET[0]) + 'px');
} else {
bubble.css('left', position[0] + OFFSET[0] + 'px');
}
if (goUp) {
bubble.css('bottom', (winDim[1] - position[1] + OFFSET[1]) + 'px');
} else {
bubble.css('top', position[1] + OFFSET[1] + 'px');
}
// Add the menu to the body
body.append(bubble);
// Return a function to dismiss the bubble
return function () { bubble.remove(); };
}
return {
/**
* Display an info bubble at the specified location.
* @param {string} templateKey template to place in bubble
* @param {string} title title for the bubble
* @param {*} content content to pass to the template, via
* `ng-model`
* @param {number[]} x,y position of the info bubble, in
* pixel coordinates.
* @returns {Function} a function that may be invoked to
* dismiss the info bubble
*/
display: display
};
}
return InfoService;
}
);

View File

@ -0,0 +1,157 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
['../../src/gestures/InfoGesture'],
function (InfoGesture) {
"use strict";
describe("The info gesture", function () {
var mockTimeout,
mockInfoService,
testDelay = 12321,
mockElement,
mockDomainObject,
mockScope,
mockOff,
testMetadata,
mockPromise,
mockHide,
gesture;
function fireEvent(evt, value) {
mockElement.on.calls.forEach(function (call) {
if (call.args[0] === evt) {
call.args[1](value);
}
});
}
beforeEach(function () {
mockTimeout = jasmine.createSpy('$timeout');
mockTimeout.cancel = jasmine.createSpy('cancel');
mockInfoService = jasmine.createSpyObj(
'infoService',
[ 'display' ]
);
mockElement = jasmine.createSpyObj(
'element',
[ 'on', 'off', 'scope', 'css' ]
);
mockDomainObject = jasmine.createSpyObj(
'domainObject',
[ 'getId', 'getCapability', 'useCapability', 'getModel' ]
);
mockScope = jasmine.createSpyObj('$scope', [ '$on' ]);
mockOff = jasmine.createSpy('$off');
testMetadata = [ { name: "Test name", value: "Test value" } ];
mockPromise = jasmine.createSpyObj('promise', ['then']);
mockHide = jasmine.createSpy('hide');
mockDomainObject.getModel.andReturn({ name: "Test Object" });
mockDomainObject.useCapability.andCallFake(function (c) {
return (c === 'metadata') ? testMetadata : undefined;
});
mockElement.scope.andReturn(mockScope);
mockScope.$on.andReturn(mockOff);
mockTimeout.andReturn(mockPromise);
mockInfoService.display.andReturn(mockHide);
gesture = new InfoGesture(
mockTimeout,
mockInfoService,
testDelay,
mockElement,
mockDomainObject
);
});
it("listens for mouseenter on the representation", function () {
expect(mockElement.on)
.toHaveBeenCalledWith('mouseenter', jasmine.any(Function));
});
it("displays an info bubble on a delay after mouseenter", function () {
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
expect(mockTimeout)
.toHaveBeenCalledWith(jasmine.any(Function), testDelay);
mockTimeout.mostRecentCall.args[0]();
expect(mockInfoService.display).toHaveBeenCalledWith(
jasmine.any(String),
"Test Object",
testMetadata,
[ 1977, 42 ]
);
});
it("does not display info bubble if mouse leaves too soon", function () {
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
fireEvent("mouseleave", { clientX: 1977, clientY: 42 });
expect(mockTimeout.cancel).toHaveBeenCalledWith(mockPromise);
expect(mockInfoService.display).not.toHaveBeenCalled();
});
it("hides a shown bubble when mouse leaves", function () {
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
mockTimeout.mostRecentCall.args[0]();
expect(mockHide).not.toHaveBeenCalled(); // verify precondition
fireEvent("mouseleave", {});
expect(mockHide).toHaveBeenCalled();
});
it("tracks mouse position", function () {
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
fireEvent("mousemove", { clientX: 1999, clientY: 11 });
fireEvent("mousemove", { clientX: 1984, clientY: 11 });
mockTimeout.mostRecentCall.args[0]();
// Should have displayed at the latest observed mouse position
expect(mockInfoService.display).toHaveBeenCalledWith(
jasmine.any(String),
"Test Object",
testMetadata,
[ 1984, 11 ]
);
});
it("hides shown bubbles when destroyed", function () {
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
mockTimeout.mostRecentCall.args[0]();
expect(mockHide).not.toHaveBeenCalled(); // verify precondition
gesture.destroy();
expect(mockHide).toHaveBeenCalled();
});
it("detaches listeners when destroyed", function () {
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
gesture.destroy();
mockElement.on.calls.forEach(function (call) {
expect(mockElement.off).toHaveBeenCalledWith(
call.args[0],
call.args[1]
);
});
});
});
}
);

View File

@ -0,0 +1,131 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
['../../src/services/InfoService', '../../src/InfoConstants'],
function (InfoService, InfoConstants) {
"use strict";
describe("The info service", function () {
var mockCompile,
mockDocument,
testWindow,
mockRootScope,
mockCompiledTemplate,
testScope,
mockBody,
mockElement,
service;
beforeEach(function () {
mockCompile = jasmine.createSpy('$compile');
mockDocument = jasmine.createSpyObj('$document', ['find']);
testWindow = { innerWidth: 1000, innerHeight: 100 };
mockRootScope = jasmine.createSpyObj('$rootScope', ['$new']);
mockCompiledTemplate = jasmine.createSpy('template');
testScope = {};
mockBody = jasmine.createSpyObj('body', ['append']);
mockElement = jasmine.createSpyObj('element', ['css', 'remove']);
mockDocument.find.andCallFake(function (tag) {
return tag === 'body' ? mockBody : undefined;
});
mockCompile.andReturn(mockCompiledTemplate);
mockCompiledTemplate.andReturn(mockElement);
mockRootScope.$new.andReturn(testScope);
service = new InfoService(
mockCompile,
mockDocument,
testWindow,
mockRootScope
);
});
it("creates elements and appends them to the body to display", function () {
service.display('', '', {}, [0, 0]);
expect(mockBody.append).toHaveBeenCalledWith(mockElement);
});
it("provides a function to remove displayed info bubbles", function () {
var fn = service.display('', '', {}, [0, 0]);
expect(mockElement.remove).not.toHaveBeenCalled();
fn();
expect(mockElement.remove).toHaveBeenCalled();
});
describe("depending on mouse position", function () {
// Positioning should vary based on quadrant in window,
// which is 1000 x 100 in this test case.
it("displays from the top-left in the top-left quadrant", function () {
service.display('', '', {}, [250, 25]);
expect(mockElement.css).toHaveBeenCalledWith(
'left',
(250 + InfoConstants.BUBBLE_OFFSET[0]) + 'px'
);
expect(mockElement.css).toHaveBeenCalledWith(
'top',
(25 + InfoConstants.BUBBLE_OFFSET[1]) + 'px'
);
});
it("displays from the top-right in the top-right quadrant", function () {
service.display('', '', {}, [700, 25]);
expect(mockElement.css).toHaveBeenCalledWith(
'right',
(300 + InfoConstants.BUBBLE_OFFSET[0]) + 'px'
);
expect(mockElement.css).toHaveBeenCalledWith(
'top',
(25 + InfoConstants.BUBBLE_OFFSET[1]) + 'px'
);
});
it("displays from the bottom-left in the bottom-left quadrant", function () {
service.display('', '', {}, [250, 70]);
expect(mockElement.css).toHaveBeenCalledWith(
'left',
(250 + InfoConstants.BUBBLE_OFFSET[0]) + 'px'
);
expect(mockElement.css).toHaveBeenCalledWith(
'bottom',
(30 + InfoConstants.BUBBLE_OFFSET[1]) + 'px'
);
});
it("displays from the bottom-right in the bottom-right quadrant", function () {
service.display('', '', {}, [800, 60]);
expect(mockElement.css).toHaveBeenCalledWith(
'right',
(200 + InfoConstants.BUBBLE_OFFSET[0]) + 'px'
);
expect(mockElement.css).toHaveBeenCalledWith(
'bottom',
(40 + InfoConstants.BUBBLE_OFFSET[1]) + 'px'
);
});
});
});
}
);

View File

@ -0,0 +1,4 @@
[
"gestures/InfoGesture",
"services/InfoService"
]

View File

@ -165,6 +165,10 @@
"implementation": "capabilities/PersistenceCapability.js",
"depends": [ "persistenceService", "PERSISTENCE_SPACE" ]
},
{
"key": "metadata",
"implementation": "capabilities/MetadataCapability.js"
},
{
"key": "mutation",
"implementation": "capabilities/MutationCapability.js",
@ -180,6 +184,11 @@
{
"key": "now",
"implementation": "services/Now.js"
},
{
"key": "throttle",
"implementation": "services/Throttle.js",
"depends": [ "$timeout" ]
}
],
"roots": [

View File

@ -0,0 +1,92 @@
/*global define*/
define(
['moment'],
function (moment) {
"use strict";
/**
* A piece of information about a domain object.
* @typedef {Object} MetadataProperty
* @property {string} name the human-readable name of this property
* @property {string} value the human-readable value of this property,
* for this specific domain object
*/
var TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
/**
* Implements the `metadata` capability of a domain object, providing
* properties of that object for display.
*
* Usage: `domainObject.useCapability("metadata")`
*
* ...which will return an array of objects containing `name` and
* `value` properties describing that domain object (suitable for
* display.)
*
* @constructor
*/
function MetadataCapability(domainObject) {
var model = domainObject.getModel();
function hasDisplayableValue(metadataProperty) {
var t = typeof metadataProperty.value;
return (t === 'string' || t === 'number');
}
function formatTimestamp(timestamp) {
return typeof timestamp === 'number' ?
(moment.utc(timestamp).format(TIME_FORMAT) + " UTC") :
undefined;
}
function getProperties() {
var type = domainObject.getCapability('type');
function lookupProperty(typeProperty) {
return {
name: typeProperty.getDefinition().name,
value: typeProperty.getValue(model)
};
}
return (type ? type.getProperties() : []).map(lookupProperty);
}
function getCommonMetadata() {
var type = domainObject.getCapability('type');
// Note that invalid values will be filtered out later
return [
{
name: "Updated",
value: formatTimestamp(model.modified)
},
{
name: "Type",
value: type && type.getName()
},
{
name: "ID",
value: domainObject.getId()
}
];
}
function getMetadata() {
return getProperties().concat(getCommonMetadata())
.filter(hasDisplayableValue);
}
return {
/**
* Get metadata about this object.
* @returns {MetadataProperty[]} metadata about this object
*/
invoke: getMetadata
};
}
return MetadataCapability;
}
);

View File

@ -0,0 +1,63 @@
/*global define*/
define(
[],
function () {
"use strict";
/**
* Throttler for function executions, registered as the `throttle`
* service.
*
* Usage:
*
* throttle(fn, delay, [apply])
*
* Returns a function that, when invoked, will invoke `fn` after
* `delay` milliseconds, only if no other invocations are pending.
* The optional argument `apply` determines whether.
*
* The returned function will itself return a `Promise` which will
* resolve to the returned value of `fn` whenever that is invoked.
*
* @returns {Function}
*/
function Throttle($timeout) {
/**
* Throttle this function.
* @param {Function} fn the function to throttle
* @param {number} [delay] the delay, in milliseconds, before
* executing this function; defaults to 0.
* @param {boolean} apply true if a `$apply` call should be
* invoked after this function executes; defaults to
* `false`.
*/
return function (fn, delay, apply) {
var activeTimeout;
// Clear active timeout, so that next invocation starts
// a new one.
function clearActiveTimeout() {
activeTimeout = undefined;
}
// Defaults
delay = delay || 0;
apply = apply || false;
return function () {
// Start a timeout if needed
if (!activeTimeout) {
activeTimeout = $timeout(fn, delay, apply);
activeTimeout.then(clearActiveTimeout);
}
// Return whichever timeout is active (to get
// a promise for the results of fn)
return activeTimeout;
};
};
}
return Throttle;
}
);

View File

@ -0,0 +1,101 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
['../../src/capabilities/MetadataCapability'],
function (MetadataCapability) {
"use strict";
describe("The metadata capability", function () {
var mockDomainObject,
mockType,
mockProperties,
testModel,
metadata;
function getCapability(key) {
return key === 'type' ? mockType : undefined;
}
function findValue(properties, name) {
var i;
for (i = 0; i < properties.length; i += 1) {
if (properties[i].name === name) {
return properties[i].value;
}
}
}
beforeEach(function () {
mockDomainObject = jasmine.createSpyObj(
'domainObject',
['getId', 'getCapability', 'useCapability', 'getModel']
);
mockType = jasmine.createSpyObj(
'type',
['getProperties', 'getName']
);
mockProperties = ['a', 'b', 'c'].map(function (k) {
var mockProperty = jasmine.createSpyObj(
'property-' + k,
['getValue', 'getDefinition']
);
mockProperty.getValue.andReturn("Value " + k);
mockProperty.getDefinition.andReturn({ name: "Property " + k});
return mockProperty;
});
testModel = { name: "" };
mockDomainObject.getId.andReturn("Test id");
mockDomainObject.getModel.andReturn(testModel);
mockDomainObject.getCapability.andCallFake(getCapability);
mockDomainObject.useCapability.andCallFake(getCapability);
mockType.getProperties.andReturn(mockProperties);
mockType.getName.andReturn("Test type");
metadata = new MetadataCapability(mockDomainObject);
});
it("reads properties from the domain object model", function () {
metadata.invoke();
mockProperties.forEach(function (mockProperty) {
expect(mockProperty.getValue).toHaveBeenCalledWith(testModel);
});
});
it("reports type-specific properties", function () {
var properties = metadata.invoke();
expect(findValue(properties, 'Property a')).toEqual("Value a");
expect(findValue(properties, 'Property b')).toEqual("Value b");
expect(findValue(properties, 'Property c')).toEqual("Value c");
});
it("reports generic properties", function () {
var properties = metadata.invoke();
expect(findValue(properties, 'ID')).toEqual("Test id");
expect(findValue(properties, 'Type')).toEqual("Test type");
});
});
}
);

View File

@ -0,0 +1,49 @@
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
["../../src/services/Throttle"],
function (Throttle) {
"use strict";
describe("The 'throttle' service", function () {
var throttle,
mockTimeout,
mockFn,
mockPromise;
beforeEach(function () {
mockTimeout = jasmine.createSpy("$timeout");
mockPromise = jasmine.createSpyObj("promise", ["then"]);
mockFn = jasmine.createSpy("fn");
mockTimeout.andReturn(mockPromise);
throttle = new Throttle(mockTimeout);
});
it("provides functions which run on a timeout", function () {
var throttled = throttle(mockFn);
// Verify precondition: Not called at throttle-time
expect(mockTimeout).not.toHaveBeenCalled();
expect(throttled()).toEqual(mockPromise);
expect(mockTimeout).toHaveBeenCalledWith(mockFn, 0, false);
});
it("schedules only one timeout at a time", function () {
var throttled = throttle(mockFn);
throttled();
throttled();
throttled();
expect(mockTimeout.calls.length).toEqual(1);
});
it("schedules additional invocations after resolution", function () {
var throttled = throttle(mockFn);
throttled();
mockPromise.then.mostRecentCall.args[0](); // Resolve timeout
throttled();
mockPromise.then.mostRecentCall.args[0]();
throttled();
expect(mockTimeout.calls.length).toEqual(3);
});
});
}
);

View File

@ -9,6 +9,7 @@
"capabilities/ContextualDomainObject",
"capabilities/CoreCapabilityProvider",
"capabilities/DelegationCapability",
"capabilities/MetadataCapability",
"capabilities/MutationCapability",
"capabilities/PersistenceCapability",
"capabilities/RelationshipCapability",
@ -23,6 +24,7 @@
"objects/DomainObjectProvider",
"services/Now",
"services/Throttle",
"types/MergeModels",
"types/TypeCapability",

View File

@ -0,0 +1 @@
Contains services which manage execution and flow control (e.g. for concurrency.)

View File

@ -0,0 +1,11 @@
{
"extensions": {
"services": [
{
"key": "workerService",
"implementation": "WorkerService.js",
"depends": [ "$window", "workers[]" ]
}
]
}
}

View File

@ -0,0 +1,68 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* Handles the execution of WebWorkers.
* @constructor
*/
function WorkerService($window, workers) {
var workerUrls = {},
Worker = $window.Worker;
function addWorker(worker) {
var key = worker.key;
if (!workerUrls[key]) {
workerUrls[key] = [
worker.bundle.path,
worker.bundle.sources,
worker.scriptUrl
].join("/");
}
}
(workers || []).forEach(addWorker);
return {
/**
* Start running a new web worker. This will run a worker
* that has been registered under the `workers` category
* of extension.
*
* @param {string} key symbolic identifier for the worker
* @returns {Worker} the running Worker
*/
run: function (key) {
var scriptUrl = workerUrls[key];
return scriptUrl && Worker && new Worker(scriptUrl);
}
};
}
return WorkerService;
}
);

View File

@ -0,0 +1,77 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../src/WorkerService"],
function (WorkerService) {
"use strict";
describe("The worker service", function () {
var mockWindow,
testWorkers,
mockWorker,
service;
beforeEach(function () {
mockWindow = jasmine.createSpyObj('$window', ['Worker']);
testWorkers = [
{
key: 'abc',
scriptUrl: 'c.js',
bundle: { path: 'a', sources: 'b' }
},
{
key: 'xyz',
scriptUrl: 'z.js',
bundle: { path: 'x', sources: 'y' }
},
{
key: 'xyz',
scriptUrl: 'bad.js',
bundle: { path: 'bad', sources: 'bad' }
}
];
mockWorker = {};
mockWindow.Worker.andReturn(mockWorker);
service = new WorkerService(mockWindow, testWorkers);
});
it("instantiates workers at registered paths", function () {
expect(service.run('abc')).toBe(mockWorker);
expect(mockWindow.Worker).toHaveBeenCalledWith('a/b/c.js');
});
it("prefers the first worker when multiple keys are found", function () {
expect(service.run('xyz')).toBe(mockWorker);
expect(mockWindow.Worker).toHaveBeenCalledWith('x/y/z.js');
});
it("returns undefined for unknown workers", function () {
expect(service.run('def')).toBeUndefined();
});
});
}
);

View File

@ -0,0 +1,3 @@
[
"WorkerService"
]

View File

@ -35,7 +35,7 @@
</div>
<div class="abs object-holder">
<mct-representation key="representation.selected.key"
mct-object="domainObject">
mct-object="representation.selected.key && domainObject">
</mct-representation>
</div>
</div>

View File

@ -34,50 +34,62 @@
<!-- Drag handles -->
<span ng-show="domainObject.hasCapability('editor')">
<span style="position: absolute; left: 12px; right: 12px; top: 12px; bottom: 12px; cursor: move;"
<span
class="edit-handle edit-move"
mct-drag-down="controller.startDrag(childObject.getId(), [1,1], [0,0])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; left: 0px; width: 12px; top: 12px; bottom: 12px; cursor: w-resize;"
<!--
<span
class="edit-handle edit-resize-w"
mct-drag-down="controller.startDrag(childObject.getId(), [1,0], [-1,0])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; right: 0px; width: 12px; top: 12px; bottom: 12px; cursor: e-resize;"
<span
class="edit-handle edit-resize-e"
mct-drag-down="controller.startDrag(childObject.getId(), [0,0], [1,0])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; left: 12px; right: 12px; top: 0px; height: 12px; cursor: n-resize;"
<span
class="edit-handle edit-resize-n"
mct-drag-down="controller.startDrag(childObject.getId(), [0,1], [0,-1])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; left: 12px; right: 12px; bottom: 0px; height: 12px; cursor: s-resize;"
<span
class="edit-handle edit-resize-s"
mct-drag-down="controller.startDrag(childObject.getId(), [0,0], [0,1])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
-->
<span style="position: absolute; left: 0px; width: 12px; top: 0px; height: 12px; cursor: nw-resize;"
<span
class="edit-corner edit-resize-nw"
mct-drag-down="controller.startDrag(childObject.getId(), [1,1], [-1,-1])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; right: 0px; width: 12px; top: 0px; height: 12px; cursor: ne-resize;"
<!--span
class="edit-corner edit-resize-nw"
style="position: absolute; right: 0px; width: 12px; top: 0px; height: 12px; cursor: ne-resize;"
mct-drag-down="controller.startDrag(childObject.getId(), [0,1], [1,-1])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; left: 0px; width: 12px; bottom: 0px; height: 12px; cursor: sw-resize;"
</span-->
<span
class="edit-corner edit-resize-sw"
mct-drag-down="controller.startDrag(childObject.getId(), [1,0], [-1,1])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">
</span>
<span style="position: absolute; right: 0px; width: 12px; bottom: 0px; height: 12px; cursor: se-resize;"
<span
class="edit-corner edit-resize-se"
mct-drag-down="controller.startDrag(childObject.getId(), [0,0], [1,1])"
mct-drag="controller.continueDrag(delta)"
mct-drag-up="controller.endDrag()">

View File

@ -90,6 +90,10 @@ define(
function lookupPanels(ids) {
var configuration = $scope.configuration || {};
// ids is read from model.composition and may be undefined;
// fall back to an array if that occurs
ids = ids || [];
// Pull panel positions from configuration
rawPositions = shallowCopy(configuration.panels || {}, ids);

View File

@ -23,7 +23,7 @@
{
"key": "PlotController",
"implementation": "PlotController.js",
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler" ]
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler", "throttle" ]
}
]
}

View File

@ -51,13 +51,14 @@ define(
*
* @constructor
*/
function PlotController($scope, telemetryFormatter, telemetryHandler) {
function PlotController($scope, telemetryFormatter, telemetryHandler, throttle) {
var subPlotFactory = new SubPlotFactory(telemetryFormatter),
modeOptions = new PlotModeOptions([], subPlotFactory),
subplots = [],
cachedObjects = [],
updater,
handle,
scheduleUpdate,
domainOffset;
// Populate the scope with axis information (specifically, options
@ -89,9 +90,7 @@ define(
// Update all sub-plots
function update() {
modeOptions.getModeHandler()
.getSubPlots()
.forEach(updateSubplot);
scheduleUpdate();
}
// Reinstantiate the plot updater (e.g. because we have a
@ -162,6 +161,12 @@ define(
// Unsubscribe when the plot is destroyed
$scope.$on("$destroy", releaseSubscription);
// Create a throttled update function
scheduleUpdate = throttle(function () {
modeOptions.getModeHandler().getSubPlots()
.forEach(updateSubplot);
});
return {
/**

View File

@ -62,8 +62,6 @@ define(
points: buf.getLength()
};
});
subplot.update();
}
return {

View File

@ -58,8 +58,6 @@ define(
color: PlotPalette.getFloatColor(0),
points: buffer.getLength()
}];
subplot.update();
}
function plotTelemetry(prepared) {

View File

@ -33,6 +33,7 @@ define(
var mockScope,
mockFormatter,
mockHandler,
mockThrottle,
mockHandle,
mockDomainObject,
mockSeries,
@ -56,6 +57,7 @@ define(
"telemetrySubscriber",
["handle"]
);
mockThrottle = jasmine.createSpy("throttle");
mockHandle = jasmine.createSpyObj(
"subscription",
[
@ -73,12 +75,18 @@ define(
);
mockHandler.handle.andReturn(mockHandle);
mockThrottle.andCallFake(function (fn) { return fn; });
mockHandle.getTelemetryObjects.andReturn([mockDomainObject]);
mockHandle.getMetadata.andReturn([{}]);
mockHandle.getDomainValue.andReturn(123);
mockHandle.getRangeValue.andReturn(42);
controller = new PlotController(mockScope, mockFormatter, mockHandler);
controller = new PlotController(
mockScope,
mockFormatter,
mockHandler,
mockThrottle
);
});
it("provides plot colors", function () {
@ -224,4 +232,4 @@ define(
});
});
}
);
);

View File

@ -35,8 +35,8 @@
<span class='field control date'>
<input type='text'
name='date'
placeholder="YYYY-DDD"
ng-pattern="/\d\d\d\d-\d\d\d/"
placeholder="{{format}}"
ng-pattern="/\d\d\d\d-\d\d-\d\d/"
ng-model='datetime.date'
ng-required='ngRequired || partiallyComplete'/>
</span>
@ -80,4 +80,4 @@
</ng-form>
</div>
</div>

View File

@ -26,7 +26,7 @@ define(
function () {
"use strict";
var DATE_FORMAT = "YYYY-DDD";
var DATE_FORMAT = "YYYY-MM-DD";
/**
* Controller for the `datetime` form control.
@ -92,6 +92,9 @@ define(
$scope.$watch("datetime.min", update);
$scope.$watch("datetime.sec", update);
// Expose format string for placeholder
$scope.format = DATE_FORMAT;
// Initialize forms values
updateDateTime(
($scope.ngModel && $scope.field) ?
@ -102,4 +105,4 @@ define(
return DateTimeController;
}
);
);

View File

@ -47,7 +47,7 @@ define(
it("converts date-time input into a timestamp", function () {
mockScope.ngModel = {};
mockScope.field = "test";
mockScope.datetime.date = "2014-332";
mockScope.datetime.date = "2014-11-28";
mockScope.datetime.hour = 22;
mockScope.datetime.min = 55;
mockScope.datetime.sec = 13;
@ -63,7 +63,7 @@ define(
// as required.
mockScope.ngModel = {};
mockScope.field = "test";
mockScope.datetime.date = "2014-332";
mockScope.datetime.date = "2014-11-28";
mockScope.datetime.hour = 22;
mockScope.datetime.min = 55;
// mockScope.datetime.sec = 13;
@ -84,6 +84,27 @@ define(
// Should have cleared out the time stamp
expect(mockScope.ngModel.test).toBeUndefined();
});
it("exposes date-time format for placeholder", function () {
expect(mockScope.format).toEqual(jasmine.any(String));
expect(mockScope.format.length).toBeGreaterThan(0);
});
it("initializes form fields with values from ng-model", function () {
mockScope.ngModel = { test: 1417215313000 };
mockScope.field = "test";
mockScope.$watch.calls.forEach(function (call) {
if (call.args[0] === 'ngModel[field]') {
call.args[1](mockScope.ngModel.test);
}
});
expect(mockScope.datetime).toEqual({
date: "2014-11-28",
hour: "22",
min: "55",
sec: "13"
});
});
});
}
);
);

View File

@ -93,15 +93,18 @@ define(
function link($scope, element, attrs) {
var activeRepresenters = representers.map(function (Representer) {
return new Representer($scope, element, attrs);
});
return new Representer($scope, element, attrs);
}),
toClear = [], // Properties to clear out of scope on change
counter = 0;
// Populate scope with any capabilities indicated by the
// representation's extension definition
function refreshCapabilities() {
var domainObject = $scope.domainObject,
representation = lookup($scope.key, domainObject),
uses = ((representation || {}).uses || []);
uses = ((representation || {}).uses || []),
myCounter = counter;
if (domainObject) {
// Update model
@ -115,10 +118,16 @@ define(
" for representation ",
$scope.key
].join(""));
$q.when(
domainObject.useCapability(used)
).then(function (c) {
$scope[used] = c;
// Avoid clobbering capabilities from
// subsequent representations;
// Angular reuses scopes.
if (counter === myCounter) {
$scope[used] = c;
}
});
});
}
@ -130,8 +139,7 @@ define(
function refresh() {
var domainObject = $scope.domainObject,
representation = lookup($scope.key, domainObject),
uses = ((representation || {}).uses || []),
gestureKeys = ((representation || {}).gestures || []);
uses = ((representation || {}).uses || []);
// Create an empty object named "representation", for this
// representation to store local variables into.
@ -152,9 +160,19 @@ define(
$log.warn("No representation found for " + $scope.key);
}
// Clear out the scope from the last representation
toClear.forEach(function (property) {
delete $scope[property];
});
// Populate scope with fields associated with the current
// domain object (if one has been passed in)
if (domainObject) {
// Track how many representations we've made in this scope,
// to ensure that the correct representations are matched to
// the correct object/key pairs.
counter += 1;
// Initialize any capabilities
refreshCapabilities();
@ -168,6 +186,10 @@ define(
activeRepresenters.forEach(function (representer) {
representer.represent(representation, domainObject);
});
// Track which properties we want to clear from scope
// next change object/key pair changes
toClear = uses.concat(['model']);
}
}

View File

@ -43,7 +43,7 @@ define(
function DropGesture(dndService, $q, element, domainObject) {
var actionCapability = domainObject.getCapability('action'),
action; // Action for the drop, when it occurs
function broadcastDrop(id, event) {
// Find the relevant scope...
var scope = element && element.scope && element.scope(),
@ -92,17 +92,24 @@ define(
function drop(e) {
var event = (e || {}).originalEvent || e,
id = event.dataTransfer.getData(GestureConstants.MCT_DRAG_TYPE);
// Handle the drop; add the dropped identifier to the
// destination domain object's composition, and persist
// the change.
if (id) {
$q.when(action && action.perform()).then(function (result) {
broadcastDrop(id, event);
});
id = event.dataTransfer.getData(GestureConstants.MCT_DRAG_TYPE),
domainObjectType = domainObject.getModel().type;
// If currently in edit mode allow drag and drop gestures to the
// domain object. An exception to this is folders which have drop
// gestures in browse mode.
if (domainObjectType === 'folder' || domainObject.hasCapability('editor')) {
// Handle the drop; add the dropped identifier to the
// destination domain object's composition, and persist
// the change.
if (id) {
$q.when(action && action.perform()).then(function (result) {
broadcastDrop(id, event);
});
}
}
// TODO: Alert user if drag and drop is not allowed
}
// We can only handle drops if we have access to actions...

View File

@ -181,6 +181,25 @@ define(
// Should have gotten a warning - that's an unknown key
expect(mockLog.warn).toHaveBeenCalled();
});
it("clears out obsolete peroperties from scope", function () {
mctRepresentation.link(mockScope, mockElement);
mockScope.key = "def";
mockScope.domainObject = mockDomainObject;
mockDomainObject.useCapability.andReturn("some value");
// Trigger the watch
mockScope.$watch.calls[0].args[1]();
expect(mockScope.testCapability).toBeDefined();
// Change the view
mockScope.key = "xyz";
// Trigger the watch again; should clear capability from scope
mockScope.$watch.calls[0].args[1]();
expect(mockScope.testCapability).toBeUndefined();
});
});
}
);

View File

@ -131,8 +131,11 @@ define(
expect(mockEvent.preventDefault).toHaveBeenCalled();
expect(mockEvent.dataTransfer.dropEffect).toBeDefined();
});
it("invokes compose on drop", function () {
it("invokes compose on drop in edit mode", function () {
// Set the mockDomainObject to have the editor capability
mockDomainObject.hasCapability.andReturn(true);
callbacks.dragover(mockEvent);
expect(mockAction.getActions).toHaveBeenCalledWith({
key: 'compose',
@ -141,9 +144,43 @@ define(
callbacks.drop(mockEvent);
expect(mockCompose.perform).toHaveBeenCalled();
});
it("does not invoke compose on drop in browse mode for non-folders", function () {
// Set the mockDomainObject to not have the editor capability
mockDomainObject.hasCapability.andReturn(false);
// Set the mockDomainObject to not have a type of folder
mockDomainObject.getModel.andReturn({type: 'notAFolder'});
callbacks.dragover(mockEvent);
expect(mockAction.getActions).toHaveBeenCalledWith({
key: 'compose',
selectedObject: mockDraggedObject
});
callbacks.drop(mockEvent);
expect(mockCompose.perform).not.toHaveBeenCalled();
});
it("invokes compose on drop in browse mode for folders", function () {
// Set the mockDomainObject to not have the editor capability
mockDomainObject.hasCapability.andReturn(false);
// Set the mockDomainObject to have a type of folder
mockDomainObject.getModel.andReturn({type: 'folder'});
it("broadcasts drop position", function () {
callbacks.dragover(mockEvent);
expect(mockAction.getActions).toHaveBeenCalledWith({
key: 'compose',
selectedObject: mockDraggedObject
});
callbacks.drop(mockEvent);
expect(mockCompose.perform).toHaveBeenCalled();
});
it("broadcasts drop position (in edit mode)", function () {
// Set the mockDomainObject to have the editor capability
mockDomainObject.hasCapability.andReturn(true);
testRect.left = 42;
testRect.top = 36;
mockEvent.pageX = 52;

View File

@ -22,8 +22,8 @@
/*global define,moment*/
define(
['../lib/moment.min.js'],
function () {
['moment'],
function (moment) {
"use strict";
// Date format to use for domain values; in particular,

View File

@ -35,28 +35,68 @@ define(
* @constructor
*/
function TelemetryQueue() {
var queue = [];
// General approach here:
// * Maintain a queue as an array of objects containing key-value
// pairs. Putting values into the queue will assign to the
// earliest-available queue position for the associated key
// (appending to the array if necessary.)
// * Maintain a set of counts for each key, such that determining
// the next available queue position is easy; O(1) insertion.
// * When retrieving objects, pop off the queue and decrement
// counts. This provides O(n+k) or O(k) retrieval for a queue
// of length n with k unique keys; this depends on whether
// the browser's implementation of Array.prototype.shift is
// O(n) or O(1).
// Graphically (indexes at top, keys along side, values as *'s),
// if we have a queue that looks like:
// 0 1 2 3 4
// a * * * * *
// b * *
// c * * *
//
// And we put a new value for b, we expect:
// 0 1 2 3 4
// a * * * * *
// b * * *
// c * * *
var queue = [],
counts = {};
// Look up an object in the queue that does not have a value
// assigned to this key (or, add a new one)
function getFreeObject(key) {
var index = 0, object;
var index = counts[key] || 0, object;
// Look for an existing queue position where we can store
// a value to this key without overwriting an existing value.
for (index = 0; index < queue.length; index += 1) {
if (queue[index][key] === undefined) {
return queue[index];
}
// Track the largest free position for this key
counts[key] = index + 1;
// If it's before the end of the queue, add it there
if (index < queue.length) {
return queue[index];
}
// If we made it through the loop, values have been assigned
// Otherwise, values have been assigned
// to that key in all queued containers, so we need to queue
// up a new container for key-value pairs.
object = {};
queue.push(object);
return object;
}
// Decrement counts for a specific key
function decrementCount(key) {
if (counts[key] < 2) {
delete counts[key];
} else {
counts[key] -= 1;
}
}
// Decrement all counts
function decrementCounts() {
Object.keys(counts).forEach(decrementCount);
}
return {
/**
@ -74,6 +114,8 @@ define(
* @return {object} key-value pairs
*/
poll: function () {
// Decrement counts for the object that will be popped
decrementCounts();
return queue.shift();
},
/**