@grafana/aws-sdk 0.3.5 → 0.4.1

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
@@ -6,8 +6,8 @@ var React = require('react');
6
6
  var ui = require('@grafana/ui');
7
7
  var data = require('@grafana/data');
8
8
  var runtime = require('@grafana/runtime');
9
- var experimental = require('@grafana/experimental');
10
9
  var css = require('@emotion/css');
10
+ var experimental = require('@grafana/experimental');
11
11
  var lodash = require('lodash');
12
12
  var asyncQueryData = require('@grafana/async-query-data');
13
13
 
@@ -22,16 +22,25 @@ const standardRegions = [
22
22
  "ap-northeast-2",
23
23
  "ap-northeast-3",
24
24
  "ap-south-1",
25
+ "ap-south-2",
25
26
  "ap-southeast-1",
26
27
  "ap-southeast-2",
28
+ "ap-southeast-3",
29
+ "ap-southeast-4",
27
30
  "ca-central-1",
31
+ "ca-west-1",
28
32
  "cn-north-1",
29
33
  "cn-northwest-1",
30
34
  "eu-central-1",
35
+ "eu-central-2",
31
36
  "eu-north-1",
37
+ "eu-south-1",
38
+ "eu-south-2",
32
39
  "eu-west-1",
33
40
  "eu-west-2",
34
41
  "eu-west-3",
42
+ "il-central-1",
43
+ "me-central-1",
35
44
  "me-south-1",
36
45
  "sa-east-1",
37
46
  "us-east-1",
@@ -81,196 +90,6 @@ const assumeRoleInstructionsStyle = css.css({
81
90
  maxWidth: "715px"
82
91
  });
83
92
 
84
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
85
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
86
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
87
- var __objRest = (source, exclude) => {
88
- var target = {};
89
- for (var prop in source)
90
- if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
91
- target[prop] = source[prop];
92
- if (source != null && __getOwnPropSymbols$8)
93
- for (var prop of __getOwnPropSymbols$8(source)) {
94
- if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
95
- target[prop] = source[prop];
96
- }
97
- return target;
98
- };
99
- const NewConnectionConfig = (_a) => {
100
- var _b = _a, {
101
- isARNInstructionsOpen,
102
- setIsARNInstructionsOpen,
103
- awsAssumeRoleEnabled,
104
- currentProvider,
105
- awsAllowedAuthProviders,
106
- skipHeader,
107
- regions
108
- } = _b, props = __objRest(_b, [
109
- "isARNInstructionsOpen",
110
- "setIsARNInstructionsOpen",
111
- "awsAssumeRoleEnabled",
112
- "currentProvider",
113
- "awsAllowedAuthProviders",
114
- "skipHeader",
115
- "regions"
116
- ]);
117
- var _a2, _b2, _c, _d, _e, _f, _g;
118
- const options = props.options;
119
- 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(
120
- ui.Field,
121
- {
122
- label: "Authentication Provider",
123
- description: "Specify which AWS credentials chain to use.",
124
- htmlFor: "authProvider"
125
- },
126
- /* @__PURE__ */ React__default["default"].createElement(
127
- ui.Select,
128
- {
129
- inputId: "authProvider",
130
- value: currentProvider,
131
- options: awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value)),
132
- defaultValue: options.jsonData.authType,
133
- onChange: (option) => {
134
- data.onUpdateDatasourceJsonDataOptionSelect(props, "authType")(option);
135
- },
136
- menuShouldPortal: true
137
- }
138
- )
139
- ), options.jsonData.authType === "credentials" && /* @__PURE__ */ React__default["default"].createElement(
140
- ui.Field,
141
- {
142
- label: "Credentials Profile Name",
143
- description: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.",
144
- htmlFor: "credentialsProfileName"
145
- },
146
- /* @__PURE__ */ React__default["default"].createElement(
147
- ui.Input,
148
- {
149
- id: "credentialsProfileName",
150
- placeholder: "default",
151
- value: options.jsonData.profile,
152
- onChange: data.onUpdateDatasourceJsonDataOption(props, "profile")
153
- }
154
- )
155
- ), 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" }, ((_a2 = props.options.secureJsonFields) == null ? void 0 : _a2.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(
156
- ui.ToolbarButton,
157
- {
158
- icon: "edit",
159
- tooltip: "Edit Access Key ID",
160
- type: "button",
161
- onClick: data.onUpdateDatasourceResetOption(props, "accessKey")
162
- }
163
- )) : /* @__PURE__ */ React__default["default"].createElement(
164
- ui.Input,
165
- {
166
- id: "accessKeyId",
167
- value: (_c = (_b2 = options.secureJsonData) == null ? void 0 : _b2.accessKey) != null ? _c : "",
168
- onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "accessKey")
169
- }
170
- )), /* @__PURE__ */ React__default["default"].createElement(ui.Field, { label: "Secret Access Key", htmlFor: "secretKey" }, ((_d = props.options.secureJsonFields) == null ? void 0 : _d.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(
171
- ui.ToolbarButton,
172
- {
173
- id: "secretKey",
174
- icon: "edit",
175
- type: "button",
176
- tooltip: "Edit Secret Access Key",
177
- onClick: data.onUpdateDatasourceResetOption(props, "secretKey")
178
- }
179
- )) : /* @__PURE__ */ React__default["default"].createElement(
180
- ui.Input,
181
- {
182
- id: "secretKey",
183
- value: (_f = (_e = options.secureJsonData) == null ? void 0 : _e.secretKey) != null ? _f : "",
184
- onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "secretKey")
185
- }
186
- )))), /* @__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(
187
- ui.Collapse,
188
- {
189
- label: "How to create an IAM role for grafana to assume:",
190
- collapsible: true,
191
- isOpen: isARNInstructionsOpen,
192
- onToggle: () => setIsARNInstructionsOpen(!isARNInstructionsOpen)
193
- },
194
- /* @__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(
195
- "a",
196
- {
197
- href: "https://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/",
198
- target: "_blank",
199
- rel: "noreferrer"
200
- },
201
- "read through our documentation"
202
- ), ".")), /* @__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.")))
203
- )), awsAssumeRoleEnabled && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(
204
- ui.Field,
205
- {
206
- htmlFor: "assumeRoleArn",
207
- label: "Assume Role ARN",
208
- 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."
209
- },
210
- /* @__PURE__ */ React__default["default"].createElement(
211
- ui.Input,
212
- {
213
- id: "assumeRoleArn",
214
- placeholder: "arn:aws:iam:*",
215
- value: options.jsonData.assumeRoleArn || "",
216
- onChange: data.onUpdateDatasourceJsonDataOption(props, "assumeRoleArn")
217
- }
218
- )
219
- ), options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
220
- ui.Field,
221
- {
222
- htmlFor: "externalId",
223
- label: "External ID",
224
- description: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."
225
- },
226
- /* @__PURE__ */ React__default["default"].createElement(
227
- ui.Input,
228
- {
229
- id: "externalId",
230
- placeholder: "External ID",
231
- value: options.jsonData.externalId || "",
232
- onChange: data.onUpdateDatasourceJsonDataOption(props, "externalId")
233
- }
234
- )
235
- ))), /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSubSection, { title: "Additional Settings" }, !props.skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
236
- ui.Field,
237
- {
238
- label: "Endpoint",
239
- description: "Optionally, specify a custom endpoint for the service",
240
- htmlFor: "endpoint"
241
- },
242
- /* @__PURE__ */ React__default["default"].createElement(
243
- ui.Input,
244
- {
245
- id: "endpoint",
246
- placeholder: (_g = props.defaultEndpoint) != null ? _g : "https://{service}.{region}.amazonaws.com",
247
- value: options.jsonData.endpoint || "",
248
- onChange: data.onUpdateDatasourceJsonDataOption(props, "endpoint")
249
- }
250
- )
251
- ), /* @__PURE__ */ React__default["default"].createElement(
252
- ui.Field,
253
- {
254
- label: "Default Region",
255
- description: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.",
256
- htmlFor: "defaultRegion"
257
- },
258
- /* @__PURE__ */ React__default["default"].createElement(
259
- ui.Select,
260
- {
261
- inputId: "defaultRegion",
262
- value: regions.find((region) => region.value === options.jsonData.defaultRegion),
263
- options: regions,
264
- defaultValue: options.jsonData.defaultRegion,
265
- allowCustomValue: true,
266
- onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, "defaultRegion"),
267
- formatCreateLabel: (r) => `Use region: ${r}`,
268
- menuShouldPortal: true
269
- }
270
- )
271
- )), props.children));
272
- };
273
-
274
93
  var __defProp$7 = Object.defineProperty;
