@@ -35,6 +35,7 @@ import { useMessageContext } from '../context/UserMessages';
3535import PostProcessingToast from './Popups/GraphEnhancementDialog/PostProcessingCheckList/PostProcessingToast' ;
3636import { getChunkText } from '../services/getChunkText' ;
3737import ChunkPopUp from './Popups/ChunkPopUp' ;
38+ import { isExpired } from '../utils/Utils' ;
3839
3940const ConfirmationDialog = lazy ( ( ) => import ( './Popups/LargeFilePopUp/ConfirmationDialog' ) ) ;
4041
@@ -55,8 +56,10 @@ const Content: React.FC<ContentProps> = ({
5556 const [ openGraphView , setOpenGraphView ] = useState < boolean > ( false ) ;
5657 const [ inspectedName , setInspectedName ] = useState < string > ( '' ) ;
5758 const [ documentName , setDocumentName ] = useState < string > ( '' ) ;
58- const { setUserCredentials, userCredentials, setConnectionStatus, isGdsActive, isReadOnlyUser } = useCredentials ( ) ;
59+ const { setUserCredentials, userCredentials, setConnectionStatus, isGdsActive, isReadOnlyUser, isGCSActive } =
60+ useCredentials ( ) ;
5961 const [ showConfirmationModal , setshowConfirmationModal ] = useState < boolean > ( false ) ;
62+ const [ showExpirationModal , setshowExpirationModal ] = useState < boolean > ( false ) ;
6063 const [ extractLoading , setextractLoading ] = useState < boolean > ( false ) ;
6164 const [ retryFile , setRetryFile ] = useState < string > ( '' ) ;
6265 const [ retryLoading , setRetryLoading ] = useState < boolean > ( false ) ;
@@ -662,7 +665,8 @@ const Content: React.FC<ContentProps> = ({
662665 const onClickHandler = ( ) => {
663666 const selectedRows = childRef . current ?. getSelectedRows ( ) ;
664667 if ( selectedRows ?. length ) {
665- let selectedLargeFiles : CustomFile [ ] = [ ] ;
668+ const selectedLargeFiles : CustomFile [ ] = [ ] ;
669+ const expiredFiles : CustomFile [ ] = [ ] ;
666670 for ( let index = 0 ; index < selectedRows . length ; index ++ ) {
667671 const parsedData : CustomFile = selectedRows [ index ] ;
668672 if (
@@ -673,9 +677,18 @@ const Content: React.FC<ContentProps> = ({
673677 ) {
674678 selectedLargeFiles . push ( parsedData ) ;
675679 }
680+ if (
681+ parsedData . fileSource === 'local file' &&
682+ ( parsedData . status === 'New' || parsedData . status == 'Ready to Reprocess' ) &&
683+ isExpired ( parsedData ?. createdAt as Date )
684+ ) {
685+ expiredFiles . push ( parsedData ) ;
686+ }
676687 }
677688 if ( selectedLargeFiles . length ) {
678689 setshowConfirmationModal ( true ) ;
690+ } else if ( expiredFiles . length && isGCSActive ) {
691+ setshowExpirationModal ( true ) ;
679692 } else {
680693 handleGenerateGraph ( selectedRows . filter ( ( f ) => f . status === 'New' || f . status === 'Ready to Reprocess' ) ) ;
681694 }
@@ -690,16 +703,34 @@ const Content: React.FC<ContentProps> = ({
690703 }
691704 return false ;
692705 } ) ;
706+ const expiredFiles = filesData . filter ( ( f ) => {
707+ console . log (
708+ f . fileSource === 'local file'
709+ ? { isExpired : isExpired ( f ?. createdAt as Date ) , name : f . name , createdAt : f . createdAt }
710+ : 'Not Local File'
711+ ) ;
712+ if (
713+ f . fileSource === 'local file' &&
714+ ( f . status === 'New' || f . status == 'Ready to Reprocess' ) &&
715+ isExpired ( f ?. createdAt as Date )
716+ ) {
717+ return true ;
718+ }
719+ return false ;
720+ } ) ;
693721 const selectAllNewFiles = filesData . filter ( ( f ) => f . status === 'New' || f . status === 'Ready to Reprocess' ) ;
694722 const stringified = selectAllNewFiles . reduce ( ( accu , f ) => {
695723 const key = f . id ;
696724 // @ts -ignore
697725 accu [ key ] = true ;
698726 return accu ;
699727 } , { } ) ;
728+ console . log ( expiredFiles ) ;
700729 setRowSelection ( stringified ) ;
701730 if ( largefiles . length ) {
702731 setshowConfirmationModal ( true ) ;
732+ } else if ( expiredFiles . length && isGCSActive ) {
733+ setshowExpirationModal ( true ) ;
703734 } else {
704735 handleGenerateGraph ( filesData . filter ( ( f ) => f . status === 'New' || f . status === 'Ready to Reprocess' ) ) ;
705736 }
@@ -729,6 +760,19 @@ const Content: React.FC<ContentProps> = ({
729760 > </ ConfirmationDialog >
730761 </ Suspense >
731762 ) }
763+ { showExpirationModal && filesForProcessing . length && (
764+ < Suspense fallback = { < FallBackDialog /> } >
765+ < ConfirmationDialog
766+ open = { showExpirationModal }
767+ largeFiles = { filesForProcessing }
768+ extractHandler = { handleGenerateGraph }
769+ onClose = { ( ) => setshowExpirationModal ( false ) }
770+ loading = { extractLoading }
771+ selectedRows = { childRef . current ?. getSelectedRows ( ) as CustomFile [ ] }
772+ isLargeDocumentAlert = { false }
773+ > </ ConfirmationDialog >
774+ </ Suspense >
775+ ) }
732776 { showDeletePopUp && (
733777 < DeletePopUp
734778 open = { showDeletePopUp }
0 commit comments