Compare commits
1 Commits
itc-mode-d
...
code-walkt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea45e7f636 |
@@ -194,6 +194,7 @@
|
|||||||
['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked'],
|
['table', 'telemetry.plot.overlay', 'telemetry.plot.stacked'],
|
||||||
{indicator: true}
|
{indicator: true}
|
||||||
));
|
));
|
||||||
|
openmct.install(openmct.plugins.CodeWalkthrough);
|
||||||
openmct.start();
|
openmct.start();
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
71
src/plugins/codeWalkthrough/plugin.js
Normal file
71
src/plugins/codeWalkthrough/plugin.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
import Vue from 'Vue';
|
||||||
|
|
||||||
|
export default function install(openmct) {
|
||||||
|
openmct.objectViews.addProvider({
|
||||||
|
name: "Latest Data Table",
|
||||||
|
key: "latest-table",
|
||||||
|
cssClass: "icon-packet",
|
||||||
|
description: "A tabular view of telemetry contents.",
|
||||||
|
canView: function () {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
view: function (domainObject) {
|
||||||
|
let unsubscribe;
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: function (element) {
|
||||||
|
//element.innerText = 'Hello World!';
|
||||||
|
let telemetryMetadata = openmct.telemetry.getMetadata(domainObject).values();
|
||||||
|
let tableEl = document.createElement('table');
|
||||||
|
let tableHeader = document.createElement('thead');
|
||||||
|
let tableHeaderRow = document.createElement('tr');
|
||||||
|
let tableBody = document.createElement('tbody');
|
||||||
|
|
||||||
|
element.appendChild(tableEl);
|
||||||
|
tableHeader.appendChild(tableHeaderRow);
|
||||||
|
tableEl.appendChild(tableHeader);
|
||||||
|
tableEl.appendChild(tableBody);
|
||||||
|
|
||||||
|
telemetryMetadata.forEach(metadatum => {
|
||||||
|
let tableHeader = document.createElement('td');
|
||||||
|
tableHeader.innerText = metadatum.name;
|
||||||
|
tableHeaderRow.appendChild(tableHeader);
|
||||||
|
});
|
||||||
|
|
||||||
|
openmct.time.on('bounds', (newBounds) => {
|
||||||
|
tableBody.innerHTML = '';
|
||||||
|
requestTelemetry(newBounds);
|
||||||
|
});
|
||||||
|
|
||||||
|
requestTelemetry();
|
||||||
|
|
||||||
|
// unsubscribe = openmct.telemetry.subscribe(domainObject, (datum) => {
|
||||||
|
// addRow(datum);
|
||||||
|
// });
|
||||||
|
|
||||||
|
function addRow(telemetryDatum) {
|
||||||
|
let dataRow = document.createElement('tr');
|
||||||
|
telemetryMetadata.forEach(metadatum => {
|
||||||
|
let tableCell = document.createElement('td');
|
||||||
|
let formatter = openmct.telemetry.getValueFormatter(metadatum);
|
||||||
|
|
||||||
|
tableCell.innerText = formatter.format(telemetryDatum[metadatum.key]);
|
||||||
|
dataRow.appendChild(tableCell);
|
||||||
|
tableBody.appendChild(dataRow);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestTelemetry(bounds) {
|
||||||
|
openmct.telemetry.request(domainObject, {bounds}).then(arrayOfTelemetry => {
|
||||||
|
arrayOfTelemetry.forEach(addRow);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
destroy: function (element) {
|
||||||
|
unsubscribe();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
@@ -65,7 +65,8 @@ define([
|
|||||||
'./interceptors/plugin',
|
'./interceptors/plugin',
|
||||||
'./performanceIndicator/plugin',
|
'./performanceIndicator/plugin',
|
||||||
'./CouchDBSearchFolder/plugin',
|
'./CouchDBSearchFolder/plugin',
|
||||||
'./timeline/plugin'
|
'./timeline/plugin',
|
||||||
|
'./codeWalkthrough/plugin'
|
||||||
], function (
|
], function (
|
||||||
_,
|
_,
|
||||||
UTCTimeSystem,
|
UTCTimeSystem,
|
||||||
@@ -111,7 +112,8 @@ define([
|
|||||||
ObjectInterceptors,
|
ObjectInterceptors,
|
||||||
PerformanceIndicator,
|
PerformanceIndicator,
|
||||||
CouchDBSearchFolder,
|
CouchDBSearchFolder,
|
||||||
Timeline
|
Timeline,
|
||||||
|
codeWalkthroughPlugin
|
||||||
) {
|
) {
|
||||||
const bundleMap = {
|
const bundleMap = {
|
||||||
LocalStorage: 'platform/persistence/local',
|
LocalStorage: 'platform/persistence/local',
|
||||||
@@ -212,6 +214,7 @@ define([
|
|||||||
plugins.PerformanceIndicator = PerformanceIndicator.default;
|
plugins.PerformanceIndicator = PerformanceIndicator.default;
|
||||||
plugins.CouchDBSearchFolder = CouchDBSearchFolder.default;
|
plugins.CouchDBSearchFolder = CouchDBSearchFolder.default;
|
||||||
plugins.Timeline = Timeline.default;
|
plugins.Timeline = Timeline.default;
|
||||||
|
plugins.CodeWalkthrough = codeWalkthroughPlugin.default;
|
||||||
|
|
||||||
return plugins;
|
return plugins;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user