275
94
  var __defProps$6 = Object.defineProperties;
276
95
  var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
@@ -297,11 +116,10 @@ const isAwsAuthType = (value) => {
297
116
  return typeof value === "string" && awsAuthProviderOptions.some((opt) => opt.value === value);
298
117
  };
299
118
  const ConnectionConfig = (props) => {
300
- var _a, _b, _c, _d, _e, _f, _g, _h;
119
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
301
120
  const [isARNInstructionsOpen, setIsARNInstructionsOpen] = React.useState(false);
302
121
  const [regions, setRegions] = React.useState((props.standardRegions || standardRegions).map(toOption));
303
- const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;
304
- const { labelWidth = DEFAULT_LABEL_WIDTH, options, inExperimentalAuthComponent } = props;
122
+ const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false, options } = props;
305
123
  let profile = options.jsonData.profile;
306
124
  if (profile === void 0) {
307
125
  profile = options.database;
@@ -328,30 +146,18 @@ const ConnectionConfig = (props) => {
328
146
  }
329
147
  loadRegions().then((regions2) => setRegions(regions2.map(toOption)));
330
148
  }, [loadRegions]);
331
- const inputWidth = inExperimentalAuthComponent ? "width-20" : "width-30";
332
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.newFormStylingEnabled ? /* @__PURE__ */ React__default["default"].createElement(
333
- NewConnectionConfig,
334
- __spreadValues$7({
335
- currentProvider,
336
- awsAllowedAuthProviders,
337
- isARNInstructionsOpen,
338
- setIsARNInstructionsOpen,
339
- awsAssumeRoleEnabled,
340
- regions
341
- }, props)
342
- ) : /* @__PURE__ */ React__default["default"].createElement(ui.FieldSet, { label: skipHeader ? "" : "Connection Details", "data-testid": "connection-config" }, /* @__PURE__ */ React__default["default"].createElement(
343
- ui.InlineField,
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(
150
+ ui.Field,
344
151
  {
345
152
  label: "Authentication Provider",
346
- labelWidth,
347
- tooltip: "Specify which AWS credentials chain to use.",
348
- htmlFor: "authenticationProvider"
153
+ description: "Specify which AWS credentials chain to use.",
154
+ htmlFor: "authProvider"
349
155
  },
350
156
  /* @__PURE__ */ React__default["default"].createElement(
351
157
  ui.Select,
352
158
  {
353
- inputId: "authenticationProvider",
354
- className: inputWidth,
159
+ "aria-label": "Authentication Provider",
160
+ inputId: "authProvider",
355
161
  value: currentProvider,
356
162
  options: awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value)),
357
163
  defaultValue: options.jsonData.authType,
@@ -362,24 +168,22 @@ const ConnectionConfig = (props) => {
362
168
  }
363
169
  )
364
170
  ), options.jsonData.authType === "credentials" && /* @__PURE__ */ React__default["default"].createElement(
365
- ui.InlineField,
171
+ ui.Field,
366
172
  {
367
173
  label: "Credentials Profile Name",
368
- labelWidth,
369
- tooltip: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.",
174
+ description: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.",
370
175
  htmlFor: "credentialsProfileName"
371
176
  },
372
177
  /* @__PURE__ */ React__default["default"].createElement(
373
178
  ui.Input,
374
179
  {
375
180
  id: "credentialsProfileName",
376
- className: inputWidth,
377
181
  placeholder: "default",
378
- value: profile,
182
+ value: options.jsonData.profile,
379
183
  onChange: data.onUpdateDatasourceJsonDataOption(props, "profile")
380
184
  }
381
185
  )
382
- ), options.jsonData.authType === "keys" && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.InlineField, { label: "Access Key ID", htmlFor: "accessKeyId", labelWidth }, ((_b = props.options.secureJsonFields) == null ? void 0 : _b.accessKey) ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, { className: inputWidth }, /* @__PURE__ */ React__default["default"].createElement(ui.Input, { disabled: true, placeholder: "Configured" }), /* @__PURE__ */ React__default["default"].createElement(
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(
383
187
  ui.ToolbarButton,
384
188
  {
385
189
  icon: "edit",
@@ -391,13 +195,13 @@ const ConnectionConfig = (props) => {
391
195
  ui.Input,
392
196
  {
393
197
  id: "accessKeyId",
394
- className: inputWidth,
395
198
  value: (_d = (_c = options.secureJsonData) == null ? void 0 : _c.accessKey) != null ? _d : "",
396
199
  onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "accessKey")
397
200
  }
398
- )), /* @__PURE__ */ React__default["default"].createElement(ui.InlineField, { label: "Secret Access Key", htmlFor: "secretAccessKey", labelWidth }, ((_e = props.options.secureJsonFields) == null ? void 0 : _e.secretKey) ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, { className: inputWidth }, /* @__PURE__ */ React__default["default"].createElement(ui.Input, { disabled: true, placeholder: "Configured" }), /* @__PURE__ */ React__default["default"].createElement(
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(
399
202
  ui.ToolbarButton,
400
203
  {
204
+ id: "secretKey",
401
205
  icon: "edit",
402
206
  type: "button",
403
207
  tooltip: "Edit Secret Access Key",
@@ -406,12 +210,11 @@ const ConnectionConfig = (props) => {
406
210
  )) : /* @__PURE__ */ React__default["default"].createElement(
407
211
  ui.Input,
408
212
  {
409
- id: "secretAccessKey",
410
- className: inputWidth,
213
+ id: "secretKey",
411
214
  value: (_g = (_f = options.secureJsonData) == null ? void 0 : _f.secretKey) != null ? _g : "",
412
215
  onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "secretKey")
413
216
  }
414
- ))), options.jsonData.authType === AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement("div", { className: assumeRoleInstructionsStyle }, /* @__PURE__ */ React__default["default"].createElement(
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(
415
218
  ui.Collapse,
416
219
  {
417
220
  label: "How to create an IAM role for grafana to assume:",
@@ -419,7 +222,7 @@ const ConnectionConfig = (props) => {
419
222
  isOpen: isARNInstructionsOpen,
420
223
  onToggle: () => setIsARNInstructionsOpen(!isARNInstructionsOpen)
421
224
  },
422
- /* @__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, "AWS account"), " as the Trusted entity, and select ", /* @__PURE__ */ React__default["default"].createElement("code", null, "Another AWS account"), " as the account.")), /* @__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(
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(
423
226
  "a",
424
227
  {
425
228
  href: "https://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/",
@@ -429,73 +232,68 @@ const ConnectionConfig = (props) => {
429
232
  "read through our documentation"
430
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.")))
431
234
  )), awsAssumeRoleEnabled && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(
432
- ui.InlineField,
235
+ ui.Field,
433
236
  {
237
+ htmlFor: "assumeRoleArn",
434
238
  label: "Assume Role ARN",
435
- labelWidth,
436
- tooltip: "Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all",
437
- htmlFor: "assumeRoleArn"
239
+ 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."
438
240
  },
439
241
  /* @__PURE__ */ React__default["default"].createElement(
440
242
  ui.Input,
441
243
  {
442
244
  id: "assumeRoleArn",
443
- className: inputWidth,
444
245
  placeholder: "arn:aws:iam:*",
445
246
  value: options.jsonData.assumeRoleArn || "",
446
247
  onChange: data.onUpdateDatasourceJsonDataOption(props, "assumeRoleArn")
447
248
  }
448
249
  )
449
250
  ), options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
450
- ui.InlineField,
251
+ ui.Field,
451
252
  {
253
+ htmlFor: "externalId",
452
254
  label: "External ID",
453
- labelWidth,
454
- tooltip: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.",
455
- htmlFor: "externalId"
255
+ description: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."
456
256
  },
457
257
  /* @__PURE__ */ React__default["default"].createElement(
458
258
  ui.Input,
459
259
  {
460
260
  id: "externalId",
461
- className: inputWidth,
462
261
  placeholder: "External ID",
463
262
  value: options.jsonData.externalId || "",
464
263
  onChange: data.onUpdateDatasourceJsonDataOption(props, "externalId")
465
264
  }
466
265
  )
467
- )), !skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
468
- ui.InlineField,
266
+ ))), /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSubSection, { title: "Additional Settings" }, !skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
267
+ ui.Field,
469
268
  {
470
269
  label: "Endpoint",
471
- labelWidth,
472
- tooltip: "Optionally, specify a custom endpoint for the service",
270
+ description: "Optionally, specify a custom endpoint for the service",
473
271
  htmlFor: "endpoint"
474
272
  },
