Compare commits

...

10 Commits

Author SHA1 Message Date
Deep Tailor
4264e704b2 use makekeystring instead of key to avoid collisions in events 2019-04-03 18:08:48 -07:00
Deep Tailor
b104413d13 conditionally show snapshot button only if notebook is installed 2019-04-03 14:13:05 -07:00
Deep Tailor
7f5e66962a force a digest in the plot options controller once the series are added 2019-04-03 12:10:58 -07:00
Deep Tailor
7b5a3c1e1b only update inspector views if selection has changed to a new context 2019-04-03 11:33:25 -07:00
Deep Tailor
c4fde0e074 move selection logic to flexible layouts 2019-04-03 10:58:29 -07:00
Deep Tailor
f44f6839be remove uneccesary console log 2019-04-01 13:21:53 -07:00
Deep Tailor
47767748b7 fix isAlias logic for folder views 2019-04-01 13:04:04 -07:00
Deep Tailor
f2a3148cfc fix for resize handles not showing after object is dropped 2019-04-01 12:46:02 -07:00
Deep Tailor
a7bc96a3b5 resize when item is deleted 2019-04-01 12:35:13 -07:00
Deep Tailor
0aa32962c7 add a function to change selection of deleted item in remove action, and update flexlayouts 2019-04-01 12:24:27 -07:00
9 changed files with 62 additions and 23 deletions

View File

@@ -57,8 +57,10 @@ define([
}.bind(this);
handleLegacyMutation = function (legacyObject) {
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId());
this.eventEmitter.emit(newStyleObject.identifier.key + ":*", newStyleObject);
var newStyleObject = utils.toNewFormat(legacyObject.getModel(), legacyObject.getId()),
keystring = utils.makeKeyString(newStyleObject.identifier);
this.eventEmitter.emit(keystring + ":*", newStyleObject);
this.eventEmitter.emit('mutation', newStyleObject);
}.bind(this);

View File

