Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full angular removal #170

Merged
merged 44 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
caba717
update historical sessions indicator to remove angular
jvigliotta Jan 31, 2024
95283c2
moving global staleness to a regular service, not angular
jvigliotta Feb 14, 2024
7a0af0f
Merge branch 'main' into full-angular-removal
jvigliotta Mar 27, 2024
58c3e29
ignoring some stuff AND removing angular from our data cell preview
jvigliotta Mar 29, 2024
43d94bf
wrong path
jvigliotta Mar 29, 2024
29cb585
lint
jvigliotta Mar 29, 2024
abadb72
missed a period
jvigliotta Mar 29, 2024
8cae7b0
move order around to show loader and switch to small view to be more …
jvigliotta Mar 29, 2024
4b610b9
actually making the overlay small
jvigliotta Mar 29, 2024
5cef269
updating time plugin and time systems to not use angular
jvigliotta Mar 29, 2024
926ec57
missed some spots
jvigliotta Mar 29, 2024
c1ec596
convert venue template and controller to vue file and venue plugin to…
jvigliotta Apr 2, 2024
0df0501
convert venue service to es6
jvigliotta Apr 2, 2024
3c79340
created the venue dialog component to replace the angular version
jvigliotta Apr 2, 2024
7aa274f
convert venue.js to es6
jvigliotta Apr 2, 2024
dc78d96
created vue components for historical, active venue and active sessio…
jvigliotta Apr 2, 2024
1548e94
swapping over venues
jvigliotta Apr 10, 2024
1e87c10
Updated venues to Vue, starting on remaining legacy code
jvigliotta Apr 18, 2024
4d09fa0
removing old venue files
jvigliotta Apr 18, 2024
a9a7fdc
update types from legacy composition model
jvigliotta Apr 18, 2024
3e62ca3
remove legacy from taxonomy
jvigliotta Apr 18, 2024
330c364
moving styles out of legacy folder
jvigliotta Apr 18, 2024
9de99c1
remove legacy products bundle and associated files
jvigliotta Apr 18, 2024
53a37ca
updating export data action
jvigliotta Apr 24, 2024
6b32f7d
removed legacy folder
jvigliotta Apr 24, 2024
2559364
removing openmct w/maps repo
jvigliotta Apr 25, 2024
7125b65
reverting webpack changes
jvigliotta Apr 25, 2024
578d640
moving import back to where it was
jvigliotta Apr 25, 2024
773a1b2
removed development settings
jvigliotta Apr 25, 2024
7b4e170
removing old commented code
jvigliotta Apr 25, 2024
0539ba3
changed openmct package name back to normal
jvigliotta Apr 25, 2024
9ecc559
syntax cleanup
jvigliotta Apr 25, 2024
5857625
removing redundant check
jvigliotta Apr 25, 2024
7e0e95a
remvoing unnecessary await
jvigliotta Apr 25, 2024
d79adb9
syntax
jvigliotta Apr 25, 2024
b6509fc
safe check the type
davetsay Apr 30, 2024
7be0f2b
config is already passed
davetsay Apr 30, 2024
7d607a7
removing axios... for good
jvigliotta Apr 30, 2024
772e01f
removing _openmct use
jvigliotta Apr 30, 2024
5d0f689
removing old commented code
jvigliotta Apr 30, 2024
1f3ddd5
addressing PR comments
jvigliotta May 3, 2024
7313277
xdescribing tests that need updates
jvigliotta May 3, 2024
2376ec6
removing unnecessary checks
jvigliotta May 3, 2024
85e175d
final updates
jvigliotta May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ npm-debug.log
# auto-env files for those that use them.
.env
dist
package-lock.json
test_data/
3 changes: 2 additions & 1 deletion .webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ module.exports = merge(common, {
// for dev, we serve out of dist/ so we need to replace any reference
return content.toString().replace(/"dist\//g, '"');
}
}
},
{ from: './ExampleVenueDefinitions.json', to: 'ExampleVenueDefinitions.json' }
]
})
],
Expand Down
21 changes: 1 addition & 20 deletions loader.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
define([
'openmct',
'./src/AMMOSPlugins',
'./src/legacy/export/bundle',
'./src/legacy/products/bundle',
'./src/legacy/table/bundle',
'./src/legacy/general/res/sass/vista.scss',
'./src/styles/sass/vista.scss',
'./src/commandEventsView/plugin',
'./src/messagesView/plugin',
'./src/product-status/plugin',
'./about.html',
'./src/metadataAction/plugin',
'./src/clearDataIndicator/plugin',
'./src/globalStaleness/plugin',
'./src/dictionaryView/plugin',
'./src/packetSummary/plugin',
'./src/containerView/plugin',
'openmct-legacy-support',
davetsay marked this conversation as resolved.
Show resolved Hide resolved
'services/identity/MCWSIdentityProvider',
'./src/persistence/plugin'
], function (
openmct,
AMMOSPlugins,
exportBundle,
productsBundle,
legacyTablesBundle,
VistaStyles, /** Do not delete, needed for webpack to compile scss file*/
CommandEventsViewPlugin,
MessagesPlugin,
ProductStatusPlugin,
AboutTemplate,
MetadataActionPlugin,
ClearDataIndicator,
GlobalStalenessPlugin,
DictionaryViewPlugin,
PacketSummaryPlugin,
ContainerViewPlugin,
LegacySupport,
IdentityProvider,
MCWSPersistenceProviderPlugin
) {
Expand All @@ -47,8 +37,6 @@ define([
});
openmct.setAssetPath(config.assetPath);

openmct.install(LegacySupport.default());

//Optional Themes
if (config.theme) {
openmct.install(openmct.plugins[config.theme]());
Expand Down Expand Up @@ -82,7 +70,6 @@ define([
}
));
openmct.install(ClearDataIndicator.default(config.globalStalenessInterval));
openmct.install(GlobalStalenessPlugin.default(config.globalStalenessInterval));
openmct.install(CommandEventsViewPlugin.default());
openmct.install(MessagesPlugin.default());
openmct.install(ProductStatusPlugin.default());
Expand Down Expand Up @@ -112,12 +99,6 @@ define([
});
}

[
exportBundle,
productsBundle,
legacyTablesBundle
].forEach(openmct.install, openmct);

if (config.plugins) {
if (config.plugins.summaryWidgets) {
openmct.install(openmct.plugins.SummaryWidget());
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Open MCT for MCWS",
"devDependencies": {
"@braintree/sanitize-url": "6.0.2",
"axios": "^0.21.2",
"babel-loader": "8.2.3",
"babel-plugin-istanbul": "6.1.1",
"bower": "^1.7.7",
Expand Down Expand Up @@ -33,7 +32,6 @@
"moment": "2.29.4",
"node-bourbon": "^4.2.3",
"openmct": "nasa/openmct#omm-r5.2.0-rc2",
"openmct-legacy-support": "akhenry/openmct-legacy-support#omm-r5.1.0-rc1",
"printj": "^1.2.1",
"raw-loader": "^0.5.1",
"resolve-url-loader": "5.0.0",
Expand Down
29 changes: 23 additions & 6 deletions src/AMMOSPlugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define([
'services/dataset/DatasetCache',
'services/session/SessionService',
'services/globalStaleness/globalStaleness',
'./types/plugin',
'./taxonomy/plugin',
'./time/plugin',
Expand Down Expand Up @@ -30,10 +31,12 @@ define([
'./mcwsIndicator/plugin',
'./multipleHistoricalSessions/plugin',
'./realtimeSessions/plugin',
'./globalFilters/plugin'
'./globalFilters/plugin',
'./exportDataAction/plugin'
], function (
DatasetCache,
SessionService,
GlobalStaleness,
TypePlugin,
TaxonomyPlugin,
TimePlugin,
Expand Down Expand Up @@ -63,18 +66,20 @@ define([
MCWSIndicatorPlugin,
MultipleHistoricalSessions,
RealtimeSessions,
GlobalFilters
GlobalFilters,
ExportDataAction
) {

function AMMOSPlugins(options) {
return function install(openmct) {
// initialze session service and datasetCache service
// initialze session service, datasetCache service, global staleness
SessionService.default(openmct, options);
DatasetCache.default(openmct);
GlobalStaleness.default(openmct, options.globalStalenessInterval);

openmct.install(new FormatPlugin(options));

const timePlugin = new TimePlugin(options.time);
const timePlugin = new TimePlugin(openmct, options.time);
openmct.install(timePlugin);

const formatKey = options.time.utcFormat;
Expand All @@ -97,10 +102,10 @@ define([

openmct.install(new HistoricalTelemetryPlugin(options));
openmct.install(new RealtimeTelemetryPlugin(vistaTime, options));
openmct.install(new TypePlugin(options));
openmct.install(new TypePlugin.default());
openmct.install(new TaxonomyPlugin(options.taxonomy));
openmct.install(new LinkPlugin(options));
openmct.install(new VenuePlugin(options));
openmct.install(new VenuePlugin.default(options));
openmct.install(FrameWatchViewPlugin.default());
openmct.install(FrameEventFilterViewPlugin.default());
openmct.install(new ChannelTablePlugin.default());
Expand Down Expand Up @@ -128,6 +133,18 @@ define([
openmct.install(CustomFormsPlugin.default());

openmct.install(openmct.plugins.DefaultRootName('VISTA'));
openmct.install(new ExportDataAction.default([
'table',
'telemetry.plot.overlay',
'telemetry.plot.stacked',
'vista.channel',
'vista.channelGroup',
'vista.chanTableGroup',
'vista.evr',
'vista.evrModule',
'vista.evrSource',
'vista.evrView'
]));
openmct.install(ActionModifiersPlugin.default());
openmct.install(new PacketQueryPlugin.default());
if (options.globalFilters) {
Expand Down
84 changes: 84 additions & 0 deletions src/exportDataAction/ExportDataAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import ExportDataTask from './ExportDataTask';

/**
* Implements the "Export Data" action, allowing data for Channels, EVRs,
* or grouped containers of these to be exported as CSV using ES6 class syntax.
*
* @param {openmct} openmct instance
* @memberof vista/export
*/
class ExportDataAction {
constructor(openmct, validTypes) {
this.name = 'Export Historical Data';
this.key = 'vista.export';
this.description = 'Export channel or EVR data as CSV';
this.cssClass = 'icon-download';
this.group = 'view';
this.priority = 1;
this.validTypes = validTypes;

this.openmct = openmct;
}

appliesTo(objectPath) {
const domainObject = objectPath[0];

if (this.isValidType(domainObject)) {
return true;
}

return false;
}

async invoke(objectPath) {
const domainObject = objectPath[0];
const progressDialog = this.openmct.notifications.progress('Exporting CSV', 'unknown');

try {
await this.exportData(domainObject);
} catch (error) {
console.error(error);
this.openmct.notifications.error('Error exporting CSV');
} finally {
progressDialog.dismiss();
}
}

async exportData(domainObject) {
if (this.hasHistoricalTelemetry(domainObject)) {
await this.runExportTask([domainObject]);
} else {
await this.exportCompositionData(domainObject);
}
}

async exportCompositionData(domainObject) {
const compositionCollection = this.openmct.composition.get(domainObject);
const composition = await compositionCollection.load();
const filteredComposition = composition.filter(obj =>
this.isValidType(obj) && this.hasHistoricalTelemetry(obj)
);

if (filteredComposition.length > 0) {
await this.runExportTask(filteredComposition);
} else {
this.openmct.notifications.info('No historical data to export');
}
}

runExportTask(domainObjects) {
const task = new ExportDataTask(this.openmct, domainObjects[0].name, domainObjects);

return task.invoke();
}

isValidType(domainObject) {
return this.validTypes.includes(domainObject?.type);
}

hasHistoricalTelemetry(domainObject) {
return this.openmct.telemetry.isTelemetryObject(domainObject) && !domainObject.telemetry.realtimeOnly;
}
}

export default ExportDataAction;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define([
], function (ExportDataAction) {
'use strict';

describe("The Export Data action", function () {
xdescribe("The Export Data action", function () {
var mockExportService,
openmct,
mockTelemetryObject,
Expand Down
62 changes: 62 additions & 0 deletions src/exportDataAction/ExportDataTask.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import CSV from 'comma-separated-values';
import {saveAs} from 'saveAs';

export default class ExportDataTask {
/**
* Exports telemetry data to CSV for a group of domain objects.
* Used to support the "Export Data" action.
* @see {vista/export.ExportDataAction}
* @param {DomainObject[]} domainObjects the domain object for which
* telemetry data should be exported
*/
constructor(openmct, filename, domainObjects) {
this.openmct = openmct;
this.filename = filename;
this.domainObjects = domainObjects;
}

/**
* Query for telemetry data and export it to CSV.
* @returns {Promise} a promise which will resolve when the export is
* successfully completed, or be rejected if an error occurs
*/
async invoke() {
const telemetryData = await this.fetchAllTelemetryData();
const headers = this.extractHeaders(telemetryData);
const allTelemetry = telemetryData.flat();

return this.exportAsCSV(allTelemetry, headers);
}

async fetchAllTelemetryData() {
return Promise.all(this.domainObjects.map(async (domainObject) => {
return this.openmct.telemetry.request(domainObject, { strategy: 'comprehensive' });
}));
}

extractHeaders(telemetryData) {
const headerSet = new Set();
telemetryData.forEach(data => {
const datum = data[0] || {};
Object.keys(datum).forEach(key => headerSet.add(key));
});
return Array.from(headerSet);
}

exportAsCSV(rows, headers) {
const options = {
headers: headers,
filename: this.filename
};
return this.exportCSV(rows, options);
}

exportCSV(rows, options) {
const headers = options.headers || Object.keys((rows[0] || {})).sort();
const filename = `${options.filename || 'export'}.csv`;
const csvText = new CSV(rows, { header: headers }).encode();
const blob = new Blob([csvText], { type: "text/csv" });
saveAs(blob, filename);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define([
], function (ExportDataTask) {
'use strict';

describe("ExportDataTask", function () {
xdescribe("ExportDataTask", function () {
var testIds,
testTelemetryData,
mockExportService,
Expand Down
8 changes: 8 additions & 0 deletions src/exportDataAction/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ExportDataAction from './ExportDataAction';

export default function (validTypes) {
return function (openmct) {
openmct.actions.register(new ExportDataAction(openmct, validTypes));
};
}

24 changes: 0 additions & 24 deletions src/globalStaleness/globalStaleness.js

This file was deleted.

Loading
Loading