@grafana/aws-sdk 0.3.5 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import type { DataSourceJsonData, DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n GrafanaAssumeRole = 'grafana_assume_role'\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n\nexport interface ConnectionConfigProps<\n J extends AwsAuthDataSourceJsonData = AwsAuthDataSourceJsonData,\n S = AwsAuthDataSourceSecureJsonData\n> extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n labelWidth?: number;\n inExperimentalAuthComponent?: boolean;\n externalId?: string;\n newFormStylingEnabled?: boolean;\n}\n"],"names":["AwsAuthType"],"mappings":"AAEY,IAAA,WAAA,qBAAAA,YAAL,KAAA;AACL,EAAAA,aAAA,MAAO,CAAA,GAAA,MAAA,CAAA;AACP,EAAAA,aAAA,aAAc,CAAA,GAAA,aAAA,CAAA;AACd,EAAAA,aAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AACV,EAAAA,aAAA,YAAa,CAAA,GAAA,cAAA,CAAA;AAIb,EAAAA,aAAA,KAAM,CAAA,GAAA,KAAA,CAAA;AACN,EAAAA,aAAA,mBAAoB,CAAA,GAAA,qBAAA,CAAA;AATV,EAAAA,OAAAA,YAAAA,CAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["import type { DataSourceJsonData, DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n GrafanaAssumeRole = 'grafana_assume_role'\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n\nexport interface ConnectionConfigProps<\n J extends AwsAuthDataSourceJsonData = AwsAuthDataSourceJsonData,\n S = AwsAuthDataSourceSecureJsonData\n> extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n labelWidth?: number;\n inExperimentalAuthComponent?: boolean;\n externalId?: string;\n}\n"],"names":["AwsAuthType"],"mappings":"AAEY,IAAA,WAAA,qBAAAA,YAAL,KAAA;AACL,EAAAA,aAAA,MAAO,CAAA,GAAA,MAAA,CAAA;AACP,EAAAA,aAAA,aAAc,CAAA,GAAA,aAAA,CAAA;AACd,EAAAA,aAAA,SAAU,CAAA,GAAA,SAAA,CAAA;AACV,EAAAA,aAAA,YAAa,CAAA,GAAA,cAAA,CAAA;AAIb,EAAAA,aAAA,KAAM,CAAA,GAAA,KAAA,CAAA;AACN,EAAAA,aAAA,mBAAoB,CAAA,GAAA,qBAAA,CAAA;AATV,EAAAA,OAAAA,YAAAA,CAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA;;;;"}
package/dist/index.d.ts CHANGED
@@ -39,7 +39,6 @@ interface ConnectionConfigProps<J extends AwsAuthDataSourceJsonData = AwsAuthDat
39
39
  labelWidth?: number;
40
40
  inExperimentalAuthComponent?: boolean;
41
41
  externalId?: string;
42
- newFormStylingEnabled?: boolean;
43
42
  }
44
43
 
45
44
  declare const DEFAULT_LABEL_WIDTH = 28;
@@ -85,7 +84,6 @@ interface ConfigSelectProps extends DataSourcePluginOptionsEditorProps<AwsAuthDa
85
84
  width?: number;
86
85
  isOptionDisabled?: () => boolean;
87
86
  labelWidth?: number;
88
- newFormStylingEnabled?: boolean;
89
87
  }
90
88
  declare function ConfigSelect(props: ConfigSelectProps): JSX.Element;
91
89
 
