@@ -87,6 +87,53 @@ export function ToolbarSaveAs() {
87
87
88
88
const items : MenuItemProps [ ] = [ ] ;
89
89
90
+ if ( organization . features . includes ( 'performance-saved-queries' ) ) {
91
+ if ( defined ( id ) ) {
92
+ items . push ( {
93
+ key : 'update-query' ,
94
+ label : (
95
+ < span >
96
+ { t ( 'Existing Query' ) }
97
+ < FeatureBadge type = "alpha" />
98
+ </ span >
99
+ ) ,
100
+ onAction : async ( ) => {
101
+ try {
102
+ addLoadingMessage ( t ( 'Updating query...' ) ) ;
103
+ await updateQuery ( ) ;
104
+ addSuccessMessage ( t ( 'Query updated successfully' ) ) ;
105
+ trackAnalytics ( 'trace_explorer.save_as' , {
106
+ save_type : 'update_query' ,
107
+ ui_source : 'toolbar' ,
108
+ organization,
109
+ } ) ;
110
+ } catch ( error ) {
111
+ addErrorMessage ( t ( 'Failed to update query' ) ) ;
112
+ Sentry . captureException ( error ) ;
113
+ }
114
+ } ,
115
+ } ) ;
116
+ }
117
+ items . push ( {
118
+ key : 'save-query' ,
119
+ label : (
120
+ < span >
121
+ { t ( 'A New Query' ) }
122
+ < FeatureBadge type = "alpha" />
123
+ </ span >
124
+ ) ,
125
+ onAction : ( ) => {
126
+ openSaveQueryModal ( {
127
+ organization,
128
+ query,
129
+ groupBys : mode === Mode . AGGREGATE ? groupBys : [ ] ,
130
+ visualizes,
131
+ saveQuery,
132
+ } ) ;
133
+ } ,
134
+ } ) ;
135
+ }
136
+
90
137
if ( organization . features . includes ( 'alerts-eap' ) ) {
91
138
items . push ( {
92
139
key : 'create-alert' ,
@@ -154,54 +201,6 @@ export function ToolbarSaveAs() {
154
201
} ) ;
155
202
}
156
203
157
- if ( organization . features . includes ( 'performance-saved-queries' ) ) {
158
- items . push ( {
159
- key : 'save-query' ,
160
- label : (
161
- < span >
162
- { t ( 'A New Query' ) }
163
- < FeatureBadge type = "alpha" />
164
- </ span >
165
- ) ,
166
- onAction : ( ) => {
167
- openSaveQueryModal ( {
168
- organization,
169
- query,
170
- groupBys : mode === Mode . AGGREGATE ? groupBys : [ ] ,
171
- visualizes,
172
- saveQuery,
173
- } ) ;
174
- } ,
175
- } ) ;
176
-
177
- if ( defined ( id ) ) {
178
- items . push ( {
179
- key : 'update-query' ,
180
- label : (
181
- < span >
182
- { t ( 'Existing Query' ) }
183
- < FeatureBadge type = "alpha" />
184
- </ span >
185
- ) ,
186
- onAction : async ( ) => {
187
- try {
188
- addLoadingMessage ( t ( 'Updating query...' ) ) ;
189
- await updateQuery ( ) ;
190
- addSuccessMessage ( t ( 'Query updated successfully' ) ) ;
191
- trackAnalytics ( 'trace_explorer.save_as' , {
192
- save_type : 'update_query' ,
193
- ui_source : 'toolbar' ,
194
- organization,
195
- } ) ;
196
- } catch ( error ) {
197
- addErrorMessage ( t ( 'Failed to update query' ) ) ;
198
- Sentry . captureException ( error ) ;
199
- }
200
- } ,
201
- } ) ;
202
- }
203
- }
204
-
205
204
if ( items . length === 0 ) {
206
205
return null ;
207
206
}
0 commit comments