@grafana/aws-sdk 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11,9 +11,9 @@ var experimental = require('@grafana/experimental');
11
11
  var lodash = require('lodash');
12
12
  var asyncQueryData = require('@grafana/async-query-data');
13
13
 
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
15
15
 
16
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
17
17
 
18
18
  const standardRegions = [
19
19
  "af-south-1",
@@ -90,25 +90,6 @@ const assumeRoleInstructionsStyle = css.css({
90
90
  maxWidth: "715px"
91
91
  });
92
92
 
93
- var __defProp$7 = Object.defineProperty;
94
- var __defProps$6 = Object.defineProperties;
95
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
96
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
97
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
98
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
99
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
100
- var __spreadValues$7 = (a, b) => {
101
- for (var prop in b || (b = {}))
102
- if (__hasOwnProp$7.call(b, prop))
103
- __defNormalProp$7(a, prop, b[prop]);
104
- if (__getOwnPropSymbols$7)
105
- for (var prop of __getOwnPropSymbols$7(b)) {
106
- if (__propIsEnum$7.call(b, prop))
107
- __defNormalProp$7(a, prop, b[prop]);
108
- }
109
- return a;
110
- };
111
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
112
93
  const DEFAULT_LABEL_WIDTH = 28;
113
94
  const DS_TYPES_THAT_SUPPORT_TEMP_CREDS = ["cloudwatch", "grafana-athena-datasource"];
114
95
  const toOption = (value) => ({ value, label: value });
@@ -133,11 +114,13 @@ const ConnectionConfig = (props) => {
133
114
  const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);
134
115
  React.useEffect(() => {
135
116
  if (!currentProvider && awsAllowedAuthProviders.length) {
136
- onOptionsChange(__spreadProps$6(__spreadValues$7({}, options), {
137
- jsonData: __spreadProps$6(__spreadValues$7({}, options.jsonData), {
117
+ onOptionsChange({
118
+ ...options,
119
+ jsonData: {
120
+ ...options.jsonData,
138
121
  authType: awsAllowedAuthProviders[0]
139
- })
140
- }));
122
+ }
123
+ });
141
124
  }
142
125
  }, [currentProvider, options, onOptionsChange, awsAllowedAuthProviders]);
143
126
  React.useEffect(() => {
@@ -146,14 +129,14 @@ const ConnectionConfig = (props) => {
146
129
  }
147
130
  loadRegions().then((regions2) => setRegions(regions2.map(toOption)));
148
131
  }, [loadRegions]);
149
- return /* @__PURE__ */ React__default["default"].createElement("div", { "data-testid": "connection-config" }, /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSection, { title: skipHeader ? "" : "Connection Details", "data-testid": "connection-config" }, /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSubSection, { title: "Authentication" }, /* @__PURE__ */ React__default["default"].createElement(
132
+ return /* @__PURE__ */ React__default.default.createElement("div", { "data-testid": "connection-config" }, /* @__PURE__ */ React__default.default.createElement(experimental.ConfigSection, { title: skipHeader ? "" : "Connection Details", "data-testid": "connection-config" }, /* @__PURE__ */ React__default.default.createElement(experimental.ConfigSubSection, { title: "Authentication" }, /* @__PURE__ */ React__default.default.createElement(
150
133
  ui.Field,
151
134
  {
152
135
  label: "Authentication Provider",
153
136
  description: "Specify which AWS credentials chain to use.",
154
137
  htmlFor: "authProvider"
155
138
  },
156
- /* @__PURE__ */ React__default["default"].createElement(
139
+ /* @__PURE__ */ React__default.default.createElement(
157
140
  ui.Select,
158
141
  {
159
142
  "aria-label": "Authentication Provider",
@@ -167,14 +150,14 @@ const ConnectionConfig = (props) => {
167
150
  menuShouldPortal: true
168
151
  }
169
152
  )
170
- ), options.jsonData.authType === "credentials" && /* @__PURE__ */ React__default["default"].createElement(
153
+ ), options.jsonData.authType === "credentials" && /* @__PURE__ */ React__default.default.createElement(
171
154
  ui.Field,
172
155
  {
173
156
  label: "Credentials Profile Name",
174
157
  description: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.",
175
158
  htmlFor: "credentialsProfileName"
176
159
  },
177
- /* @__PURE__ */ React__default["default"].createElement(
160
+ /* @__PURE__ */ React__default.default.createElement(
178
161
  ui.Input,
179
162
  {
180
163
  id: "credentialsProfileName",
@@ -183,7 +166,7 @@ const ConnectionConfig = (props) => {
183
166
  onChange: data.onUpdateDatasourceJsonDataOption(props, "profile")
184
167
  }
185
168
  )
186
- ), options.jsonData.authType === "keys" && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.Field, { label: "Access Key ID", htmlFor: "accessKeyId" }, ((_b = props.options.secureJsonFields) == null ? void 0 : _b.accessKey) ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.Input, { disabled: true, placeholder: "Configured", id: "accessKeyId" }), /* @__PURE__ */ React__default["default"].createElement(
169
+ ), options.jsonData.authType === "keys" && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(ui.Field, { label: "Access Key ID", htmlFor: "accessKeyId" }, ((_b = props.options.secureJsonFields) == null ? void 0 : _b.accessKey) ? /* @__PURE__ */ React__default.default.createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default.default.createElement(ui.Input, { disabled: true, placeholder: "Configured", id: "accessKeyId" }), /* @__PURE__ */ React__default.default.createElement(
187
170
  ui.ToolbarButton,
188
171
  {
189
172
  icon: "edit",
@@ -191,14 +174,14 @@ const ConnectionConfig = (props) => {
191
174
  type: "button",
192
175
  onClick: data.onUpdateDatasourceResetOption(props, "accessKey")
193
176
  }
194
- )) : /* @__PURE__ */ React__default["default"].createElement(
177
+ )) : /* @__PURE__ */ React__default.default.createElement(
195
178
  ui.Input,
196
179
  {
197
180
  id: "accessKeyId",
198
181
  value: (_d = (_c = options.secureJsonData) == null ? void 0 : _c.accessKey) != null ? _d : "",
199
182
  onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "accessKey")
200
183
  }
201
- )), /* @__PURE__ */ React__default["default"].createElement(ui.Field, { label: "Secret Access Key", htmlFor: "secretKey" }, ((_e = props.options.secureJsonFields) == null ? void 0 : _e.secretKey) ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.Input, { disabled: true, placeholder: "Configured" }), /* @__PURE__ */ React__default["default"].createElement(
184
+ )), /* @__PURE__ */ React__default.default.createElement(ui.Field, { label: "Secret Access Key", htmlFor: "secretKey" }, ((_e = props.options.secureJsonFields) == null ? void 0 : _e.secretKey) ? /* @__PURE__ */ React__default.default.createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default.default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }), /* @__PURE__ */ React__default.default.createElement(
202
185
  ui.ToolbarButton,
203
186
  {
204
187
  id: "secretKey",
@@ -207,14 +190,14 @@ const ConnectionConfig = (props) => {
207
190
  tooltip: "Edit Secret Access Key",
208
191
  onClick: data.onUpdateDatasourceResetOption(props, "secretKey")
209
192
  }
210
- )) : /* @__PURE__ */ React__default["default"].createElement(
193
+ )) : /* @__PURE__ */ React__default.default.createElement(
211
194
  ui.Input,
212
195
  {
213
196
  id: "secretKey",
214
197
  value: (_g = (_f = options.secureJsonData) == null ? void 0 : _f.secretKey) != null ? _g : "",
215
198
  onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "secretKey")
216
199
  }
217
- )))), /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSubSection, { title: "Assume Role" }, options.jsonData.authType === AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement("div", { className: assumeRoleInstructionsStyle }, /* @__PURE__ */ React__default["default"].createElement(
200
+ )))), /* @__PURE__ */ React__default.default.createElement(experimental.ConfigSubSection, { title: "Assume Role" }, options.jsonData.authType === AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default.default.createElement("div", { className: assumeRoleInstructionsStyle }, /* @__PURE__ */ React__default.default.createElement(
218
201
  ui.Collapse,
219
202
  {
220
203
  label: "How to create an IAM role for grafana to assume:",
@@ -222,7 +205,7 @@ const ConnectionConfig = (props) => {
222
205
  isOpen: isARNInstructionsOpen,
223
206
  onToggle: () => setIsARNInstructionsOpen(!isARNInstructionsOpen)
224
207
  },
225
- /* @__PURE__ */ React__default["default"].createElement("ol", null, /* @__PURE__ */ React__default["default"].createElement("li", null, /* @__PURE__ */ React__default["default"].createElement("p", null, "1. Create a new IAM role in the AWS console, and select ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Another AWS account"), " as the", " ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Trusted entity"), ".")), /* @__PURE__ */ React__default["default"].createElement("li", null, /* @__PURE__ */ React__default["default"].createElement("p", null, "2. Enter the account ID of the Grafana account that has permission to assume this role:", /* @__PURE__ */ React__default["default"].createElement("code", null, " 008923505280 "), " and check the ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Require external ID"), " box.")), /* @__PURE__ */ React__default["default"].createElement("li", null, /* @__PURE__ */ React__default["default"].createElement("p", null, "3. Enter the following external ID:", " ", /* @__PURE__ */ React__default["default"].createElement("code", null, props.externalId || "External Id is currently unavailable"), " and click", " ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Next"), ".")), /* @__PURE__ */ React__default["default"].createElement("li", null, /* @__PURE__ */ React__default["default"].createElement("p", null, "4. Add any required permissions you would like Grafana to be able to access on your behalf. For more details on our permissions please", " ", /* @__PURE__ */ React__default["default"].createElement(
208
+ /* @__PURE__ */ React__default.default.createElement("ol", null, /* @__PURE__ */ React__default.default.createElement("li", null, /* @__PURE__ */ React__default.default.createElement("p", null, "1. Create a new IAM role in the AWS console, and select ", /* @__PURE__ */ React__default.default.createElement("code", null, "Another AWS account"), " as the", " ", /* @__PURE__ */ React__default.default.createElement("code", null, "Trusted entity"), ".")), /* @__PURE__ */ React__default.default.createElement("li", null, /* @__PURE__ */ React__default.default.createElement("p", null, "2. Enter the account ID of the Grafana account that has permission to assume this role:", /* @__PURE__ */ React__default.default.createElement("code", null, " 008923505280 "), " and check the ", /* @__PURE__ */ React__default.default.createElement("code", null, "Require external ID"), " box.")), /* @__PURE__ */ React__default.default.createElement("li", null, /* @__PURE__ */ React__default.default.createElement("p", null, "3. Enter the following external ID:", " ", /* @__PURE__ */ React__default.default.createElement("code", null, props.externalId || "External Id is currently unavailable"), " and click", " ", /* @__PURE__ */ React__default.default.createElement("code", null, "Next"), ".")), /* @__PURE__ */ React__default.default.createElement("li", null, /* @__PURE__ */ React__default.default.createElement("p", null, "4. Add any required permissions you would like Grafana to be able to access on your behalf. For more details on our permissions please", " ", /* @__PURE__ */ React__default.default.createElement(
226
209
  "a",
227
210
  {
228
211
  href: "https://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/",
@@ -230,15 +213,15 @@ const ConnectionConfig = (props) => {
230
213
  rel: "noreferrer"
231
214
  },
232
215
  "read through our documentation"
233
- ), ".")), /* @__PURE__ */ React__default["default"].createElement("li", null, /* @__PURE__ */ React__default["default"].createElement("p", null, "5. Give the role a name and description, and click ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Create role"), ".")), /* @__PURE__ */ React__default["default"].createElement("li", null, /* @__PURE__ */ React__default["default"].createElement("p", null, "6. Copy the ARN of the role you just created and paste it into the ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Assume Role ARN"), " ", "field below.")))
234
- )), awsAssumeRoleEnabled && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(
216
+ ), ".")), /* @__PURE__ */ React__default.default.createElement("li", null, /* @__PURE__ */ React__default.default.createElement("p", null, "5. Give the role a name and description, and click ", /* @__PURE__ */ React__default.default.createElement("code", null, "Create role"), ".")), /* @__PURE__ */ React__default.default.createElement("li", null, /* @__PURE__ */ React__default.default.createElement("p", null, "6. Copy the ARN of the role you just created and paste it into the ", /* @__PURE__ */ React__default.default.createElement("code", null, "Assume Role ARN"), " ", "field below.")))
217
+ )), awsAssumeRoleEnabled && /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
235
218
  ui.Field,