@@ -21,8 +21,10 @@
*****************************************************************************/
define([
'./object-utils.js',
'lodash'
], function (
utils,
_
) {
var ANY_OBJECT_EVENT = "mutation";
@@ -41,7 +43,9 @@ define([
}
function qualifiedEventName(object, eventName) {
return [object.identifier.key, eventName].join(':');
var keystring = utils.makeKeyString(object.identifier);
return [keystring, eventName].join(':');
}
MutableObject.prototype.stopListening = function () {

View File

@@ -422,6 +422,7 @@ import Container from '../utils/container';
import Frame from '../utils/frame';
import ResizeHandle from './resizeHandle.vue';
import DropHint from './dropHint.vue';
import RemoveAction from '../../remove/RemoveAction.js';
const MIN_CONTAINER_SIZE = 5;
@@ -513,7 +514,7 @@ export default {
remove associated domainObjects from composition
*/
container.frames.forEach(f => {
this.composition.remove({identifier: f.domainObjectIdentifier});
this.removeFromComposition(f.domainObjectIdentifier);
});
this.containers.splice(containerIndex, 1);
@@ -528,6 +529,7 @@ export default {
}
sizeToFill(this.containers);
this.setSelectionToParent();
this.persist();
},
moveFrame(toContainerIndex, toFrameIndex, frameId, fromContainerIndex) {
@@ -561,20 +563,24 @@ export default {
deleteFrame(frameId) {
let container = this.containers
.filter(c => c.frames.some(f => f.id === frameId))[0];
let containerIndex = this.containers.indexOf(container);
let frame = container
.frames
.filter((f => f.id === frameId))[0];
let frameIndex = container.frames.indexOf(frame);
/*
remove associated domainObject from composition
*/
this.composition.remove({identifier: frame.domainObjectIdentifier});
container.frames.splice(frameIndex, 1);
sizeToFill(container.frames);
this.persist(containerIndex);
this.removeFromComposition(frame.domainObjectIdentifier)
.then(() => {
sizeToFill(container.frames)
this.setSelectionToParent();
});
},
removeFromComposition(identifier) {
return this.openmct.objects.get(identifier).then((childDomainObject) => {
this.RemoveAction.removeFromComposition(this.domainObject, childDomainObject);
});
},
setSelectionToParent() {
let currentSelection = this.openmct.selection.selected;
this.openmct.selection.select(currentSelection.slice(1));
},
allowContainerDrop(event, index) {
if (!event.dataTransfer.types.includes('containerid')) {
@@ -665,6 +671,8 @@ export default {
this.composition.on('remove', this.removeChildObject);
this.composition.on('add', this.addFrame);
this.RemoveAction = new RemoveAction(this.openmct);
this.unobserve = this.openmct.objects.observe(this.domainObject, '*', this.updateDomainObject);
},
beforeDestroy() {

View File

@@ -79,10 +79,12 @@ export default {
mounted() {
document.addEventListener('dragstart', this.setDragging);
document.addEventListener('dragend', this.unsetDragging);
document.addEventListener('drop', this.unsetDragging);
},
destroyed() {
document.removeEventListener('dragstart', this.setDragging);
document.removeEventListener('dragend', this.unsetDragging);
document.removeEventListener('drop', this.unsetDragging);
}
}
</script>

View File

@@ -77,11 +77,11 @@ function ToolbarProvider(openmct) {
.containers;
let container = containers
.filter(c => c.frames.some(f => f.id === frameId))[0];
let frame = container
let containerIndex = containers.indexOf(container);
let frame = container && container
.frames
.filter((f => f.id === frameId))[0];
let containerIndex = containers.indexOf(container);
let frameIndex = container.frames.indexOf(frame);
let frameIndex = container && container.frames.indexOf(frame);
deleteFrame = {
control: "button",

View File

@@ -14,6 +14,7 @@ export default {
},
mounted() {
this.composition = this.openmct.composition.get(this.domainObject);
this.keystring = this.openmct.objects.makeKeyString(this.domainObject.identifier);
if (!this.composition) {
return;
}
@@ -34,7 +35,7 @@ export default {
this.items.push({
model: child,
type: type.definition,
isAlias: this.domainObject.identifier.key !== child.location,
isAlias: this.keystring !== child.location,
objectPath: [child].concat(this.openmct.router.path),
objectKeyString: this.openmct.objects.makeKeyString(child.identifier)
});

View File

@@ -70,12 +70,15 @@ define([
this.listenTo(this.$scope, '$destroy', this.destroy, this);
this.listenTo(config.series, 'add', this.addSeries, this);
this.listenTo(config.series, 'remove', this.resetAllSeries, this);
config.series.forEach(this.addSeries, this);
};
PlotOptionsController.prototype.addSeries = function (series, index) {
this.$scope.plotSeries[index] = series;
series.locateOldObject(this.$scope.domainObject);
this.$timeout(function () {
this.$scope.plotSeries[index] = series;
series.locateOldObject(this.$scope.domainObject);
}.bind(this));
};
PlotOptionsController.prototype.resetAllSeries = function (series, index) {

View File

@@ -7,6 +7,8 @@
</style>
<script>
import _ from 'lodash';
export default {
inject: ['openmct'],
mounted() {
@@ -16,9 +18,20 @@
destroyed() {
this.openmct.selection.off('change', this.updateSelection);
},
data() {
return {
selection: []
}
},
methods: {
updateSelection() {
let selection = this.openmct.selection.get();
if (_.isEqual(this.selection[0], selection[0])) {
return;
}
this.selection = selection;
if (this.selectedViews) {
this.selectedViews.forEach(selectedView => {
selectedView.destroy();

View File

@@ -43,7 +43,8 @@
</div>
<!-- Action buttons -->
<div class="l-browse-bar__actions">
<button class="l-browse-bar__actions__notebook-entry c-button icon-notebook"
<button v-if="notebookEnabled"
class="l-browse-bar__actions__notebook-entry c-button icon-notebook"
title="New Notebook entry"
@click="snapshot()">
</button>
@@ -167,7 +168,8 @@ const PLACEHOLDER_OBJECT = {};
showSaveMenu: false,
domainObject: PLACEHOLDER_OBJECT,
viewKey: undefined,
isEditing: this.openmct.editor.isEditing()
isEditing: this.openmct.editor.isEditing(),
notebookEnabled: false
}
},
computed: {
@@ -213,7 +215,11 @@ const PLACEHOLDER_OBJECT = {};
}
},
mounted: function () {
this.notebookSnapshot = new NotebookSnapshot(this.openmct);
if (this.openmct.types.get('notebook')) {
this.notebookSnapshot = new NotebookSnapshot(this.openmct);
this.notebookEnabled = true;
}
document.addEventListener('click', this.closeViewAndSaveMenu);
window.addEventListener('beforeunload', this.promptUserbeforeNavigatingAway);