Skip to content

Commit f9380d4

Browse files
committed
Merge remote-tracking branch 'origin/main' into update_electron_version
2 parents 3c9458f + 885d310 commit f9380d4

File tree

30 files changed

+309
-100
lines changed

30 files changed

+309
-100
lines changed

electron-builder.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,14 @@
6363
"extraResources": [
6464
"./resources/**",
6565
{
66-
"from": "./redisinsight/api/src/static",
66+
"from": "./redisinsight/api/static",
6767
"to": "static",
6868
"filter": ["**/*"]
69+
},
70+
{
71+
"from": "./redisinsight/api/defaults",
72+
"to": "defaults",
73+
"filter": ["**/*"]
6974
}
7075
]
7176
}

redisinsight/ui/src/components/consents-settings/ConsentsSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const ConsentsSettings = ({ liveEditMode = false }: Props) => {
171171
{!liveEditMode && (
172172
<>
173173
<EuiCallOut>
174-
<EuiText size="s">
174+
<EuiText size="s" data-testid="plugin-section">
175175
While adding new visualization plugins, use files only from trusted authors
176176
to avoid automatic execution of malicious code.
177177
</EuiText>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const QueryCardCliPlugin = (props: Props) => {
147147
ref={pluginIframeRef}
148148
referrerPolicy="no-referrer"
149149
sandbox="allow-same-origin allow-scripts"
150+
data-testid="pluginIframe"
150151
/>
151152
{!!error && (
152153
<div className={styles.container}>

redisinsight/ui/src/pages/browser/components/key-list/KeyList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
formatLongName,
1717
replaceSpaces,
1818
truncateTTLToDuration,
19-
truncateTTLToRange,
19+
truncateTTLToFirstUnit,
2020
truncateTTLToSeconds,
2121
} from 'uiSrc/utils'
2222
import {
@@ -192,7 +192,7 @@ const KeyList = (props: Props) => {
192192
},
193193
{
194194
id: 'ttl',
195-
label: 'TTL(s)',
195+
label: 'TTL',
196196
absoluteWidth: 65,
197197
minWidth: 65,
198198
truncateText: true,
@@ -221,7 +221,7 @@ const KeyList = (props: Props) => {
221221
</>
222222
)}
223223
>
224-
<>{truncateTTLToRange(cellData)}</>
224+
<>{truncateTTLToFirstUnit(cellData)}</>
225225
</EuiToolTip>
226226
</div>
227227
</EuiText>

redisinsight/ui/src/pages/instance/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.mainComponent {
2-
height: calc(100% - 29px) !important;
2+
height: calc(100% - 26px) !important;
33
}
44

55
.resizableButton {

redisinsight/ui/src/pages/workbench/components/enablament-area/EnablementAreaWrapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const EnablementAreaWrapper = React.memo(({ isMinimized, setIsMinimized, scriptE
6767
className={cx(styles.areaWrapper, { [styles.minimized]: isMinimized })}
6868
onClick={() => isMinimized && setIsMinimized(false)}
6969
direction="column"
70+
responsive={false}
7071
gutterSize="none"
7172
data-testid="enablement-area-container"
7273
>

redisinsight/ui/src/styles/components/_buttons.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
box-shadow: none;
3030
}
3131
}
32+
&.euiButton--fill {
33+
color: var(--euiColorPrimaryText) !important;
34+
&:hover {
35+
color: var(--euiColorPrimaryText) !important;
36+
}
37+
}
3238
}
3339
.euiButton.euiButton--fill {
3440
&.euiButton--secondary {

redisinsight/ui/src/utils/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getBaseApiUrl } from 'uiSrc/utils/common'
44
export const getVisualizationsByCommand = (query: string, visualizations: IPluginVisualization[]) =>
55
visualizations.filter((visualization: IPluginVisualization) =>
66
visualization.matchCommands.some((matchCommand) =>
7-
query.startsWith(matchCommand) || (new RegExp(matchCommand.toLowerCase())).test(query.toLowerCase())))
7+
query.startsWith(matchCommand) || (new RegExp(`^${matchCommand}`, 'i')).test(query)))
88

99
export const urlForAsset = (basePluginUrl: string, path: string) => {
1010
const baseApiUrl = getBaseApiUrl()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { getVisualizationsByCommand } from 'uiSrc/utils'
2+
import { IPluginVisualization } from 'uiSrc/slices/interfaces'
3+
4+
describe('getVisualizationsByCommand', () => {
5+
it('should return proper visualizations by query', () => {
6+
const visualizations = [
7+
{ matchCommands: ['ft.search', 'ft.get'] },
8+
{ matchCommands: ['ft._list'] },
9+
{ matchCommands: ['ft.*'] },
10+
{ matchCommands: ['get'] }
11+
] as IPluginVisualization[]
12+
13+
const query1 = 'ft.search sa'
14+
const query2 = 'ft.get zxc'
15+
const query3 = 'command ft. zxc zxcz ft'
16+
const query4 = 'command ft'
17+
const query5 = 'any command'
18+
const query6 = 'get key'
19+
20+
expect(getVisualizationsByCommand(query1, visualizations)).toHaveLength(2)
21+
expect(getVisualizationsByCommand(query2, visualizations)).toHaveLength(2)
22+
expect(getVisualizationsByCommand(query3, visualizations)).toHaveLength(0)
23+
expect(getVisualizationsByCommand(query4, visualizations)).toHaveLength(0)
24+
expect(getVisualizationsByCommand(query5, visualizations)).toHaveLength(0)
25+
expect(getVisualizationsByCommand(query6, visualizations)).toHaveLength(1)
26+
})
27+
})

redisinsight/ui/src/utils/tests/truncateTTL.spec.ts

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
truncateTTLToDuration,
3+
truncateTTLToFirstUnit,
34
truncateTTLToRange,
45
truncateTTLToSeconds,
56
} from '../truncateTTL'
@@ -101,16 +102,15 @@ describe('Truncate TTL util tests', () => {
101102
const expectedResponse2 = '25 min, 34 s'
102103
const expectedResponse3 = '15 h, 5 min, 34 s'
103104
const expectedResponse4 = '1 mo, 19 d, 1 h, 33 min, 54 s'
104-
// TODO started failing
105-
// const expectedResponse5 = '3 yr, 6 mo, 19 d, 10 h, 32 min, 10 s';
106-
// const expectedResponse6 = '67 yr, 2 mo, 6 d, 12 h, 38 min, 20 s';
105+
const expectedResponse5 = '3 yr, 6 mo, 19 d, 10 h, 32 min, 10 s'
106+
const expectedResponse6 = '67 yr, 2 mo, 6 d, 12 h, 38 min, 20 s'
107107

108108
expect(truncateTTLToDuration(ttl1)).toEqual(expectedResponse1)
109109
expect(truncateTTLToDuration(ttl2)).toEqual(expectedResponse2)
110110
expect(truncateTTLToDuration(ttl3)).toEqual(expectedResponse3)
111111
expect(truncateTTLToDuration(ttl4)).toEqual(expectedResponse4)
112-
// expect(truncateTTLToDuration(ttl5)).toEqual(expectedResponse5);
113-
// expect(truncateTTLToDuration(ttl6)).toEqual(expectedResponse6);
112+
expect(truncateTTLToDuration(ttl5)).toEqual(expectedResponse5)
113+
expect(truncateTTLToDuration(ttl6)).toEqual(expectedResponse6)
114114
})
115115
})
116116

@@ -132,4 +132,29 @@ describe('Truncate TTL util tests', () => {
132132
expect(truncateTTLToSeconds(ttl4)).toEqual(expectedResponse4)
133133
})
134134
})
135+
136+
describe('truncateTTLToFirstUnit', () => {
137+
it('truncateTTLToFirstUnit should return appropriate value', () => {
138+
const ttl1 = 100
139+
const ttl2 = 1_534
140+
const ttl3 = 54_334
141+
const ttl4 = 4_325_634
142+
const ttl5 = 112_012_330
143+
const ttl6 = 2_120_042_300
144+
145+
const expectedResponse1 = '1 min' // '1 min, 40 s'
146+
const expectedResponse2 = '25 min' // '25 min, 34 s'
147+
const expectedResponse3 = '15 h' // '15 h, 5 min, 34 s'
148+
const expectedResponse4 = '1 mo' // '1 mo, 19 d, 1 h, 33 min, 54 s'
149+
const expectedResponse5 = '3 yr' // '3 yr, 6 mo, 19 d, 10 h, 32 min, 10 s'
150+
const expectedResponse6 = '67 yr' // '67 yr, 2 mo, 6 d, 12 h, 38 min, 20 s'
151+
152+
expect(truncateTTLToFirstUnit(ttl1)).toEqual(expectedResponse1)
153+
expect(truncateTTLToFirstUnit(ttl2)).toEqual(expectedResponse2)
154+
expect(truncateTTLToFirstUnit(ttl3)).toEqual(expectedResponse3)
155+
expect(truncateTTLToFirstUnit(ttl4)).toEqual(expectedResponse4)
156+
expect(truncateTTLToFirstUnit(ttl5)).toEqual(expectedResponse5)
157+
expect(truncateTTLToFirstUnit(ttl6)).toEqual(expectedResponse6)
158+
})
159+
})
135160
})

0 commit comments

Comments
 (0)