55import BAINotificationBackgroundProgress from './BAINotificationBackgroundProgress' ;
66import { useToggle } from 'ahooks' ;
77import { Card , List , theme , Typography } from 'antd' ;
8- import { BAIFlex , BAILink , BAINotificationItem , BAIText } from 'backend.ai-ui' ;
8+ import {
9+ BAIFlex ,
10+ BAILink ,
11+ BAINotificationItem ,
12+ BAIText ,
13+ toLocalId ,
14+ } from 'backend.ai-ui' ;
915import dayjs from 'dayjs' ;
1016import * as _ from 'lodash-es' ;
1117import { useTranslation } from 'react-i18next' ;
1218import { graphql , useFragment } from 'react-relay' ;
1319import { useNavigate } from 'react-router-dom' ;
14- import { BAIVirtualFolderNodeNotificationItemFragment $key } from 'src/__generated__/BAIVirtualFolderNodeNotificationItemFragment .graphql' ;
20+ import { BAIVFolderNotificationItemFragment $key } from 'src/__generated__/BAIVFolderNotificationItemFragment .graphql' ;
1521import {
1622 NotificationState ,
1723 useSetBAINotification ,
1824} from 'src/hooks/useBAINotification' ;
1925
20- interface BAIVirtualFolderNodeNotificationItemProps {
26+ interface BAIVFolderNotificationItemProps {
2127 notification : NotificationState ;
22- virtualFolderNodeFrgmt : BAIVirtualFolderNodeNotificationItemFragment $key | null ;
28+ vfolderFrgmt : BAIVFolderNotificationItemFragment $key | null ;
2329 showDate ?: boolean ;
2430}
2531
26- const BAIVirtualFolderNodeNotificationItem : React . FC <
27- BAIVirtualFolderNodeNotificationItemProps
28- > = ( { notification, virtualFolderNodeFrgmt, showDate } ) => {
32+ const BAIVFolderNotificationItem : React . FC < BAIVFolderNotificationItemProps > = ( {
33+ notification,
34+ vfolderFrgmt,
35+ showDate,
36+ } ) => {
2937 'use memo' ;
3038
3139 const navigate = useNavigate ( ) ;
@@ -37,16 +45,19 @@ const BAIVirtualFolderNodeNotificationItem: React.FC<
3745
3846 const node = useFragment (
3947 graphql `
40- fragment BAIVirtualFolderNodeNotificationItemFragment on VirtualFolderNode {
41- row_id
48+ fragment BAIVFolderNotificationItemFragment on VFolder {
4249 id
43- name
44- status
50+ metadata {
51+ name
52+ }
4553 }
4654 ` ,
47- virtualFolderNodeFrgmt ,
55+ vfolderFrgmt ,
4856 ) ;
4957
58+ const folderName = node ?. metadata ?. name ;
59+ const folderLocalId = node ?. id ? toLocalId ( node . id ) : undefined ;
60+
5061 return (
5162 node && (
5263 < BAINotificationItem
@@ -57,15 +68,15 @@ const BAIVirtualFolderNodeNotificationItem: React.FC<
5768 style = { {
5869 fontWeight : 'normal' ,
5970 } }
60- title = { node . name || '' }
71+ title = { folderName || '' }
6172 onClick = { ( ) => {
6273 navigate (
63- `/data${ node . row_id ? `?${ new URLSearchParams ( { folder : node . row_id } ) . toString ( ) } ` : '' } ` ,
74+ `/data${ folderLocalId ? `?${ new URLSearchParams ( { folder : folderLocalId } ) . toString ( ) } ` : '' } ` ,
6475 ) ;
6576 closeNotification ( notification . key ) ;
6677 } }
6778 >
68- { node . name }
79+ { folderName }
6980 </ BAILink >
7081 </ BAIText >
7182 }
@@ -138,4 +149,4 @@ const BAIVirtualFolderNodeNotificationItem: React.FC<
138149 ) ;
139150} ;
140151
141- export default BAIVirtualFolderNodeNotificationItem ;
152+ export default BAIVFolderNotificationItem ;
0 commit comments