Skip to content

Commit 0293adf

Browse files
Merge pull request #2537 from RedisInsight/release/2.32.0
Release/2.32.0
2 parents e40366f + 8d98c9d commit 0293adf

File tree

22 files changed

+344
-92
lines changed

22 files changed

+344
-92
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@
225225
"dependencies": {
226226
"@elastic/datemath": "^5.0.3",
227227
"@elastic/eui": "34.6.0",
228-
"@msgpack/msgpack": "^2.7.2",
229228
"@reduxjs/toolkit": "^1.6.2",
230229
"@stablelib/snappy": "^1.0.2",
231230
"axios": "^0.25.0",
@@ -247,13 +246,14 @@
247246
"html-entities": "^2.3.2",
248247
"html-react-parser": "^1.2.4",
249248
"java-object-serialization": "^0.1.1",
250-
"jpickle": "^0.4.1",
251249
"json-bigint": "^1.0.0",
252250
"jsonpath": "^1.1.1",
253251
"lodash": "^4.17.21",
254252
"lz4js": "^0.2.0",
253+
"msgpackr": "^1.9.7",
255254
"pako": "^2.1.0",
256255
"php-serialize": "^4.0.2",
256+
"pickleparser": "^0.1.0",
257257
"rawproto": "^0.7.6",
258258
"react": "^18.2.0",
259259
"react-contenteditable": "^3.3.5",

redisinsight/api/config/features-config.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": 2.3201,
2+
"version": 2.3202,
33
"features": {
44
"insightsRecommendations": {
55
"flag": true,
@@ -39,6 +39,16 @@
3939
"provider": "GCP",
4040
"regions": ["asia-northeast1"]
4141
}
42+
],
43+
"redisStackPreview": [
44+
{
45+
"provider": "AWS",
46+
"regions": ["us-east-2", "ap-southeast-1", "sa-east-1"]
47+
},
48+
{
49+
"provider": "GCP",
50+
"regions": ["asia-northeast-1", "europe-west-1", "us-central-1"]
51+
}
4252
]
4353
}
4454
}

redisinsight/api/src/__mocks__/feature.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ export const mockFeatureSso = Object.assign(new Feature(), {
179179
regions: ['asia-northeast1'],
180180
},
181181
],
182+
redisStackPreview: [
183+
{
184+
provider: 'AWS',
185+
regions: ['us-east-2', 'ap-southeast-1', 'sa-east-1']
186+
},
187+
{
188+
provider: 'GCP',
189+
regions: ['asia-northeast-1', 'europe-west-1', 'us-central-1']
190+
}
191+
],
182192
},
183193
},
184194
},