@@ -105,7 +103,6 @@ declare function InlineInput(props: InlineInputProps): JSX.Element;
105
103
  interface ResourceSelectorProps extends SelectCommonProps<string> {
106
104
  tooltip?: string;
107
105
  hidden?: boolean;
108
- newFormStylingEnabled?: boolean;
109
106
  value: string | null;
110
107
  dependencies?: DependencyList;
111
108
  id: string;
@@ -129,7 +126,6 @@ declare enum FillValueOptions {
129
126
  declare type FillValueSelectProps<TQuery extends DataQuery> = {
130
127
  query: TQuery;
131
128
  onChange: (value: TQuery) => void;
132
- newFormStylingEnabled?: boolean;
133
129
  onRunQuery?: () => void;
134
130
  };
135
131
  declare function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>): JSX.Element;
@@ -172,7 +168,6 @@ interface Props<Datasource extends DataSourceApi<TQuery, JsonData>, TQuery exten
172
168
  declare function QueryEditorHeader<Datasource extends DataSourceApi<TQuery, JsonData>, TQuery extends DataQuery, JsonData extends DataSourceJsonData>({ query, showAsyncQueryButtons, extraHeaderElementLeft, extraHeaderElementRight, enableRunButton, onRunQuery, data, cancel, }: Props<Datasource, TQuery, JsonData>): JSX.Element;
173
169
 
174
170
  declare type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {
175
- newFormStylingEnabled?: boolean;
176
171
  id?: string;
177
172
  query: TQuery;
178
173
  options: Array<SelectableValue<FormatOptions>>;
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
 
@@ -81,196 +81,6 @@ const assumeRoleInstructionsStyle = css.css({
81
81
  maxWidth: "715px"
82
82
  });
83
83
 
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
84
  var __defProp$7 = Object.defineProperty;
275
85
  var __defProps$6 = Object.defineProperties;
276
86
  var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
@@ -300,8 +110,7 @@ const ConnectionConfig = (props) => {
300
110
  var _a, _b, _c, _d, _e, _f, _g, _h;
301
111
  const [isARNInstructionsOpen, setIsARNInstructionsOpen] = React.useState(false);
302
112
  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;
113
+ const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false, options } = props;
305
114
  let profile = options.jsonData.profile;
306
115
  if (profile === void 0) {
307
116
  profile = options.database;
@@ -328,30 +137,18 @@ const ConnectionConfig = (props) => {
328
137
  }
329
138
  loadRegions().then((regions2) => setRegions(regions2.map(toOption)));
330
139
  }, [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,
140
+ 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(
141
+ ui.Field,
344
142
  {
345
143
  label: "Authentication Provider",
346
- labelWidth,
347
- tooltip: "Specify which AWS credentials chain to use.",
348
- htmlFor: "authenticationProvider"
144
+ description: "Specify which AWS credentials chain to use.",
145
+ htmlFor: "authProvider"
349
146
  },
350
147
  /* @__PURE__ */ React__default["default"].createElement(
351
148
  ui.Select,
352
149
  {
353
- inputId: "authenticationProvider",
354
- className: inputWidth,
150
+ "aria-label": "Authentication Provider",
151
+ inputId: "authProvider",
355
152
  value: currentProvider,
356
153
  options: awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value)),
357
154
  defaultValue: options.jsonData.authType,
@@ -362,24 +159,22 @@ const ConnectionConfig = (props) => {
362
159
  }
363
160
  )
364
161
  ), options.jsonData.authType === "credentials" && /* @__PURE__ */ React__default["default"].createElement(
365
- ui.InlineField,
162
+ ui.Field,
366
163
  {
367
164
  label: "Credentials Profile Name",
368
- labelWidth,
369
- tooltip: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.",
165
+ description: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.",
370
166
  htmlFor: "credentialsProfileName"
371
167
  },
372
168
  /* @__PURE__ */ React__default["default"].createElement(
373
169
  ui.Input,
374
170
  {
375
171
  id: "credentialsProfileName",
376
- className: inputWidth,
377
172
  placeholder: "default",
378
- value: profile,
173
+ value: options.jsonData.profile,
379
174
  onChange: data.onUpdateDatasourceJsonDataOption(props, "profile")
380
175
  }
381
176
  )
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(
177
+ ), 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
178
  ui.ToolbarButton,
384
179
  {
385
180
  icon: "edit",
@@ -391,13 +186,13 @@ const ConnectionConfig = (props) => {
391
186
  ui.Input,
392
187
  {
393
188
  id: "accessKeyId",
394
- className: inputWidth,
395
189
  value: (_d = (_c = options.secureJsonData) == null ? void 0 : _c.accessKey) != null ? _d : "",
396
190
  onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "accessKey")
397
191
  }
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(
192
+ )), /* @__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
193
  ui.ToolbarButton,
400
194
  {
195
+ id: "secretKey",
401
196
  icon: "edit",
402
197
  type: "button",
403
198
  tooltip: "Edit Secret Access Key",
@@ -406,12 +201,11 @@ const ConnectionConfig = (props) => {
406
201
  )) : /* @__PURE__ */ React__default["default"].createElement(
407
202
  ui.Input,
408
203
  {
409
- id: "secretAccessKey",
410
- className: inputWidth,
204
+ id: "secretKey",
411
205
  value: (_g = (_f = options.secureJsonData) == null ? void 0 : _f.secretKey) != null ? _g : "",
412
206
  onChange: data.onUpdateDatasourceSecureJsonDataOption(props, "secretKey")
413
207
  }
414
- ))), options.jsonData.authType === AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement("div", { className: assumeRoleInstructionsStyle }, /* @__PURE__ */ React__default["default"].createElement(
208
+ )))), /* @__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
209
  ui.Collapse,
416
210
  {
417
211
  label: "How to create an IAM role for grafana to assume:",
@@ -419,7 +213,7 @@ const ConnectionConfig = (props) => {
419
213
  isOpen: isARNInstructionsOpen,
420
214
  onToggle: () => setIsARNInstructionsOpen(!isARNInstructionsOpen)
421
215
  },
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(
216
+ /* @__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
217
  "a",
424
218
  {
425
219
  href: "https://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/",
@@ -429,72 +223,64 @@ const ConnectionConfig = (props) => {
429
223
  "read through our documentation"
430
224
  ), ".")), /* @__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
225
  )), awsAssumeRoleEnabled && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(
432
- ui.InlineField,
226
+ ui.Field,
433
227
  {
228
+ htmlFor: "assumeRoleArn",
434
229
  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"
230
+ 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
231
  },
439
232
  /* @__PURE__ */ React__default["default"].createElement(
440
233
  ui.Input,
441
234
  {
442
235
  id: "assumeRoleArn",
443
- className: inputWidth,
444
236
  placeholder: "arn:aws:iam:*",
445
237
  value: options.jsonData.assumeRoleArn || "",
446
238
  onChange: data.onUpdateDatasourceJsonDataOption(props, "assumeRoleArn")
447
239
  }
448
240
  )
