Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9045d09
Add draft implementation of FT.EXPLAIN/FT.EXPLAINCLI vizualization.
GnaneshKunal Dec 28, 2022
2878b55
Add support for ft.profile (plain version) and scrollbar functionality
GnaneshKunal Dec 29, 2022
3c92f20
Add support for ft.profile (non-clustered version) visualization
GnaneshKunal Dec 30, 2022
57604ef
Remove semicolons
GnaneshKunal Dec 30, 2022
843df8a
Center profile info
GnaneshKunal Dec 30, 2022
96f48c9
Merge branch 'main' into ri-explain-plugin
egor-zalenski Jan 5, 2023
26f7264
#RI-3726 - Prepare for vizualizations for Graph and FT profile and ex…
egor-zalenski Jan 5, 2023
9e47c5c
#RI-3726 - Prepare for vizualizations for Graph and FT profile and ex…
egor-zalenski Jan 5, 2023
3ea6c44
Merge pull request #1560 from RedisInsight/main
egor-zalenski Jan 5, 2023
4cf3ede
Merge remote-tracking branch 'origin/ri-explain-plugin' into build/ri…
egor-zalenski Jan 5, 2023
154ac45
Merge pull request #1561 from RedisInsight/build/ri-explain-plugin
egor-zalenski Jan 6, 2023
405ac84
Add support for redisearch cluster profile.
GnaneshKunal Jan 7, 2023
398e6e8
Add support for GRAPH.EXPLAIN and GRAPH.PROFILE
GnaneshKunal Jan 8, 2023
e135c33
Dump regex for simple parsing of size and time
GnaneshKunal Jan 8, 2023
9d7d921
Remove semicolons and fix ternary operator lint
GnaneshKunal Jan 9, 2023
fd4e151
Add support for hovering for search queries
GnaneshKunal Jan 11, 2023
7085375
Add proper recursive redisgraph PROFILE/EXPLAIN level parser
GnaneshKunal Jan 14, 2023
7569daf
- Suffix time with 'ms'
GnaneshKunal Jan 14, 2023
5b2b181
- Edge width should depend on record size.
GnaneshKunal Jan 14, 2023
7c38d91
Highlight ancestors on child node hover
GnaneshKunal Jan 15, 2023
4732c09
Calculate total execution time for redisgraph profile
GnaneshKunal Jan 15, 2023
d8b3889
Parse tags and display them in snippet region if available
GnaneshKunal Jan 17, 2023
5d54e87
- Calculate edge size using log.
GnaneshKunal Jan 21, 2023
fae5e99
Merge branch 'main' into ri-explain-plugin
GnaneshKunal Jan 21, 2023
3e20c4f
Add ability to run a profile/explain right from the query card tab of
GnaneshKunal Jan 22, 2023
fc31b41
Fix comments - https://github.com/RedisInsight/RedisInsight/pull/1537…
GnaneshKunal Jan 23, 2023
f770a43
- Move queryProfile to parent and create a new telement event on the …
GnaneshKunal Jan 23, 2023
9d2e65c
- Add null checks for generate profile command functions
GnaneshKunal Jan 23, 2023
3904a0e
Merge remote-tracking branch 'origin/main' into ri-explain-plugin
GnaneshKunal Jan 24, 2023
c05bdde
Switch back to compactBox layout
GnaneshKunal Jan 25, 2023
eb75d62
Wrap info data for large texts
GnaneshKunal Jan 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions redisinsight/ui/src/assets/img/workbench/vis_tag_cloud.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion redisinsight/ui/src/components/query-card/QueryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cx from 'classnames'
import { EuiLoadingContent, keys } from '@elastic/eui'
import { useParams } from 'react-router-dom'

