Skip to content

Commit cbe2bfb

Browse files
author
Roman.Sergeenko
committed
#RI-2078 - close edit mode after db deletion
#RI-2103 - fix text of button #RI-2110 - fix styles for callout for light theme
1 parent d57305b commit cbe2bfb

File tree

8 files changed

+19
-5
lines changed

8 files changed

+19
-5
lines changed

redisinsight/ui/src/pages/home/HomePage.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ const HomePage = () => {
159159
setAddDialogIsOpen(false)
160160
}
161161

162+
const handleDeleteInstances = (instances: Instance[]) => {
163+
if (instances.find((instance) => instance.id === editedInstance?.id)) {
164+
setEditedInstance(null)
165+
setEditDialogIsOpen(false)
166+
}
167+
}
168+
162169
const onResize = ({ width: innerWidth }: { width: number }) => {
163170
setWidth(innerWidth)
164171
}
@@ -200,6 +207,7 @@ const HomePage = () => {
200207
dialogIsOpen={dialogIsOpen}
201208
editedInstance={editedInstance}
202209
onEditInstance={handleEditInstance}
210+
onDeleteInstances={handleDeleteInstances}
203211
/>
204212
</div>
205213
</EuiResizablePanel>

redisinsight/ui/src/pages/home/components/DatabasesListComponent/DatabasesListWrapper.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ export interface Props {
3939
dialogIsOpen: boolean;
4040
editedInstance: Nullable<Instance>;
4141
onEditInstance: (instance: Instance) => void;
42+
onDeleteInstances: (instances: Instance[]) => void;
4243
}
4344
const DatabasesListWrapper = ({
4445
width,
4546
dialogIsOpen,
4647
onEditInstance,
4748
editedInstance,
49+
onDeleteInstances
4850
}: Props) => {
4951
const dispatch = useDispatch()
5052
const history = useHistory()
@@ -145,11 +147,11 @@ const DatabasesListWrapper = ({
145147
}
146148

147149
const handleDeleteInstance = (instance: Instance) => {
148-
dispatch(deleteInstancesAction([instance]))
150+
dispatch(deleteInstancesAction([instance], () => onDeleteInstances([instance])))
149151
}
150152

151153
const handleDeleteInstances = (instances: Instance[]) => {
152-
dispatch(deleteInstancesAction(instances))
154+
dispatch(deleteInstancesAction(instances, () => onDeleteInstances(instances)))
153155
}
154156

155157
const PopoverDelete = ({ id, ...instance }: Instance) => (

redisinsight/ui/src/pages/home/constants/help-links.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export enum HelpLink {
99

1010
export const HELP_LINKS = {
1111
[HelpLink.CreateRedisCloud]: {
12-
label: 'Create a FREE on Redis Cloud',
12+
label: 'Create a free Redis Database on Redis Cloud',
1313
link: 'https://redis.com/try-free/?utm_source=redis&utm_medium=app&utm_campaign=redisinsight',
1414
event: TelemetryEvent.CONFIG_DATABASES_GET_REDIS_CLOUD_ACCOUNT_CLICKED
1515
},

redisinsight/ui/src/slices/instances.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export function updateInstanceAction({ id, ...payload }: Instance) {
270270
}
271271

272272
// Asynchronous thunk action
273-
export function deleteInstancesAction(instances: Instance[]) {
273+
export function deleteInstancesAction(instances: Instance[], onSuccess?: () => void) {
274274
return async (dispatch: AppDispatch, stateInit: () => RootState) => {
275275
dispatch(setDefaultInstance())
276276

@@ -289,6 +289,7 @@ export function deleteInstancesAction(instances: Instance[]) {
289289
dispatch(resetConnectedInstance())
290290
dispatch(setAppContextInitialState())
291291
}
292+
onSuccess?.()
292293

293294
if (instances.length === 1) {
294295
dispatch(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.euiCallOut {
22
padding: 12px 24px !important;
33
&--primary {
4-
background-color: var(--euiTooltipBackgroundColor) !important;
4+
background-color: var(--callOutBackgroundColor) !important;
55
border-color: var(--euiColorPrimary) !important;
66
.euiText {
77
color: var(--euiTooltipTextColor) !important;

redisinsight/ui/src/styles/themes/dark_theme/_dark_theme.lazy.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
--commandGroupBadgeColor: #{$commandGroupBadgeColor};
105105

106106
--moduleBackgroundColor: #{$commandGroupBadgeColor};
107+
--callOutBackgroundColor: #{$euiTooltipBackgroundColor};
107108

108109
// KeyTypes
109110
--typeHashColor: #{$typeHashColor};

redisinsight/ui/src/styles/themes/light_theme/_light_theme.lazy.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
--commandGroupBadgeColor: #{$commandGroupBadgeColor};
107107

108108
--moduleBackgroundColor: #{$typeHashColor};
109+
--callOutBackgroundColor: #{$callOutBackgroundColor};
109110

110111
// KeyTypes
111112
--typeHashColor: #{$typeHashColor};

redisinsight/ui/src/styles/themes/light_theme/_theme_color.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ $cliOutputResponseFailColor: #AA131F;
6464

6565
$badgeBackgroundColor: #E8EFFF;
6666
$commandGroupBadgeColor: #B8C5DB;
67+
$callOutBackgroundColor: #E9EDFA;
6768

6869
// Types colors
6970
$typeHashColor: #CDDDF8;

0 commit comments

Comments
 (0)