1.8.2 merge into master - the version of open mct after the last but equally as important (#4611)

* Release 1.8.2

* Trasactions tests are ids equal fix 1.8.2 (#4593)

* test fix

* return promise on 'onSave'

* "Export as JSON" yielding corrupted data #4577 (#4585)

https://github.com/nasa/openmct/issues/4577

* Fix date picker default time setting (#4581)

Fix mode dropdown position
Fix unlistening of upstream events

* Bar graph composition policy fix to allow condition set creation. (#4598)

* Use image timestamp instead of image index to show large view (#4591)

* Use image timestamp instead of image index to show large view

* Fix failing test

Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov>
This commit is contained in:
Shefali Joshi
2021-12-17 12:57:49 -08:00
committed by GitHub
parent 2d64813a4f
commit 70f2fad243
10 changed files with 39 additions and 31 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "openmct", "name": "openmct",
"version": "1.8.1", "version": "1.8.2",
"description": "The Open MCT core platform", "description": "The Open MCT core platform",
"devDependencies": { "devDependencies": {
"@braintree/sanitize-url": "^5.0.2", "@braintree/sanitize-url": "^5.0.2",

View File

@ -145,7 +145,6 @@ class IndependentTimeContext extends TimeContext {
/** /**
* Causes this time context to follow another time context (either the global context, or another upstream time context) * Causes this time context to follow another time context (either the global context, or another upstream time context)
* This allows views to have their own time context which points to the appropriate upstream context as necessary, achieving nesting. * This allows views to have their own time context which points to the appropriate upstream context as necessary, achieving nesting.
* @param {*} upstreamTimeContext
*/ */
followTimeContext() { followTimeContext() {
this.stopFollowingTimeContext(); this.stopFollowingTimeContext();
@ -153,7 +152,9 @@ class IndependentTimeContext extends TimeContext {
TIME_CONTEXT_EVENTS.forEach((eventName) => { TIME_CONTEXT_EVENTS.forEach((eventName) => {
const thisTimeContext = this; const thisTimeContext = this;
this.upstreamTimeContext.on(eventName, passthrough); this.upstreamTimeContext.on(eventName, passthrough);
this.unlisteners.push(() => this.upstreamTimeContext.off(eventName, passthrough)); this.unlisteners.push(() => {
thisTimeContext.upstreamTimeContext.off(eventName, passthrough);
});
function passthrough() { function passthrough() {
thisTimeContext.emit(eventName, ...arguments); thisTimeContext.emit(eventName, ...arguments);
} }
@ -167,6 +168,7 @@ class IndependentTimeContext extends TimeContext {
*/ */
stopFollowingTimeContext() { stopFollowingTimeContext() {
this.unlisteners.forEach(unlisten => unlisten()); this.unlisteners.forEach(unlisten => unlisten());
this.unlisteners = [];
} }
resetContext() { resetContext() {
@ -180,17 +182,19 @@ class IndependentTimeContext extends TimeContext {
* Refresh the time context, following any upstream time contexts as necessary * Refresh the time context, following any upstream time contexts as necessary
*/ */
refreshContext(viewKey) { refreshContext(viewKey) {
//TODO: find a better way to skip upstream context for the view that just got an independent time context
const key = this.openmct.objects.makeKeyString(this.objectPath[0].identifier); const key = this.openmct.objects.makeKeyString(this.objectPath[0].identifier);
if (viewKey && key === viewKey) { if (viewKey && key === viewKey) {
return; return;
} }
//this is necessary as the upstream context gets reassigned after this
this.stopFollowingTimeContext();
this.upstreamTimeContext = this.getUpstreamContext(); this.upstreamTimeContext = this.getUpstreamContext();
this.followTimeContext(); this.followTimeContext();
// Emit bounds so that views that are changing context get the upstream bounds // Emit bounds so that views that are changing context get the upstream bounds
this.emit('bounds', this.upstreamTimeContext.bounds()); this.emit('bounds', this.bounds());
} }
hasOwnContext() { hasOwnContext() {

View File

@ -41,14 +41,10 @@ export default function BarGraphCompositionPolicy(openmct) {
return { return {
allow: function (parent, child) { allow: function (parent, child) {
if (child.type === 'conditionSet') { if (parent.type === BAR_GRAPH_KEY) {
if ((child.type === 'conditionSet') || (!hasBarGraphTelemetry(child))) {
return false; return false;
} }
if ((parent.type === BAR_GRAPH_KEY)
&& (!hasBarGraphTelemetry(child))
) {
return false;
} }
return true; return true;

View File

@ -60,6 +60,7 @@ export default class ExportAsJSONAction {
* @param {object} objectpath * @param {object} objectpath
*/ */
invoke(objectpath) { invoke(objectpath) {
this.tree = {};
const root = objectpath[0]; const root = objectpath[0];
this.root = JSON.parse(JSON.stringify(root)); this.root = JSON.parse(JSON.stringify(root));
const rootId = this._getId(this.root); const rootId = this._getId(this.root);

View File

@ -12,9 +12,9 @@ export default class ImageryView {
show(element, isEditing, viewOptions) { show(element, isEditing, viewOptions) {
let alternateObjectPath; let alternateObjectPath;
let indexForFocusedImage; let focusedImageTimestamp;
if (viewOptions) { if (viewOptions) {
indexForFocusedImage = viewOptions.indexForFocusedImage; focusedImageTimestamp = viewOptions.timestamp;
alternateObjectPath = viewOptions.objectPath; alternateObjectPath = viewOptions.objectPath;
} }
@ -31,10 +31,10 @@ export default class ImageryView {
}, },
data() { data() {
return { return {
indexForFocusedImage focusedImageTimestamp
}; };
}, },
template: '<imagery-view :index-for-focused-image="indexForFocusedImage" ref="ImageryContainer"></imagery-view>' template: '<imagery-view :focused-image-timestamp="focusedImageTimestamp" ref="ImageryContainer"></imagery-view>'
}); });
} }

View File

@ -119,10 +119,10 @@ export default {
this.timeContext.off("bounds", this.updateViewBounds); this.timeContext.off("bounds", this.updateViewBounds);
} }
}, },
expand(index) { expand(imageTimestamp) {
const path = this.objectPath[0]; const path = this.objectPath[0];
this.previewAction.invoke([path], { this.previewAction.invoke([path], {
indexForFocusedImage: index, timestamp: imageTimestamp,
objectPath: this.objectPath objectPath: this.objectPath
}); });
}, },
@ -395,7 +395,7 @@ export default {
//handle mousedown event to show the image in a large view //handle mousedown event to show the image in a large view
imageWrapper.addEventListener('mousedown', (e) => { imageWrapper.addEventListener('mousedown', (e) => {
if (e.button === 0) { if (e.button === 0) {
this.expand(index); this.expand(item.time);
} }
}); });

View File

@ -201,7 +201,7 @@ export default {
mixins: [imageryData], mixins: [imageryData],
inject: ['openmct', 'domainObject', 'objectPath', 'currentView'], inject: ['openmct', 'domainObject', 'objectPath', 'currentView'],
props: { props: {
indexForFocusedImage: { focusedImageTimestamp: {
type: Number, type: Number,
default() { default() {
return undefined; return undefined;
@ -411,8 +411,11 @@ export default {
watch: { watch: {
imageHistorySize(newSize, oldSize) { imageHistorySize(newSize, oldSize) {
let imageIndex; let imageIndex;
if (this.indexForFocusedImage !== undefined) { if (this.focusedImageTimestamp !== undefined) {
imageIndex = this.initFocusedImageIndex; const foundImageIndex = this.imageHistory.findIndex(image => {
return image.time === this.focusedImageTimestamp;
});
imageIndex = foundImageIndex > -1 ? foundImageIndex : newSize - 1;
} else { } else {
imageIndex = newSize > 0 ? newSize - 1 : undefined; imageIndex = newSize > 0 ? newSize - 1 : undefined;
} }
@ -429,8 +432,7 @@ export default {
}, },
async mounted() { async mounted() {
//We only need to use this till the user focuses an image manually //We only need to use this till the user focuses an image manually
if (this.indexForFocusedImage !== undefined) { if (this.focusedImageTimestamp !== undefined) {
this.initFocusedImageIndex = this.indexForFocusedImage;
this.isPaused = true; this.isPaused = true;
} }
@ -701,10 +703,10 @@ export default {
if (thumbnailClick) { if (thumbnailClick) {
//We use the props till the user changes what they want to see //We use the props till the user changes what they want to see
this.initFocusedImageIndex = undefined; this.focusedImageTimestamp = undefined;
} }
if (this.isPaused && !thumbnailClick && this.initFocusedImageIndex === undefined) { if (this.isPaused && !thumbnailClick && this.focusedImageTimestamp === undefined) {
this.nextImageIndex = focusedIndex; this.nextImageIndex = focusedIndex;
//this could happen if bounds changes //this could happen if bounds changes
if (this.focusedImageIndex > this.imageHistory.length - 1) { if (this.focusedImageIndex > this.imageHistory.length - 1) {

View File

@ -528,10 +528,10 @@ describe("The Imagery View Layouts", () => {
const mouseDownEvent = createMouseEvent("mousedown"); const mouseDownEvent = createMouseEvent("mousedown");
let imageWrapper = parent.querySelectorAll(`.c-imagery-tsv__image-wrapper`); let imageWrapper = parent.querySelectorAll(`.c-imagery-tsv__image-wrapper`);
imageWrapper[2].dispatchEvent(mouseDownEvent); imageWrapper[2].dispatchEvent(mouseDownEvent);
Vue.nextTick(() => { Vue.nextTick(() => {
const timestamp = imageWrapper[2].id.replace('wrapper-', '');
expect(componentView.previewAction.invoke).toHaveBeenCalledWith([componentView.objectPath[0]], { expect(componentView.previewAction.invoke).toHaveBeenCalledWith([componentView.objectPath[0]], {
indexForFocusedImage: 2, timestamp: Number(timestamp),
objectPath: componentView.objectPath objectPath: componentView.objectPath
}); });
done(); done();

View File

@ -143,6 +143,11 @@ export default {
time: undefined time: undefined
}; };
}, },
watch: {
defaultDateTime() {
this.updateFromModel(this.defaultDateTime);
}
},
mounted: function () { mounted: function () {
this.updateFromModel(this.defaultDateTime); this.updateFromModel(this.defaultDateTime);
this.updateViewForMonth(); this.updateViewForMonth();

View File

@ -109,11 +109,11 @@ export default {
showModesMenu() { showModesMenu() {
const elementBoundingClientRect = this.$refs.modeMenuButton.getBoundingClientRect(); const elementBoundingClientRect = this.$refs.modeMenuButton.getBoundingClientRect();
const x = elementBoundingClientRect.x; const x = elementBoundingClientRect.x;
const y = elementBoundingClientRect.y; const y = elementBoundingClientRect.y + elementBoundingClientRect.height;
const menuOptions = { const menuOptions = {
menuClass: 'c-conductor__mode-menu', menuClass: 'c-conductor__mode-menu',
placement: this.openmct.menus.menuPlacement.TOP_RIGHT placement: this.openmct.menus.menuPlacement.BOTTOM_RIGHT
}; };
this.openmct.menus.showSuperMenu(x, y, this.modes, menuOptions); this.openmct.menus.showSuperMenu(x, y, this.modes, menuOptions);
}, },