Skip to content

Commit 0232823

Browse files
authored
feat(Remove dataset): add warning for when a user removes their own dataset
1 parent 493a288 commit 0232823

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

app/components/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// a layout component for the resizable sidebar with main content area
22
import * as React from 'react'
33
import { Resizable } from './Resizable'
4-
import NavTopbar from '../components/nav/NavTopBar'
4+
import NavTopbar from '../components/nav/NavTopbar'
55

66
interface LayoutProps {
77
id: string

app/components/modals/RemoveDataset.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { connectComponentToProps } from '../../utils/connectComponentToProps'
88
import { dismissModal } from '../../actions/ui'
99
import { removeDatasetAndFetch } from '../../actions/api'
1010

11-
import { selectModal } from '../../selections'
11+
import { selectModal, selectSessionUsername } from '../../selections'
1212

1313
import CheckboxInput from '../form/CheckboxInput'
1414
import Modal from './Modal'
@@ -17,12 +17,13 @@ import Buttons from './Buttons'
1717

1818
interface RemoveDatasetProps {
1919
modal: RemoveDatasetModal
20+
sessionUsername: string
2021
onDismissed: () => void
2122
onSubmit: (username: string, name: string, isLinked: boolean, keepFiles: boolean) => Promise<ApiAction>
2223
}
2324

2425
export const RemoveDatasetComponent: React.FunctionComponent<RemoveDatasetProps> = (props: RemoveDatasetProps) => {
25-
const { modal, onDismissed, onSubmit } = props
26+
const { modal, sessionUsername, onDismissed, onSubmit } = props
2627
const { username, name, fsiPath } = modal
2728

2829
const [keepFiles, setKeepFiles] = React.useState(true)
@@ -63,7 +64,11 @@ export const RemoveDatasetComponent: React.FunctionComponent<RemoveDatasetProps>
6364
>
6465
<div className='content-wrap'>
6566
<div className='content'>
66-
<div className='content-main'>Are you sure you want to remove <br/> <div className='code-highlight'>{username}/{name}</div>&nbsp;?</div>
67+
<div className='content-main'>
68+
Are you sure you want to remove <br/> <div className='code-highlight'>{username}/{name}</div>&nbsp;?
69+
<br/><br/>
70+
{sessionUsername === username && <div className='warning'>Warning: removing a dataset which belongs to you means you cannot return to that dataset&apos;s history.</div>}
71+
</div>
6772
{ fsiPath &&
6873
<CheckboxInput
6974
name='should-remove-files'
@@ -95,7 +100,8 @@ export default connectComponentToProps(
95100
(state: any, ownProps: RemoveDatasetProps) => {
96101
return {
97102
...ownProps,
98-
modal: selectModal(state)
103+
modal: selectModal(state),
104+
sessionUsername: selectSessionUsername(state)
99105
}
100106
},
101107
{

0 commit comments

Comments
 (0)