Skip to content

Commit f690b3f

Browse files
Add recusrive delete warning
1 parent 39d87d5 commit f690b3f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/src/actions/clearTopic.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export const clearTopic = (topic: q.TreeNode<any>, recursive: boolean) => async
99
dispatch: Dispatch<any>,
1010
getState: () => AppState
1111
) => {
12+
const topicsForPurging = recursive ? [topic, ...topic.childTopics()] : [topic]
13+
1214
if (recursive) {
1315
const topicCount = topic.childTopicCount()
1416

@@ -21,7 +23,7 @@ export const clearTopic = (topic: q.TreeNode<any>, recursive: boolean) => async
2123
const confirmed = await dispatch(
2224
globalActions.requestConfirmation(
2325
'Confirm delete',
24-
`Do you want to delete "${topic.path()}"${childTopicsMessage}?`
26+
`Do you want to clear "${topic.path()}"${childTopicsMessage}?\n\nThis function will send an empty payload (QoS 0, retain) to this and every subtopic, clearing retained topics in the process. Only use this function if you know what you are doing.`
2527
)
2628
)
2729
if (!confirmed) {
@@ -36,7 +38,6 @@ export const clearTopic = (topic: q.TreeNode<any>, recursive: boolean) => async
3638
return
3739
}
3840
const publishEvent = makePublishEvent(connectionId)
39-
const topicsForPurging = recursive ? [topic, ...topic.childTopics()] : [topic]
4041

4142
topicsForPurging
4243
.filter(t => t.path() !== '' && t.hasMessage())

app/src/components/ConfirmationDialog.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ function ConfirmationDialog(props: { confirmationRequests: Array<ConfirmationReq
4242
>
4343
<DialogTitle id="alert-dialog-title">{request.title}</DialogTitle>
4444
<DialogContent>
45-
<DialogContentText id="alert-dialog-description">{request.inquiry}</DialogContentText>
45+
<DialogContentText id="alert-dialog-description" style={{ whiteSpace: 'pre-wrap' }}>
46+
{request.inquiry}
47+
</DialogContentText>
4648
</DialogContent>
4749
<DialogActions>
4850
<Button ref={yesRef as any} variant="contained" onClick={confirm} color="primary" autoFocus>

0 commit comments

Comments
 (0)