Skip to content

Commit 4287e95

Browse files
authored
fix: Improve delete module dialog phrasing (#4497)
* fix: Improve delete module dialog phrasing & adjust tests * fix tests * improve code changes * fix code style issue
1 parent 2a9f261 commit 4287e95

File tree

6 files changed

+35
-30
lines changed

6 files changed

+35
-30
lines changed

public/i18n/en.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,8 @@ kyma-modules:
892892
change-release-channel-warning: The module's version in the fast channel is usually higher than the version in the regular channel. As downgrades are not supported, switching the channel back to regular will not affect the module's version <0>until the channel version is the same or higher.</0> To use the lower version, you must delete the module and re-add it from the <0>regular</0> channel.
893893
channel: Channel
894894
channel-overridden: Overridden
895-
delete-module: Before you delete the {{name}} module, make sure the module resources are no longer needed. This action also permanently removes the namespaces, service instances, and service bindings created by the module. Are you sure you want to continue?
895+
delete-module: Deleting this module will also permanently delete all namespaces, service instances, and service bindings created by the module.
896+
delete-module-title: Delete module {{name}} from your cluster?
896897
description: With <0>Kyma’s modular approach</0>, you can install just the modules you need, instead of a predefined set of components.
897898
documentation: Documentation
898899
installation-state: Installation State

src/components/Modules/components/ModulesDeleteBox.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
List,
66
ListItemStandard,
77
MessageStrip,
8-
Text,
98
} from '@ui5/webcomponents-react';
109
import {
1110
checkIfAllResourcesAreDeleted,
@@ -284,6 +283,9 @@ export const ModulesDeleteBox = ({
284283
}
285284
};
286285

286+
const moduleName =
287+
chosenModuleIndex != null ? selectedModules[chosenModuleIndex]?.name : '';
288+
287289
return (
288290
<DeleteMessageBox
289291
disableDeleteButton={
@@ -295,20 +297,14 @@ export const ModulesDeleteBox = ({
295297
? 'common.buttons.cascade-delete'
296298
: null
297299
}
300+
customTitle={t('kyma-modules.delete-module-title', { name: moduleName })}
301+
customMessage={t('kyma-modules.delete-module')}
298302
cancelFn={() => {
299303
setAllowForceDelete(false);
300304
setChosenModuleIndex(null);
301305
}}
302306
additionalDeleteInfo={
303307
<>
304-
<Text>
305-
{t('kyma-modules.delete-module', {
306-
name:
307-
chosenModuleIndex != null
308-
? selectedModules[chosenModuleIndex]?.name
309-
: '',
310-
})}
311-
</Text>
312308
{associatedResources.length > 0 && (
313309
<>
314310
<MessageStrip

src/shared/hooks/useDeleteResource.jsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,23 @@ export function useDeleteResource({
169169
cancelFn,
170170
additionalDeleteInfo,
171171
customDeleteText,
172+
customTitle,
173+
customMessage,
172174
disableDeleteButton = false,
173175
}) => {
176+
const defaultTitle = t(
177+
resourceIsCluster
178+
? 'common.delete-dialog.disconnect-title'
179+
: 'common.delete-dialog.delete-title',
180+
{
181+
type: prettifiedResourceName,
182+
},
183+
);
174184
return (
175185
<MessageBox
176186
style={{ maxWidth: '700px' }}
177187
type="Warning"
178-
titleText={t(
179-
resourceIsCluster
180-
? 'common.delete-dialog.disconnect-title'
181-
: 'common.delete-dialog.delete-title',
182-
{
183-
type: prettifiedResourceName,
184-
},
185-
)}
188+
titleText={customTitle || defaultTitle}
186189
open={showDeleteDialog}
187190
className="ui5-content-density-compact"
188191
id="delete-message-box"
@@ -223,15 +226,16 @@ export function useDeleteResource({
223226
}}
224227
>
225228
<Text style={{ paddingLeft: '7.5px' }}>
226-
{t(
227-
resourceIsCluster
228-
? 'common.delete-dialog.disconnect-message'
229-
: 'common.delete-dialog.delete-message',
230-
{
231-
type: prettifiedResourceName,
232-
name: resourceTitle || resource?.metadata?.name,
233-
},
234-
)}
229+
{customMessage ??
230+
t(
231+
resourceIsCluster
232+
? 'common.delete-dialog.disconnect-message'
233+
: 'common.delete-dialog.delete-message',
234+
{
235+
type: prettifiedResourceName,
236+
name: resourceTitle || resource?.metadata?.name,
237+
},
238+
)}
235239
</Text>
236240
{additionalDeleteInfo && (
237241
<Text style={{ paddingLeft: '7.5px' }}>{additionalDeleteInfo}</Text>

tests/integration/support/commands.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Cypress.Commands.add(
181181
searchInPlainTableText = false,
182182
parentSelector = null,
183183
waitForDelete = 0,
184+
customHeaderText = null,
184185
} = options;
185186

186187
cy.wait(1000);
@@ -218,15 +219,16 @@ Cypress.Commands.add(
218219
cy.get('ui5-button[data-testid="delete"]').click();
219220

220221
if (confirmationEnabled) {
221-
cy.contains(`Delete ${resourceType} ${resourceName}`);
222+
const headerText = customHeaderText || `Delete ${resourceType}`;
223+
cy.contains(customHeaderText || `Delete ${resourceType} ${resourceName}`);
222224

223225
// TODO: This wait allows 'community modules add/edit/delete' to download needed resources to apply from backend.
224226
// The download is initiated when user mark module to install and then when user click delete, it deleted what is was able to download
225227
if (waitForDelete !== 0) {
226228
cy.wait(waitForDelete);
227229
}
228230

229-
cy.get(`[header-text="Delete ${resourceType}"]:visible`)
231+
cy.get(`[header-text="${headerText}"]:visible`)
230232
.find('[data-testid="delete-confirmation"]')
231233
.click();
232234

tests/integration/tests/kyma-cluster/test-community-modules.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ context('Test Community Modules views', () => {
176176

177177
it('Test deleting Community Modules from List and Details', () => {
178178
cy.deleteFromGenericList('Module', 'busola', {
179+
parentSelector: '.community-modules-list',
179180
searchInPlainTableText: true,
180181
deletedVisible: false,
181-
parentSelector: '.community-modules-list',
182182
waitForDelete: 2000,
183+
customHeaderText: 'Delete module busola from your cluster?',
183184
});
184185
});
185186
});

tests/integration/tests/kyma-cluster/test-kyma-modules.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ context('Test Kyma Modules views', () => {
207207
cy.deleteFromGenericList('Module', 'eventing', {
208208
searchInPlainTableText: true,
209209
parentSelector: '.modules-list',
210+
customHeaderText: 'Delete module eventing from your cluster?',
210211
});
211212

212213
// Uncomment after adding local KLM

0 commit comments

Comments
 (0)