236
219
  {
237
220
  htmlFor: "assumeRoleArn",
238
221
  label: "Assume Role ARN",
239
222
  description: "Optional. Specifying the ARN of a role will ensure that the\n selected authentication provider is used to assume the role rather than the\n credentials directly."
240
223
  },
241
- /* @__PURE__ */ React__default["default"].createElement(
224
+ /* @__PURE__ */ React__default.default.createElement(
242
225
  ui.Input,
243
226
  {
244
227
  id: "assumeRoleArn",
@@ -247,14 +230,14 @@ const ConnectionConfig = (props) => {
247
230
  onChange: data.onUpdateDatasourceJsonDataOption(props, "assumeRoleArn")
248
231
  }
249
232
  )
250
- ), options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
233
+ ), options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default.default.createElement(
251
234
  ui.Field,
252
235
  {
253
236
  htmlFor: "externalId",
254
237
  label: "External ID",
255
238
  description: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."
256
239
  },
257
- /* @__PURE__ */ React__default["default"].createElement(
240
+ /* @__PURE__ */ React__default.default.createElement(
258
241
  ui.Input,
259
242
  {
260
243
  id: "externalId",
@@ -263,14 +246,14 @@ const ConnectionConfig = (props) => {
263
246
  onChange: data.onUpdateDatasourceJsonDataOption(props, "externalId")
264
247
  }
265
248
  )
266
- ))), /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSubSection, { title: "Additional Settings" }, !skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
249
+ ))), /* @__PURE__ */ React__default.default.createElement(experimental.ConfigSubSection, { title: "Additional Settings" }, !skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default.default.createElement(
267
250
  ui.Field,
268
251
  {
269
252
  label: "Endpoint",
270
253
  description: "Optionally, specify a custom endpoint for the service",
271
254
  htmlFor: "endpoint"
272
255
  },
273
- /* @__PURE__ */ React__default["default"].createElement(
256
+ /* @__PURE__ */ React__default.default.createElement(
274
257
  ui.Input,
275
258
  {
276
259
  id: "endpoint",
@@ -279,14 +262,14 @@ const ConnectionConfig = (props) => {
279
262
  onChange: data.onUpdateDatasourceJsonDataOption(props, "endpoint")
280
263
  }
281
264
  )
282
- ), /* @__PURE__ */ React__default["default"].createElement(
265
+ ), /* @__PURE__ */ React__default.default.createElement(
283
266
  ui.Field,
284
267
  {
285
268
  label: "Default Region",
286
269
  description: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.",
287
270
  htmlFor: "defaultRegion"
288
271
  },
289
- /* @__PURE__ */ React__default["default"].createElement(
272
+ /* @__PURE__ */ React__default.default.createElement(
290
273
  ui.Select,
291
274
  {
292
275
  inputId: "defaultRegion",
@@ -347,9 +330,9 @@ function isVersionGtOrEq(a, b) {
347
330
  function Divider() {
348
331
  const theme = ui.useTheme2();
349
332
  if (isVersionGtOrEq(runtime.config.buildInfo.version, "10.1.0")) {
350
- return /* @__PURE__ */ React__default["default"].createElement(ui.Divider, null);
333
+ return /* @__PURE__ */ React__default.default.createElement(ui.Divider, null);
351
334
  }
352
- return /* @__PURE__ */ React__default["default"].createElement(
335
+ return /* @__PURE__ */ React__default.default.createElement(
353
336
  "div",
354
337
  {
355
338
  style: { borderTop: `1px solid ${theme.colors.border.weak}`, margin: theme.spacing(2, 0), width: "100%" }
@@ -357,40 +340,23 @@ function Divider() {
357
340
  );
358
341
  }
359
342
 
360
- var __defProp$6 = Object.defineProperty;
361
- var __defProps$5 = Object.defineProperties;
362
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
363
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
364
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
365
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
366
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
367
- var __spreadValues$6 = (a, b) => {
368
- for (var prop in b || (b = {}))
369
- if (__hasOwnProp$6.call(b, prop))
370
- __defNormalProp$6(a, prop, b[prop]);
371
- if (__getOwnPropSymbols$6)
372
- for (var prop of __getOwnPropSymbols$6(b)) {
373
- if (__propIsEnum$6.call(b, prop))
374
- __defNormalProp$6(a, prop, b[prop]);
375
- }
376
- return a;
377
- };
378
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
379
343
  const SIGV4ConnectionConfig = (props) => {
380
344
  var _a, _b, _c, _d;
381
345
  const { onOptionsChange, options } = props;
382
346
  const connectionConfigProps = {
383
347
  onOptionsChange: (awsDataSourceSettings) => {
384
348
  var _a2, _b2, _c2, _d2;
385
- const dataSourceSettings = __spreadProps$5(__spreadValues$6({}, options), {
386
- jsonData: __spreadProps$5(__spreadValues$6({}, options.jsonData), {
349
+ const dataSourceSettings = {
350
+ ...options,
351
+ jsonData: {
352
+ ...options.jsonData,
387
353
  sigV4AuthType: awsDataSourceSettings.jsonData.authType,
388
354
  sigV4Profile: awsDataSourceSettings.jsonData.profile,
389
355
  sigV4AssumeRoleArn: awsDataSourceSettings.jsonData.assumeRoleArn,
390
356
  sigV4ExternalId: awsDataSourceSettings.jsonData.externalId,
391
357
  sigV4Region: awsDataSourceSettings.jsonData.defaultRegion,
392
358
  sigV4Endpoint: awsDataSourceSettings.jsonData.endpoint
393
- }),
359
+ },
394
360
  secureJsonFields: {
395
361
  sigV4AccessKey: (_a2 = awsDataSourceSettings.secureJsonFields) == null ? void 0 : _a2.accessKey,
396
362
  sigV4SecretKey: (_b2 = awsDataSourceSettings.secureJsonFields) == null ? void 0 : _b2.secretKey
@@ -399,18 +365,20 @@ const SIGV4ConnectionConfig = (props) => {
399
365
  sigV4AccessKey: (_c2 = awsDataSourceSettings.secureJsonData) == null ? void 0 : _c2.accessKey,
400
366
  sigV4SecretKey: (_d2 = awsDataSourceSettings.secureJsonData) == null ? void 0 : _d2.secretKey
401
367
  }
402
- });
368
+ };
403
369
  onOptionsChange(dataSourceSettings);
404
370
  },
405
- options: __spreadProps$5(__spreadValues$6({}, options), {
406
- jsonData: __spreadProps$5(__spreadValues$6({}, options.jsonData), {
371
+ options: {
372
+ ...options,
373
+ jsonData: {
374
+ ...options.jsonData,
407
375
  authType: options.jsonData.sigV4AuthType,
408
376
  profile: options.jsonData.sigV4Profile,
409
377
  assumeRoleArn: options.jsonData.sigV4AssumeRoleArn,
410
378
  externalId: options.jsonData.sigV4ExternalId,
411
379
  defaultRegion: options.jsonData.sigV4Region,
412
380
  endpoint: options.jsonData.sigV4Endpoint
413
- }),
381
+ },
414
382
  secureJsonFields: {
415
383
  accessKey: (_a = options.secureJsonFields) == null ? void 0 : _a.sigV4AccessKey,
416
384
  secretKey: (_b = options.secureJsonFields) == null ? void 0 : _b.sigV4SecretKey
@@ -419,33 +387,14 @@ const SIGV4ConnectionConfig = (props) => {
419
387
  accessKey: (_c = options.secureJsonData) == null ? void 0 : _c.sigV4AccessKey,
420
388
  secretKey: (_d = options.secureJsonData) == null ? void 0 : _d.sigV4SecretKey
421
389
  }
422
- }),
390
+ },
423
391
  inExperimentalAuthComponent: props.inExperimentalAuthComponent
424
392
  };
425
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", { className: "gf-form" }, /* @__PURE__ */ React__default["default"].createElement("h6", null, "SigV4 Auth Details")), /* @__PURE__ */ React__default["default"].createElement(ConnectionConfig, __spreadProps$5(__spreadValues$6({}, connectionConfigProps), { skipHeader: true, skipEndpoint: true })));
393
+ return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("div", { className: "gf-form" }, /* @__PURE__ */ React__default.default.createElement("h6", null, "SigV4 Auth Details")), /* @__PURE__ */ React__default.default.createElement(ConnectionConfig, { ...connectionConfigProps, skipHeader: true, skipEndpoint: true }));
426
394
  };
427
395
 
428
396
  const defaultKey = "__default";
429
397
 
430
- var __defProp$5 = Object.defineProperty;
431
- var __defProps$4 = Object.defineProperties;
432
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
433
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
434
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
435
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
436
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
437
- var __spreadValues$5 = (a, b) => {
438
- for (var prop in b || (b = {}))
439
- if (__hasOwnProp$5.call(b, prop))
440
- __defNormalProp$5(a, prop, b[prop]);
441
- if (__getOwnPropSymbols$5)
442
- for (var prop of __getOwnPropSymbols$5(b)) {
443
- if (__propIsEnum$5.call(b, prop))
444
- __defNormalProp$5(a, prop, b[prop]);
445
- }
446
- return a;
447
- };
448
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
449
398
  function ResourceSelector(props) {
450
399
  const propsDependencies = props.dependencies;
451
400
  const propsOnChange = props.onChange;
@@ -526,9 +475,10 @@ function ResourceSelector(props) {
526
475
  setIsLoading(false);
527
476
  }
528
477
  };
529
- return /* @__PURE__ */ React__default["default"].createElement(
478
+ return /* @__PURE__ */ React__default.default.createElement(
530
479
  ui.Select,
531
- __spreadProps$4(__spreadValues$5({}, props), {
480
+ {
481
+ ...props,
532
482
  id: props.id,
533
483
  inputId: props.id,
534
484
  "aria-label": props.label,
@@ -538,26 +488,10 @@ function ResourceSelector(props) {
538
488
  className: props.className || "min-width-6",
539
489
  onOpenMenu: () => props.fetch && onClick(),
540
490
  menuShouldPortal: true
541
- })
491
+ }
542
492
  );
543
493
  }
544
494
 
545
- var __defProp$4 = Object.defineProperty;
546
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
547
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
548
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
549
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
550
- var __spreadValues$4 = (a, b) => {
551
- for (var prop in b || (b = {}))
552
- if (__hasOwnProp$4.call(b, prop))
553
- __defNormalProp$4(a, prop, b[prop]);
554
- if (__getOwnPropSymbols$4)
555
- for (var prop of __getOwnPropSymbols$4(b)) {
556
- if (__propIsEnum$4.call(b, prop))
557
- __defNormalProp$4(a, prop, b[prop]);
558
- }
559
- return a;
560
- };
561
495
  function ConfigSelect(props) {
562
496
  var _a, _b, _c;
563
497
  const { jsonData } = props.options;
@@ -576,9 +510,9 @@ function ConfigSelect(props) {
576
510
  (_b = props.options.secureJsonData) == null ? void 0 : _b.accessKey,
577
511
  (_c = props.options.secureJsonData) == null ? void 0 : _c.secretKey
578
512
  ].concat(props.dependencies);
579
- return /* @__PURE__ */ React__default["default"].createElement(
513
+ return /* @__PURE__ */ React__default.default.createElement(
580
514
  ResourceSelector,
581
- __spreadValues$4({
515
+ {
582
516
  id: props.id,
583
517
  label: props.label,
584
518
  "data-testid": props["data-testid"],
@@ -608,14 +542,15 @@ function ConfigSelect(props) {
608
542
  onInputChange: props.onInputChange,
609
543
  placeholder: props.placeholder,
610
544
  width: props.width,
611
- isOptionDisabled: props.isOptionDisabled
612
- }, commonProps)
545
+ isOptionDisabled: props.isOptionDisabled,
546
+ ...commonProps
547
+ }
613
548
  );
614
549
  }
615
550
 
616
551
  function InlineInput(props) {
617
552
  var _a;
618
- return /* @__PURE__ */ React__default["default"].createElement(
553
+ return /* @__PURE__ */ React__default.default.createElement(
619
554
  ui.InlineField,
620
555
  {
621
556
  label: props.label,
@@ -624,7 +559,7 @@ function InlineInput(props) {
624
559
  hidden: props.hidden,
625
560
  disabled: props.disabled
626
561
  },
627
- /* @__PURE__ */ React__default["default"].createElement(
562
+ /* @__PURE__ */ React__default.default.createElement(
628
563
  ui.Input,
629
564
  {
630
565
  "data-testid": props["data-testid"],
@@ -638,32 +573,14 @@ function InlineInput(props) {
638
573
  );
639
574
  }
640
575
 
641
- var __defProp$3 = Object.defineProperty;
642
- var __defProps$3 = Object.defineProperties;
643
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
644
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
645
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
646
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
647
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
648
- var __spreadValues$3 = (a, b) => {
649
- for (var prop in b || (b = {}))
650
- if (__hasOwnProp$3.call(b, prop))
651
- __defNormalProp$3(a, prop, b[prop]);
652
- if (__getOwnPropSymbols$3)
653
- for (var prop of __getOwnPropSymbols$3(b)) {
654
- if (__propIsEnum$3.call(b, prop))
655
- __defNormalProp$3(a, prop, b[prop]);
656
- }
657
- return a;
658
- };
659
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
660
576
  function QueryCodeEditor(props) {
661
577
  const { getSuggestions, query } = props;
662
578
  const { rawSQL } = lodash.defaults(props.query, { rawSQL: "" });
663
579
  const onRawSqlChange = (rawSQL2) => {
664
- const query2 = __spreadProps$3(__spreadValues$3({}, props.query), {
580
+ const query2 = {
581
+ ...props.query,
665
582
  rawSQL: rawSQL2
666
- });
583
+ };
667
584
  props.onChange(query2);
668
585
  props.onRunQuery();
669
586
  };
@@ -671,17 +588,18 @@ function QueryCodeEditor(props) {
671
588
  React.useEffect(() => {
672
589
  suggestionsRef.current = getSuggestions(query);
673
590
  }, [getSuggestions, query]);
674
- return /* @__PURE__ */ React__default["default"].createElement(
591
+ return /* @__PURE__ */ React__default.default.createElement(
675
592
  ui.CodeEditor,
676
- __spreadValues$3({
593
+ {
677
594
  language: props.language,
678
595
  value: rawSQL,
679
596
  onBlur: onRawSqlChange,
680
597
  showMiniMap: false,
681
598
  showLineNumbers: true,
682
599
  getSuggestions: () => suggestionsRef.current,
683
- height: "240px"
684
- }, props.editorProps)
600
+ height: "240px",
601
+ ...props.editorProps
602
+ }
685
603
  );
686
604
  }
687
605
 
@@ -695,7 +613,7 @@ function QueryEditorHeader({
695
613
  data: data$1,
696
614
  cancel
697
615
  }) {
698
- return /* @__PURE__ */ React__default["default"].createElement(experimental.EditorHeader, null, extraHeaderElementLeft, /* @__PURE__ */ React__default["default"].createElement(experimental.FlexItem, { grow: 1 }), showAsyncQueryButtons ? /* @__PURE__ */ React__default["default"].createElement(
616
+ return /* @__PURE__ */ React__default.default.createElement(experimental.EditorHeader, null, extraHeaderElementLeft, /* @__PURE__ */ React__default.default.createElement(experimental.FlexItem, { grow: 1 }), showAsyncQueryButtons ? /* @__PURE__ */ React__default.default.createElement(
699
617
  asyncQueryData.RunQueryButtons,
700
618
  {
701
619
  onRunQuery,
@@ -706,7 +624,7 @@ function QueryEditorHeader({
706
624
  },
707
625
  state: data$1 == null ? void 0 : data$1.state
708
626
  }
709
- ) : /* @__PURE__ */ React__default["default"].createElement(
627
+ ) : /* @__PURE__ */ React__default.default.createElement(
710
628
  ui.Button,
711
629
  {
712
630
  variant: enableRunButton ? "primary" : "secondary",
@@ -719,35 +637,17 @@ function QueryEditorHeader({
719
637
  ), extraHeaderElementRight);
720
638
  }
721
639
 
722
- var __defProp$2 = Object.defineProperty;
723
- var __defProps$2 = Object.defineProperties;
724
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
725
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
726
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
727
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
728
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
729
- var __spreadValues$2 = (a, b) => {
730
- for (var prop in b || (b = {}))
731
- if (__hasOwnProp$2.call(b, prop))
732
- __defNormalProp$2(a, prop, b[prop]);
733
- if (__getOwnPropSymbols$2)
734
- for (var prop of __getOwnPropSymbols$2(b)) {
735
- if (__propIsEnum$2.call(b, prop))
736
- __defNormalProp$2(a, prop, b[prop]);
737
- }
738
- return a;
739
- };
740
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
741
640
  function FormatSelect(props) {
742
641
  var _a;
743
642
  const onChangeFormat = (e) => {
744
643
  var _a2;
745
- props.onChange(__spreadProps$2(__spreadValues$2({}, props.query), {
644
+ props.onChange({
645
+ ...props.query,
746
646
  format: e.value || 0
747
- }));
647
+ });
748
648
  (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
749
649
  };
750
- return /* @__PURE__ */ React__default["default"].createElement(
650
+ return /* @__PURE__ */ React__default.default.createElement(
751
651
  ui.Select,
752
652
  {
753
653
  "aria-label": "Format data frames as",
@@ -760,25 +660,6 @@ function FormatSelect(props) {
760
660
  );
761
661
  }
762
662
 
763
- var __defProp$1 = Object.defineProperty;
764
- var __defProps$1 = Object.defineProperties;
765
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
766
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
767
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
768
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
769
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
770
- var __spreadValues$1 = (a, b) => {
771
- for (var prop in b || (b = {}))
772
- if (__hasOwnProp$1.call(b, prop))
773
- __defNormalProp$1(a, prop, b[prop]);
774
- if (__getOwnPropSymbols$1)
775
- for (var prop of __getOwnPropSymbols$1(b)) {
776
- if (__propIsEnum$1.call(b, prop))
777
- __defNormalProp$1(a, prop, b[prop]);
778
- }
779
- return a;
780
- };
781
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
782
663
  var FillValueOptions = /* @__PURE__ */ ((FillValueOptions2) => {
783
664
  FillValueOptions2[FillValueOptions2["Previous"] = 0] = "Previous";
784
665
  FillValueOptions2[FillValueOptions2["Null"] = 1] = "Null";
@@ -801,7 +682,7 @@ const SelectableFillValueOptions = [
801
682
  ];
802
683
  function FillValueSelect(props) {
803
684
  var _a, _b, _c;
804
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(experimental.EditorField, { label: "Fill with", tooltip: "value to fill missing points", htmlFor: "fillWith" }, /* @__PURE__ */ React__default["default"].createElement(
685
+ return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(experimental.EditorField, { label: "Fill with", tooltip: "value to fill missing points", htmlFor: "fillWith" }, /* @__PURE__ */ React__default.default.createElement(
805
686
  ui.Select,
806
687
  {
807
688
  id: "fillWith",
@@ -811,26 +692,29 @@ function FillValueSelect(props) {
811
692
  value: (_b = (_a = props.query.fillMode) == null ? void 0 : _a.mode) != null ? _b : 0 /* Previous */,
812
693
  onChange: ({ value }) => {
813
694
  var _a2;
814
- props.onChange(__spreadProps$1(__spreadValues$1({}, props.query), {
815
- fillMode: __spreadProps$1(__spreadValues$1({}, props.query.fillMode), { mode: value })
816
- }));
695
+ props.onChange({
696
+ ...props.query,
697
+ // Keep the fillMode.value in case FillValueOptions.Value mode is selected back
698
+ fillMode: { ...props.query.fillMode, mode: value }
699
+ });
817
700
  (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
818
701
  },
819
702
  menuShouldPortal: true
820
703
  }
821
- )), ((_c = props.query.fillMode) == null ? void 0 : _c.mode) === 2 /* Value */ && /* @__PURE__ */ React__default["default"].createElement(experimental.EditorField, { label: "Value", htmlFor: "valueToFill", width: 6 }, /* @__PURE__ */ React__default["default"].createElement(
704
+ )), ((_c = props.query.fillMode) == null ? void 0 : _c.mode) === 2 /* Value */ && /* @__PURE__ */ React__default.default.createElement(experimental.EditorField, { label: "Value", htmlFor: "valueToFill", width: 6 }, /* @__PURE__ */ React__default.default.createElement(
822
705
  ui.Input,
823
706
  {
824
707
  id: "valueToFill",
825
708
  "aria-label": "Value",
826
709
  type: "number",
827
710
  value: props.query.fillMode.value,
828
- onChange: ({ currentTarget }) => props.onChange(__spreadProps$1(__spreadValues$1({}, props.query), {
711
+ onChange: ({ currentTarget }) => props.onChange({
712
+ ...props.query,
829
713
  fillMode: {
830
714
  mode: 2 /* Value */,
831
715
  value: currentTarget.valueAsNumber
832
716
  }
833
- })),
717
+ }),
834
718
  onBlur: () => {
835
719
  var _a2;
836
720
  return (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
@@ -839,33 +723,15 @@ function FillValueSelect(props) {
839
723
  )));
840
724
  }
841
725
 
842
- var __defProp = Object.defineProperty;
843
- var __defProps = Object.defineProperties;
844
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
845
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
846
- var __hasOwnProp = Object.prototype.hasOwnProperty;
847
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
848
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
849
- var __spreadValues = (a, b) => {
850
- for (var prop in b || (b = {}))
851
- if (__hasOwnProp.call(b, prop))
852
- __defNormalProp(a, prop, b[prop]);
853
- if (__getOwnPropSymbols)
854
- for (var prop of __getOwnPropSymbols(b)) {
855
- if (__propIsEnum.call(b, prop))
856
- __defNormalProp(a, prop, b[prop]);
857
- }
858
- return a;
859
- };
860
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
861
726
  function filterSQLQuery(query) {
862
727
  return !!query.rawSQL;
863
728
  }
864
729
  function applySQLTemplateVariables(query, scopedVars, getTemplateSrv) {
865
730
  const templateSrv = getTemplateSrv();
866
- return __spreadProps(__spreadValues({}, query), {
731
+ return {
732
+ ...query,
867
733
  rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable)
868
- });
734
+ };
869
735
  }
870
736
  function interpolateVariable(value) {
871
737
  if (typeof value === "string" || typeof value === "number") {