From 8390fcc80fb3741ea9b596b2eefbcacedc7f36f3 Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Tue, 16 May 2023 10:32:25 -0700 Subject: [PATCH] Chore: Remove alpha icon panel (#68573) --- .betterer.results | 8 -- .github/CODEOWNERS | 1 - .../manager/manager_integration_test.go | 1 - pkg/plugins/pfs/corelist/corelist_load_gen.go | 1 - .../app/features/plugins/built_in_plugins.ts | 2 - public/app/plugins/panel/icon/IconPanel.tsx | 90 ------------------- public/app/plugins/panel/icon/README.md | 3 - .../app/plugins/panel/icon/img/icn-icon.svg | 4 - public/app/plugins/panel/icon/models.gen.ts | 26 ------ public/app/plugins/panel/icon/module.tsx | 36 -------- public/app/plugins/panel/icon/plugin.json | 18 ---- 11 files changed, 190 deletions(-) delete mode 100644 public/app/plugins/panel/icon/IconPanel.tsx delete mode 100644 public/app/plugins/panel/icon/README.md delete mode 100644 public/app/plugins/panel/icon/img/icn-icon.svg delete mode 100644 public/app/plugins/panel/icon/models.gen.ts delete mode 100644 public/app/plugins/panel/icon/module.tsx delete mode 100644 public/app/plugins/panel/icon/plugin.json diff --git a/.betterer.results b/.betterer.results index 4d1853f6a0c..dbb5b8b957d 100644 --- a/.betterer.results +++ b/.betterer.results @@ -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"], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 91f5a5704a2..9446a597cd4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -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 diff --git a/pkg/plugins/manager/manager_integration_test.go b/pkg/plugins/manager/manager_integration_test.go index b829f238ba3..551058514b0 100644 --- a/pkg/plugins/manager/manager_integration_test.go +++ b/pkg/plugins/manager/manager_integration_test.go @@ -175,7 +175,6 @@ func verifyCorePluginCatalogue(t *testing.T, ctx context.Context, ps *store.Serv "graph": {}, "heatmap": {}, "histogram": {}, - "icon": {}, "live": {}, "logs": {}, "candlestick": {}, diff --git a/pkg/plugins/pfs/corelist/corelist_load_gen.go b/pkg/plugins/pfs/corelist/corelist_load_gen.go index b2110db4a63..cdbdb3ea1f7 100644 --- a/pkg/plugins/pfs/corelist/corelist_load_gen.go +++ b/pkg/plugins/pfs/corelist/corelist_load_gen.go @@ -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), diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index 1b46e9f83af..6097d5ce2f3 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -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, diff --git a/public/app/plugins/panel/icon/IconPanel.tsx b/public/app/plugins/panel/icon/IconPanel.tsx deleted file mode 100644 index d248ceef4c1..00000000000 --- a/public/app/plugins/panel/icon/IconPanel.tsx +++ /dev/null @@ -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 {} - -export class IconPanel extends Component { - 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
{this.element.render()}
; - } -} diff --git a/public/app/plugins/panel/icon/README.md b/public/app/plugins/panel/icon/README.md deleted file mode 100644 index 6fc6f0b2271..00000000000 --- a/public/app/plugins/panel/icon/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Icon panel - Native Plugin - -The icon panel is **included** with Grafana. diff --git a/public/app/plugins/panel/icon/img/icn-icon.svg b/public/app/plugins/panel/icon/img/icn-icon.svg deleted file mode 100644 index b4ff2621278..00000000000 --- a/public/app/plugins/panel/icon/img/icn-icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/public/app/plugins/panel/icon/models.gen.ts b/public/app/plugins/panel/icon/models.gen.ts deleted file mode 100644 index b068bcda677..00000000000 --- a/public/app/plugins/panel/icon/models.gen.ts +++ /dev/null @@ -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, 'type' | 'name'>; // type is forced -} - -export const defaultOptions: Options = { - root: { - config: { - path: { - mode: ResourceDimensionMode.Fixed, - fixed: 'img/icons/unicons/analysis.svg', - }, - fill: { - fixed: 'green' - } - }, - }, -}; diff --git a/public/app/plugins/panel/icon/module.tsx b/public/app/plugins/panel/icon/module.tsx deleted file mode 100644 index 1cce66fea37..00000000000 --- a/public/app/plugins/panel/icon/module.tsx +++ /dev/null @@ -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(IconPanel) - .setNoPadding() // extend to panel edges - .useFieldConfig({ - standardOptions: { - [FieldConfigProperty.Mappings]: { - settings: { - icon: true, - }, - }, - }, - }) - .setPanelOptions((builder) => { - builder.addNestedOptions>({ - 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, - }); - }); diff --git a/public/app/plugins/panel/icon/plugin.json b/public/app/plugins/panel/icon/plugin.json deleted file mode 100644 index 0fa8f63010f..00000000000 --- a/public/app/plugins/panel/icon/plugin.json +++ /dev/null @@ -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" - } - } -}