+
+
+
This Flexible Layout is currently empty
@@ -50,7 +55,7 @@
:container="container"
:rowsLayout="rowsLayout"
@move-frame="moveFrame"
- @create-frame="createFrame"
+ @new-frame="setFrameLocation"
@persist="persist">
@@ -137,6 +142,23 @@
opacity: 0.5;
}
}
+
+ &__drag-ghost{
+ background: $colorItemTreeHoverBg;
+ color: $colorItemTreeHoverFg;
+ border-radius: $basicCr;
+ display: flex;
+ align-items: center;
+ padding: $interiorMarginLg $interiorMarginLg * 2;
+ position: absolute;
+ top: -10000px;
+ z-index: 2;
+
+ &:before {
+ color: $colorKey;
+ margin-right: $interiorMarginSm;
+ }
+ }
}
.c-fl-container {
@@ -451,7 +473,8 @@ export default {
},
data() {
return {
- domainObject: this.layoutObject
+ domainObject: this.layoutObject,
+ newFrameLocation: []
}
},
computed: {
@@ -497,12 +520,22 @@ export default {
sizeItems(toContainer.frames, frame);
this.persist();
},
- createFrame(containerIndex, insertFrameIndex, objectIdentifier) {
- let frame = new Frame(objectIdentifier);
- let container = this.containers[containerIndex];
- container.frames.splice(insertFrameIndex + 1, 0, frame);
- sizeItems(container.frames, frame);
- this.persist();
+ setFrameLocation(containerIndex, insertFrameIndex) {
+ this.newFrameLocation = [containerIndex, insertFrameIndex];
+ },
+ addFrame(domainObject) {
+ if (this.newFrameLocation.length) {
+ let containerIndex = this.newFrameLocation[0],
+ frameIndex = this.newFrameLocation[1],
+ frame = new Frame(domainObject.identifier),
+ container = this.containers[containerIndex];
+
+ container.frames.splice(frameIndex + 1, 0, frame);
+ sizeItems(container.frames, frame);
+
+ this.newFrameLocation = [];
+ this.persist(containerIndex);
+ }
},
deleteFrame(frameId) {
let container = this.containers
@@ -584,13 +617,33 @@ export default {
} else {
this.containers.splice(toIndex, 0, container);
}
+ this.persist(index);
+ },
+ removeChildObject(identifier) {
+ let removeIdentifier = this.openmct.objects.makeKeyString(identifier);
+
+ this.containers.forEach(container => {
+ container.frames = container.frames.filter(frame => {
+ let frameIdentifier = this.openmct.objects.makeKeyString(frame.domainObjectIdentifier);
+
+ return removeIdentifier !== frameIdentifier;
+ });
+ });
+
this.persist();
}
},
mounted() {
+ this.composition = this.openmct.composition.get(this.domainObject);
+ this.composition.on('remove', this.removeChildObject);
+ this.composition.on('add', this.addFrame);
+
this.unobserve = this.openmct.objects.observe(this.domainObject, '*', this.updateDomainObject);
},
beforeDestroy() {
+ this.composition.off('remove', this.removeChildObject);
+ this.composition.off('add', this.addFrame);
+
this.unobserve();
}
}
diff --git a/src/plugins/flexibleLayout/components/frame.vue b/src/plugins/flexibleLayout/components/frame.vue
index 150635d21b..77286d4c00 100644
--- a/src/plugins/flexibleLayout/components/frame.vue
+++ b/src/plugins/flexibleLayout/components/frame.vue
@@ -73,7 +73,6 @@ export default {
},
methods: {
setDomainObject(object) {
- console.log('setting object!');
this.domainObject = object;
this.objectPath = [object];
this.setSelection();
@@ -89,6 +88,18 @@ export default {
this.unsubscribeSelection = this.openmct.selection.selectable(this.$refs.frame, context, false);
},
initDrag(event) {
+ let type = this.openmct.types.get(this.domainObject.type),
+ iconClass = type.definition ? type.definition.cssClass : 'icon-object-unknown';
+
+ if (this.dragGhost) {
+ let originalClassName = this.dragGhost.classList[0];
+ this.dragGhost.className = '';
+ this.dragGhost.classList.add(originalClassName, iconClass);
+
+ this.dragGhost.innerHTML = `${this.domainObject.name}`;
+ event.dataTransfer.setDragImage(this.dragGhost, 0, 0);
+ }
+
event.dataTransfer.setData('frameid', this.frame.id);
event.dataTransfer.setData('containerIndex', this.containerIndex);
}
@@ -99,6 +110,8 @@ export default {
this.setDomainObject(object);
});
}
+
+ this.dragGhost = document.getElementById('js-fl-drag-ghost');
},
beforeDestroy() {
if (this.unsubscribeSelection) {
diff --git a/src/plugins/flexibleLayout/toolbarProvider.js b/src/plugins/flexibleLayout/toolbarProvider.js
index eacc3ebc6e..28cff65e93 100644
--- a/src/plugins/flexibleLayout/toolbarProvider.js
+++ b/src/plugins/flexibleLayout/toolbarProvider.js
@@ -151,7 +151,7 @@ function ToolbarProvider(openmct) {
let prompt = openmct.overlays.dialog({
iconClass: 'alert',
- message: `This action will permanently delete container ${containerIndex + 1} from this Flexible Layout`,
+ message: 'This action will permanently delete this container from this Flexible Layout',
buttons: [
{
label: 'Ok',
diff --git a/src/plugins/notebook/res/templates/embed.html b/src/plugins/notebook/res/templates/embed.html
index b98fc73bc4..5890c3f91d 100644
--- a/src/plugins/notebook/res/templates/embed.html
+++ b/src/plugins/notebook/res/templates/embed.html
@@ -14,7 +14,7 @@