mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
108 lines
3.3 KiB
TypeScript
108 lines
3.3 KiB
TypeScript
import React, { PureComponent } from 'react';
|
|
import { css } from 'emotion';
|
|
import appEvents from '../../app_events';
|
|
import { User } from '../../services/context_srv';
|
|
import { NavModelItem } from '@grafana/data';
|
|
import { Icon, IconName } from '@grafana/ui';
|
|
import { CoreEvents } from 'app/types';
|
|
import { OrgSwitcher } from '../OrgSwitcher';
|
|
import { getFooterLinks } from '../Footer/Footer';
|
|
|
|
export interface Props {
|
|
link: NavModelItem;
|
|
user: User;
|
|
}
|
|
|
|
interface State {
|
|
showSwitcherModal: boolean;
|
|
}
|
|
|
|
export default class BottomNavLinks extends PureComponent<Props, State> {
|
|
state: State = {
|
|
showSwitcherModal: false,
|
|
};
|
|
|
|
onOpenShortcuts = () => {
|
|
appEvents.emit(CoreEvents.showModal, {
|
|
templateHtml: '<help-modal></help-modal>',
|
|
});
|
|
};
|
|
|
|
toggleSwitcherModal = () => {
|
|
this.setState(prevState => ({
|
|
showSwitcherModal: !prevState.showSwitcherModal,
|
|
}));
|
|
};
|
|
|
|
render() {
|
|
const { link, user } = this.props;
|
|
const { showSwitcherModal } = this.state;
|
|
const subMenuIconClassName = css`
|
|
margin-right: 8px;
|
|
`;
|
|
|
|
let children = link.children || [];
|
|
|
|
if (link.id === 'help') {
|
|
children = getFooterLinks();
|
|
}
|
|
|
|
return (
|
|
<div className="sidemenu-item dropdown dropup">
|
|
<a href={link.url} className="sidemenu-link" target={link.target}>
|
|
<span className="icon-circle sidemenu-icon">
|
|
{link.icon && <Icon name={link.icon as IconName} size="xl" />}
|
|
{link.img && <img src={link.img} />}
|
|
</span>
|
|
</a>
|
|
<ul className="dropdown-menu dropdown-menu--sidemenu" role="menu">
|
|
{link.subTitle && (
|
|
<li className="sidemenu-subtitle">
|
|
<span className="sidemenu-item-text">{link.subTitle}</span>
|
|
</li>
|
|
)}
|
|
{link.showOrgSwitcher && (
|
|
<li className="sidemenu-org-switcher">
|
|
<a onClick={this.toggleSwitcherModal}>
|
|
<div>
|
|
<div className="sidemenu-org-switcher__org-current">Current Org.:</div>
|
|
<div className="sidemenu-org-switcher__org-name">{user.orgName}</div>
|
|
</div>
|
|
<div className="sidemenu-org-switcher__switch">
|
|
<Icon name="arrow-random" className={subMenuIconClassName} />
|
|
Switch
|
|
</div>
|
|
</a>
|
|
</li>
|
|
)}
|
|
|
|
{showSwitcherModal && <OrgSwitcher onDismiss={this.toggleSwitcherModal} />}
|
|
|
|
{children.map((child, index) => {
|
|
return (
|
|
<li key={`${child.text}-${index}`}>
|
|
<a href={child.url} target={child.target} rel="noopener">
|
|
{child.icon && <Icon name={child.icon as IconName} className={subMenuIconClassName} />}
|
|
{child.text}
|
|
</a>
|
|
</li>
|
|
);
|
|
})}
|
|
|
|
{link.id === 'help' && (
|
|
<li key="keyboard-shortcuts">
|
|
<a onClick={() => this.onOpenShortcuts()}>
|
|
<Icon name="keyboard" className={subMenuIconClassName} /> Keyboard shortcuts
|
|
</a>
|
|
</li>
|
|
)}
|
|
|
|
<li className="side-menu-header">
|
|
<span className="sidemenu-item-text">{link.text}</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
);
|
|
}
|
|
}
|