449
241
  ), options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
450
- ui.InlineField,
242
+ ui.Field,
451
243
  {
244
+ htmlFor: "externalId",
452
245
  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"
246
+ description: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."
456
247
  },
457
248
  /* @__PURE__ */ React__default["default"].createElement(
458
249
  ui.Input,
459
250
  {
460
251
  id: "externalId",
461
- className: inputWidth,
462
252
  placeholder: "External ID",
463
253
  value: options.jsonData.externalId || "",
464
254
  onChange: data.onUpdateDatasourceJsonDataOption(props, "externalId")
465
255
  }
466
256
  )
467
- )), !skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
468
- ui.InlineField,
257
+ ))), /* @__PURE__ */ React__default["default"].createElement(experimental.ConfigSubSection, { title: "Additional Settings" }, !skipEndpoint && options.jsonData.authType !== AwsAuthType.GrafanaAssumeRole && /* @__PURE__ */ React__default["default"].createElement(
258
+ ui.Field,
469
259
  {
470
260
  label: "Endpoint",
471
- labelWidth,
472
- tooltip: "Optionally, specify a custom endpoint for the service",
261
+ description: "Optionally, specify a custom endpoint for the service",
473
262
  htmlFor: "endpoint"
474
263
  },
475
264
  /* @__PURE__ */ React__default["default"].createElement(
476
265
  ui.Input,
477
266
  {
478
267
  id: "endpoint",
479
- className: inputWidth,
480
268
  placeholder: (_h = props.defaultEndpoint) != null ? _h : "https://{service}.{region}.amazonaws.com",
481
269
  value: options.jsonData.endpoint || "",
482
270
  onChange: data.onUpdateDatasourceJsonDataOption(props, "endpoint")
483
271
  }
484
272
  )
485
273
  ), /* @__PURE__ */ React__default["default"].createElement(
486
- ui.InlineField,
274
+ ui.Field,
487
275
  {
488
276
  label: "Default Region",
489
- labelWidth,
490
- tooltip: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.",
277
+ description: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.",
491
278
  htmlFor: "defaultRegion"
492
279
  },
493
280
  /* @__PURE__ */ React__default["default"].createElement(
494
281
  ui.Select,
495
282
  {
496
283
  inputId: "defaultRegion",
497
- className: inputWidth,
498
284
  value: regions.find((region) => region.value === options.jsonData.defaultRegion),
499
285
  options: regions,
500
286
  defaultValue: options.jsonData.defaultRegion,
@@ -504,7 +290,7 @@ const ConnectionConfig = (props) => {
504
290
  menuShouldPortal: true
505
291
  }
506
292
  )
507
- ), props.children));
293
+ )), props.children));
508
294
  };
