diff --git a/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx b/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx index 361d0bb8385..b18d608b818 100644 --- a/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx +++ b/packages/grafana-ui/src/components/ConfirmModal/ConfirmModal.tsx @@ -97,7 +97,7 @@ export const ConfirmModal = ({ ) : null} - + + + +``` + +For buttons at the bottom of the modal you should always use: + +- Modal.ButtonRow - this makes sure the Buttons are right aligned +- If you have a Cancel button use fill="outline" and variant="secondary" and place it on the left side of any other button. diff --git a/public/app/features/alerting/unified/components/notification-policies/Modals.tsx b/public/app/features/alerting/unified/components/notification-policies/Modals.tsx index ea34cec0963..f6c01c0b24c 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Modals.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Modals.tsx @@ -62,10 +62,10 @@ const useAddPolicyModal = ( onSubmit={(newRoute) => parentRoute && handleAdd(newRoute, parentRoute)} actionButtons={ - - + } /> @@ -121,10 +121,10 @@ const useEditPolicyModal = ( route={route} actionButtons={ - - + } /> @@ -136,10 +136,10 @@ const useEditPolicyModal = ( onSubmit={handleSave} actionButtons={ - - + } /> diff --git a/public/app/features/alerting/unified/components/rule-editor/DashboardPicker.tsx b/public/app/features/alerting/unified/components/rule-editor/DashboardPicker.tsx index 6462648e10b..e8127bec171 100644 --- a/public/app/features/alerting/unified/components/rule-editor/DashboardPicker.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/DashboardPicker.tsx @@ -230,6 +230,9 @@ export const DashboardPicker = ({ dashboardUid, panelId, isOpen, onChange, onDis + - ); diff --git a/public/app/features/alerting/unified/components/rules/EditRuleGroupModal.tsx b/public/app/features/alerting/unified/components/rules/EditRuleGroupModal.tsx index b1a6da13e4e..0ee23bfdd6a 100644 --- a/public/app/features/alerting/unified/components/rules/EditRuleGroupModal.tsx +++ b/public/app/features/alerting/unified/components/rules/EditRuleGroupModal.tsx @@ -374,6 +374,15 @@ export function EditCloudGroupModal(props: ModalProps): React.ReactElement { )}
+ -
{!hasSomeNoRecordingRules &&
This group does not contain alert rules.
} diff --git a/public/app/features/browse-dashboards/components/BrowseActions/MoveModal.tsx b/public/app/features/browse-dashboards/components/BrowseActions/MoveModal.tsx index 54dcefb868d..22428fb0b5b 100644 --- a/public/app/features/browse-dashboards/components/BrowseActions/MoveModal.tsx +++ b/public/app/features/browse-dashboards/components/BrowseActions/MoveModal.tsx @@ -45,7 +45,7 @@ export const MoveModal = ({ onConfirm, onDismiss, selectedItems, ...props }: Pro setMoveTarget(uid)} /> - - diff --git a/public/app/plugins/datasource/azuremonitor/components/ResourcePicker/ResourcePicker.tsx b/public/app/plugins/datasource/azuremonitor/components/ResourcePicker/ResourcePicker.tsx index 1a11b909b59..2bdc360abfe 100644 --- a/public/app/plugins/datasource/azuremonitor/components/ResourcePicker/ResourcePicker.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/ResourcePicker/ResourcePicker.tsx @@ -2,7 +2,7 @@ import { cx } from '@emotion/css'; import React, { useCallback, useEffect, useState } from 'react'; import { useEffectOnce } from 'react-use'; -import { Alert, Button, LoadingPlaceholder, useStyles2 } from '@grafana/ui'; +import { Alert, Button, LoadingPlaceholder, Modal, useStyles2 } from '@grafana/ui'; import { selectors } from '../../e2e/selectors'; import ResourcePickerData, { ResourcePickerQueryType } from '../../resourcePicker/resourcePickerData'; @@ -261,31 +261,28 @@ const ResourcePicker = ({ renderAdvanced={renderAdvanced} /> - + {errorMessage && ( + <> + + + {errorMessage} + + + )} - - - - - + + + + - - {errorMessage && ( - <> - - - {errorMessage} - - - )} ); }; diff --git a/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx index d44e1755b7e..95df690de0c 100644 --- a/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx @@ -150,7 +150,7 @@ describe('Render', () => { it('should display log group selector field', async () => { setup(); - await waitFor(async () => expect(await screen.getByText('Select Log Groups')).toBeInTheDocument()); + await waitFor(async () => expect(await screen.getByText('Select log groups')).toBeInTheDocument()); }); it('should only display the first two default log groups and show all of them when clicking "Show all" button', async () => { @@ -215,8 +215,8 @@ describe('Render', () => { render(); - await waitFor(() => expect(screen.getByText('Select Log Groups')).toBeInTheDocument()); - await userEvent.click(screen.getByText('Select Log Groups')); + await waitFor(() => expect(screen.getByText('Select log groups')).toBeInTheDocument()); + await userEvent.click(screen.getByText('Select log groups')); await waitFor(() => expect(screen.getByText('You need to save the data source before adding log groups.')).toBeInTheDocument() ); @@ -232,7 +232,7 @@ describe('Render', () => { }, }; const { rerender } = render(); - await waitFor(() => expect(screen.getByText('Select Log Groups')).toBeInTheDocument()); + await waitFor(() => expect(screen.getByText('Select log groups')).toBeInTheDocument()); const rerenderProps = { ...newProps, options: { @@ -245,7 +245,7 @@ describe('Render', () => { }; rerender(); await waitFor(() => expect(screen.getByText('AWS SDK Default')).toBeInTheDocument()); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); await waitFor(() => expect( screen.getByText( @@ -265,7 +265,7 @@ describe('Render', () => { }, }; const { rerender } = render(); - await waitFor(() => expect(screen.getByText('Select Log Groups')).toBeInTheDocument()); + await waitFor(() => expect(screen.getByText('Select log groups')).toBeInTheDocument()); const rerenderProps = { ...newProps, options: { @@ -274,7 +274,7 @@ describe('Render', () => { }, }; rerender(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); await waitFor(() => expect(screen.getByText('Log group name prefix')).toBeInTheDocument()); }); }); diff --git a/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsField.test.tsx b/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsField.test.tsx index b670c8486ae..05d1a336897 100644 --- a/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsField.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsField.test.tsx @@ -37,7 +37,7 @@ describe('LogGroupSelection', () => { .mockResolvedValue([{ value: { arn: 'arn', name: 'loggroupname' } }]); render(); - await waitFor(async () => expect(screen.getByText('Select Log Groups')).toBeInTheDocument()); + await waitFor(async () => expect(screen.getByText('Select log groups')).toBeInTheDocument()); expect(defaultProps.datasource.resources.getLogGroups).toHaveBeenCalledWith({ region: defaultProps.region, logGroupNamePrefix: 'loggroupname', @@ -53,7 +53,7 @@ describe('LogGroupSelection', () => { .mockResolvedValue([{ value: { arn: 'arn', name: 'loggroupname' } }]); render(); - await waitFor(async () => expect(screen.getByText('Select Log Groups')).toBeInTheDocument()); + await waitFor(async () => expect(screen.getByText('Select log groups')).toBeInTheDocument()); expect(defaultProps.datasource.resources.getLogGroups).toHaveBeenCalledTimes(1); expect(defaultProps.datasource.resources.getLogGroups).toHaveBeenCalledWith({ region: defaultProps.region, @@ -71,7 +71,7 @@ describe('LogGroupSelection', () => { .fn() .mockResolvedValue([{ value: { arn: 'arn', name: 'loggroupname' } }]); render(); - await waitFor(() => expect(screen.getByText('Select Log Groups')).toBeInTheDocument()); + await waitFor(() => expect(screen.getByText('Select log groups')).toBeInTheDocument()); expect(defaultProps.datasource.resources.getLogGroups).not.toHaveBeenCalled(); expect(defaultProps.onChange).not.toHaveBeenCalled(); }); diff --git a/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.test.tsx b/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.test.tsx index 62b22c6a361..96745674be9 100644 --- a/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.test.tsx @@ -68,9 +68,9 @@ describe('LogGroupsSelector', () => { afterEach(() => { lodash.debounce = originalDebounce; }); - it('opens a modal with a search field when the Select Log Groups Button is clicked', async () => { + it('opens a modal with a search field when the Select log groups Button is clicked', async () => { render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); }); @@ -81,7 +81,7 @@ describe('LogGroupsSelector', () => { return defaultProps.fetchLogGroups(); }); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Loading...')).toBeInTheDocument(); defer.resolve(); await waitFor(() => expect(screen.queryByText('Loading...')).not.toBeInTheDocument()); @@ -96,7 +96,7 @@ describe('LogGroupsSelector', () => { return []; }); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Loading...')).toBeInTheDocument(); defer.resolve(); await waitFor(() => expect(screen.queryByText('Loading...')).not.toBeInTheDocument()); @@ -108,7 +108,7 @@ describe('LogGroupsSelector', () => { it('calls fetchLogGroups with a search phrase when it is typed in the Search Field', async () => { const fetchLogGroups = jest.fn(() => defaultProps.fetchLogGroups()); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); await userEvent.type(screen.getByLabelText('log group search'), 'something'); await waitFor(() => screen.getByDisplayValue('something')); @@ -129,7 +129,7 @@ describe('LogGroupsSelector', () => { return defaultProps.fetchLogGroups(); }); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Loading...')).toBeInTheDocument(); firstCall.resolve(); await waitFor(() => expect(screen.queryByText('Loading...')).not.toBeInTheDocument()); @@ -147,7 +147,7 @@ describe('LogGroupsSelector', () => { it('shows a log group as checked after the user checks it', async () => { const onChange = jest.fn(); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); expect(screen.getByLabelText('logGroup2')).not.toBeChecked(); await userEvent.click(screen.getByLabelText('logGroup2')); @@ -157,7 +157,7 @@ describe('LogGroupsSelector', () => { it('calls onChange with the selected log group when checked and the user clicks the Add button', async () => { const onChange = jest.fn(); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); await userEvent.click(screen.getByLabelText('logGroup2')); await userEvent.click(screen.getByText('Add log groups')); @@ -174,7 +174,7 @@ describe('LogGroupsSelector', () => { it('does not call onChange after a selection if the user hits the cancel button', async () => { const onChange = jest.fn(); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); await userEvent.click(screen.getByLabelText('logGroup2')); await userEvent.click(screen.getByText('Cancel')); @@ -197,7 +197,7 @@ describe('LogGroupsSelector', () => { return []; }); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.queryByText(labelText)).not.toBeInTheDocument(); defer.resolve(); await waitFor(() => expect(screen.queryByText(labelText)).not.toBeInTheDocument()); @@ -215,7 +215,7 @@ describe('LogGroupsSelector', () => { })); }); render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.queryByText(labelText)).not.toBeInTheDocument(); defer.resolve(); await waitFor(() => expect(screen.getByText(labelText)).toBeInTheDocument()); @@ -223,7 +223,7 @@ describe('LogGroupsSelector', () => { it('should display log groups counter label', async () => { render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); await waitFor(() => expect(screen.getByText('0 log groups selected')).toBeInTheDocument()); await userEvent.click(screen.getByLabelText('logGroup2')); await waitFor(() => expect(screen.getByText('1 log group selected')).toBeInTheDocument()); @@ -239,7 +239,7 @@ describe('LogGroupsSelector', () => { ]} /> ); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); await waitFor(() => expect(screen.getByText('1 log group selected')).toBeInTheDocument()); }); @@ -255,7 +255,7 @@ describe('LogGroupsSelector', () => { onChange={onChange} /> ); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); await selectEvent.select(screen.getByLabelText('Template variable'), '$logGroupVariable', { container: document.body, }); @@ -284,7 +284,7 @@ describe('LogGroupsSelector', () => { onChange={onChange} /> ); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); await screen.getByRole('button', { name: 'select-clear-value' }).click(); await userEvent.click(screen.getByText('Add log groups')); expect(onChange).toHaveBeenCalledWith([ @@ -297,7 +297,7 @@ describe('LogGroupsSelector', () => { it('should display account label if account options prop has values', async () => { render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); expect(screen.getByText('Account label')).toBeInTheDocument(); waitFor(() => expect(screen.getByText('Account Name 123')).toBeInTheDocument()); @@ -305,7 +305,7 @@ describe('LogGroupsSelector', () => { it('should not display account label if account options prop doesnt has values', async () => { render(); - await userEvent.click(screen.getByText('Select Log Groups')); + await userEvent.click(screen.getByText('Select log groups')); expect(screen.getByText('Log group name prefix')).toBeInTheDocument(); expect(screen.queryByText('Account label')).not.toBeInTheDocument(); waitFor(() => expect(screen.queryByText('Account Name 123')).not.toBeInTheDocument()); diff --git a/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.tsx b/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.tsx index e4e53f8e92a..7e9bc683044 100644 --- a/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/LogGroups/LogGroupsSelector.tsx @@ -112,7 +112,7 @@ export const LogGroupsSelector = ({ return ( <> - +
@@ -229,15 +229,15 @@ export const LogGroupsSelector = ({ }} /> - -
- - -
+ +
@@ -251,7 +251,7 @@ export const LogGroupsSelector = ({ }} type="button" > - Select Log Groups + Select log groups
diff --git a/public/app/plugins/datasource/cloudwatch/components/QueryEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/QueryEditor.test.tsx index 61542d80086..c1b2acd9752 100644 --- a/public/app/plugins/datasource/cloudwatch/components/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/QueryEditor.test.tsx @@ -118,7 +118,7 @@ describe('QueryEditor should render right editor', () => { statistic: 'Average', } as CloudWatchQuery; render(); - expect(await screen.findByText('Select Log Groups')).toBeInTheDocument(); + expect(await screen.findByText('Select log groups')).toBeInTheDocument(); }); }); diff --git a/public/app/plugins/datasource/cloudwatch/components/styles.ts b/public/app/plugins/datasource/cloudwatch/components/styles.ts index 4d69dd7a07e..7c0025d2d39 100644 --- a/public/app/plugins/datasource/cloudwatch/components/styles.ts +++ b/public/app/plugins/datasource/cloudwatch/components/styles.ts @@ -95,10 +95,6 @@ const getStyles = (theme: GrafanaTheme2) => ({ verticalAlign: 'middle', marginLeft: theme.spacing(0.5), }), - - addBtn: css({ - marginRight: '10px', - }), }); export default getStyles;