475
273
  /* @__PURE__ */ React__default["default"].createElement(
476
274
  ui.Input,
477
275
  {
478
276
  id: "endpoint",
479
- className: inputWidth,
480
277
  placeholder: (_h = props.defaultEndpoint) != null ? _h : "https://{service}.{region}.amazonaws.com",
481
278
  value: options.jsonData.endpoint || "",
482
279
  onChange: data.onUpdateDatasourceJsonDataOption(props, "endpoint")
483
280
  }
484
281
  )
485
282
  ), /* @__PURE__ */ React__default["default"].createElement(
486
- ui.InlineField,
283
+ ui.Field,
487
284
  {
488
285
  label: "Default Region",
489
- labelWidth,
490
- tooltip: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.",
286
+ description: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.",
491
287
  htmlFor: "defaultRegion"
492
288
  },
493
289
  /* @__PURE__ */ React__default["default"].createElement(
494
290
  ui.Select,
495
291
  {
496
292
  inputId: "defaultRegion",
497
- className: inputWidth,
498
- value: regions.find((region) => region.value === options.jsonData.defaultRegion),
293
+ value: (_i = regions.find((region) => region.value === options.jsonData.defaultRegion)) != null ? _i : options.jsonData.defaultRegion ? {
294
+ label: options.jsonData.defaultRegion,
295
+ value: options.jsonData.defaultRegion
296
+ } : void 0,
499
297
  options: regions,
500
298
  defaultValue: options.jsonData.defaultRegion,
501
299
  allowCustomValue: true,
@@ -504,7 +302,7 @@ const ConnectionConfig = (props) => {
504
302
  menuShouldPortal: true
505
303
  }
506
304
  )
507
- ), props.children));
305
+ )), props.children));
508
306
  };
