Skip to content

Panel: removes deprecated componets #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 8 additions & 29 deletions examples/panel-basic/src/components/SimplePanel/SimplePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import React from 'react';
import { PanelProps } from '@grafana/data';
import { TimeSeries, TooltipPlugin, TooltipDisplayMode, ZoomPlugin } from '@grafana/ui';
import { PanelDataErrorView } from '@grafana/runtime';
import { Table } from '@grafana/ui';

import { SimpleOptions } from '../../types';
import { testIds } from '../testIds';
import { PanelDataErrorView } from '@grafana/runtime';

interface Props extends PanelProps<SimpleOptions> {}

export function SimplePanel({
// Takes in a list of props used in this example
options, // Options declared within module.ts and standard Grafana options
data,
fieldConfig,
id,
width,
height,
timeZone,
timeRange,
onChangeTimeRange,
fieldConfig,
id,
}: Props) {
if (data.series.length === 0) {
if (!data.series.length) {
return <PanelDataErrorView fieldConfig={fieldConfig} panelId={id} data={data} needsStringField />;
}

Expand All @@ -29,29 +28,9 @@ export function SimplePanel({
{options.showSeriesCount && (
<div data-testid="simple-panel-series-counter">Number of series: {data.series.length}</div>
)}

<Table data={data.series[0]} width={width} height={height} timeRange={timeRange}></Table>
</div>
<TimeSeries
width={width}
height={height}
timeRange={timeRange}
timeZone={timeZone}
frames={data.series}
legend={options.legend}
>
{(config, alignedDataFrame) => {
return (
<>
<TooltipPlugin
config={config}
data={alignedDataFrame}
mode={TooltipDisplayMode.Multi}
timeZone={timeZone}
/>
<ZoomPlugin config={config} onZoom={onChangeTimeRange} />
</>
);
}}
</TimeSeries>
</div>
);
}