import { WBQueryType } from 'uiSrc/pages/workbench/constants'
import { WBQueryType, ProfileQueryType } from 'uiSrc/pages/workbench/constants'
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
import {
getWBQueryType,
Expand Down Expand Up @@ -44,6 +44,7 @@ export interface Props {
onQueryDelete: () => void
onQueryReRun: () => void
onQueryOpen: () => void
onQueryProfile: (type: ProfileQueryType) => void
}

const getDefaultPlugin = (views: IPluginVisualization[], query: string) =>
Expand Down Expand Up @@ -75,6 +76,7 @@ const QueryCard = (props: Props) => {
createdAt,
onQueryOpen,
onQueryDelete,
onQueryProfile,
onQueryReRun,
loading,
emptyCommand,
Expand Down Expand Up @@ -186,6 +188,7 @@ const QueryCard = (props: Props) => {
setSelectedValue={changeViewTypeSelected}
onQueryDelete={onQueryDelete}
onQueryReRun={onQueryReRun}
onQueryProfile={onQueryProfile}
/>
{isOpen && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { numberWithSpaces } from 'uiSrc/utils/numbers'
import { ThemeContext } from 'uiSrc/contexts/themeContext'
import { appPluginsSelector } from 'uiSrc/slices/app/plugins'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { getViewTypeOptions, WBQueryType } from 'uiSrc/pages/workbench/constants'
import { getViewTypeOptions, WBQueryType, getProfileViewTypeOptions, ProfileQueryType, isCommandAllowedForProfile } from 'uiSrc/pages/workbench/constants'
import { IPluginVisualization } from 'uiSrc/slices/interfaces'
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
Expand Down Expand Up @@ -70,6 +70,7 @@ export interface Props {
setSelectedValue: (type: WBQueryType, value: string) => void
onQueryDelete: () => void
onQueryReRun: () => void
onQueryProfile: (type: ProfileQueryType) => void
}

const getExecutionTimeString = (value: number): string => {
Expand Down Expand Up @@ -109,6 +110,7 @@ const QueryCardHeader = (props: Props) => {
setSelectedValue,
onQueryDelete,
onQueryReRun,
onQueryProfile,
db,
} = props

Expand Down Expand Up @@ -237,6 +239,30 @@ const QueryCardHeader = (props: Props) => {
}
})

const profileOptions: EuiSuperSelectOption<any>[] = (getProfileViewTypeOptions() as any[]).map((item) => {
const { value, id, text } = item
return {
value: id ?? value,
inputDisplay: (
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
<EuiIcon
className={styles.iconDropdownOption}
type="visTagCloud"
data-testid={`view-type-selected-${value}-${id}`}
/>
</div>
),
dropdownDisplay: (
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
<span>{truncateText(text, 20)}</span>
</div>
),
'data-test-subj': `profile-type-option-${value}-${id}`,
}
})

const canCommandProfile = isCommandAllowedForProfile(query)

const indexForSeparator = findIndex(pluginsOptions, (option) => !option.internal)
if (indexForSeparator > -1) {
modifiedOptions.splice(indexForSeparator + 1, 0, {
Expand Down Expand Up @@ -320,6 +346,26 @@ const QueryCardHeader = (props: Props) => {
</EuiToolTip>
)}
</EuiFlexItem>
<EuiFlexItem
grow={false}
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
onClick={onDropDownViewClick}
>
{isOpen && canCommandProfile && !summaryText && (
<div className={styles.dropdownWrapper}>
<div className={styles.dropdown}>
<EuiSuperSelect
options={profileOptions}
itemClassName={cx(styles.changeViewItem, styles.dropdownProfileItem)}
className={cx(styles.changeView, styles.dropdownProfileIcon)}
valueOfSelected={ProfileQueryType.Profile}
onChange={(value: ProfileQueryType) => onQueryProfile(value)}
data-testid="run-profile-type"
/>
</div>
</div>
)}
</EuiFlexItem>
<EuiFlexItem
grow={false}
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,27 @@ $marginIcon: 12px;
height: 40px;
}

.dropdownProfileIcon {
padding: inherit !important;
:global {
.euiSuperSelectControl.euiFormControlLayoutIcons {
display: none !important;
}
}
}

.dropdownProfileOption {
display: inherit !important;
}

.dropdownProfileItem {
:global {
.euiContextMenu__icon {
display: none !important;
}
}
}

.dropdown {
width: 168px;
position: absolute;
Expand Down
1 change: 1 addition & 0 deletions redisinsight/ui/src/packages/ri-explain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# RI-Explain plugin
71 changes: 71 additions & 0 deletions redisinsight/ui/src/packages/ri-explain/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"author": {
"name": "Redis Ltd.",
"email": "support@redis.com",
"url": "https://redis.com/redis-enterprise/redis-insight"
},
"bugs": {
"url": "https://github.com/"
},
"description": "Show Profile/Explain Visualization",
"source": "./src/main.tsx",
"styles": "./dist/styles.css",
"main": "./dist/index.js",
"name": "explain-plugin",
"version": "0.0.1",
"scripts": {
"start": "cross-env NODE_ENV=development parcel serve src/index.html",
"build": "rimraf dist && cross-env NODE_ENV=production concurrently \"yarn build:js && yarn minify:js\" \"yarn build:css\" \"yarn build:assets\"",
"build-lite": "rm dist/*.js && cross-env NODE_ENV=production concurrently \"yarn build:js && yarn minify:js\"",
"build:js": "parcel build src/main.tsx --dist-dir dist",
"build:css": "parcel build src/styles/styles.less --dist-dir dist",
"build:assets": "parcel build src/assets/**/* --dist-dir dist",
"minify:js": "terser -- dist/main.js > dist/index.js && rimraf dist/main.js"
},
"targets": {
"main": false,
"module": {
"includeNodeModules": true
}
},
"visualizations": [
{
"id": "profile-explain-viz",
"name": "Visualization",
"activationMethod": "renderCore",
"matchCommands": [
"FT.EXPLAIN",
"FT.EXPLAINCLI",
"FT.PROFILE",
"GRAPH.EXPLAIN",
"GRAPH.PROFILE"
],
"iconDark": "./dist/profile_icon_dark.svg",
"iconLight": "./dist/profile_icon_light.svg",
"description": "Profile/Explain plugin Visualization",
"default": true
}
],
"devDependencies": {
"@parcel/compressor-brotli": "^2.0.0",
"@parcel/compressor-gzip": "^2.0.0",
"@parcel/transformer-less": "^2.3.2",
"concurrently": "^6.3.0",
"cross-env": "^7.0.3",
"parcel": "^2.0.0",
"rimraf": "^3.0.2",
"terser": "^5.9.0"
},
"dependencies": {
"@antv/hierarchy": "^0.6.8",
"@antv/x6": "^2.1.3",
"@antv/x6-react-shape": "^2.1.0",
"@elastic/eui": "34.6.0",
"@emotion/react": "^11.7.1",
"classnames": "^2.3.1",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"uuid": "^9.0.0"
}
}
27 changes: 27 additions & 0 deletions redisinsight/ui/src/packages/ri-explain/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import Explain from './Explain'

const isDarkTheme = document.body.classList.contains('theme_DARK')

export function App(props: { command?: string, data: any }) {

const ErrorResponse = HandleError(props)

if (ErrorResponse !== null) return ErrorResponse

return (
<div id="mainApp" style={{ height: "100%", width: '100%', overflowX: 'auto' }}>
<Explain command={props.command || ''} data={props.data}/>
</div>
)
}

function HandleError(props: { command?: string, data: any }): JSX.Element | null {
const { data: [{ response = '', status = '' } = {}] = [] } = props

if (status === 'fail') {
return <div className="responseFail">{JSON.stringify(response)}</div>
}

return null
}
Loading