-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Confirmation dialog to release legal hold.
Fixes #8
- Loading branch information
1 parent
e410d0a
commit 76d0230
Showing
3 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React, {useState} from 'react'; | ||
|
||
import {UserProfile} from 'mattermost-redux/types/users'; | ||
|
||
import UsersInput from '@/components/users_input'; | ||
import {CreateLegalHold, LegalHold} from '@/types'; | ||
import {GenericModal} from '@/components/mattermost-webapp/generic_modal/generic_modal'; | ||
import Input from '@/components/mattermost-webapp/input/input'; | ||
|
||
import './create_legal_hold_form.scss'; | ||
|
||
interface ConfirmReleaseProps { | ||
legalHold: LegalHold; | ||
releaseLegalHold: (id: string) => Promise<any>; | ||
onExited: () => void; | ||
visible: boolean; | ||
} | ||
|
||
const ConfirmRelease = (props: ConfirmReleaseProps) => { | ||
const [saving, setSaving] = useState(false); | ||
const [serverError, setServerError] = useState(''); | ||
|
||
const release = () => { | ||
setSaving(true); | ||
props.releaseLegalHold(props.legalHold.id).then((response) => { | ||
props.onExited(); | ||
}).catch((error) => { | ||
setSaving(false); | ||
setServerError(error.toString()); | ||
}); | ||
}; | ||
|
||
const onCancel = () => { | ||
props.onExited(); | ||
}; | ||
|
||
return ( | ||
<GenericModal | ||
id='confirm-release-legal-hold-modal' | ||
className='confirm-release-legal-hold-modal' | ||
modalHeaderText='Release legal hold' | ||
confirmButtonText='Release' | ||
cancelButtonText='Cancel' | ||
errorText={serverError} | ||
autoCloseOnConfirmButton={false} | ||
compassDesign={true} | ||
isConfirmDisabled={saving} | ||
handleConfirm={release} | ||
handleCancel={onCancel} | ||
onExited={onCancel} | ||
show={props.visible} | ||
> | ||
<div> | ||
Are you sure you want to release this legal hold? All data | ||
associated with it will immediately be deleted and cannot be recovered. | ||
</div> | ||
</GenericModal> | ||
); | ||
}; | ||
|
||
export default ConfirmRelease; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters