Chore: Remove alpha icon panel (#68573)

This commit is contained in:
Nathan Marrs
2023-05-16 10:32:25 -07:00
committed by GitHub
parent bf75969794
commit 8390fcc80f
11 changed files with 0 additions and 190 deletions

View File

@ -5610,14 +5610,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "4"],
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
],
"public/app/plugins/panel/icon/IconPanel.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/panel/icon/module.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/panel/live/LiveChannelEditor.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],

1
.github/CODEOWNERS vendored
View File

@ -419,7 +419,6 @@ lerna.json @grafana/frontend-ops
/public/app/plugins/panel/geomap/ @grafana/dataviz-squad
/public/app/plugins/panel/canvas/ @grafana/dataviz-squad
/public/app/plugins/panel/candlestick/ @grafana/dataviz-squad
/public/app/plugins/panel/icon/ @grafana/dataviz-squad
/public/app/plugins/panel/live/ @grafana/grafana-app-platform-squad
/public/app/plugins/panel/news/ @grafana/grafana-frontend-platform
/public/app/plugins/panel/stat/ @grafana/grafana-bi-squad

View File

@ -175,7 +175,6 @@ func verifyCorePluginCatalogue(t *testing.T, ctx context.Context, ps *store.Serv
"graph": {},
"heatmap": {},
"histogram": {},
"icon": {},
"live": {},
"logs": {},
"candlestick": {},

View File

@ -66,7 +66,6 @@ func corePlugins(rt *thema.Runtime) []pfs.ParsedPlugin {
parsePluginOrPanic("public/app/plugins/panel/graph", "graph", rt),
parsePluginOrPanic("public/app/plugins/panel/heatmap", "heatmap", rt),
parsePluginOrPanic("public/app/plugins/panel/histogram", "histogram", rt),
parsePluginOrPanic("public/app/plugins/panel/icon", "icon", rt),
parsePluginOrPanic("public/app/plugins/panel/live", "live", rt),
parsePluginOrPanic("public/app/plugins/panel/logs", "logs", rt),
parsePluginOrPanic("public/app/plugins/panel/news", "news", rt),

View File

@ -74,7 +74,6 @@ import * as xyChartPanel from 'app/plugins/panel/xychart/module';
// Async loaded panels
const geomapPanel = async () => await import(/* webpackChunkName: "geomapPanel" */ 'app/plugins/panel/geomap/module');
const canvasPanel = async () => await import(/* webpackChunkName: "canvasPanel" */ 'app/plugins/panel/canvas/module');
const iconPanel = async () => await import(/* webpackChunkName: "iconPanel" */ 'app/plugins/panel/icon/module');
const graphPanel = async () => await import(/* webpackChunkName: "graphPlugin" */ 'app/plugins/panel/graph/module');
const heatmapPanel = async () =>
await import(/* webpackChunkName: "heatmapPanel" */ 'app/plugins/panel/heatmap/module');
@ -116,7 +115,6 @@ const builtInPlugins: any = {
'app/plugins/panel/xychart/module': xyChartPanel,
'app/plugins/panel/geomap/module': geomapPanel,
'app/plugins/panel/canvas/module': canvasPanel,
'app/plugins/panel/icon/module': iconPanel,
'app/plugins/panel/dashlist/module': dashListPanel,
'app/plugins/panel/alertlist/module': alertListPanel,
'app/plugins/panel/annolist/module': annoListPanel,

View File

@ -1,90 +0,0 @@
import React, { Component } from 'react';
import { PanelProps } from '@grafana/data';
import {
ColorDimensionConfig,
ResourceDimensionConfig,
ScalarDimensionConfig,
ScaleDimensionConfig,
TextDimensionConfig,
} from '@grafana/schema';
import { HorizontalConstraint, VerticalConstraint } from 'app/features/canvas';
import { iconItem } from 'app/features/canvas/elements/icon';
import { ElementState } from 'app/features/canvas/runtime/element';
import {
DimensionContext,
getColorDimensionFromData,
getResourceDimensionFromData,
getScalarDimensionFromData,
getScaleDimensionFromData,
getTextDimensionFromData,
} from 'app/features/dimensions';
import { Options } from './models.gen';
interface Props extends PanelProps<Options> {}
export class IconPanel extends Component<Props> {
private element: ElementState;
constructor(props: Props) {
super(props);
this.element = this.initElement(props);
}
initElement = (props: Props) => {
this.element = new ElementState(iconItem, props.options.root as any);
this.updateSize(props);
this.element.updateData(this.dims);
return this.element;
};
updateSize = (props: Props) => {
const { width, height } = props;
this.element.options.constraint = {
vertical: VerticalConstraint.Top,
horizontal: HorizontalConstraint.Left,
};
this.element.options.placement = {
left: 0,
top: 0,
width,
height,
};
};
dims: DimensionContext = {
getColor: (color: ColorDimensionConfig) => getColorDimensionFromData(this.props.data, color),
getScale: (scale: ScaleDimensionConfig) => getScaleDimensionFromData(this.props.data, scale),
getScalar: (scalar: ScalarDimensionConfig) => getScalarDimensionFromData(this.props.data, scalar),
getText: (text: TextDimensionConfig) => getTextDimensionFromData(this.props.data, text),
getResource: (res: ResourceDimensionConfig) => getResourceDimensionFromData(this.props.data, res),
getPanelData: () => this.props.data,
};
shouldComponentUpdate(nextProps: Props) {
const { width, height, data } = this.props;
let changed = false;
if (width !== nextProps.width || height !== nextProps.height) {
this.updateSize(nextProps);
changed = true;
}
if (data !== nextProps.data) {
this.element.updateData(this.dims);
changed = true;
}
// Reload the element when options change
if (this.props.options?.root !== nextProps.options?.root) {
this.initElement(nextProps);
changed = true;
}
return changed;
}
render() {
const { width, height } = this.props;
return <div style={{ width, height, overflow: 'hidden', position: 'relative' }}>{this.element.render()}</div>;
}
}

View File

@ -1,3 +0,0 @@
# Icon panel - Native Plugin
The icon panel is **included** with Grafana.

View File

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<defs><style>.cls-1{fill:#84aff1;}.cls-2{fill:url(#linear-gradient);}.cls-3{fill:#3865ab;}</style><linearGradient id="linear-gradient" y1="40.18" x2="82.99" y2="40.18" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f2cc0c"/><stop offset="1" stop-color="#ff9830"/></linearGradient></defs>
<path class="cls-3" d="M21.92,6.62a1,1,0,0,0-.54-.54A1,1,0,0,0,21,6H16a1,1,0,0,0,0,2h2.59L13,13.59l-3.29-3.3a1,1,0,0,0-1.42,0l-6,6a1,1,0,0,0,0,1.42,1,1,0,0,0,1.42,0L9,12.41l3.29,3.3a1,1,0,0,0,1.42,0L20,9.41V12a1,1,0,0,0,2,0V7A1,1,0,0,0,21.92,6.62Z" />
</svg>

Before

Width:  |  Height:  |  Size: 629 B

View File

@ -1,26 +0,0 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// NOTE: This file will be auto generated from models.cue
// It is currenty hand written but will serve as the target for cuetsy
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import { CanvasElementOptions } from 'app/features/canvas';
import { IconConfig } from 'app/features/canvas/elements/icon';
import { ResourceDimensionMode } from '@grafana/schema';
export interface Options {
root: Omit<CanvasElementOptions<IconConfig>, 'type' | 'name'>; // type is forced
}
export const defaultOptions: Options = {
root: {
config: {
path: {
mode: ResourceDimensionMode.Fixed,
fixed: 'img/icons/unicons/analysis.svg',
},
fill: {
fixed: 'green'
}
},
},
};

View File

@ -1,36 +0,0 @@
import { FieldConfigProperty, PanelPlugin } from '@grafana/data';
import { CanvasElementOptions } from 'app/features/canvas';
import { IconConfig, iconItem } from 'app/features/canvas/elements/icon';
import { optionBuilder } from '../canvas/editor/options';
import { IconPanel } from './IconPanel';
import { defaultOptions, Options } from './models.gen';
export const plugin = new PanelPlugin<Options>(IconPanel)
.setNoPadding() // extend to panel edges
.useFieldConfig({
standardOptions: {
[FieldConfigProperty.Mappings]: {
settings: {
icon: true,
},
},
},
})
.setPanelOptions((builder) => {
builder.addNestedOptions<CanvasElementOptions<IconConfig>>({
category: ['Icon'],
path: 'root',
// Dynamically fill the selected element
build: (builder, ctx) => {
iconItem.registerOptionsUI!(builder, ctx);
optionBuilder.addBackground(builder, ctx);
optionBuilder.addBorder(builder, ctx);
},
defaultValue: defaultOptions.root as any,
});
});

View File

@ -1,18 +0,0 @@
{
"type": "panel",
"name": "Icon",
"id": "icon",
"state": "alpha",
"info": {
"description": "Show icon based on data",
"author": {
"name": "Grafana Labs",
"url": "https://grafana.com"
},
"logos": {
"small": "img/icn-icon.svg",
"large": "img/icn-icon.svg"
}
}
}