From 1c58202b26cc738e1b51e1add6606b7e602cfda8 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Sun, 12 Apr 2020 22:20:02 +0200 Subject: [PATCH] @grafana/ui: Replace various icons using Icon component (#23442) * Replace icons in dashboard and settings * Replace icons in alerting * Update batch of icons * Implement icons accross various files * Style updates * Search: Fix recent and starred icons * Update styling and details * Replace new icon created by unicons * Fix e2e test, styling * Minor styling updates Co-authored-by: Clarity-89 --- .../components/AlphaNotice/AlphaNotice.tsx | 3 +- .../src/components/Button/Button.story.tsx | 2 +- .../ButtonCascader/ButtonCascader.tsx | 2 +- .../src/components/Cascader/Cascader.tsx | 8 +- .../components/ContextMenu/ContextMenu.tsx | 9 +- .../components/DataLinks/DataLinkEditor.tsx | 3 +- .../CustomHeadersSettings.tsx | 3 +- .../DataSourceHttpSettings.tsx | 3 +- .../src/components/Drawer/Drawer.tsx | 3 +- .../src/components/FormLabel/FormLabel.tsx | 2 +- .../Forms/FieldValidationMessage.tsx | 3 +- .../Select/ButtonSelect.story.internal.tsx | 2 +- .../Forms/Legacy/Select/ButtonSelect.tsx | 3 +- .../Legacy/Select/IndicatorsContainer.tsx | 5 +- .../Forms/Legacy/Select/SelectOption.tsx | 3 +- .../Forms/Legacy/Select/_Select.scss | 4 +- .../grafana-ui/src/components/Icon/Icon.tsx | 6 + .../src/components/Icon/assets/Circle.tsx | 17 + .../src/components/Icon/assets/index.ts | 1 + .../grafana-ui/src/components/Input/Input.tsx | 1 + .../src/components/Legend/LegendTable.tsx | 13 +- .../src/components/Legend/SeriesIcon.tsx | 4 +- .../LoadingPlaceholder/LoadingPlaceholder.tsx | 3 +- .../src/components/Modal/Modal.story.tsx | 3 +- .../PanelOptionsGroup/PanelOptionsGroup.tsx | 2 +- .../src/components/Segment/Segment.story.tsx | 3 +- .../components/Segment/SegmentAsync.story.tsx | 3 +- .../components/Segment/SegmentInput.story.tsx | 3 +- .../src/components/Select/SelectBase.tsx | 2 +- .../components/Select/SelectOptionGroup.tsx | 6 +- .../src/components/Spinner/Spinner.tsx | 3 +- .../TableInputCSV/TableInputCSV.tsx | 3 +- .../src/components/TagsInput/TagItem.tsx | 12 +- .../TimePickerContent/TimePickerCalendar.tsx | 13 +- .../TimePickerContent/TimeRangeOption.tsx | 3 +- .../FilterByNameTransformerEditor.tsx | 15 +- .../FilterByRefIdTransformerEditor.tsx | 15 +- packages/grafana-ui/src/types/icon.ts | 103 +++-- packages/grafana-ui/src/utils/dataLinks.ts | 2 +- pkg/components/dashdiffs/formatter_basic.go | 8 +- .../input-datasource/src/InputQueryEditor.tsx | 4 +- .../components/EmptyListCTA/EmptyListCTA.tsx | 2 +- public/app/core/components/Footer/Footer.tsx | 5 +- .../components/PageHeader/PageHeader.test.tsx | 4 +- .../PermissionList/PermissionListItem.tsx | 4 +- .../__snapshots__/TeamPicker.test.tsx.snap | 24 +- .../__snapshots__/UserPicker.test.tsx.snap | 24 +- public/app/core/components/help/HelpModal.tsx | 4 +- .../manage_dashboards/manage_dashboards.html | 2 +- .../manage_dashboards/manage_dashboards.ts | 2 +- .../components/search/search_results.html | 2 +- .../app/core/components/sidemenu/SignIn.tsx | 3 +- .../__snapshots__/SignIn.test.tsx.snap | 4 +- public/app/core/copy/appNotification.ts | 6 +- public/app/core/nav_model_srv.ts | 2 +- public/app/core/selectors/navModel.ts | 2 +- public/app/core/services/search_srv.ts | 4 +- public/app/core/services/util_srv.ts | 2 +- .../app/core/specs/manage_dashboards.test.ts | 12 +- .../app/features/admin/AdminEditUserCtrl.ts | 2 +- .../app/features/admin/AdminListOrgsCtrl.ts | 2 +- public/app/features/admin/UserSyncInfo.tsx | 3 +- .../admin/ldap/LdapConnectionStatus.tsx | 6 +- .../app/features/admin/ldap/LdapSyncInfo.tsx | 3 +- .../features/admin/ldap/LdapUserGroups.tsx | 6 +- .../admin/ldap/LdapUserPermissions.tsx | 4 +- .../app/features/admin/ldap/LdapUserTeams.tsx | 4 +- .../app/features/admin/partials/edit_org.html | 2 +- .../features/admin/partials/edit_user.html | 2 +- public/app/features/admin/partials/orgs.html | 2 +- public/app/features/alerting/AlertTabCtrl.ts | 18 +- public/app/features/alerting/StateHistory.tsx | 7 +- .../app/features/alerting/TestRuleResult.tsx | 8 +- .../alerting/partials/alert_howto.html | 2 +- .../features/alerting/partials/alert_tab.html | 18 +- .../alerting/partials/notifications_list.html | 2 +- .../app/features/alerting/state/alertDef.ts | 2 +- .../features/alerting/state/reducers.test.ts | 2 +- .../app/features/annotations/editor_ctrl.ts | 2 +- .../features/annotations/partials/editor.html | 14 +- .../features/api-keys/ApiKeysAddedModal.tsx | 2 +- .../ApiKeysAddedModal.test.tsx.snap | 1 + .../DashLinks/DashLinksContainerCtrl.ts | 4 +- .../DashLinks/DashLinksEditorCtrl.ts | 2 +- .../components/DashLinks/editor.html | 12 +- .../dashboard/components/DashNav/DashNav.tsx | 7 +- .../components/DashboardRow/DashboardRow.tsx | 12 +- .../DashboardSettings/SettingsCtrl.ts | 22 +- .../DashboardSettings/template.html | 2 +- .../components/RowOptions/template.html | 2 +- .../components/ShareModal/ShareLink.tsx | 2 +- .../components/ShareModal/ShareSnapshot.tsx | 4 +- .../UnsavedChangesModalCtrl.ts | 2 +- .../components/VersionHistory/template.html | 90 +++-- .../dashboard/containers/DashboardPage.tsx | 4 +- .../__snapshots__/DashboardPage.test.tsx.snap | 5 +- .../dashboard/dashgrid/PanelChromeAngular.tsx | 1 + .../dashgrid/PanelHeader/PanelHeader.tsx | 14 +- .../dashboard/panel_editor/EditorTabBody.tsx | 4 +- .../dashboard/panel_editor/QueriesTab.tsx | 2 +- .../dashboard/panel_editor/QueryInspector.tsx | 8 +- .../panel_editor/VisualizationTab.tsx | 5 +- .../panel_editor/VizPickerSearch.tsx | 3 +- .../features/datasources/DashboardsTable.tsx | 5 +- .../DashboardsTable.test.tsx.snap | 12 +- .../settings/DataSourceSettingsPage.tsx | 11 +- .../app/features/explore/AdHocFilterField.tsx | 3 +- .../app/features/explore/ErrorContainer.tsx | 3 +- .../features/explore/ExploreGraphPanel.tsx | 3 +- public/app/features/explore/LiveLogs.tsx | 6 +- .../app/features/explore/LiveTailButton.tsx | 4 +- .../explore/NoDataSourceCallToAction.tsx | 4 +- .../features/explore/QueryRowActions.test.tsx | 4 +- .../app/features/explore/SecondaryActions.tsx | 6 +- .../app/features/explore/TimeSyncButton.tsx | 4 +- .../ErrorContainer.test.tsx.snap | 4 +- .../TimeSyncButton.test.tsx.snap | 30 +- .../features/folders/FolderSettingsPage.tsx | 2 +- .../manage-dashboards/SnapshotListCtrl.ts | 2 +- .../MoveToFolderModal/template.html | 2 +- .../partials/snapshot_list.html | 2 +- .../app/features/panel/panellinks/module.html | 95 +++-- .../features/panel/partials/panelTime.html | 6 +- .../features/playlist/partials/playlists.html | 12 +- .../app/features/playlist/playlists_ctrl.ts | 2 +- .../plugins/partials/update_instructions.html | 2 +- .../search/components/DashboardSearch.tsx | 19 +- public/app/features/teams/TeamGroupSync.tsx | 4 +- .../__snapshots__/TeamGroupSync.test.tsx.snap | 19 +- .../features/templating/partials/editor.html | 28 +- public/app/features/users/InviteeRow.tsx | 2 +- public/app/features/users/UsersListPage.tsx | 2 +- public/app/features/users/UsersTable.tsx | 2 +- .../__snapshots__/UsersTable.test.tsx.snap | 30 ++ .../adhoc/picker/AdHocFilterBuilder.tsx | 4 +- .../editor/VariableEditorContainer.tsx | 9 +- .../variables/editor/VariableEditorList.tsx | 10 +- public/app/partials/confirm_modal.html | 2 +- public/app/partials/error.html | 13 +- public/app/partials/valueSelectDropdown.html | 2 +- .../cloudwatch/components/Dimensions.test.tsx | 4 +- .../cloudwatch/components/Dimensions.tsx | 4 +- .../cloudwatch/components/QueryEditor.tsx | 5 +- .../cloudwatch/components/Stats.tsx | 4 +- .../__snapshots__/Stats.test.tsx.snap | 19 +- .../dashboard/DashboardQueryEditor.tsx | 4 +- .../elasticsearch/partials/bucket_agg.html | 380 +++++++++++------- .../elasticsearch/partials/metric_agg.html | 18 +- .../partials/pipeline_variables.html | 40 +- .../partials/annotations.editor.html | 40 +- .../partials/query.editor.html | 8 +- .../graphite/FunctionEditorControls.tsx | 2 +- .../datasource/graphite/add_graphite_func.ts | 2 +- .../graphite/partials/query.editor.html | 2 +- .../influxdb/partials/query.editor.html | 2 +- .../mssql/partials/annotations.editor.html | 31 +- .../mssql/partials/query.editor.html | 8 +- .../mysql/partials/annotations.editor.html | 31 +- .../mysql/partials/query.editor.html | 8 +- .../plugins/datasource/mysql/query_ctrl.ts | 2 +- .../opentsdb/partials/query.editor.html | 16 +- .../postgres/partials/annotations.editor.html | 31 +- .../datasource/postgres/partials/config.html | 4 +- .../postgres/partials/query.editor.html | 8 +- .../plugins/datasource/postgres/query_ctrl.ts | 2 +- .../prometheus/components/PromLink.tsx | 3 +- .../stackdriver/components/Aggregations.tsx | 4 +- .../stackdriver/components/GroupBys.tsx | 4 +- .../stackdriver/components/Help.tsx | 5 +- .../stackdriver/components/LabelFilter.tsx | 4 +- .../__snapshots__/Aggregations.test.tsx.snap | 19 +- .../stackdriver/partials/config.html | 6 +- .../plugins/datasource/testdata/module.tsx | 2 +- .../app/plugins/panel/alertlist/module.html | 2 +- .../app/plugins/panel/graph/Legend/Legend.tsx | 4 +- .../panel/graph/Legend/LegendSeriesItem.tsx | 4 +- public/app/plugins/panel/graph/graph.ts | 4 +- .../app/plugins/panel/graph/tab_display.html | 8 +- .../plugins/panel/graph/thresholds_form.html | 64 ++- .../panel/graph/time_regions_form.html | 48 ++- .../app/plugins/panel/pluginlist/editor.html | 4 +- .../app/plugins/panel/singlestat/editor.html | 2 +- .../plugins/panel/singlestat/mappings.html | 4 +- .../plugins/panel/table/column_options.html | 6 +- public/app/plugins/panel/table/module.html | 47 +-- public/sass/components/_buttons.scss | 3 - public/sass/components/_gf-form.scss | 2 +- public/sass/components/_modals.scss | 5 - public/sass/components/_search.scss | 3 - public/sass/pages/_alerting.scss | 34 +- public/sass/pages/_history.scss | 5 +- public/vendor/angular-other/datepicker.js | 2 +- public/views/error-template.html | 2 +- 193 files changed, 1256 insertions(+), 824 deletions(-) create mode 100644 packages/grafana-ui/src/components/Icon/assets/Circle.tsx diff --git a/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx b/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx index cc362a41f49..3a712eb66ee 100644 --- a/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx +++ b/packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx @@ -2,6 +2,7 @@ import React, { FC, useContext } from 'react'; import { css, cx } from 'emotion'; import { ThemeContext } from '../../index'; import { PluginState } from '@grafana/data'; +import { Icon } from '../Icon/Icon'; interface Props { state?: PluginState; @@ -30,7 +31,7 @@ export const AlphaNotice: FC = ({ state, text, className }) => { return (
- {state} + {state}
); }; diff --git a/packages/grafana-ui/src/components/Button/Button.story.tsx b/packages/grafana-ui/src/components/Button/Button.story.tsx index 106dc4aa7bc..3c9a42932f4 100644 --- a/packages/grafana-ui/src/components/Button/Button.story.tsx +++ b/packages/grafana-ui/src/components/Button/Button.story.tsx @@ -28,7 +28,7 @@ export const simple = () => { const icon = getIconKnob(); return ( - ); diff --git a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx index e6a166bc7b3..76282e1e0b4 100644 --- a/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx +++ b/packages/grafana-ui/src/components/ButtonCascader/ButtonCascader.tsx @@ -40,7 +40,7 @@ export const ButtonCascader: React.FC = props => { expandIcon={null} > ); diff --git a/packages/grafana-ui/src/components/Cascader/Cascader.tsx b/packages/grafana-ui/src/components/Cascader/Cascader.tsx index 5eb4b08c757..00834df5e2b 100644 --- a/packages/grafana-ui/src/components/Cascader/Cascader.tsx +++ b/packages/grafana-ui/src/components/Cascader/Cascader.tsx @@ -212,7 +212,13 @@ export class Cascader extends React.PureComponent value={activeLabel} onKeyDown={this.onInputKeyDown} onChange={() => {}} - suffix={focusCascade ? : } + suffix={ + focusCascade ? ( + + ) : ( + + ) + } /> diff --git a/packages/grafana-ui/src/components/ContextMenu/ContextMenu.tsx b/packages/grafana-ui/src/components/ContextMenu/ContextMenu.tsx index a69a7fb4a82..2f85d15d336 100644 --- a/packages/grafana-ui/src/components/ContextMenu/ContextMenu.tsx +++ b/packages/grafana-ui/src/components/ContextMenu/ContextMenu.tsx @@ -5,6 +5,8 @@ import { selectThemeVariant, ThemeContext } from '../../index'; import { GrafanaTheme } from '@grafana/data'; import { stylesFactory } from '../../themes/stylesFactory'; import { Portal, List } from '../index'; +import { Icon } from '../Icon/Icon'; +import { IconName } from '../../types'; import { LinkTarget } from '@grafana/data'; export interface ContextMenuItem { @@ -140,13 +142,8 @@ const getContextMenuStyles = stylesFactory((theme: GrafanaTheme) => { `, icon: css` opacity: 0.7; - width: 12px; - height: 12px; - display: inline-block; margin-right: 10px; color: ${theme.colors.linkDisabled}; - position: relative; - top: 4px; `, }; }); @@ -226,7 +223,7 @@ const ContextMenuItem: React.FC = React.memo( } }} > - {icon && } {label} + {icon && } {label} ); diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinkEditor.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinkEditor.tsx index d95ce24a526..f622f12ede3 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinkEditor.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinkEditor.tsx @@ -5,6 +5,7 @@ import { Switch } from '../Switch/Switch'; import { css } from 'emotion'; import { ThemeContext, stylesFactory } from '../../themes/index'; import { DataLinkInput } from './DataLinkInput'; +import { Icon } from '../Icon/Icon'; interface DataLinkEditorProps { index: number; @@ -60,7 +61,7 @@ export const DataLinkEditor: React.FC = React.memo( /> = ({ header, onBlur, onCha onBlur={onBlur} /> ); diff --git a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.tsx b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.tsx index 646a04c158c..e6ec09478db 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.tsx @@ -10,6 +10,7 @@ import { HttpSettingsProps } from './types'; import { CustomHeadersSettings } from './CustomHeadersSettings'; import { Select } from '../Forms/Legacy/Select/Select'; import { Input } from '../Forms/Legacy/Input/Input'; +import { Icon } from '../Icon/Icon'; import { FormField } from '../FormField/FormField'; import { FormLabel } from '../FormLabel/FormLabel'; import { Switch } from '../Switch/Switch'; @@ -139,7 +140,7 @@ export const DataSourceHttpSettings: React.FC = props => { onClick={() => setIsAccessHelpVisible(isVisible => !isVisible)} > Help  - + diff --git a/packages/grafana-ui/src/components/Drawer/Drawer.tsx b/packages/grafana-ui/src/components/Drawer/Drawer.tsx index ead948eb347..9fb7d53ea29 100644 --- a/packages/grafana-ui/src/components/Drawer/Drawer.tsx +++ b/packages/grafana-ui/src/components/Drawer/Drawer.tsx @@ -3,6 +3,7 @@ import { GrafanaTheme } from '@grafana/data'; import RcDrawer from 'rc-drawer'; import { css } from 'emotion'; import CustomScrollbar from '../CustomScrollbar/CustomScrollbar'; +import { Icon } from '../Icon/Icon'; import { stylesFactory, useTheme } from '../../themes'; export interface Props { @@ -93,7 +94,7 @@ export const Drawer: FC = ({
{title}
- +
)} diff --git a/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx b/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx index ca3fd9bf4f5..19cfdf6e615 100644 --- a/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx +++ b/packages/grafana-ui/src/components/FormLabel/FormLabel.tsx @@ -34,7 +34,7 @@ export const FormLabel: FunctionComponent = ({ {tooltip && (
- +
)} diff --git a/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx b/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx index f1c57a41651..6b6dc427979 100644 --- a/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldValidationMessage.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { useTheme, stylesFactory } from '../../themes'; import { GrafanaTheme } from '@grafana/data'; import { css, cx } from 'emotion'; +import { Icon } from '../Icon/Icon'; export interface FieldValidationMessageProps { children: string; @@ -45,7 +46,7 @@ export const FieldValidationMessage: React.FC = ({ return (
- + {children}
); diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.story.internal.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.story.internal.tsx index 9dff759ed59..e1575baac79 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.story.internal.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.story.internal.tsx @@ -32,7 +32,7 @@ ButtonSelectStories.add('default', () => { }} label={value.label ? value.label : ''} className="refresh-select" - iconClass={text('iconClass', 'fa fa-clock-o fa-fw')} + iconClass={text('iconClass', 'clock-nine')} /> ); }} diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.tsx index 4379b35d457..da4d801529f 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/ButtonSelect.tsx @@ -2,6 +2,7 @@ import React, { PureComponent, ReactElement } from 'react'; import Select from './Select'; import { PopoverContent } from '../../../Tooltip/Tooltip'; import { Icon } from '../../../Icon/Icon'; +import { IconName } from '../../../../types'; import { SelectableValue } from '@grafana/data'; interface ButtonComponentProps { @@ -22,7 +23,7 @@ const ButtonComponent = (buttonProps: ButtonComponentProps) => (props: any) => { tabIndex={0} // necessary to get onBlur to work https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus >
- {iconClass && } + {iconClass && } {label ? label : ''} {!props.menuIsOpen && } {props.menuIsOpen && } diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx index 260fe6ebbdf..08f78bd11e2 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { Icon } from '../../../Icon/Icon'; // Ignoring because I couldn't get @types/react-select work wih Torkel's fork // @ts-ignore @@ -8,9 +9,7 @@ export const IndicatorsContainer = (props: any) => { const isOpen = props.selectProps.menuIsOpen; return ( - + ); }; diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx index b3606797918..1d7b64c7d49 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { Icon } from '../../../Icon/Icon'; // Ignoring because I couldn't get @types/react-select work wih Torkel's fork // @ts-ignore @@ -24,7 +25,7 @@ export const SelectOption = (props: ExtendedOptionProps) => {
{children}
{data.description &&
{data.description}
}
- {isSelected &&