Skip to content

Commit

Permalink
fix import/export, channel table order, frame summary view, EMD View,…
Browse files Browse the repository at this point in the history
… issue installing over older persistence
  • Loading branch information
jvigliotta committed May 30, 2023
2 parents ce9bbe6 + 90481ba commit 30ae4e0
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openmct-mcws",
"version": "5.0-b3",
"version": "5.0-b4",
"description": "Open MCT for MCWS",
"devDependencies": {
"axios": "^0.21.2",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>gov.nasa.arc.wtd</groupId>
<artifactId>openmct-client</artifactId>
<name>Open MCT for MCWS Client</name>
<version>5.0-b3</version>
<version>5.0-b4</version>
<packaging>war</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ function importWithDatasetsModifier(openmct) {
}

function getReferencedDatasetsFromImport(json) {
const openmct = json.openmct;
const objects = json.openmct;
const referencedDatasetsFromImport = [];

Object.values(openmct)
Object.values(objects)
.forEach(object => object.composition
?.forEach( identifier => {
if (Types.hasTypeForIdentifier(identifier)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ define([
el: element
});
},
priority: function () {
return openmct.priority.HIGH;
},
destroy: function () {
component.$destroy();
component = undefined;
}
}
},
priority: function () {
return 1;
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/framesummary/FrameWatchConfigurationViewProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FrameWatchTableConfiguration from './FrameWatchTableConfiguration';
import TableConfigurationComponent from 'openmct.tables.components.TableConfiguration';

export default class FrameWatchConfigurationViewProvider {
constructor(key, name, type) {
constructor(openmct, key, name, type) {
this.key = key;
this.name = name;
this.type = type;
Expand Down Expand Up @@ -36,6 +36,9 @@ export default class FrameWatchConfigurationViewProvider {
el: element
});
},
priority: function () {
return openmct.priority.HIGH + 1;
},
destroy: function () {
component.$destroy();
component = undefined;
Expand Down
35 changes: 18 additions & 17 deletions src/framesummary/FrameWatchRowCollection.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import TableRowCollection from 'openmct.tables.collections.TableRowCollection';

export default class FrameWatchRowCollection extends TableRowCollection {
constructor(openmct) {
super(openmct);
addRows(rows) {
let rowsToAdd = this.filterRows(rows);
let newRowsToAdd = [];

rowsToAdd.forEach(rowToAdd => {
const matchIndex = this.rows.find(row => row.rowId === rowToAdd.rowId)

this.createRowMapEntries = this.createRowMapEntries.bind(this);
this.removeRowMapEntries = this.removeRowMapEntries.bind(this);
this.rowMap = {};

this.on('remove', this.removeRowMapEntries);
this.on('add', this.createRowMapEntries);
}

createRowMapEntries(row) {
this.rowMap[row.rowId] = row;
}

removeRowMapEntries(rows) {
rows.forEach((row) => {
delete this.rowMap[row.rowId];
if (matchIndex !== undefined) {
this.emit('remove', [this.rows[matchIndex]]);
this.rows[matchIndex] = rowToAdd;
this.emit('add', [this.rows[matchIndex]]);
} else {
newRowsToAdd.push(rowToAdd);
}
});

if (newRowsToAdd.length > 0) {
this.sortAndMergeRows(newRowsToAdd);
this.emit('add', newRowsToAdd);
}
}
}
1 change: 0 additions & 1 deletion src/framesummary/FrameWatchTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default class FrameWatchTable extends TelemetryTable {
let telemetryRows = this.createRows(datum, columnMap, keyString, limitEvaluator);

this.updateHeader(datum);
this.tableRows.clear();

if (this.paused) {
this.delayedActions.push(this.tableRows.addRows.bind(this, telemetryRows, 'add'));
Expand Down
12 changes: 6 additions & 6 deletions src/framesummary/encodingwatch/EncodingWatchRow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import FrameWatchRow from '../FrameWatchRow';
import DatasetCache from 'services/dataset/DatasetCache';
import Types from '../../types/types';

export default class EncodingWatchRow extends FrameWatchRow {
constructor(datum, columns, objectKeyString, limitEvaluator, rowId, frameEventType) {
Expand All @@ -10,12 +11,11 @@ export default class EncodingWatchRow extends FrameWatchRow {
}

getContextualDomainObject(openmct, objectKeyString) {
const objectKeyStringArray = objectKeyString.split(":");
const datasetIdentifier = {
namespace: objectKeyStringArray[objectKeyStringArray.length - 2],
key: objectKeyStringArray[objectKeyStringArray.length - 1]
}

const identifier = openmct.objects.parseKeyString(objectKeyString);
const matchingType = Types.typeForIdentifier(identifier);
const data = matchingType.data(identifier);
const datasetIdentifier = data.datasetIdentifier;

return this.datasetCache.get(datasetIdentifier).then(dataset => {
const badFrameEventFilterObjectKey = this.frameEventType.makeFilterIdentifier(dataset.identifier, 'BadTelemetryFrame');

Expand Down
18 changes: 10 additions & 8 deletions src/framesummary/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,29 @@ export default function FrameWatchViewPlugin() {

openmct.objectViews.addProvider(new FrameWatchViewProvider(
openmct,
'vista.encodingWatchViewProvider',
'Encoding Watch View',
ENCODING_WATCH_TYPE
'vista.frameWatchViewProvider',
'Frame Watch View',
FRAME_WATCH_TYPE
));

openmct.objectViews.addProvider(new FrameWatchViewProvider(
openmct,
'vista.frameWatchViewProvider',
'Frame Watch View',
FRAME_WATCH_TYPE
'vista.encodingWatchViewProvider',
'Encoding Watch View',
ENCODING_WATCH_TYPE
));

openmct.inspectorViews.addProvider(new FrameWatchConfigurationViewProvider(
openmct,
'vista.encodingWatchConfigurationViewProvider',
'Encoding Watch Configuration',
'Config',
ENCODING_WATCH_TYPE
));

openmct.inspectorViews.addProvider(new FrameWatchConfigurationViewProvider(
openmct,
'vista.frameWatchConfigurationViewProvider',
'Frame Watch Configuration',
'Config',
FRAME_WATCH_TYPE
));

Expand Down
9 changes: 5 additions & 4 deletions src/legacy/products/src/EMDViewProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ define([
divElement.className = "abs loading";
el.appendChild(divElement);

mcws.opaqueFile(row.emd_preview).read().then(function (response) {
var preElement = $document[0].createElement('pre');
var codeElement = $document[0].createElement('code');
mcws.opaqueFile(row.emd_preview).read().then(async function (response) {
const preElement = $document[0].createElement('pre');
const codeElement = $document[0].createElement('code');
const text = await response.text();
preElement.appendChild(codeElement);
divElement.className = "abs scroll";
codeElement.textContent = response;
codeElement.textContent = text;
divElement.appendChild(preElement);
}, function (response) {
let reason = 'Unknown Error';
Expand Down
23 changes: 23 additions & 0 deletions src/persistence/existingNamespaceUpdateInterceptor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default function existingNamespaceUpdateInterceptor(openmct, usersNamespace, shouldCheck) {
let loggedNamespaceCheck = false;

openmct.objects.addGetInterceptor({
appliesTo: (identifier, domainObject) => {
return shouldCheck;
},
invoke: (identifier, object) => {
if (object.location === usersNamespace.key) {
object.location = usersNamespace.id;
openmct.objects.mutate(object, 'location', usersNamespace.id);
}

// turn off if we've checked the user folder
if (!loggedNamespaceCheck && (object.location === usersNamespace.key || object.location === usersNamespace.id)) {
localStorage.setItem(`r5.0_old_namespace_checked:${usersNamespace.key}`, 'true');
loggedNamespaceCheck = true;
}

return object;
}
});
}
7 changes: 6 additions & 1 deletion src/persistence/plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createIdentifierFromNamespaceDefinition, createNamespace } from './utils';
import existingNamespaceUpdateInterceptor from './existingNamespaceUpdateInterceptor';
import MCWSPersistenceProvider from './MCWSPersistenceProvider';

export default function MCWSPersistenceProviderPlugin(configNamespaces) {
Expand All @@ -8,8 +9,12 @@ export default function MCWSPersistenceProviderPlugin(configNamespaces) {
rootsResolve = resolve;
});
openmct.objects.addRoot(() => rootsPromise);
const namespaces = configNamespaces.map(createNamespace);
const mcwsPersistenceProvider = new MCWSPersistenceProvider(openmct, namespaces);

const mcwsPersistenceProvider = new MCWSPersistenceProvider(openmct, configNamespaces.map(createNamespace));
const usersNamespace = namespaces.find((namespace) => namespace.containsNamespaces);
const checkOldNamespaces = localStorage.getItem(`r5.0_old_namespace_checked:${usersNamespace.key}`) === null;
existingNamespaceUpdateInterceptor(openmct, usersNamespace, checkOldNamespaces);

// install the provider for each persistence space,
// key is the namespace in the response for persistence namespaces
Expand Down

0 comments on commit 30ae4e0

Please sign in to comment.