|
1 | 1 | import React, { FC, useEffect, useMemo, useState } from 'react'; |
2 | 2 | import { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet, Collapse } from '@grafana/ui'; |
3 | 3 | import { |
4 | | - DataSourcePluginOptionsEditorProps, |
5 | 4 | onUpdateDatasourceJsonDataOptionSelect, |
6 | 5 | onUpdateDatasourceResetOption, |
7 | 6 | onUpdateDatasourceJsonDataOption, |
8 | 7 | onUpdateDatasourceSecureJsonDataOption, |
9 | 8 | } from '@grafana/data'; |
10 | 9 | import { config } from '@grafana/runtime'; |
11 | 10 | import { standardRegions } from '../regions'; |
12 | | -import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from '../types'; |
| 11 | +import { AwsAuthType, ConnectionConfigProps } from '../types'; |
13 | 12 | import { awsAuthProviderOptions } from '../providers'; |
14 | | -import { css } from '@emotion/css'; |
15 | 13 | import { NewConnectionConfig } from './NewConnectionConfig'; |
| 14 | +import { assumeRoleInstructionsStyle } from './ConnectionConfig.styles'; |
16 | 15 |
|
17 | 16 | export const DEFAULT_LABEL_WIDTH = 28; |
18 | 17 | const DS_TYPES_THAT_SUPPORT_TEMP_CREDS = ['cloudwatch', 'grafana-athena-datasource']; |
19 | 18 | const toOption = (value: string) => ({ value, label: value }); |
20 | 19 | const isAwsAuthType = (value: any): value is AwsAuthType => { |
21 | 20 | return typeof value === 'string' && awsAuthProviderOptions.some((opt) => opt.value === value); |
22 | 21 | }; |
23 | | -export interface ConnectionConfigProps< |
24 | | - J extends AwsAuthDataSourceJsonData = AwsAuthDataSourceJsonData, |
25 | | - S = AwsAuthDataSourceSecureJsonData |
26 | | -> extends DataSourcePluginOptionsEditorProps<J, S> { |
27 | | - standardRegions?: string[]; |
28 | | - loadRegions?: () => Promise<string[]>; |
29 | | - defaultEndpoint?: string; |
30 | | - skipHeader?: boolean; |
31 | | - skipEndpoint?: boolean; |
32 | | - children?: React.ReactNode; |
33 | | - labelWidth?: number; |
34 | | - inExperimentalAuthComponent?: boolean; |
35 | | - externalId?: string; |
36 | | - newFormStylingEnabled?: boolean; |
37 | | -} |
38 | 22 |
|
39 | 23 | export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => { |
40 | 24 | const [isARNInstructionsOpen, setIsARNInstructionsOpen] = useState(false); |
@@ -184,9 +168,8 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon |
184 | 168 | <ol> |
185 | 169 | <li> |
186 | 170 | <p> |
187 | | - 1. Create a new IAM role in the AWS console, |
188 | | - and select <code>AWS account</code> as the Trusted entity, |
189 | | - and select <code>Another AWS account</code> as the account. |
| 171 | + 1. Create a new IAM role in the AWS console, and select <code>AWS account</code> as the Trusted |
| 172 | + entity, and select <code>Another AWS account</code> as the account. |
190 | 173 | </p> |
191 | 174 | </li> |
192 | 175 | <li> |
@@ -302,8 +285,3 @@ export const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionCon |
302 | 285 | </> |
303 | 286 | ); |
304 | 287 | }; |
305 | | - |
306 | | -export const assumeRoleInstructionsStyle = css({ |
307 | | - maxWidth: '715px', |
308 | | -}) |
309 | | - |
0 commit comments