Skip to content

Commit 4f85347

Browse files
committed
#RI-4326 - add highlighting for bulk upload
1 parent db3b375 commit 4f85347

File tree

6 files changed

+46
-66
lines changed

6 files changed

+46
-66
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react'
2-
import { PageNames } from 'uiSrc/constants/pages'
32

43
export type FeaturesHighlightingType = 'plain' | 'tooltip' | 'popover'
54

@@ -9,11 +8,11 @@ interface BuildHighlightingFeature {
98
content?: string | React.ReactElement
109
page?: string
1110
}
12-
export const BUILD_FEATURES: { [key: string]: BuildHighlightingFeature } = {
13-
myTutorials: {
11+
12+
export const BUILD_FEATURES: Record<string, BuildHighlightingFeature> = {
13+
bulkUpload: {
1414
type: 'tooltip',
15-
title: 'Upload your own tutorials',
16-
content: 'Upload tutorials to work in Workbench and share them with others.',
17-
page: PageNames.workbench
15+
title: (<span><i>New:</i> Bulk Upload</span>),
16+
content: 'Upload your data in bulk from a file.',
1817
}
19-
}
18+
} as const

redisinsight/ui/src/pages/browser/components/keys-header/KeysHeader.tsx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ import { getBasedOnViewTypeEvent, sendEventTelemetry, TelemetryEvent } from 'uiS
2323
import { isRedisearchAvailable } from 'uiSrc/utils'
2424

2525
import { OnboardingStepName, OnboardingSteps } from 'uiSrc/constants/onboarding'
26-
import { incrementOnboardStepAction } from 'uiSrc/slices/app/features'
26+
import {
27+
appFeatureHighlightingSelector,
28+
incrementOnboardStepAction,
29+
removeFeatureFromHighlighting
30+
} from 'uiSrc/slices/app/features'
2731
import { OnboardingTour } from 'uiSrc/components'
2832
import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features'
2933
import { setBulkActionType } from 'uiSrc/slices/browser/bulkActions'
34+
import { BUILD_FEATURES } from 'uiSrc/constants/featuresHighlighting'
35+
import HighlightedFeature from 'uiSrc/components/hightlighted-feature/HighlightedFeature'
36+
import { getHighlightingFeatures } from 'uiSrc/utils/highlighting'
3037
import AutoRefresh from '../auto-refresh'
3138
import FilterKeyType from '../filter-key-type'
3239
import RediSearchIndexesList from '../redisearch-key-list'
@@ -77,6 +84,8 @@ const KeysHeader = (props: Props) => {
7784
const { id: instanceId, modules } = useSelector(connectedInstanceSelector)
7885
const { viewType, searchMode, isFiltered } = useSelector(keysSelector)
7986
const { selectedIndex } = useSelector(redisearchSelector)
87+
const { features } = useSelector(appFeatureHighlightingSelector)
88+
const { bulkUpload: bulkUploadHighlighting } = getHighlightingFeatures(features)
8089

8190
const rootDivRef: Ref<HTMLDivElement> = useRef(null)
8291

@@ -241,6 +250,7 @@ const KeysHeader = (props: Props) => {
241250
const openBulkActions = () => {
242251
dispatch(setBulkActionType(BulkActionsType.Delete))
243252
handleBulkActionsPanel(true)
253+
dispatch(removeFeatureFromHighlighting('bulkUpload'))
244254
}
245255

246256
const handleSwitchView = (type: KeyViewType) => {
@@ -301,18 +311,27 @@ const KeysHeader = (props: Props) => {
301311
)
302312

303313
const BulkActionsBtn = (
304-
<EuiToolTip content="Bulk Actions" position="top">
305-
<EuiButton
306-
fill
307-
size="s"
308-
color="secondary"
309-
onClick={openBulkActions}
310-
className={styles.bulkActions}
311-
data-testid="btn-bulk-actions"
312-
>
313-
<EuiIcon type={BulkActionsIcon} />
314-
</EuiButton>
315-
</EuiToolTip>
314+
<HighlightedFeature
315+
isHighlight={bulkUploadHighlighting}
316+
title={BUILD_FEATURES?.bulkUpload?.title}
317+
content={BUILD_FEATURES?.bulkUpload?.content}
318+
type={BUILD_FEATURES?.bulkUpload?.type}
319+
wrapperClassName={styles.bulkActionsHighlighting}
320+
hideFirstChild
321+
>
322+
<EuiToolTip content="Bulk Actions" position="top">
323+
<EuiButton
324+
fill
325+
size="s"
326+
color="secondary"
327+
onClick={openBulkActions}
328+
className={styles.bulkActions}
329+
data-testid="btn-bulk-actions"
330+
>
331+
<EuiIcon type={BulkActionsIcon} />
332+
</EuiButton>
333+
</EuiToolTip>
334+
</HighlightedFeature>
316335
)
317336

318337
const ViewSwitch = (width: number) => (

redisinsight/ui/src/pages/browser/components/keys-header/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
padding: 0 !important;
3030
}
3131
}
32+
33+
.bulkActionsHighlighting {
34+
display: inline-block;
35+
}
3236
}
3337

3438
.top,

redisinsight/ui/src/pages/workbench/components/enablement-area/EnablementArea/EnablementArea.tsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
FormValues
1616
} from 'uiSrc/pages/workbench/components/enablement-area/EnablementArea/components/UploadTutorialForm/UploadTutorialForm'
1717
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
18-
import { appFeatureHighlightingSelector, removeFeatureFromHighlighting } from 'uiSrc/slices/app/features'
19-
import { getHighlightingFeatures } from 'uiSrc/utils/highlighting'
18+
2019
import {
2120
getMarkdownPathByManifest,
2221
getWBSourcePath
@@ -69,8 +68,6 @@ const EnablementArea = (props: Props) => {
6968
const history = useHistory()
7069
const dispatch = useDispatch()
7170
const { search: searchEAContext } = useSelector(appContextWorkbenchEA)
72-
const { features } = useSelector(appFeatureHighlightingSelector)
73-
const { myTutorials: myTutorialsHighlighting } = getHighlightingFeatures(features)
7471

7572
const [isInternalPageVisible, setIsInternalPageVisible] = useState(false)
7673
const [isCreateOpen, setIsCreateOpen] = useState(false)
@@ -80,18 +77,6 @@ const EnablementArea = (props: Props) => {
8077
const searchRef = useRef<string>('')
8178
const { instanceId = '' } = useParams<{ instanceId: string }>()
8279

83-
useEffect(() => {
84-
if (isCreateOpen && myTutorialsHighlighting) {
85-
dispatch(removeFeatureFromHighlighting('myTutorials'))
86-
}
87-
88-
return () => {
89-
if (myTutorialsHighlighting) {
90-
dispatch(removeFeatureFromHighlighting('myTutorials'))
91-
}
92-
}
93-
}, [isCreateOpen, myTutorialsHighlighting])
94-
9580
useEffect(() => {
9681
searchRef.current = search
9782
const pagePath = new URLSearchParams(search).get('item')
@@ -215,9 +200,6 @@ const EnablementArea = (props: Props) => {
215200
const currentSourcePath = sourcePath + (uriPath ? `${uriPath}` : (args?.path ?? ''))
216201
const currentManifestPath = `${manifestPath}/${key}`
217202

218-
const isMyTutorialsGroup = level === 0 && currentSourcePath.startsWith(ApiEndpoints.CUSTOM_TUTORIALS_PATH)
219-
const isHighlightGroup = isMyTutorialsGroup && myTutorialsHighlighting
220-
221203
switch (type) {
222204
case EnablementAreaComponent.Group:
223205
return (
@@ -229,7 +211,6 @@ const EnablementArea = (props: Props) => {
229211
isShowActions={currentSourcePath.startsWith(ApiEndpoints.CUSTOM_TUTORIALS_PATH)}
230212
onCreate={() => setIsCreateOpen((v) => !v)}
231213
onDelete={onDeleteCustomTutorial}
232-
highlightGroup={isHighlightGroup}
233214
{...args}
234215
>
235216
<>

redisinsight/ui/src/pages/workbench/components/enablement-area/EnablementArea/components/Group/Group.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { useParams } from 'react-router-dom'
55

66
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
77
import { workbenchCustomTutorialsSelector } from 'uiSrc/slices/workbench/wb-custom-tutorials'
8-
import { BUILD_FEATURES } from 'uiSrc/constants/featuresHighlighting'
9-
import HighlightedFeature from 'uiSrc/components/hightlighted-feature/HighlightedFeature'
108
import DeleteTutorialButton from '../DeleteTutorialButton'
119
import { EAItemActions } from '../../constants'
1210

@@ -45,7 +43,6 @@ const Group = (props: Props) => {
4543
onCreate,
4644
onDelete,
4745
triggerStyle,
48-
highlightGroup
4946
} = props
5047
const { deleting: deletingCustomTutorials } = useSelector(workbenchCustomTutorialsSelector)
5148
const { instanceId = '' } = useParams<{ instanceId: string }>()
@@ -90,18 +87,9 @@ const Group = (props: Props) => {
9087

9188
const buttonContent = (
9289
<div className="group-header-wrapper">
93-
<HighlightedFeature
94-
title={BUILD_FEATURES.myTutorials?.title}
95-
content={BUILD_FEATURES.myTutorials?.content}
96-
type={BUILD_FEATURES.myTutorials?.type}
97-
isHighlight={highlightGroup}
98-
dotClassName="dotHighlighting"
99-
wrapperClassName="wrapperHighlighting"
100-
>
101-
<EuiText className="group-header" size="m">
102-
{label}
103-
</EuiText>
104-
</HighlightedFeature>
90+
<EuiText className="group-header" size="m">
91+
{label}
92+
</EuiText>
10593
{isShowActions && actionsContent}
10694
</div>
10795
)

redisinsight/ui/src/pages/workbench/components/enablement-area/EnablementArea/components/Group/styles.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,4 @@
112112
background-color: var(--hoverInListColorDarken);
113113
}
114114
}
115-
116-
.dotHighlighting {
117-
width: 8px;
118-
height: 8px;
119-
top: 0;
120-
right: -8px;
121-
}
122-
123-
.wrapperHighlighting {
124-
display: flex;
125-
}
126115
}

0 commit comments

Comments
 (0)