509
307
 
510
308
  const versionPattern = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z\.]+))?/;
@@ -728,7 +526,7 @@ function ResourceSelector(props) {
728
526
  setIsLoading(false);
729
527
  }
730
528
  };
731
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.newFormStylingEnabled ? /* @__PURE__ */ React__default["default"].createElement(
529
+ return /* @__PURE__ */ React__default["default"].createElement(
732
530
  ui.Select,
733
531
  __spreadProps$4(__spreadValues$5({}, props), {
734
532
  id: props.id,
@@ -741,30 +539,7 @@ function ResourceSelector(props) {
741
539
  onOpenMenu: () => props.fetch && onClick(),
742
540
  menuShouldPortal: true
743
541
  })
744
- ) : /* @__PURE__ */ React__default["default"].createElement(
745
- ui.InlineField,
746
- {
747
- label: props.label,
748
- labelWidth: props.labelWidth,
749
- tooltip: props.tooltip,
750
- hidden: props.hidden,
751
- htmlFor: props.id
752
- },
753
- /* @__PURE__ */ React__default["default"].createElement("div", { "data-testid": props["data-testid"], title: props.title }, /* @__PURE__ */ React__default["default"].createElement(
754
- ui.Select,
755
- __spreadProps$4(__spreadValues$5({}, props), {
756
- id: props.id,
757
- inputId: props.id,
758
- "aria-label": props.label,
759
- options,
760
- onChange,
761
- isLoading,
762
- className: props.className || "min-width-6",
763
- onOpenMenu: () => props.fetch && onClick(),
764
- menuShouldPortal: true
765
- })
766
- ))
767
- ));
542
+ );
768
543
  }
