mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 11:09:22 +00:00
Compare commits
12 Commits
plot-filte
...
table-row-
Author | SHA1 | Date | |
---|---|---|---|
91a8fbeb3e | |||
534bdbae50 | |||
831873e7de | |||
622d246fdd | |||
4a1ca9f299 | |||
4e1de2678c | |||
33a4792531 | |||
37dd4856a6 | |||
6a9cf3389d | |||
2da2395473 | |||
00ecd27bb3 | |||
0fa4486dcf |
@ -20,14 +20,8 @@ API. Open MCT is also being refactored to minimize the dependencies that using
|
||||
Open MCT imposes on developers, such as the current requirement to use
|
||||
AngularJS.
|
||||
|
||||
This new API has not yet been heavily used and is likely to contain defects.
|
||||
You can help by trying it out, and reporting any issues you encounter
|
||||
using our GitHub issue tracker. Such issues may include bugs, suggestions,
|
||||
missing documentation, or even just requests for help if you're having
|
||||
trouble.
|
||||
|
||||
We want Open MCT to be as easy to use, install, run, and develop for as
|
||||
possible, and your feedback will help us get there!
|
||||
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues), or by emailing us at [arc-dl-openmct@nasa.gov](mailto:arc-dl-openmct@nasa.gov).
|
||||
|
||||
## Building and Running Open MCT Locally
|
||||
|
||||
|
10
openmct.js
10
openmct.js
@ -41,14 +41,14 @@ requirejs.config({
|
||||
"lodash": "bower_components/lodash/lodash",
|
||||
"d3-selection": "node_modules/d3-selection/dist/d3-selection.min",
|
||||
"d3-scale": "node_modules/d3-scale/build/d3-scale.min",
|
||||
"d3-axis": "node_modules/d3-axis/build/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/build/d3-array.min",
|
||||
"d3-collection": "node_modules/d3-collection/build/d3-collection.min",
|
||||
"d3-axis": "node_modules/d3-axis/dist/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/dist/d3-array.min",
|
||||
"d3-collection": "node_modules/d3-collection/dist/d3-collection.min",
|
||||
"d3-color": "node_modules/d3-color/build/d3-color.min",
|
||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||
"d3-time": "node_modules/d3-time/dist/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/dist/d3-time-format.min",
|
||||
"html2canvas": "node_modules/html2canvas/dist/html2canvas.min",
|
||||
"painterro": "node_modules/painterro/build/painterro.min",
|
||||
"printj": "node_modules/printj/dist/printj.min"
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "openmct",
|
||||
"version": "0.14.0-SNAPSHOT",
|
||||
"description": "The Open MCT core platform",
|
||||
"description": "The Open MCT core platform.",
|
||||
"dependencies": {
|
||||
"d3-array": "1.2.x",
|
||||
"d3-axis": "1.0.x",
|
||||
|
@ -51,7 +51,7 @@ define([
|
||||
/**
|
||||
* Perform this action.
|
||||
*/
|
||||
RemoveAction.prototype.perform = function () {
|
||||
RemoveAction.prototype.perform = function (skipWarning) {
|
||||
var dialog,
|
||||
dialogService = this.dialogService,
|
||||
domainObject = this.domainObject,
|
||||
@ -115,12 +115,18 @@ define([
|
||||
return parent.useCapability('mutation', doMutate);
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass in the function to remove the domain object so it can be
|
||||
* associated with an 'OK' button press
|
||||
*/
|
||||
dialog = new RemoveDialog(dialogService, domainObject, removeFromContext);
|
||||
dialog.show();
|
||||
if (skipWarning) {
|
||||
|
||||
removeFromContext(domainObject);
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Pass in the function to remove the domain object so it can be
|
||||
* associated with an 'OK' button press
|
||||
*/
|
||||
dialog = new RemoveDialog(dialogService, domainObject, removeFromContext);
|
||||
dialog.show();
|
||||
}
|
||||
};
|
||||
|
||||
// Object needs to have a parent for Remove to be applicable
|
||||
|
@ -124,6 +124,17 @@ define(
|
||||
expect(mockParent.useCapability).not.toHaveBeenCalledWith("mutation", jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("does not show a blocking message dialog when true is passed to perform", function () {
|
||||
mockParent = jasmine.createSpyObj(
|
||||
"parent",
|
||||
["getModel", "getCapability", "useCapability"]
|
||||
);
|
||||
|
||||
action.perform(true);
|
||||
|
||||
expect(mockDialogService.showBlockingMessage).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("after the remove callback is triggered", function () {
|
||||
var mockChildContext,
|
||||
mockChildObject,
|
||||
|
@ -102,14 +102,14 @@ define(
|
||||
* @returns {Action[]} an array of matching actions
|
||||
* @memberof platform/core.ActionCapability#
|
||||
*/
|
||||
ActionCapability.prototype.perform = function (context) {
|
||||
ActionCapability.prototype.perform = function (context, flag) {
|
||||
// Alias to getActions(context)[0].perform, with a
|
||||
// check for empty arrays.
|
||||
var actions = this.getActions(context);
|
||||
|
||||
return this.$q.when(
|
||||
(actions && actions.length > 0) ?
|
||||
actions[0].perform() :
|
||||
actions[0].perform(flag) :
|
||||
undefined
|
||||
);
|
||||
};
|
||||
|
@ -92,7 +92,7 @@ define(
|
||||
.then(function () {
|
||||
return object
|
||||
.getCapability('action')
|
||||
.perform('remove');
|
||||
.perform('remove', true);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -224,10 +224,11 @@ define(
|
||||
locationPromise.resolve();
|
||||
});
|
||||
|
||||
it("removes object from parent", function () {
|
||||
it("removes object from parent without user warning dialog", function () {
|
||||
expect(actionCapability.perform)
|
||||
.toHaveBeenCalledWith('remove');
|
||||
.toHaveBeenCalledWith('remove', true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@ -244,9 +245,9 @@ define(
|
||||
.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("removes object from parent", function () {
|
||||
it("removes object from parent without user warning dialog", function () {
|
||||
expect(actionCapability.perform)
|
||||
.toHaveBeenCalledWith('remove');
|
||||
.toHaveBeenCalledWith('remove', true);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -87,7 +87,8 @@ define(
|
||||
'setDisplayedValue',
|
||||
'subscribeToObject',
|
||||
'unsubscribe',
|
||||
'updateView'
|
||||
'updateView',
|
||||
'setSelection'
|
||||
].forEach(function (name) {
|
||||
self[name] = self[name].bind(self);
|
||||
});
|
||||
@ -224,7 +225,7 @@ define(
|
||||
// Respond to external bounds changes
|
||||
this.openmct.time.on("bounds", updateDisplayBounds);
|
||||
|
||||
this.openmct.selection.on('change', this.setSelection.bind(this));
|
||||
this.openmct.selection.on('change', this.setSelection);
|
||||
this.$element.on('click', this.bypassSelection.bind(this));
|
||||
this.unlisten = this.openmct.objects.observe(this.newDomainObject, '*', function (obj) {
|
||||
this.newDomainObject = JSON.parse(JSON.stringify(obj));
|
||||
@ -233,6 +234,9 @@ define(
|
||||
|
||||
this.updateElementPositions(this.newDomainObject.layoutGrid);
|
||||
refreshElements();
|
||||
|
||||
//force a click, to initialize Fixed Position Controller on SelectionAPI
|
||||
$element[0].click();
|
||||
}
|
||||
|
||||
FixedController.prototype.updateElementPositions = function (layoutGrid) {
|
||||
|
@ -35,28 +35,30 @@ mct-table {
|
||||
}
|
||||
|
||||
.mct-table {
|
||||
tr {
|
||||
display: flex; // flex-flow defaults to row nowrap (which is what we want) so no need to define
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
td, th {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
flex: 1 0 auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
thead {
|
||||
display: block;
|
||||
tr {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
th {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tbody {
|
||||
tr {
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
height: 18px; // Needed when a row has empty values in its cells
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ define(['lodash'], function (_) {
|
||||
copyOfChild.location = parentId;
|
||||
parent.composition[index] = copyOfChild.identifier;
|
||||
this.tree[newIdString] = copyOfChild;
|
||||
this.tree[parentId].composition[index] = newIdString;
|
||||
this.tree[parentId].composition[index] = copyOfChild.identifier;
|
||||
|
||||
return copyOfChild;
|
||||
};
|
||||
|
@ -79,16 +79,18 @@ define(['zepto'], function ($) {
|
||||
var parentModel = parent.getModel();
|
||||
var newObj;
|
||||
|
||||
seen.push(parent.getId());
|
||||
seen.push(this.getKeyString(parent.getId()));
|
||||
parentModel.composition.forEach(function (childId, index) {
|
||||
if (!tree[childId] || seen.includes(childId)) {
|
||||
var childIdString = this.getKeyString(childId);
|
||||
if (!tree[childIdString] || seen.includes(childIdString)) {
|
||||
return;
|
||||
}
|
||||
|
||||
newObj = this.instantiate(tree[childId], childId);
|
||||
parent.getCapability("composition").add(newObj);
|
||||
newObj.getCapability("location")
|
||||
.setPrimaryLocation(tree[childId].location);
|
||||
newObj = this.instantiate(tree[childIdString], childIdString);
|
||||
// New object has not been persisted yet so clear persisted
|
||||
// timestamp from copied model.
|
||||
delete newObj.getModel().persisted;
|
||||
newObj.getCapability('persistence').persist();
|
||||
this.deepInstantiate(newObj, tree, seen);
|
||||
}, this);
|
||||
}
|
||||
@ -103,6 +105,10 @@ define(['zepto'], function ($) {
|
||||
return tree;
|
||||
};
|
||||
|
||||
ImportAsJSONAction.prototype.getKeyString = function (identifier) {
|
||||
return this.openmct.objects.makeKeyString(identifier);
|
||||
};
|
||||
|
||||
/**
|
||||
* Rewrites all instances of a given id in the tree with a newly generated
|
||||
* replacement to prevent collision.
|
||||
|
@ -47,7 +47,12 @@ define(
|
||||
uniqueId = 0;
|
||||
newObjects = [];
|
||||
openmct = {
|
||||
$injector: jasmine.createSpyObj('$injector', ['get'])
|
||||
$injector: jasmine.createSpyObj('$injector', ['get']),
|
||||
objects: {
|
||||
makeKeyString: function (identifier) {
|
||||
return identifier.key;
|
||||
}
|
||||
}
|
||||
};
|
||||
mockInstantiate = jasmine.createSpy('instantiate').and.callFake(
|
||||
function (model, id) {
|
||||
@ -154,7 +159,7 @@ define(
|
||||
body: JSON.stringify({
|
||||
"openmct": {
|
||||
"infiniteParent": {
|
||||
"composition": ["infinteChild"],
|
||||
"composition": [{key: "infinteChild", namespace: ""}],
|
||||
"name": "1",
|
||||
"type": "folder",
|
||||
"modified": 1503598129176,
|
||||
@ -162,7 +167,7 @@ define(
|
||||
"persisted": 1503598129176
|
||||
},
|
||||
"infinteChild": {
|
||||
"composition": ["infiniteParent"],
|
||||
"composition": [{key: "infinteParent", namespace: ""}],
|
||||
"name": "2",
|
||||
"type": "folder",
|
||||
"modified": 1503598132428,
|
||||
|
10
test-main.js
10
test-main.js
@ -67,14 +67,14 @@ requirejs.config({
|
||||
"lodash": "bower_components/lodash/lodash",
|
||||
"d3-selection": "node_modules/d3-selection/dist/d3-selection.min",
|
||||
"d3-scale": "node_modules/d3-scale/build/d3-scale.min",
|
||||
"d3-axis": "node_modules/d3-axis/build/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/build/d3-array.min",
|
||||
"d3-collection": "node_modules/d3-collection/build/d3-collection.min",
|
||||
"d3-axis": "node_modules/d3-axis/dist/d3-axis.min",
|
||||
"d3-array": "node_modules/d3-array/dist/d3-array.min",
|
||||
"d3-collection": "node_modules/d3-collection/dist/d3-collection.min",
|
||||
"d3-color": "node_modules/d3-color/build/d3-color.min",
|
||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||
"d3-time": "node_modules/d3-time/dist/d3-time.min",
|
||||
"d3-time-format": "node_modules/d3-time-format/dist/d3-time-format.min",
|
||||
"html2canvas": "node_modules/html2canvas/dist/html2canvas.min",
|
||||
"painterro": "node_modules/painterro/build/painterro.min",
|
||||
"printj": "node_modules/printj/dist/printj.min"
|
||||
|
Reference in New Issue
Block a user