mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 13:18:15 +00:00
* Notebook conflict auto retry 1.7.7 (#4230) * Use timeFormatter.parse to get the timestamp of imagery since the source could be something other than key (#4238) * If there is a pending create request for an id, queue a duplicate request. (#4243) * [Telemetry Tables] Handling Request Loading (#4245) * Fix file selection on pressing enter key (#4246) * starting loading as false, since that makes sense (#4247) * Hide independent time conductor mode if only 1 mode option is available. (#4250) * Fix bargraph color selection (#4253) * snapshot clicked while in edit mode should open in preview mode #4115 (#4257) * Fix missing object handling in several vues (#4259) * Flexible Layouts display Condition Sets as their editing/browsing interface (#4179) * Flexible Layouts display Condition Sets as their editing/browsing interface #4141 * [Telemetry Table] Progress bar tests (#4249) * Remove alert styling and hide pause button if in Fixed Time mode. (#4263) * [Table/Collection Fixes] Clearing correctly, no mutating options, no duplicate requests (#4261) * Condition sets only persist if actively editing (#4262) * Imagery views should follow time context (#4264) * Equal stacked plot y widths for all it's sub-plots (#4267) * Fix Bar Graph related CSS (#4270) * Bar graph review comment fixes (#4232) * Mct4196 - Fixes Conditional Styling not being applied when editing a Condition Widget (#4255) * Fix plot zoom when child of time strip (#4272) * Resume plot if no pan, zoom, or drag action is taken (#4138) (#4256) * [Telemetry Collection] No duplicate requests on load (#4274) * doing the easy thing first (#4278) * Bargraph time metadata should consider 'source' (#4289) * Show clicked image in large view (#4280) * added icon for inspector (#4275) * Bar graph style nullcheck (#4291) * Stacked plots need to align the Y axis (#4286) * Duplicate Request Fixes (#4295) * Add braintree sanitize url lib and sanitize form urls (#4296) * Mct4177 fix for telemetry endpoints with '.' in the key (#4308) * Remove additional request to load plots when mounted. (#4314) * Fix plots dup requests (#4324) * Merging 1.7.8 into master. Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov> Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov> Co-authored-by: Khalid Adil <khalidadil29@gmail.com> Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com> Co-authored-by: Michael Rogers <michael@mhrogers.com>
204 lines
5.2 KiB
JavaScript
204 lines
5.2 KiB
JavaScript
import objectLink from '../../../ui/mixins/object-link';
|
|
|
|
export const DEFAULT_CLASS = 'notebook-default';
|
|
const TIME_BOUNDS = {
|
|
START_BOUND: 'tc.startBound',
|
|
END_BOUND: 'tc.endBound',
|
|
START_DELTA: 'tc.startDelta',
|
|
END_DELTA: 'tc.endDelta'
|
|
};
|
|
|
|
export function addEntryIntoPage(notebookStorage, entries, entry) {
|
|
const defaultSectionId = notebookStorage.defaultSectionId;
|
|
const defaultPageId = notebookStorage.defaultPageId;
|
|
if (!defaultSectionId || !defaultPageId) {
|
|
return;
|
|
}
|
|
|
|
const newEntries = JSON.parse(JSON.stringify(entries));
|
|
let section = newEntries[defaultSectionId];
|
|
if (!section) {
|
|
newEntries[defaultSectionId] = {};
|
|
}
|
|
|
|
let page = newEntries[defaultSectionId][defaultPageId];
|
|
if (!page) {
|
|
newEntries[defaultSectionId][defaultPageId] = [];
|
|
}
|
|
|
|
newEntries[defaultSectionId][defaultPageId].push(entry);
|
|
|
|
return newEntries;
|
|
}
|
|
|
|
export function getHistoricLinkInFixedMode(openmct, bounds, historicLink) {
|
|
if (historicLink.includes('tc.mode=fixed')) {
|
|
return historicLink;
|
|
}
|
|
|
|
openmct.time.getAllClocks().forEach(clock => {
|
|
if (historicLink.includes(`tc.mode=${clock.key}`)) {
|
|
historicLink.replace(`tc.mode=${clock.key}`, 'tc.mode=fixed');
|
|
|
|
return;
|
|
}
|
|
});
|
|
|
|
const params = historicLink.split('&').map(param => {
|
|
if (param.includes(TIME_BOUNDS.START_BOUND)
|
|
|| param.includes(TIME_BOUNDS.START_DELTA)) {
|
|
param = `${TIME_BOUNDS.START_BOUND}=${bounds.start}`;
|
|
}
|
|
|
|
if (param.includes(TIME_BOUNDS.END_BOUND)
|
|
|| param.includes(TIME_BOUNDS.END_DELTA)) {
|
|
param = `${TIME_BOUNDS.END_BOUND}=${bounds.end}`;
|
|
}
|
|
|
|
return param;
|
|
});
|
|
|
|
return params.join('&');
|
|
}
|
|
|
|
export function createNewEmbed(snapshotMeta, snapshot = '') {
|
|
const {
|
|
bounds,
|
|
link,
|
|
objectPath,
|
|
openmct
|
|
} = snapshotMeta;
|
|
const domainObject = objectPath[0];
|
|
const domainObjectType = openmct.types.get(domainObject.type);
|
|
|
|
const cssClass = domainObjectType && domainObjectType.definition
|
|
? domainObjectType.definition.cssClass
|
|
: 'icon-object-unknown';
|
|
const date = Date.now();
|
|
const historicLink = link
|
|
? getHistoricLinkInFixedMode(openmct, bounds, link)
|
|
: objectLink.computed.objectLink.call({
|
|
objectPath,
|
|
openmct
|
|
});
|
|
const name = domainObject.name;
|
|
const type = domainObject.identifier.key;
|
|
|
|
return {
|
|
bounds,
|
|
createdOn: date,
|
|
cssClass,
|
|
domainObject,
|
|
historicLink,
|
|
id: 'embed-' + date,
|
|
name,
|
|
snapshot,
|
|
type
|
|
};
|
|
}
|
|
|
|
export function addNotebookEntry(openmct, domainObject, notebookStorage, embed = null, entryText = '') {
|
|
if (!openmct || !domainObject || !notebookStorage) {
|
|
return;
|
|
}
|
|
|
|
const date = Date.now();
|
|
const configuration = domainObject.configuration;
|
|
const entries = configuration.entries || {};
|
|
|
|
if (!entries) {
|
|
return;
|
|
}
|
|
|
|
const embeds = embed
|
|
? [embed]
|
|
: [];
|
|
|
|
const id = `entry-${date}`;
|
|
const entry = {
|
|
id,
|
|
createdOn: date,
|
|
text: entryText,
|
|
embeds
|
|
};
|
|
|
|
const newEntries = addEntryIntoPage(notebookStorage, entries, entry);
|
|
|
|
addDefaultClass(domainObject, openmct);
|
|
domainObject.configuration.entries = newEntries;
|
|
|
|
return id;
|
|
}
|
|
|
|
export function getNotebookEntries(domainObject, selectedSection, selectedPage) {
|
|
if (!domainObject || !selectedSection || !selectedPage) {
|
|
return;
|
|
}
|
|
|
|
const configuration = domainObject.configuration;
|
|
const entries = configuration.entries || {};
|
|
|
|
let section = entries[selectedSection.id];
|
|
if (!section) {
|
|
return;
|
|
}
|
|
|
|
let page = entries[selectedSection.id][selectedPage.id];
|
|
if (!page) {
|
|
return;
|
|
}
|
|
|
|
return entries[selectedSection.id][selectedPage.id];
|
|
}
|
|
|
|
export function getEntryPosById(entryId, domainObject, selectedSection, selectedPage) {
|
|
if (!domainObject || !selectedSection || !selectedPage) {
|
|
return;
|
|
}
|
|
|
|
const entries = getNotebookEntries(domainObject, selectedSection, selectedPage);
|
|
let foundId = -1;
|
|
entries.forEach((element, index) => {
|
|
if (element.id === entryId) {
|
|
foundId = index;
|
|
|
|
return;
|
|
}
|
|
});
|
|
|
|
return foundId;
|
|
}
|
|
|
|
export function deleteNotebookEntries(openmct, domainObject, selectedSection, selectedPage) {
|
|
if (!domainObject || !selectedSection) {
|
|
return;
|
|
}
|
|
|
|
const configuration = domainObject.configuration;
|
|
const entries = configuration.entries || {};
|
|
|
|
// Delete entire section
|
|
if (!selectedPage) {
|
|
delete entries[selectedSection.id];
|
|
|
|
return;
|
|
}
|
|
|
|
let section = entries[selectedSection.id];
|
|
if (!section) {
|
|
return;
|
|
}
|
|
|
|
delete entries[selectedSection.id][selectedPage.id];
|
|
|
|
mutateObject(openmct, domainObject, 'configuration.entries', entries);
|
|
}
|
|
|
|
export function mutateObject(openmct, object, key, value) {
|
|
openmct.objects.mutate(object, key, value);
|
|
}
|
|
|
|
function addDefaultClass(domainObject, openmct) {
|
|
openmct.status.set(domainObject.identifier, DEFAULT_CLASS);
|
|
}
|