mirror of https://github.com/grafana/grafana.git
i18n: removes useTranslate hook (#106556)
* i18n: removes useTranslate hook * chore: fix duplicate imports * chore: fix import sorting and hook dependencies
This commit is contained in:
parent
e73530da09
commit
2b8c74de2e
|
@ -75,9 +75,8 @@ const ErrorMessage = ({ id, message }) => <Trans i18nKey={`errors.${id}`}>There
|
||||||
Sometimes you may need to translate a string cannot be represented in JSX, such as `placeholder` props. Use the `t` macro for this.
|
Sometimes you may need to translate a string cannot be represented in JSX, such as `placeholder` props. Use the `t` macro for this.
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { useTranslate } from "@grafana/i18n"
|
import { t } from "@grafana/i18n"
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
const placeholder = t('form.username-placeholder','Username');
|
const placeholder = t('form.username-placeholder','Username');
|
||||||
|
|
||||||
return <input type="value" placeholder={placeholder}>
|
return <input type="value" placeholder={placeholder}>
|
||||||
|
@ -211,9 +210,8 @@ import { Trans } from '@grafana/i18n';
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
const translatedString = t('inbox.heading', 'You got {{count}} messages', { count: messages.length });
|
const translatedString = t('inbox.heading', 'You got {{count}} messages', { count: messages.length });
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -192,11 +192,6 @@ export const t: TFunction = (id: string, defaultMessage: string, values?: Record
|
||||||
return tFunc(id, defaultMessage, values);
|
return tFunc(id, defaultMessage, values);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function useTranslate() {
|
|
||||||
initDefaultI18nInstance();
|
|
||||||
return { t };
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Trans(props: TransProps) {
|
export function Trans(props: TransProps) {
|
||||||
initDefaultI18nInstance();
|
initDefaultI18nInstance();
|
||||||
const Component = transComponent ?? I18NextTrans;
|
const Component = transComponent ?? I18NextTrans;
|
||||||
|
|
|
@ -22,6 +22,6 @@ export {
|
||||||
PSEUDO_LOCALE,
|
PSEUDO_LOCALE,
|
||||||
DEFAULT_LANGUAGE,
|
DEFAULT_LANGUAGE,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
export { initPluginTranslations, Trans, useTranslate } from './i18n';
|
export { initPluginTranslations, t, Trans } from './i18n';
|
||||||
export type { ResourceLoader, Resources, TFunction, TransProps } from './types';
|
export type { ResourceLoader, Resources, TFunction, TransProps } from './types';
|
||||||
export { formatDate, formatDuration, formatDateRange } from './dates';
|
export { formatDate, formatDuration, formatDateRange } from './dates';
|
||||||
|
|
|
@ -17,5 +17,4 @@ export {
|
||||||
getLanguage,
|
getLanguage,
|
||||||
getResolvedLanguage,
|
getResolvedLanguage,
|
||||||
initializeI18n,
|
initializeI18n,
|
||||||
t,
|
|
||||||
} from '../i18n';
|
} from '../i18n';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { isFetchError } from '@grafana/runtime';
|
import { isFetchError } from '@grafana/runtime';
|
||||||
import { notifyApp } from 'app/core/actions';
|
import { notifyApp } from 'app/core/actions';
|
||||||
import { createSuccessNotification, createErrorNotification } from 'app/core/copy/appNotification';
|
import { createSuccessNotification, createErrorNotification } from 'app/core/copy/appNotification';
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { Trans } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { t } from '@grafana/i18n/internal';
|
|
||||||
import { Button, Select, Stack } from '@grafana/ui';
|
import { Button, Select, Stack } from '@grafana/ui';
|
||||||
import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
|
import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
|
||||||
import { ServiceAccountPicker } from 'app/core/components/Select/ServiceAccountPicker';
|
import { ServiceAccountPicker } from 'app/core/components/Select/ServiceAccountPicker';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Box, Button, Icon, Select, Tooltip, useStyles2 } from '@grafana/ui';
|
import { Box, Button, Icon, Select, Tooltip, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { ResourcePermission } from './types';
|
import { ResourcePermission } from './types';
|
||||||
|
@ -16,7 +16,7 @@ interface Props {
|
||||||
|
|
||||||
export const PermissionListItem = ({ item, permissionLevels, canSet, onRemove, onChange }: Props) => {
|
export const PermissionListItem = ({ item, permissionLevels, canSet, onRemove, onChange }: Props) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td>{getAvatar(item)}</td>
|
<td>{getAvatar(item)}</td>
|
||||||
|
|
|
@ -4,8 +4,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { t } from '@grafana/i18n/internal';
|
|
||||||
import { Text, Box, Button, useStyles2, Space } from '@grafana/ui';
|
import { Text, Box, Button, useStyles2, Space } from '@grafana/ui';
|
||||||
import { SlideDown } from 'app/core/components/Animations/SlideDown';
|
import { SlideDown } from 'app/core/components/Animations/SlideDown';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { useObservable } from 'react-use';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
|
|
||||||
import { AppEvents, NavModel, NavModelItem, PageLayoutType, UrlQueryValue } from '@grafana/data';
|
import { AppEvents, NavModel, NavModelItem, PageLayoutType, UrlQueryValue } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { config, locationService, reportInteraction } from '@grafana/runtime';
|
import { config, locationService, reportInteraction } from '@grafana/runtime';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
|
|
|
@ -1,26 +1,18 @@
|
||||||
import { render, screen, fireEvent } from '@testing-library/react';
|
import { render, screen, fireEvent } from '@testing-library/react';
|
||||||
|
|
||||||
import { useTranslate } from '@grafana/i18n';
|
|
||||||
|
|
||||||
import { ExtensionToolbarItemButton } from './ExtensionToolbarItemButton';
|
import { ExtensionToolbarItemButton } from './ExtensionToolbarItemButton';
|
||||||
|
|
||||||
// Mock the useTranslate hook
|
// Mock the useTranslate hook
|
||||||
jest.mock('@grafana/i18n', () => ({
|
jest.mock('@grafana/i18n', () => ({
|
||||||
useTranslate: jest.fn(),
|
t: (_: string, fallback: string, values?: Record<string, string>) => {
|
||||||
}));
|
|
||||||
|
|
||||||
describe('ExtensionToolbarItemButton', () => {
|
|
||||||
const mockTranslate = (_: string, fallback: string, values?: Record<string, string>) => {
|
|
||||||
if (values) {
|
if (values) {
|
||||||
return fallback.replace('{{title}}', values.title);
|
return fallback.replace('{{title}}', values.title);
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
};
|
},
|
||||||
|
}));
|
||||||
beforeEach(() => {
|
|
||||||
(useTranslate as jest.Mock).mockReturnValue({ t: mockTranslate });
|
|
||||||
});
|
|
||||||
|
|
||||||
|
describe('ExtensionToolbarItemButton', () => {
|
||||||
it('renders open button with default tooltip when no title is provided', () => {
|
it('renders open button with default tooltip when no title is provided', () => {
|
||||||
render(<ExtensionToolbarItemButton isOpen={false} />);
|
render(<ExtensionToolbarItemButton isOpen={false} />);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { ToolbarButton, useStyles2 } from '@grafana/ui';
|
import { ToolbarButton, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
interface ToolbarItemButtonProps {
|
interface ToolbarItemButtonProps {
|
||||||
|
@ -16,7 +16,6 @@ function ExtensionToolbarItemButtonComponent(
|
||||||
ref: React.ForwardedRef<HTMLButtonElement>
|
ref: React.ForwardedRef<HTMLButtonElement>
|
||||||
) {
|
) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
// render button to close the sidebar
|
// render button to close the sidebar
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
||||||
import { useToggle } from 'react-use';
|
import { useToggle } from 'react-use';
|
||||||
|
|
||||||
import { GrafanaTheme2, store } from '@grafana/data';
|
import { GrafanaTheme2, store } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Drawer, ToolbarButton, useStyles2 } from '@grafana/ui';
|
import { Drawer, ToolbarButton, useStyles2 } from '@grafana/ui';
|
||||||
import { appEvents } from 'app/core/app_events';
|
import { appEvents } from 'app/core/app_events';
|
||||||
import { RecordHistoryEntryEvent } from 'app/types/events';
|
import { RecordHistoryEntryEvent } from 'app/types/events';
|
||||||
|
@ -47,7 +47,6 @@ export function HistoryContainer() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import moment from 'moment';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import { FieldType, GrafanaTheme2, store } from '@grafana/data';
|
import { FieldType, GrafanaTheme2, store } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Button, Card, IconButton, Space, Stack, Text, useStyles2, Box, Sparkline, useTheme2, Icon } from '@grafana/ui';
|
import { Button, Card, IconButton, Space, Stack, Text, useStyles2, Box, Sparkline, useTheme2, Icon } from '@grafana/ui';
|
||||||
import { formatDate } from 'app/core/internationalization/dates';
|
import { formatDate } from 'app/core/internationalization/dates';
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import { HistoryEntry } from '../types';
|
||||||
import { logClickUnifiedHistoryEntryEvent, logUnifiedHistoryShowMoreEvent } from './eventsTracking';
|
import { logClickUnifiedHistoryEntryEvent, logUnifiedHistoryShowMoreEvent } from './eventsTracking';
|
||||||
|
|
||||||
export function HistoryWrapper({ onClose }: { onClose: () => void }) {
|
export function HistoryWrapper({ onClose }: { onClose: () => void }) {
|
||||||
const { t } = useTranslate();
|
|
||||||
const history = store.getObject<HistoryEntry[]>(HISTORY_LOCAL_STORAGE_KEY, []).filter((entry) => {
|
const history = store.getObject<HistoryEntry[]>(HISTORY_LOCAL_STORAGE_KEY, []).filter((entry) => {
|
||||||
return moment(entry.time).isAfter(moment().subtract(2, 'day').startOf('day'));
|
return moment(entry.time).isAfter(moment().subtract(2, 'day').startOf('day'));
|
||||||
});
|
});
|
||||||
|
@ -89,7 +88,7 @@ function HistoryEntryAppView({ entry, isSelected, onClick }: ItemProps) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const [isExpanded, setIsExpanded] = useState(isSelected && entry.views.length > 0);
|
const [isExpanded, setIsExpanded] = useState(isSelected && entry.views.length > 0);
|
||||||
const { t } = useTranslate();
|
|
||||||
const { breadcrumbs, views, time, url, sparklineData } = entry;
|
const { breadcrumbs, views, time, url, sparklineData } = entry;
|
||||||
const expandedLabel = isExpanded
|
const expandedLabel = isExpanded
|
||||||
? t('nav.history-wrapper.collapse', 'Collapse')
|
? t('nav.history-wrapper.collapse', 'Collapse')
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useLocation } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
|
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { config, reportInteraction } from '@grafana/runtime';
|
import { config, reportInteraction } from '@grafana/runtime';
|
||||||
import { ScrollContainer, useStyles2 } from '@grafana/ui';
|
import { ScrollContainer, useStyles2 } from '@grafana/ui';
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
|
@ -37,7 +37,7 @@ export const MegaMenu = memo(
|
||||||
const state = chrome.useState();
|
const state = chrome.useState();
|
||||||
const [patchPreferences] = usePatchUserPreferencesMutation();
|
const [patchPreferences] = usePatchUserPreferencesMutation();
|
||||||
const pinnedItems = usePinnedItems();
|
const pinnedItems = usePinnedItems();
|
||||||
const { t } = useTranslate();
|
|
||||||
// Remove profile + help from tree
|
// Remove profile + help from tree
|
||||||
const navItems = navTree
|
const navItems = navTree
|
||||||
.filter((item) => item.id !== 'profile' && item.id !== 'help')
|
.filter((item) => item.id !== 'profile' && item.id !== 'help')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { IconButton, Stack, ToolbarButton, useTheme2 } from '@grafana/ui';
|
import { IconButton, Stack, ToolbarButton, useTheme2 } from '@grafana/ui';
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ export function MegaMenuHeader({ handleMegaMenu, handleDockedMenu, onClose }: Pr
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const { chrome } = useGrafana();
|
const { chrome } = useGrafana();
|
||||||
const state = chrome.useState();
|
const state = chrome.useState();
|
||||||
const { t } = useTranslate();
|
|
||||||
const styles = getStyles(theme);
|
const styles = getStyles(theme);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useLocation } from 'react-router-dom-v5-compat';
|
||||||
import { useLocalStorage } from 'react-use';
|
import { useLocalStorage } from 'react-use';
|
||||||
|
|
||||||
import { FeatureState, GrafanaTheme2, NavModelItem, toIconName } from '@grafana/data';
|
import { FeatureState, GrafanaTheme2, NavModelItem, toIconName } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2, Text, IconButton, Icon, Stack, FeatureBadge } from '@grafana/ui';
|
import { useStyles2, Text, IconButton, Icon, Stack, FeatureBadge } from '@grafana/ui';
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick, onPin, isPi
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [isActive]);
|
}, [isActive]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
if (!link.url) {
|
if (!link.url) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Icon, IconButton, Link, useTheme2 } from '@grafana/ui';
|
import { Icon, IconButton, Link, useTheme2 } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
|
@ -20,7 +20,7 @@ export interface Props {
|
||||||
|
|
||||||
export function MegaMenuItemText({ children, isActive, onClick, target, url, onPin, isPinned }: Props) {
|
export function MegaMenuItemText({ children, isActive, onClick, target, url, onPin, isPinned }: Props) {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const { t } = useTranslate();
|
|
||||||
const styles = getStyles(theme, isActive);
|
const styles = getStyles(theme, isActive);
|
||||||
const LinkComponent = !target && url.startsWith('/') ? Link : 'a';
|
const LinkComponent = !target && url.startsWith('/') ? Link : 'a';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
import { NavModelItem } from '@grafana/data';
|
import { NavModelItem } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { config, reportInteraction } from '@grafana/runtime';
|
import { config, reportInteraction } from '@grafana/runtime';
|
||||||
import { MEGA_MENU_TOGGLE_ID } from 'app/core/constants';
|
import { MEGA_MENU_TOGGLE_ID } from 'app/core/constants';
|
||||||
import { HOME_NAV_ID } from 'app/core/reducers/navModel';
|
import { HOME_NAV_ID } from 'app/core/reducers/navModel';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { IconButton, Drawer, useStyles2, Text } from '@grafana/ui';
|
import { IconButton, Drawer, useStyles2, Text } from '@grafana/ui';
|
||||||
import { DEFAULT_FEED_URL } from 'app/plugins/panel/news/constants';
|
import { DEFAULT_FEED_URL } from 'app/plugins/panel/news/constants';
|
||||||
import grotNewsSvg from 'img/grot-news.svg';
|
import grotNewsSvg from 'img/grot-news.svg';
|
||||||
|
@ -16,7 +16,7 @@ interface NewsContainerProps {
|
||||||
|
|
||||||
export function NewsContainer({ onClose }: NewsContainerProps) {
|
export function NewsContainer({ onClose }: NewsContainerProps) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
title={
|
title={
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
||||||
import { useMeasure } from 'react-use';
|
import { useMeasure } from 'react-use';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
import { News } from 'app/plugins/panel/news/component/News';
|
import { News } from 'app/plugins/panel/news/component/News';
|
||||||
import { useNewsFeed } from 'app/plugins/panel/news/useNewsFeed';
|
import { useNewsFeed } from 'app/plugins/panel/news/useNewsFeed';
|
||||||
|
@ -20,7 +20,6 @@ export function NewsWrapper({ feedUrl }: NewsWrapperProps) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getNews();
|
getNews();
|
||||||
}, [getNews]);
|
}, [getNews]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
if (state.error) {
|
if (state.error) {
|
||||||
return <div className={styles.innerWrapper}>{state.error && state.error.message}</div>;
|
return <div className={styles.innerWrapper}>{state.error && state.error.message}</div>;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { SelectableValue, GrafanaTheme2 } from '@grafana/data';
|
import { SelectableValue, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Icon, Select, useStyles2 } from '@grafana/ui';
|
import { Icon, Select, useStyles2 } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import { UserOrg } from 'app/types';
|
import { UserOrg } from 'app/types';
|
||||||
|
@ -11,7 +11,7 @@ import { OrganizationBaseProps } from './types';
|
||||||
|
|
||||||
export function OrganizationSelect({ orgs, onSelectChange }: OrganizationBaseProps) {
|
export function OrganizationSelect({ orgs, onSelectChange }: OrganizationBaseProps) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const { orgId } = contextSrv.user;
|
const { orgId } = contextSrv.user;
|
||||||
|
|
||||||
const options = useMemo(
|
const options = useMemo(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { reportInteraction } from '@grafana/runtime';
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
import { Menu, Dropdown, ToolbarButton } from '@grafana/ui';
|
import { Menu, Dropdown, ToolbarButton } from '@grafana/ui';
|
||||||
import { getExternalUserMngLinkUrl } from 'app/features/users/utils';
|
import { getExternalUserMngLinkUrl } from 'app/features/users/utils';
|
||||||
|
@ -16,7 +16,7 @@ export interface Props {}
|
||||||
export const QuickAdd = ({}: Props) => {
|
export const QuickAdd = ({}: Props) => {
|
||||||
const navBarTree = useSelector((state) => state.navBarTree);
|
const navBarTree = useSelector((state) => state.navBarTree);
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const { t } = useTranslate();
|
|
||||||
const createActions = useMemo(() => {
|
const createActions = useMemo(() => {
|
||||||
const actions = findCreateActions(navBarTree);
|
const actions = findCreateActions(navBarTree);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export const QuickAdd = ({}: Props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}, [navBarTree, t]);
|
}, [navBarTree]);
|
||||||
const showQuickAdd = createActions.length > 0;
|
const showQuickAdd = createActions.length > 0;
|
||||||
|
|
||||||
if (!showQuickAdd) {
|
if (!showQuickAdd) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Button, ButtonGroup, useStyles2 } from '@grafana/ui';
|
import { Button, ButtonGroup, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
export interface DismissableButtonProps {
|
export interface DismissableButtonProps {
|
||||||
|
@ -13,7 +13,7 @@ export interface DismissableButtonProps {
|
||||||
|
|
||||||
export const DismissableButton = ({ label, onClick, onDismiss }: DismissableButtonProps) => {
|
export const DismissableButton = ({ label, onClick, onDismiss }: DismissableButtonProps) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<ButtonGroup className={styles.buttonGroup}>
|
<ButtonGroup className={styles.buttonGroup}>
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useCallback } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { locationService } from '@grafana/runtime';
|
import { locationService } from '@grafana/runtime';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
|
@ -27,7 +27,7 @@ export const ReturnToPrevious = ({ href, title }: ReturnToPreviousProps) => {
|
||||||
const handleOnDismiss = useCallback(() => {
|
const handleOnDismiss = useCallback(() => {
|
||||||
chrome.clearReturnToPrevious('dismissed');
|
chrome.clearReturnToPrevious('dismissed');
|
||||||
}, [chrome]);
|
}, [chrome]);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.returnToPrevious} data-testid={selectors.components.ReturnToPrevious.buttonGroup}>
|
<div className={styles.returnToPrevious} data-testid={selectors.components.ReturnToPrevious.buttonGroup}>
|
||||||
<DismissableButton
|
<DismissableButton
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { cloneDeep } from 'lodash';
|
||||||
import { useToggle } from 'react-use';
|
import { useToggle } from 'react-use';
|
||||||
|
|
||||||
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
|
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Dropdown, Menu, MenuItem, ToolbarButton, useStyles2 } from '@grafana/ui';
|
import { Dropdown, Menu, MenuItem, ToolbarButton, useStyles2 } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
|
@ -24,7 +24,7 @@ export function ProfileButton({ profileNode, onToggleKioskMode }: Props) {
|
||||||
const node = enrichWithInteractionTracking(cloneDeep(profileNode), false);
|
const node = enrichWithInteractionTracking(cloneDeep(profileNode), false);
|
||||||
const [showNewsDrawer, onToggleShowNewsDrawer] = useToggle(false);
|
const [showNewsDrawer, onToggleShowNewsDrawer] = useToggle(false);
|
||||||
const [showThemeDrawer, onToggleThemeDrawer] = useToggle(false);
|
const [showThemeDrawer, onToggleThemeDrawer] = useToggle(false);
|
||||||
const { t } = useTranslate();
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { memo } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
|
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
|
||||||
import { Components } from '@grafana/e2e-selectors';
|
import { Components } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { ScopesContextValue } from '@grafana/runtime';
|
import { ScopesContextValue } from '@grafana/runtime';
|
||||||
import { Dropdown, Icon, Stack, ToolbarButton, useStyles2 } from '@grafana/ui';
|
import { Dropdown, Icon, Stack, ToolbarButton, useStyles2 } from '@grafana/ui';
|
||||||
import { config } from 'app/core/config';
|
import { config } from 'app/core/config';
|
||||||
|
@ -64,7 +64,7 @@ export const SingleTopBar = memo(function SingleTopBar({
|
||||||
const breadcrumbs = buildBreadcrumbs(sectionNav, pageNav, homeNav);
|
const breadcrumbs = buildBreadcrumbs(sectionNav, pageNav, homeNav);
|
||||||
const unifiedHistoryEnabled = config.featureToggles.unifiedHistory;
|
const unifiedHistoryEnabled = config.featureToggles.unifiedHistory;
|
||||||
const isSmallScreen = !useMediaQueryMinWidth('sm');
|
const isSmallScreen = !useMediaQueryMinWidth('sm');
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.layout}>
|
<div className={styles.layout}>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import React, { useMemo } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { getInputStyles, Icon, Text, ToolbarButton, useStyles2 } from '@grafana/ui';
|
import { getInputStyles, Icon, Text, ToolbarButton, useStyles2 } from '@grafana/ui';
|
||||||
import { getFocusStyles } from '@grafana/ui/internal';
|
import { getFocusStyles } from '@grafana/ui/internal';
|
||||||
import { useMediaQueryMinWidth } from 'app/core/hooks/useMediaQueryMinWidth';
|
import { useMediaQueryMinWidth } from 'app/core/hooks/useMediaQueryMinWidth';
|
||||||
|
@ -19,7 +19,7 @@ export const TopSearchBarCommandPaletteTrigger = React.memo(() => {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const isLargeScreen = useMediaQueryMinWidth('lg');
|
const isLargeScreen = useMediaQueryMinWidth('lg');
|
||||||
const { t } = useTranslate();
|
|
||||||
const onOpenSearch = () => {
|
const onOpenSearch = () => {
|
||||||
kbar.toggle();
|
kbar.toggle();
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@ interface PretendTextInputProps {
|
||||||
function PretendTextInput({ onClick }: PretendTextInputProps) {
|
function PretendTextInput({ onClick }: PretendTextInputProps) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const modKey = useMemo(() => getModKey(), []);
|
const modKey = useMemo(() => getModKey(), []);
|
||||||
const { t } = useTranslate();
|
|
||||||
// We want the desktop command palette trigger to look like a search box,
|
// We want the desktop command palette trigger to look like a search box,
|
||||||
// but it actually behaves like a button - you active it and it performs an
|
// but it actually behaves like a button - you active it and it performs an
|
||||||
// action. You don't actually type into it.
|
// action. You don't actually type into it.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { css, keyframes } from '@emotion/css';
|
import { css, keyframes } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
import grafanaIconSvg from 'img/grafana_icon.svg';
|
import grafanaIconSvg from 'img/grafana_icon.svg';
|
||||||
|
|
||||||
export function BouncingLoader() {
|
export function BouncingLoader() {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.container}
|
className={styles.container}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { BreadcrumbItem } from './BreadcrumbItem';
|
import { BreadcrumbItem } from './BreadcrumbItem';
|
||||||
|
@ -14,7 +14,7 @@ export interface Props {
|
||||||
|
|
||||||
export function Breadcrumbs({ breadcrumbs, className }: Props) {
|
export function Breadcrumbs({ breadcrumbs, className }: Props) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<nav aria-label={t('navigation.breadcrumbs.aria-label', 'Breadcrumbs')} className={className}>
|
<nav aria-label={t('navigation.breadcrumbs.aria-label', 'Breadcrumbs')} className={className}>
|
||||||
<ol className={styles.breadcrumbs}>
|
<ol className={styles.breadcrumbs}>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { IconButton, useStyles2 } from '@grafana/ui';
|
import { IconButton, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -13,7 +13,6 @@ type Props = {
|
||||||
|
|
||||||
export const CloseButton = ({ onClick, 'aria-label': ariaLabel, style }: Props) => {
|
export const CloseButton = ({ onClick, 'aria-label': ariaLabel, style }: Props) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|
|
@ -3,7 +3,7 @@ import debounce from 'debounce-promise';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { AsyncMultiSelect, Icon, Button, useStyles2 } from '@grafana/ui';
|
import { AsyncMultiSelect, Icon, Button, useStyles2 } from '@grafana/ui';
|
||||||
import { config } from 'app/core/config';
|
import { config } from 'app/core/config';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
|
@ -21,7 +21,6 @@ export function FolderFilter({ onChange, maxMenuHeight }: FolderFilterProps): JS
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const getOptions = useCallback((searchString: string) => getFoldersAsOptions(searchString, setLoading), []);
|
const getOptions = useCallback((searchString: string) => getFoldersAsOptions(searchString, setLoading), []);
|
||||||
const debouncedLoadOptions = useMemo(() => debounce(getOptions, 300), [getOptions]);
|
const debouncedLoadOptions = useMemo(() => debounce(getOptions, 300), [getOptions]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const [value, setValue] = useState<Array<SelectableValue<FolderInfo>>>([]);
|
const [value, setValue] = useState<Array<SelectableValue<FolderInfo>>>([]);
|
||||||
const onSelectOptionChange = useCallback(
|
const onSelectOptionChange = useCallback(
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2, LinkTarget } from '@grafana/data';
|
import { GrafanaTheme2, LinkTarget } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Icon, IconName, useStyles2 } from '@grafana/ui';
|
import { Icon, IconName, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { SyntheticEvent, useState } from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Tooltip, Field, Button, Alert, useStyles2, Stack } from '@grafana/ui';
|
import { Tooltip, Field, Button, Alert, useStyles2, Stack } from '@grafana/ui';
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ interface PasswordDTO {
|
||||||
|
|
||||||
export const ChangePassword = ({ onSubmit, onSkip, showDefaultPasswordWarning }: Props) => {
|
export const ChangePassword = ({ onSubmit, onSkip, showDefaultPasswordWarning }: Props) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const [displayValidationLabels, setDisplayValidationLabels] = useState(false);
|
const [displayValidationLabels, setDisplayValidationLabels] = useState(false);
|
||||||
const [pristine, setPristine] = useState(true);
|
const [pristine, setPristine] = useState(true);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useState } from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { Field, Input, Button, Legend, Container, useStyles2, LinkButton, Stack } from '@grafana/ui';
|
import { Field, Input, Button, Legend, Container, useStyles2, LinkButton, Stack } from '@grafana/ui';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
|
@ -30,7 +30,6 @@ export const ForgottenPassword = () => {
|
||||||
register,
|
register,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm<EmailDTO>();
|
} = useForm<EmailDTO>();
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const sendEmail = async (formModel: EmailDTO) => {
|
const sendEmail = async (formModel: EmailDTO) => {
|
||||||
const res = await getBackendSrv().post('/api/user/password/send-reset-email', formModel);
|
const res = await getBackendSrv().post('/api/user/password/send-reset-email', formModel);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import history from 'history';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Navigate } from 'react-router-dom-v5-compat';
|
import { Navigate } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Button, Modal } from '@grafana/ui';
|
import { Button, Modal } from '@grafana/ui';
|
||||||
|
|
||||||
import { Prompt } from './Prompt';
|
import { Prompt } from './Prompt';
|
||||||
|
@ -96,8 +96,6 @@ interface UnsavedChangesModalProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const UnsavedChangesModal = ({ onDiscard, onBackToForm, isOpen }: UnsavedChangesModalProps) => {
|
const UnsavedChangesModal = ({ onDiscard, onBackToForm, isOpen }: UnsavedChangesModalProps) => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Button } from '@grafana/ui';
|
import { Button } from '@grafana/ui';
|
||||||
|
|
||||||
import { performInviteUserClick } from './utils';
|
import { performInviteUserClick } from './utils';
|
||||||
|
|
||||||
export function InviteUserButton() {
|
export function InviteUserButton() {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
icon="add-user"
|
icon="add-user"
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
|
||||||
import { DragDropContext, Draggable, Droppable, DropResult } from '@hello-pangea/dnd';
|
import { DragDropContext, Draggable, Droppable, DropResult } from '@hello-pangea/dnd';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Icon, IconButton, useStyles2 } from '@grafana/ui';
|
import { Icon, IconButton, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { LayerName } from './LayerName';
|
import { LayerName } from './LayerName';
|
||||||
|
@ -38,7 +38,7 @@ export const LayerDragDropList = <T extends LayerElement>({
|
||||||
verifyLayerNameUniqueness,
|
verifyLayerNameUniqueness,
|
||||||
}: LayerDragDropListProps<T>) => {
|
}: LayerDragDropListProps<T>) => {
|
||||||
const style = useStyles2(getStyles);
|
const style = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const getRowStyle = (isSelected: boolean) => {
|
const getRowStyle = (isSelected: boolean) => {
|
||||||
return isSelected ? `${style.row} ${style.sel}` : style.row;
|
return isSelected ? `${style.row} ${style.sel}` : style.row;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useState } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Icon, Input, FieldValidationMessage, useStyles2 } from '@grafana/ui';
|
import { Icon, Input, FieldValidationMessage, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
export interface LayerNameProps {
|
export interface LayerNameProps {
|
||||||
|
@ -18,7 +18,6 @@ export const LayerName = ({ name, onChange, verifyLayerNameUniqueness, overrideS
|
||||||
|
|
||||||
const [isEditing, setIsEditing] = useState<boolean>(false);
|
const [isEditing, setIsEditing] = useState<boolean>(false);
|
||||||
const [validationError, setValidationError] = useState<string | null>(null);
|
const [validationError, setValidationError] = useState<string | null>(null);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const onEditLayer = (event: React.SyntheticEvent) => {
|
const onEditLayer = (event: React.SyntheticEvent) => {
|
||||||
setIsEditing(true);
|
setIsEditing(true);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { PureComponent } from 'react';
|
import { PureComponent } from 'react';
|
||||||
|
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { FetchError, getBackendSrv, isFetchError, locationService } from '@grafana/runtime';
|
import { FetchError, getBackendSrv, isFetchError, locationService } from '@grafana/runtime';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
|
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { PasswordField } from '../PasswordField/PasswordField';
|
import { PasswordField } from '../PasswordField/PasswordField';
|
||||||
|
@ -28,7 +28,7 @@ export const LoginForm = ({ children, onSubmit, isLoggingIn, passwordHint, login
|
||||||
register,
|
register,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm<FormModel>({ mode: 'onChange' });
|
} = useForm<FormModel>({ mode: 'onChange' });
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { css } from '@emotion/css';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Alert, LinkButton, Stack, useStyles2 } from '@grafana/ui';
|
import { Alert, LinkButton, Stack, useStyles2 } from '@grafana/ui';
|
||||||
import { Branding } from 'app/core/components/Branding/Branding';
|
import { Branding } from 'app/core/components/Branding/Branding';
|
||||||
|
@ -20,7 +20,7 @@ import { UserSignup } from './UserSignup';
|
||||||
|
|
||||||
const LoginPage = () => {
|
const LoginPage = () => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
document.title = Branding.AppTitle;
|
document.title = Branding.AppTitle;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { locationService } from '@grafana/runtime';
|
import { locationService } from '@grafana/runtime';
|
||||||
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
|
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
|
||||||
import { Branding } from 'app/core/components/Branding/Branding';
|
import { Branding } from 'app/core/components/Branding/Branding';
|
||||||
|
@ -55,7 +55,6 @@ export const PasswordlessConfirmation = ({ onSubmit, isLoggingIn }: Props) => {
|
||||||
setValue('name', queryValues.get('name') || '');
|
setValue('name', queryValues.get('name') || '');
|
||||||
}
|
}
|
||||||
}, [setValue, handleSubmit, onSubmit, setSignup]);
|
}, [setValue, handleSubmit, onSubmit, setSignup]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
|
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { PasswordlessFormModel } from './LoginCtrl';
|
import { PasswordlessFormModel } from './LoginCtrl';
|
||||||
|
@ -22,7 +22,7 @@ export const PasswordlessLoginForm = ({ onSubmit, isLoggingIn }: Props) => {
|
||||||
register,
|
register,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm<PasswordlessFormModel>({ mode: 'onChange' });
|
} = useForm<PasswordlessFormModel>({ mode: 'onChange' });
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Badge } from '@grafana/ui';
|
import { Badge } from '@grafana/ui';
|
||||||
import { useIsProvisionedInstance } from 'app/features/provisioning/hooks/useIsProvisionedInstance';
|
import { useIsProvisionedInstance } from 'app/features/provisioning/hooks/useIsProvisionedInstance';
|
||||||
import { NestedFolderDTO } from 'app/features/search/service/types';
|
import { NestedFolderDTO } from 'app/features/search/service/types';
|
||||||
|
@ -10,7 +10,6 @@ export interface Props {
|
||||||
|
|
||||||
export function FolderRepo({ folder }: Props) {
|
export function FolderRepo({ folder }: Props) {
|
||||||
const isProvisionedInstance = useIsProvisionedInstance();
|
const isProvisionedInstance = useIsProvisionedInstance();
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
if (!folder || ('parentUID' in folder && folder.parentUID) || !folder.managedBy || isProvisionedInstance) {
|
if (!folder || ('parentUID' in folder && folder.parentUID) || !folder.managedBy || isProvisionedInstance) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Alert, Icon, Input, LoadingBar, Stack, Text, useStyles2 } from '@grafana/ui';
|
import { Alert, Icon, Input, LoadingBar, Stack, Text, useStyles2 } from '@grafana/ui';
|
||||||
import { useGetFolderQuery } from 'app/features/browse-dashboards/api/browseDashboardsAPI';
|
import { useGetFolderQuery } from 'app/features/browse-dashboards/api/browseDashboardsAPI';
|
||||||
|
@ -250,7 +250,6 @@ export function NestedFolderPicker({
|
||||||
},
|
},
|
||||||
[flatTree]
|
[flatTree]
|
||||||
);
|
);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const isLoading = isBrowseLoading || isFetchingSearchResults;
|
const isLoading = isBrowseLoading || isFetchingSearchResults;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { forwardRef, ReactNode, ButtonHTMLAttributes } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Icon, getInputStyles, useTheme2, Text } from '@grafana/ui';
|
import { Icon, getInputStyles, useTheme2, Text } from '@grafana/ui';
|
||||||
import { getFocusStyles, getMouseFocusStyles } from '@grafana/ui/internal';
|
import { getFocusStyles, getMouseFocusStyles } from '@grafana/ui/internal';
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ function Trigger(
|
||||||
ref: React.ForwardedRef<HTMLButtonElement>
|
ref: React.ForwardedRef<HTMLButtonElement>
|
||||||
) {
|
) {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const { t } = useTranslate();
|
|
||||||
const styles = getStyles(theme, invalid);
|
const styles = getStyles(theme, invalid);
|
||||||
|
|
||||||
const handleKeyDown = (event: React.KeyboardEvent<SVGElement>) => {
|
const handleKeyDown = (event: React.KeyboardEvent<SVGElement>) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useTheme2, useStyles2, ColorPicker, IconButton } from '@grafana/ui';
|
import { useTheme2, useStyles2, ColorPicker, IconButton } from '@grafana/ui';
|
||||||
import { ColorSwatch } from '@grafana/ui/internal';
|
import { ColorSwatch } from '@grafana/ui/internal';
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ interface Props {
|
||||||
export const ColorValueEditor = ({ value, settings, onChange, details }: Props) => {
|
export const ColorValueEditor = ({ value, settings, onChange, details }: Props) => {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<ColorPicker color={value ?? ''} onChange={onChange} enableNamedColors={settings?.enableNamedColors !== false}>
|
<ColorPicker color={value ?? ''} onChange={onChange} enableNamedColors={settings?.enableNamedColors !== false}>
|
||||||
{({ ref, showColorPicker, hideColorPicker }) => {
|
{({ ref, showColorPicker, hideColorPicker }) => {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
FieldColorSeriesByMode,
|
FieldColorSeriesByMode,
|
||||||
getFieldColorMode,
|
getFieldColorMode,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2, useTheme2, Field, RadioButtonGroup, Select } from '@grafana/ui';
|
import { useStyles2, useTheme2, Field, RadioButtonGroup, Select } from '@grafana/ui';
|
||||||
|
|
||||||
import { ColorValueEditor } from './color';
|
import { ColorValueEditor } from './color';
|
||||||
|
@ -23,7 +23,6 @@ type Props = StandardEditorProps<FieldColor | undefined, FieldColorConfigSetting
|
||||||
export const FieldColorEditor = ({ value, onChange, item, id }: Props) => {
|
export const FieldColorEditor = ({ value, onChange, item, id }: Props) => {
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const colorMode = getFieldColorMode(value?.mode);
|
const colorMode = getFieldColorMode(value?.mode);
|
||||||
const availableOptions = item.settings?.byValueSupport
|
const availableOptions = item.settings?.byValueSupport
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { StandardEditorProps, GrafanaTheme2, UnitFieldConfigSettings } from '@grafana/data';
|
import { StandardEditorProps, GrafanaTheme2, UnitFieldConfigSettings } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { IconButton, UnitPicker, useStyles2 } from '@grafana/ui';
|
import { IconButton, UnitPicker, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
type Props = StandardEditorProps<string, UnitFieldConfigSettings>;
|
type Props = StandardEditorProps<string, UnitFieldConfigSettings>;
|
||||||
|
|
||||||
export function UnitValueEditor({ value, onChange, item }: Props) {
|
export function UnitValueEditor({ value, onChange, item }: Props) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
if (item?.settings?.isClearable && value != null) {
|
if (item?.settings?.isClearable && value != null) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { isFetchError } from '@grafana/runtime';
|
import { isFetchError } from '@grafana/runtime';
|
||||||
import { Field, IconButton, Input, useStyles2, Text } from '@grafana/ui';
|
import { Field, IconButton, Input, useStyles2, Text } from '@grafana/ui';
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ export const EditableTitle = ({ value, onEdit }: Props) => {
|
||||||
},
|
},
|
||||||
[onEdit, value]
|
[onEdit, value]
|
||||||
);
|
);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return !isEditing ? (
|
return !isEditing ? (
|
||||||
<div className={styles.textContainer}>
|
<div className={styles.textContainer}>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2, PanelPluginMeta, SelectableValue } from '@grafana/data';
|
import { GrafanaTheme2, PanelPluginMeta, SelectableValue } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Icon, Button, MultiSelect, useStyles2 } from '@grafana/ui';
|
import { Icon, Button, MultiSelect, useStyles2 } from '@grafana/ui';
|
||||||
import { getAllPanelPluginMeta } from 'app/features/panel/state/util';
|
import { getAllPanelPluginMeta } from 'app/features/panel/state/util';
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export const PanelTypeFilter = ({ onChange: propsOnChange, maxMenuHeight }: Prop
|
||||||
[propsOnChange]
|
[propsOnChange]
|
||||||
);
|
);
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const selectOptions = {
|
const selectOptions = {
|
||||||
defaultOptions: true,
|
defaultOptions: true,
|
||||||
getOptionLabel: (i: SelectableValue<PanelPluginMeta>) => i.label,
|
getOptionLabel: (i: SelectableValue<PanelPluginMeta>) => i.label,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { forwardRef, useState } from 'react';
|
import { forwardRef, useState } from 'react';
|
||||||
|
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Input, IconButton } from '@grafana/ui';
|
import { Input, IconButton } from '@grafana/ui';
|
||||||
import { InputProps } from '@grafana/ui/internal';
|
import { InputProps } from '@grafana/ui/internal';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ interface Props extends Omit<InputProps, 'type'> {}
|
||||||
|
|
||||||
export const PasswordField = forwardRef<HTMLInputElement, Props>((props, ref) => {
|
export const PasswordField = forwardRef<HTMLInputElement, Props>((props, ref) => {
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useAsync } from 'react-use';
|
import { useAsync } from 'react-use';
|
||||||
|
|
||||||
import { renderMarkdown } from '@grafana/data';
|
import { renderMarkdown } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { LoadingPlaceholder } from '@grafana/ui';
|
import { LoadingPlaceholder } from '@grafana/ui';
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PluginHelp({ pluginId }: Props) {
|
export function PluginHelp({ pluginId }: Props) {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const { value, loading, error } = useAsync(async () => {
|
const { value, loading, error } = useAsync(async () => {
|
||||||
return getBackendSrv().get(`/api/plugins/${pluginId}/markdown/query_help`);
|
return getBackendSrv().get(`/api/plugins/${pluginId}/markdown/query_help`);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { MouseEventHandler } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Icon, IconButton, useStyles2, Stack } from '@grafana/ui';
|
import { Icon, IconButton, useStyles2, Stack } from '@grafana/ui';
|
||||||
|
|
||||||
export interface QueryOperationRowHeaderProps {
|
export interface QueryOperationRowHeaderProps {
|
||||||
|
@ -42,7 +42,7 @@ export const QueryOperationRowHeader = ({
|
||||||
expanderMessages,
|
expanderMessages,
|
||||||
}: QueryOperationRowHeaderProps) => {
|
}: QueryOperationRowHeaderProps) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
let tooltipMessage = isContentVisible
|
let tooltipMessage = isContentVisible
|
||||||
? t('query-operation.header.collapse-row', 'Collapse query row')
|
? t('query-operation.header.collapse-row', 'Collapse query row')
|
||||||
: t('query-operation.header.expand-row', 'Expand query row');
|
: t('query-operation.header.expand-row', 'Expand query row');
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { cx } from '@emotion/css';
|
||||||
import { FormEvent, memo } from 'react';
|
import { FormEvent, memo } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Checkbox, Portal, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Checkbox, Portal, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { getSelectStyles } from '@grafana/ui/internal';
|
import { getSelectStyles } from '@grafana/ui/internal';
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ export const RoleMenuGroupOption = memo(
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = getSelectStyles(theme);
|
const styles = getSelectStyles(theme);
|
||||||
const customStyles = useStyles2(getStyles);
|
const customStyles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const wrapperClassName = cx(
|
const wrapperClassName = cx(
|
||||||
styles.option,
|
styles.option,
|
||||||
isFocused && styles.optionFocused,
|
isFocused && styles.optionFocused,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { cx } from '@emotion/css';
|
import { cx } from '@emotion/css';
|
||||||
import { forwardRef, FormEvent } from 'react';
|
import { forwardRef, FormEvent } from 'react';
|
||||||
|
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Checkbox, Icon, Tooltip, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Checkbox, Icon, Tooltip, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { getSelectStyles } from '@grafana/ui/internal';
|
import { getSelectStyles } from '@grafana/ui/internal';
|
||||||
import { Role } from 'app/types';
|
import { Role } from 'app/types';
|
||||||
|
@ -24,7 +24,7 @@ export const RoleMenuOption = forwardRef<HTMLDivElement, React.PropsWithChildren
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = getSelectStyles(theme);
|
const styles = getSelectStyles(theme);
|
||||||
const customStyles = useStyles2(getStyles);
|
const customStyles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
disabled = disabled || mapped;
|
disabled = disabled || mapped;
|
||||||
let disabledMessage = '';
|
let disabledMessage = '';
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { FormEvent, HTMLProps, useEffect, useRef } from 'react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { useStyles2, getInputStyles, sharedInputStyle, Tooltip, Icon, Spinner } from '@grafana/ui';
|
import { useStyles2, getInputStyles, sharedInputStyle, Tooltip, Icon, Spinner } from '@grafana/ui';
|
||||||
import { getFocusStyles } from '@grafana/ui/internal';
|
import { getFocusStyles } from '@grafana/ui/internal';
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ export const RolePickerInput = ({
|
||||||
}: InputProps): JSX.Element => {
|
}: InputProps): JSX.Element => {
|
||||||
const styles = useStyles2(getRolePickerInputStyles, false, !!isFocused, !!disabled, false, width);
|
const styles = useStyles2(getRolePickerInputStyles, false, !!isFocused, !!disabled, false, width);
|
||||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isFocused) {
|
if (isFocused) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Button, ScrollContainer, Stack, TextLink, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Button, ScrollContainer, Stack, TextLink, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { getSelectStyles } from '@grafana/ui/internal';
|
import { getSelectStyles } from '@grafana/ui/internal';
|
||||||
import { OrgRole, Role } from 'app/types';
|
import { OrgRole, Role } from 'app/types';
|
||||||
|
@ -138,8 +138,6 @@ export const RolePickerMenu = ({
|
||||||
});
|
});
|
||||||
}, [options]);
|
}, [options]);
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const getSelectedGroupOptions = (group: string) => {
|
const getSelectedGroupOptions = (group: string) => {
|
||||||
const selectedGroupOptions = [];
|
const selectedGroupOptions = [];
|
||||||
for (const role of selectedOptions) {
|
for (const role of selectedOptions) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { cx } from '@emotion/css';
|
import { cx } from '@emotion/css';
|
||||||
|
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Button, ScrollContainer, Stack, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Button, ScrollContainer, Stack, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { getSelectStyles } from '@grafana/ui/internal';
|
import { getSelectStyles } from '@grafana/ui/internal';
|
||||||
import { Role } from 'app/types';
|
import { Role } from 'app/types';
|
||||||
|
@ -30,7 +30,7 @@ export const RolePickerSubMenu = ({
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const styles = getSelectStyles(theme);
|
const styles = getSelectStyles(theme);
|
||||||
const customStyles = useStyles2(getStyles);
|
const customStyles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const onClearInternal = async () => {
|
const onClearInternal = async () => {
|
||||||
if (onClear) {
|
if (onClear) {
|
||||||
onClear();
|
onClear();
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useState } from 'react';
|
||||||
import { FormProvider, useForm } from 'react-hook-form';
|
import { FormProvider, useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2, Badge, Stack } from '@grafana/ui';
|
import { useStyles2, Badge, Stack } from '@grafana/ui';
|
||||||
import { OrgUser } from 'app/types';
|
import { OrgUser } from 'app/types';
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export const RolePickerBadges = ({ disabled, user }: Props) => {
|
||||||
roles: user.roles,
|
roles: user.roles,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { t } = useTranslate();
|
|
||||||
const { watch } = methods;
|
const { watch } = methods;
|
||||||
|
|
||||||
const drawerControl = () => {
|
const drawerControl = () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Controller, useFormContext } from 'react-hook-form';
|
import { Controller, useFormContext } from 'react-hook-form';
|
||||||
|
|
||||||
import { toOption } from '@grafana/data';
|
import { toOption } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Drawer, Field, RadioButtonGroup, TextLink } from '@grafana/ui';
|
import { Drawer, Field, RadioButtonGroup, TextLink } from '@grafana/ui';
|
||||||
import { OrgRole } from 'app/types';
|
import { OrgRole } from 'app/types';
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ export const RolePickerDrawer = ({ onClose }: Props) => {
|
||||||
const methods = useFormContext();
|
const methods = useFormContext();
|
||||||
const { control, getValues, setValue } = methods;
|
const { control, getValues, setValue } = methods;
|
||||||
const [name, roles] = getValues(['name', 'roles']);
|
const [name, roles] = getValues(['name', 'roles']);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer title={name} subtitle={drawerSubtitle} onClose={onClose}>
|
<Drawer title={name} subtitle={drawerSubtitle} onClose={onClose}>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useAsync } from 'react-use';
|
||||||
|
|
||||||
import { AppEvents, GrafanaTheme2, SelectableValue } from '@grafana/data';
|
import { AppEvents, GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { reportInteraction } from '@grafana/runtime';
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
import { ActionMeta, AsyncVirtualizedSelect, Input, InputActionMeta, useStyles2 } from '@grafana/ui';
|
import { ActionMeta, AsyncVirtualizedSelect, Input, InputActionMeta, useStyles2 } from '@grafana/ui';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
|
@ -281,8 +281,6 @@ export function OldFolderPicker(props: Props) {
|
||||||
[customAdd?.disallowValues, customAdd?.isAllowedValue, newFolderValue, createNewFolder, folder?.title, rootName]
|
[customAdd?.disallowValues, customAdd?.isAllowedValue, newFolderValue, createNewFolder, folder?.title, rootName]
|
||||||
);
|
);
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const onNewFolderChange = (e: FormEvent<HTMLInputElement>) => {
|
const onNewFolderChange = (e: FormEvent<HTMLInputElement>) => {
|
||||||
const value = e.currentTarget.value;
|
const value = e.currentTarget.value;
|
||||||
setNewFolderValue(value);
|
setNewFolderValue(value);
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
||||||
import { useAsyncFn } from 'react-use';
|
import { useAsyncFn } from 'react-use';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { AsyncSelect } from '@grafana/ui';
|
import { AsyncSelect } from '@grafana/ui';
|
||||||
import { Organization, UserOrg } from 'app/types';
|
import { Organization, UserOrg } from 'app/types';
|
||||||
|
@ -49,7 +49,6 @@ export function OrgPicker({ onSelected, className, inputId, autoFocus, excludeOr
|
||||||
return allOrgs;
|
return allOrgs;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AsyncSelect
|
<AsyncSelect
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { isNil } from 'lodash';
|
||||||
import { Component } from 'react';
|
import { Component } from 'react';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { AsyncSelect } from '@grafana/ui';
|
import { AsyncSelect } from '@grafana/ui';
|
||||||
import { ServiceAccountDTO, ServiceAccountsState } from 'app/types';
|
import { ServiceAccountDTO, ServiceAccountsState } from 'app/types';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useAsync } from 'react-use';
|
import { useAsync } from 'react-use';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Icon, Select } from '@grafana/ui';
|
import { Icon, Select } from '@grafana/ui';
|
||||||
import { DEFAULT_SORT } from 'app/features/search/constants';
|
import { DEFAULT_SORT } from 'app/features/search/constants';
|
||||||
import { getGrafanaSearcher } from 'app/features/search/service/searcher';
|
import { getGrafanaSearcher } from 'app/features/search/service/searcher';
|
||||||
|
@ -28,7 +28,6 @@ export function SortPicker({ onChange, value, placeholder, filter, getSortOption
|
||||||
}
|
}
|
||||||
return vals;
|
return vals;
|
||||||
}, [getSortOptions, filter]);
|
}, [getSortOptions, filter]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
if (options.loading) {
|
if (options.loading) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { isNil } from 'lodash';
|
||||||
import { Component } from 'react';
|
import { Component } from 'react';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { AsyncSelect } from '@grafana/ui';
|
import { AsyncSelect } from '@grafana/ui';
|
||||||
import { Team } from 'app/types';
|
import { Team } from 'app/types';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { isNil } from 'lodash';
|
||||||
import { Component } from 'react';
|
import { Component } from 'react';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { AsyncSelect } from '@grafana/ui';
|
import { AsyncSelect } from '@grafana/ui';
|
||||||
import { OrgUser } from 'app/types';
|
import { OrgUser } from 'app/types';
|
||||||
|
|
|
@ -4,8 +4,7 @@ import * as React from 'react';
|
||||||
|
|
||||||
import { FeatureState, ThemeRegistryItem } from '@grafana/data';
|
import { FeatureState, ThemeRegistryItem } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { PSEUDO_LOCALE, Trans } from '@grafana/i18n';
|
import { PSEUDO_LOCALE, t, Trans } from '@grafana/i18n';
|
||||||
import { t } from '@grafana/i18n/internal';
|
|
||||||
import { config, reportInteraction } from '@grafana/runtime';
|
import { config, reportInteraction } from '@grafana/runtime';
|
||||||
import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/preferences/x/preferences_types.gen';
|
import { Preferences as UserPreferencesDTO } from '@grafana/schema/src/raw/preferences/x/preferences_types.gen';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { Field, Input, Button, LinkButton, Stack } from '@grafana/ui';
|
import { Field, Input, Button, LinkButton, Stack } from '@grafana/ui';
|
||||||
import { getConfig } from 'app/core/config';
|
import { getConfig } from 'app/core/config';
|
||||||
|
@ -36,7 +36,7 @@ export const SignupPage = ({ queryParams }: Props) => {
|
||||||
register,
|
register,
|
||||||
getValues,
|
getValues,
|
||||||
} = useForm<SignupDTO>({ defaultValues: { email: queryParams.email, code: queryParams.code } });
|
} = useForm<SignupDTO>({ defaultValues: { email: queryParams.email, code: queryParams.code } });
|
||||||
const { t } = useTranslate();
|
|
||||||
const onSubmit = async (formData: SignupDTO) => {
|
const onSubmit = async (formData: SignupDTO) => {
|
||||||
if (formData.name === '') {
|
if (formData.name === '') {
|
||||||
delete formData.name;
|
delete formData.name;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { Field, Input, Button, Legend, Container, LinkButton, Stack } from '@grafana/ui';
|
import { Field, Input, Button, Legend, Container, LinkButton, Stack } from '@grafana/ui';
|
||||||
import { getConfig } from 'app/core/config';
|
import { getConfig } from 'app/core/config';
|
||||||
|
@ -20,7 +20,7 @@ export const VerifyEmail = () => {
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm<EmailDTO>();
|
} = useForm<EmailDTO>();
|
||||||
const [emailSent, setEmailSent] = useState(false);
|
const [emailSent, setEmailSent] = useState(false);
|
||||||
const { t } = useTranslate();
|
|
||||||
const onSubmit = (formModel: EmailDTO) => {
|
const onSubmit = (formModel: EmailDTO) => {
|
||||||
getBackendSrv()
|
getBackendSrv()
|
||||||
.post('/api/user/signup', formModel)
|
.post('/api/user/signup', formModel)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { components, MultiValueRemoveProps } from 'react-select';
|
import { components, MultiValueRemoveProps } from 'react-select';
|
||||||
|
|
||||||
import { escapeStringForRegex, GrafanaTheme2, SelectableValue } from '@grafana/data';
|
import { escapeStringForRegex, GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Icon, MultiSelect, useStyles2 } from '@grafana/ui';
|
import { Icon, MultiSelect, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { TagBadge, getStyles as getTagBadgeStyles } from './TagBadge';
|
import { TagBadge, getStyles as getTagBadgeStyles } from './TagBadge';
|
||||||
|
@ -55,7 +55,7 @@ export const TagFilter = ({
|
||||||
|
|
||||||
// Necessary to force re-render to keep tag options up to date / relevant
|
// Necessary to force re-render to keep tag options up to date / relevant
|
||||||
const selectKey = useMemo(() => tags.join(), [tags]);
|
const selectKey = useMemo(() => tags.join(), [tags]);
|
||||||
const { t } = useTranslate();
|
|
||||||
const onLoadOptions = useCallback(async () => {
|
const onLoadOptions = useCallback(async () => {
|
||||||
const options = await tagOptions();
|
const options = await tagOptions();
|
||||||
return options.map((option) => {
|
return options.map((option) => {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
|
||||||
import { OptionProps } from 'react-select';
|
import { OptionProps } from 'react-select';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { useStyles2 } from '@grafana/ui';
|
import { useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { TagBadge } from './TagBadge';
|
import { TagBadge } from './TagBadge';
|
||||||
|
@ -15,7 +15,7 @@ export interface TagSelectOption {
|
||||||
|
|
||||||
export const TagOption = ({ data, className, label, isFocused, innerProps }: OptionProps<TagSelectOption>) => {
|
export const TagOption = ({ data, className, label, isFocused, innerProps }: OptionProps<TagSelectOption>) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cx(styles.option, isFocused && styles.optionFocused)}
|
className={cx(styles.option, isFocused && styles.optionFocused)}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { FeatureState, GrafanaTheme2, ThemeRegistryItem } from '@grafana/data';
|
import { FeatureState, GrafanaTheme2, ThemeRegistryItem } from '@grafana/data';
|
||||||
import { TFunction, useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { FeatureBadge, RadioButtonDot, useStyles2 } from '@grafana/ui';
|
import { FeatureBadge, RadioButtonDot, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { ThemePreview } from '../Theme/ThemePreview';
|
import { ThemePreview } from '../Theme/ThemePreview';
|
||||||
|
@ -14,9 +14,8 @@ interface ThemeCardProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ThemeCard({ themeOption, isExperimental, isSelected, onSelect }: ThemeCardProps) {
|
export function ThemeCard({ themeOption, isExperimental, isSelected, onSelect }: ThemeCardProps) {
|
||||||
const { t } = useTranslate();
|
|
||||||
const theme = themeOption.build();
|
const theme = themeOption.build();
|
||||||
const label = getTranslatedThemeName(themeOption, t);
|
const label = getTranslatedThemeName(themeOption);
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -69,7 +68,7 @@ const getStyles = (theme: GrafanaTheme2) => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function getTranslatedThemeName(theme: ThemeRegistryItem, t: TFunction) {
|
function getTranslatedThemeName(theme: ThemeRegistryItem) {
|
||||||
switch (theme.id) {
|
switch (theme.id) {
|
||||||
case 'dark':
|
case 'dark':
|
||||||
return t('shared.preferences.theme.dark-label', 'Dark');
|
return t('shared.preferences.theme.dark-label', 'Dark');
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2, ThemeRegistryItem } from '@grafana/data';
|
import { GrafanaTheme2, ThemeRegistryItem } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { config, reportInteraction } from '@grafana/runtime';
|
import { config, reportInteraction } from '@grafana/runtime';
|
||||||
import { Drawer, TextLink, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Drawer, TextLink, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { changeTheme } from 'app/core/services/theme';
|
import { changeTheme } from 'app/core/services/theme';
|
||||||
|
@ -17,7 +17,7 @@ export function ThemeSelectorDrawer({ onClose }: Props) {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const themes = getSelectableThemes();
|
const themes = getSelectableThemes();
|
||||||
const currentTheme = useTheme2();
|
const currentTheme = useTheme2();
|
||||||
const { t } = useTranslate();
|
|
||||||
const onChange = (theme: ThemeRegistryItem) => {
|
const onChange = (theme: ThemeRegistryItem) => {
|
||||||
reportInteraction('grafana_preferences_theme_changed', {
|
reportInteraction('grafana_preferences_theme_changed', {
|
||||||
toTheme: theme.id,
|
toTheme: theme.id,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { uniqBy } from 'lodash';
|
import { uniqBy } from 'lodash';
|
||||||
|
|
||||||
import { AppEvents, DateTime, TimeRange, isDateTime, rangeUtil } from '@grafana/data';
|
import { AppEvents, DateTime, TimeRange, isDateTime, rangeUtil } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { TimeRangePickerProps, TimeRangePicker } from '@grafana/ui';
|
import { TimeRangePickerProps, TimeRangePicker } from '@grafana/ui';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ interface TimePickerHistoryItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TimePickerWithHistory = (props: Props) => {
|
export const TimePickerWithHistory = (props: Props) => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LocalStorageValueProvider<unknown> storageKey={LOCAL_STORAGE_KEY} defaultValue={[]}>
|
<LocalStorageValueProvider<unknown> storageKey={LOCAL_STORAGE_KEY} defaultValue={[]}>
|
||||||
{(values, onSaveToStore) => {
|
{(values, onSaveToStore) => {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
|
||||||
import { HTMLAttributes, useEffect } from 'react';
|
import { HTMLAttributes, useEffect } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { reportExperimentView } from '@grafana/runtime';
|
import { reportExperimentView } from '@grafana/runtime';
|
||||||
import { Button, Icon, LinkButton, useStyles2 } from '@grafana/ui';
|
import { Button, Icon, LinkButton, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
|
@ -32,8 +32,6 @@ export const UpgradeBox = ({
|
||||||
reportExperimentView(`feature-highlights-${featureId}`, 'test', eventVariant);
|
reportExperimentView(`feature-highlights-${featureId}`, 'test', eventVariant);
|
||||||
}, [eventVariant, featureId]);
|
}, [eventVariant, featureId]);
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx(styles.box, className)} {...htmlProps}>
|
<div className={cx(styles.box, className)} {...htmlProps}>
|
||||||
<Icon name={'rocket'} className={styles.icon} />
|
<Icon name={'rocket'} className={styles.icon} />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { Box, Icon, Text, useStyles2 } from '@grafana/ui';
|
import { Box, Icon, Text, useStyles2 } from '@grafana/ui';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { identity } from 'lodash';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import { dateTimeFormatTimeAgo } from '@grafana/data';
|
import { dateTimeFormatTimeAgo } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Box, Button, Divider, EmptyState, Icon, Stack, Text } from '@grafana/ui';
|
import { Box, Button, Divider, EmptyState, Icon, Stack, Text } from '@grafana/ui';
|
||||||
import { DiffGroup } from 'app/features/dashboard-scene/settings/version-history/DiffGroup';
|
import { DiffGroup } from 'app/features/dashboard-scene/settings/version-history/DiffGroup';
|
||||||
import { DiffViewer } from 'app/features/dashboard-scene/settings/version-history/DiffViewer';
|
import { DiffViewer } from 'app/features/dashboard-scene/settings/version-history/DiffViewer';
|
||||||
|
@ -66,7 +66,7 @@ export const VersionHistoryComparison = <T extends DiffArgument>({
|
||||||
const diff = jsonDiff(preprocessVersion(oldVersion), preprocessVersion(newVersion));
|
const diff = jsonDiff(preprocessVersion(oldVersion), preprocessVersion(newVersion));
|
||||||
const noHumanReadableDiffs = Object.entries(diff).length === 0;
|
const noHumanReadableDiffs = Object.entries(diff).length === 0;
|
||||||
const [showJsonDiff, setShowJsonDiff] = useState(noHumanReadableDiffs);
|
const [showJsonDiff, setShowJsonDiff] = useState(noHumanReadableDiffs);
|
||||||
const { t } = useTranslate();
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={2} direction="column">
|
<Stack gap={2} direction="column">
|
||||||
<Box>
|
<Box>
|
||||||
|
|
|
@ -2,11 +2,11 @@ import { css } from '@emotion/css';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { TFunction, Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Grid, Modal, useStyles2, Text } from '@grafana/ui';
|
import { Grid, Modal, useStyles2, Text } from '@grafana/ui';
|
||||||
import { getModKey } from 'app/core/utils/browser';
|
import { getModKey } from 'app/core/utils/browser';
|
||||||
|
|
||||||
const getShortcuts = (modKey: string, t: TFunction) => {
|
const getShortcuts = (modKey: string) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
category: t('help-modal.shortcuts-category.global', 'Global'),
|
category: t('help-modal.shortcuts-category.global', 'Global'),
|
||||||
|
@ -165,10 +165,9 @@ export interface HelpModalProps {
|
||||||
|
|
||||||
export const HelpModal = ({ onDismiss }: HelpModalProps): JSX.Element => {
|
export const HelpModal = ({ onDismiss }: HelpModalProps): JSX.Element => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const modKey = useMemo(() => getModKey(), []);
|
const modKey = useMemo(() => getModKey(), []);
|
||||||
const shortcuts = useMemo(() => getShortcuts(modKey, t), [modKey, t]);
|
const shortcuts = useMemo(() => getShortcuts(modKey), [modKey]);
|
||||||
return (
|
return (
|
||||||
<Modal title={t('help-modal.title', 'Shortcuts')} isOpen onDismiss={onDismiss} onClickBackdrop={onDismiss}>
|
<Modal title={t('help-modal.title', 'Shortcuts')} isOpen onDismiss={onDismiss} onClickBackdrop={onDismiss}>
|
||||||
<Grid columns={{ xs: 1, sm: 2 }} gap={3} tabIndex={0}>
|
<Grid columns={{ xs: 1, sm: 2 }} gap={3} tabIndex={0}>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { ErrorInfo, useEffect } from 'react';
|
||||||
import { useLocation } from 'react-router-dom-v5-compat';
|
import { useLocation } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
import { GrafanaTheme2, locationUtil, PageLayoutType } from '@grafana/data';
|
import { GrafanaTheme2, locationUtil, PageLayoutType } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Button, ErrorWithStack, useStyles2 } from '@grafana/ui';
|
import { Button, ErrorWithStack, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { Page } from '../components/Page/Page';
|
import { Page } from '../components/Page/Page';
|
||||||
|
@ -24,7 +24,6 @@ export function GrafanaRouteError({ error, errorInfo }: Props) {
|
||||||
window.location.href = locationUtil.getUrlForPartial(location, { chunkNotFound: true });
|
window.location.href = locationUtil.getUrlForPartial(location, { chunkNotFound: true });
|
||||||
}
|
}
|
||||||
}, [location, isChunkLoadingError]);
|
}, [location, isChunkLoadingError]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
// Would be good to know the page navId here but needs a pretty big refactoring
|
// Would be good to know the page navId here but needs a pretty big refactoring
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
|
|
||||||
// Maps the ID of the nav item to a translated phrase to later pass to <Trans />
|
// Maps the ID of the nav item to a translated phrase to later pass to <Trans />
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
urlUtil,
|
urlUtil,
|
||||||
serializeStateToUrlParam,
|
serializeStateToUrlParam,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { getDataSourceSrv } from '@grafana/runtime';
|
import { getDataSourceSrv } from '@grafana/runtime';
|
||||||
import { notifyApp } from 'app/core/actions';
|
import { notifyApp } from 'app/core/actions';
|
||||||
import { createErrorNotification, createWarningNotification } from 'app/core/copy/appNotification';
|
import { createErrorNotification, createWarningNotification } from 'app/core/copy/appNotification';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import memoizeOne from 'memoize-one';
|
import memoizeOne from 'memoize-one';
|
||||||
|
|
||||||
import { AbsoluteTimeRange, LogRowModel, UrlQueryMap } from '@grafana/data';
|
import { AbsoluteTimeRange, LogRowModel, UrlQueryMap } from '@grafana/data';
|
||||||
import { t } from '@grafana/i18n/internal';
|
import { t } from '@grafana/i18n';
|
||||||
import { getBackendSrv, config, locationService } from '@grafana/runtime';
|
import { getBackendSrv, config, locationService } from '@grafana/runtime';
|
||||||
import { sceneGraph, SceneTimeRangeLike, VizPanel } from '@grafana/scenes';
|
import { sceneGraph, SceneTimeRangeLike, VizPanel } from '@grafana/scenes';
|
||||||
import { notifyApp } from 'app/core/actions';
|
import { notifyApp } from 'app/core/actions';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
VariableSuggestion,
|
VariableSuggestion,
|
||||||
ActionVariable,
|
ActionVariable,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import {
|
import {
|
||||||
Switch,
|
Switch,
|
||||||
Field,
|
Field,
|
||||||
|
@ -40,7 +40,7 @@ const LABEL_WIDTH = 13;
|
||||||
export const ActionEditor = memo(({ index, value, onChange, suggestions, showOneClick }: ActionEditorProps) => {
|
export const ActionEditor = memo(({ index, value, onChange, suggestions, showOneClick }: ActionEditorProps) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const theme = useTheme2();
|
const theme = useTheme2();
|
||||||
const { t } = useTranslate();
|
|
||||||
const onTitleChange = (title: string) => {
|
const onTitleChange = (title: string) => {
|
||||||
onChange(index, { ...value, title });
|
onChange(index, { ...value, title });
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
import { ActionVariable, ActionVariableType } from '@grafana/data';
|
import { ActionVariable, ActionVariableType } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { IconButton, Input, Stack, Combobox, ComboboxOption } from '@grafana/ui';
|
import { IconButton, Input, Stack, Combobox, ComboboxOption } from '@grafana/ui';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -14,8 +14,6 @@ export const ActionVariablesEditor = ({ value, onChange }: Props) => {
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
const [type, setType] = useState<ActionVariableType>(ActionVariableType.String);
|
const [type, setType] = useState<ActionVariableType>(ActionVariableType.String);
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const changeKey = (key: string) => {
|
const changeKey = (key: string) => {
|
||||||
setKey(key);
|
setKey(key);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { contentTypeOptions, GrafanaTheme2, VariableSuggestion } from '@grafana/data';
|
import { contentTypeOptions, GrafanaTheme2, VariableSuggestion } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { IconButton, Input, Stack, Select, useStyles2 } from '@grafana/ui';
|
import { IconButton, Input, Stack, Select, useStyles2 } from '@grafana/ui';
|
||||||
|
|
||||||
import { SuggestionsInput } from '../transformers/suggestionsInput/SuggestionsInput';
|
import { SuggestionsInput } from '../transformers/suggestionsInput/SuggestionsInput';
|
||||||
|
@ -33,7 +33,6 @@ export const ParamsEditor = ({ value, onChange, suggestions, contentTypeHeader =
|
||||||
|
|
||||||
// forces re-init of first SuggestionsInput(s), since they are stateful and don't respond to 'value' prop changes to be able to clear them :(
|
// forces re-init of first SuggestionsInput(s), since they are stateful and don't respond to 'value' prop changes to be able to clear them :(
|
||||||
const [entryKey, setEntryKey] = useState(Math.random().toString());
|
const [entryKey, setEntryKey] = useState(Math.random().toString());
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const changeParamValue = (paramValue: string) => {
|
const changeParamValue = (paramValue: string) => {
|
||||||
setParamValue(paramValue);
|
setParamValue(paramValue);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useParams } from 'react-router-dom-v5-compat';
|
||||||
import { useAsyncFn } from 'react-use';
|
import { useAsyncFn } from 'react-use';
|
||||||
|
|
||||||
import { NavModelItem } from '@grafana/data';
|
import { NavModelItem } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Field, Input, Button, Legend, Alert } from '@grafana/ui';
|
import { Field, Input, Button, Legend, Alert } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
|
@ -51,8 +51,6 @@ const AdminEditOrgPage = () => {
|
||||||
fetchOrgUsers(page);
|
fetchOrgUsers(page);
|
||||||
}, [fetchOrg, fetchOrgUsers, page]);
|
}, [fetchOrg, fetchOrgUsers, page]);
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const onUpdateOrgName = async ({ orgName }: OrgNameDTO) => {
|
const onUpdateOrgName = async ({ orgName }: OrgNameDTO) => {
|
||||||
await updateOrgName(orgName, orgId);
|
await updateOrgName(orgName, orgId);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useState } from 'react';
|
||||||
import { useAsync } from 'react-use';
|
import { useAsync } from 'react-use';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { useStyles2, Icon } from '@grafana/ui';
|
import { useStyles2, Icon } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export default function AdminFeatureTogglesPage() {
|
||||||
const togglesApi = getTogglesAPI();
|
const togglesApi = getTogglesAPI();
|
||||||
const featureState = useAsync(() => togglesApi.getFeatureToggles(), [reload]);
|
const featureState = useAsync(() => togglesApi.getFeatureToggles(), [reload]);
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const handleUpdateSuccess = () => {
|
const handleUpdateSuccess = () => {
|
||||||
setReload(reload + 1);
|
setReload(reload + 1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useState, useRef } from 'react';
|
import { useState, useRef } from 'react';
|
||||||
|
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Switch, InteractiveTable, Tooltip, type CellProps, Button, ConfirmModal, type SortByFn } from '@grafana/ui';
|
import { Switch, InteractiveTable, Tooltip, type CellProps, Button, ConfirmModal, type SortByFn } from '@grafana/ui';
|
||||||
|
|
||||||
import { FeatureToggle, getTogglesAPI } from './AdminFeatureTogglesAPI';
|
import { FeatureToggle, getTogglesAPI } from './AdminFeatureTogglesAPI';
|
||||||
|
@ -37,7 +37,7 @@ export function AdminFeatureTogglesTable({ featureToggles, allowEditing, onUpdat
|
||||||
const [localToggles, setLocalToggles] = useState<FeatureToggle[]>(featureToggles);
|
const [localToggles, setLocalToggles] = useState<FeatureToggle[]>(featureToggles);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
const [showSaveModel, setShowSaveModal] = useState(false);
|
const [showSaveModel, setShowSaveModal] = useState(false);
|
||||||
const { t } = useTranslate();
|
|
||||||
const togglesApi = getTogglesAPI();
|
const togglesApi = getTogglesAPI();
|
||||||
|
|
||||||
const handleToggleChange = (toggle: FeatureToggle, newValue: boolean) => {
|
const handleToggleChange = (toggle: FeatureToggle, newValue: boolean) => {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useState } from 'react';
|
||||||
import Skeleton from 'react-loading-skeleton';
|
import Skeleton from 'react-loading-skeleton';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { Button, ConfirmModal, useStyles2 } from '@grafana/ui';
|
import { Button, ConfirmModal, useStyles2 } from '@grafana/ui';
|
||||||
import { SkeletonComponent, attachSkeleton } from '@grafana/ui/unstable';
|
import { SkeletonComponent, attachSkeleton } from '@grafana/ui/unstable';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
|
@ -32,7 +32,7 @@ function AdminOrgsTableComponent({ orgs, onDelete }: Props) {
|
||||||
const canDeleteOrgs = contextSrv.hasPermission(AccessControlAction.OrgsDelete);
|
const canDeleteOrgs = contextSrv.hasPermission(AccessControlAction.OrgsDelete);
|
||||||
|
|
||||||
const [deleteOrg, setDeleteOrg] = useState<Organization>();
|
const [deleteOrg, setDeleteOrg] = useState<Organization>();
|
||||||
const { t } = useTranslate();
|
|
||||||
const deleteOrgName = deleteOrg?.name;
|
const deleteOrgName = deleteOrg?.name;
|
||||||
return (
|
return (
|
||||||
<table className="filter-table form-inline filter-table--hover">
|
<table className="filter-table form-inline filter-table--hover">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { OrgRole } from '@grafana/data';
|
import { OrgRole } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { Select } from '@grafana/ui';
|
import { Select } from '@grafana/ui';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -16,8 +16,6 @@ const basicRoles = Object.values(OrgRole).filter((r) => r !== OrgRole.None);
|
||||||
const options = basicRoles.map((r) => ({ label: r, value: r }));
|
const options = basicRoles.map((r) => ({ label: r, value: r }));
|
||||||
|
|
||||||
export function OrgRolePicker({ value, onChange, 'aria-label': ariaLabel, inputId, autoFocus, ...restProps }: Props) {
|
export function OrgRolePicker({ value, onChange, 'aria-label': ariaLabel, inputId, autoFocus, ...restProps }: Props) {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
inputId={inputId}
|
inputId={inputId}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { GrafanaTheme2, NavModel } from '@grafana/data';
|
import { GrafanaTheme2, NavModel } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { LinkButton, useStyles2 } from '@grafana/ui';
|
import { LinkButton, useStyles2 } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import checkmarkSvg from 'img/licensing/checkmark.svg';
|
import checkmarkSvg from 'img/licensing/checkmark.svg';
|
||||||
|
@ -108,8 +108,6 @@ const CallToAction = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const ServiceInfo = () => {
|
const ServiceInfo = () => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h4>
|
<h4>
|
||||||
|
@ -169,8 +167,6 @@ const FeatureInfo = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const FeatureListing = () => {
|
const FeatureListing = () => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<Item title={t('admin.feature-listing.title-data-source-permissions', 'Data source permissions')} />
|
<Item title={t('admin.feature-listing.title-data-source-permissions', 'Data source permissions')} />
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { connect, ConnectedProps } from 'react-redux';
|
||||||
import { useParams } from 'react-router-dom-v5-compat';
|
import { useParams } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
import { NavModelItem } from '@grafana/data';
|
import { NavModelItem } from '@grafana/data';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { featureEnabled } from '@grafana/runtime';
|
import { featureEnabled } from '@grafana/runtime';
|
||||||
import { Stack } from '@grafana/ui';
|
import { Stack } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
|
@ -60,7 +60,6 @@ export const UserAdminPage = ({
|
||||||
revokeAllSessions,
|
revokeAllSessions,
|
||||||
syncLdapUser,
|
syncLdapUser,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { t } = useTranslate();
|
|
||||||
const { id = '' } = useParams();
|
const { id = '' } = useParams();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadAdminUserPage(id);
|
loadAdminUserPage(id);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form';
|
||||||
import { useNavigate } from 'react-router-dom-v5-compat';
|
import { useNavigate } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
import { NavModelItem } from '@grafana/data';
|
import { NavModelItem } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { getBackendSrv } from '@grafana/runtime';
|
import { getBackendSrv } from '@grafana/runtime';
|
||||||
import { Button, Input, Field } from '@grafana/ui';
|
import { Button, Input, Field } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
|
@ -40,7 +40,6 @@ const UserCreatePage = () => {
|
||||||
},
|
},
|
||||||
[navigate]
|
[navigate]
|
||||||
);
|
);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page navId="global-users" pageNav={pageNav}>
|
<Page navId="global-users" pageNav={pageNav}>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { PureComponent } from 'react';
|
import { PureComponent } from 'react';
|
||||||
|
|
||||||
import { dateTimeFormat } from '@grafana/data';
|
import { dateTimeFormat } from '@grafana/data';
|
||||||
import { Trans } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { t } from '@grafana/i18n/internal';
|
|
||||||
import { Button, LinkButton } from '@grafana/ui';
|
import { Button, LinkButton } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
import { AccessControlAction, SyncInfo, UserDTO } from 'app/types';
|
import { AccessControlAction, SyncInfo, UserDTO } from 'app/types';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { connect, ConnectedProps } from 'react-redux';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { LinkButton, RadioButtonGroup, useStyles2, FilterInput, EmptyState } from '@grafana/ui';
|
import { LinkButton, RadioButtonGroup, useStyles2, FilterInput, EmptyState } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
|
@ -70,8 +70,6 @@ const UserListAdminPageUnConnected = ({
|
||||||
fetchUsers();
|
fetchUsers();
|
||||||
}, [fetchUsers]);
|
}, [fetchUsers]);
|
||||||
|
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page.Contents>
|
<Page.Contents>
|
||||||
<div className={styles.actionBar} data-testid={selectors.container}>
|
<div className={styles.actionBar} data-testid={selectors.container}>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { connect, ConnectedProps } from 'react-redux';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { RadioButtonGroup, useStyles2, FilterInput } from '@grafana/ui';
|
import { RadioButtonGroup, useStyles2, FilterInput } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ const UserListAnonymousDevicesPageUnConnected = ({
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchUsersAnonymousDevices();
|
fetchUsersAnonymousDevices();
|
||||||
}, [fetchUsersAnonymousDevices]);
|
}, [fetchUsersAnonymousDevices]);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page.Contents>
|
<Page.Contents>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
||||||
import { useTranslate } from '@grafana/i18n';
|
import { t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { useStyles2, TabsBar, Tab } from '@grafana/ui';
|
import { useStyles2, TabsBar, Tab } from '@grafana/ui';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
|
@ -28,8 +28,6 @@ enum TabView {
|
||||||
const selectors = e2eSelectors.pages.UserListPage;
|
const selectors = e2eSelectors.pages.UserListPage;
|
||||||
|
|
||||||
const PublicDashboardsTab = ({ view, setView }: { view: TabView | null; setView: (v: TabView | null) => void }) => {
|
const PublicDashboardsTab = ({ view, setView }: { view: TabView | null; setView: (v: TabView | null) => void }) => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tab
|
<Tab
|
||||||
label={
|
label={
|
||||||
|
@ -65,7 +63,6 @@ export default function UserListPage() {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const showAdminAndOrgTabs = hasAccessToOrgUsers && hasAccessToAdminUsers;
|
const showAdminAndOrgTabs = hasAccessToOrgUsers && hasAccessToAdminUsers;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Button, LoadingPlaceholder, Modal, ModalsController, useStyles2 } from '@grafana/ui';
|
import { Button, LoadingPlaceholder, Modal, ModalsController, useStyles2 } from '@grafana/ui';
|
||||||
import {
|
import {
|
||||||
|
@ -17,7 +17,6 @@ export const DashboardsListModal = ({ email, onDismiss }: { email: string; onDis
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
const { data: dashboards, isLoading } = useGetActiveUserDashboardsQuery(email);
|
const { data: dashboards, isLoading } = useGetActiveUserDashboardsQuery(email);
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -84,8 +83,6 @@ export const DashboardsListModal = ({ email, onDismiss }: { email: string; onDis
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DashboardsListModalButton = ({ email }: { email: string }) => {
|
export const DashboardsListModalButton = ({ email }: { email: string }) => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const translatedDashboardListModalButtonText = t(
|
const translatedDashboardListModalButtonText = t(
|
||||||
'public-dashboard-users-access-list.dashboard-modal.open-dashboard-list-text',
|
'public-dashboard-users-access-list.dashboard-modal.open-dashboard-list-text',
|
||||||
'Open dashboards list'
|
'Open dashboards list'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Trans, useTranslate } from '@grafana/i18n';
|
import { Trans, t } from '@grafana/i18n';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Button, Modal, ModalsController, useStyles2 } from '@grafana/ui';
|
import { Button, Modal, ModalsController, useStyles2 } from '@grafana/ui';
|
||||||
import { SessionUser } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils';
|
import { SessionUser } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils';
|
||||||
|
@ -11,7 +11,7 @@ import { useRevokeAllAccessMutation } from '../../dashboard/api/publicDashboardA
|
||||||
const DeleteUserModal = ({ user, hideModal }: { user: SessionUser; hideModal: () => void }) => {
|
const DeleteUserModal = ({ user, hideModal }: { user: SessionUser; hideModal: () => void }) => {
|
||||||
const [revokeAllAccess] = useRevokeAllAccessMutation();
|
const [revokeAllAccess] = useRevokeAllAccessMutation();
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
const { t } = useTranslate();
|
|
||||||
const onRevokeAccessClick = () => {
|
const onRevokeAccessClick = () => {
|
||||||
revokeAllAccess({ email: user.email });
|
revokeAllAccess({ email: user.email });
|
||||||
hideModal();
|
hideModal();
|
||||||
|
@ -61,8 +61,6 @@ const DeleteUserModal = ({ user, hideModal }: { user: SessionUser; hideModal: ()
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DeleteUserModalButton = ({ user }: { user: SessionUser }) => {
|
export const DeleteUserModalButton = ({ user }: { user: SessionUser }) => {
|
||||||
const { t } = useTranslate();
|
|
||||||
|
|
||||||
const translatedDeleteUserText = t(
|
const translatedDeleteUserText = t(
|
||||||
'public-dashboard-users-access-list.delete-user-modal.delete-user-button-text',
|
'public-dashboard-users-access-list.delete-user-modal.delete-user-button-text',
|
||||||
'Delete user'
|
'Delete user'
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue