From d710507bc5c91e97950737889c7855bbddf36491 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 14 Mar 2023 07:38:21 -0700 Subject: [PATCH] Chore: Avoid explicit `React.FC` when possible (#64722) --- contribute/style-guides/styling.md | 4 ++-- .../build-a-panel-plugin-with-d3/index.md | 4 ++-- .../tutorials/build-an-app-plugin/index.md | 4 ++-- .../src/cli/templates/component.tsx.template.ts | 4 ++-- .../DataLinksInlineEditor/DataLinksListItem.tsx | 4 ++-- .../DataSourceSettings/CertificationKey.tsx | 4 ++-- .../DateTimePickers/TimeRangeInput.tsx | 6 +++--- .../TimeRangePicker/TimePickerFooter.tsx | 4 ++-- .../EmptySearchResult/EmptySearchResult.tsx | 4 ++-- .../grafana-ui/src/components/Forms/FieldSet.tsx | 4 ++-- .../src/components/Forms/InlineField.tsx | 6 +++--- .../src/components/PageLayout/PageToolbar.tsx | 6 +++--- .../src/components/Spinner/Spinner.tsx | 5 ++--- .../src/components/Table/BarGaugeCell.tsx | 4 ++-- .../src/components/Table/DefaultCell.tsx | 4 ++-- .../grafana-ui/src/components/Table/Filter.tsx | 4 ++-- .../src/components/Table/FilterList.tsx | 4 ++-- .../src/components/Table/FilterPopup.tsx | 4 ++-- .../src/components/Table/ImageCell.tsx | 4 ++-- .../src/components/Table/SparklineCell.tsx | 4 ++-- .../src/components/Table/TableCell.tsx | 4 ++-- .../grafana-ui/src/components/Tabs/Counter.tsx | 4 ++-- .../src/components/Tabs/TabContent.tsx | 4 ++-- .../src/utils/storybook/DashboardStoryCanvas.tsx | 4 ++-- .../src/utils/storybook/StoryExample.tsx | 4 ++-- public/app/core/components/Animations/FadeIn.tsx | 4 ++-- .../ForgottenPassword/ChangePassword.tsx | 4 ++-- .../ForgottenPassword/ChangePasswordPage.tsx | 4 ++-- public/app/core/components/Login/LoginForm.tsx | 4 ++-- public/app/core/components/Login/UserSignup.tsx | 4 ++-- .../components/OptionsUI/DashboardPickerByID.tsx | 6 +++--- public/app/core/components/Page/PageContents.tsx | 4 ++-- .../core/components/PageHeader/PageHeader.tsx | 4 ++-- .../core/components/PageLoader/PageLoader.tsx | 4 ++-- .../app/core/components/PageNew/PageContents.tsx | 4 ++-- .../components/PasswordField/PasswordField.tsx | 4 ++-- .../components/RolePicker/TeamRolePicker.tsx | 6 +++--- .../components/RolePicker/UserRolePicker.tsx | 6 +++--- .../app/core/components/Select/MetricSelect.tsx | 4 ++-- public/app/core/components/Signup/SignupPage.tsx | 4 ++-- public/app/features/admin/UserProfile.tsx | 4 ++-- .../features/admin/ldap/LdapConnectionStatus.tsx | 6 +++--- .../app/features/admin/ldap/LdapUserGroups.tsx | 4 ++-- public/app/features/admin/ldap/LdapUserInfo.tsx | 4 ++-- .../features/admin/ldap/LdapUserMappingInfo.tsx | 4 ++-- .../features/admin/ldap/LdapUserPermissions.tsx | 4 ++-- public/app/features/admin/ldap/LdapUserTeams.tsx | 4 ++-- .../alerting/components/BasicSettings.tsx | 6 +++--- .../alerting/components/ChannelSettings.tsx | 6 +++--- .../alerting/components/DeprecationNotice.tsx | 4 ++-- .../components/NotificationChannelForm.tsx | 6 +++--- .../components/NotificationChannelOptions.tsx | 6 +++--- .../alerting/components/NotificationSettings.tsx | 4 ++-- .../alerting/components/OptionElement.tsx | 4 ++-- .../features/alerting/unified/PanelAlertTab.tsx | 4 ++-- .../alerting/unified/PanelAlertTabContent.tsx | 4 ++-- .../unified/components/AlertManagerPicker.tsx | 4 ++-- .../components/AnnotationDetailsField.tsx | 6 +++--- .../unified/components/CollapseToggle.tsx | 6 +++--- .../unified/components/EmptyAreaWithCTA.tsx | 6 +++--- .../alerting/unified/components/HoverCard.tsx | 6 +++--- .../alerting/unified/components/Label.tsx | 6 +++--- .../alerting/unified/components/MetaText.tsx | 6 +++--- .../alerting/unified/components/RuleLocation.tsx | 6 +++--- .../alerting/unified/components/Well.tsx | 4 ++-- .../components/alert-groups/AlertDetails.tsx | 4 ++-- .../expressions/AlertConditionIndicator.tsx | 9 ++------- .../mute-timings/MuteTimingTimeRange.tsx | 4 ++-- .../components/mute-timings/MuteTimingsTable.tsx | 4 ++-- .../notification-policies/AlertGroupsSummary.tsx | 4 ++-- .../EditDefaultPolicyForm.tsx | 6 +++--- .../EditNotificationPolicyForm.tsx | 4 ++-- .../components/notification-policies/Filters.tsx | 6 +++--- .../panel-alerts-tab/NewRuleFromPanelButton.tsx | 4 ++-- .../receivers/DuplicateTemplateView.tsx | 4 ++-- .../components/receivers/EditReceiverView.tsx | 4 ++-- .../components/receivers/EditTemplateView.tsx | 4 ++-- .../components/receivers/GlobalConfigForm.tsx | 4 ++-- .../components/receivers/NewReceiverView.tsx | 4 ++-- .../components/receivers/NewTemplateView.tsx | 4 ++-- .../receivers/ReceiversAndTemplatesView.tsx | 4 ++-- .../components/receivers/ReceiversTable.tsx | 4 ++-- .../components/receivers/TemplateEditor.tsx | 4 ++-- .../components/receivers/TemplateForm.tsx | 4 ++-- .../components/receivers/TemplatesTable.tsx | 4 ++-- .../form/CloudCommonChannelSettings.tsx | 6 +++--- .../receivers/form/CloudReceiverForm.tsx | 4 ++-- .../form/GrafanaCommonChannelSettings.tsx | 6 +++--- .../receivers/form/GrafanaReceiverForm.tsx | 4 ++-- .../receivers/form/fields/KeyValueMapInput.tsx | 4 ++-- .../receivers/form/fields/StringArrayInput.tsx | 4 ++-- .../receivers/form/fields/SubformArrayField.tsx | 4 ++-- .../receivers/form/fields/SubformField.tsx | 4 ++-- .../components/rule-editor/AlertRuleForm.tsx | 4 ++-- .../rule-editor/AnnotationKeyInput.tsx | 4 ++-- .../components/rule-editor/ExpressionEditor.tsx | 6 +++--- .../components/rule-editor/ExpressionsEditor.tsx | 6 +++--- .../rule-editor/GrafanaAlertStatePicker.tsx | 4 ++-- .../rule-editor/GroupAndNamespaceFields.tsx | 4 ++-- .../components/rule-editor/QueryEditor.tsx | 6 +++--- .../components/rule-editor/QueryWrapper.tsx | 6 +++--- .../components/rule-editor/RuleInspector.tsx | 8 ++++---- .../components/rule-editor/SelectWIthAdd.tsx | 6 +++--- .../components/rule-editor/VizWrapper.tsx | 6 +++--- .../query-and-alert-condition/AlertType.tsx | 4 ++-- .../QueryAndExpressionsStep.tsx | 4 ++-- .../rule-types/GrafanaManagedAlert.tsx | 4 ++-- .../rule-editor/rule-types/MimirOrLokiAlert.tsx | 4 ++-- .../rule-types/MimirOrLokiRecordingRule.tsx | 4 ++-- .../rule-editor/rule-types/RuleType.tsx | 4 ++-- .../rule-editor/rule-types/RuleTypePicker.tsx | 4 ++-- .../unified/components/rules/ActionButton.tsx | 4 ++-- .../unified/components/rules/ActionIcon.tsx | 6 +++--- .../components/rules/AlertInstanceDetails.tsx | 4 ++-- .../components/rules/AlertInstancesTable.tsx | 4 ++-- .../unified/components/rules/AlertStateTag.tsx | 4 ++-- .../unified/components/rules/CloudRules.tsx | 4 ++-- .../unified/components/rules/GrafanaRules.tsx | 4 ++-- .../components/rules/ReorderRuleGroupModal.tsx | 6 +++--- .../components/rules/RuleActionsButtons.tsx | 4 ++-- .../unified/components/rules/RuleDetails.tsx | 4 ++-- .../rules/RuleDetailsActionButtons.tsx | 4 ++-- .../rules/RuleDetailsFederatedSources.tsx | 4 ++-- .../unified/components/rules/RuleHealth.tsx | 4 ++-- .../components/rules/RuleListGroupView.tsx | 4 ++-- .../components/rules/RuleListStateSection.tsx | 4 ++-- .../components/rules/RuleListStateView.tsx | 4 ++-- .../unified/components/rules/RuleState.tsx | 4 ++-- .../unified/components/rules/RuleStats.tsx | 4 ++-- .../unified/components/rules/RulesGroup.tsx | 4 ++-- .../unified/components/rules/RulesTable.tsx | 6 +++--- .../unified/components/rules/StateHistory.tsx | 6 +++--- .../components/silences/AmAlertStateTag.tsx | 4 ++-- .../unified/components/silences/Matchers.tsx | 4 ++-- .../components/silences/MatchersField.tsx | 4 ++-- .../components/silences/NoSilencesCTA.tsx | 4 ++-- .../components/silences/SilenceStateTag.tsx | 6 ++---- .../components/silences/SilencedAlertsTable.tsx | 4 ++-- .../silences/SilencedAlertsTableRow.tsx | 4 ++-- .../components/silences/SilencesEditor.tsx | 4 ++-- .../components/silences/SilencesTable.tsx | 4 ++-- .../app/features/api-keys/ApiKeysActionBar.tsx | 4 ++-- public/app/features/api-keys/ApiKeysTable.tsx | 4 ++-- .../tabs/ConnectData/CardGrid/CardGrid.tsx | 4 ++-- .../tabs/ConnectData/NoResults/NoResults.tsx | 4 ++-- .../DashboardSettings/AutoRefreshIntervals.tsx | 6 +++--- .../PanelEditor/OptionsPaneCategory.tsx | 16 +++++++++++++--- .../PanelEditor/OverrideCategoryTitle.tsx | 8 ++++---- .../PanelEditor/PanelEditorTableView.test.tsx | 5 ++--- .../components/PanelEditor/PanelEditorTabs.tsx | 4 ++-- .../PanelEditor/VisualizationSelectPane.tsx | 4 ++-- .../RepeatRowSelect/RepeatRowSelect.tsx | 4 ++-- .../components/RowOptions/RowOptionsButton.tsx | 4 ++-- .../components/RowOptions/RowOptionsForm.tsx | 4 ++-- .../components/RowOptions/RowOptionsModal.tsx | 4 ++-- .../components/SubMenu/DashboardLinks.tsx | 4 ++-- .../PanelHeader/PanelHeaderLoadingIndicator.tsx | 4 ++-- .../dashgrid/PanelHeader/PanelHeaderMenuItem.tsx | 4 ++-- .../dashgrid/PanelHeader/PanelHeaderNotice.tsx | 4 ++-- .../dashgrid/PanelHeader/PanelHeaderNotices.tsx | 4 ++-- .../dashgrid/PanelStateWrapper.test.tsx | 6 +++--- .../dimensions/editors/ColorDimensionEditor.tsx | 4 ++-- .../dimensions/editors/ScaleDimensionEditor.tsx | 4 ++-- public/app/features/explore/ElapsedTime.tsx | 4 ++-- public/app/features/explore/ExploreActions.tsx | 4 ++-- public/app/features/explore/Time.tsx | 4 ++-- .../expressions/components/ClassicConditions.tsx | 4 ++-- .../app/features/expressions/components/Math.tsx | 4 ++-- .../features/expressions/components/Reduce.tsx | 4 ++-- .../features/expressions/components/Resample.tsx | 4 ++-- .../expressions/components/Threshold.tsx | 4 ++-- public/app/features/invites/SignupInvited.tsx | 4 ++-- .../PanelLibraryOptionsGroup.tsx | 4 ++-- .../components/ImportDashboardForm.tsx | 6 +++--- public/app/features/org/NewOrgPage.tsx | 4 ++-- public/app/features/org/OrgProfile.tsx | 4 ++-- public/app/features/org/SelectOrgPage.tsx | 4 ++-- .../plugins/components/PluginStateInfo.tsx | 4 ++-- .../app/features/profile/ChangePasswordForm.tsx | 4 ++-- .../app/features/profile/UserProfileEditForm.tsx | 4 ++-- .../search/components/DashboardActions.tsx | 4 ++-- .../features/search/components/SearchItem.tsx | 4 ++-- .../page/components/ConfirmDeleteModal.tsx | 4 ++-- .../search/page/components/MoveToFolderModal.tsx | 4 ++-- public/app/features/teams/TeamSettings.tsx | 4 ++-- .../adhoc/picker/AdHocFilterBuilder.tsx | 4 ++-- .../variables/adhoc/picker/AdHocFilterKey.tsx | 4 ++-- .../adhoc/picker/AdHocFilterRenderer.tsx | 6 +++--- .../variables/adhoc/picker/AdHocFilterValue.tsx | 11 ++--------- .../variables/adhoc/picker/ConditionSegment.tsx | 4 ++-- .../variables/adhoc/picker/OperatorSegment.tsx | 4 ++-- .../editor/LegacyVariableQueryEditor.tsx | 4 ++-- .../features/variables/inspect/NetworkGraph.tsx | 4 ++-- .../variables/inspect/VariableUsagesButton.tsx | 4 ++-- .../inspect/VariablesDependenciesButton.tsx | 6 +++--- .../variables/inspect/VariablesUnknownButton.tsx | 4 ++-- .../variables/pickers/shared/VariableLink.tsx | 8 ++++---- .../cloud-monitoring/components/Aggregation.tsx | 4 ++-- .../cloud-monitoring/components/Alignment.tsx | 6 +++--- .../components/AlignmentFunction.tsx | 6 +++--- .../cloud-monitoring/components/Fields.tsx | 6 +++--- .../cloudwatch/components/ConfigEditor.tsx | 4 ++-- .../cloudwatch/components/QueryHeader.tsx | 4 ++-- .../VariableQueryEditor/VariableTextField.tsx | 13 +++---------- .../loki/components/VariableQueryEditor.tsx | 4 ++-- .../prometheus/components/PromLink.tsx | 4 ++-- .../components/VariableQueryEditor.tsx | 4 ++-- .../SearchTraceQLEditor/InlineSearchField.tsx | 4 ++-- .../panel/alertlist/GroupByWithLoading.tsx | 4 ++-- .../alertlist/unified-alerting/GroupedView.tsx | 6 +++--- .../alertlist/unified-alerting/UngroupedView.tsx | 6 +++--- public/app/plugins/panel/welcome/Welcome.tsx | 4 ++-- .../app/plugins/panel/xychart/XYChartPanel2.tsx | 2 +- 213 files changed, 485 insertions(+), 498 deletions(-) diff --git a/contribute/style-guides/styling.md b/contribute/style-guides/styling.md index e6c9ab63a57..c9d4c193be2 100644 --- a/contribute/style-guides/styling.md +++ b/contribute/style-guides/styling.md @@ -13,12 +13,12 @@ To access the theme in your styles, use the `useStyles` hook. It provides basic > Please remember to put `getStyles` function at the end of the file! ```tsx -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; import { css } from '@emotion/css'; -const Foo: FC = () => { +const Foo = (props: FooProps) => { const styles = useStyles2(getStyles); // Use styles with classNames diff --git a/docs/sources/tutorials/build-a-panel-plugin-with-d3/index.md b/docs/sources/tutorials/build-a-panel-plugin-with-d3/index.md index 3638df56e06..4e77ee6d93b 100644 --- a/docs/sources/tutorials/build-a-panel-plugin-with-d3/index.md +++ b/docs/sources/tutorials/build-a-panel-plugin-with-d3/index.md @@ -48,7 +48,7 @@ Wait a minute. Manipulating documents based on data? That's sounds an awful lot In **SimplePanel.tsx**, change `SimplePanel` to return an `svg` with a `rect` element. ```ts -export const SimplePanel: React.FC = ({ options, data, width, height }) => { +export const SimplePanel = ({ options, data, width, height }: Props) => { const theme = useTheme(); return ( @@ -196,7 +196,7 @@ import * as d3 from 'd3'; interface Props extends PanelProps {} -export const SimplePanel: React.FC = ({ options, data, width, height }) => { +export const SimplePanel = ({ options, data, width, height }: Props) => { const theme = useTheme(); const values = [4, 8, 15, 16, 23, 42]; diff --git a/docs/sources/tutorials/build-an-app-plugin/index.md b/docs/sources/tutorials/build-an-app-plugin/index.md index fa2aeb03c7e..7a8bc2a6e86 100644 --- a/docs/sources/tutorials/build-an-app-plugin/index.md +++ b/docs/sources/tutorials/build-an-app-plugin/index.md @@ -65,9 +65,9 @@ Let's add a tab for managing server instances. ```ts import { AppRootProps } from '@grafana/data'; - import React, { FC } from 'react'; + import React from 'react'; - export const Instances: FC = ({ query, path, meta }) => { + export const Instances = ({ query, path, meta }: AppRootProps) => { return

Hello

; }; ``` diff --git a/packages/grafana-toolkit/src/cli/templates/component.tsx.template.ts b/packages/grafana-toolkit/src/cli/templates/component.tsx.template.ts index 7345eb529d5..4c7903597a7 100644 --- a/packages/grafana-toolkit/src/cli/templates/component.tsx.template.ts +++ b/packages/grafana-toolkit/src/cli/templates/component.tsx.template.ts @@ -1,8 +1,8 @@ -export const componentTpl = `import React, { FC } from 'react'; +export const componentTpl = `import React from 'react'; export interface Props {}; -export const <%= name %>: FC = (props) => { +export const <%= name %> = (props: Props) => { return (
Hello world!
) diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinksInlineEditor/DataLinksListItem.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinksInlineEditor/DataLinksListItem.tsx index 228da8ffe24..9ed7b744b03 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinksInlineEditor/DataLinksListItem.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinksInlineEditor/DataLinksListItem.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { DataFrame, DataLink, GrafanaTheme2 } from '@grafana/data'; @@ -18,7 +18,7 @@ export interface DataLinksListItemProps { isEditing?: boolean; } -export const DataLinksListItem: FC = ({ link, onEdit, onRemove }) => { +export const DataLinksListItem = ({ link, onEdit, onRemove }: DataLinksListItemProps) => { const theme = useTheme2(); const styles = getDataLinkListItemStyles(theme); const { title = '', url = '' } = link; diff --git a/packages/grafana-ui/src/components/DataSourceSettings/CertificationKey.tsx b/packages/grafana-ui/src/components/DataSourceSettings/CertificationKey.tsx index 20b57fc6576..6355ba9440b 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/CertificationKey.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/CertificationKey.tsx @@ -1,4 +1,4 @@ -import React, { ChangeEvent, MouseEvent, FC } from 'react'; +import React, { ChangeEvent, MouseEvent } from 'react'; import { Button } from '../Button'; import { InlineField } from '../Forms/InlineField'; @@ -15,7 +15,7 @@ interface Props { onClick: (event: MouseEvent) => void; } -export const CertificationKey: FC = ({ hasCert, label, onChange, onClick, placeholder }) => { +export const CertificationKey = ({ hasCert, label, onChange, onClick, placeholder }: Props) => { return ( diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangeInput.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangeInput.tsx index ae8f995f63e..b9d85df07d4 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangeInput.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangeInput.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, FormEvent, MouseEvent, useState } from 'react'; +import React, { FormEvent, MouseEvent, useState } from 'react'; import { dateMath, dateTime, getDefaultTimeRange, GrafanaTheme2, TimeRange, TimeZone } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -35,7 +35,7 @@ export interface TimeRangeInputProps { const noop = () => {}; -export const TimeRangeInput: FC = ({ +export const TimeRangeInput = ({ value, onChange, onChangeTimeZone = noop, @@ -46,7 +46,7 @@ export const TimeRangeInput: FC = ({ isReversed = true, hideQuickRanges = false, disabled = false, -}) => { +}: TimeRangeInputProps) => { const [isOpen, setIsOpen] = useState(false); const theme = useTheme2(); const styles = getStyles(theme, disabled); diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx index 471625df5a6..4802a79a713 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimePickerFooter.tsx @@ -1,6 +1,6 @@ import { css, cx } from '@emotion/css'; import { isString } from 'lodash'; -import React, { FC, useCallback, useState } from 'react'; +import React, { useCallback, useState } from 'react'; import { getTimeZoneInfo, GrafanaTheme2, TimeZone } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -23,7 +23,7 @@ interface Props { onChangeFiscalYearStartMonth?: (month: number) => void; } -export const TimePickerFooter: FC = (props) => { +export const TimePickerFooter = (props: Props) => { const { timeZone, fiscalYearStartMonth, diff --git a/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx b/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx index a340d7154b0..436bc87eeee 100644 --- a/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx +++ b/packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -9,7 +9,7 @@ export interface Props { children: JSX.Element | string; } -const EmptySearchResult: FC = ({ children }) => { +const EmptySearchResult = ({ children }: Props) => { const styles = useStyles2(getStyles); return
{children}
; }; diff --git a/packages/grafana-ui/src/components/Forms/FieldSet.tsx b/packages/grafana-ui/src/components/Forms/FieldSet.tsx index 11ab276b3b6..2f93e60587d 100644 --- a/packages/grafana-ui/src/components/Forms/FieldSet.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldSet.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, HTMLProps } from 'react'; +import React, { HTMLProps } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -13,7 +13,7 @@ export interface Props extends Omit, 'label'> { label?: React.ReactNode; } -export const FieldSet: FC = ({ label, children, className, ...rest }) => { +export const FieldSet = ({ label, children, className, ...rest }: Props) => { const theme = useTheme2(); const styles = getStyles(theme); diff --git a/packages/grafana-ui/src/components/Forms/InlineField.tsx b/packages/grafana-ui/src/components/Forms/InlineField.tsx index 01f3fa3a257..4596c782de3 100644 --- a/packages/grafana-ui/src/components/Forms/InlineField.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineField.tsx @@ -1,5 +1,5 @@ import { cx, css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -29,7 +29,7 @@ export interface Props extends Omit = ({ +export const InlineField = ({ children, label, tooltip, @@ -46,7 +46,7 @@ export const InlineField: FC = ({ transparent, interactive, ...htmlProps -}) => { +}: Props) => { const theme = useTheme2(); const styles = getStyles(theme, grow, shrink); const inputId = htmlFor ?? getChildId(children); diff --git a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx index 66db32d3561..0f4510c7008 100644 --- a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx +++ b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, ReactNode } from 'react'; +import React, { ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -28,7 +28,7 @@ export interface Props { } /** @alpha */ -export const PageToolbar: FC = React.memo( +export const PageToolbar = React.memo( ({ title, section, @@ -44,7 +44,7 @@ export const PageToolbar: FC = React.memo( /** main nav-container aria-label **/ 'aria-label': ariaLabel, buttonOverflowAlignment = 'right', - }) => { + }: Props) => { const styles = useStyles2(getStyles); /** diff --git a/packages/grafana-ui/src/components/Spinner/Spinner.tsx b/packages/grafana-ui/src/components/Spinner/Spinner.tsx index b5419622dd8..0267c34f806 100644 --- a/packages/grafana-ui/src/components/Spinner/Spinner.tsx +++ b/packages/grafana-ui/src/components/Spinner/Spinner.tsx @@ -1,5 +1,5 @@ import { cx, css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { stylesFactory } from '../../themes'; import { Icon } from '../Icon/Icon'; @@ -28,8 +28,7 @@ export type Props = { /** * @public */ -export const Spinner: FC = (props: Props) => { - const { className, inline = false, iconClassName, style, size = 16 } = props; +export const Spinner = ({ className, inline = false, iconClassName, style, size = 16 }: Props) => { const styles = getStyles(size, inline); return (
diff --git a/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx b/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx index f3d1f5ef9e2..4e6870f0a5f 100644 --- a/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx +++ b/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx @@ -1,5 +1,5 @@ import { isFunction } from 'lodash'; -import React, { FC } from 'react'; +import React from 'react'; import { ThresholdsConfig, ThresholdsMode, VizOrientation, getFieldConfigWithMinMax } from '@grafana/data'; import { BarGaugeDisplayMode, BarGaugeValueMode } from '@grafana/schema'; @@ -24,7 +24,7 @@ const defaultScale: ThresholdsConfig = { ], }; -export const BarGaugeCell: FC = (props) => { +export const BarGaugeCell = (props: TableCellProps) => { const { field, innerWidth, tableStyles, cell, cellProps, row } = props; const displayValue = field.display!(cell.value); const cellOptions = getCellOptions(field); diff --git a/packages/grafana-ui/src/components/Table/DefaultCell.tsx b/packages/grafana-ui/src/components/Table/DefaultCell.tsx index 9bfcdc1e675..60181560309 100644 --- a/packages/grafana-ui/src/components/Table/DefaultCell.tsx +++ b/packages/grafana-ui/src/components/Table/DefaultCell.tsx @@ -1,5 +1,5 @@ import { cx } from '@emotion/css'; -import React, { FC, ReactElement } from 'react'; +import React, { ReactElement } from 'react'; import tinycolor from 'tinycolor2'; import { DisplayValue, formattedValueToString } from '@grafana/data'; @@ -15,7 +15,7 @@ import { TableStyles } from './styles'; import { TableCellDisplayMode, TableCellProps, TableFieldOptions } from './types'; import { getCellOptions } from './utils'; -export const DefaultCell: FC = (props) => { +export const DefaultCell = (props: TableCellProps) => { const { field, cell, tableStyles, row, cellProps } = props; const inspectEnabled = Boolean((field.config.custom as TableFieldOptions)?.inspect); diff --git a/packages/grafana-ui/src/components/Table/Filter.tsx b/packages/grafana-ui/src/components/Table/Filter.tsx index dacbb223d36..056cf79464d 100644 --- a/packages/grafana-ui/src/components/Table/Filter.tsx +++ b/packages/grafana-ui/src/components/Table/Filter.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, useCallback, useMemo, useRef, useState } from 'react'; +import React, { useCallback, useMemo, useRef, useState } from 'react'; import { Field, GrafanaTheme2 } from '@grafana/data'; @@ -16,7 +16,7 @@ interface Props { field?: Field; } -export const Filter: FC = ({ column, field, tableStyles }) => { +export const Filter = ({ column, field, tableStyles }: Props) => { const ref = useRef(null); const [isPopoverVisible, setPopoverVisible] = useState(false); const styles = useStyles2(getStyles); diff --git a/packages/grafana-ui/src/components/Table/FilterList.tsx b/packages/grafana-ui/src/components/Table/FilterList.tsx index 0d914f8f134..865085748dd 100644 --- a/packages/grafana-ui/src/components/Table/FilterList.tsx +++ b/packages/grafana-ui/src/components/Table/FilterList.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useCallback, useMemo, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { FixedSizeList as List } from 'react-window'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; @@ -17,7 +17,7 @@ interface Props { const ITEM_HEIGHT = 28; const MIN_HEIGHT = ITEM_HEIGHT * 5; -export const FilterList: FC = ({ options, values, caseSensitive, onChange }) => { +export const FilterList = ({ options, values, caseSensitive, onChange }: Props) => { const theme = useTheme2(); const styles = getStyles(theme); const [searchFilter, setSearchFilter] = useState(''); diff --git a/packages/grafana-ui/src/components/Table/FilterPopup.tsx b/packages/grafana-ui/src/components/Table/FilterPopup.tsx index 3498b0b3700..304be70f812 100644 --- a/packages/grafana-ui/src/components/Table/FilterPopup.tsx +++ b/packages/grafana-ui/src/components/Table/FilterPopup.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, useCallback, useMemo, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { Field, GrafanaTheme2, SelectableValue } from '@grafana/data'; @@ -17,7 +17,7 @@ interface Props { field?: Field; } -export const FilterPopup: FC = ({ column: { preFilteredRows, filterValue, setFilter }, onClose, field }) => { +export const FilterPopup = ({ column: { preFilteredRows, filterValue, setFilter }, onClose, field }: Props) => { const theme = useTheme2(); const uniqueValues = useMemo(() => calculateUniqueFieldValues(preFilteredRows, field), [preFilteredRows, field]); const options = useMemo(() => valuesToOptions(uniqueValues), [uniqueValues]); diff --git a/packages/grafana-ui/src/components/Table/ImageCell.tsx b/packages/grafana-ui/src/components/Table/ImageCell.tsx index 9dffa16b88e..33c87d22b9f 100644 --- a/packages/grafana-ui/src/components/Table/ImageCell.tsx +++ b/packages/grafana-ui/src/components/Table/ImageCell.tsx @@ -1,5 +1,5 @@ import { cx } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { useStyles2 } from '../../themes'; import { getCellLinks } from '../../utils'; @@ -8,7 +8,7 @@ import { DataLinksContextMenu } from '../DataLinks/DataLinksContextMenu'; import { TableCellProps } from './types'; -export const ImageCell: FC = (props) => { +export const ImageCell = (props: TableCellProps) => { const { field, cell, tableStyles, row, cellProps } = props; const displayValue = field.display!(cell.value); diff --git a/packages/grafana-ui/src/components/Table/SparklineCell.tsx b/packages/grafana-ui/src/components/Table/SparklineCell.tsx index 7da625fe5a7..05fa0f5f35a 100644 --- a/packages/grafana-ui/src/components/Table/SparklineCell.tsx +++ b/packages/grafana-ui/src/components/Table/SparklineCell.tsx @@ -1,5 +1,5 @@ import { isArray } from 'lodash'; -import React, { FC } from 'react'; +import React from 'react'; import { ArrayVector, @@ -37,7 +37,7 @@ export const defaultSparklineCellConfig: GraphFieldConfig = { showPoints: VisibilityMode.Never, }; -export const SparklineCell: FC = (props) => { +export const SparklineCell = (props: TableCellProps) => { const { field, innerWidth, tableStyles, cell, cellProps } = props; const sparkline = getSparkline(cell.value); diff --git a/packages/grafana-ui/src/components/Table/TableCell.tsx b/packages/grafana-ui/src/components/Table/TableCell.tsx index 00d69ef171e..620e542a14d 100644 --- a/packages/grafana-ui/src/components/Table/TableCell.tsx +++ b/packages/grafana-ui/src/components/Table/TableCell.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Cell } from 'react-table'; import { TableStyles } from './styles'; @@ -13,7 +13,7 @@ export interface Props { userProps?: object; } -export const TableCell: FC = ({ cell, tableStyles, onCellFilterAdded, userProps }) => { +export const TableCell = ({ cell, tableStyles, onCellFilterAdded, userProps }: Props) => { const cellProps = cell.getCellProps(); const field = (cell.column as unknown as GrafanaTableColumn).field; diff --git a/packages/grafana-ui/src/components/Tabs/Counter.tsx b/packages/grafana-ui/src/components/Tabs/Counter.tsx index 7bb63b2ecd9..ccb680d87d3 100644 --- a/packages/grafana-ui/src/components/Tabs/Counter.tsx +++ b/packages/grafana-ui/src/components/Tabs/Counter.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2, locale } from '@grafana/data'; @@ -24,7 +24,7 @@ export interface CounterProps { value: number; } -export const Counter: FC = ({ value }) => { +export const Counter = ({ value }: CounterProps) => { const styles = useStyles2(getStyles); return {locale(value, 0).text}; diff --git a/packages/grafana-ui/src/components/Tabs/TabContent.tsx b/packages/grafana-ui/src/components/Tabs/TabContent.tsx index eb50ed3a974..9265ee39816 100644 --- a/packages/grafana-ui/src/components/Tabs/TabContent.tsx +++ b/packages/grafana-ui/src/components/Tabs/TabContent.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, HTMLAttributes, ReactNode } from 'react'; +import React, { HTMLAttributes, ReactNode } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; @@ -17,7 +17,7 @@ const getTabContentStyle = stylesFactory((theme: GrafanaTheme2) => { }; }); -export const TabContent: FC = ({ children, className, ...restProps }) => { +export const TabContent = ({ children, className, ...restProps }: Props) => { const theme = useTheme2(); const styles = getTabContentStyle(theme); diff --git a/packages/grafana-ui/src/utils/storybook/DashboardStoryCanvas.tsx b/packages/grafana-ui/src/utils/storybook/DashboardStoryCanvas.tsx index d887740ebe2..dbf458df7a8 100644 --- a/packages/grafana-ui/src/utils/storybook/DashboardStoryCanvas.tsx +++ b/packages/grafana-ui/src/utils/storybook/DashboardStoryCanvas.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { useTheme2 } from '../../themes'; @@ -7,7 +7,7 @@ export interface Props { children?: React.ReactNode; } -export const DashboardStoryCanvas: FC = ({ children }) => { +export const DashboardStoryCanvas = ({ children }: Props) => { const theme = useTheme2(); const style = css` width: 100%; diff --git a/packages/grafana-ui/src/utils/storybook/StoryExample.tsx b/packages/grafana-ui/src/utils/storybook/StoryExample.tsx index 8332c87509c..e26679bdb98 100644 --- a/packages/grafana-ui/src/utils/storybook/StoryExample.tsx +++ b/packages/grafana-ui/src/utils/storybook/StoryExample.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { useTheme2 } from '../../themes/ThemeContext'; @@ -8,7 +8,7 @@ export interface Props { children?: React.ReactNode; } -export const StoryExample: FC = ({ name, children }) => { +export const StoryExample = ({ name, children }: Props) => { const theme = useTheme2(); const style = css` width: 100%; diff --git a/public/app/core/components/Animations/FadeIn.tsx b/public/app/core/components/Animations/FadeIn.tsx index bf047393712..6794728726a 100644 --- a/public/app/core/components/Animations/FadeIn.tsx +++ b/public/app/core/components/Animations/FadeIn.tsx @@ -1,4 +1,4 @@ -import React, { FC, CSSProperties } from 'react'; +import React, { CSSProperties } from 'react'; import Transition, { ExitHandler } from 'react-transition-group/Transition'; interface Props { @@ -9,7 +9,7 @@ interface Props { onExited?: ExitHandler; } -export const FadeIn: FC = (props) => { +export const FadeIn = (props: Props) => { const defaultStyle: CSSProperties = { transition: `opacity ${props.duration}ms linear`, opacity: 0, diff --git a/public/app/core/components/ForgottenPassword/ChangePassword.tsx b/public/app/core/components/ForgottenPassword/ChangePassword.tsx index 3a014973cb4..f97de51947c 100644 --- a/public/app/core/components/ForgottenPassword/ChangePassword.tsx +++ b/public/app/core/components/ForgottenPassword/ChangePassword.tsx @@ -1,4 +1,4 @@ -import React, { FC, SyntheticEvent } from 'react'; +import React, { SyntheticEvent } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Tooltip, Form, Field, VerticalGroup, Button } from '@grafana/ui'; @@ -15,7 +15,7 @@ interface PasswordDTO { confirmNew: string; } -export const ChangePassword: FC = ({ onSubmit, onSkip }) => { +export const ChangePassword = ({ onSubmit, onSkip }: Props) => { const submit = (passwords: PasswordDTO) => { onSubmit(passwords.newPassword); }; diff --git a/public/app/core/components/ForgottenPassword/ChangePasswordPage.tsx b/public/app/core/components/ForgottenPassword/ChangePasswordPage.tsx index 70fe1ab4c06..cf9c1a0a419 100644 --- a/public/app/core/components/ForgottenPassword/ChangePasswordPage.tsx +++ b/public/app/core/components/ForgottenPassword/ChangePasswordPage.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; @@ -9,7 +9,7 @@ import { ChangePassword } from './ChangePassword'; export interface Props extends GrafanaRouteComponentProps<{}, { code: string }> {} -export const ChangePasswordPage: FC = (props) => { +export const ChangePasswordPage = (props: Props) => { return ( diff --git a/public/app/core/components/Login/LoginForm.tsx b/public/app/core/components/Login/LoginForm.tsx index 7798b75a748..45cdf8fa087 100644 --- a/public/app/core/components/Login/LoginForm.tsx +++ b/public/app/core/components/Login/LoginForm.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, ReactElement } from 'react'; +import React, { ReactElement } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Button, Form, Input, Field } from '@grafana/ui'; @@ -26,7 +26,7 @@ export const submitButton = css` width: 100%; `; -export const LoginForm: FC = ({ children, onSubmit, isLoggingIn, passwordHint, loginHint }) => { +export const LoginForm = ({ children, onSubmit, isLoggingIn, passwordHint, loginHint }: Props) => { return (
diff --git a/public/app/core/components/Login/UserSignup.tsx b/public/app/core/components/Login/UserSignup.tsx index 56113665b6d..04866de95d9 100644 --- a/public/app/core/components/Login/UserSignup.tsx +++ b/public/app/core/components/Login/UserSignup.tsx @@ -1,10 +1,10 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { LinkButton, VerticalGroup } from '@grafana/ui'; import { getConfig } from 'app/core/config'; -export const UserSignup: FC<{}> = () => { +export const UserSignup = () => { const href = getConfig().verifyEmailEnabled ? `${getConfig().appSubUrl}/verify` : `${getConfig().appSubUrl}/signup`; const paddingTop = css({ paddingTop: '16px' }); diff --git a/public/app/core/components/OptionsUI/DashboardPickerByID.tsx b/public/app/core/components/OptionsUI/DashboardPickerByID.tsx index 085dd1c7e0d..99a108e9f66 100644 --- a/public/app/core/components/OptionsUI/DashboardPickerByID.tsx +++ b/public/app/core/components/OptionsUI/DashboardPickerByID.tsx @@ -1,5 +1,5 @@ import debounce from 'debounce-promise'; -import React, { FC } from 'react'; +import React from 'react'; import { SelectableValue } from '@grafana/data'; import { AsyncSelect } from '@grafana/ui'; @@ -31,7 +31,7 @@ interface Props { /** * @deprecated prefer using dashboard uid rather than id */ -export const DashboardPickerByID: FC = ({ +export const DashboardPickerByID = ({ onChange: propsOnChange, value, width, @@ -41,7 +41,7 @@ export const DashboardPickerByID: FC = ({ id, optionLabel = 'label', excludedDashboards, -}) => { +}: Props) => { const debouncedSearch = debounce((query: string) => getDashboards(query || '', optionLabel, excludedDashboards), 300); const option = value ? { value, [optionLabel]: value[optionLabel] } : undefined; const onChange = (item: SelectableValue) => { diff --git a/public/app/core/components/Page/PageContents.tsx b/public/app/core/components/Page/PageContents.tsx index cfbd1b850c6..55ec042e789 100644 --- a/public/app/core/components/Page/PageContents.tsx +++ b/public/app/core/components/Page/PageContents.tsx @@ -1,6 +1,6 @@ // Libraries import { cx } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; // Components import PageLoader from '../PageLoader/PageLoader'; @@ -11,6 +11,6 @@ interface Props { className?: string; } -export const PageContents: FC = ({ isLoading, children, className }) => { +export const PageContents = ({ isLoading, children, className }: Props) => { return
{isLoading ? : children}
; }; diff --git a/public/app/core/components/PageHeader/PageHeader.tsx b/public/app/core/components/PageHeader/PageHeader.tsx index 0b151e99f57..412da8c3078 100644 --- a/public/app/core/components/PageHeader/PageHeader.tsx +++ b/public/app/core/components/PageHeader/PageHeader.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { NavModelItem, NavModelBreadcrumb, GrafanaTheme2 } from '@grafana/data'; import { Tab, TabsBar, Icon, useStyles2, toIconName } from '@grafana/ui'; @@ -86,7 +86,7 @@ const Navigation = ({ children }: { children: NavModelItem[] }) => { ); }; -export const PageHeader: FC = ({ navItem: model, renderTitle, actions, info, subTitle }) => { +export const PageHeader = ({ navItem: model, renderTitle, actions, info, subTitle }: Props) => { const styles = useStyles2(getStyles); if (!model) { diff --git a/public/app/core/components/PageLoader/PageLoader.tsx b/public/app/core/components/PageLoader/PageLoader.tsx index d7aee52c271..177f18f54ce 100644 --- a/public/app/core/components/PageLoader/PageLoader.tsx +++ b/public/app/core/components/PageLoader/PageLoader.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { LoadingPlaceholder } from '@grafana/ui'; @@ -6,7 +6,7 @@ interface Props { pageName?: string; } -const PageLoader: FC = ({ pageName = '' }) => { +const PageLoader = ({ pageName = '' }: Props) => { const loadingText = `Loading ${pageName}...`; return (
diff --git a/public/app/core/components/PageNew/PageContents.tsx b/public/app/core/components/PageNew/PageContents.tsx index 81f60408e8d..1246443139a 100644 --- a/public/app/core/components/PageNew/PageContents.tsx +++ b/public/app/core/components/PageNew/PageContents.tsx @@ -1,5 +1,5 @@ // Libraries -import React, { FC } from 'react'; +import React from 'react'; import PageLoader from '../PageLoader/PageLoader'; @@ -9,7 +9,7 @@ interface Props { className?: string; } -export const PageContents: FC = ({ isLoading, children, className }) => { +export const PageContents = ({ isLoading, children, className }: Props) => { let content = className ?
{children}
: children; return <>{isLoading ? : content}; diff --git a/public/app/core/components/PasswordField/PasswordField.tsx b/public/app/core/components/PasswordField/PasswordField.tsx index 1571f17186d..03811be74a2 100644 --- a/public/app/core/components/PasswordField/PasswordField.tsx +++ b/public/app/core/components/PasswordField/PasswordField.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from 'react'; +import React, { useState } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Input, IconButton } from '@grafana/ui'; @@ -10,7 +10,7 @@ export interface Props { passwordHint?: string; } -export const PasswordField: FC = React.forwardRef( +export const PasswordField = React.forwardRef( ({ autoComplete, autoFocus, id, passwordHint, ...props }, ref) => { const [showPassword, setShowPassword] = useState(false); diff --git a/public/app/core/components/RolePicker/TeamRolePicker.tsx b/public/app/core/components/RolePicker/TeamRolePicker.tsx index 73e0b7f0aa8..f4dec6622a9 100644 --- a/public/app/core/components/RolePicker/TeamRolePicker.tsx +++ b/public/app/core/components/RolePicker/TeamRolePicker.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect } from 'react'; +import React, { useEffect } from 'react'; import { useAsyncFn } from 'react-use'; import { contextSrv } from 'app/core/core'; @@ -29,7 +29,7 @@ export interface Props { maxWidth?: string | number; } -export const TeamRolePicker: FC = ({ +export const TeamRolePicker = ({ teamId, roleOptions, disabled, @@ -37,7 +37,7 @@ export const TeamRolePicker: FC = ({ pendingRoles, apply = false, maxWidth, -}) => { +}: Props) => { const [{ loading, value: appliedRoles = [] }, getTeamRoles] = useAsyncFn(async () => { try { if (apply && Boolean(pendingRoles?.length)) { diff --git a/public/app/core/components/RolePicker/UserRolePicker.tsx b/public/app/core/components/RolePicker/UserRolePicker.tsx index ede86b99f3f..573b43ca54c 100644 --- a/public/app/core/components/RolePicker/UserRolePicker.tsx +++ b/public/app/core/components/RolePicker/UserRolePicker.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect } from 'react'; +import React, { useEffect } from 'react'; import { useAsyncFn } from 'react-use'; import { contextSrv } from 'app/core/core'; @@ -32,7 +32,7 @@ export interface Props { maxWidth?: string | number; } -export const UserRolePicker: FC = ({ +export const UserRolePicker = ({ basicRole, userId, orgId, @@ -44,7 +44,7 @@ export const UserRolePicker: FC = ({ onApplyRoles, pendingRoles, maxWidth, -}) => { +}: Props) => { const [{ loading, value: appliedRoles = [] }, getUserRoles] = useAsyncFn(async () => { try { if (apply && Boolean(pendingRoles?.length)) { diff --git a/public/app/core/components/Select/MetricSelect.tsx b/public/app/core/components/Select/MetricSelect.tsx index 48cfb8b52f7..cdbbc7be4a2 100644 --- a/public/app/core/components/Select/MetricSelect.tsx +++ b/public/app/core/components/Select/MetricSelect.tsx @@ -1,5 +1,5 @@ import { flatten } from 'lodash'; -import React, { useMemo, useCallback, FC } from 'react'; +import React, { useMemo, useCallback } from 'react'; import { SelectableValue } from '@grafana/data'; import { LegacyForms } from '@grafana/ui'; @@ -16,7 +16,7 @@ export interface Props { variables?: Variable[]; } -export const MetricSelect: FC = (props) => { +export const MetricSelect = (props: Props) => { const { value, placeholder, className, isSearchable, onChange } = props; const options = useSelectOptions(props); const selected = useSelectedOption(options, value); diff --git a/public/app/core/components/Signup/SignupPage.tsx b/public/app/core/components/Signup/SignupPage.tsx index c757bb753fe..d0d1bd2c434 100644 --- a/public/app/core/components/Signup/SignupPage.tsx +++ b/public/app/core/components/Signup/SignupPage.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { getBackendSrv } from '@grafana/runtime'; import { Form, Field, Input, Button, HorizontalGroup, LinkButton, FormAPI } from '@grafana/ui'; @@ -27,7 +27,7 @@ interface QueryParams { interface Props extends GrafanaRouteComponentProps<{}, QueryParams> {} -export const SignupPage: FC = (props) => { +export const SignupPage = (props: Props) => { const notifyApp = useAppNotification(); const onSubmit = async (formData: SignupDTO) => { if (formData.name === '') { diff --git a/public/app/features/admin/UserProfile.tsx b/public/app/features/admin/UserProfile.tsx index 13ac137ae42..847677f4890 100644 --- a/public/app/features/admin/UserProfile.tsx +++ b/public/app/features/admin/UserProfile.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, PureComponent, useRef, useState } from 'react'; +import React, { PureComponent, useRef, useState } from 'react'; import { Button, ConfirmButton, ConfirmModal, Input, LegacyInputStatus } from '@grafana/ui'; import { contextSrv } from 'app/core/core'; @@ -303,7 +303,7 @@ interface LockedRowProps { lockMessage?: string; } -export const LockedRow: FC = ({ label, value, lockMessage }) => { +export const LockedRow = ({ label, value, lockMessage }: LockedRowProps) => { const lockMessageClass = css` font-style: italic; margin-right: 0.6rem; diff --git a/public/app/features/admin/ldap/LdapConnectionStatus.tsx b/public/app/features/admin/ldap/LdapConnectionStatus.tsx index 6fbed0a9909..2566a3ff93c 100644 --- a/public/app/features/admin/ldap/LdapConnectionStatus.tsx +++ b/public/app/features/admin/ldap/LdapConnectionStatus.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Alert, Icon } from '@grafana/ui'; import { AppNotificationSeverity, LdapConnectionInfo, LdapServerInfo } from 'app/types'; @@ -7,7 +7,7 @@ interface Props { ldapConnectionInfo: LdapConnectionInfo; } -export const LdapConnectionStatus: FC = ({ ldapConnectionInfo }) => { +export const LdapConnectionStatus = ({ ldapConnectionInfo }: Props) => { return ( <>

LDAP Connection

@@ -50,7 +50,7 @@ interface LdapConnectionErrorProps { ldapConnectionInfo: LdapConnectionInfo; } -export const LdapErrorBox: FC = ({ ldapConnectionInfo }) => { +export const LdapErrorBox = ({ ldapConnectionInfo }: LdapConnectionErrorProps) => { const hasError = ldapConnectionInfo.some((info) => info.error); if (!hasError) { return null; diff --git a/public/app/features/admin/ldap/LdapUserGroups.tsx b/public/app/features/admin/ldap/LdapUserGroups.tsx index d2d0d80b08f..44c4361d7e6 100644 --- a/public/app/features/admin/ldap/LdapUserGroups.tsx +++ b/public/app/features/admin/ldap/LdapUserGroups.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Tooltip, Icon } from '@grafana/ui'; import { LdapRole } from 'app/types'; @@ -8,7 +8,7 @@ interface Props { showAttributeMapping?: boolean; } -export const LdapUserGroups: FC = ({ groups, showAttributeMapping }) => { +export const LdapUserGroups = ({ groups, showAttributeMapping }: Props) => { const items = showAttributeMapping ? groups : groups.filter((item) => item.orgRole); return ( diff --git a/public/app/features/admin/ldap/LdapUserInfo.tsx b/public/app/features/admin/ldap/LdapUserInfo.tsx index 51228b7d4e5..441df16acdb 100644 --- a/public/app/features/admin/ldap/LdapUserInfo.tsx +++ b/public/app/features/admin/ldap/LdapUserInfo.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { LdapUser } from 'app/types'; @@ -12,7 +12,7 @@ interface Props { showAttributeMapping?: boolean; } -export const LdapUserInfo: FC = ({ ldapUser, showAttributeMapping }) => { +export const LdapUserInfo = ({ ldapUser, showAttributeMapping }: Props) => { return ( <> diff --git a/public/app/features/admin/ldap/LdapUserMappingInfo.tsx b/public/app/features/admin/ldap/LdapUserMappingInfo.tsx index 8376ba74a07..f762aefd444 100644 --- a/public/app/features/admin/ldap/LdapUserMappingInfo.tsx +++ b/public/app/features/admin/ldap/LdapUserMappingInfo.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { LdapUserInfo } from 'app/types'; @@ -7,7 +7,7 @@ interface Props { showAttributeMapping?: boolean; } -export const LdapUserMappingInfo: FC = ({ info, showAttributeMapping }) => { +export const LdapUserMappingInfo = ({ info, showAttributeMapping }: Props) => { return (
diff --git a/public/app/features/admin/ldap/LdapUserPermissions.tsx b/public/app/features/admin/ldap/LdapUserPermissions.tsx index 526d4299f77..f31d0410da8 100644 --- a/public/app/features/admin/ldap/LdapUserPermissions.tsx +++ b/public/app/features/admin/ldap/LdapUserPermissions.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Icon } from '@grafana/ui'; import { LdapPermissions } from 'app/types'; @@ -7,7 +7,7 @@ interface Props { permissions: LdapPermissions; } -export const LdapUserPermissions: FC = ({ permissions }) => { +export const LdapUserPermissions = ({ permissions }: Props) => { return (
diff --git a/public/app/features/admin/ldap/LdapUserTeams.tsx b/public/app/features/admin/ldap/LdapUserTeams.tsx index 08c601c9159..1a29aad6e13 100644 --- a/public/app/features/admin/ldap/LdapUserTeams.tsx +++ b/public/app/features/admin/ldap/LdapUserTeams.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Tooltip, Icon } from '@grafana/ui'; import { LdapTeam } from 'app/types'; @@ -8,7 +8,7 @@ interface Props { showAttributeMapping?: boolean; } -export const LdapUserTeams: FC = ({ teams, showAttributeMapping }) => { +export const LdapUserTeams = ({ teams, showAttributeMapping }: Props) => { const items = showAttributeMapping ? teams : teams.filter((item) => item.teamName); return ( diff --git a/public/app/features/alerting/components/BasicSettings.tsx b/public/app/features/alerting/components/BasicSettings.tsx index 0e18086c5c2..6705da037ef 100644 --- a/public/app/features/alerting/components/BasicSettings.tsx +++ b/public/app/features/alerting/components/BasicSettings.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { SelectableValue } from '@grafana/data'; import { Field, Input, InputControl, Select } from '@grafana/ui'; @@ -15,7 +15,7 @@ interface Props extends NotificationSettingsProps { resetSecureField: (key: string) => void; } -export const BasicSettings: FC = ({ +export const BasicSettings = ({ control, currentFormValues, errors, @@ -24,7 +24,7 @@ export const BasicSettings: FC = ({ channels, register, resetSecureField, -}) => { +}: Props) => { return ( <> diff --git a/public/app/features/alerting/components/ChannelSettings.tsx b/public/app/features/alerting/components/ChannelSettings.tsx index 292110d723d..940863c1f3e 100644 --- a/public/app/features/alerting/components/ChannelSettings.tsx +++ b/public/app/features/alerting/components/ChannelSettings.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Alert, CollapsableSection } from '@grafana/ui'; @@ -13,7 +13,7 @@ interface Props extends NotificationSettingsProps { resetSecureField: (key: string) => void; } -export const ChannelSettings: FC = ({ +export const ChannelSettings = ({ control, currentFormValues, errors, @@ -21,7 +21,7 @@ export const ChannelSettings: FC = ({ secureFields, register, resetSecureField, -}) => { +}: Props) => { return ( {selectedChannel.info !== '' && } diff --git a/public/app/features/alerting/components/DeprecationNotice.tsx b/public/app/features/alerting/components/DeprecationNotice.tsx index c89586f3ea4..6db39c68785 100644 --- a/public/app/features/alerting/components/DeprecationNotice.tsx +++ b/public/app/features/alerting/components/DeprecationNotice.tsx @@ -1,10 +1,10 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Alert } from '@grafana/ui'; export const LOCAL_STORAGE_KEY = 'grafana.legacyalerting.unifiedalertingpromo'; -const DeprecationNotice: FC<{}> = () => ( +const DeprecationNotice = () => (

You are using Grafana legacy alerting, it has been deprecated and will be removed in the next major version of diff --git a/public/app/features/alerting/components/NotificationChannelForm.tsx b/public/app/features/alerting/components/NotificationChannelForm.tsx index 5eeb366dc80..60be00150a7 100644 --- a/public/app/features/alerting/components/NotificationChannelForm.tsx +++ b/public/app/features/alerting/components/NotificationChannelForm.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useEffect } from 'react'; +import React, { useEffect } from 'react'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; import { Button, FormAPI, HorizontalGroup, Spinner, useStyles2 } from '@grafana/ui'; @@ -26,7 +26,7 @@ export interface NotificationSettingsProps currentFormValues: NotificationChannelDTO; } -export const NotificationChannelForm: FC = ({ +export const NotificationChannelForm = ({ control, errors, selectedChannel, @@ -38,7 +38,7 @@ export const NotificationChannelForm: FC = ({ onTestChannel, resetSecureField, secureFields, -}) => { +}: Props) => { const styles = useStyles2(getStyles); useEffect(() => { diff --git a/public/app/features/alerting/components/NotificationChannelOptions.tsx b/public/app/features/alerting/components/NotificationChannelOptions.tsx index 2bd4cb7918b..c94fd994893 100644 --- a/public/app/features/alerting/components/NotificationChannelOptions.tsx +++ b/public/app/features/alerting/components/NotificationChannelOptions.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { SelectableValue } from '@grafana/data'; import { Button, Checkbox, Field, Input } from '@grafana/ui'; @@ -16,7 +16,7 @@ interface Props extends NotificationSettingsProps { onResetSecureField: (key: string) => void; } -export const NotificationChannelOptions: FC = ({ +export const NotificationChannelOptions = ({ control, currentFormValues, errors, @@ -24,7 +24,7 @@ export const NotificationChannelOptions: FC = ({ register, onResetSecureField, secureFields, -}) => { +}: Props) => { return ( <> {selectedChannelOptions.map((option: NotificationChannelOption, index: number) => { diff --git a/public/app/features/alerting/components/NotificationSettings.tsx b/public/app/features/alerting/components/NotificationSettings.tsx index 2e9ea0629e4..c88191d65fe 100644 --- a/public/app/features/alerting/components/NotificationSettings.tsx +++ b/public/app/features/alerting/components/NotificationSettings.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Checkbox, CollapsableSection, Field, InfoBox, Input } from '@grafana/ui'; @@ -8,7 +8,7 @@ interface Props extends NotificationSettingsProps { imageRendererAvailable: boolean; } -export const NotificationSettings: FC = ({ currentFormValues, imageRendererAvailable, register }) => { +export const NotificationSettings = ({ currentFormValues, imageRendererAvailable, register }: Props) => { return ( diff --git a/public/app/features/alerting/components/OptionElement.tsx b/public/app/features/alerting/components/OptionElement.tsx index ee8472bbf92..bc43c8dee85 100644 --- a/public/app/features/alerting/components/OptionElement.tsx +++ b/public/app/features/alerting/components/OptionElement.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { FormAPI, Input, InputControl, Select, TextArea } from '@grafana/ui'; @@ -9,7 +9,7 @@ interface Props extends Pick, 'register' | 'control'> { invalid?: boolean; } -export const OptionElement: FC = ({ control, option, register, invalid }) => { +export const OptionElement = ({ control, option, register, invalid }: Props) => { const modelValue = option.secure ? `secureSettings.${option.propertyName}` : `settings.${option.propertyName}`; switch (option.element) { case 'input': diff --git a/public/app/features/alerting/unified/PanelAlertTab.tsx b/public/app/features/alerting/unified/PanelAlertTab.tsx index cbdf52eec11..88e6a763f2c 100644 --- a/public/app/features/alerting/unified/PanelAlertTab.tsx +++ b/public/app/features/alerting/unified/PanelAlertTab.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Tab, TabProps } from '@grafana/ui/src/components/Tabs/Tab'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; @@ -11,7 +11,7 @@ interface Props extends Omit { } // it will load rule count from backend -export const PanelAlertTab: FC = ({ panel, dashboard, ...otherProps }) => { +export const PanelAlertTab = ({ panel, dashboard, ...otherProps }: Props) => { const { rules, loading } = usePanelCombinedRules({ panel, dashboard }); return ; }; diff --git a/public/app/features/alerting/unified/PanelAlertTabContent.tsx b/public/app/features/alerting/unified/PanelAlertTabContent.tsx index a8b99dbc0de..da91c08802f 100644 --- a/public/app/features/alerting/unified/PanelAlertTabContent.tsx +++ b/public/app/features/alerting/unified/PanelAlertTabContent.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -17,7 +17,7 @@ interface Props { panel: PanelModel; } -export const PanelAlertTabContent: FC = ({ dashboard, panel }) => { +export const PanelAlertTabContent = ({ dashboard, panel }: Props) => { const styles = useStyles2(getStyles); const { errors, loading, rules } = usePanelCombinedRules({ dashboard, diff --git a/public/app/features/alerting/unified/components/AlertManagerPicker.tsx b/public/app/features/alerting/unified/components/AlertManagerPicker.tsx index 94f30bcc38c..d3b81252194 100644 --- a/public/app/features/alerting/unified/components/AlertManagerPicker.tsx +++ b/public/app/features/alerting/unified/components/AlertManagerPicker.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; import { Field, Select, useStyles2 } from '@grafana/ui'; @@ -17,7 +17,7 @@ function getAlertManagerLabel(alertManager: AlertManagerDataSource) { return alertManager.name === GRAFANA_RULES_SOURCE_NAME ? 'Grafana' : alertManager.name.slice(0, 37); } -export const AlertManagerPicker: FC = ({ onChange, current, dataSources, disabled = false }) => { +export const AlertManagerPicker = ({ onChange, current, dataSources, disabled = false }: Props) => { const styles = useStyles2(getStyles); const options: Array> = useMemo(() => { diff --git a/public/app/features/alerting/unified/components/AnnotationDetailsField.tsx b/public/app/features/alerting/unified/components/AnnotationDetailsField.tsx index 15f65d379b3..d29f0fe2f2c 100644 --- a/public/app/features/alerting/unified/components/AnnotationDetailsField.tsx +++ b/public/app/features/alerting/unified/components/AnnotationDetailsField.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2, textUtil } from '@grafana/data'; import { Tooltip, useStyles2 } from '@grafana/ui'; @@ -18,7 +18,7 @@ interface Props { valueLink?: string; } -export const AnnotationDetailsField: FC = ({ annotationKey, value, valueLink }) => { +export const AnnotationDetailsField = ({ annotationKey, value, valueLink }: Props) => { const label = annotationLabels[annotationKey as Annotation] ? ( {annotationLabels[annotationKey as Annotation]} @@ -34,7 +34,7 @@ export const AnnotationDetailsField: FC = ({ annotationKey, value, valueL ); }; -const AnnotationValue: FC = ({ annotationKey, value, valueLink }) => { +const AnnotationValue = ({ annotationKey, value, valueLink }: Props) => { const styles = useStyles2(getStyles); const needsWell = wellableAnnotationKeys.includes(annotationKey); diff --git a/public/app/features/alerting/unified/components/CollapseToggle.tsx b/public/app/features/alerting/unified/components/CollapseToggle.tsx index 9ea400226e6..f3b15669694 100644 --- a/public/app/features/alerting/unified/components/CollapseToggle.tsx +++ b/public/app/features/alerting/unified/components/CollapseToggle.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, HTMLAttributes } from 'react'; +import React, { HTMLAttributes } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { IconSize, useStyles2, Button } from '@grafana/ui'; @@ -14,7 +14,7 @@ interface Props extends HTMLAttributes { text?: string; } -export const CollapseToggle: FC = ({ +export const CollapseToggle = ({ isCollapsed, onToggle, idControlled, @@ -22,7 +22,7 @@ export const CollapseToggle: FC = ({ text, size = 'xl', ...restOfProps -}) => { +}: Props) => { const styles = useStyles2(getStyles); return ( diff --git a/public/app/features/alerting/unified/components/EmptyAreaWithCTA.tsx b/public/app/features/alerting/unified/components/EmptyAreaWithCTA.tsx index 38e1ce688bb..11d4e86efc8 100644 --- a/public/app/features/alerting/unified/components/EmptyAreaWithCTA.tsx +++ b/public/app/features/alerting/unified/components/EmptyAreaWithCTA.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { ButtonHTMLAttributes, FC } from 'react'; +import React, { ButtonHTMLAttributes } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, ButtonVariant, IconName, LinkButton, useStyles2 } from '@grafana/ui'; @@ -18,7 +18,7 @@ export interface EmptyAreaWithCTAProps { showButton?: boolean; } -export const EmptyAreaWithCTA: FC = ({ +export const EmptyAreaWithCTA = ({ buttonIcon, buttonLabel, buttonSize = 'lg', @@ -27,7 +27,7 @@ export const EmptyAreaWithCTA: FC = ({ text, href, showButton = true, -}) => { +}: EmptyAreaWithCTAProps) => { const styles = useStyles2(getStyles); const commonProps = { diff --git a/public/app/features/alerting/unified/components/HoverCard.tsx b/public/app/features/alerting/unified/components/HoverCard.tsx index b0dca5ce7dc..9a8bd56c6e4 100644 --- a/public/app/features/alerting/unified/components/HoverCard.tsx +++ b/public/app/features/alerting/unified/components/HoverCard.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/css'; import { Placement } from '@popperjs/core'; import classnames from 'classnames'; -import React, { FC, ReactElement, ReactNode, useRef } from 'react'; +import React, { ReactElement, ReactNode, useRef } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Stack } from '@grafana/experimental'; @@ -19,7 +19,7 @@ export interface HoverCardProps { arrow?: boolean; } -export const HoverCard: FC = ({ +export const HoverCard = ({ children, header, content, @@ -29,7 +29,7 @@ export const HoverCard: FC = ({ wrapperClassName, disabled = false, ...rest -}) => { +}: HoverCardProps) => { const popoverRef = useRef(null); const styles = useStyles2(getStyles); diff --git a/public/app/features/alerting/unified/components/Label.tsx b/public/app/features/alerting/unified/components/Label.tsx index d9b7bb38597..83dbf664569 100644 --- a/public/app/features/alerting/unified/components/Label.tsx +++ b/public/app/features/alerting/unified/components/Label.tsx @@ -1,11 +1,11 @@ import { css } from '@emotion/css'; -import React, { FC, ReactNode } from 'react'; +import React, { ReactNode } from 'react'; import { GrafanaTheme2, IconName } from '@grafana/data'; import { Stack } from '@grafana/experimental'; import { Icon, useStyles2 } from '@grafana/ui'; -interface LabelProps { +interface Props { icon?: IconName; label?: ReactNode; value: ReactNode; @@ -13,7 +13,7 @@ interface LabelProps { } // TODO allow customization with color prop -const Label: FC = ({ label, value, icon }) => { +const Label = ({ label, value, icon }: Props) => { const styles = useStyles2(getStyles); return ( diff --git a/public/app/features/alerting/unified/components/MetaText.tsx b/public/app/features/alerting/unified/components/MetaText.tsx index 616653ccfc6..c02e6bd88f9 100644 --- a/public/app/features/alerting/unified/components/MetaText.tsx +++ b/public/app/features/alerting/unified/components/MetaText.tsx @@ -1,16 +1,16 @@ import { css } from '@emotion/css'; import classNames from 'classnames'; -import React, { FC, HTMLAttributes } from 'react'; +import React, { HTMLAttributes } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Stack } from '@grafana/experimental'; import { Icon, IconName, useStyles2 } from '@grafana/ui'; -interface MetaTextProps extends HTMLAttributes { +interface Props extends HTMLAttributes { icon?: IconName; } -const MetaText: FC = ({ children, icon, ...rest }) => { +const MetaText = ({ children, icon, ...rest }: Props) => { const styles = useStyles2(getStyles); const interactive = typeof rest.onClick === 'function'; diff --git a/public/app/features/alerting/unified/components/RuleLocation.tsx b/public/app/features/alerting/unified/components/RuleLocation.tsx index 74ccbf5209d..1a64d33d2cc 100644 --- a/public/app/features/alerting/unified/components/RuleLocation.tsx +++ b/public/app/features/alerting/unified/components/RuleLocation.tsx @@ -1,13 +1,13 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Icon } from '@grafana/ui'; -interface RuleLocationProps { +interface Props { namespace: string; group?: string; } -const RuleLocation: FC = ({ namespace, group }) => { +const RuleLocation = ({ namespace, group }: Props) => { if (!group) { return <>{namespace}; } diff --git a/public/app/features/alerting/unified/components/Well.tsx b/public/app/features/alerting/unified/components/Well.tsx index 17294c8fec4..106889e42ca 100644 --- a/public/app/features/alerting/unified/components/Well.tsx +++ b/public/app/features/alerting/unified/components/Well.tsx @@ -1,12 +1,12 @@ import { cx, css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; type Props = React.HTMLAttributes; -export const Well: FC = ({ children, className }) => { +export const Well = ({ children, className }: Props) => { const styles = useStyles2(getStyles); return

{children}
; }; diff --git a/public/app/features/alerting/unified/components/alert-groups/AlertDetails.tsx b/public/app/features/alerting/unified/components/alert-groups/AlertDetails.tsx index 8ab58c7cbc7..ecef884ae84 100644 --- a/public/app/features/alerting/unified/components/alert-groups/AlertDetails.tsx +++ b/public/app/features/alerting/unified/components/alert-groups/AlertDetails.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { LinkButton, useStyles2 } from '@grafana/ui'; @@ -18,7 +18,7 @@ interface AmNotificationsAlertDetailsProps { alert: AlertmanagerAlert; } -export const AlertDetails: FC = ({ alert, alertManagerSourceName }) => { +export const AlertDetails = ({ alert, alertManagerSourceName }: AmNotificationsAlertDetailsProps) => { const styles = useStyles2(getStyles); const instancePermissions = getInstancesPermissions(alertManagerSourceName); diff --git a/public/app/features/alerting/unified/components/expressions/AlertConditionIndicator.tsx b/public/app/features/alerting/unified/components/expressions/AlertConditionIndicator.tsx index 3572af7d877..11d4d98e516 100644 --- a/public/app/features/alerting/unified/components/expressions/AlertConditionIndicator.tsx +++ b/public/app/features/alerting/unified/components/expressions/AlertConditionIndicator.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Badge, clearButtonStyles, useStyles2 } from '@grafana/ui'; @@ -11,12 +11,7 @@ interface AlertConditionProps { onSetCondition?: () => void; } -export const AlertConditionIndicator: FC = ({ - enabled = false, - error, - warning, - onSetCondition, -}) => { +export const AlertConditionIndicator = ({ enabled = false, error, warning, onSetCondition }: AlertConditionProps) => { const styles = useStyles2(getStyles); if (enabled && error) { diff --git a/public/app/features/alerting/unified/components/mute-timings/MuteTimingTimeRange.tsx b/public/app/features/alerting/unified/components/mute-timings/MuteTimingTimeRange.tsx index 04cba1844b8..91129713b10 100644 --- a/public/app/features/alerting/unified/components/mute-timings/MuteTimingTimeRange.tsx +++ b/public/app/features/alerting/unified/components/mute-timings/MuteTimingTimeRange.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { useFieldArray, useFormContext } from 'react-hook-form'; import { GrafanaTheme2 } from '@grafana/data'; @@ -11,7 +11,7 @@ interface Props { intervalIndex: number; } -export const MuteTimingTimeRange: FC = ({ intervalIndex }) => { +export const MuteTimingTimeRange = ({ intervalIndex }: Props) => { const styles = useStyles2(getStyles); const { register, formState } = useFormContext(); diff --git a/public/app/features/alerting/unified/components/mute-timings/MuteTimingsTable.tsx b/public/app/features/alerting/unified/components/mute-timings/MuteTimingsTable.tsx index 5ddc5abbcd4..c641f7bc821 100644 --- a/public/app/features/alerting/unified/components/mute-timings/MuteTimingsTable.tsx +++ b/public/app/features/alerting/unified/components/mute-timings/MuteTimingsTable.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useMemo, useState } from 'react'; +import React, { useMemo, useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Stack } from '@grafana/experimental'; @@ -32,7 +32,7 @@ interface Props { hideActions?: boolean; } -export const MuteTimingsTable: FC = ({ alertManagerSourceName, muteTimingNames, hideActions }) => { +export const MuteTimingsTable = ({ alertManagerSourceName, muteTimingNames, hideActions }: Props) => { const styles = useStyles2(getStyles); const dispatch = useDispatch(); const permissions = getNotificationsPermissions(alertManagerSourceName); diff --git a/public/app/features/alerting/unified/components/notification-policies/AlertGroupsSummary.tsx b/public/app/features/alerting/unified/components/notification-policies/AlertGroupsSummary.tsx index e96cb93c434..db731352eec 100644 --- a/public/app/features/alerting/unified/components/notification-policies/AlertGroupsSummary.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/AlertGroupsSummary.tsx @@ -1,5 +1,5 @@ import pluralize from 'pluralize'; -import React, { FC, Fragment } from 'react'; +import React, { Fragment } from 'react'; import { Stack } from '@grafana/experimental'; import { Badge } from '@grafana/ui'; @@ -10,7 +10,7 @@ interface Props { unprocessed?: number; } -export const AlertGroupsSummary: FC = ({ active = 0, suppressed = 0, unprocessed = 0 }) => { +export const AlertGroupsSummary = ({ active = 0, suppressed = 0, unprocessed = 0 }: Props) => { const statsComponents: React.ReactNode[] = []; const total = active + suppressed + unprocessed; diff --git a/public/app/features/alerting/unified/components/notification-policies/EditDefaultPolicyForm.tsx b/public/app/features/alerting/unified/components/notification-policies/EditDefaultPolicyForm.tsx index 882a8a09a3f..9eaf5614bef 100644 --- a/public/app/features/alerting/unified/components/notification-policies/EditDefaultPolicyForm.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/EditDefaultPolicyForm.tsx @@ -1,5 +1,5 @@ import { cx } from '@emotion/css'; -import React, { FC, ReactNode, useState } from 'react'; +import React, { ReactNode, useState } from 'react'; import { Collapse, Field, Form, Input, InputControl, Link, MultiSelect, Select, useStyles2 } from '@grafana/ui'; import { RouteWithID } from 'app/plugins/datasource/alertmanager/types'; @@ -28,13 +28,13 @@ export interface AmRootRouteFormProps { route: RouteWithID; } -export const AmRootRouteForm: FC = ({ +export const AmRootRouteForm = ({ actionButtons, alertManagerSourceName, onSubmit, receivers, route, -}) => { +}: AmRootRouteFormProps) => { const styles = useStyles2(getFormStyles); const [isTimingOptionsExpanded, setIsTimingOptionsExpanded] = useState(false); const [groupByOptions, setGroupByOptions] = useState(stringsToSelectableValues(route.group_by)); diff --git a/public/app/features/alerting/unified/components/notification-policies/EditNotificationPolicyForm.tsx b/public/app/features/alerting/unified/components/notification-policies/EditNotificationPolicyForm.tsx index bf604612e1b..6c4e91931ab 100644 --- a/public/app/features/alerting/unified/components/notification-policies/EditNotificationPolicyForm.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/EditNotificationPolicyForm.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC, ReactNode, useState } from 'react'; +import React, { ReactNode, useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Stack } from '@grafana/experimental'; @@ -45,7 +45,7 @@ export interface AmRoutesExpandedFormProps { actionButtons: ReactNode; } -export const AmRoutesExpandedForm: FC = ({ actionButtons, receivers, route, onSubmit }) => { +export const AmRoutesExpandedForm = ({ actionButtons, receivers, route, onSubmit }: AmRoutesExpandedFormProps) => { const styles = useStyles2(getStyles); const formStyles = useStyles2(getFormStyles); const [groupByOptions, setGroupByOptions] = useState(stringsToSelectableValues(route?.group_by)); diff --git a/public/app/features/alerting/unified/components/notification-policies/Filters.tsx b/public/app/features/alerting/unified/components/notification-policies/Filters.tsx index fda19685c3d..7965cca4a81 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Filters.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Filters.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { debounce, pick } from 'lodash'; -import React, { FC, useCallback, useEffect, useRef } from 'react'; +import React, { useCallback, useEffect, useRef } from 'react'; import { SelectableValue } from '@grafana/data'; import { Stack } from '@grafana/experimental'; @@ -16,11 +16,11 @@ interface NotificationPoliciesFilterProps { onChangeReceiver: (receiver: string | undefined) => void; } -const NotificationPoliciesFilter: FC = ({ +const NotificationPoliciesFilter = ({ receivers, onChangeReceiver, onChangeMatchers, -}) => { +}: NotificationPoliciesFilterProps) => { const [searchParams, setSearchParams] = useURLSearchParams(); const searchInputRef = useRef(null); const { queryString, contactPoint } = getNotificationPoliciesFilters(searchParams); diff --git a/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx b/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx index 51ace2c47d6..f6000d528e0 100644 --- a/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx +++ b/public/app/features/alerting/unified/components/panel-alerts-tab/NewRuleFromPanelButton.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { useLocation } from 'react-router-dom'; import { useAsync } from 'react-use'; @@ -17,7 +17,7 @@ interface Props { className?: string; } -export const NewRuleFromPanelButton: FC = ({ dashboard, panel, className }) => { +export const NewRuleFromPanelButton = ({ dashboard, panel, className }: Props) => { const templating = useSelector((state) => { return state.templating; }); diff --git a/public/app/features/alerting/unified/components/receivers/DuplicateTemplateView.tsx b/public/app/features/alerting/unified/components/receivers/DuplicateTemplateView.tsx index a72ace2d2fb..96489e6c2eb 100644 --- a/public/app/features/alerting/unified/components/receivers/DuplicateTemplateView.tsx +++ b/public/app/features/alerting/unified/components/receivers/DuplicateTemplateView.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Alert } from '@grafana/ui'; import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types'; @@ -14,7 +14,7 @@ interface Props { alertManagerSourceName: string; } -export const DuplicateTemplateView: FC = ({ config, templateName, alertManagerSourceName }) => { +export const DuplicateTemplateView = ({ config, templateName, alertManagerSourceName }: Props) => { const template = config.template_files?.[templateName]; if (!template) { diff --git a/public/app/features/alerting/unified/components/receivers/EditReceiverView.tsx b/public/app/features/alerting/unified/components/receivers/EditReceiverView.tsx index 2d395975ac4..34dd5207170 100644 --- a/public/app/features/alerting/unified/components/receivers/EditReceiverView.tsx +++ b/public/app/features/alerting/unified/components/receivers/EditReceiverView.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Alert } from '@grafana/ui'; import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types'; @@ -14,7 +14,7 @@ interface Props { alertManagerSourceName: string; } -export const EditReceiverView: FC = ({ config, receiverName, alertManagerSourceName }) => { +export const EditReceiverView = ({ config, receiverName, alertManagerSourceName }: Props) => { const receiver = config.alertmanager_config.receivers?.find(({ name }) => name === receiverName); if (!receiver) { return ( diff --git a/public/app/features/alerting/unified/components/receivers/EditTemplateView.tsx b/public/app/features/alerting/unified/components/receivers/EditTemplateView.tsx index cb3b4a4664b..b8271e2d98e 100644 --- a/public/app/features/alerting/unified/components/receivers/EditTemplateView.tsx +++ b/public/app/features/alerting/unified/components/receivers/EditTemplateView.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Alert } from '@grafana/ui'; import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types'; @@ -11,7 +11,7 @@ interface Props { alertManagerSourceName: string; } -export const EditTemplateView: FC = ({ config, templateName, alertManagerSourceName }) => { +export const EditTemplateView = ({ config, templateName, alertManagerSourceName }: Props) => { const template = config.template_files?.[templateName]; const provenance = config.template_file_provenances?.[templateName]; diff --git a/public/app/features/alerting/unified/components/receivers/GlobalConfigForm.tsx b/public/app/features/alerting/unified/components/receivers/GlobalConfigForm.tsx index a83a5e7d69f..33c5da50700 100644 --- a/public/app/features/alerting/unified/components/receivers/GlobalConfigForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/GlobalConfigForm.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { useForm, FormProvider } from 'react-hook-form'; import { Alert, Button, HorizontalGroup, LinkButton } from '@grafana/ui'; @@ -27,7 +27,7 @@ const defaultValues: FormValues = { smtp_require_tls: true, } as const; -export const GlobalConfigForm: FC = ({ config, alertManagerSourceName }) => { +export const GlobalConfigForm = ({ config, alertManagerSourceName }: Props) => { const dispatch = useDispatch(); useCleanup((state) => (state.unifiedAlerting.saveAMConfig = initialAsyncRequestState)); diff --git a/public/app/features/alerting/unified/components/receivers/NewReceiverView.tsx b/public/app/features/alerting/unified/components/receivers/NewReceiverView.tsx index 86dfea463e8..0fe5ed33a61 100644 --- a/public/app/features/alerting/unified/components/receivers/NewReceiverView.tsx +++ b/public/app/features/alerting/unified/components/receivers/NewReceiverView.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types'; @@ -12,7 +12,7 @@ interface Props { alertManagerSourceName: string; } -export const NewReceiverView: FC = ({ alertManagerSourceName, config }) => { +export const NewReceiverView = ({ alertManagerSourceName, config }: Props) => { if (alertManagerSourceName === GRAFANA_RULES_SOURCE_NAME) { return ; } else { diff --git a/public/app/features/alerting/unified/components/receivers/NewTemplateView.tsx b/public/app/features/alerting/unified/components/receivers/NewTemplateView.tsx index a7636dc6a65..0daac5b222b 100644 --- a/public/app/features/alerting/unified/components/receivers/NewTemplateView.tsx +++ b/public/app/features/alerting/unified/components/receivers/NewTemplateView.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types'; @@ -9,6 +9,6 @@ interface Props { alertManagerSourceName: string; } -export const NewTemplateView: FC = ({ config, alertManagerSourceName }) => { +export const NewTemplateView = ({ config, alertManagerSourceName }: Props) => { return ; }; diff --git a/public/app/features/alerting/unified/components/receivers/ReceiversAndTemplatesView.tsx b/public/app/features/alerting/unified/components/receivers/ReceiversAndTemplatesView.tsx index ceaf42f4e2a..f7116e1804f 100644 --- a/public/app/features/alerting/unified/components/receivers/ReceiversAndTemplatesView.tsx +++ b/public/app/features/alerting/unified/components/receivers/ReceiversAndTemplatesView.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { Stack } from '@grafana/experimental'; import { Alert, LinkButton } from '@grafana/ui'; @@ -17,7 +17,7 @@ interface Props { alertManagerName: string; } -export const ReceiversAndTemplatesView: FC = ({ config, alertManagerName }) => { +export const ReceiversAndTemplatesView = ({ config, alertManagerName }: Props) => { const isCloud = alertManagerName !== GRAFANA_RULES_SOURCE_NAME; const isVanillaAM = isVanillaPrometheusAlertManagerDataSource(alertManagerName); diff --git a/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx b/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx index ace509fa67d..4e344582c5e 100644 --- a/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx +++ b/public/app/features/alerting/unified/components/receivers/ReceiversTable.tsx @@ -1,5 +1,5 @@ import pluralize from 'pluralize'; -import React, { FC, useMemo, useState } from 'react'; +import React, { useMemo, useState } from 'react'; import { dateTime, dateTimeFormat } from '@grafana/data'; import { Stack } from '@grafana/experimental'; @@ -238,7 +238,7 @@ interface Props { alertManagerName: string; } -export const ReceiversTable: FC = ({ config, alertManagerName }) => { +export const ReceiversTable = ({ config, alertManagerName }: Props) => { const dispatch = useDispatch(); const isVanillaAM = isVanillaPrometheusAlertManagerDataSource(alertManagerName); const permissions = getNotificationsPermissions(alertManagerName); diff --git a/public/app/features/alerting/unified/components/receivers/TemplateEditor.tsx b/public/app/features/alerting/unified/components/receivers/TemplateEditor.tsx index 1ada702eecf..c2223ded6d5 100644 --- a/public/app/features/alerting/unified/components/receivers/TemplateEditor.tsx +++ b/public/app/features/alerting/unified/components/receivers/TemplateEditor.tsx @@ -4,7 +4,7 @@ * It includes auto-complete for template data and syntax highlighting */ import { editor, IDisposable } from 'monaco-editor'; -import React, { FC, useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { CodeEditor } from '@grafana/ui'; import { CodeEditorProps } from '@grafana/ui/src/components/Monaco/types'; @@ -17,7 +17,7 @@ type TemplateEditorProps = Omit & { autoHeight?: boolean; }; -const TemplateEditor: FC = (props) => { +const TemplateEditor = (props: TemplateEditorProps) => { const shouldAutoHeight = Boolean(props.autoHeight); const disposeSuggestions = useRef(null); diff --git a/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx b/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx index 5eedbddc0f4..225c0d49746 100644 --- a/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/TemplateForm.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { Location } from 'history'; -import React, { FC } from 'react'; +import React from 'react'; import { useForm, Validate } from 'react-hook-form'; import { useLocation } from 'react-router-dom'; import AutoSizer from 'react-virtualized-auto-sizer'; @@ -41,7 +41,7 @@ interface Props { } export const isDuplicating = (location: Location) => location.pathname.endsWith('/duplicate'); -export const TemplateForm: FC = ({ existing, alertManagerSourceName, config, provenance }) => { +export const TemplateForm = ({ existing, alertManagerSourceName, config, provenance }: Props) => { const styles = useStyles2(getStyles); const dispatch = useDispatch(); diff --git a/public/app/features/alerting/unified/components/receivers/TemplatesTable.tsx b/public/app/features/alerting/unified/components/receivers/TemplatesTable.tsx index 292b0fc1c7e..33d56c2360e 100644 --- a/public/app/features/alerting/unified/components/receivers/TemplatesTable.tsx +++ b/public/app/features/alerting/unified/components/receivers/TemplatesTable.tsx @@ -1,4 +1,4 @@ -import React, { FC, Fragment, useMemo, useState } from 'react'; +import React, { Fragment, useMemo, useState } from 'react'; import { ConfirmModal, useStyles2 } from '@grafana/ui'; import { contextSrv } from 'app/core/services/context_srv'; @@ -23,7 +23,7 @@ interface Props { alertManagerName: string; } -export const TemplatesTable: FC = ({ config, alertManagerName }) => { +export const TemplatesTable = ({ config, alertManagerName }: Props) => { const dispatch = useDispatch(); const [expandedTemplates, setExpandedTemplates] = useState>({}); const tableStyles = useStyles2(getAlertTableStyles); diff --git a/public/app/features/alerting/unified/components/receivers/form/CloudCommonChannelSettings.tsx b/public/app/features/alerting/unified/components/receivers/form/CloudCommonChannelSettings.tsx index fc8c56e5202..e12795ed122 100644 --- a/public/app/features/alerting/unified/components/receivers/form/CloudCommonChannelSettings.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/CloudCommonChannelSettings.tsx @@ -1,15 +1,15 @@ -import React, { FC } from 'react'; +import React from 'react'; import { useFormContext } from 'react-hook-form'; import { Checkbox, Field } from '@grafana/ui'; import { CommonSettingsComponentProps } from '../../../types/receiver-form'; -export const CloudCommonChannelSettings: FC = ({ +export const CloudCommonChannelSettings = ({ pathPrefix, className, readOnly = false, -}) => { +}: CommonSettingsComponentProps) => { const { register } = useFormContext(); return (
diff --git a/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx b/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx index 87549586611..6ddd89024bb 100644 --- a/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/CloudReceiverForm.tsx @@ -1,4 +1,4 @@ -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { Alert } from '@grafana/ui'; import { AlertManagerCortexConfig, Receiver } from 'app/plugins/datasource/alertmanager/types'; @@ -32,7 +32,7 @@ const defaultChannelValues: CloudChannelValues = Object.freeze({ type: 'email', }); -export const CloudReceiverForm: FC = ({ existing, alertManagerSourceName, config }) => { +export const CloudReceiverForm = ({ existing, alertManagerSourceName, config }: Props) => { const dispatch = useDispatch(); const isVanillaAM = isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName); diff --git a/public/app/features/alerting/unified/components/receivers/form/GrafanaCommonChannelSettings.tsx b/public/app/features/alerting/unified/components/receivers/form/GrafanaCommonChannelSettings.tsx index 527337ee02e..bd1d2d1fb55 100644 --- a/public/app/features/alerting/unified/components/receivers/form/GrafanaCommonChannelSettings.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/GrafanaCommonChannelSettings.tsx @@ -1,15 +1,15 @@ -import React, { FC } from 'react'; +import React from 'react'; import { useFormContext } from 'react-hook-form'; import { Checkbox, Field } from '@grafana/ui'; import { CommonSettingsComponentProps } from '../../../types/receiver-form'; -export const GrafanaCommonChannelSettings: FC = ({ +export const GrafanaCommonChannelSettings = ({ pathPrefix, className, readOnly = false, -}) => { +}: CommonSettingsComponentProps) => { const { register } = useFormContext(); return (
diff --git a/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx b/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx index cfba5c26548..e68361c2be0 100644 --- a/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { LoadingPlaceholder } from '@grafana/ui'; import { @@ -44,7 +44,7 @@ const defaultChannelValues: GrafanaChannelValues = Object.freeze({ type: 'email', }); -export const GrafanaReceiverForm: FC = ({ existing, alertManagerSourceName, config }) => { +export const GrafanaReceiverForm = ({ existing, alertManagerSourceName, config }: Props) => { const grafanaNotifiers = useUnifiedAlertingSelector((state) => state.grafanaNotifiers); const [testChannelValues, setTestChannelValues] = useState(); diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx index 4bf2dda0b50..2c1eebceb9b 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/KeyValueMapInput.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, Input, useStyles2 } from '@grafana/ui'; @@ -12,7 +12,7 @@ interface Props { onChange: (value: Record) => void; } -export const KeyValueMapInput: FC = ({ value, onChange, readOnly = false }) => { +export const KeyValueMapInput = ({ value, onChange, readOnly = false }: Props) => { const styles = useStyles2(getStyles); const [pairs, setPairs] = useState(recordToPairs(value)); useEffect(() => setPairs(recordToPairs(value)), [value]); diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/StringArrayInput.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/StringArrayInput.tsx index a752fea4482..3d35b333690 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/StringArrayInput.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/StringArrayInput.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, Input, useStyles2 } from '@grafana/ui'; @@ -12,7 +12,7 @@ interface Props { onChange: (value: string[]) => void; } -export const StringArrayInput: FC = ({ value, onChange, readOnly = false }) => { +export const StringArrayInput = ({ value, onChange, readOnly = false }: Props) => { const styles = useStyles2(getStyles); const deleteItem = (index: number) => { diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx index 103b35f8563..efb11ca8684 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/SubformArrayField.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import React from 'react'; import { FieldError, DeepMap, useFormContext } from 'react-hook-form'; import { Button, useStyles2 } from '@grafana/ui'; @@ -19,7 +19,7 @@ interface Props { readOnly?: boolean; } -export const SubformArrayField: FC = ({ option, pathPrefix, errors, defaultValues, readOnly = false }) => { +export const SubformArrayField = ({ option, pathPrefix, errors, defaultValues, readOnly = false }: Props) => { const styles = useStyles2(getReceiverFormFieldStyles); const path = `${pathPrefix}${option.propertyName}`; const formAPI = useFormContext(); diff --git a/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx b/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx index 626c859cb57..bcc323f6d12 100644 --- a/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/fields/SubformField.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from 'react'; +import React, { useState } from 'react'; import { FieldError, DeepMap, useFormContext } from 'react-hook-form'; import { Button, useStyles2 } from '@grafana/ui'; @@ -17,7 +17,7 @@ interface Props { readOnly?: boolean; } -export const SubformField: FC = ({ option, pathPrefix, errors, defaultValue, readOnly = false }) => { +export const SubformField = ({ option, pathPrefix, errors, defaultValue, readOnly = false }: Props) => { const styles = useStyles2(getReceiverFormFieldStyles); const name = `${pathPrefix}${option.propertyName}`; const { watch } = useFormContext(); diff --git a/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx b/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx index 0e7a6c485a2..92680cac669 100644 --- a/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { DeepMap, FieldError, FormProvider, useForm, useFormContext, UseFormWatch } from 'react-hook-form'; import { Link } from 'react-router-dom'; @@ -73,7 +73,7 @@ type Props = { prefill?: Partial; // Existing implies we modify existing rule. Prefill only provides default form values }; -export const AlertRuleForm: FC = ({ existing, prefill }) => { +export const AlertRuleForm = ({ existing, prefill }: Props) => { const styles = useStyles2(getStyles); const dispatch = useDispatch(); const notifyApp = useAppNotification(); diff --git a/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx b/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx index f9c433ce397..864ddacb515 100644 --- a/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx @@ -1,4 +1,4 @@ -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { SelectableValue } from '@grafana/data'; @@ -16,7 +16,7 @@ interface Props { 'aria-label'?: string; } -export const AnnotationKeyInput: FC = ({ value, existingKeys, 'aria-label': ariaLabel, ...rest }) => { +export const AnnotationKeyInput = ({ value, existingKeys, 'aria-label': ariaLabel, ...rest }: Props) => { const annotationOptions = useMemo( (): SelectableValue[] => Object.values(Annotation) diff --git a/public/app/features/alerting/unified/components/rule-editor/ExpressionEditor.tsx b/public/app/features/alerting/unified/components/rule-editor/ExpressionEditor.tsx index a803455386d..efef4b38119 100644 --- a/public/app/features/alerting/unified/components/rule-editor/ExpressionEditor.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/ExpressionEditor.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { noop } from 'lodash'; -import React, { FC, useCallback, useMemo } from 'react'; +import React, { useCallback, useMemo } from 'react'; import { useAsync } from 'react-use'; import { CoreApp, DataQuery, DataSourcePluginContextProvider, GrafanaTheme2, LoadingState } from '@grafana/data'; @@ -19,12 +19,12 @@ export interface ExpressionEditorProps { showPreviewAlertsButton: boolean; } -export const ExpressionEditor: FC = ({ +export const ExpressionEditor = ({ value, onChange, dataSourceName, showPreviewAlertsButton = true, -}) => { +}: ExpressionEditorProps) => { const styles = useStyles2(getStyles); const { mapToValue, mapToQuery } = useQueryMappers(dataSourceName); diff --git a/public/app/features/alerting/unified/components/rule-editor/ExpressionsEditor.tsx b/public/app/features/alerting/unified/components/rule-editor/ExpressionsEditor.tsx index ea09e7761a7..365e4f66ba9 100644 --- a/public/app/features/alerting/unified/components/rule-editor/ExpressionsEditor.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/ExpressionsEditor.tsx @@ -1,4 +1,4 @@ -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { PanelData } from '@grafana/data'; import { Stack } from '@grafana/experimental'; @@ -21,7 +21,7 @@ interface Props { onUpdateQueryExpression: (query: ExpressionQuery) => void; } -export const ExpressionsEditor: FC = ({ +export const ExpressionsEditor = ({ condition, onSetCondition, queries, @@ -30,7 +30,7 @@ export const ExpressionsEditor: FC = ({ onRemoveExpression, onUpdateExpressionType, onUpdateQueryExpression, -}) => { +}: Props) => { const expressionQueries = useMemo(() => { return queries.reduce((acc: ExpressionQuery[], query) => { return isExpressionQuery(query.model) ? acc.concat(query.model) : acc; diff --git a/public/app/features/alerting/unified/components/rule-editor/GrafanaAlertStatePicker.tsx b/public/app/features/alerting/unified/components/rule-editor/GrafanaAlertStatePicker.tsx index 291152e3104..ee732387de3 100644 --- a/public/app/features/alerting/unified/components/rule-editor/GrafanaAlertStatePicker.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/GrafanaAlertStatePicker.tsx @@ -1,4 +1,4 @@ -import React, { FC, useMemo } from 'react'; +import React, { useMemo } from 'react'; import { SelectableValue } from '@grafana/data'; import { Select } from '@grafana/ui'; @@ -17,7 +17,7 @@ const options: SelectableValue[] = [ { value: GrafanaAlertStateDecision.Error, label: 'Error' }, ]; -export const GrafanaAlertStatePicker: FC = ({ includeNoData, includeError, ...props }) => { +export const GrafanaAlertStatePicker = ({ includeNoData, includeError, ...props }: Props) => { const opts = useMemo(() => { if (!includeNoData) { return options.filter((opt) => opt.value !== GrafanaAlertStateDecision.NoData); diff --git a/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx b/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx index d49c6f46ab2..6c4497b9119 100644 --- a/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useEffect, useMemo } from 'react'; +import React, { useEffect, useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; @@ -16,7 +16,7 @@ interface Props { rulesSourceName: string; } -export const GroupAndNamespaceFields: FC = ({ rulesSourceName }) => { +export const GroupAndNamespaceFields = ({ rulesSourceName }: Props) => { const { control, watch, diff --git a/public/app/features/alerting/unified/components/rule-editor/QueryEditor.tsx b/public/app/features/alerting/unified/components/rule-editor/QueryEditor.tsx index e733f807e62..dc52b018fd9 100644 --- a/public/app/features/alerting/unified/components/rule-editor/QueryEditor.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/QueryEditor.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2, PanelData } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; @@ -18,7 +18,7 @@ interface Props { onSetCondition: (refId: string) => void; } -export const QueryEditor: FC = ({ +export const QueryEditor = ({ queries, expressions, panelData, @@ -27,7 +27,7 @@ export const QueryEditor: FC = ({ onDuplicateQuery, condition, onSetCondition, -}) => { +}: Props) => { const styles = useStyles2(getStyles); return ( diff --git a/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx b/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx index 37154731ce3..25232791e3b 100644 --- a/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { cloneDeep } from 'lodash'; -import React, { ChangeEvent, FC, useState } from 'react'; +import React, { ChangeEvent, useState } from 'react'; import { CoreApp, @@ -60,7 +60,7 @@ interface Props { onChangeQueryOptions: (options: AlertQueryOptions, index: number) => void; } -export const QueryWrapper: FC = ({ +export const QueryWrapper = ({ data, error, dsSettings, @@ -79,7 +79,7 @@ export const QueryWrapper: FC = ({ condition, onSetCondition, onChangeQueryOptions, -}) => { +}: Props) => { const styles = useStyles2(getStyles); const isExpression = isExpressionQuery(query.model); const [pluginId, changePluginId] = useState(isExpression ? TABLE : TIMESERIES); diff --git a/public/app/features/alerting/unified/components/rule-editor/RuleInspector.tsx b/public/app/features/alerting/unified/components/rule-editor/RuleInspector.tsx index 52828b993a2..48ea6c18f35 100644 --- a/public/app/features/alerting/unified/components/rule-editor/RuleInspector.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/RuleInspector.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { dump, load } from 'js-yaml'; -import React, { FC, useState } from 'react'; +import React, { useState } from 'react'; import { useFormContext } from 'react-hook-form'; import AutoSizer from 'react-virtualized-auto-sizer'; @@ -22,7 +22,7 @@ interface Props { const tabs = [{ label: 'Yaml', value: 'yaml' }]; -export const RuleInspector: FC = ({ onClose }) => { +export const RuleInspector = ({ onClose }: Props) => { const [activeTab, setActiveTab] = useState('yaml'); const { setValue } = useFormContext(); const styles = useStyles2(drawerStyles); @@ -57,7 +57,7 @@ interface SubtitleProps { setActiveTab: (tab: string) => void; } -const RuleInspectorSubtitle: FC = ({ activeTab, setActiveTab }) => { +const RuleInspectorSubtitle = ({ activeTab, setActiveTab }: SubtitleProps) => { return ( {tabs.map((tab, index) => { @@ -79,7 +79,7 @@ interface YamlTabProps { onSubmit: (newModel: RuleFormValues) => void; } -const InspectorYamlTab: FC = ({ onSubmit }) => { +const InspectorYamlTab = ({ onSubmit }: YamlTabProps) => { const styles = useStyles2(yamlTabStyle); const { getValues } = useFormContext(); diff --git a/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx b/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx index 9cb999d6903..8bc85bc91b6 100644 --- a/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect, useMemo, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { SelectableValue } from '@grafana/data'; import { Input, Select } from '@grafana/ui'; @@ -18,7 +18,7 @@ interface Props { getOptionLabel?: ((item: SelectableValue) => React.ReactNode) | undefined; } -export const SelectWithAdd: FC = ({ +export const SelectWithAdd = ({ value, onChange, options, @@ -31,7 +31,7 @@ export const SelectWithAdd: FC = ({ addLabel = '+ Add new', 'aria-label': ariaLabel, getOptionLabel, -}) => { +}: Props) => { const [isCustom, setIsCustom] = useState(custom); useEffect(() => { diff --git a/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx b/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx index 2a4d841f10b..91c9585f953 100644 --- a/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC, useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import { FieldConfigSource, GrafanaTheme2, PanelData, ThresholdsConfig } from '@grafana/data'; @@ -23,13 +23,13 @@ interface Props { type PanelFieldConfig = FieldConfigSource; -export const VizWrapper: FC = ({ +export const VizWrapper = ({ data, currentPanel, changePanel, thresholds, thresholdsType = GraphTresholdsStyleMode.Line, -}) => { +}: Props) => { const [options, setOptions] = useState({ frameIndex: 0, showHeader: true, diff --git a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/AlertType.tsx b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/AlertType.tsx index f406b94855d..870dfaafc9a 100644 --- a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/AlertType.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/AlertType.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { useFormContext } from 'react-hook-form'; import { DataSourceInstanceSettings, GrafanaTheme2 } from '@grafana/data'; @@ -15,7 +15,7 @@ interface Props { editingExistingRule: boolean; } -export const AlertType: FC = ({ editingExistingRule }) => { +export const AlertType = ({ editingExistingRule }: Props) => { const { enabledRuleTypes, defaultRuleType } = getAvailableRuleTypes(); const { diff --git a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx index 4b426163f84..4b26d63f4a8 100644 --- a/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx @@ -1,4 +1,4 @@ -import React, { FC, useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react'; import { useFormContext } from 'react-hook-form'; import { LoadingState, PanelData } from '@grafana/data'; @@ -38,7 +38,7 @@ interface Props { onDataChange: (error: string) => void; } -export const QueryAndExpressionsStep: FC = ({ editingExistingRule, onDataChange }) => { +export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: Props) => { const runner = useRef(new AlertingQueryRunner()); const { setValue, diff --git a/public/app/features/alerting/unified/components/rule-editor/rule-types/GrafanaManagedAlert.tsx b/public/app/features/alerting/unified/components/rule-editor/rule-types/GrafanaManagedAlert.tsx index 2826b7910f3..ce10238a329 100644 --- a/public/app/features/alerting/unified/components/rule-editor/rule-types/GrafanaManagedAlert.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/rule-types/GrafanaManagedAlert.tsx @@ -1,10 +1,10 @@ -import React, { FC } from 'react'; +import React from 'react'; import { RuleFormType } from '../../../types/rule-form'; import { RuleType, SharedProps } from './RuleType'; -const GrafanaManagedRuleType: FC = ({ selected = false, disabled, onClick }) => { +const GrafanaManagedRuleType = ({ selected = false, disabled, onClick }: SharedProps) => { return ( void; } -const MimirFlavoredType: FC = ({ selected = false, disabled = false, onClick }) => { +const MimirFlavoredType = ({ selected = false, disabled = false, onClick }: Props) => { return ( = ({ selected = false, disabled = false, onClick }) => { +const RecordingRuleType = ({ selected = false, disabled = false, onClick }: SharedProps) => { return ( void; } -const RuleType: FC = (props) => { +const RuleType = (props: Props) => { const { name, description, image, selected = false, value, onClick, disabled = false } = props; const styles = useStyles2(getStyles); diff --git a/public/app/features/alerting/unified/components/rule-editor/rule-types/RuleTypePicker.tsx b/public/app/features/alerting/unified/components/rule-editor/rule-types/RuleTypePicker.tsx index f92f1973e86..b0ddea16b8b 100644 --- a/public/app/features/alerting/unified/components/rule-editor/rule-types/RuleTypePicker.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/rule-types/RuleTypePicker.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import { isEmpty } from 'lodash'; -import React, { FC, useEffect } from 'react'; +import React, { useEffect } from 'react'; import { GrafanaTheme2 } from '@grafana/data/src'; import { Stack } from '@grafana/experimental'; @@ -21,7 +21,7 @@ interface RuleTypePickerProps { enabledTypes: RuleFormType[]; } -const RuleTypePicker: FC = ({ selected, onChange, enabledTypes }) => { +const RuleTypePicker = ({ selected, onChange, enabledTypes }: RuleTypePickerProps) => { const rulesSourcesWithRuler = useRulesSourcesWithRuler(); const hasLotexDatasources = !isEmpty(rulesSourcesWithRuler); diff --git a/public/app/features/alerting/unified/components/rules/ActionButton.tsx b/public/app/features/alerting/unified/components/rules/ActionButton.tsx index fafa85c2ecf..43222f3d084 100644 --- a/public/app/features/alerting/unified/components/rules/ActionButton.tsx +++ b/public/app/features/alerting/unified/components/rules/ActionButton.tsx @@ -1,5 +1,5 @@ import { css, cx } from '@emotion/css'; -import React, { FC } from 'react'; +import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; @@ -7,7 +7,7 @@ import { Button, ButtonProps } from '@grafana/ui/src/components/Button'; type Props = Omit; -export const ActionButton: FC = ({ className, ...restProps }) => { +export const ActionButton = ({ className, ...restProps }: Props) => { const styles = useStyles2(getStyle); return