mirror of
https://github.com/nasa/openmct.git
synced 2025-03-21 11:35:59 +00:00
Merge remote-tracking branch 'github/master' into open245b
Conflicts: docs/src/guide/index.md platform/core/src/capabilities/InstantiationCapability.js
This commit is contained in:
commit
e31d9decdc
File diff suppressed because it is too large
Load Diff
@ -68,7 +68,7 @@ define(
|
||||
*/
|
||||
CreationService.prototype.createObject = function (model, parent) {
|
||||
var persistence = parent.getCapability("persistence"),
|
||||
newObject = parent.useCapability("creation", model),
|
||||
newObject = parent.useCapability("instantiation", model),
|
||||
newObjectPersistence = newObject.getCapability("persistence"),
|
||||
self = this;
|
||||
|
||||
|
@ -91,14 +91,14 @@ define(
|
||||
);
|
||||
mockCreationCapability = jasmine.createSpyObj(
|
||||
"creation",
|
||||
["create", "invoke"]
|
||||
["instantiate", "invoke"]
|
||||
);
|
||||
mockCapabilities = {
|
||||
mutation: mockMutationCapability,
|
||||
persistence: mockPersistenceCapability,
|
||||
composition: mockCompositionCapability,
|
||||
context: mockContextCapability,
|
||||
creation: mockCreationCapability
|
||||
instantiation: mockCreationCapability
|
||||
};
|
||||
mockNewPersistenceCapability = jasmine.createSpyObj(
|
||||
"new-persistence",
|
||||
@ -130,9 +130,9 @@ define(
|
||||
mockPromise([mockNewObject])
|
||||
);
|
||||
mockCompositionCapability.add.andReturn(mockPromise(true));
|
||||
mockCreationCapability.create.andReturn(mockNewObject);
|
||||
mockCreationCapability.instantiate.andReturn(mockNewObject);
|
||||
mockCreationCapability.invoke.andCallFake(function (model) {
|
||||
return mockCreationCapability.create(model);
|
||||
return mockCreationCapability.instantiate(model);
|
||||
});
|
||||
|
||||
creationService = new CreationService(
|
||||
@ -144,7 +144,7 @@ define(
|
||||
it("allows new objects to be created", function () {
|
||||
var model = { someKey: "some value" };
|
||||
creationService.createObject(model, mockParentObject);
|
||||
expect(mockCreationCapability.create)
|
||||
expect(mockCreationCapability.instantiate)
|
||||
.toHaveBeenCalledWith(model);
|
||||
});
|
||||
|
||||
|
@ -181,7 +181,7 @@ define(
|
||||
* @typedef DialogOption
|
||||
* @property {string} label a label to be displayed as the button
|
||||
* text for this action
|
||||
* @property {function} action a function to be called when the
|
||||
* @property {function} callback a function to be called when the
|
||||
* button is clicked
|
||||
*/
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
"runs": [
|
||||
{
|
||||
"implementation": "StyleSheetLoader.js",
|
||||
"depends": [ "stylesheets[]", "$document" ]
|
||||
"depends": [ "stylesheets[]", "$document", "THEME" ]
|
||||
}
|
||||
],
|
||||
"stylesheets": [
|
||||
@ -194,6 +194,11 @@
|
||||
{
|
||||
"key": "MCT_SCROLL_Y_ATTRIBUTE",
|
||||
"value": "mctScrollY"
|
||||
},
|
||||
{
|
||||
"key": "THEME",
|
||||
"value": "unspecified",
|
||||
"priority": "fallback"
|
||||
}
|
||||
],
|
||||
"containers": [
|
||||
|
@ -1,19 +1,27 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "WTD Symbols",
|
||||
"lastOpened": 1446490786311,
|
||||
"created": 1446489891263
|
||||
"lastOpened": 1446670352108,
|
||||
"created": 1446670349721
|
||||
},
|
||||
"iconSets": [
|
||||
{
|
||||
"selection": [
|
||||
{
|
||||
"order": 113,
|
||||
"order": 116,
|
||||
"id": 93,
|
||||
"prevSize": 32,
|
||||
"code": 58902,
|
||||
"name": "icon-eye-open-no-gleam",
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 115,
|
||||
"id": 92,
|
||||
"prevSize": 32,
|
||||
"code": 58901,
|
||||
"name": "icon-crosshair",
|
||||
"tempChar": ""
|
||||
"name": "icon-eye-open",
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 110,
|
||||
@ -21,7 +29,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58899,
|
||||
"name": "icon-collapse-pane-left",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 111,
|
||||
@ -29,7 +37,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58900,
|
||||
"name": "icon-collapse-pane-right",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 109,
|
||||
@ -37,7 +45,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58898,
|
||||
"name": "icon-save",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 108,
|
||||
@ -45,7 +53,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58897,
|
||||
"name": "icon-dataset",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 90,
|
||||
@ -53,7 +61,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58896,
|
||||
"name": "icon-bell",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 91,
|
||||
@ -61,7 +69,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58889,
|
||||
"name": "icon-hourglass",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 92,
|
||||
@ -74,7 +82,7 @@
|
||||
58890
|
||||
],
|
||||
"name": "icon-info-v15",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 93,
|
||||
@ -82,7 +90,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58887,
|
||||
"name": "icon-x-in-circle",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 94,
|
||||
@ -90,7 +98,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58881,
|
||||
"name": "icon-datatable",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 95,
|
||||
@ -98,7 +106,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58882,
|
||||
"name": "icon-tabular-scrolling",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 96,
|
||||
@ -106,7 +114,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58884,
|
||||
"name": "icon-tabular",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 97,
|
||||
@ -114,7 +122,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58885,
|
||||
"name": "icon-calendar",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 98,
|
||||
@ -122,7 +130,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58886,
|
||||
"name": "icon-paint-bucket",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 99,
|
||||
@ -130,7 +138,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 123,
|
||||
"name": "icon-pointer-left",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 100,
|
||||
@ -138,7 +146,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 125,
|
||||
"name": "icon-pointer-right",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 101,
|
||||
@ -146,7 +154,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 80,
|
||||
"name": "icon-person",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 102,
|
||||
@ -154,7 +162,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 232,
|
||||
"name": "icon-chain-links",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 103,
|
||||
@ -162,7 +170,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 115,
|
||||
"name": "icon-database-in-brackets",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 104,
|
||||
@ -170,7 +178,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 114,
|
||||
"name": "icon-refresh",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 105,
|
||||
@ -178,7 +186,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 108,
|
||||
"name": "icon-lock",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 106,
|
||||
@ -186,7 +194,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 51,
|
||||
"name": "icon-box-with-dashed-lines",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 10,
|
||||
@ -194,7 +202,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58880,
|
||||
"name": "icon-box-with-arrow-cursor",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 11,
|
||||
@ -202,7 +210,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 65,
|
||||
"name": "icon-activity-mode",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 12,
|
||||
@ -210,7 +218,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 97,
|
||||
"name": "icon-activity",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 87,
|
||||
@ -218,7 +226,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 33,
|
||||
"name": "icon-alert-rect",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 14,
|
||||
@ -226,7 +234,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58883,
|
||||
"name": "icon-alert-triangle",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 15,
|
||||
@ -234,7 +242,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 238,
|
||||
"name": "icon-arrow-double-down",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 16,
|
||||
@ -242,7 +250,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 235,
|
||||
"name": "icon-arrow-double-up",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 2,
|
||||
@ -250,7 +258,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 118,
|
||||
"name": "icon-arrow-down",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 19,
|
||||
@ -258,7 +266,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 60,
|
||||
"name": "icon-arrow-left",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 20,
|
||||
@ -266,7 +274,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 62,
|
||||
"name": "icon-arrow-right",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 21,
|
||||
@ -274,7 +282,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 236,
|
||||
"name": "icon-arrow-tall-down",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 22,
|
||||
@ -282,7 +290,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 237,
|
||||
"name": "icon-arrow-tall-up",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 23,
|
||||
@ -290,7 +298,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 94,
|
||||
"name": "icon-arrow-up",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 24,
|
||||
@ -298,7 +306,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 73,
|
||||
"name": "icon-arrows-out",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 25,
|
||||
@ -306,7 +314,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58893,
|
||||
"name": "icon-arrows-right-left",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 33,
|
||||
@ -314,7 +322,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 53,
|
||||
"name": "icon-arrows-up-down",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 26,
|
||||
@ -322,7 +330,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 42,
|
||||
"name": "icon-asterisk",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 27,
|
||||
@ -330,7 +338,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 72,
|
||||
"name": "icon-autoflow-tabular",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 28,
|
||||
@ -338,7 +346,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 224,
|
||||
"name": "icon-box",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 29,
|
||||
@ -346,7 +354,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 50,
|
||||
"name": "icon-check",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 30,
|
||||
@ -354,7 +362,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 67,
|
||||
"name": "icon-clock",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 31,
|
||||
@ -362,7 +370,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 46,
|
||||
"name": "icon-connectivity",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 32,
|
||||
@ -370,7 +378,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 100,
|
||||
"name": "icon-database-query",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 17,
|
||||
@ -378,7 +386,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 68,
|
||||
"name": "icon-database",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 35,
|
||||
@ -386,7 +394,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 81,
|
||||
"name": "icon-dictionary",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 36,
|
||||
@ -394,7 +402,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 242,
|
||||
"name": "icon-duplicate",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 37,
|
||||
@ -402,7 +410,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 102,
|
||||
"name": "icon-folder-new",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 38,
|
||||
@ -410,7 +418,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 70,
|
||||
"name": "icon-folder",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 39,
|
||||
@ -418,7 +426,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 95,
|
||||
"name": "icon-fullscreen-collapse",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 40,
|
||||
@ -426,7 +434,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 122,
|
||||
"name": "icon-fullscreen-expand",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 41,
|
||||
@ -434,7 +442,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 71,
|
||||
"name": "icon-gear",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 49,
|
||||
@ -442,7 +450,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 227,
|
||||
"name": "icon-image",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 42,
|
||||
@ -450,7 +458,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 225,
|
||||
"name": "icon-layers",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 43,
|
||||
@ -458,7 +466,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 76,
|
||||
"name": "icon-layout",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 44,
|
||||
@ -466,7 +474,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 226,
|
||||
"name": "icon-line-horz",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 75,
|
||||
@ -474,7 +482,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 244,
|
||||
"name": "icon-link",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 46,
|
||||
@ -482,7 +490,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 88,
|
||||
"name": "icon-magnify-in",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 47,
|
||||
@ -490,7 +498,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 89,
|
||||
"name": "icon-magnify-out",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 48,
|
||||
@ -498,7 +506,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 77,
|
||||
"name": "icon-magnify",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 34,
|
||||
@ -506,7 +514,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 109,
|
||||
"name": "icon-menu",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 50,
|
||||
@ -514,7 +522,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 243,
|
||||
"name": "icon-move",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 51,
|
||||
@ -522,7 +530,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 121,
|
||||
"name": "icon-new-window",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 52,
|
||||
@ -530,7 +538,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 111,
|
||||
"name": "icon-object",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 73,
|
||||
@ -538,7 +546,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 63,
|
||||
"name": "icon-object-unknown",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 53,
|
||||
@ -546,7 +554,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 86,
|
||||
"name": "icon-packet",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 54,
|
||||
@ -554,7 +562,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 234,
|
||||
"name": "icon-page",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 55,
|
||||
@ -562,7 +570,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 241,
|
||||
"name": "icon-pause",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 56,
|
||||
@ -570,7 +578,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 112,
|
||||
"name": "icon-pencil",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 65,
|
||||
@ -578,7 +586,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 79,
|
||||
"name": "icon-people",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 57,
|
||||
@ -586,7 +594,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 239,
|
||||
"name": "icon-play",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 58,
|
||||
@ -594,7 +602,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 233,
|
||||
"name": "icon-plot-resource",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 59,
|
||||
@ -602,7 +610,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 43,
|
||||
"name": "icon-plus",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 60,
|
||||
@ -610,7 +618,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 45,
|
||||
"name": "icon-minus",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 61,
|
||||
@ -618,7 +626,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 54,
|
||||
"name": "icon-sine",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 62,
|
||||
@ -626,7 +634,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 228,
|
||||
"name": "icon-T",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 63,
|
||||
@ -634,7 +642,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 116,
|
||||
"name": "icon-telemetry-panel",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 64,
|
||||
@ -642,7 +650,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 84,
|
||||
"name": "icon-telemetry",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 18,
|
||||
@ -650,7 +658,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 246,
|
||||
"name": "icon-thumbs-strip",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 67,
|
||||
@ -658,7 +666,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 83,
|
||||
"name": "icon-timeline",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 68,
|
||||
@ -666,7 +674,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 245,
|
||||
"name": "icon-timer",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 69,
|
||||
@ -674,7 +682,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 90,
|
||||
"name": "icon-trash",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 70,
|
||||
@ -682,7 +690,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 229,
|
||||
"name": "icon-two-parts-both",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 71,
|
||||
@ -690,7 +698,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 231,
|
||||
"name": "icon-two-parts-one-only",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 72,
|
||||
@ -698,7 +706,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 120,
|
||||
"name": "icon-x-heavy",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
},
|
||||
{
|
||||
"order": 66,
|
||||
@ -706,7 +714,7 @@
|
||||
"prevSize": 32,
|
||||
"code": 58946,
|
||||
"name": "icon-x",
|
||||
"tempChar": ""
|
||||
"tempChar": ""
|
||||
}
|
||||
],
|
||||
"id": 2,
|
||||
@ -722,13 +730,43 @@
|
||||
"prevSize": 32,
|
||||
"icons": [
|
||||
{
|
||||
"id": 92,
|
||||
"id": 93,
|
||||
"paths": [
|
||||
"M514 2c-282.8 0-512 229.2-512 512s229.2 512 512 512 512-229.2 512-512-229.2-512-512-512zM860.2 450h-282.2v-282.2c69.6 12.8 133.8 46.2 185 97.4 51 51 84.4 115.2 97.2 184.8zM450 167.8v282.2h-282.2c12.8-69.6 46.2-133.8 97.4-185 51-51 115.2-84.4 184.8-97.2zM167.8 578h282.2v282.2c-69.6-12.8-133.8-46.2-185-97.4-51-51-84.4-115.2-97.2-184.8zM578 860.2v-282.2h282.2c-12.8 69.6-46.2 133.8-97.4 185-51 51-115.2 84.4-184.8 97.2z"
|
||||
"M512 64c-261 0-480.6 195.4-512 448 31.4 252.6 251 448 512 448s480.6-195.4 512-448c-31.4-252.6-251-448-512-448zM768.2 734.6c-71.4 62.8-162.8 97.4-257.6 97.4s-186.2-34.6-257.6-97.4c-66.6-58.6-110.6-137.2-125-222.6 0 0 0-0.2 0-0.2 76.8-154 220.8-257.6 384-257.6s307.2 103.8 384 257.6c0 0 0 0.2 0 0.2-14.4 85.4-61.2 164-127.8 222.6z",
|
||||
"M512 288c-123.8 0-224 100.2-224 224s100.2 224 224 224 224-100.2 224-224-100.2-224-224-224zM576 544c-53 0-96-43-96-96s43-96 96-96 96 43 96 96c0 53-43 96-96 96z"
|
||||
],
|
||||
"attrs": [
|
||||
{
|
||||
"fill": "rgb(0, 0, 0)"
|
||||
"fill": "rgb(6, 161, 75)"
|
||||
},
|
||||
{
|
||||
"fill": "rgb(6, 161, 75)"
|
||||
}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
"grid": 0,
|
||||
"tags": [
|
||||
"icon-eye-open-no-gleam"
|
||||
],
|
||||
"colorPermutations": {
|
||||
"125525525516161751": [
|
||||
1,
|
||||
1
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 92,
|
||||
"paths": [
|
||||
"M512 64c-261 0-480.6 195.4-512 448 31.4 252.6 251 448 512 448s480.6-195.4 512-448c-31.4-252.6-251-448-512-448zM768.2 734.6c-71.4 62.8-162.8 97.4-257.6 97.4s-186.2-34.6-257.6-97.4c-66.6-58.6-110.6-137.2-125-222.6 0 0 0-0.2 0-0.2 76.8-154 220.8-257.6 384-257.6s307.2 103.8 384 257.6c0 0 0 0.2 0 0.2-14.4 85.4-61.2 164-127.8 222.6z",
|
||||
"M512 288c-123.8 0-224 100.2-224 224s100.2 224 224 224 224-100.2 224-224-100.2-224-224-224z"
|
||||
],
|
||||
"attrs": [
|
||||
{
|
||||
"fill": "rgb(6, 161, 75)"
|
||||
},
|
||||
{
|
||||
"fill": "rgb(6, 161, 75)"
|
||||
}
|
||||
],
|
||||
"isMulticolor": false,
|
||||
@ -738,7 +776,8 @@
|
||||
],
|
||||
"colorPermutations": {
|
||||
"125525525516161751": [
|
||||
0
|
||||
1,
|
||||
1
|
||||
]
|
||||
}
|
||||
},
|
||||
|
Binary file not shown.
@ -92,6 +92,7 @@
|
||||
<glyph unicode="" glyph-name="icon-save" d="M192.2 384c-0.2 0-0.2 0 0 0l-0.2-448h640v447.8c0 0 0 0-0.2 0.2h-639.6zM978.8 749.2l-165.4 165.4c-25 25-74.2 45.4-109.4 45.4h-576c-70.4 0-128-57.6-128-128v-768c0-70.4 57.6-128 128-128v448c0 35.2 28.8 64 64 64h640c35.2 0 64-28.8 64-64v-448c70.4 0 128 57.6 128 128v576c0 35.2-20.4 84.4-45.2 109.2zM704 704c0-35.2-28.8-64-64-64h-448c-35.2 0-64 28.8-64 64v192h320v-192h128v192h128v-192z" />
|
||||
<glyph unicode="" glyph-name="icon-collapse-pane-left" d="M256 960h-256v-1024h256c105.6 0 192 86.4 192 192v640c0 105.6-86.4 192-192 192zM512 640l512-320v640z" />
|
||||
<glyph unicode="" glyph-name="icon-collapse-pane-right" d="M768 960h256v-1024h-256c-105.6 0-192 86.4-192 192v640c0 105.6 86.4 192 192 192zM512 640l-512-320v640z" />
|
||||
<glyph unicode="" glyph-name="icon-crosshair" d="M514 958c-282.8 0-512-229.2-512-512s229.2-512 512-512 512 229.2 512 512-229.2 512-512 512zM860.2 510h-282.2v282.2c69.6-12.8 133.8-46.2 185-97.4 51-51 84.4-115.2 97.2-184.8zM450 792.2v-282.2h-282.2c12.8 69.6 46.2 133.8 97.4 185 51 51 115.2 84.4 184.8 97.2zM167.8 382h282.2v-282.2c-69.6 12.8-133.8 46.2-185 97.4-51 51-84.4 115.2-97.2 184.8zM578 99.8v282.2h282.2c-12.8-69.6-46.2-133.8-97.4-185-51-51-115.2-84.4-184.8-97.2z" />
|
||||
<glyph unicode="" glyph-name="icon-eye-open" d="M512 896c-261 0-480.6-195.4-512-448 31.4-252.6 251-448 512-448s480.6 195.4 512 448c-31.4 252.6-251 448-512 448zM768.2 225.4c-71.4-62.8-162.8-97.4-257.6-97.4s-186.2 34.6-257.6 97.4c-66.6 58.6-110.6 137.2-125 222.6 0 0 0 0.2 0 0.2 76.8 154 220.8 257.6 384 257.6s307.2-103.8 384-257.6c0 0 0-0.2 0-0.2-14.4-85.4-61.2-164-127.8-222.6zM512 672c-123.8 0-224-100.2-224-224s100.2-224 224-224 224 100.2 224 224-100.2 224-224 224z" />
|
||||
<glyph unicode="" glyph-name="icon-eye-open-no-gleam" d="M512 896c-261 0-480.6-195.4-512-448 31.4-252.6 251-448 512-448s480.6 195.4 512 448c-31.4 252.6-251 448-512 448zM768.2 225.4c-71.4-62.8-162.8-97.4-257.6-97.4s-186.2 34.6-257.6 97.4c-66.6 58.6-110.6 137.2-125 222.6 0 0 0 0.2 0 0.2 76.8 154 220.8 257.6 384 257.6s307.2-103.8 384-257.6c0 0 0-0.2 0-0.2-14.4-85.4-61.2-164-127.8-222.6zM512 672c-123.8 0-224-100.2-224-224s100.2-224 224-224 224 100.2 224 224-100.2 224-224 224zM576 416c-53 0-96 43-96 96s43 96 96 96 96-43 96-96c0-53-43-96-96-96z" />
|
||||
<glyph unicode="" glyph-name="icon-x" d="M384 448l-365.332-365.332c-24.89-24.89-24.89-65.62 0-90.51l37.49-37.49c24.89-24.89 65.62-24.89 90.51 0 0 0 365.332 365.332 365.332 365.332l365.332-365.332c24.89-24.89 65.62-24.89 90.51 0l37.49 37.49c24.89 24.89 24.89 65.62 0 90.51l-365.332 365.332c0 0 365.332 365.332 365.332 365.332 24.89 24.89 24.89 65.62 0 90.51l-37.49 37.49c-24.89 24.89-65.62 24.89-90.51 0 0 0-365.332-365.332-365.332-365.332l-365.332 365.332c-24.89 24.89-65.62 24.89-90.51 0l-37.49-37.49c-24.89-24.89-24.89-65.62 0-90.51 0 0 365.332-365.332 365.332-365.332z" />
|
||||
</font></defs></svg>
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Binary file not shown.
Binary file not shown.
119
platform/commonUI/general/res/sass/_archetypes.scss
Normal file
119
platform/commonUI/general/res/sass/_archetypes.scss
Normal file
@ -0,0 +1,119 @@
|
||||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
/********************************************* COLUMN LAYOUTS STYLES */
|
||||
@mixin cols($totalCols, $span) {
|
||||
$cw: 100% / $totalCols;
|
||||
min-width: (500px / $totalCols) * $span;
|
||||
@if ($totalCols != $span) {
|
||||
width: ($cw * $span) - $ueColMargin;
|
||||
} @else {
|
||||
width: $cw;
|
||||
}
|
||||
}
|
||||
|
||||
.cols {
|
||||
@include clearfix;
|
||||
.col {
|
||||
@include box-sizing(border-box);
|
||||
@include clearfix;
|
||||
// background: rgba(#ffcc00, 0.2);
|
||||
float: left;
|
||||
margin-left: $ueColMargin;
|
||||
padding-left: $interiorMargin;
|
||||
position: relative;
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
&.cols-2 {
|
||||
$nc: 2;
|
||||
.col-1 {
|
||||
@include cols($nc, 1);
|
||||
}
|
||||
}
|
||||
&.cols-2-ff {
|
||||
// 2 columns, first column is fixed, second is fluid
|
||||
.col-100px {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
&.cols-6 {
|
||||
$nc: 6;
|
||||
.col-1 {
|
||||
@include cols($nc, 1);
|
||||
}
|
||||
}
|
||||
&.cols-16 {
|
||||
$nc: 16;
|
||||
.col-1 {
|
||||
@include cols($nc, 1);
|
||||
}
|
||||
.col-2 {
|
||||
@include cols($nc, 2);
|
||||
}
|
||||
.col-7 {
|
||||
@include cols($nc, 7);
|
||||
}
|
||||
}
|
||||
&.cols-32 {
|
||||
$nc: 32;
|
||||
.col-2 {
|
||||
@include cols($nc, 2);
|
||||
}
|
||||
.col-15 {
|
||||
@include cols($nc, 15);
|
||||
}
|
||||
}
|
||||
.l-row {
|
||||
@include clearfix;
|
||||
padding: $interiorMargin 0;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************* FLEX STYLES */
|
||||
.l-flex-row,
|
||||
.l-flex-col {
|
||||
@include display-flex;
|
||||
@include flex-wrap(nowrap);
|
||||
.flex-elem {
|
||||
&:not(.grows) {
|
||||
@include flex(0 1 auto);
|
||||
}
|
||||
&.grows {
|
||||
@include flex(1 1 auto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.l-flex-row { @include flex-direction(row); }
|
||||
.l-flex-col { @include flex-direction(column); }
|
||||
|
||||
.l-flex {
|
||||
@extend .l-flex-row;
|
||||
.left {
|
||||
@include flex(1 1 0);
|
||||
padding-right: $interiorMarginLg;
|
||||
}
|
||||
}
|
@ -44,9 +44,10 @@ $ueAppLogoW: 105px;
|
||||
$ueEditToolBarH: 25px;
|
||||
$ueBrowseLeftPaneTreeW: 25%;
|
||||
$ueBrowseRightPaneInspectW: 20%;
|
||||
$ueCollapsedPaneEdgeM: 20px;
|
||||
$ueCollapsedPaneEdgeM: 22px;
|
||||
$uePaneMiniTabH: $ueTopBarH;
|
||||
$uePaneMiniTabW: 9px;
|
||||
$uePaneMiniTabCollapsedW: 11px;
|
||||
$ueEditLeftPaneW: 75%;
|
||||
$treeSearchInputBarH: 25px;
|
||||
$ueTimeControlH: (33px, 20px, 20px);
|
||||
|
@ -43,6 +43,11 @@
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
@include box-sizing(border-box);
|
||||
padding-right: $interiorMargin;
|
||||
}
|
||||
|
||||
ul li,
|
||||
em {
|
||||
|
@ -21,6 +21,7 @@
|
||||
*****************************************************************************/
|
||||
@import "effects";
|
||||
@import "global";
|
||||
@import "archetypes";
|
||||
@import "about";
|
||||
@import "text";
|
||||
@import "icons";
|
||||
|
@ -225,6 +225,11 @@ $pad: $interiorMargin * $baseRatio;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
|
||||
&.collapsed {
|
||||
$d: $uePaneMiniTabCollapsedW;
|
||||
width: $d; font-size: $d;
|
||||
}
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
position: absolute;
|
||||
|
@ -19,23 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
@mixin cols($totalCols, $span) {
|
||||
$cw: 100% / $totalCols;
|
||||
min-width: (500px / $totalCols) * $span;
|
||||
@if ($totalCols != $span) {
|
||||
width: ($cw * $span) - $ueColMargin;
|
||||
} @else {
|
||||
width: $cw;
|
||||
}
|
||||
}
|
||||
|
||||
/*.holder-all {
|
||||
$myM: 0; // $interiorMarginSm;
|
||||
top: $myM;
|
||||
right: $myM;
|
||||
bottom: $myM;
|
||||
left: $myM;
|
||||
}*/
|
||||
|
||||
.browse-area,
|
||||
.edit-area,
|
||||
@ -158,67 +141,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.cols {
|
||||
@include clearfix;
|
||||
.col {
|
||||
@include box-sizing(border-box);
|
||||
@include clearfix;
|
||||
// background: rgba(#ffcc00, 0.2);
|
||||
float: left;
|
||||
margin-left: $ueColMargin;
|
||||
padding-left: $interiorMargin;
|
||||
position: relative;
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
&.cols-2 {
|
||||
$nc: 2;
|
||||
.col-1 {
|
||||
@include cols($nc, 1);
|
||||
}
|
||||
}
|
||||
&.cols-2-ff {
|
||||
// 2 columns, first column is fixed, second is fluid
|
||||
.col-100px {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
&.cols-6 {
|
||||
$nc: 6;
|
||||
.col-1 {
|
||||
@include cols($nc, 1);
|
||||
}
|
||||
}
|
||||
&.cols-16 {
|
||||
$nc: 16;
|
||||
.col-1 {
|
||||
@include cols($nc, 1);
|
||||
}
|
||||
.col-2 {
|
||||
@include cols($nc, 2);
|
||||
}
|
||||
.col-7 {
|
||||
@include cols($nc, 7);
|
||||
}
|
||||
}
|
||||
&.cols-32 {
|
||||
$nc: 32;
|
||||
.col-2 {
|
||||
@include cols($nc, 2);
|
||||
}
|
||||
.col-15 {
|
||||
@include cols($nc, 15);
|
||||
}
|
||||
}
|
||||
.l-row {
|
||||
@include clearfix;
|
||||
padding: $interiorMargin 0;
|
||||
}
|
||||
}
|
||||
|
||||
.browse-mode {
|
||||
.split-layout {
|
||||
.split-pane-component.pane {
|
||||
@ -427,7 +349,7 @@
|
||||
|
||||
.object-browse-bar {
|
||||
//@include test(blue);
|
||||
@include absPosDefault(0, visible);
|
||||
@include absPosDefault(0, hidden);
|
||||
@include box-sizing(border-box);
|
||||
height: $ueTopBarH;
|
||||
line-height: $ueTopBarH;
|
||||
@ -443,16 +365,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.l-flex {
|
||||
@include webkitVal('display', 'flex');
|
||||
@include webkitProp('flex-flow', 'row nowrap');
|
||||
.left {
|
||||
//@include test(red);
|
||||
@include webkitProp(flex, '1 1 0');
|
||||
padding-right: $interiorMarginLg;
|
||||
}
|
||||
}
|
||||
|
||||
// When the tree is hidden, these are the
|
||||
// classes used for the left menu and the
|
||||
// right representation.
|
||||
@ -464,25 +376,6 @@
|
||||
.holder-create-and-search {
|
||||
opacity: 0;
|
||||
}
|
||||
/*.holder-create-and-search {
|
||||
@include trans-prop-nice((top, left), 250ms);
|
||||
top: $ueTopBarH + $interiorMargin;
|
||||
left: -1 * $bodyMargin !important;
|
||||
.create-btn {
|
||||
@include border-left-radius(0);
|
||||
@include trans-prop-nice((width), 250ms);
|
||||
width: $uePaneMiniTabW !important;
|
||||
text-align: center !important;
|
||||
padding: 0;
|
||||
.title-label,
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
&:before {
|
||||
font-size: 9px;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
.pane-tree-showing {
|
||||
|
@ -20,9 +20,9 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span class="l-inspect" ng-controller="ObjectInspectorController as controller">
|
||||
<div class="abs holder holder-inspector-elements">
|
||||
<div class="pane-header">Inspection</div>
|
||||
<ul>
|
||||
<div class="abs holder holder-inspector-elements l-flex-col">
|
||||
<div class="pane-header flex-elem">Inspection</div>
|
||||
<ul class="flex-elem grows vscroll">
|
||||
<li>
|
||||
<em>Properties</em>
|
||||
<div class="inspector-properties"
|
||||
|
@ -38,8 +38,9 @@ define(
|
||||
* @constructor
|
||||
* @param {object[]} stylesheets stylesheet extension definitions
|
||||
* @param $document Angular's jqLite-wrapped document element
|
||||
* @param {string} activeTheme the theme in use
|
||||
*/
|
||||
function StyleSheetLoader(stylesheets, $document) {
|
||||
function StyleSheetLoader(stylesheets, $document, activeTheme) {
|
||||
var head = $document.find('head'),
|
||||
document = $document[0];
|
||||
|
||||
@ -62,8 +63,15 @@ define(
|
||||
head.append(link);
|
||||
}
|
||||
|
||||
// Stylesheets which specify themes should only be applied
|
||||
// when that theme has been declared.
|
||||
function matchesTheme(stylesheet) {
|
||||
return stylesheet.theme === undefined ||
|
||||
stylesheet.theme === activeTheme;
|
||||
}
|
||||
|
||||
// Add all stylesheets from extensions
|
||||
stylesheets.forEach(addStyleSheet);
|
||||
stylesheets.filter(matchesTheme).forEach(addStyleSheet);
|
||||
}
|
||||
|
||||
return StyleSheetLoader;
|
||||
|
@ -32,10 +32,11 @@ define(
|
||||
mockPlainDocument,
|
||||
mockHead,
|
||||
mockElement,
|
||||
testBundle,
|
||||
loader;
|
||||
|
||||
beforeEach(function () {
|
||||
var testBundle = {
|
||||
testBundle = {
|
||||
path: "a/b",
|
||||
resources: "c"
|
||||
};
|
||||
@ -72,6 +73,40 @@ define(
|
||||
expect(mockElement.setAttribute)
|
||||
.toHaveBeenCalledWith('href', "a/b/c/d.css");
|
||||
});
|
||||
|
||||
describe("for themed stylesheets", function () {
|
||||
var testTheme = "test-theme";
|
||||
|
||||
beforeEach(function () {
|
||||
testStyleSheets = [{
|
||||
stylesheetUrl: "themed.css",
|
||||
bundle: testBundle,
|
||||
theme: testTheme
|
||||
}, {
|
||||
stylesheetUrl: "bad-theme.css",
|
||||
bundle: testBundle,
|
||||
theme: 'bad-theme'
|
||||
}];
|
||||
|
||||
loader = new StyleSheetLoader(
|
||||
testStyleSheets,
|
||||
mockDocument,
|
||||
testTheme
|
||||
);
|
||||
});
|
||||
|
||||
it("includes matching themes", function () {
|
||||
expect(mockElement.setAttribute)
|
||||
.toHaveBeenCalledWith('href', "a/b/c/themed.css");
|
||||
});
|
||||
|
||||
it("excludes mismatching themes", function () {
|
||||
expect(mockElement.setAttribute)
|
||||
.not.toHaveBeenCalledWith('href', "a/b/c/bad-theme.css");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -1,12 +1,18 @@
|
||||
{
|
||||
"name": "Espresso",
|
||||
"description": "Espresso theme: dark and rich",
|
||||
"extensions": {
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/theme-espresso.css",
|
||||
"priority": 1000
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"name": "Espresso",
|
||||
"description": "Espresso theme: dark and rich",
|
||||
"extensions": {
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/theme-espresso.css",
|
||||
"priority": 1000
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "THEME",
|
||||
"value": "espresso"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,18 @@
|
||||
{
|
||||
"name": "Sonw",
|
||||
"description": "Snow theme: light and cool",
|
||||
"extensions": {
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/theme-snow.css",
|
||||
"priority": 1000
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"name": "Snow",
|
||||
"description": "Snow theme: light and cool",
|
||||
"extensions": {
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/theme-snow.css",
|
||||
"priority": 1000
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "THEME",
|
||||
"value": "snow"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -72,20 +72,6 @@ $colorInputBg: $colorGenBg;
|
||||
$colorInputFg: $colorBodyFg;
|
||||
$colorFormText: pushBack($colorBodyFg, 10%);
|
||||
$colorInputIcon: pushBack($colorBodyFg, 25%);
|
||||
|
||||
// Status colors, mainly used for messaging and item ancillary symbols
|
||||
$colorStatusFg: #fff;
|
||||
$colorStatusDefault: #ccc;
|
||||
$colorStatusInfo: #60ba7b;
|
||||
$colorStatusAlert: #ffb66c;
|
||||
$colorStatusError: #c96b68;
|
||||
$colorProgressBarOuter: rgba(#000, 0.1);
|
||||
$colorProgressBarAmt: #0a0;
|
||||
$progressBarHOverlay: 15px;
|
||||
$progressBarStripeW: 20px;
|
||||
$shdwStatusIc: rgba(white, 0.8) 0 0px 5px;
|
||||
|
||||
// Selects
|
||||
$colorSelectBg: #ddd;
|
||||
$colorSelectFg: $colorBodyFg;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
"provides": "objectService",
|
||||
"type": "provider",
|
||||
"implementation": "objects/DomainObjectProvider.js",
|
||||
"depends": [ "modelService", "capabilityService", "$q" ]
|
||||
"depends": [ "modelService", "instantiate" ]
|
||||
},
|
||||
{
|
||||
"provides": "capabilityService",
|
||||
@ -205,8 +205,8 @@
|
||||
"depends": [ "$q" ]
|
||||
},
|
||||
{
|
||||
"key": "creation",
|
||||
"implementation": "capabilities/CreationCapability.js",
|
||||
"key": "instantiation",
|
||||
"implementation": "capabilities/InstantiationCapability.js",
|
||||
"depends": [ "$injector" ]
|
||||
}
|
||||
],
|
||||
@ -228,6 +228,11 @@
|
||||
"key": "contextualize",
|
||||
"implementation": "services/Contextualize.js",
|
||||
"depends": [ "$log" ]
|
||||
},
|
||||
{
|
||||
"key": "instantiate",
|
||||
"implementation": "services/Instantiate.js",
|
||||
"depends": [ "capabilityService" ]
|
||||
}
|
||||
],
|
||||
"roots": [
|
||||
|
@ -27,33 +27,19 @@ define(
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Implements the `creation` capability. This allows new domain
|
||||
* Implements the `instantiation` capability. This allows new domain
|
||||
* objects to be instantiated.
|
||||
*
|
||||
* @constructor
|
||||
* @memberof platform/core
|
||||
* @param $injector Angular's `$injector`
|
||||
*/
|
||||
function CreationCapability($injector, identifierService, domainObject) {
|
||||
function InstantiationCapability($injector, identifierService, domainObject) {
|
||||
this.$injector = $injector;
|
||||
this.identifierService = identifierService;
|
||||
this.domainObject = domainObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias of `capabilityService.getCapabilities`; handles lazy loading
|
||||
* of `capabilityService`, since it cannot be declared as a
|
||||
* dependency directly without creating a cycle.
|
||||
* @private
|
||||
*/
|
||||
CreationCapability.prototype.getCapabilities = function (model) {
|
||||
if (!this.capabilityService) {
|
||||
this.capabilityService =
|
||||
this.$injector.get('capabilityService');
|
||||
}
|
||||
return this.capabilityService.getCapabilities(model);
|
||||
};
|
||||
|
||||
/**
|
||||
* Instantiate a new domain object with the provided model.
|
||||
*
|
||||
@ -63,23 +49,27 @@ define(
|
||||
*
|
||||
* @returns {DomainObject} the new domain object
|
||||
*/
|
||||
CreationCapability.prototype.create = function (model) {
|
||||
InstantiationCapability.prototype.instantiate = function (model) {
|
||||
var parsedId =
|
||||
this.identifierService.parse(this.domainObject.getId()),
|
||||
space = parsedId.getDefinedSpace(),
|
||||
id = this.identifierService.generate(space),
|
||||
capabilities = this.getCapabilities(model);
|
||||
id = this.identifierService.generate(space);
|
||||
|
||||
return new DomainObjectImpl(id, model, capabilities);
|
||||
// Lazily initialize; instantiate depends on capabilityService,
|
||||
// which depends on all capabilities, including this one.
|
||||
this.instantiateFn = this.instantiateFn ||
|
||||
this.$injector.get("instantiate");
|
||||
|
||||
return this.instantiateFn(model, id);
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of `create`.
|
||||
* @see {platform/core.CreationCapability#create}
|
||||
* Alias of `instantiate`.
|
||||
* @see {platform/core.CreationCapability#instantiate}
|
||||
*/
|
||||
CreationCapability.prototype.invoke =
|
||||
CreationCapability.prototype.create;
|
||||
InstantiationCapability.prototype.invoke =
|
||||
InstantiationCapability.prototype.instantiate;
|
||||
|
||||
return CreationCapability;
|
||||
return InstantiationCapability;
|
||||
}
|
||||
);
|
@ -27,8 +27,8 @@
|
||||
* @namespace platform/core
|
||||
*/
|
||||
define(
|
||||
["./DomainObjectImpl"],
|
||||
function (DomainObjectImpl) {
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
@ -57,62 +57,36 @@ define(
|
||||
*
|
||||
* @param {ModelService} modelService the service which shall
|
||||
* provide models (persistent state) for domain objects
|
||||
* @param {CapabilityService} capabilityService the service
|
||||
* which provides capabilities (dynamic behavior)
|
||||
* for domain objects.
|
||||
* @param {Function} instantiate a service to instantiate new
|
||||
* domain object instances
|
||||
* @param $q Angular's $q, for promise consolidation
|
||||
* @memberof platform/core
|
||||
* @constructor
|
||||
*/
|
||||
function DomainObjectProvider(modelService, capabilityService, $q) {
|
||||
function DomainObjectProvider(modelService, instantiate, $q) {
|
||||
this.modelService = modelService;
|
||||
this.capabilityService = capabilityService;
|
||||
this.$q = $q;
|
||||
this.instantiate = instantiate;
|
||||
}
|
||||
|
||||
DomainObjectProvider.prototype.getObjects = function getObjects(ids) {
|
||||
var modelService = this.modelService,
|
||||
capabilityService = this.capabilityService,
|
||||
$q = this.$q;
|
||||
|
||||
// Given a models object (containing key-value id-model pairs)
|
||||
// create a function that will look up from the capability
|
||||
// service based on id; for handy mapping below.
|
||||
function capabilityResolver(models) {
|
||||
return function (id) {
|
||||
var model = models[id];
|
||||
return model ?
|
||||
capabilityService.getCapabilities(model) :
|
||||
undefined;
|
||||
};
|
||||
}
|
||||
instantiate = this.instantiate;
|
||||
|
||||
// Assemble the results from the model service and the
|
||||
// capability service into one value, suitable to return
|
||||
// from this service. Note that ids are matched to capabilities
|
||||
// by index.
|
||||
function assembleResult(ids, models, capabilities) {
|
||||
// from this service.
|
||||
function assembleResult(models) {
|
||||
var result = {};
|
||||
ids.forEach(function (id, index) {
|
||||
if (models[id]) {
|
||||
// Create the domain object
|
||||
result[id] = new DomainObjectImpl(
|
||||
id,
|
||||
models[id],
|
||||
capabilities[index]
|
||||
);
|
||||
result[id] = instantiate(models[id], id);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
return modelService.getModels(ids).then(function (models) {
|
||||
return $q.all(
|
||||
ids.map(capabilityResolver(models))
|
||||
).then(function (capabilities) {
|
||||
return assembleResult(ids, models, capabilities);
|
||||
});
|
||||
});
|
||||
return modelService.getModels(ids).then(assembleResult);
|
||||
};
|
||||
|
||||
return DomainObjectProvider;
|
||||
|
54
platform/core/src/services/Instantiate.js
Normal file
54
platform/core/src/services/Instantiate.js
Normal file
@ -0,0 +1,54 @@
|
||||
/*****************************************************************************
|
||||
* 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(
|
||||
['../objects/DomainObjectImpl', 'uuid'],
|
||||
function (DomainObjectImpl, uuid) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* The `instantiate` service allows new domain object instances to be
|
||||
* created. These objects are not persisted to any back-end or
|
||||
* placed anywhere in the object hierarchy by default.
|
||||
*
|
||||
* Usage: `instantiate(model, [id])`
|
||||
*
|
||||
* ...returns a new instance of a domain object with the specified
|
||||
* model. An identifier may be provided; if omitted, one will be
|
||||
* generated instead.
|
||||
*
|
||||
* @constructor
|
||||
* @memberof platform/core
|
||||
* @param $injector Angular's `$injector`
|
||||
*/
|
||||
function Instantiate(capabilityService) {
|
||||
return function (model, id) {
|
||||
var capabilities = capabilityService.getCapabilities(model);
|
||||
id = id || uuid();
|
||||
return new DomainObjectImpl(id, model, capabilities);
|
||||
};
|
||||
}
|
||||
|
||||
return Instantiate;
|
||||
}
|
||||
);
|
@ -1,102 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT Web includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
/**
|
||||
* ContextCapability. Created by vwoeltje on 11/6/14.
|
||||
*/
|
||||
define(
|
||||
["../../src/capabilities/CreationCapability"],
|
||||
function (CreationCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("The 'creation' capability", function () {
|
||||
var mockInjector,
|
||||
mockCapabilityService,
|
||||
creation;
|
||||
|
||||
beforeEach(function () {
|
||||
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
|
||||
mockCapabilityService = jasmine.createSpyObj(
|
||||
"capabilityService",
|
||||
[ "getCapabilities" ]
|
||||
);
|
||||
|
||||
mockInjector.get.andCallFake(function (key) {
|
||||
return key === 'capabilityService' ?
|
||||
mockCapabilityService : undefined;
|
||||
});
|
||||
|
||||
creation = new CreationCapability(mockInjector);
|
||||
});
|
||||
|
||||
|
||||
it("aliases 'create' as 'invoke'", function () {
|
||||
expect(creation.invoke).toBe(creation.create);
|
||||
});
|
||||
|
||||
describe("when creating an object", function () {
|
||||
var mockCapabilityConstructor,
|
||||
mockCapabilityInstance,
|
||||
mockCapabilities,
|
||||
testModel,
|
||||
domainObject;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCapabilityConstructor = jasmine.createSpy('capability');
|
||||
mockCapabilityInstance = {};
|
||||
mockCapabilityService.getCapabilities.andReturn({
|
||||
something: mockCapabilityConstructor
|
||||
});
|
||||
mockCapabilityConstructor.andReturn(mockCapabilityInstance);
|
||||
|
||||
testModel = { someKey: "some value" };
|
||||
|
||||
domainObject = creation.create(testModel);
|
||||
});
|
||||
|
||||
it("loads capabilities from the capability service", function () {
|
||||
expect(mockCapabilityService.getCapabilities)
|
||||
.toHaveBeenCalledWith(testModel);
|
||||
});
|
||||
|
||||
it("exposes loaded capabilities from the created object", function () {
|
||||
expect(domainObject.getCapability('something'))
|
||||
.toBe(mockCapabilityInstance);
|
||||
expect(mockCapabilityConstructor)
|
||||
.toHaveBeenCalledWith(domainObject);
|
||||
});
|
||||
|
||||
it("exposes the provided model", function () {
|
||||
expect(domainObject.getModel()).toEqual(testModel);
|
||||
});
|
||||
|
||||
it("provides unique identifiers", function () {
|
||||
expect(domainObject.getId()).toEqual(jasmine.any(String));
|
||||
expect(creation.create(testModel).getId())
|
||||
.not.toEqual(domainObject.getId());
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -0,0 +1,67 @@
|
||||
/*****************************************************************************
|
||||
* 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,xdescribe,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/capabilities/InstantiationCapability"],
|
||||
function (InstantiationCapability) {
|
||||
'use strict';
|
||||
|
||||
describe("The 'instantiation' capability", function () {
|
||||
var mockInjector,
|
||||
mockInstantiate,
|
||||
instantiation;
|
||||
|
||||
beforeEach(function () {
|
||||
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
|
||||
mockInstantiate = jasmine.createSpy("instantiate");
|
||||
|
||||
mockInjector.get.andCallFake(function (key) {
|
||||
return key === 'instantiate' ?
|
||||
mockInstantiate : undefined;
|
||||
});
|
||||
|
||||
instantiation = new InstantiationCapability(mockInjector);
|
||||
});
|
||||
|
||||
|
||||
it("aliases 'instantiate' as 'invoke'", function () {
|
||||
expect(instantiation.invoke).toBe(instantiation.instantiate);
|
||||
});
|
||||
|
||||
it("uses the instantiate service to create domain objects", function () {
|
||||
var mockDomainObject = jasmine.createSpyObj('domainObject', [
|
||||
'getId',
|
||||
'getModel',
|
||||
'getCapability',
|
||||
'useCapability',
|
||||
'hasCapability'
|
||||
]), testModel = { someKey: "some value" };
|
||||
mockInstantiate.andReturn(mockDomainObject);
|
||||
expect(instantiation.instantiate(testModel))
|
||||
.toBe(mockDomainObject);
|
||||
expect(mockInstantiate).toHaveBeenCalledWith(testModel);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -25,14 +25,16 @@
|
||||
* DomainObjectProviderSpec. Created by vwoeltje on 11/6/14.
|
||||
*/
|
||||
define(
|
||||
["../../src/objects/DomainObjectProvider"],
|
||||
function (DomainObjectProvider) {
|
||||
[
|
||||
"../../src/objects/DomainObjectProvider",
|
||||
"../../src/objects/DomainObjectImpl"
|
||||
],
|
||||
function (DomainObjectProvider, DomainObjectImpl) {
|
||||
"use strict";
|
||||
|
||||
describe("The domain object provider", function () {
|
||||
var mockModelService,
|
||||
mockCapabilityService,
|
||||
mockQ,
|
||||
mockInstantiate,
|
||||
provider;
|
||||
|
||||
function mockPromise(value) {
|
||||
@ -57,18 +59,15 @@ define(
|
||||
"modelService",
|
||||
[ "getModels" ]
|
||||
);
|
||||
mockCapabilityService = jasmine.createSpyObj(
|
||||
"capabilityService",
|
||||
[ "getCapabilities" ]
|
||||
);
|
||||
mockQ = {
|
||||
when: mockPromise,
|
||||
all: mockAll
|
||||
};
|
||||
mockInstantiate = jasmine.createSpy("instantiate");
|
||||
|
||||
mockInstantiate.andCallFake(function (model, id) {
|
||||
return new DomainObjectImpl(id, model, {});
|
||||
});
|
||||
|
||||
provider = new DomainObjectProvider(
|
||||
mockModelService,
|
||||
mockCapabilityService,
|
||||
mockQ
|
||||
mockInstantiate
|
||||
);
|
||||
});
|
||||
|
||||
@ -86,10 +85,11 @@ define(
|
||||
result;
|
||||
mockModelService.getModels.andReturn(mockPromise({ a: model }));
|
||||
result = provider.getObjects(ids).testValue;
|
||||
expect(mockInstantiate).toHaveBeenCalledWith(model, 'a');
|
||||
expect(result.a.getId()).toEqual("a");
|
||||
expect(result.a.getModel()).toEqual(model);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
81
platform/core/test/services/InstantiateSpec.js
Normal file
81
platform/core/test/services/InstantiateSpec.js
Normal file
@ -0,0 +1,81 @@
|
||||
/*****************************************************************************
|
||||
* 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,xdescribe,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/services/Instantiate"],
|
||||
function (Instantiate) {
|
||||
'use strict';
|
||||
|
||||
describe("The 'instantiate' service", function () {
|
||||
|
||||
var mockCapabilityService,
|
||||
mockCapabilityConstructor,
|
||||
mockCapabilityInstance,
|
||||
mockCapabilities,
|
||||
testModel,
|
||||
instantiate,
|
||||
domainObject;
|
||||
|
||||
beforeEach(function () {
|
||||
mockCapabilityService = jasmine.createSpyObj(
|
||||
'capabilityService',
|
||||
['getCapabilities']
|
||||
);
|
||||
mockCapabilityConstructor = jasmine.createSpy('capability');
|
||||
mockCapabilityInstance = {};
|
||||
mockCapabilityService.getCapabilities.andReturn({
|
||||
something: mockCapabilityConstructor
|
||||
});
|
||||
mockCapabilityConstructor.andReturn(mockCapabilityInstance);
|
||||
|
||||
testModel = { someKey: "some value" };
|
||||
|
||||
instantiate = new Instantiate(mockCapabilityService);
|
||||
domainObject = instantiate(testModel);
|
||||
});
|
||||
|
||||
it("loads capabilities from the capability service", function () {
|
||||
expect(mockCapabilityService.getCapabilities)
|
||||
.toHaveBeenCalledWith(testModel);
|
||||
});
|
||||
|
||||
it("exposes loaded capabilities from the created object", function () {
|
||||
expect(domainObject.getCapability('something'))
|
||||
.toBe(mockCapabilityInstance);
|
||||
expect(mockCapabilityConstructor)
|
||||
.toHaveBeenCalledWith(domainObject);
|
||||
});
|
||||
|
||||
it("exposes the provided model", function () {
|
||||
expect(domainObject.getModel()).toEqual(testModel);
|
||||
});
|
||||
|
||||
it("provides unique identifiers", function () {
|
||||
expect(domainObject.getId()).toEqual(jasmine.any(String));
|
||||
expect(instantiate(testModel).getId())
|
||||
.not.toEqual(domainObject.getId());
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
);
|
@ -8,8 +8,8 @@
|
||||
"capabilities/ContextCapability",
|
||||
"capabilities/ContextualDomainObject",
|
||||
"capabilities/CoreCapabilityProvider",
|
||||
"capabilities/CreationCapability",
|
||||
"capabilities/DelegationCapability",
|
||||
"capabilities/InstantiationCapability",
|
||||
"capabilities/MetadataCapability",
|
||||
"capabilities/MutationCapability",
|
||||
"capabilities/PersistenceCapability",
|
||||
@ -26,6 +26,7 @@
|
||||
"objects/DomainObjectProvider",
|
||||
|
||||
"services/Contextualize",
|
||||
"services/Instantiate",
|
||||
"services/Now",
|
||||
"services/Throttle",
|
||||
"services/Topic",
|
||||
|
@ -20,7 +20,8 @@
|
||||
"glyph": "+",
|
||||
"category": "contextual",
|
||||
"implementation": "actions/CopyAction.js",
|
||||
"depends": ["locationService", "copyService"]
|
||||
"depends": ["$log", "locationService", "copyService",
|
||||
"dialogService", "notificationService"]
|
||||
},
|
||||
{
|
||||
"key": "link",
|
||||
@ -84,7 +85,8 @@
|
||||
"name": "Copy Service",
|
||||
"description": "Provides a service for copying objects",
|
||||
"implementation": "services/CopyService.js",
|
||||
"depends": ["$q", "creationService", "policyService"]
|
||||
"depends": ["$q", "creationService", "policyService",
|
||||
"persistenceService", "now"]
|
||||
},
|
||||
{
|
||||
"key": "locationService",
|
||||
|
@ -34,16 +34,103 @@ define(
|
||||
* @constructor
|
||||
* @memberof platform/entanglement
|
||||
*/
|
||||
function CopyAction(locationService, copyService, context) {
|
||||
return new AbstractComposeAction(
|
||||
locationService,
|
||||
copyService,
|
||||
context,
|
||||
"Duplicate",
|
||||
"to a location"
|
||||
);
|
||||
function CopyAction($log, locationService, copyService, dialogService,
|
||||
notificationService, context) {
|
||||
this.dialog = undefined;
|
||||
this.notification = undefined;
|
||||
this.dialogService = dialogService;
|
||||
this.notificationService = notificationService;
|
||||
this.$log = $log;
|
||||
//Extend the behaviour of the Abstract Compose Action
|
||||
AbstractComposeAction.call(this, locationService, copyService,
|
||||
context, "Duplicate", "to a location");
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates user about progress of copy. Should not be invoked by
|
||||
* client code under any circumstances.
|
||||
*
|
||||
* @private
|
||||
* @param phase
|
||||
* @param totalObjects
|
||||
* @param processed
|
||||
*/
|
||||
CopyAction.prototype.progress = function(phase, totalObjects, processed){
|
||||
/*
|
||||
Copy has two distinct phases. In the first phase a copy plan is
|
||||
made in memory. During this phase of execution, the user is
|
||||
shown a blocking 'modal' dialog.
|
||||
|
||||
In the second phase, the copying is taking place, and the user
|
||||
is shown non-invasive banner notifications at the bottom of the screen.
|
||||
*/
|
||||
if (phase.toLowerCase() === 'preparing' && !this.dialog){
|
||||
this.dialog = this.dialogService.showBlockingMessage({
|
||||
title: "Preparing to copy objects",
|
||||
unknownProgress: true,
|
||||
severity: "info"
|
||||
});
|
||||
} else if (phase.toLowerCase() === "copying") {
|
||||
this.dialogService.dismiss();
|
||||
if (!this.notification) {
|
||||
this.notification = this.notificationService
|
||||
.notify({
|
||||
title: "Copying objects",
|
||||
unknownProgress: false,
|
||||
severity: "info"
|
||||
});
|
||||
}
|
||||
this.notification.model.progress = (processed / totalObjects) * 100;
|
||||
this.notification.model.title = ["Copied ", processed, "of ",
|
||||
totalObjects, "objects"].join(" ");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Executes the CopyAction. The CopyAction uses the default behaviour of
|
||||
* the AbstractComposeAction, but extends it to support notification
|
||||
* updates of progress on copy.
|
||||
*/
|
||||
CopyAction.prototype.perform = function() {
|
||||
var self = this;
|
||||
|
||||
function success(){
|
||||
self.notification.dismiss();
|
||||
self.notificationService.info("Copying complete.");
|
||||
}
|
||||
|
||||
function error(errorDetails){
|
||||
var errorMessage = {
|
||||
title: "Error copying objects.",
|
||||
severity: "error",
|
||||
hint: errorDetails.message,
|
||||
minimized: true, // want the notification to be minimized initially (don't show banner)
|
||||
options: [{
|
||||
label: "OK",
|
||||
callback: function() {
|
||||
self.dialogService.dismiss();
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
self.dialogService.dismiss();
|
||||
if (self.notification) {
|
||||
self.notification.dismiss(); // Clear the progress notification
|
||||
}
|
||||
self.$log.error("Error copying objects. ", errorDetails);
|
||||
//Show a minimized notification of error for posterity
|
||||
self.notificationService.notify(errorMessage);
|
||||
//Display a blocking message
|
||||
self.dialogService.showBlockingMessage(errorMessage);
|
||||
|
||||
}
|
||||
function notification(details){
|
||||
self.progress(details.phase, details.totalObjects, details.processed);
|
||||
}
|
||||
|
||||
return AbstractComposeAction.prototype.perform.call(this)
|
||||
.then(success, error, notification);
|
||||
};
|
||||
return CopyAction;
|
||||
}
|
||||
);
|
||||
|
@ -23,7 +23,11 @@
|
||||
/*global define */
|
||||
|
||||
define(
|
||||
function () {
|
||||
[
|
||||
"uuid",
|
||||
"./CopyTask"
|
||||
],
|
||||
function (uuid, CopyTask) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
@ -34,10 +38,12 @@ define(
|
||||
* @memberof platform/entanglement
|
||||
* @implements {platform/entanglement.AbstractComposeService}
|
||||
*/
|
||||
function CopyService($q, creationService, policyService) {
|
||||
function CopyService($q, creationService, policyService, persistenceService, now) {
|
||||
this.$q = $q;
|
||||
this.creationService = creationService;
|
||||
this.policyService = policyService;
|
||||
this.persistenceService = persistenceService;
|
||||
this.now = now;
|
||||
}
|
||||
|
||||
CopyService.prototype.validate = function (object, parentCandidate) {
|
||||
@ -54,45 +60,25 @@ define(
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a duplicate of the object tree starting at domainObject to
|
||||
* the new parent specified.
|
||||
* @param domainObject
|
||||
* @param parent
|
||||
* @param progress
|
||||
* @returns a promise that will be completed with the clone of
|
||||
* domainObject when the duplication is successful.
|
||||
*/
|
||||
CopyService.prototype.perform = function (domainObject, parent) {
|
||||
var model = JSON.parse(JSON.stringify(domainObject.getModel())),
|
||||
$q = this.$q,
|
||||
self = this;
|
||||
|
||||
// Wrapper for the recursive step
|
||||
function duplicateObject(domainObject, parent) {
|
||||
return self.perform(domainObject, parent);
|
||||
}
|
||||
|
||||
if (!this.validate(domainObject, parent)) {
|
||||
var $q = this.$q,
|
||||
copyTask = new CopyTask(domainObject, parent, this.persistenceService, this.$q, this.now);
|
||||
if (this.validate(domainObject, parent)) {
|
||||
return copyTask.perform();
|
||||
} else {
|
||||
throw new Error(
|
||||
"Tried to copy objects without validating first."
|
||||
);
|
||||
}
|
||||
|
||||
if (domainObject.hasCapability('composition')) {
|
||||
model.composition = [];
|
||||
}
|
||||
|
||||
return this.creationService
|
||||
.createObject(model, parent)
|
||||
.then(function (newObject) {
|
||||
if (!domainObject.hasCapability('composition')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return domainObject
|
||||
.useCapability('composition')
|
||||
.then(function (composees) {
|
||||
// Duplicate composition serially to prevent
|
||||
// write conflicts.
|
||||
return composees.reduce(function (promise, composee) {
|
||||
return promise.then(function () {
|
||||
return duplicateObject(composee, newObject);
|
||||
});
|
||||
}, $q.when(undefined));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return CopyService;
|
||||
|
198
platform/entanglement/src/services/CopyTask.js
Normal file
198
platform/entanglement/src/services/CopyTask.js
Normal file
@ -0,0 +1,198 @@
|
||||
/*****************************************************************************
|
||||
* 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(
|
||||
["uuid"],
|
||||
function (uuid) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* This class encapsulates the process of copying a domain object
|
||||
* and all of its children.
|
||||
*
|
||||
* @param domainObject The object to copy
|
||||
* @param parent The new location of the cloned object tree
|
||||
* @param persistenceService
|
||||
* @param $q
|
||||
* @param now
|
||||
* @constructor
|
||||
*/
|
||||
function CopyTask (domainObject, parent, persistenceService, $q, now){
|
||||
this.domainObject = domainObject;
|
||||
this.parent = parent;
|
||||
this.$q = $q;
|
||||
this.deferred = undefined;
|
||||
this.persistenceService = persistenceService;
|
||||
this.persisted = 0;
|
||||
this.now = now;
|
||||
this.clones = [];
|
||||
}
|
||||
|
||||
function composeChild(child, parent) {
|
||||
//Once copied, associate each cloned
|
||||
// composee with its parent clone
|
||||
child.model.location = parent.id;
|
||||
parent.model.composition = parent.model.composition || [];
|
||||
return parent.model.composition.push(child.id);
|
||||
}
|
||||
|
||||
function cloneObjectModel(objectModel) {
|
||||
var clone = JSON.parse(JSON.stringify(objectModel));
|
||||
|
||||
delete clone.composition;
|
||||
delete clone.persisted;
|
||||
delete clone.modified;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will persist a list of {@link objectClones}. It will persist all
|
||||
* simultaneously, irrespective of order in the list. This may
|
||||
* result in automatic request batching by the browser.
|
||||
*/
|
||||
function persistObjects(self) {
|
||||
|
||||
return self.$q.all(self.clones.map(function(clone){
|
||||
clone.model.persisted = self.now();
|
||||
return self.persistenceService.createObject(clone.persistenceSpace, clone.id, clone.model)
|
||||
.then(function(){
|
||||
self.deferred.notify({phase: "copying", totalObjects: self.clones.length, processed: ++self.persisted});
|
||||
});
|
||||
})).then(function(){
|
||||
return self;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Will add a list of clones to the specified parent's composition
|
||||
*/
|
||||
function addClonesToParent(self) {
|
||||
var parentClone = self.clones[self.clones.length-1];
|
||||
|
||||
if (!self.parent.hasCapability('composition')){
|
||||
return self.$q.reject();
|
||||
}
|
||||
|
||||
return self.persistenceService
|
||||
.updateObject(parentClone.persistenceSpace, parentClone.id, parentClone.model)
|
||||
.then(function(){return self.parent.getCapability("composition").add(parentClone.id);})
|
||||
.then(function(){return self.parent.getCapability("persistence").persist();})
|
||||
.then(function(){return parentClone;});
|
||||
// Ensure the clone of the original domainObject is returned
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of objects composed by a parent, clone them, then
|
||||
* add them to the parent.
|
||||
* @private
|
||||
* @returns {*}
|
||||
*/
|
||||
CopyTask.prototype.copyComposees = function(composees, clonedParent, originalParent){
|
||||
var self = this;
|
||||
|
||||
return (composees || []).reduce(function(promise, composee){
|
||||
//If the composee is composed of other
|
||||
// objects, chain a promise..
|
||||
return promise.then(function(){
|
||||
// ...to recursively copy it (and its children)
|
||||
return self.copy(composee, originalParent).then(function(composee){
|
||||
composeChild(composee, clonedParent);
|
||||
});
|
||||
});}, self.$q.when(undefined)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* A recursive function that will perform a bottom-up copy of
|
||||
* the object tree with originalObject at the root. Recurses to
|
||||
* the farthest leaf, then works its way back up again,
|
||||
* cloning objects, and composing them with their child clones
|
||||
* as it goes
|
||||
* @private
|
||||
* @param originalObject
|
||||
* @param originalParent
|
||||
* @returns {*}
|
||||
*/
|
||||
CopyTask.prototype.copy = function(originalObject, originalParent) {
|
||||
var self = this,
|
||||
modelClone = {
|
||||
id: uuid(),
|
||||
model: cloneObjectModel(originalObject.getModel()),
|
||||
persistenceSpace: originalParent.hasCapability('persistence') && originalParent.getCapability('persistence').getSpace()
|
||||
};
|
||||
|
||||
return this.$q.when(originalObject.useCapability('composition')).then(function(composees){
|
||||
self.deferred.notify({phase: "preparing"});
|
||||
//Duplicate the object's children, and their children, and
|
||||
// so on down to the leaf nodes of the tree.
|
||||
return self.copyComposees(composees, modelClone, originalObject).then(function (){
|
||||
//Add the clone to the list of clones that will
|
||||
//be returned by this function
|
||||
self.clones.push(modelClone);
|
||||
return modelClone;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Will build a graph of an object and all of its child objects in
|
||||
* memory
|
||||
* @private
|
||||
* @param domainObject The original object to be copied
|
||||
* @param parent The parent of the original object to be copied
|
||||
* @returns {Promise} resolved with an array of clones of the models
|
||||
* of the object tree being copied. Copying is done in a bottom-up
|
||||
* fashion, so that the last member in the array is a clone of the model
|
||||
* object being copied. The clones are all full composed with
|
||||
* references to their own children.
|
||||
*/
|
||||
CopyTask.prototype.buildCopyPlan = function() {
|
||||
var self = this;
|
||||
|
||||
return this.copy(self.domainObject, self.parent).then(function(domainObjectClone){
|
||||
domainObjectClone.model.location = self.parent.getId();
|
||||
return self;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute the copy task with the objects provided in the constructor.
|
||||
* @returns {promise} Which will resolve with a clone of the object
|
||||
* once complete.
|
||||
*/
|
||||
CopyTask.prototype.perform = function(){
|
||||
this.deferred = this.$q.defer();
|
||||
|
||||
this.buildCopyPlan()
|
||||
.then(persistObjects)
|
||||
.then(addClonesToParent)
|
||||
.then(this.deferred.resolve, this.deferred.reject);
|
||||
|
||||
return this.deferred.promise;
|
||||
};
|
||||
|
||||
return CopyTask;
|
||||
}
|
||||
);
|
@ -20,7 +20,7 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*global define,describe,beforeEach,it,jasmine,expect */
|
||||
/*global define,describe,beforeEach,it,jasmine,expect,spyOn */
|
||||
|
||||
define(
|
||||
[
|
||||
@ -41,7 +41,13 @@ define(
|
||||
selectedObject,
|
||||
selectedObjectContextCapability,
|
||||
currentParent,
|
||||
newParent;
|
||||
newParent,
|
||||
notificationService,
|
||||
notification,
|
||||
dialogService,
|
||||
mockLog,
|
||||
abstractComposePromise,
|
||||
progress = {phase: "copying", totalObjects: 10, processed: 1};
|
||||
|
||||
beforeEach(function () {
|
||||
selectedObjectContextCapability = jasmine.createSpyObj(
|
||||
@ -87,10 +93,43 @@ define(
|
||||
]
|
||||
);
|
||||
|
||||
abstractComposePromise = jasmine.createSpyObj(
|
||||
'abstractComposePromise',
|
||||
[
|
||||
'then'
|
||||
]
|
||||
);
|
||||
|
||||
abstractComposePromise.then.andCallFake(function(success, error, notify){
|
||||
notify(progress);
|
||||
success();
|
||||
});
|
||||
|
||||
locationServicePromise.then.andCallFake(function(callback){
|
||||
callback(newParent);
|
||||
return abstractComposePromise;
|
||||
});
|
||||
|
||||
locationService
|
||||
.getLocationFromUser
|
||||
.andReturn(locationServicePromise);
|
||||
|
||||
dialogService = jasmine.createSpyObj('dialogService',
|
||||
['showBlockingMessage', 'dismiss']
|
||||
);
|
||||
|
||||
notification = jasmine.createSpyObj('notification',
|
||||
['dismiss', 'model']
|
||||
);
|
||||
|
||||
notificationService = jasmine.createSpyObj('notificationService',
|
||||
['notify', 'info']
|
||||
);
|
||||
|
||||
notificationService.notify.andReturn(notification);
|
||||
|
||||
mockLog = jasmine.createSpyObj('log', ['error']);
|
||||
|
||||
copyService = new MockCopyService();
|
||||
});
|
||||
|
||||
@ -102,8 +141,11 @@ define(
|
||||
};
|
||||
|
||||
copyAction = new CopyAction(
|
||||
mockLog,
|
||||
locationService,
|
||||
copyService,
|
||||
dialogService,
|
||||
notificationService,
|
||||
context
|
||||
);
|
||||
});
|
||||
@ -114,6 +156,7 @@ define(
|
||||
|
||||
describe("when performed it", function () {
|
||||
beforeEach(function () {
|
||||
spyOn(copyAction, 'progress').andCallThrough();
|
||||
copyAction.perform();
|
||||
});
|
||||
|
||||
@ -132,7 +175,7 @@ define(
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("copys object to selected location", function () {
|
||||
it("copies object to selected location", function () {
|
||||
locationServicePromise
|
||||
.then
|
||||
.mostRecentCall
|
||||
@ -141,6 +184,11 @@ define(
|
||||
expect(copyService.perform)
|
||||
.toHaveBeenCalledWith(selectedObject, newParent);
|
||||
});
|
||||
|
||||
it("notifies the user of progress", function(){
|
||||
expect(notificationService.info).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -152,8 +200,11 @@ define(
|
||||
};
|
||||
|
||||
copyAction = new CopyAction(
|
||||
mockLog,
|
||||
locationService,
|
||||
copyService,
|
||||
dialogService,
|
||||
notificationService,
|
||||
context
|
||||
);
|
||||
});
|
||||
|
@ -31,6 +31,10 @@ define(
|
||||
"use strict";
|
||||
|
||||
function synchronousPromise(value) {
|
||||
if (value && value.then) {
|
||||
return value;
|
||||
}
|
||||
|
||||
var promise = {
|
||||
then: function (callback) {
|
||||
return synchronousPromise(callback(value));
|
||||
@ -122,13 +126,19 @@ define(
|
||||
describe("perform", function () {
|
||||
|
||||
var mockQ,
|
||||
mockDeferred,
|
||||
creationService,
|
||||
createObjectPromise,
|
||||
copyService,
|
||||
mockPersistenceService,
|
||||
mockNow,
|
||||
object,
|
||||
newParent,
|
||||
copyResult,
|
||||
copyFinished;
|
||||
copyFinished,
|
||||
persistObjectPromise,
|
||||
parentPersistenceCapability,
|
||||
resolvedValue;
|
||||
|
||||
beforeEach(function () {
|
||||
creationService = jasmine.createSpyObj(
|
||||
@ -138,44 +148,93 @@ define(
|
||||
createObjectPromise = synchronousPromise(undefined);
|
||||
creationService.createObject.andReturn(createObjectPromise);
|
||||
policyService.allow.andReturn(true);
|
||||
|
||||
mockPersistenceService = jasmine.createSpyObj(
|
||||
'persistenceService',
|
||||
['createObject', 'updateObject']
|
||||
);
|
||||
persistObjectPromise = synchronousPromise(undefined);
|
||||
mockPersistenceService.createObject.andReturn(persistObjectPromise);
|
||||
mockPersistenceService.updateObject.andReturn(persistObjectPromise);
|
||||
|
||||
parentPersistenceCapability = jasmine.createSpyObj(
|
||||
"persistence",
|
||||
[ "persist", "getSpace" ]
|
||||
);
|
||||
|
||||
parentPersistenceCapability.persist.andReturn(persistObjectPromise);
|
||||
parentPersistenceCapability.getSpace.andReturn("testSpace");
|
||||
|
||||
mockNow = jasmine.createSpyObj("mockNow", ["now"]);
|
||||
mockNow.now.andCallFake(function(){
|
||||
return 1234;
|
||||
});
|
||||
|
||||
mockDeferred = jasmine.createSpyObj('mockDeferred', ['notify', 'resolve']);
|
||||
mockDeferred.notify.andCallFake(function(notification){});
|
||||
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;});
|
||||
mockDeferred.promise = {
|
||||
then: function(callback){
|
||||
return synchronousPromise(callback(resolvedValue));
|
||||
}
|
||||
};
|
||||
|
||||
mockQ = jasmine.createSpyObj('mockQ', ['when', 'all', 'reject', 'defer']);
|
||||
mockQ.when.andCallFake(synchronousPromise);
|
||||
mockQ.all.andCallFake(function (promises) {
|
||||
var result = {};
|
||||
Object.keys(promises).forEach(function (k) {
|
||||
promises[k].then(function (v) { result[k] = v; });
|
||||
});
|
||||
return synchronousPromise(result);
|
||||
});
|
||||
mockQ.defer.andReturn(mockDeferred);
|
||||
|
||||
});
|
||||
|
||||
describe("on domain object without composition", function () {
|
||||
beforeEach(function () {
|
||||
object = domainObjectFactory({
|
||||
name: 'object',
|
||||
id: 'abc',
|
||||
model: {
|
||||
name: 'some object'
|
||||
}
|
||||
});
|
||||
newParent = domainObjectFactory({
|
||||
name: 'newParent',
|
||||
id: '456',
|
||||
model: {
|
||||
composition: []
|
||||
},
|
||||
capabilities: {
|
||||
persistence: parentPersistenceCapability
|
||||
}
|
||||
});
|
||||
copyService = new CopyService(null, creationService, policyService);
|
||||
|
||||
object = domainObjectFactory({
|
||||
name: 'object',
|
||||
id: 'abc',
|
||||
model: {
|
||||
name: 'some object',
|
||||
location: newParent.id,
|
||||
persisted: mockNow.now()
|
||||
}
|
||||
});
|
||||
|
||||
copyService = new CopyService(mockQ, creationService, policyService, mockPersistenceService, mockNow.now);
|
||||
copyResult = copyService.perform(object, newParent);
|
||||
copyFinished = jasmine.createSpy('copyFinished');
|
||||
copyResult.then(copyFinished);
|
||||
});
|
||||
|
||||
it("uses creation service", function () {
|
||||
expect(creationService.createObject)
|
||||
.toHaveBeenCalledWith(jasmine.any(Object), newParent);
|
||||
|
||||
expect(createObjectPromise.then)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
it("uses persistence service", function () {
|
||||
expect(mockPersistenceService.createObject)
|
||||
.toHaveBeenCalledWith(parentPersistenceCapability.getSpace(), jasmine.any(String), object.getModel());
|
||||
|
||||
expect(persistObjectPromise.then)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("deep clones object model", function () {
|
||||
var newModel = creationService
|
||||
//var newModel = creationService
|
||||
var newModel = mockPersistenceService
|
||||
.createObject
|
||||
.mostRecentCall
|
||||
.args[0];
|
||||
|
||||
.args[2];
|
||||
expect(newModel).toEqual(object.model);
|
||||
expect(newModel).not.toBe(object.model);
|
||||
});
|
||||
@ -191,11 +250,15 @@ define(
|
||||
var newObject,
|
||||
childObject,
|
||||
compositionCapability,
|
||||
locationCapability,
|
||||
compositionPromise;
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = jasmine.createSpyObj('mockQ', ['when']);
|
||||
mockQ.when.andCallFake(synchronousPromise);
|
||||
|
||||
|
||||
locationCapability = jasmine.createSpyObj('locationCapability', ['isLink']);
|
||||
locationCapability.isLink.andReturn(true);
|
||||
|
||||
childObject = domainObjectFactory({
|
||||
name: 'childObject',
|
||||
id: 'def',
|
||||
@ -205,24 +268,28 @@ define(
|
||||
});
|
||||
compositionCapability = jasmine.createSpyObj(
|
||||
'compositionCapability',
|
||||
['invoke']
|
||||
['invoke', 'add']
|
||||
);
|
||||
compositionPromise = jasmine.createSpyObj(
|
||||
'compositionPromise',
|
||||
['then']
|
||||
);
|
||||
|
||||
compositionCapability
|
||||
.invoke
|
||||
.andReturn(compositionPromise);
|
||||
.andReturn(synchronousPromise([childObject]));
|
||||
|
||||
object = domainObjectFactory({
|
||||
name: 'object',
|
||||
id: 'abc',
|
||||
model: {
|
||||
name: 'some object',
|
||||
composition: ['def']
|
||||
composition: ['def'],
|
||||
location: 'testLocation'
|
||||
},
|
||||
capabilities: {
|
||||
composition: compositionCapability
|
||||
composition: compositionCapability,
|
||||
location: locationCapability
|
||||
}
|
||||
});
|
||||
newObject = domainObjectFactory({
|
||||
@ -241,45 +308,45 @@ define(
|
||||
id: '456',
|
||||
model: {
|
||||
composition: []
|
||||
},
|
||||
capabilities: {
|
||||
composition: compositionCapability,
|
||||
persistence: parentPersistenceCapability
|
||||
}
|
||||
});
|
||||
|
||||
createObjectPromise = synchronousPromise(newObject);
|
||||
creationService.createObject.andReturn(createObjectPromise);
|
||||
copyService = new CopyService(mockQ, creationService, policyService);
|
||||
copyResult = copyService.perform(object, newParent);
|
||||
copyFinished = jasmine.createSpy('copyFinished');
|
||||
copyResult.then(copyFinished);
|
||||
copyService = new CopyService(mockQ, creationService, policyService, mockPersistenceService, mockNow.now);
|
||||
});
|
||||
|
||||
it("uses creation service", function () {
|
||||
expect(creationService.createObject)
|
||||
.toHaveBeenCalledWith(jasmine.any(Object), newParent);
|
||||
describe("the cloning process", function(){
|
||||
beforeEach(function() {
|
||||
copyResult = copyService.perform(object, newParent);
|
||||
copyFinished = jasmine.createSpy('copyFinished');
|
||||
copyResult.then(copyFinished);
|
||||
});
|
||||
|
||||
expect(createObjectPromise.then)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
});
|
||||
it("copies object and children in a bottom-up" +
|
||||
" fashion", function () {
|
||||
expect(mockPersistenceService.createObject.calls[0].args[2].name).toEqual(childObject.model.name);
|
||||
expect(mockPersistenceService.createObject.calls[1].args[2].name).toEqual(object.model.name);
|
||||
});
|
||||
|
||||
it("clears model composition", function () {
|
||||
var newModel = creationService
|
||||
.createObject
|
||||
.mostRecentCall
|
||||
.args[0];
|
||||
it("returns a promise", function () {
|
||||
expect(copyResult.then).toBeDefined();
|
||||
expect(copyFinished).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
expect(newModel.composition.length).toBe(0);
|
||||
expect(newModel.name).toBe('some object');
|
||||
});
|
||||
it("clears modified and sets persisted", function () {
|
||||
expect(copyFinished.mostRecentCall.args[0].model.modified).toBeUndefined();
|
||||
expect(copyFinished.mostRecentCall.args[0].model.persisted).toBe(mockNow.now());
|
||||
});
|
||||
|
||||
it("recursively clones it's children", function () {
|
||||
expect(creationService.createObject.calls.length).toBe(1);
|
||||
expect(compositionCapability.invoke).toHaveBeenCalled();
|
||||
compositionPromise.then.mostRecentCall.args[0]([childObject]);
|
||||
expect(creationService.createObject.calls.length).toBe(2);
|
||||
});
|
||||
it ("correctly locates cloned objects", function() {
|
||||
expect(mockPersistenceService.createObject.calls[0].args[2].location).toEqual(mockPersistenceService.createObject.calls[1].args[1]);
|
||||
});
|
||||
|
||||
it("returns a promise", function () {
|
||||
expect(copyResult.then).toBeDefined();
|
||||
expect(copyFinished).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@ -301,7 +368,7 @@ define(
|
||||
|
||||
it("throws an error", function () {
|
||||
var copyService =
|
||||
new CopyService(mockQ, creationService, policyService);
|
||||
new CopyService(mockQ, creationService, policyService, mockPersistenceService, mockNow.now);
|
||||
|
||||
function perform() {
|
||||
copyService.perform(object, newParent);
|
||||
|
@ -102,7 +102,7 @@ define(
|
||||
function updateDomain(value) {
|
||||
var newDomain = conductor.domain(value);
|
||||
conductorScope.parameters.format = newDomain.format;
|
||||
repScope.$broadcast('telemetry:display:bounds', bounds());
|
||||
broadcastBounds();
|
||||
}
|
||||
|
||||
// telemetry domain metadata -> option for a select control
|
||||
@ -139,8 +139,6 @@ define(
|
||||
.$watch('ngModel.conductor.inner.end', updateConductorInner);
|
||||
conductorScope
|
||||
.$watch('ngModel.domain', updateDomain);
|
||||
|
||||
repScope.$on('telemetry:view', updateConductorInner);
|
||||
};
|
||||
|
||||
ConductorRepresenter.prototype.conductorScope = function (s) {
|
||||
|
@ -245,9 +245,6 @@ define(
|
||||
|
||||
// Unsubscribe when the plot is destroyed
|
||||
$scope.$on("$destroy", releaseSubscription);
|
||||
|
||||
// Notify any external observers that a new telemetry view is here
|
||||
$scope.$emit("telemetry:view");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,7 @@ define(
|
||||
*/
|
||||
function TelemetryHandle($q, subscription) {
|
||||
var seriesMap = {},
|
||||
active = true,
|
||||
self = Object.create(subscription);
|
||||
|
||||
// Request a telemetry series for this specific object
|
||||
@ -50,7 +51,7 @@ define(
|
||||
// Store it for subsequent lookup
|
||||
seriesMap[id] = series;
|
||||
// Notify callback of new series data, if there is one
|
||||
if (callback) {
|
||||
if (callback && active) {
|
||||
callback(telemetryObject, series);
|
||||
}
|
||||
// Pass it along for promise-chaining
|
||||
@ -61,6 +62,10 @@ define(
|
||||
return telemetry.requestData(request).then(receiveSeries);
|
||||
}
|
||||
|
||||
self.unsubscribe = function () {
|
||||
active = false;
|
||||
return subscription.unsubscribe();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the most recently obtained telemetry data series associated
|
||||
|
@ -85,10 +85,18 @@ define(
|
||||
|
||||
it("exposes subscription API", function () {
|
||||
// Should still expose methods from the provided subscription
|
||||
expect(handle.unsubscribe)
|
||||
.toBe(mockSubscription.unsubscribe);
|
||||
expect(handle.getTelemetryObjects)
|
||||
.toBe(mockSubscription.getTelemetryObjects);
|
||||
// (though these may have been wrapped)
|
||||
expect(mockSubscription.getTelemetryObjects)
|
||||
.not.toHaveBeenCalled();
|
||||
handle.getTelemetryObjects();
|
||||
expect(mockSubscription.getTelemetryObjects)
|
||||
.toHaveBeenCalled();
|
||||
|
||||
expect(mockSubscription.unsubscribe)
|
||||
.not.toHaveBeenCalled();
|
||||
handle.unsubscribe();
|
||||
expect(mockSubscription.unsubscribe)
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("provides an interface for historical requests", function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user