feat(explore): Remove default for time range filter and Metrics (#14661)

* feat(explore): Remove default for time range filter and Metrics

* Merge errors with same messages

* Fix e2e test

* Rename a variable

* Bump packages

* Fix unit tests
This commit is contained in:
Kamil Gabryjelski
2021-05-25 15:55:41 +02:00
committed by GitHub
parent add35f9fe4
commit 63dc035d6a
9 changed files with 398 additions and 381 deletions

View File

@@ -149,30 +149,14 @@ describe('controlUtils', () => {
expect(control).toBeNull();
});
it('applies the default function for metrics', () => {
it('metrics control should be empty by default', () => {
const control = getControlState('metrics', 'table', state);
expect(control?.default).toEqual(['first']);
expect(control?.default).toBeUndefined();
});
it('applies the default function for metric', () => {
it('metric control should be empty by default', () => {
const control = getControlState('metric', 'table', state);
expect(control?.default).toEqual('first');
});
it('applies the default function, prefers count if it exists', () => {
const stateWithCount = {
...state,
datasource: {
...(state.datasource as DatasourceMeta),
metrics: [
{ metric_name: 'first' },
{ metric_name: 'second' },
{ metric_name: 'count' },
],
},
};
const control = getControlState('metrics', 'table', stateWithCount);
expect(control?.default).toEqual(['count']);
expect(control?.default).toBeUndefined();
});
it('should not apply mapStateToProps when initializing', () => {
@@ -180,7 +164,6 @@ describe('controlUtils', () => {
...state,
controls: undefined,
});
expect(typeof control?.default).toBe('function');
expect(control?.value).toBe(undefined);
});
});