Skip to content

Commit 8d7fa48

Browse files
authored
Merge pull request #1977 from RedisInsight/fe/bugfix/upload-data-in-bulk
[bugfix] - #RI-4416 #RI-4417 #RI-4418
2 parents 92e2d8d + 579e2ea commit 8d7fa48

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

redisinsight/ui/src/pages/browser/components/bulk-actions/BulkActionsInfo/BulkActionsInfo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import styles from './styles.module.scss'
1111

1212
export interface Props {
1313
title?: string | React.ReactNode
14+
subTitle?: string | React.ReactNode
1415
loading: boolean
1516
filter?: Nullable<KeyTypes>
1617
status: Maybe<BulkActionsStatus>
@@ -23,14 +24,15 @@ export interface Props {
2324
}
2425

2526
const BulkActionsInfo = (props: Props) => {
26-
const { children, loading, filter, search, status, progress, title = 'Delete Keys with' } = props
27+
const { children, loading, filter, search, status, progress, title = 'Delete Keys with', subTitle } = props
2728
const { total = 0, scanned = 0 } = progress || {}
2829

2930
return (
3031
<div className={styles.container} data-testid="bulk-actions-info">
3132
<div className={styles.header}>
3233
<EuiText color="subdued" className={styles.title}>{title}</EuiText>
3334
<EuiText color="subdued" className={styles.subTitle}>
35+
{subTitle}
3436
{filter && (
3537
<div className={styles.filter} data-testid="bulk-actions-info-filter">
3638
<span style={{ paddingRight: 6 }}>Key type:</span>

redisinsight/ui/src/pages/browser/components/bulk-actions/BulkUpload/BulkUpload.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import BulkActionsInfo from 'uiSrc/pages/browser/components/bulk-actions/BulkAct
2626
import BulkActionSummary from 'uiSrc/pages/browser/components/bulk-actions/BulkActionSummary'
2727

2828
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
29+
import { isProcessedBulkAction } from 'uiSrc/pages/browser/components/bulk-actions/utils'
2930
import styles from './styles.module.scss'
3031

3132
export interface Props {
@@ -48,6 +49,7 @@ const BulkUpload = (props: Props) => {
4849

4950
const onStartAgain = () => {
5051
dispatch(setBulkUploadStartAgain())
52+
setFiles(null)
5153
}
5254

5355
const handleUploadWarning = () => {
@@ -120,13 +122,8 @@ const BulkUpload = (props: Props) => {
120122
loading={loading}
121123
status={status}
122124
progress={progress}
123-
title={(
124-
<>
125-
Upload with file
126-
<EuiSpacer size="m" />
127-
<div className="truncateText">{fileName}</div>
128-
</>
129-
)}
125+
title="Upload with file"
126+
subTitle={(<div className="truncateText" style={{ paddingTop: 6 }}>{fileName}</div>)}
130127
>
131128
<BulkActionSummary
132129
succeed={succeed}
@@ -144,7 +141,7 @@ const BulkUpload = (props: Props) => {
144141
className={styles.cancelBtn}
145142
data-testid="bulk-action-cancel-btn"
146143
>
147-
Cancel
144+
{isProcessedBulkAction(status) ? 'Close' : 'Cancel'}
148145
</EuiButton>
149146
{!isCompleted ? (
150147
<EuiPopover
@@ -193,6 +190,7 @@ const BulkUpload = (props: Props) => {
193190
) : (
194191
<EuiButton
195192
fill
193+
iconType="refresh"
196194
color="secondary"
197195
onClick={onStartAgain}
198196
data-testid="bulk-action-start-new-btn"

redisinsight/ui/src/slices/browser/bulkActions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ApiEndpoints, BulkActionsType, MAX_BULK_ACTION_ERRORS_LENGTH } from 'ui
55
import { apiService } from 'uiSrc/services'
66
import { getApiErrorMessage, getUrl, isStatusSuccessful } from 'uiSrc/utils'
77

8+
import { addErrorNotification } from 'uiSrc/slices/app/notifications'
89
import { AppDispatch, RootState } from '../store'
910
import { StateBulkActions, IBulkActionOverview } from '../interfaces'
1011

@@ -181,6 +182,7 @@ export function bulkUploadDataAction(
181182
}
182183
} catch (error) {
183184
const errorMessage = getApiErrorMessage(error as AxiosError)
185+
dispatch(addErrorNotification(error as AxiosError))
184186
dispatch(bulkUploadFailed(errorMessage))
185187
onFailAction?.()
186188
}

redisinsight/ui/src/slices/tests/browser/bulkActions.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { cloneDeep } from 'lodash'
2+
import { AxiosError } from 'axios'
23
import { BulkActionsType } from 'uiSrc/constants'
34
import reducer, {
45
bulkActionsSelector,
@@ -22,6 +23,7 @@ import reducer, {
2223
} from 'uiSrc/slices/browser/bulkActions'
2324
import { cleanup, initialStateDefault, mockedStore } from 'uiSrc/utils/test-utils'
2425
import { apiService } from 'uiSrc/services'
26+
import { addErrorNotification } from 'uiSrc/slices/app/notifications'
2527

2628
let store: typeof mockedStore
2729

@@ -433,6 +435,7 @@ describe('bulkActions slice', () => {
433435
// Assert
434436
const expectedActions = [
435437
bulkUpload(),
438+
addErrorNotification(responsePayload as AxiosError),
436439
bulkUploadFailed(errorMessage),
437440
]
438441
expect(store.getActions()).toEqual(expectedActions)

0 commit comments

Comments
 (0)