mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
AngularMigration: Add migration button to old graph panel (#41600)
* GraphOld: Mark old graph panel as deprecated so that it can no longer be picked in the UI * Add migration button * remove deprecation * add timeseries to graph query * update language * Slight tweak * Update public/app/plugins/panel/graph/tab_display.html Co-authored-by: Leon Sorokin <leeoniya@gmail.com> Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
parent
51ef770c2b
commit
1f07d32666
@ -27,6 +27,7 @@ export function filterPluginList(
|
||||
const query = searchQuery.toLowerCase();
|
||||
const first: PanelPluginMeta[] = [];
|
||||
const match: PanelPluginMeta[] = [];
|
||||
const isGraphQuery = 'graph'.startsWith(query);
|
||||
|
||||
for (const item of pluginsList) {
|
||||
if (item.state === PluginState.deprecated && current.id !== item.id) {
|
||||
@ -40,6 +41,8 @@ export function filterPluginList(
|
||||
first.push(item);
|
||||
} else if (idx > 0) {
|
||||
match.push(item);
|
||||
} else if (isGraphQuery && item.id === 'timeseries') {
|
||||
first.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
14
public/app/features/panel/state/utils.test.ts
Normal file
14
public/app/features/panel/state/utils.test.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { PanelPluginMeta } from '@grafana/data';
|
||||
import { filterPluginList } from './util';
|
||||
|
||||
describe('panel state utils', () => {
|
||||
it('should include timeseries in a graph query', async () => {
|
||||
const pluginsList: PanelPluginMeta[] = [
|
||||
{ id: 'graph', name: 'Graph (old)' } as any,
|
||||
{ id: 'timeseries', name: 'Graph (old)' },
|
||||
{ id: 'timeline', name: 'Timeline' },
|
||||
];
|
||||
const found = filterPluginList(pluginsList, 'gra', { id: 'xyz' } as any);
|
||||
expect(found.map((v) => v.id)).toEqual(['graph', 'timeseries']);
|
||||
});
|
||||
});
|
@ -356,6 +356,10 @@ export class GraphCtrl extends MetricsPanelCtrl {
|
||||
getDataFrameByRefId = (refId: string) => {
|
||||
return this.dataList.filter((dataFrame) => dataFrame.refId === refId)[0];
|
||||
};
|
||||
|
||||
migrateToReact() {
|
||||
this.onPluginTypeChange(config.panels['timeseries']);
|
||||
}
|
||||
}
|
||||
|
||||
// Use new react style configuration
|
||||
|
@ -1,4 +1,17 @@
|
||||
<div class="gf-form-group">
|
||||
<div class="grafana-info-box">
|
||||
<h5>Migration</h5>
|
||||
<p>
|
||||
Consider switching to the Time series visualization type. It is a more capable and performant version of this panel.
|
||||
</p>
|
||||
<p>
|
||||
<button class="btn btn-primary" ng-click="ctrl.migrateToReact()">
|
||||
Migrate
|
||||
</button>
|
||||
</p>
|
||||
<p>Some features like colored time regions and negative transforms are not supported in the new panel yet.</p>
|
||||
</div>
|
||||
|
||||
<gf-form-switch
|
||||
class="gf-form"
|
||||
label="Bars"
|
||||
|
Loading…
Reference in New Issue
Block a user