add todo for search and removed mutation listener

This commit is contained in:
Scott Bell 2023-06-13 12:02:46 +02:00
parent a5e3317f8e
commit 16dd43d1c8
2 changed files with 12 additions and 23 deletions

View File

@ -101,7 +101,7 @@ export default {
},
onAnnotationChange(annotations) {
this.selectedAnnotations = annotations;
this.buildAnnotationIndex();
this.$emit('annotationsChanged', annotations);
},
updateSelection(selection) {
const selectionContext = selection?.[0]?.[0]?.context?.item;

View File

@ -93,6 +93,7 @@
:image="focusedImage"
:imagery-annotations="imageryAnnotations[focusedImage.time]"
@annotationMarqueed="handlePauseButton(true)"
@annotationsChanged="loadAnnotations"
/>
</div>
</div>
@ -714,11 +715,6 @@ export default {
this.listenTo(this.focusedImageWrapper, 'wheel', this.wheelZoom, this);
this.loadVisibleLayers();
this.loadAnnotations();
this.unobserveAnnotationLastCreated = this.openmct.objects.observe(
this.domainObject,
'annotationLastCreated',
this.checkForNewAnnotations
);
this.openmct.selection.on('change', this.updateSelection);
},
@ -756,10 +752,6 @@ export default {
});
});
if (this.unobserveAnnotationLastCreated) {
this.unobserveAnnotationLastCreated();
}
this.openmct.selection.off('change', this.updateSelection);
},
methods: {
@ -799,7 +791,8 @@ export default {
const incomingSelectedAnnotation = selection?.[0]?.[0]?.context?.annotations?.[0];
console.debug(`📲 incoming search selections`, incomingSelectedAnnotation);
// TODO: for incoming search results, we should:
// TODO in https://github.com/nasa/openmct/issues/6731
// For incoming search results, we should:
// 1. set the the time bounds to match the search result
// 2. search the imageHistory for the image that matches the time of the search result
// 3. using the index from the above, "click" on the image to select it
@ -894,17 +887,18 @@ export default {
});
}
},
async loadAnnotations() {
async loadAnnotations(existingAnnotations) {
if (!this.openmct.annotation.getAvailableTags().length) {
// don't bother loading annotations if there are no tags
return;
}
this.lastLocalAnnotationCreation = this.domainObject.annotationLastCreated ?? 0;
const foundAnnotations = await this.openmct.annotation.getAnnotations(
this.domainObject.identifier
);
let foundAnnotations = existingAnnotations;
if (!foundAnnotations) {
// attempt to load
foundAnnotations = await this.openmct.annotation.getAnnotations(
this.domainObject.identifier
);
}
foundAnnotations.forEach((foundAnnotation) => {
const targetId = Object.keys(foundAnnotation.targets)[0];
const timeForAnnotation = foundAnnotation.targets[targetId].time;
@ -927,11 +921,6 @@ export default {
}
});
},
checkForNewAnnotations() {
if (this.lastLocalAnnotationCreation < this.domainObject.annotationLastCreated) {
this.loadAnnotations();
}
},
persistVisibleLayers() {
if (
this.domainObject.configuration &&