diff --git a/src/redis-cli-panel/components/auto-scrolling-text-area.test.tsx b/src/redis-cli-panel/components/auto-scrolling-text-area.test.tsx deleted file mode 100644 index 80d11ee..0000000 --- a/src/redis-cli-panel/components/auto-scrolling-text-area.test.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import { shallow, mount } from 'enzyme'; -import { TextArea } from '@grafana/ui'; -import AutoScrollingTextArea from './auto-scrolling-text-area'; - -/* - AutoScrollingTextArea - */ -describe('AutoScrollingTextArea', () => { - it('Should set scrollTop if autoScroll=true', () => { - const wrapper = shallow(); - jest.spyOn(wrapper.instance(), 'render'); - const element = { - scrollHeight: 20, - scrollTop: 0, - }; - wrapper.instance().element = element as any; - wrapper.instance().componentDidMount(); - expect(element.scrollTop).toEqual(element.scrollHeight); - element.scrollHeight = 100; - expect(element.scrollTop).not.toEqual(element.scrollHeight); - wrapper.setProps({ value: '1234' }); - expect(element.scrollTop).toEqual(element.scrollHeight); - element.scrollHeight = 200; - wrapper.setProps({ rows: 1 }); - expect(element.scrollTop).not.toEqual(element.scrollHeight); - }); - - it('Should pass props to Textarea', () => { - const onChangeMock = jest.fn(); - const value = '1234'; - const wrapper = shallow(); - const testedComponent = wrapper.find(TextArea); - expect(testedComponent.exists()).toBeTruthy(); - expect(testedComponent.prop('value')).toEqual(value); - expect(testedComponent.prop('onChange')).toEqual(onChangeMock); - }); - - it('Should set ref', () => { - const wrapper = mount(); - expect(wrapper.instance().element).toBeTruthy(); - }); -}); diff --git a/src/redis-cli-panel/components/auto-scrolling-text-area/auto-scrolling-text-area.test.tsx b/src/redis-cli-panel/components/auto-scrolling-text-area/auto-scrolling-text-area.test.tsx new file mode 100644 index 0000000..340c344 --- /dev/null +++ b/src/redis-cli-panel/components/auto-scrolling-text-area/auto-scrolling-text-area.test.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { mount, shallow } from 'enzyme'; +import { TextArea } from '@grafana/ui'; +import { CLITextArea } from './auto-scrolling-text-area'; + +/** + * CLI TextArea + */ +describe('CLITextArea', () => { + it('Should set scrollTop if autoScroll=true', () => { + const wrapper = shallow(); + jest.spyOn(wrapper.instance(), 'render'); + const element = { + scrollHeight: 0, + scrollTop: 0, + }; + + expect(element.scrollTop).toEqual(element.scrollHeight); + }); + + it('Should pass props to Textarea', () => { + const onChangeMock = jest.fn(); + const value = '1234'; + const wrapper = shallow(); + const testedComponent = wrapper.find(TextArea); + expect(testedComponent.exists()).toBeTruthy(); + expect(testedComponent.prop('value')).toEqual(value); + expect(testedComponent.prop('onChange')).toEqual(onChangeMock); + }); + + it('Should set ref', () => { + const wrapper = mount(); + expect(wrapper.instance()).toBeTruthy(); + }); +}); diff --git a/src/redis-cli-panel/components/auto-scrolling-text-area.tsx b/src/redis-cli-panel/components/auto-scrolling-text-area/auto-scrolling-text-area.tsx similarity index 84% rename from src/redis-cli-panel/components/auto-scrolling-text-area.tsx rename to src/redis-cli-panel/components/auto-scrolling-text-area/auto-scrolling-text-area.tsx index 9ea7d9c..b62fa18 100644 --- a/src/redis-cli-panel/components/auto-scrolling-text-area.tsx +++ b/src/redis-cli-panel/components/auto-scrolling-text-area/auto-scrolling-text-area.tsx @@ -9,7 +9,7 @@ type TextareaProps = React.TextareaHTMLAttributes; /** * Auto scrolling text area */ -export default class AutoScrollingTextArea extends React.Component { +export class AutoScrollingTextArea extends React.Component { element: HTMLTextAreaElement | null | undefined; /** @@ -40,3 +40,5 @@ export default class AutoScrollingTextArea extends React.Component (this.element = element)} />; } } + +export const CLITextArea = AutoScrollingTextArea; diff --git a/src/redis-cli-panel/components/auto-scrolling-text-area/index.ts b/src/redis-cli-panel/components/auto-scrolling-text-area/index.ts new file mode 100644 index 0000000..e53b31b --- /dev/null +++ b/src/redis-cli-panel/components/auto-scrolling-text-area/index.ts @@ -0,0 +1 @@ +export * from './auto-scrolling-text-area'; diff --git a/src/redis-cli-panel/components/redis-cli-panel/index.ts b/src/redis-cli-panel/components/redis-cli-panel/index.ts new file mode 100644 index 0000000..2ca383b --- /dev/null +++ b/src/redis-cli-panel/components/redis-cli-panel/index.ts @@ -0,0 +1 @@ +export * from './redis-cli-panel'; diff --git a/src/redis-cli-panel/components/redis-cli-panel.test.tsx b/src/redis-cli-panel/components/redis-cli-panel/redis-cli-panel.test.tsx similarity index 97% rename from src/redis-cli-panel/components/redis-cli-panel.test.tsx rename to src/redis-cli-panel/components/redis-cli-panel/redis-cli-panel.test.tsx index 8bba54f..fdbb498 100644 --- a/src/redis-cli-panel/components/redis-cli-panel.test.tsx +++ b/src/redis-cli-panel/components/redis-cli-panel/redis-cli-panel.test.tsx @@ -1,12 +1,16 @@ import React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; import { Observable } from 'rxjs'; -import { PanelData, LoadingState } from '@grafana/data'; +import { LoadingState, PanelData } from '@grafana/data'; import { Button } from '@grafana/ui'; -import { PanelOptions, Help } from '../types'; +import { Help } from '../../constants'; +import { PanelOptions } from '../../types'; import { RedisCLIPanel } from './redis-cli-panel'; -import AutoScrollingTextarea from './auto-scrolling-text-area'; +import { CLITextArea } from '../auto-scrolling-text-area'; +/** + * Override + */ interface OverrideOptions { height?: number; query?: string; @@ -29,6 +33,11 @@ const getOptions = ({ help = {}, ...overrideOptions }: OverrideOptions = {}): Pa type ShallowComponent = ShallowWrapper; +/** + * Query result + * + * @param values + */ const getDataSourceQueryResult = (values: string[]) => ({ data: [ { @@ -46,8 +55,8 @@ const getDataSourceQueryResult = (values: string[]) => ({ ], }); -/* - DataSource +/** + * DataSource */ const dataSourceMock = { query: jest.fn().mockImplementation( @@ -68,8 +77,8 @@ jest.mock('@grafana/runtime', () => ({ }), })); -/* - RedisCLIPanel +/** + * Redis CLI Panel */ describe('RedisCLIPanel', () => { const width = 300; @@ -90,8 +99,8 @@ describe('RedisCLIPanel', () => { dataSourceSrvGetMock.mockClear(); }); - /* - Rendering elements + /** + * Rendering elements */ describe('Rendering elements', () => { it('Should show AutoScrollingTextarea', () => { @@ -106,13 +115,13 @@ describe('RedisCLIPanel', () => { options={options} /> ); - const testedComponent = wrapper.find(AutoScrollingTextarea); + const testedComponent = wrapper.find(CLITextArea); expect(testedComponent.exists()).toBeTruthy(); expect(testedComponent.prop('value')).toEqual(options.output); }); - /* - Help + /** + * Help */ describe('Help', () => { const getHelpComponent = (wrapper: ShallowComponent) => { @@ -275,8 +284,8 @@ describe('RedisCLIPanel', () => { }); }); - /* - Query + /** + * Query */ describe('Query', () => { const getTestedComponent = (wrapper: ShallowComponent) => { diff --git a/src/redis-cli-panel/components/redis-cli-panel.tsx b/src/redis-cli-panel/components/redis-cli-panel/redis-cli-panel.tsx similarity index 94% rename from src/redis-cli-panel/components/redis-cli-panel.tsx rename to src/redis-cli-panel/components/redis-cli-panel/redis-cli-panel.tsx index 960f8af..815c5de 100644 --- a/src/redis-cli-panel/components/redis-cli-panel.tsx +++ b/src/redis-cli-panel/components/redis-cli-panel/redis-cli-panel.tsx @@ -5,9 +5,10 @@ import { map as map$, switchMap as switchMap$ } from 'rxjs/operators'; import { DataFrame, DataQueryRequest, DataQueryResponse, PanelProps } from '@grafana/data'; import { getDataSourceSrv } from '@grafana/runtime'; import { Button, LegacyForms } from '@grafana/ui'; -import { Styles } from '../styles'; -import { Help, HelpCommand, PanelOptions, RedisQuery } from '../types'; -import AutoScrollingTextarea from './auto-scrolling-text-area'; +import { Help } from '../../constants'; +import { Styles } from '../../styles'; +import { HelpCommand, PanelOptions, RedisQuery } from '../../types'; +import { CLITextArea } from '../auto-scrolling-text-area'; /** * Legacy Forms @@ -143,7 +144,7 @@ export const RedisCLIPanel: React.FC> = ({ )} >
- +
{query && help && ( diff --git a/src/redis-cli-panel/constants.ts b/src/redis-cli-panel/constants.ts new file mode 100644 index 0000000..5edd925 --- /dev/null +++ b/src/redis-cli-panel/constants.ts @@ -0,0 +1,25 @@ +import { + RedisAIHelp, + RedisBloomHelp, + RedisGearsHelp, + RedisGraphHelp, + RedisHelp, + RedisJSONHelp, + RedisSearchHelp, + RedisTimeSeriesHelp, +} from './help'; +import { HelpCommand } from './types'; + +/** + * Help for native redis commands and modules + */ +export const Help: { [key: string]: HelpCommand } = { + ...RedisHelp, + ...RedisAIHelp, + ...RedisBloomHelp, + ...RedisGearsHelp, + ...RedisGraphHelp, + ...RedisJSONHelp, + ...RedisSearchHelp, + ...RedisTimeSeriesHelp, +}; diff --git a/src/redis-cli-panel/help/redis-ai.ts b/src/redis-cli-panel/help/redis-ai.ts index 43546fc..9756b7b 100644 --- a/src/redis-cli-panel/help/redis-ai.ts +++ b/src/redis-cli-panel/help/redis-ai.ts @@ -1,7 +1,8 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RedisAI + * * @see https://oss.redislabs.com/redisai/ */ export const RedisAIHelp: { [key: string]: HelpCommand } = { diff --git a/src/redis-cli-panel/help/redis-bloom.ts b/src/redis-cli-panel/help/redis-bloom.ts index 496fbb6..42a1718 100644 --- a/src/redis-cli-panel/help/redis-bloom.ts +++ b/src/redis-cli-panel/help/redis-bloom.ts @@ -1,7 +1,8 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RedisBloom + * * @see https://oss.redislabs.com/redisbloom/ */ export const RedisBloomHelp: { [key: string]: HelpCommand } = { diff --git a/src/redis-cli-panel/help/redis-gears.ts b/src/redis-cli-panel/help/redis-gears.ts index e4af159..a79a1b7 100644 --- a/src/redis-cli-panel/help/redis-gears.ts +++ b/src/redis-cli-panel/help/redis-gears.ts @@ -1,7 +1,8 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RedisGears + * * @see https://oss.redislabs.com/redisgears */ export const RedisGearsHelp: { [key: string]: HelpCommand } = { diff --git a/src/redis-cli-panel/help/redis-graph.ts b/src/redis-cli-panel/help/redis-graph.ts index 189ce45..bf1b7ba 100644 --- a/src/redis-cli-panel/help/redis-graph.ts +++ b/src/redis-cli-panel/help/redis-graph.ts @@ -1,12 +1,13 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RedisGraph + * * @see https://oss.redislabs.com/redisgraph/ */ export const RedisGraphHelp: { [key: string]: HelpCommand } = { GRAPH: { - syntax: 'GRAPH.QUERY, GRAPH.PROFILE, GRAPH.DELETE, GRAPH.EXPLAIN, GRAPH SLOWLOG', + syntax: 'GRAPH.QUERY, GRAPH.PROFILE, GRAPH.DELETE, GRAPH.EXPLAIN, GRAPH.SLOWLOG, GRAPH.CONFIG', summary: 'RedisGraph is the first queryable Property Graph database to use sparse matrices to represent the \ adjacency matrix in graphs and linear algebra to query the graph.', @@ -14,12 +15,12 @@ export const RedisGraphHelp: { [key: string]: HelpCommand } = { }, 'GRAPH QUERY': { syntax: 'GRAPH.QUERY {query}', - summary: 'Execute the given query against a specified graph.', + summary: 'Executes the given query against a specified graph.', url: 'https://oss.redislabs.com/redisgraph/commands/#graphquery', }, 'GRAPH PROFILE': { - syntax: 'GRAPH.QUERY {query}', - summary: "Execute a query and produces an execution plan augmented with metrics for each operation's execution.", + syntax: 'GRAPH.PROFILE {query}', + summary: "Executes a query and produces an execution plan augmented with metrics for each operation's execution.", url: 'https://oss.redislabs.com/redisgraph/commands/#graphprofile', }, 'GRAPH DELETE': { @@ -30,13 +31,18 @@ export const RedisGraphHelp: { [key: string]: HelpCommand } = { 'GRAPH EXPLAIN': { syntax: 'GRAPH.EXPLAIN {query}', summary: - 'Construct a query execution plan but does not run it. Inspect this execution plan to better \ + 'Constructs a query execution plan but does not run it. Inspect this execution plan to better \ understand how your query will get executed.', url: 'https://oss.redislabs.com/redisgraph/commands/#graphexplain', }, 'GRAPH SLOWLOG': { - syntax: 'GRAPH.SLOWLOG', - summary: 'Return a list containing up to 10 of the slowest queries issued against the given graph ID.', + syntax: 'GRAPH.SLOWLOG ', + summary: 'Returns a list containing up to 10 of the slowest queries issued against the given graph ID.', url: 'https://oss.redislabs.com/redisgraph/commands/#graphslowlog', }, + 'GRAPH CONFIG': { + syntax: 'GRAPH.CONFIG GET/SET [value] value', + summary: 'Retrieves or updates a RedisGraph configuration.', + url: 'https://oss.redislabs.com/redisgraph/commands/#graphconfig', + }, }; diff --git a/src/redis-cli-panel/help/redis-json.ts b/src/redis-cli-panel/help/redis-json.ts index 87af112..fa9a9bd 100644 --- a/src/redis-cli-panel/help/redis-json.ts +++ b/src/redis-cli-panel/help/redis-json.ts @@ -1,7 +1,8 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RedisJSON + * * @see https://oss.redislabs.com/redisjson/ */ export const RedisJSONHelp: { [key: string]: HelpCommand } = { diff --git a/src/redis-cli-panel/help/redis-search.ts b/src/redis-cli-panel/help/redis-search.ts index 6cb2112..fda7d4c 100644 --- a/src/redis-cli-panel/help/redis-search.ts +++ b/src/redis-cli-panel/help/redis-search.ts @@ -1,7 +1,8 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RediSearch + * * @see https://oss.redislabs.com/redisearch/ */ export const RedisSearchHelp: { [key: string]: HelpCommand } = { diff --git a/src/redis-cli-panel/help/redis-time-series.ts b/src/redis-cli-panel/help/redis-time-series.ts index 890b330..07561c8 100644 --- a/src/redis-cli-panel/help/redis-time-series.ts +++ b/src/redis-cli-panel/help/redis-time-series.ts @@ -1,7 +1,8 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * RedisTimeSeries + * * @see https://oss.redislabs.com/redistimeseries/ */ export const RedisTimeSeriesHelp: { [key: string]: HelpCommand } = { diff --git a/src/redis-cli-panel/help/redis.ts b/src/redis-cli-panel/help/redis.ts index 19f12c7..4176732 100644 --- a/src/redis-cli-panel/help/redis.ts +++ b/src/redis-cli-panel/help/redis.ts @@ -1,8 +1,10 @@ -import { HelpCommand } from 'redis-cli-panel/types'; +import { HelpCommand } from '../types'; /** * Native Redis commands + * * @see https://redis.io/commands + * @see https://github.com/redis/redis-doc/blob/master/commands.json */ export const RedisHelp: { [key: string]: HelpCommand } = { /** @@ -205,10 +207,12 @@ export const RedisHelp: { [key: string]: HelpCommand } = { /** * Client - * @see + * + * @see https://redis.io/topics/client-side-caching */ CLIENT: { - syntax: 'CLIENT CACHING | ID | KILL | LIST | GETNAME | GETREDIR | PAUSE | REPLY | SETNAME | TRACKING | UNBLOCK', + syntax: + 'CLIENT CACHING | ID | INFO | KILL | LIST | GETNAME | GETREDIR | UNPAUSE | PAUSE | REPLY | SETNAME | TRACKING | TRACKINGINFO | UNBLOCK', summary: 'Client connections.', url: 'https://redis.io/commands', }, @@ -226,6 +230,13 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '5.0.0', url: 'https://redis.io/commands/client-id', }, + 'CLIENT INFO': { + syntax: 'CLIENT INFO', + summary: 'Returns information about the current client connection.', + complexity: 'O(1)', + since: '6.2.0', + url: 'https://redis.io/commands/client-info', + }, 'CLIENT KILL': { syntax: 'CLIENT KILL [ip:port] [ID client-id] [TYPE normal|master|slave|pubsub] [USER username] [ADDR ip:port] [SKIPME yes/no]', @@ -255,6 +266,13 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '6.0.0', url: 'https://redis.io/commands/client-getredir', }, + 'CLIENT UNPAUSE': { + syntax: 'CLIENT UNPAUSE', + summary: 'Resume processing of clients that were paused.', + complexity: 'O(1)', + since: '6.2.0', + url: 'https://redis.io/commands/client-unpause', + }, 'CLIENT PAUSE': { syntax: 'CLIENT PAUSE timeout', summary: 'Stop processing commands from clients for some time.', @@ -284,6 +302,13 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '6.0.0', url: 'https://redis.io/commands/client-tracking', }, + 'CLIENT TRACKINGINFO': { + syntax: 'CLIENT TRACKINGINFO', + summary: 'Return information about server assisted client side caching for the current connection.', + complexity: 'O(1)', + since: '6.2.0', + url: 'https://redis.io/commands/client-trackinginfo', + }, 'CLIENT UNBLOCK': { syntax: 'CLIENT UNBLOCK client-id [TIMEOUT|ERROR]', summary: 'Unblock a client blocked in a blocking command from a different connection.', @@ -294,6 +319,7 @@ export const RedisHelp: { [key: string]: HelpCommand } = { /** * Cluster + * * @see https://redis.io/topics/cluster-spec */ CLUSTER: { @@ -527,6 +553,13 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.0.0', url: 'https://redis.io/commands/config-resetstat', }, + COPY: { + syntax: 'COPY source destination [DB destination-db] [REPLACE]', + summary: 'Copy a key.', + complexity: 'O(N) worst case for collections, where N is the number of nested items. O(1) for string values.', + since: '6.2.0', + url: 'https://redis.io/commands/copy', + }, DBSIZE: { syntax: 'DBSIZE', summary: 'Return the number of keys in the selected database.', @@ -704,6 +737,27 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '3.2.0', url: 'https://redis.io/commands/georadiusbymember', }, + GEOSEARCH: { + syntax: + 'GEOSEARCH key [FROMMEMBER member] [FROMLONLAT longitude latitude] [BYRADIUS radius m|km|ft|mi] \ + [BYBOX width height m|km|ft|mi] [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]', + summary: 'Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle.', + complexity: + 'O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape.', + since: '6.2.0', + url: 'https://redis.io/commands/geosearch', + }, + GEOSEARCHSTORE: { + syntax: + 'GEOSEARCHSTORE destination source [FROMMEMBER member] [FROMLONLAT longitude latitude] [BYRADIUS radius m|km|ft|mi] \ + [BYBOX width height m|km|ft|mi] [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH] [STOREDIST]', + summary: + 'Query a sorted set representing a geospatial index to fetch members inside an area of a box or a circle, and store the result in another key.', + complexity: + 'O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape.', + since: '6.2.0', + url: 'https://redis.io/commands/geosearchstore', + }, GET: { syntax: 'GET key', summary: 'Get the value of a key.', @@ -718,6 +772,20 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.2.0', url: 'https://redis.io/commands/getbit', }, + GETDEL: { + syntax: 'GETDEL key', + summary: 'Get the value of a key and delete the key.', + complexity: 'O(1)', + since: '6.2.0', + url: 'https://redis.io/commands/getdel', + }, + GETEX: { + syntax: 'GETEX key [EX seconds|PX milliseconds|EXAT timestamp|PXAT milliseconds-timestamp|PERSIST]', + summary: 'Get the value of a key and optionally set its expiration.', + complexity: 'O(1)', + since: '6.2.0', + url: 'https://redis.io/commands/getex', + }, GETRANGE: { syntax: 'GETRANGE key start end', summary: 'Get a substring of the string stored at a key.', @@ -828,6 +896,13 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.0.0', url: 'https://redis.io/commands/hsetnx', }, + HRANDFIELD: { + syntax: 'HRANDFIELD key [count [WITHVALUES]]', + summary: 'Get one or multiple random fields from a hash.', + complexity: 'O(N) where N is the number of fields returned.', + since: '6.2.0', + url: 'https://redis.io/commands/hrandfield', + }, HSTRLEN: { syntax: 'HSTRLEN key field', summary: 'Get the length of the value of a hash field.', @@ -1259,6 +1334,12 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '1.0.0', url: 'https://redis.io/commands/renamenx', }, + RESET: { + syntax: 'RESET', + summary: 'Reset the connection.', + since: '6.2.0', + url: 'https://redis.io/commands/reset', + }, RESTORE: { syntax: 'RESTORE key ttl serialized-value [REPLACE] [ABSTTL] [IDLETIME seconds] [FREQ frequency]', summary: 'Create a key using the provided serialized value, previously obtained using DUMP.', @@ -1338,6 +1419,7 @@ export const RedisHelp: { [key: string]: HelpCommand } = { /** * Script + * * @see https://redis.io/commands/eval */ SCRIPT: { @@ -1658,6 +1740,10 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.2.0', url: 'https://redis.io/commands/watch', }, + + /** + * Sorted Set + */ ZADD: { syntax: 'ZADD key [NX|XX] [GT|LT] [CH] [INCR] score member [score member ...]', summary: 'Add one or more members to a sorted set, or update its score if it already exists.', @@ -1679,6 +1765,23 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.0.0', url: 'https://redis.io/commands/zcount', }, + ZDIFF: { + syntax: 'ZDIFF numkeys key [key ...] [WITHSCORES]', + summary: 'Subtract multiple sorted sets.', + complexity: + 'O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.', + since: '6.2.0', + url: 'https://redis.io/commands/zdiff', + }, + ZDIFFSTORE: { + syntax: 'ZDIFFSTORE destination numkeys key [key ...]', + summary: + 'O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.', + complexity: + 'O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set.', + since: '6.2.0', + url: 'https://redis.io/commands/zdiffstore', + }, ZINCRBY: { syntax: 'ZINCRBY key increment member', summary: 'Increment the score of a member in a sorted set.', @@ -1727,6 +1830,21 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '5.0.0', url: 'https://redis.io/commands/zpopmin', }, + ZRANDMEMBER: { + syntax: 'ZRANDMEMBER key [count [WITHSCORES]]', + summary: 'Get one or multiple random elements from a sorted set.', + complexity: 'O(N) where N is the number of elements returned.', + since: '6.2.0', + url: 'https://redis.io/commands/zrandmember', + }, + ZRANGESTORE: { + syntax: 'ZRANGESTORE dst src min max [BYSCORE|BYLEX] [REV] [LIMIT offset count]', + summary: 'Store a range of members from sorted set into another key.', + complexity: + 'O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements stored into the destination key.', + since: '6.2.0', + url: 'https://redis.io/commands/zrangestore', + }, ZRANGE: { syntax: 'ZRANGE key start stop [WITHSCORES]', summary: 'Return a range of members in a sorted set, by index.', @@ -1858,6 +1976,10 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.0.0', url: 'https://redis.io/commands/zunionstore', }, + + /** + * Scan commands + */ SCAN: { syntax: 'SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]', summary: 'Incrementally iterate the keys space.', @@ -1894,6 +2016,12 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '2.8.0', url: 'https://redis.io/commands/zscan', }, + + /** + * Streams + * + * @see https://redis.io/topics/streams-intro + */ XINFO: { syntax: 'XINFO [CONSUMERS key groupname] [GROUPS key] [STREAM key] [HELP]', summary: 'Get information on streams and consumer groups.', @@ -2010,6 +2138,14 @@ export const RedisHelp: { [key: string]: HelpCommand } = { since: '5.0.0', url: 'https://redis.io/commands/xclaim', }, + XAUTOCLAIM: { + syntax: 'XAUTOCLAIM key group consumer min-idle-time start [COUNT count] [JUSTID]', + summary: + 'Changes (or acquires) ownership of messages in a consumer group, as if the messages were delivered to the specified consumer.', + complexity: 'O(1) if COUNT is small.', + since: '6.2.0', + url: 'https://redis.io/commands/xautoclaim', + }, XPENDING: { syntax: 'XPENDING key group [start end count] [consumer]', summary: @@ -2024,6 +2160,7 @@ export const RedisHelp: { [key: string]: HelpCommand } = { /** * Latency + * * @see https://redis.io/topics/latency-monitor */ LATENCY: { diff --git a/src/redis-cli-panel/types.ts b/src/redis-cli-panel/types.ts index dfb1d98..6b30d48 100644 --- a/src/redis-cli-panel/types.ts +++ b/src/redis-cli-panel/types.ts @@ -1,14 +1,4 @@ import { DataQuery } from '@grafana/data'; -import { - RedisAIHelp, - RedisBloomHelp, - RedisGearsHelp, - RedisGraphHelp, - RedisHelp, - RedisJSONHelp, - RedisSearchHelp, - RedisTimeSeriesHelp, -} from './help'; /** * Panel Options @@ -115,17 +105,3 @@ export interface HelpCommand { */ url?: string; } - -/** - * Help for native redis commands and modules - */ -export const Help: { [key: string]: HelpCommand } = { - ...RedisHelp, - ...RedisAIHelp, - ...RedisBloomHelp, - ...RedisGearsHelp, - ...RedisGraphHelp, - ...RedisJSONHelp, - ...RedisSearchHelp, - ...RedisTimeSeriesHelp, -};