diff --git a/packages/rath-client/src/pages/dataConnection/history/history-list-item.tsx b/packages/rath-client/src/pages/dataConnection/history/history-list-item.tsx index 1ebf902f..64651625 100644 --- a/packages/rath-client/src/pages/dataConnection/history/history-list-item.tsx +++ b/packages/rath-client/src/pages/dataConnection/history/history-list-item.tsx @@ -12,20 +12,20 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - import intl from 'react-intl-universal'; -import { Icon } from '@fluentui/react'; +import { ButtonType, Icon } from '@fluentui/react'; import { observer } from 'mobx-react-lite'; import dayjs from 'dayjs'; import type { FC } from 'react'; import styled from 'styled-components'; -import { Caption1, Card, CardHeader, Text } from '@fluentui/react-components'; +import { Button, Caption1, Card, CardHeader, Text,CardFooter } from '@fluentui/react-components'; // import { MoreHorizontal20Filled } from '@fluentui/react-icons'; import { IDBMeta } from '../../../utils/storage'; import { RathDemoVirtualExt } from '../demo'; import { IDataSourceType } from '../../../global'; import getFileIcon from './get-file-icon'; - +import React from 'react'; +import {deleteStorageByIdInLocal} from '../../../utils/storage' const Desc = styled.p` font-size: 12px; `; @@ -54,6 +54,13 @@ const HistoryListItem: FC = ({ file, rowIndex, colIndex, const ext = file.name.endsWith(RathDemoVirtualExt) ? RathDemoVirtualExt : /\.([^./]+)$/.exec(file.name)?.[1]; const isRathDemo = ext === RathDemoVirtualExt; const name = isRathDemo ? file.name.replace(new RegExp(`\\.${RathDemoVirtualExt.replaceAll(/\./g, '\\.')}$`), '') : file.name; + const handleDelete=(e:React.MouseEvent)=>{ + e?.stopPropagation() + deleteStorageByIdInLocal(file.id).then(() => { + handleRefresh?.(); + }); + } + return ( = ({ file, rowIndex, colIndex, } // action={ + ); }; diff --git a/packages/rath-client/src/pages/dataConnection/history/history-list.tsx b/packages/rath-client/src/pages/dataConnection/history/history-list.tsx index e2c740c6..d6aa409b 100644 --- a/packages/rath-client/src/pages/dataConnection/history/history-list.tsx +++ b/packages/rath-client/src/pages/dataConnection/history/history-list.tsx @@ -124,7 +124,7 @@ const HistoryList: FC = props => { const handleDeleteHistory = useCallback( (id: string) => { deleteDataStorageById(id).then(() => { - fetchDataStorageList(); + fetchDataStorageList(false); }); }, [fetchDataStorageList] @@ -192,15 +192,15 @@ const HistoryList: FC = props => { {group.list.map((file, i) => ( fetchDataStorageList(false)} - /> + appearance={appearance} + key={i} + file={file} + rowIndex={Math.floor(i / colCount) + 1} + colIndex={(i % colCount) + 1} + handleClick={handleLoadHistory} + handleClearClick={handleDeleteHistory} + handleRefresh={() => fetchDataStorageList(false)} + /> ))}