release 1.8.3 - master (#4752)

* Fix object creation (#4675)

* Save the object before adding it to the parent so that transaction committing works properly
* Fix object creation - composition policy changes

* use relative path (#4683)

* Notebook Snapshotting to the default Notebook isn't working (#4475)

* Notebook Snapshotting to the default Notebook isn't working #4469

* Check for ref when trying to get the style receiver. (#4687)

Also ensure that the property being displayed in Properties is actually a part of the domainObject.

* Mct 4555 rebased v3 (#4689)

* Preserve the previousFocusedImage for subscription updates, bound change for local and fixed time

* Only preserve previous focused image if paused

* Forcibly reset imageContainer size to prevent aspect ratio distortion

* Remove unneccesary mixin invocation

* Use image history instead of imagehistory size for watcher. Revert other changes

* Added check if last image index is selected

* isPaused instead of paused

Co-authored-by: Michael Rogers <contact@mhrogers.com>

* Snapshot notice link not navigating as expected #4194 (#4686)

* Fix Link Action to accept the right input for validation (#4696)

* Remove snapshot from release version (#4721)

Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov>
Co-authored-by: Michael Rogers <contact@mhrogers.com>
This commit is contained in:
Shefali Joshi
2022-01-20 11:09:46 -08:00
committed by GitHub
parent cf47f7c1b2
commit dcaad40064
14 changed files with 99 additions and 81 deletions

View File

@ -39,8 +39,10 @@ export default class ConditionSetViewProvider {
return isConditionSet && this.openmct.router.isNavigatedObject(objectPath); return isConditionSet && this.openmct.router.isNavigatedObject(objectPath);
} }
canEdit(domainObject) { canEdit(domainObject, objectPath) {
return domainObject.type === 'conditionSet'; const isConditionSet = domainObject.type === 'conditionSet';
return isConditionSet && this.openmct.router.isNavigatedObject(objectPath);
} }
view(domainObject, objectPath) { view(domainObject, objectPath) {

View File

@ -99,6 +99,7 @@ export default class CreateAction extends PropertiesAction {
*/ */
async _navigateAndEdit(domainObject, parentDomainObjectpath) { async _navigateAndEdit(domainObject, parentDomainObjectpath) {
let objectPath; let objectPath;
let self = this;
if (parentDomainObjectpath) { if (parentDomainObjectpath) {
objectPath = parentDomainObjectpath && [domainObject].concat(parentDomainObjectpath); objectPath = parentDomainObjectpath && [domainObject].concat(parentDomainObjectpath);
} else { } else {
@ -110,13 +111,18 @@ export default class CreateAction extends PropertiesAction {
.reverse() .reverse()
.join('/'); .join('/');
this.openmct.router.navigate(url); function editObject() {
const objectView = self.openmct.objectViews.get(domainObject, objectPath)[0];
const canEdit = objectView && objectView.canEdit && objectView.canEdit(domainObject, objectPath);
const objectView = this.openmct.objectViews.get(domainObject, objectPath)[0]; if (canEdit) {
const canEdit = objectView && objectView.canEdit && objectView.canEdit(domainObject, objectPath); self.openmct.editor.edit();
if (canEdit) { }
this.openmct.editor.edit();
} }
this.openmct.router.once('afterNavigation', editObject);
this.openmct.router.navigate(url);
} }
/** /**

View File

@ -65,13 +65,8 @@ export default {
keyString: undefined keyString: undefined
}; };
}, },
computed: {
imageHistorySize() {
return this.imageHistory.length;
}
},
watch: { watch: {
imageHistorySize(newSize, oldSize) { imageHistory(newHistory, oldHistory) {
this.updatePlotImagery(); this.updatePlotImagery();
} }
}, },

View File

@ -240,9 +240,6 @@ export default {
}; };
}, },
computed: { computed: {
imageHistorySize() {
return this.imageHistory.length;
},
compassRoseSizingClasses() { compassRoseSizingClasses() {
let compassRoseSizingClasses = ''; let compassRoseSizingClasses = '';
if (this.sizedImageDimensions.width < 300) { if (this.sizedImageDimensions.width < 300) {
@ -409,19 +406,23 @@ export default {
} }
}, },
watch: { watch: {
imageHistorySize(newSize, oldSize) { imageHistory: {
let imageIndex; handler(newHistory, oldHistory) {
if (this.focusedImageTimestamp !== undefined) { const newSize = newHistory.length;
const foundImageIndex = this.imageHistory.findIndex(image => { let imageIndex;
return image.time === this.focusedImageTimestamp; if (this.focusedImageTimestamp !== undefined) {
}); const foundImageIndex = this.imageHistory.findIndex(image => {
imageIndex = foundImageIndex > -1 ? foundImageIndex : newSize - 1; return image.time === this.focusedImageTimestamp;
} else { });
imageIndex = newSize > 0 ? newSize - 1 : undefined; imageIndex = foundImageIndex > -1 ? foundImageIndex : newSize - 1;
} } else {
imageIndex = newSize > 0 ? newSize - 1 : undefined;
}
this.setFocusedImage(imageIndex, false); this.setFocusedImage(imageIndex, false);
this.scrollToRight(); this.scrollToRight();
},
deep: true
}, },
focusedImageIndex() { focusedImageIndex() {
this.trackDuration(); this.trackDuration();
@ -510,12 +511,6 @@ export default {
this.timeContext.off("clock", this.trackDuration); this.timeContext.off("clock", this.trackDuration);
} }
}, },
boundsChange(bounds, isTick) {
if (!isTick) {
this.previousFocusedImage = this.focusedImage ? JSON.parse(JSON.stringify(this.focusedImage)) : undefined;
this.requestHistory();
}
},
expand() { expand() {
const actionCollection = this.openmct.actions.getActionsCollection(this.objectPath, this.currentView); const actionCollection = this.openmct.actions.getActionsCollection(this.objectPath, this.currentView);
const visibleActions = actionCollection.getVisibleActions(); const visibleActions = actionCollection.getVisibleActions();
@ -690,22 +685,32 @@ export default {
return; return;
} }
if (this.previousFocusedImage) {
// determine if the previous image exists in the new bounds of imageHistory
const matchIndex = this.matchIndexOfPreviousImage(
this.previousFocusedImage,
this.imageHistory
);
focusedIndex = matchIndex > -1 ? matchIndex : this.imageHistory.length - 1;
delete this.previousFocusedImage;
}
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.focusedImageTimestamp = undefined; this.focusedImageTimestamp = undefined;
//set the previousFocusedImage when a user chooses an image
this.previousFocusedImage = this.imageHistory[focusedIndex] ? JSON.parse(JSON.stringify(this.imageHistory[focusedIndex])) : undefined;
} }
if (this.previousFocusedImage) {
// determine if the previous image exists in the new bounds of imageHistory
if (!thumbnailClick) {
const matchIndex = this.matchIndexOfPreviousImage(
this.previousFocusedImage,
this.imageHistory
);
focusedIndex = matchIndex > -1 ? matchIndex : this.imageHistory.length - 1;
}
if (!(this.isPaused || thumbnailClick)
|| focusedIndex === this.imageHistory.length - 1) {
delete this.previousFocusedImage;
}
}
this.focusedImageIndex = focusedIndex;
//TODO: do we even need this anymore?
if (this.isPaused && !thumbnailClick && this.focusedImageTimestamp === 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
@ -716,8 +721,6 @@ export default {
return; return;
} }
this.focusedImageIndex = focusedIndex;
if (thumbnailClick && !this.isPaused) { if (thumbnailClick && !this.isPaused) {
this.paused(true); this.paused(true);
} }

View File

@ -120,9 +120,15 @@ export default {
return this.timeFormatter.parse(datum); return this.timeFormatter.parse(datum);
}, },
boundsChange(bounds, isTick) { boundsChange(bounds, isTick) {
if (!isTick) { if (isTick) {
this.requestHistory(); return;
} }
// forcibly reset the imageContainer size to prevent an aspect ratio distortion
delete this.imageContainerWidth;
delete this.imageContainerHeight;
return this.requestHistory();
}, },
async requestHistory() { async requestHistory() {
let bounds = this.timeContext.bounds(); let bounds = this.timeContext.bounds();

View File

@ -91,11 +91,11 @@ export default class LinkAction {
} }
validate(currentParent) { validate(currentParent) {
return (object, data) => { return (data) => {
const parentCandidate = data.value; const parentCandidate = data.value[0];
const currentParentKeystring = this.openmct.objects.makeKeyString(currentParent.identifier); const currentParentKeystring = this.openmct.objects.makeKeyString(currentParent.identifier);
const parentCandidateKeystring = this.openmct.objects.makeKeyString(parentCandidate.identifier); const parentCandidateKeystring = this.openmct.objects.makeKeyString(parentCandidate.identifier);
const objectKeystring = this.openmct.objects.makeKeyString(object.identifier); const objectKeystring = this.openmct.objects.makeKeyString(this.object.identifier);
if (!parentCandidateKeystring || !currentParentKeystring) { if (!parentCandidateKeystring || !currentParentKeystring) {
return false; return false;
@ -114,7 +114,7 @@ export default class LinkAction {
return false; return false;
} }
return parentCandidate && this.openmct.composition.checkPolicy(parentCandidate, object); return parentCandidate && this.openmct.composition.checkPolicy(parentCandidate, this.object);
}; };
} }
} }

View File

@ -142,7 +142,6 @@ import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaul
import { addNotebookEntry, createNewEmbed, getEntryPosById, getNotebookEntries, mutateObject } from '../utils/notebook-entries'; import { addNotebookEntry, createNewEmbed, getEntryPosById, getNotebookEntries, mutateObject } from '../utils/notebook-entries';
import { saveNotebookImageDomainObject, updateNamespaceOfDomainObject } from '../utils/notebook-image'; import { saveNotebookImageDomainObject, updateNamespaceOfDomainObject } from '../utils/notebook-image';
import { NOTEBOOK_VIEW_TYPE } from '../notebook-constants'; import { NOTEBOOK_VIEW_TYPE } from '../notebook-constants';
import objectUtils from 'objectUtils';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import objectLink from '../../../ui/mixins/object-link'; import objectLink from '../../../ui/mixins/object-link';
@ -461,11 +460,6 @@ export default {
? getDefaultNotebook().defaultSectionId ? getDefaultNotebook().defaultSectionId
: undefined; : undefined;
}, },
getDefaultNotebookObject() {
const defaultNotebook = getDefaultNotebook();
return defaultNotebook && this.openmct.objects.get(defaultNotebook.identifier);
},
getLinktoNotebook() { getLinktoNotebook() {
const objectPath = this.openmct.router.path; const objectPath = this.openmct.router.path;
const link = objectLink.computed.objectLink.call({ const link = objectLink.computed.objectLink.call({
@ -625,12 +619,12 @@ export default {
this.sectionsChanged({ sections }); this.sectionsChanged({ sections });
}, },
removeDefaultClass(domainObject) { removeDefaultClass(defaultNotebookIdentifier) {
if (!domainObject) { if (!defaultNotebookIdentifier) {
return; return;
} }
this.openmct.status.delete(domainObject.identifier); this.openmct.status.delete(defaultNotebookIdentifier);
}, },
resetSearch() { resetSearch() {
this.search = ''; this.search = '';
@ -639,15 +633,16 @@ export default {
toggleNav() { toggleNav() {
this.showNav = !this.showNav; this.showNav = !this.showNav;
}, },
async updateDefaultNotebook(notebookStorage) { updateDefaultNotebook(notebookStorage) {
const defaultNotebookObject = await this.getDefaultNotebookObject(); const defaultNotebook = getDefaultNotebook();
const isSameNotebook = defaultNotebookObject const defaultNotebookIdentifier = defaultNotebook && defaultNotebook.identifier;
&& objectUtils.makeKeyString(defaultNotebookObject.identifier) === objectUtils.makeKeyString(notebookStorage.identifier); const isSameNotebook = defaultNotebookIdentifier
&& this.openmct.objects.areIdsEqual(defaultNotebookIdentifier, notebookStorage.identifier);
if (!isSameNotebook) { if (!isSameNotebook) {
this.removeDefaultClass(defaultNotebookObject); this.removeDefaultClass(defaultNotebookIdentifier);
} }
if (!defaultNotebookObject || !isSameNotebook) { if (!defaultNotebookIdentifier || !isSameNotebook) {
setDefaultNotebook(this.openmct, notebookStorage, this.domainObject); setDefaultNotebook(this.openmct, notebookStorage, this.domainObject);
} }

View File

@ -110,7 +110,8 @@ export default class Snapshot {
} }
return () => { return () => {
window.location.href = window.location.origin + url; const path = window.location.href.split('#');
window.location.href = path[0] + url;
}; };
} }
} }

View File

@ -105,11 +105,6 @@ export function addNotebookEntry(openmct, domainObject, notebookStorage, embed =
const date = Date.now(); const date = Date.now();
const configuration = domainObject.configuration; const configuration = domainObject.configuration;
const entries = configuration.entries || {}; const entries = configuration.entries || {};
if (!entries) {
return;
}
const embeds = embed const embeds = embed
? [embed] ? [embed]
: []; : [];
@ -125,7 +120,8 @@ export function addNotebookEntry(openmct, domainObject, notebookStorage, embed =
const newEntries = addEntryIntoPage(notebookStorage, entries, entry); const newEntries = addEntryIntoPage(notebookStorage, entries, entry);
addDefaultClass(domainObject, openmct); addDefaultClass(domainObject, openmct);
domainObject.configuration.entries = newEntries;
mutateObject(openmct, domainObject, 'configuration.entries', newEntries);
return id; return id;
} }

View File

@ -29,7 +29,9 @@ define(
} }
SummaryWidgetsCompositionPolicy.prototype.allow = function (parent, child) { SummaryWidgetsCompositionPolicy.prototype.allow = function (parent, child) {
if (parent.type === 'summary-widget' && !this.openmct.telemetry.isTelemetryObject(child)) { const parentType = parent.type;
if (parentType === 'summary-widget' && !this.openmct.telemetry.isTelemetryObject(child)) {
return false; return false;
} }

View File

@ -152,11 +152,15 @@ export default {
this.openmct.objectViews.off('clearData', this.clearData); this.openmct.objectViews.off('clearData', this.clearData);
}, },
getStyleReceiver() { getStyleReceiver() {
let styleReceiver = this.$refs.objectViewWrapper.querySelector('.js-style-receiver') let styleReceiver;
|| this.$refs.objectViewWrapper.querySelector(':first-child');
if (styleReceiver === null) { if (this.$refs.objectViewWrapper !== undefined) {
styleReceiver = undefined; styleReceiver = this.$refs.objectViewWrapper.querySelector('.js-style-receiver')
|| this.$refs.objectViewWrapper.querySelector(':first-child');
if (styleReceiver === null) {
styleReceiver = undefined;
}
} }
return styleReceiver; return styleReceiver;

View File

@ -186,6 +186,10 @@ export default {
return { return {
name: field.name, name: field.name,
value: field.path.reduce((object, key) => { value: field.path.reduce((object, key) => {
if (object === undefined) {
return object;
}
return object[key]; return object[key];
}, this.domainObject) }, this.domainObject)
}; };

View File

@ -445,6 +445,10 @@ export default {
} }
// sorting composition items // sorting composition items
if (!a.name || !b.name) {
return 0;
}
if (a.name.toLowerCase() if (a.name.toLowerCase()
> b.name.toLowerCase()) { > b.name.toLowerCase()) {
return 1; return 1;

View File

@ -1,4 +1,4 @@
import objectPathToUrl from '/src/tools/url'; import objectPathToUrl from '../../tools/url';
export default { export default {
inject: ['openmct'], inject: ['openmct'],