Compare commits

...

1 Commits

Author SHA1 Message Date
2092956e50 WIP implementation of multiple-composition 2020-05-03 13:38:07 -07:00
10 changed files with 62 additions and 29 deletions

View File

@ -53,7 +53,7 @@
"marked": "^0.3.5", "marked": "^0.3.5",
"mini-css-extract-plugin": "^0.4.1", "mini-css-extract-plugin": "^0.4.1",
"minimist": "^1.1.1", "minimist": "^1.1.1",
"moment": "^2.11.1", "moment": "2.24.0",
"moment-duration-format": "^2.2.2", "moment-duration-format": "^2.2.2",
"moment-timezone": "^0.5.21", "moment-timezone": "^0.5.21",
"node-bourbon": "^4.2.3", "node-bourbon": "^4.2.3",

View File

@ -6,7 +6,7 @@
:key="action.name" :key="action.name"
:class="action.cssClass" :class="action.cssClass"
:title="action.description" :title="action.description"
@click="action.invoke(objectPath)" @click="action.invoke(objectPath, context)"
> >
{{ action.name }} {{ action.name }}
</li> </li>
@ -19,6 +19,6 @@
<script> <script>
export default { export default {
inject: ['actions', 'objectPath'] inject: ['actions', 'objectPath', 'context']
} }
</script> </script>

View File