redisinsight/api/src/modules/settings/repositories/local.agreements.repository.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('LocalAgreementsRepository', () => {
6060
const result = await service.update(mockUserId, mockAgreements);
6161

6262
expect(result).toEqual(mockAgreements);
63-
expect(repository.update).toHaveBeenCalledWith({}, {
63+
expect(repository.update).toHaveBeenCalledWith("1", {
6464
...mockAgreementsEntity,
6565
});
6666
});

redisinsight/api/src/modules/settings/repositories/local.agreements.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class LocalAgreementsRepository extends AgreementsRepository {
2424
}
2525

2626
async update(id: string, agreements: Agreements): Promise<Agreements> {
27-
await this.repository.update({}, classToClass(AgreementsEntity, agreements));
27+
await this.repository.update(id || {}, classToClass(AgreementsEntity, agreements));
2828

2929
return this.getOrCreate();
3030
}

redisinsight/desktop/app.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ if (!config.isProduction) {
2222
sourceMapSupport.install()
2323
}
2424

25-
const gotTheLock = app.requestSingleInstanceLock()
26-
27-
// deep link open (win)
28-
if (!gotTheLock) {
29-
app.quit()
30-
}
31-
3225
const init = async () => {
3326
await launchApiServer()
3427
initLogging()

redisinsight/desktop/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
import app from './app'
1+
import { app } from 'electron'
2+
import init from './app'
23

3-
app()
4+
const gotTheLock = app.requestSingleInstanceLock() || process.platform === 'darwin'
5+
6+
// deep link open (win)
7+
if (!gotTheLock) {
8+
console.log('Didn\'t get the lock. Quiting...')
9+
app.quit()
10+
} else {
11+
init()
12+
}

redisinsight/ui/src/components/oauth/oauth-select-plan/OAuthSelectPlan.spec.tsx

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { cloneDeep } from 'lodash'
33
import { cleanup, fireEvent, mockedStore, render, within } from 'uiSrc/utils/test-utils'
44
import { TelemetryEvent, sendEventTelemetry } from 'uiSrc/telemetry'
55
import { addFreeDb, oauthCloudPlanSelector, oauthCloudSelector, initialState } from 'uiSrc/slices/oauth/cloud'
6+
import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
67
import { OAuthSocialSource } from 'uiSrc/slices/interfaces'
7-
import { MOCK_NO_TF_REGION, MOCK_REGIONS } from 'uiSrc/constants/mocks/mock-sso'
8+
import { MOCK_NO_TF_REGION, MOCK_REGIONS, MOCK_RS_PREVIEW_REGION, MOCK_CUSTOM_REGIONS } from 'uiSrc/constants/mocks/mock-sso'
89
import OAuthSelectPlan from './OAuthSelectPlan'
910

1011
jest.mock('uiSrc/telemetry', () => ({
@@ -41,7 +42,17 @@ jest.mock('uiSrc/slices/app/features', () => ({
4142
provider: 'GCP',
4243
regions: ['asia-northeast1']
4344
}
44-
]
45+
],
46+
redisStackPreview: [
47+
{
48+
provider: 'AWS',
49+
regions: ['us-east-2', 'ap-southeast-1', 'sa-east-1']
50+
},
51+
{
52+
provider: 'GCP',
53+
regions: ['asia-northeast-1', 'europe-west-1', 'us-central-1']
54+
}
55+
],
4556
}
4657
}
4758
}
@@ -121,6 +132,72 @@ describe('OAuthSelectPlan', () => {
121132
expect(tfIconEl).toBeInTheDocument()
122133
})
123134

135+
it('if source is not Trigger and Functions region with RS should be selected by default', async () => {
136+
const container = render(<OAuthSelectPlan />)
137+
138+
const { queryByTestId } = within(container.queryByTestId('select-oauth-region') as HTMLElement)
139+
const tfIconEl = queryByTestId(/rs-text-/)
140+
141+
expect(tfIconEl).toBeInTheDocument()
142+
})
143+
144+
it('Should display region with RS preview text', async () => {
145+
(oauthCloudPlanSelector as jest.Mock).mockReturnValue({
146+
isOpenDialog: true,
147+
data: [MOCK_RS_PREVIEW_REGION],
148+
})
149+
150+
const container = render(<OAuthSelectPlan />)
151+
152+
const { queryByTestId } = within(container.queryByTestId('select-oauth-region') as HTMLElement)
153+
const rsTextEl = queryByTestId(/rs-text-/)
154+
155+
expect(rsTextEl).toBeInTheDocument()
156+
})
157+
158+
it('should be selected first region by default', async () => {
159+
(oauthCloudPlanSelector as jest.Mock).mockReturnValue({
160+
isOpenDialog: true,
161+
data: MOCK_CUSTOM_REGIONS,
162+
})
163+
164+
const container = render(<OAuthSelectPlan />)
165+
166+
const { queryByTestId } = within(container.queryByTestId('select-oauth-region') as HTMLElement)
167+
const selectedEl = queryByTestId('option-custom-1')
168+
169+
expect(selectedEl).toBeInTheDocument()
170+
})
171+
172+
it('should be selected us-east-2 region by default', async () => {
173+
(oauthCloudPlanSelector as jest.Mock).mockReturnValue({
174+
isOpenDialog: true,
175+
data: [MOCK_NO_TF_REGION, MOCK_RS_PREVIEW_REGION, ...MOCK_CUSTOM_REGIONS],
176+
});
177+
(appFeatureFlagsFeaturesSelector as jest.Mock).mockReturnValueOnce({})
178+
179+
const container = render(<OAuthSelectPlan />)
180+
181+
const { queryByTestId } = within(container.queryByTestId('select-oauth-region') as HTMLElement)
182+
const selectedEl = queryByTestId('option-us-east-2')
183+
184+
expect(selectedEl).toBeInTheDocument()
185+
})
186+
187+
it('Should select region with RS preview text by default', async () => {
188+
(oauthCloudPlanSelector as jest.Mock).mockReturnValue({
189+
isOpenDialog: true,
190+
data: [MOCK_RS_PREVIEW_REGION, ...MOCK_CUSTOM_REGIONS],
191+
})
192+
193+
const container = render(<OAuthSelectPlan />)
194+
195+
const { queryByTestId } = within(container.queryByTestId('select-oauth-region') as HTMLElement)
196+
const rsTextEl = queryByTestId(/rs-text-/)
197+
198+
expect(rsTextEl).toBeInTheDocument()
199+
})
200+
124201
it('should display text if no Trigger and Function regions available on this vendor', async () => {
125202
(oauthCloudPlanSelector as jest.Mock).mockReturnValue({
126203
isOpenDialog: true,

redisinsight/ui/src/components/oauth/oauth-select-plan/OAuthSelectPlan.tsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { INFINITE_MESSAGES } from 'uiSrc/components/notifications/components'
2828
import { CloudJobStep } from 'uiSrc/electron/constants'
2929
import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
3030
import { FeatureFlags, Theme } from 'uiSrc/constants'
31-
import { OAuthSocialSource, TFRegion } from 'uiSrc/slices/interfaces'
31+
import { OAuthSocialSource, Region } from 'uiSrc/slices/interfaces'
3232
import { ThemeContext } from 'uiSrc/contexts/themeContext'
3333
import TriggeredFunctionsDarkSVG from 'uiSrc/assets/img/sidebar/gears.svg'
3434
import TriggeredFunctionsLightSVG from 'uiSrc/assets/img/sidebar/gears_active.svg'
@@ -37,9 +37,10 @@ import { CloudSubscriptionPlanResponse } from 'apiSrc/modules/cloud/subscription
3737
import { OAuthProvider, OAuthProviders } from './constants'
3838
import styles from './styles.module.scss'
3939

40-
export const DEFAULT_REGION = 'us-east-1'
40+
export const DEFAULT_REGIONS = ['us-east-2', 'asia-northeast-1']
4141
export const DEFAULT_PROVIDER = OAuthProvider.AWS
42-
const getTFProviderRegions = (regions: TFRegion[], provider: OAuthProvider) =>
42+
43+
const getProviderRegions = (regions: Region[], provider: OAuthProvider) =>
4344
(find(regions, { provider }) || {}).regions || []
4445

4546
const OAuthSelectPlan = () => {
@@ -48,38 +49,43 @@ const OAuthSelectPlan = () => {
4849
const { source } = useSelector(oauthCloudSelector)
4950
const { [FeatureFlags.cloudSso]: cloudSsoFeature = {} } = useSelector(appFeatureFlagsFeaturesSelector)
5051

51-
const tfRegions: TFRegion[] = get(cloudSsoFeature, 'data.selectPlan.components.triggersAndFunctions', [])
52+
const tfRegions: Region[] = get(cloudSsoFeature, 'data.selectPlan.components.triggersAndFunctions', [])
53+
const rsRegions: Region[] = get(cloudSsoFeature, 'data.selectPlan.components.redisStackPreview', [])
5254

5355
const [plans, setPlans] = useState(plansInit || [])
5456
const [planIdSelected, setPlanIdSelected] = useState('')
5557
const [providerSelected, setProviderSelected] = useState<OAuthProvider>(DEFAULT_PROVIDER)
56-
const [tfProviderRegions, setTfProviderRegions] = useState(getTFProviderRegions(tfRegions, providerSelected))
58+
const [tfProviderRegions, setTfProviderRegions] = useState(getProviderRegions(tfRegions, providerSelected))
59+
const [rsProviderRegions, setRsProviderRegions] = useState(getProviderRegions(rsRegions, providerSelected))
5760

5861
const dispatch = useDispatch()
5962

6063
const isTFSource = source?.endsWith(OAuthSocialSource.TriggersAndFunctions)
6164

6265
useEffect(() => {
63-
setTfProviderRegions(getTFProviderRegions(tfRegions, providerSelected))
64-
}, [providerSelected])
66+
setTfProviderRegions(getProviderRegions(tfRegions, providerSelected))
67+
setRsProviderRegions(getProviderRegions(rsRegions, providerSelected))
68+
}, [providerSelected, plansInit])
6569

6670
useEffect(() => {
6771
if (!plansInit.length) {
6872
return
6973
}
7074

71-
const defaultRegions = isTFSource ? tfProviderRegions || [DEFAULT_REGION] : [DEFAULT_REGION]
75+
const defaultRegions = isTFSource
76+
? [tfProviderRegions, DEFAULT_REGIONS].find((arr) => arr?.length)
77+
: DEFAULT_REGIONS
7278

7379
const filteredPlans = filter(plansInit, { provider: providerSelected })
7480
.sort((a, b) => (a?.details?.displayOrder || 0) - (b?.details?.displayOrder || 0))
7581

7682
const defaultPlan = filteredPlans.find(({ region = '' }) => defaultRegions?.includes(region))
77-
78-
const planId = (defaultPlan || first(filteredPlans) || {}).id?.toString() || ''
83+
const rsPreviewPlan = filteredPlans.find(({ region = '' }) => rsProviderRegions?.includes(region))
84+
const planId = (defaultPlan || rsPreviewPlan || first(filteredPlans) || {}).id?.toString() || ''
7985

8086
setPlans(filteredPlans)
8187
setPlanIdSelected(planId)
82-
}, [isTFSource, plansInit, providerSelected, tfProviderRegions])
88+
}, [isTFSource, plansInit, providerSelected, tfProviderRegions, rsProviderRegions])
8389

8490
const handleOnClose = useCallback(() => {
8591
sendEventTelemetry({
@@ -96,11 +102,15 @@ const OAuthSelectPlan = () => {
96102
const getOptionDisplay = (item: CloudSubscriptionPlanResponse) => {
97103
const { region = '', details: { countryName = '', cityName = '' }, provider } = item
98104
const tfProviderRegions: string[] = find(tfRegions, { provider })?.regions || []
105+
const rsProviderRegions: string[] = find(rsRegions, { provider })?.regions || []
99106

100107
return (
101-
<EuiText color="subdued" size="s">
108+
<EuiText color="subdued" size="s" data-testid={`option-${region}`}>
102109
{`${countryName} (${cityName})`}
103110
<EuiTextColor className={styles.regionName}>{region}</EuiTextColor>
111+
{rsProviderRegions?.includes(region) && (
112+
<EuiTextColor className={styles.rspreview} data-testid={`rs-text-${region}`}>(Redis 7.2)</EuiTextColor>
113+
)}
104114
{ tfProviderRegions?.includes(region) && (
105115
<EuiToolTip
106116
content="Triggers and functions are available in this region"
@@ -156,7 +166,7 @@ const OAuthSelectPlan = () => {
156166
</EuiTitle>
157167
<section className={styles.providers}>
158168
{ OAuthProviders.map(({ icon, id, label }) => (
159-
<div className={styles.provider}>
169+
<div className={styles.provider} key={id}>
160170
{id === providerSelected
161171
&& <div className={cx(styles.providerActiveIcon)}><EuiIcon type="check" /></div>}
162172
<EuiButton

redisinsight/ui/src/components/oauth/oauth-select-plan/styles.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,9 @@
145145
margin-left: 11px;
146146
margin-bottom: 0 !important;
147147
}
148+
149+
:global(.euiTextColor).rspreview {
150+
font-size: 12px !important;
151+
margin-left: 11px;
152+
color: var(--euiColorMediumShade) !important;
153+
}

0 commit comments

Comments
 (0)