509
295
 
510
296
  const versionPattern = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z\.]+))?/;
@@ -728,7 +514,7 @@ function ResourceSelector(props) {
728
514
  setIsLoading(false);
729
515
  }
730
516
  };
731
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.newFormStylingEnabled ? /* @__PURE__ */ React__default["default"].createElement(
517
+ return /* @__PURE__ */ React__default["default"].createElement(
732
518
  ui.Select,
733
519
  __spreadProps$4(__spreadValues$5({}, props), {
734
520
  id: props.id,
@@ -741,30 +527,7 @@ function ResourceSelector(props) {
741
527
  onOpenMenu: () => props.fetch && onClick(),
742
528
  menuShouldPortal: true
743
529
  })
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
- ));
530
+ );
768
531
  }
769
532
 
770
533
  var __defProp$4 = Object.defineProperty;
@@ -805,7 +568,6 @@ function ConfigSelect(props) {
805
568
  ResourceSelector,
806
569
  __spreadValues$4({
807
570
  id: props.id,
808
- newFormStylingEnabled: props.newFormStylingEnabled,
809
571
  label: props.label,
810
572
  "data-testid": props["data-testid"],
811
573
  onChange: props.onChange,
@@ -971,7 +733,7 @@ function FormatSelect(props) {
971
733
  }));
972
734
  (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
973
735
  };
974
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.newFormStylingEnabled ? /* @__PURE__ */ React__default["default"].createElement(
736
+ return /* @__PURE__ */ React__default["default"].createElement(
975
737
  ui.Select,
976
738
  {
977
739
  "aria-label": "Format data frames as",
@@ -981,17 +743,7 @@ function FormatSelect(props) {
981
743
  onChange: onChangeFormat,
982
744
  menuShouldPortal: true
983
745
  }
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
- )));
746
+ );
995
747
  }
996
748
 
997
749
  var __defProp$1 = Object.defineProperty;
@@ -1034,8 +786,8 @@ const SelectableFillValueOptions = [
1034
786
  }
1035
787
  ];
1036
788
  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(
789
+ var _a, _b, _c;
790
+ 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
791
  ui.Select,
1040
792
  {
1041
793
  id: "fillWith",
@@ -1070,40 +822,7 @@ function FillValueSelect(props) {
1070
822
  return (_a2 = props.onRunQuery) == null ? void 0 : _a2.call(props);
1071
823
  }
1072
824
  }
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
- ))));
825
+ )));
1107
826
  }
1108
827
 
1109
828
  var __defProp = Object.defineProperty;