@ -75,7 +75,7 @@ class ContextMenuAPI {
/** /**
* @private * @private
*/ */
_showContextMenuForObjectPath(objectPath, x, y, actionsToBeIncluded) { _showContextMenuForObjectPath(objectPath, x, y, actionsToBeIncluded, context) {
let applicableActions = this._allActions.filter((action) => { let applicableActions = this._allActions.filter((action) => {
@ -96,7 +96,7 @@ class ContextMenuAPI {
this._hideActiveContextMenu(); this._hideActiveContextMenu();
} }
this._activeContextMenu = this._createContextMenuForObject(objectPath, applicableActions); this._activeContextMenu = this._createContextMenuForObject(objectPath, applicableActions, context);
this._activeContextMenu.$mount(); this._activeContextMenu.$mount();
document.body.appendChild(this._activeContextMenu.$el); document.body.appendChild(this._activeContextMenu.$el);
@ -141,14 +141,15 @@ class ContextMenuAPI {
/** /**
* @private * @private
*/ */
_createContextMenuForObject(objectPath, actions) { _createContextMenuForObject(objectPath, actions, context) {
return new Vue({ return new Vue({
components: { components: {
ContextMenu: ContextMenuComponent ContextMenu: ContextMenuComponent
}, },
provide: { provide: {
actions: actions, actions: actions,
objectPath: objectPath objectPath: objectPath,
context
}, },
template: '<ContextMenu></ContextMenu>' template: '<ContextMenu></ContextMenu>'
}); });

View File

@ -29,11 +29,11 @@ export default class RemoveAction {
this.openmct = openmct; this.openmct = openmct;
} }
invoke(objectPath) { invoke(objectPath, context) {
let object = objectPath[0]; let object = objectPath[0];
let parent = objectPath[1]; let parent = objectPath[1];
this.showConfirmDialog(object).then(() => { this.showConfirmDialog(object).then(() => {
this.removeFromComposition(parent, object); this.removeFromComposition(parent, object, context.sequenceNumber);
if (this.inNavigationPath(object)) { if (this.inNavigationPath(object)) {
this.navigateTo(objectPath.slice(1)); this.navigateTo(objectPath.slice(1));
} }
@ -79,23 +79,21 @@ export default class RemoveAction {
window.location.href = '#/browse/' + urlPath; window.location.href = '#/browse/' + urlPath;
} }
removeFromComposition(parent, child) { removeFromComposition(parent, child, sequenceNumber) {
let composition = parent.composition.filter(id => this.openmct.composition.get(parent).then(compositionCollection => {
!this.openmct.objects.areIdsEqual(id, child.identifier) compositionCollection.remove(child, sequenceNumber);
); })
this.openmct.objects.mutate(parent, 'composition', composition);
if (this.inNavigationPath(child) && this.openmct.editor.isEditing()) { if (this.inNavigationPath(child) && this.openmct.editor.isEditing()) {
this.openmct.editor.save(); this.openmct.editor.save();
} }
const parentKeyString = this.openmct.objects.makeKeyString(parent.identifier); // Find another way of doing this with notebooks
const isAlias = parentKeyString !== child.location; // const parentKeyString = this.openmct.objects.makeKeyString(parent.identifier);
// const isAlias = parentKeyString !== child.location;
if (!isAlias) { // if (!isAlias) {
this.openmct.objects.mutate(child, 'location', null); // this.openmct.objects.mutate(child, 'location', null);
} // }
} }
appliesTo(objectPath) { appliesTo(objectPath) {

View File

@ -36,6 +36,10 @@ export default {
navigateToPath: { navigateToPath: {
type: String, type: String,
default: undefined default: undefined
},
sequenceNumber: {
type: Number,
default: undefined
} }
}, },
data() { data() {

View File

@ -110,7 +110,8 @@ export default {
domainObject: PLACEHOLDER_OBJECT, domainObject: PLACEHOLDER_OBJECT,
viewKey: undefined, viewKey: undefined,
isEditing: this.openmct.editor.isEditing(), isEditing: this.openmct.editor.isEditing(),
notebookEnabled: this.openmct.types.get('notebook') notebookEnabled: this.openmct.types.get('notebook'),
sequenceNumber: undefined
} }
}, },
computed: { computed: {
@ -267,7 +268,14 @@ export default {
}); });
}, },
showContextMenu(event) { showContextMenu(event) {
this.openmct.contextMenu._showContextMenuForObjectPath(this.openmct.router.path, event.clientX, event.clientY); this.openmct.contextMenu._showContextMenuForObjectPath(
this.openmct.router.path,
event.clientX,
event.clientY,
undefined,
{
sequenceNumber: this.sequenceNumber
});
}, },
goToParent() { goToParent() {
window.location.hash = this.parentUrl; window.location.hash = this.parentUrl;

View File

@ -34,6 +34,7 @@
v-for="treeItem in allTreeItems" v-for="treeItem in allTreeItems"
:key="treeItem.id" :key="treeItem.id"
:node="treeItem" :node="treeItem"
:sequence-number="0"
/> />
</ul> </ul>
<!-- end main tree --> <!-- end main tree -->
@ -47,6 +48,7 @@
v-for="treeItem in filteredTreeItems" v-for="treeItem in filteredTreeItems"
:key="treeItem.id" :key="treeItem.id"
:node="treeItem" :node="treeItem"
:sequence-number="0"
/> />
</ul> </ul>
<!-- end search tree --> <!-- end search tree -->

View File

@ -13,6 +13,7 @@
:domain-object="node.object" :domain-object="node.object"
:object-path="node.objectPath" :object-path="node.objectPath"
:navigate-to-path="navigateToPath" :navigate-to-path="navigateToPath"
:sequence-number="sequenceNumber"
/> />
</div> </div>
<ul <ul
@ -28,9 +29,10 @@
</div> </div>
</li> </li>
<tree-item <tree-item
v-for="child in children" v-for="(child, index) in children"
:key="child.id" :key="child.id"
:node="child" :node="child"
:sequence-number="index"
/> />
</ul> </ul>
</li> </li>
@ -53,6 +55,10 @@ export default {
node: { node: {
type: Object, type: Object,
required: true required: true
},
sequenceNumber: {
type: Number,
required: true
} }
}, },
data() { data() {

View File

@ -13,13 +13,20 @@ export default {
if (!this.objectPath.length) { if (!this.objectPath.length) {
return; return;
} }
let url;
if (this.navigateToPath) { if (this.navigateToPath) {
return '#' + this.navigateToPath; url = '#' + this.navigateToPath;
} else {
url = '#/browse/' + this.objectPath
.map(o => o && this.openmct.objects.makeKeyString(o.identifier))
.reverse()
.join('/');
} }
return '#/browse/' + this.objectPath if (this.sequenceNumber) {
.map(o => o && this.openmct.objects.makeKeyString(o.identifier)) url += `?sequenceNumber=${this.sequenceNumber}`;
.reverse() }
.join('/'); return url;
} }
} }
}; };

View File

@ -27,6 +27,13 @@ define([
return; return;
} }
if (newParams.sequenceNumber) {
openmct.layout.$refs.browseBar.sequenceNumber = parseInt(newParams.sequenceNumber);
} else {
openmct.layout.$refs.browseBar.sequenceNumber = undefined;
}
if (changed.view && browseObject) { if (changed.view && browseObject) {
let provider = openmct let provider = openmct
.objectViews .objectViews