1515// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
1717import React , { useState , useEffect } from "react" ;
18+ import { connect } from "react-redux" ;
1819import get from "lodash/get" ;
1920import * as reactMoment from "react-moment" ;
2021import clsx from "clsx" ;
@@ -33,9 +34,11 @@ import {
3334 containerForHeader ,
3435 searchField ,
3536} from "../../../../Common/FormComponents/common/styleLibrary" ;
36- import history from "../../../../../../history" ;
37+ import { IFileInfo } from "./types" ;
38+ import { removeRouteLevel } from "../../../../ObjectBrowser/actions" ;
3739import { Route } from "../../../../ObjectBrowser/reducers" ;
3840import { download } from "../utils" ;
41+ import history from "../../../../../../history" ;
3942import api from "../../../../../../common/api" ;
4043import PageHeader from "../../../../Common/PageHeader/PageHeader" ;
4144import ShareIcon from "../../../../../../icons/ShareIcon" ;
@@ -46,10 +49,9 @@ import PencilIcon from "../../../../Common/TableWrapper/TableActionIcons/PencilI
4649import SetRetention from "./SetRetention" ;
4750import BrowserBreadcrumbs from "../../../../ObjectBrowser/BrowserBreadcrumbs" ;
4851import DeleteObject from "../ListObjects/DeleteObject" ;
49- import { removeRouteLevel } from "../../../../ObjectBrowser/actions" ;
50- import { connect } from "react-redux" ;
5152import AddTagModal from "./AddTagModal" ;
5253import DeleteTagModal from "./DeleteTagModal" ;
54+ import SetLegalHoldModal from "./SetLegalHoldModal" ;
5355
5456const styles = ( theme : Theme ) =>
5557 createStyles ( {
@@ -136,18 +138,6 @@ interface IObjectDetailsProps {
136138 removeRouteLevel : ( newRoute : string ) => any ;
137139}
138140
139- interface IFileInfo {
140- is_latest ?: boolean ;
141- last_modified : string ;
142- legal_hold_status ?: string ;
143- name : string ;
144- retention_mode ?: string ;
145- retention_until_date ?: string ;
146- size ?: string ;
147- tags ?: object ;
148- version_id : string ;
149- }
150-
151141const emptyFile : IFileInfo = {
152142 is_latest : true ,
153143 last_modified : "" ,
@@ -171,6 +161,7 @@ const ObjectDetails = ({
171161 const [ tagModalOpen , setTagModalOpen ] = useState < boolean > ( false ) ;
172162 const [ deleteTagModalOpen , setDeleteTagModalOpen ] = useState < boolean > ( false ) ;
173163 const [ selectedTag , setSelectedTag ] = useState < [ string , string ] > ( [ "" , "" ] ) ;
164+ const [ legalholdOpen , setLegalholdOpen ] = useState < boolean > ( false ) ;
174165 const [ actualInfo , setActualInfo ] = useState < IFileInfo > ( emptyFile ) ;
175166 const [ versions , setVersions ] = useState < IFileInfo [ ] > ( [ ] ) ;
176167 const [ filterVersion , setFilterVersion ] = useState < string > ( "" ) ;
@@ -213,22 +204,18 @@ const ObjectDetails = ({
213204
214205 const openRetentionModal = ( ) => {
215206 setRetentionModalOpen ( true ) ;
216- console . log ( "open retention modal" ) ;
217207 } ;
218208
219209 const closeRetentionModal = ( ) => {
220210 setRetentionModalOpen ( false ) ;
221- console . log ( "close retention modal" ) ;
222211 } ;
223212
224213 const shareObject = ( ) => {
225214 setShareFileModalOpen ( true ) ;
226- console . log ( "share object" ) ;
227215 } ;
228216
229217 const closeShareModal = ( ) => {
230218 setShareFileModalOpen ( false ) ;
231- console . log ( "close share modal" ) ;
232219 } ;
233220
234221 const deleteTag = ( tagKey : string , tagLabel : string ) => {
@@ -272,6 +259,14 @@ const ObjectDetails = ({
272259 }
273260 } ;
274261
262+ const closeLegalholdModal = ( reload : boolean ) => {
263+ setLegalholdOpen ( false ) ;
264+
265+ if ( reload ) {
266+ setLoadObjectData ( true ) ;
267+ }
268+ } ;
269+
275270 const closeDeleteTagModal = ( reloadObjectData : boolean ) => {
276271 setDeleteTagModalOpen ( false ) ;
277272
@@ -325,6 +320,15 @@ const ObjectDetails = ({
325320 selectedTag = { selectedTag }
326321 />
327322 ) }
323+ { legalholdOpen && (
324+ < SetLegalHoldModal
325+ open = { legalholdOpen }
326+ closeModalAndRefresh = { closeLegalholdModal }
327+ objectName = { pathInBucket }
328+ bucketName = { bucketName }
329+ actualInfo = { actualInfo }
330+ />
331+ ) }
328332 < Grid container >
329333 < Grid item xs = { 12 } className = { classes . container } >
330334 < Grid item xs = { 12 } className = { classes . obTitleSection } >
@@ -350,7 +354,7 @@ const ObjectDetails = ({
350354 size = "small"
351355 className = { classes . propertiesIcon }
352356 onClick = { ( ) => {
353- console . log ( "open legal hold modal" ) ;
357+ setLegalholdOpen ( true ) ;
354358 } }
355359 >
356360 < PencilIcon active = { true } />
0 commit comments