Skip to content

Commit ae402b6

Browse files
authored
Merge pull request #3877 from RedisInsight/release/2.58.0
Release/2.58.0 to latest
2 parents 8247ef9 + 688a91b commit ae402b6

File tree

4 files changed

+49
-25
lines changed

4 files changed

+49
-25
lines changed

redisinsight/ui/src/pages/rdi/instance/components/header/RdiPipelineHeader.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
EuiFlexGroup,
33
EuiFlexItem,
44
} from '@elastic/eui'
5-
import React, { useEffect } from 'react'
5+
import React, { useEffect, useState } from 'react'
66
import { useDispatch, useSelector } from 'react-redux'
77
import { useParams } from 'react-router-dom'
88

@@ -14,6 +14,7 @@ import PipelineActions from './components/pipeline-actions'
1414
import styles from './styles.module.scss'
1515

1616
const RdiPipelineHeader = () => {
17+
const [headerLoading, setHeaderLoading] = useState(true)
1718
const { rdiInstanceId } = useParams<{ rdiInstanceId: string }>()
1819
const { data: statusData, error: statusError } = useSelector(rdiPipelineStatusSelector)
1920
const dispatch = useDispatch()
@@ -22,7 +23,7 @@ const RdiPipelineHeader = () => {
2223

2324
useEffect(() => {
2425
if (!intervalId) {
25-
dispatch(getPipelineStatusAction(rdiInstanceId))
26+
dispatch(getPipelineStatusAction(rdiInstanceId, () => setHeaderLoading(false), () => setHeaderLoading(false)))
2627
intervalId = setInterval(() => {
2728
dispatch(getPipelineStatusAction(rdiInstanceId))
2829
}, 10000)
@@ -40,6 +41,7 @@ const RdiPipelineHeader = () => {
4041
<CurrentPipelineStatus
4142
pipelineState={pipelineState}
4243
statusError={statusError}
44+
headerLoading={headerLoading}
4345
/>
4446
</EuiFlexItem>
4547
<PipelineActions

redisinsight/ui/src/pages/rdi/instance/components/header/components/current-pipeline-status/CurrentPipelineStatus.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { EuiIcon, EuiTitle, EuiToolTip } from '@elastic/eui'
2+
import { EuiIcon, EuiLoadingSpinner, EuiTitle, EuiToolTip } from '@elastic/eui'
33
import initialSyncIcon from 'uiSrc/assets/img/rdi/pipelineStatuses/initial_sync.svg?react'
44
import streamingIcon from 'uiSrc/assets/img/rdi/pipelineStatuses/streaming.svg?react'
55
import notRunningIcon from 'uiSrc/assets/img/rdi/pipelineStatuses/not_running.svg?react'
@@ -11,9 +11,10 @@ import styles from './styles.module.scss'
1111
export interface Props {
1212
pipelineState?: PipelineState
1313
statusError?: string
14+
headerLoading: boolean
1415
}
1516

16-
const CurrentPipelineStatus = ({ pipelineState, statusError }: Props) => {
17+
const CurrentPipelineStatus = ({ pipelineState, statusError, headerLoading }: Props) => {
1718
const getPipelineStateIconAndLabel = (pipelineState: Maybe<PipelineState>) => {
1819
switch (pipelineState) {
1920
case PipelineState.InitialSync:
@@ -34,17 +35,21 @@ const CurrentPipelineStatus = ({ pipelineState, statusError }: Props) => {
3435
<EuiTitle size="xxs">
3536
<h6>Pipeline State: </h6>
3637
</EuiTitle>
37-
<EuiToolTip
38-
content={errorTooltipContent}
39-
anchorClassName={statusError && styles.tooltip}
40-
>
41-
<div className={styles.stateBadge} data-testid="pipeline-state-badge">
42-
<EuiIcon
43-
type={stateInfo.icon}
44-
/>
45-
<span>{stateInfo.label}</span>
46-
</div>
47-
</EuiToolTip>
38+
{headerLoading ? (
39+
<EuiLoadingSpinner size="m" style={{ marginLeft: '8px' }} />
40+
) : (
41+
<EuiToolTip
42+
content={errorTooltipContent}
43+
anchorClassName={statusError && styles.tooltip}
44+
>
45+
<div className={styles.stateBadge} data-testid="pipeline-state-badge">
46+
<EuiIcon
47+
type={stateInfo.icon}
48+
/>
49+
<span>{stateInfo.label}</span>
50+
</div>
51+
</EuiToolTip>
52+
)}
4853
</div>
4954
)
5055
}

redisinsight/ui/src/slices/rdi/pipeline.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ export function deletePipelineJob(
378378

379379
export function getPipelineStatusAction(
380380
rdiInstanceId: string,
381+
onSuccessAction?: () => void,
382+
onFailAction?: () => void,
381383
) {
382384
return async (dispatch: AppDispatch) => {
383385
try {
@@ -388,11 +390,13 @@ export function getPipelineStatusAction(
388390

389391
if (isStatusSuccessful(status)) {
390392
dispatch(getPipelineStatusSuccess(data))
393+
onSuccessAction?.()
391394
}
392395
} catch (_err) {
393396
const error = _err as AxiosError
394397
const errorMessage = getApiErrorMessage(error)
395398
dispatch(getPipelineStatusFailure(errorMessage))
399+
onFailAction?.()
396400
}
397401
}
398402
}

tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { commonUrl, ossStandaloneRedisGears } from '../../../../helpers/conf';
2+
import { ClientFunction } from 'testcafe';
23
import { ExploreTabs, rte } from '../../../../helpers/constants';
34
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
45
import { Common } from '../../../../helpers/common';
@@ -18,13 +19,14 @@ const { host, port, databaseName, databaseUsername = '', databasePassword = '' }
1819
const username = 'alice&&';
1920
const password = 'p1pp0@&';
2021

21-
function generateLink(params: Record<string, any>): string {
22+
function generateLink(params: Record<string, any>, connectType: string, url: string ): string {
2223
const params1 = Common.generateUrlTParams(params);
23-
const from = encodeURIComponent(`${redisConnect}?${params1}`);
24-
return (new URL(`?from=${from}`, commonUrl)).toString();
24+
const from = encodeURIComponent(`${connectType}?${params1}`);
25+
return (new URL(`?from=${from}`, url)).toString();
2526
}
2627

2728
const redisConnect = 'redisinsight://databases/connect';
29+
const redisOpen = 'redisinsight://open';
2830

2931
fixture `Add DB from SM`
3032
.meta({ type: 'critical_path', rte: rte.none })
@@ -42,7 +44,7 @@ test
4244
databaseAlias: databaseName,
4345
redirect: 'workbench'
4446
};
45-
await t.navigateTo(generateLink(connectUrlParams));
47+
await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
4648
await t.expect(myRedisDatabasePage.AddRedisDatabase.disabledDatabaseInfo.nth(0).getAttribute('title')).contains(host, 'Wrong host value');
4749
await t.expect(myRedisDatabasePage.AddRedisDatabase.disabledDatabaseInfo.nth(1).getAttribute('title')).contains(port, 'Wrong port value');
4850
await t.wait(5_000);
@@ -76,25 +78,36 @@ test
7678
subscriptionType: 'fixed',
7779
planMemoryLimit: '30',
7880
memoryLimitMeasurementUnit: 'mb',
79-
free: 'true',
80-
onboarding: 'true'
81+
free: 'true'
8182
};
8283

83-
await t.navigateTo(generateLink(connectUrlParams));
84+
const connectUrlParams2 = {
85+
redirect: '/_',
86+
onboarding: 'true',
87+
copilot: 'false'
88+
};
89+
90+
await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
8491
await t.wait(10_000);
8592
await t.expect(workbenchPage.submitCommandButton.exists).ok('Redirection to Workbench is not correct');
8693
const tab = await workbenchPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
8794
await t.expect(tab.preselectArea.textContent).contains('INTRODUCTION', 'the tutorial page is incorrect');
8895
await t.expect(tab.preselectArea.textContent).contains('JSON', 'the tutorial is incorrect');
8996

90-
//Verify that the same db is not added
91-
await t.navigateTo(generateLink(connectUrlParams));
97+
const getPageUrl = ClientFunction(() => window.location.href);
98+
const url = await getPageUrl();
99+
100+
await t.navigateTo(generateLink(connectUrlParams2, redisOpen, url));
92101
await t.wait(10_000);
102+
await t.expect(workbenchPage.submitCommandButton.exists).ok('Redirection to the same page is not correct');
93103
await t.click(workbenchPage.NavigationPanel.browserButton);
94104
await t.expect(onboardingCardsDialog.showMeAroundButton.exists).ok('onboarding is nor reset');
95105
await t.click(onboardingCardsDialog.skipTourButton);
106+
107+
//Verify that the same db is not added
108+
await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
109+
await t.wait(10_000);
96110
await t.click(workbenchPage.NavigationPanel.myRedisDBButton);
97111
await t.expect(browserPage.notification.exists).notOk({ timeout: 10000 });
98112
await t.expect(myRedisDatabasePage.dbNameList.child('span').withExactText(databaseName).count).eql(2, 'the same db is added twice');
99-
100113
});

0 commit comments

Comments
 (0)