mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
Variables: migrates ad hoc variable type to react/redux. (#22784)
* Refactor: moves all the newVariables part to features/variables directory * Feature: adds datasource type * Tests: adds reducer tests * Tests: covers data source actions with tests * Chore: reduces strict null errors * boilerplate that will be replaced by real code. * added old editor template. * added initial version of ad hoc editor. * added working (apart from add) version of the editor. * Added placeholder for picker. * Have a working UI. Need to connect it so we refresh the variables on changes. * variable should be updated now. * removed console.log * made the url work. * cleaned up the adapter. * added possiblity to create filter directly from table. * moved infotext from general reducer to extended value of adhoc. * fixed strict null errors. * fixed strict null errors. * fixed issue where remove was displayed before being added. * fixed issue with fragment key. * changed so template_src is using the redux variables. * minor refactorings. * moved adhoc picker to adhoc variable. * adding tests for reducer and fixed bug. * added tests or urlparser. * added tests for ad hoc actions. * added more tests. * added more tests. * fixed strict null error. * fixed copy n pase error. * added utilit for getting new variable index. * removed console.log * added location to reducerTester type and created a module type for it. * changed so we only have one builder pattern. * fixed tests to use static expected values. * fixed strict errors. * fixed more strict errors. Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
This commit is contained in:
co-authored by
Hugo Häggmark
parent
6c9d833602
commit
a7a1406415
@@ -1,7 +1,7 @@
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import { MetricsPanelCtrl } from 'app/plugins/sdk';
|
||||
import config from 'app/core/config';
|
||||
import config, { getConfig } from 'app/core/config';
|
||||
import { transformDataToTable } from './transformers';
|
||||
import { tablePanelEditor } from './editor';
|
||||
import { columnOptionsTab } from './column_options';
|
||||
@@ -9,6 +9,8 @@ import { TableRenderer } from './renderer';
|
||||
import { isTableData, PanelEvents, PanelPlugin } from '@grafana/data';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { CoreEvents } from 'app/types';
|
||||
import { dispatch } from 'app/store/store';
|
||||
import { applyFilterFromTable } from 'app/features/variables/adhoc/actions';
|
||||
|
||||
export class TablePanelCtrl extends MetricsPanelCtrl {
|
||||
static templateUrl = 'module.html';
|
||||
@@ -257,7 +259,11 @@ export class TablePanelCtrl extends MetricsPanelCtrl {
|
||||
operator: filterData.operator,
|
||||
};
|
||||
|
||||
ctrl.variableSrv.setAdhocFilter(options);
|
||||
if (getConfig().featureToggles.newVariables) {
|
||||
dispatch(applyFilterFromTable(options));
|
||||
} else {
|
||||
ctrl.variableSrv.setAdhocFilter(options);
|
||||
}
|
||||
}
|
||||
|
||||
elem.on('click', '.table-panel-page-link', switchPage);
|
||||
|
||||
Reference in New Issue
Block a user