@@ -103,11 +103,12 @@ const replaceChartConfig = (chartConfig) => {
103
103
const replaceFilters = ( filters ) => {
104
104
if ( ! filters || Object . keys ( filters ) . length === 0 ) {
105
105
return filters
106
- } else if ( 'dimensions' in filters || 'metrics' in filters ) {
106
+ } else if ( 'dimensions' in filters || 'metrics' in filters || 'tableCalculations' in filters ) {
107
107
return {
108
108
...filters ,
109
109
dimensions : replaceFilters ( filters . dimensions ) ,
110
- metrics : replaceFilters ( filters . metrics )
110
+ metrics : replaceFilters ( filters . metrics ) ,
111
+ tableCalculations : replaceFilters ( filters . tableCalculations )
111
112
}
112
113
113
114
} else if ( 'and' in filters ) {
@@ -197,7 +198,7 @@ const rename = async () => {
197
198
if ( ! hasChanges ) {
198
199
console . log ( `chart ${ savedChart . name } has no changes` )
199
200
return
200
- } else {
201
+ } else {
201
202
console . log ( `--------------chart ${ savedChart . name } (${ savedChartUuid } ) has changes ---------` )
202
203
console . info ( JSON . stringify ( savedChart ) )
203
204
console . log ( '------' )
@@ -226,7 +227,13 @@ const rename = async () => {
226
227
}
227
228
} catch ( e ) {
228
229
console . error ( '------------------' )
229
- if ( ! savedChart ) {
230
+ if ( savedChart ) {
231
+ console . error ( `Error updating chart "${ savedChart . name } ", consider removing this chart or updating manually` , e )
232
+ if ( debug ) {
233
+ console . error ( 'here is a snippet of the chart: ' )
234
+ console . error ( JSON . stringify ( savedChart , null , 2 ) )
235
+ }
236
+ } else {
230
237
console . error ( `Error fetching chart ${ query . uuid } ` , e )
231
238
if ( debug ) {
232
239
console . error ( 'here is a snippet of the query saved in the space: ' )
@@ -235,12 +242,6 @@ const rename = async () => {
235
242
console . error ( 'here is a reseponse from the server: ' )
236
243
console . error ( JSON . stringify ( savedChartResponse , null , 2 ) )
237
244
}
238
- } else {
239
- console . error ( `Error updating chart "${ savedChart . name } ", consider removing this chart or updating manually` , e )
240
- if ( debug ) {
241
- console . error ( 'here is a snippet of the chart: ' )
242
- console . error ( JSON . stringify ( savedChart , null , 2 ) )
243
- }
244
245
}
245
246
console . error ( '------------------' )
246
247
}
0 commit comments