@@ -18,7 +18,6 @@ class ExportDataAction {
1818 this . group = 'view' ;
1919 this . priority = 1 ;
2020 this . validTypes = validTypes ;
21- this . sessionService = SessionService ( ) ;
2221
2322 this . openmct = openmct ;
2423 }
@@ -63,12 +62,16 @@ class ExportDataAction {
6362 ) ;
6463
6564 if ( filteredComposition . length > 0 ) {
66- await this . runExportTask ( filteredComposition ) ;
65+ await this . runExportTask ( filteredComposition , domainObject . name ) ;
6766 } else {
6867 this . openmct . notifications . info ( 'No historical data to export' ) ;
6968 }
7069 }
7170
71+ getHistoricalSessionFilter ( ) {
72+ return SessionService ( ) . getHistoricalSessionFilter ( ) ;
73+ }
74+
7275 historicalFilterString ( sessionFilter ) {
7376 let filterString = formatNumberSequence ( sessionFilter . numbers ) ;
7477
@@ -78,9 +81,18 @@ class ExportDataAction {
7881 return `${ sessionFilter . host } _${ filterString } ` ;
7982 }
8083
81- runExportTask ( domainObjects ) {
82- let filename = domainObjects [ 0 ] . name ;
83- const sessionFilter = this . sessionService . getHistoricalSessionFilter ( ) ;
84+ /**
85+ * Runs the export task for the given domain objects with an optional name.
86+ * If no name is provided, uses the name of the first domain object.
87+ * Appends session filter information to the filename if a session filter exists.
88+ *
89+ * @param {Array<Object> } domainObjects - Array of domain objects to export
90+ * @param {string } [name] - Optional name for the export file. If not provided, uses the name of the first domain object
91+ * @returns {Promise } A promise that resolves when the export task is complete
92+ */
93+ runExportTask ( domainObjects , name ) {
94+ let filename = name ?? domainObjects [ 0 ] . name ;
95+ const sessionFilter = this . getHistoricalSessionFilter ( ) ;
8496
8597 if ( sessionFilter ) {
8698 filename = `${ filename } - ${ this . historicalFilterString ( sessionFilter ) } ` ;
0 commit comments