769
544
 
770
545
  var __defProp$4 = Object.defineProperty;
@@ -805,7 +580,6 @@ function ConfigSelect(props) {
805
580
  ResourceSelector,
806
581
  __spreadValues$4({
807
582
  id: props.id,
808
- newFormStylingEnabled: props.newFormStylingEnabled,
809
583
  label: props.label,
810
584
  "data-testid": props["data-testid"],
811
585
  onChange: props.onChange,
@@ -927,7 +701,9 @@ function QueryEditorHeader({
927
701
  onRunQuery,
928
702
  enableRun: enableRunButton,
929
703
  query,
930
- onCancelQuery: cancel,
704
+ onCancelQuery: (target) => {
705
+ cancel == null ? void 0 : cancel(target);
706
+ },
931
707
  state: data$1 == null ? void 0 : data$1.state
932
708
  }
933
709
  ) : /* @__PURE__ */ React__default["default"].createElement(
@@ -971,7 +747,7 @@ function FormatSelect(props) {
971
747
  }));
972
748
  (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
973
749
  };
974
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.newFormStylingEnabled ? /* @__PURE__ */ React__default["default"].createElement(
750
+ return /* @__PURE__ */ React__default["default"].createElement(
975
751
  ui.Select,
976
752
  {
977
753
  "aria-label": "Format data frames as",
@@ -981,17 +757,7 @@ function FormatSelect(props) {
981
757
  onChange: onChangeFormat,
982
758
  menuShouldPortal: true
983
759
  }
984
- ) : /* @__PURE__ */ React__default["default"].createElement(ui.InlineField, { label: "Format as", labelWidth: 11 }, /* @__PURE__ */ React__default["default"].createElement(
985
- ui.Select,
986
- {
987
- "aria-label": "Format as",
988
- options: props.options,
989
- value: props.query.format,
990
- onChange: onChangeFormat,
991
- className: "width-12",
992
- menuShouldPortal: true
993
- }
994
- )));
760
+ );
995
761
  }
996
762
 
997
763
  var __defProp$1 = Object.defineProperty;
@@ -1034,8 +800,8 @@ const SelectableFillValueOptions = [
1034
800
  }
1035
801
  ];
