mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 05:08:36 +08:00
Build: removed circular dependencies to make grafana/ui build again (#23468)
* fixed dependecy issues. * Fixed so we don't have any circular dependencies. * added missing type. * fixed formatting issue of config. * skipping sourcemap again.
This commit is contained in:
@ -6,3 +6,5 @@ export * from './fieldReducer';
|
||||
export { FilterFieldsByNameTransformerOptions } from './transformers/filterByName';
|
||||
export { FilterFramesByRefIdTransformerOptions } from './transformers/filterByRefId';
|
||||
export { ReduceTransformerOptions } from './transformers/reduce';
|
||||
export { OrganizeFieldsTransformerOptions } from './transformers/organize';
|
||||
export { createOrderFieldsComparer } from './transformers/order';
|
||||
|
@ -35,7 +35,7 @@ export const orderFieldsTransformer: DataTransformerInfo<OrderFieldsTransformerO
|
||||
},
|
||||
};
|
||||
|
||||
export const createFieldsComparer = (indexByName: Record<string, number>) => (a: string, b: string) => {
|
||||
export const createOrderFieldsComparer = (indexByName: Record<string, number>) => (a: string, b: string) => {
|
||||
return indexOfField(a, indexByName) - indexOfField(b, indexByName);
|
||||
};
|
||||
|
||||
@ -46,7 +46,7 @@ const createFieldsOrderer = (indexByName: Record<string, number>) => (fields: Fi
|
||||
if (!indexByName || Object.keys(indexByName).length === 0) {
|
||||
return fields;
|
||||
}
|
||||
const comparer = createFieldsComparer(indexByName);
|
||||
const comparer = createOrderFieldsComparer(indexByName);
|
||||
return fields.sort((a, b) => comparer(a.name, b.name));
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,7 @@ module.exports = ({ config, mode }) => {
|
||||
use: [
|
||||
{
|
||||
loader: 'style-loader',
|
||||
options: { injectType: 'lazyStyleTag' }
|
||||
options: { injectType: 'lazyStyleTag' },
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
@ -86,9 +86,10 @@ module.exports = ({ config, mode }) => {
|
||||
}),
|
||||
new OptimizeCSSAssetsPlugin({}),
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
config.resolve.extensions.push('.ts', '.tsx', '.mdx');
|
||||
|
||||
config.stats = {
|
||||
warningsFilter: /export .* was not found in/,
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { FC, ReactNode } from 'react';
|
||||
import { Icon, IconName } from '@grafana/ui';
|
||||
import classNames from 'classnames';
|
||||
import { Icon } from '../Icon/Icon';
|
||||
import { IconName } from '../../types/icon';
|
||||
|
||||
export type AlertVariant = 'success' | 'warning' | 'error' | 'info';
|
||||
|
||||
|
@ -2,7 +2,7 @@ import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, useContext } from 'r
|
||||
import { css, cx } from 'emotion';
|
||||
import tinycolor from 'tinycolor2';
|
||||
import { selectThemeVariant, stylesFactory, ThemeContext } from '../../themes';
|
||||
import { IconName } from '../../types';
|
||||
import { IconName } from '../../types/icon';
|
||||
import { getFocusStyle, getPropertiesForButtonSize } from '../Forms/commonStyles';
|
||||
import { GrafanaTheme } from '@grafana/data';
|
||||
import { ButtonContent } from './ButtonContent';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { css } from 'emotion';
|
||||
import { stylesFactory, useTheme } from '../../themes';
|
||||
import { IconName } from '../../types';
|
||||
import { IconName } from '../../types/icon';
|
||||
import { Icon } from '../Icon/Icon';
|
||||
import { ComponentSize } from '../../types/size';
|
||||
import { GrafanaTheme } from '@grafana/data';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import { css } from 'emotion';
|
||||
import { Modal } from '../Modal/Modal';
|
||||
import { IconName } from '../../types';
|
||||
import { IconName } from '../../types/icon';
|
||||
import { Button } from '../Button';
|
||||
import { stylesFactory, ThemeContext } from '../../themes';
|
||||
import { GrafanaTheme } from '@grafana/data';
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { css, cx } from 'emotion';
|
||||
import { GrafanaTheme, toPascalCase } from '@grafana/data';
|
||||
import { stylesFactory } from '../../themes';
|
||||
import { stylesFactory } from '../../themes/stylesFactory';
|
||||
import { useTheme } from '../../themes/ThemeContext';
|
||||
import { IconName, IconType, IconSize } from '../../types';
|
||||
import { IconName, IconType, IconSize } from '../../types/icon';
|
||||
import { ComponentSize } from '../../types/size';
|
||||
//@ts-ignore
|
||||
import * as DefaultIcon from '@iconscout/react-unicons';
|
||||
@ -14,11 +14,6 @@ interface IconProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
size?: IconSize;
|
||||
type?: IconType;
|
||||
}
|
||||
export interface SvgProps extends React.HTMLAttributes<SVGElement> {
|
||||
size: number;
|
||||
secondaryColor?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const getIconStyles = stylesFactory((theme: GrafanaTheme) => {
|
||||
return {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Apps: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Bell: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Cog: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Favorite: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Folder: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const FolderPlus: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Grafana: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Import: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const PanelAdd: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const PlusSquare: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { SvgProps } from '../Icon';
|
||||
import { SvgProps } from './types';
|
||||
|
||||
export const Shield: FunctionComponent<SvgProps> = ({ size, ...rest }) => {
|
||||
return (
|
||||
|
7
packages/grafana-ui/src/components/Icon/assets/types.ts
Normal file
7
packages/grafana-ui/src/components/Icon/assets/types.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
export interface SvgProps extends React.HTMLAttributes<SVGElement> {
|
||||
size: number;
|
||||
secondaryColor?: string;
|
||||
className?: string;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { Field, LinkModel, LogRowModel, TimeZone, DataQueryResponse, GrafanaTheme } from '@grafana/data';
|
||||
import { Icon } from '@grafana/ui';
|
||||
import { Icon } from '../Icon/Icon';
|
||||
import { cx, css } from 'emotion';
|
||||
|
||||
import {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Libraries
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { Icon } from '@grafana/ui';
|
||||
import { Icon } from '../Icon/Icon';
|
||||
|
||||
interface Props {
|
||||
title?: string | JSX.Element;
|
||||
|
@ -1,12 +1,17 @@
|
||||
import React, { useMemo, useCallback } from 'react';
|
||||
import { css, cx } from 'emotion';
|
||||
import { OrganizeFieldsTransformerOptions } from '@grafana/data/src/transformations/transformers/organize';
|
||||
import { DragDropContext, Droppable, Draggable, DropResult } from 'react-beautiful-dnd';
|
||||
import {
|
||||
DataTransformerID,
|
||||
transformersRegistry,
|
||||
DataFrame,
|
||||
GrafanaTheme,
|
||||
createOrderFieldsComparer,
|
||||
OrganizeFieldsTransformerOptions,
|
||||
} from '@grafana/data';
|
||||
import { TransformerUIRegistyItem, TransformerUIProps } from './types';
|
||||
import { DataTransformerID, transformersRegistry, DataFrame, GrafanaTheme } from '@grafana/data';
|
||||
import { stylesFactory, useTheme } from '../../themes';
|
||||
import { Button } from '../Button';
|
||||
import { createFieldsComparer } from '@grafana/data/src/transformations/transformers/order';
|
||||
import { Button } from '../Button/Button';
|
||||
import { VerticalGroup } from '../Layout/Layout';
|
||||
import { Input } from '../Input/Input';
|
||||
|
||||
@ -189,7 +194,7 @@ const orderFieldNamesByIndex = (fieldNames: string[], indexByName: Record<string
|
||||
if (!indexByName || Object.keys(indexByName).length === 0) {
|
||||
return fieldNames;
|
||||
}
|
||||
const comparer = createFieldsComparer(indexByName);
|
||||
const comparer = createOrderFieldsComparer(indexByName);
|
||||
return fieldNames.sort(comparer);
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
export { Icon } from './Icon/Icon';
|
||||
export { ConfirmButton } from './ConfirmButton/ConfirmButton';
|
||||
export { DeleteButton } from './ConfirmButton/DeleteButton';
|
||||
export { Tooltip, PopoverContent } from './Tooltip/Tooltip';
|
||||
@ -113,7 +114,6 @@ export { FadeTransition } from './transitions/FadeTransition';
|
||||
export { SlideOutTransition } from './transitions/SlideOutTransition';
|
||||
export { Segment, SegmentAsync, SegmentInput, SegmentSelect } from './Segment/';
|
||||
export { default as Chart } from './Chart';
|
||||
export { Icon } from './Icon/Icon';
|
||||
export { Drawer } from './Drawer/Drawer';
|
||||
export { Slider } from './Slider/Slider';
|
||||
|
||||
|
Reference in New Issue
Block a user