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AC,EAAA7G,YAAD,CAAazF,SAAUmK,EAAwB3I,MAAM,uBAArD,UACE,SAAC,EAAA+K,aAAD,CAAc7K,GAAG,cAAcpB,MAAOgI,EAAgB/H,SAAUkK,KAAK+B,4BAEvE,SAACzG,EAAD,CAAcC,QAASA,EAASC,SAAUA,EAAUC,SAAUuE,KAAKgC,oBAEnE,gBA9Cd,SAACd,EAAA,EAAD,CAAM/B,SAAUA,EAAhB,UACE,SAAC+B,EAAA,WAAD,CAAeC,WAAW,OAwDpC,MACA,GADoBnC,EAAUW","sources":["webpack://grafana/./public/app/features/api-keys/ApiKeysActionBar.tsx","webpack://grafana/./public/app/features/api-keys/ApiKeysAddedModal.tsx","webpack://grafana/./public/app/features/api-keys/ApiKeysController.tsx","webpack://grafana/./public/app/features/api-keys/ApiKeysForm.tsx","webpack://grafana/./public/app/features/api-keys/ApiKeysTable.tsx","webpack://grafana/./public/app/features/api-keys/state/actions.ts","webpack://grafana/./public/app/features/api-keys/state/selectors.ts","webpack://grafana/./public/app/features/api-keys/ApiKeysPage.tsx"],"sourcesContent":["import React, { FC } from 'react';\n\nimport { Button, FilterInput } from '@grafana/ui';\n\ninterface Props {\n searchQuery: string;\n disabled: boolean;\n onAddClick: () => void;\n onSearchChange: (value: string) => void;\n}\n\nexport const ApiKeysActionBar: FC = ({ searchQuery, disabled, onAddClick, onSearchChange }) => {\n return (\n
\n
\n \n
\n \n
\n );\n};\n","import { css } from '@emotion/css';\nimport React, { useCallback } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Alert, Field, Modal, useStyles2, Input, Icon, ClipboardButton } from '@grafana/ui';\n\nimport { notifyApp } from '../../core/actions';\nimport { createSuccessNotification } from '../../core/copy/appNotification';\nimport { dispatch } from '../../store/store';\n\nexport interface Props {\n onDismiss: () => void;\n apiKey: string;\n rootPath: string;\n}\n\nexport function ApiKeysAddedModal({ onDismiss, apiKey, rootPath }: Props): JSX.Element {\n const styles = useStyles2(getStyles);\n const getClipboardText = useCallback(() => apiKey, [apiKey]);\n const onClipboardCopy = () => {\n dispatch(notifyApp(createSuccessNotification('Content copied to clipboard')));\n };\n return (\n \n \n \n Copy\n \n }\n />\n \n \n It is not stored in this form, so be sure to copy it now.\n \n\n

You can authenticate a request using the Authorization HTTP header, example:

\n
\n        curl -H "Authorization: Bearer {apiKey}" {rootPath}/api/dashboards/home\n      
\n
\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n label: css`\n padding: ${theme.spacing(1)};\n background-color: ${theme.colors.background.secondary};\n border-radius: ${theme.shape.borderRadius()};\n `,\n small: css`\n font-size: ${theme.typography.bodySmall.fontSize};\n font-weight: ${theme.typography.bodySmall.fontWeight};\n `,\n };\n}\n","import { FC, useCallback, useState } from 'react';\n\ninterface Api {\n isAdding: boolean;\n toggleIsAdding: () => void;\n}\n\ninterface Props {\n children: (props: Api) => JSX.Element;\n}\n\nexport const ApiKeysController: FC = ({ children }) => {\n const [isAdding, setIsAdding] = useState(false);\n const toggleIsAdding = useCallback(() => {\n setIsAdding(!isAdding);\n }, [isAdding]);\n\n return children({ isAdding, toggleIsAdding });\n};\n","import React, { ChangeEvent, FC, FormEvent, useEffect, useState } from 'react';\n\nimport { rangeUtil, SelectableValue } from '@grafana/data';\nimport { EventsWithValidation, LegacyForms, ValidationEvents, Button, Select, InlineField } from '@grafana/ui';\nimport { CloseButton } from 'app/core/components/CloseButton/CloseButton';\n\nimport { SlideDown } from '../../core/components/Animations/SlideDown';\nimport { NewApiKey, OrgRole } from '../../types';\n\nconst { Input } = LegacyForms;\nconst ROLE_OPTIONS: Array> = Object.keys(OrgRole).map((role) => ({\n label: role,\n value: role as OrgRole,\n}));\n\ninterface Props {\n show: boolean;\n onClose: () => void;\n onKeyAdded: (apiKey: NewApiKey) => void;\n disabled: boolean;\n}\n\nfunction isValidInterval(value: string): boolean {\n if (!value) {\n return true;\n }\n try {\n rangeUtil.intervalToSeconds(value);\n return true;\n } catch {}\n return false;\n}\n\nconst timeRangeValidationEvents: ValidationEvents = {\n [EventsWithValidation.onBlur]: [\n {\n rule: isValidInterval,\n errorMessage: 'Not a valid duration',\n },\n ],\n};\n\nconst tooltipText =\n 'The API key life duration. For example, 1d if your key is going to last for one day. Supported units are: s,m,h,d,w,M,y';\n\nexport const ApiKeysForm: FC = ({ show, onClose, onKeyAdded, disabled }) => {\n const [name, setName] = useState('');\n const [role, setRole] = useState(OrgRole.Viewer);\n const [secondsToLive, setSecondsToLive] = useState('');\n useEffect(() => {\n setName('');\n setRole(OrgRole.Viewer);\n setSecondsToLive('');\n }, [show]);\n\n const onSubmit = (event: FormEvent) => {\n event.preventDefault();\n if (isValidInterval(secondsToLive)) {\n onKeyAdded({ name, role, secondsToLive });\n onClose();\n }\n };\n const onNameChange = (event: ChangeEvent) => {\n setName(event.currentTarget.value);\n };\n const onRoleChange = (role: SelectableValue) => {\n setRole(role.value!);\n };\n const onSecondsToLiveChange = (event: ChangeEvent) => {\n setSecondsToLive(event.currentTarget.value);\n };\n\n return (\n \n
\n \n
\n
Add API Key
\n
\n
\n Key name\n \n
\n
\n \n