Skip to content

Commit 559b589

Browse files
authored
Merge pull request #1629 from RedisInsight/feature/RI-3726_profile_explain
Feature/ri 3726 profile explain
2 parents 6e07f3f + 34e429a commit 559b589

File tree

17 files changed

+4993
-0
lines changed

17 files changed

+4993
-0
lines changed

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const QueryCardHeader = (props: Props) => {
109109
setSelectedValue,
110110
onQueryDelete,
111111
onQueryReRun,
112+
onQueryProfile,
112113
db,
113114
} = props
114115

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# RI-Explain plugin
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"author": {
3+
"name": "Redis Ltd.",
4+
"email": "[email protected]",
5+
"url": "https://redis.com/redis-enterprise/redis-insight"
6+
},
7+
"bugs": {
8+
"url": "https://github.com/"
9+
},
10+
"description": "Show Profile/Explain Visualization",
11+
"source": "./src/main.tsx",
12+
"styles": "./dist/styles.css",
13+
"main": "./dist/index.js",
14+
"name": "explain-plugin",
15+
"version": "0.0.1",
16+
"scripts": {
17+
"start": "cross-env NODE_ENV=development parcel serve src/index.html",
18+
"build": "rimraf dist && cross-env NODE_ENV=production concurrently \"yarn build:js && yarn minify:js\" \"yarn build:css\" \"yarn build:assets\"",
19+
"build-lite": "rm dist/*.js && cross-env NODE_ENV=production concurrently \"yarn build:js && yarn minify:js\"",
20+
"build:js": "parcel build src/main.tsx --dist-dir dist",
21+
"build:css": "parcel build src/styles/styles.less --dist-dir dist",
22+
"build:assets": "parcel build src/assets/**/* --dist-dir dist",
23+
"minify:js": "terser -- dist/main.js > dist/index.js && rimraf dist/main.js"
24+
},
25+
"targets": {
26+
"main": false,
27+
"module": {
28+
"includeNodeModules": true
29+
}
30+
},
31+
"visualizations": [
32+
{
33+
"id": "profile-explain-viz",
34+
"name": "Visualization",
35+
"activationMethod": "renderCore",
36+
"matchCommands": [
37+
"FT.EXPLAIN",
38+
"FT.EXPLAINCLI",
39+
"FT.PROFILE",
40+
"GRAPH.EXPLAIN",
41+
"GRAPH.PROFILE"
42+
],
43+
"iconDark": "./dist/profile_icon_dark.svg",
44+
"iconLight": "./dist/profile_icon_light.svg",
45+
"description": "Profile/Explain plugin Visualization",
46+
"default": true
47+
}
48+
],
49+
"devDependencies": {
50+
"@parcel/compressor-brotli": "^2.0.0",
51+
"@parcel/compressor-gzip": "^2.0.0",
52+
"@parcel/transformer-less": "^2.3.2",
53+
"concurrently": "^6.3.0",
54+
"cross-env": "^7.0.3",
55+
"parcel": "^2.0.0",
56+
"rimraf": "^3.0.2",
57+
"terser": "^5.9.0"
58+
},
59+
"dependencies": {
60+
"@antv/hierarchy": "^0.6.8",
61+
"@antv/x6": "^2.1.3",
62+
"@antv/x6-react-shape": "^2.1.0",
63+
"@elastic/eui": "34.6.0",
64+
"@emotion/react": "^11.7.1",
65+
"classnames": "^2.3.1",
66+
"prop-types": "^15.8.1",
67+
"react": "^18.2.0",
68+
"react-dom": "^18.2.0",
69+
"uuid": "^9.0.0"
70+
}
71+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import Explain from './Explain'
3+
4+
const isDarkTheme = document.body.classList.contains('theme_DARK')
5+
6+
export function App(props: { command?: string, data: any }) {
7+
8+
const ErrorResponse = HandleError(props)
9+
10+
if (ErrorResponse !== null) return ErrorResponse
11+
12+
return (
13+
<div id="mainApp" style={{ height: "100%", width: '100%', overflowX: 'auto' }}>
14+
<Explain command={props.command || ''} data={props.data}/>
15+
</div>
16+
)
17+
}
18+
19+
function HandleError(props: { command?: string, data: any }): JSX.Element | null {
20+
const { data: [{ response = '', status = '' } = {}] = [] } = props
21+
22+
if (status === 'fail') {
23+
return <div className="responseFail">{JSON.stringify(response)}</div>
24+
}
25+
26+
return null
27+
}

0 commit comments

Comments
 (0)