@@ -58,12 +58,8 @@ export function KbnAggTable(config, RecursionHelper) {
5858 } ;
5959
6060 self . toCsv = function ( formatted ) {
61- const rows = formatted ? $scope . rows : $scope . table . rows ;
62- const columns = formatted ? [ ...$scope . formattedColumns ] : [ ...$scope . table . columns ] ;
63-
64- if ( $scope . splitRow && formatted ) {
65- columns . unshift ( $scope . splitRow ) ;
66- }
61+ const rows = $scope . rows ;
62+ const columns = $scope . formattedColumns ;
6763
6864 const nonAlphaNumRE = / [ ^ a - z A - Z 0 - 9 ] / ;
6965 const allDoubleQuoteRE = / " / g;
@@ -77,7 +73,7 @@ export function KbnAggTable(config, RecursionHelper) {
7773 return val ;
7874 }
7975
80- let csvRows = [ ] ;
76+ const csvRows = [ ] ;
8177 for ( const row of rows ) {
8278 const rowArray = [ ] ;
8379 for ( const col of columns ) {
@@ -86,15 +82,11 @@ export function KbnAggTable(config, RecursionHelper) {
8682 formatted && col . formatter ? escape ( col . formatter . convert ( value ) ) : escape ( value ) ;
8783 rowArray . push ( formattedValue ) ;
8884 }
89- csvRows = [ ... csvRows , rowArray ] ;
85+ csvRows . push ( rowArray ) ;
9086 }
9187
9288 // add the columns to the rows
93- csvRows . unshift (
94- columns . map ( function ( col ) {
95- return escape ( formatted ? col . title : col . name ) ;
96- } )
97- ) ;
89+ csvRows . unshift ( columns . map ( ( { title } ) => escape ( title ) ) ) ;
9890
9991 return csvRows
10092 . map ( function ( row ) {
@@ -112,7 +104,6 @@ export function KbnAggTable(config, RecursionHelper) {
112104 if ( ! table ) {
113105 $scope . rows = null ;
114106 $scope . formattedColumns = null ;
115- $scope . splitRow = null ;
116107 return ;
117108 }
118109
@@ -122,19 +113,12 @@ export function KbnAggTable(config, RecursionHelper) {
122113
123114 if ( typeof $scope . dimensions === 'undefined' ) return ;
124115
125- const { buckets, metrics, splitColumn , splitRow } = $scope . dimensions ;
116+ const { buckets, metrics } = $scope . dimensions ;
126117
127118 $scope . formattedColumns = table . columns
128119 . map ( function ( col , i ) {
129120 const isBucket = buckets . find ( ( bucket ) => bucket . accessor === i ) ;
130- const isSplitColumn = splitColumn
131- ? splitColumn . find ( ( splitColumn ) => splitColumn . accessor === i )
132- : undefined ;
133- const isSplitRow = splitRow
134- ? splitRow . find ( ( splitRow ) => splitRow . accessor === i )
135- : undefined ;
136- const dimension =
137- isBucket || isSplitColumn || metrics . find ( ( metric ) => metric . accessor === i ) ;
121+ const dimension = isBucket || metrics . find ( ( metric ) => metric . accessor === i ) ;
138122
139123 const formatter = dimension
140124 ? getFormatService ( ) . deserialize ( dimension . format )
@@ -147,10 +131,6 @@ export function KbnAggTable(config, RecursionHelper) {
147131 filterable : ! ! isBucket ,
148132 } ;
149133
150- if ( isSplitRow ) {
151- $scope . splitRow = formattedColumn ;
152- }
153-
154134 if ( ! dimension ) return ;
155135
156136 const last = i === table . columns . length - 1 ;
0 commit comments