Skip to content

Commit

Permalink
Add RefId to Query as mandatory for the upcoming release (#55)
Browse files Browse the repository at this point in the history
* Add RefId to Query as required in the Grafana master

* Fix tests
  • Loading branch information
mikhail-vl authored Apr 19, 2021
1 parent 37c267a commit 12db1bb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/root-page/root-page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import React from 'react';
import { Observable } from 'rxjs';
import { AppPluginMeta, PluginType } from '@grafana/data';
import { InfoBox } from '@grafana/ui';
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('RootPage', () => {

setImmediate(() => {
expect(getRedisMock).toHaveBeenCalledWith('redis');
expect(redisMock.query).toHaveBeenCalledWith({ targets: [{ query: RedisCommand.COMMAND }] });
expect(redisMock.query).toHaveBeenCalledWith({ targets: [{ refId: 'A', query: RedisCommand.COMMAND }] });
expect(wrapper.state().loading).toBeFalsy();
expect(wrapper.state().dataSources).toEqual([
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/root-page/root-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class RootPage extends PureComponent<Props, State> {
* Execute query
*/
const query = (redis.query({
targets: [{ query: RedisCommand.COMMAND }],
targets: [{ refId: 'A', query: RedisCommand.COMMAND }],
} as DataQueryRequest<RedisQuery>) as unknown) as Observable<DataQueryResponse>;

if (!query.toPromise) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const RedisCLIPanel: React.FC<PanelProps<PanelOptions>> = ({
* Run Query
*/
const res = await ((ds.query({
targets: [{ query: replaceVariables(query), cli: !options.raw }],
targets: [{ refId: 'A', query: replaceVariables(query), cli: !options.raw }],
} as DataQueryRequest<RedisQuery>) as unknown) as Observable<DataQueryResponse>)
.pipe(
switchMap$((response) => {
Expand Down

0 comments on commit 12db1bb

Please sign in to comment.