1036
802
  function FillValueSelect(props) {
1037
- var _a, _b, _c, _d, _e, _f;
1038
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.newFormStylingEnabled ? /* @__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(
803
+ 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(
1039
805
  ui.Select,
1040
806
  {
1041
807
  id: "fillWith",
@@ -1070,40 +836,7 @@ function FillValueSelect(props) {
1070
836
  return (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
1071
837
  }
1072
838
  }
1073
- ))) : /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.InlineField, { label: "Fill value", tooltip: "value to fill missing points" }, /* @__PURE__ */ React__default["default"].createElement(
1074
- ui.Select,
1075
- {
1076
- "aria-label": "Fill value",
1077
- options: SelectableFillValueOptions,
1078
- value: (_e = (_d = props.query.fillMode) == null ? void 0 : _d.mode) != null ? _e : 0 /* Previous */,
1079
- onChange: ({ value }) => {
1080
- var _a2;
1081
- props.onChange(__spreadProps$1(__spreadValues$1({}, props.query), {
1082
- fillMode: __spreadProps$1(__spreadValues$1({}, props.query.fillMode), { mode: value })
1083
- }));
1084
- (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
1085
- },
1086
- className: "width-12",
1087
- menuShouldPortal: true
1088
- }
1089
- )), ((_f = props.query.fillMode) == null ? void 0 : _f.mode) === 2 /* Value */ && /* @__PURE__ */ React__default["default"].createElement(ui.InlineField, { label: "Value", labelWidth: 11 }, /* @__PURE__ */ React__default["default"].createElement(
1090
- ui.Input,
1091
- {
1092
- type: "number",
1093
- "aria-label": "Value",
1094
- value: props.query.fillMode.value,
1095
- onChange: ({ currentTarget }) => props.onChange(__spreadProps$1(__spreadValues$1({}, props.query), {
1096
- fillMode: {
1097
- mode: 2 /* Value */,
1098
- value: currentTarget.valueAsNumber
1099
- }
1100
- })),
1101
- onBlur: () => {
1102
- var _a2;
1103
- return (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
1104
- }
1105
- }
1106
- ))));
839
+ )));
1107
840
  }
1108
841
 
1109
842
  var __defProp = Object.defineProperty;