diff --git a/admin-frontend/src/App.tsx b/admin-frontend/src/App.tsx
index 65f9823..6a5063b 100644
--- a/admin-frontend/src/App.tsx
+++ b/admin-frontend/src/App.tsx
@@ -10,7 +10,6 @@ import WeightConfig from './features/weightConfig/WeightManager';
import Home from './pages/Home';
import Unauthed from './pages/Unauthed';
import CookieManager from './features/cookieManager/CookieManager';
-import CookieTargetManager from './features/cookieTargetManager/CookieTargetManager';
function App() {
const dispatch = useAppDispatch();
@@ -53,8 +52,8 @@ function App() {
element: ,
},
{
- path: 'cookie/:cookieId',
- element: ,
+ path: 'cookie/:siteName',
+ element: ,
},
],
},
diff --git a/admin-frontend/src/features/cookieManager/CookieManager.tsx b/admin-frontend/src/features/cookieManager/CookieManager.tsx
index 855e327..c09f942 100644
--- a/admin-frontend/src/features/cookieManager/CookieManager.tsx
+++ b/admin-frontend/src/features/cookieManager/CookieManager.tsx
@@ -1,118 +1,53 @@
-import React, { useState } from 'react';
+import React from 'react';
import {
- Button,
- Card, Descriptions, Grid, List, Popconfirm, Popover, Typography,
+ Table, TableColumnProps, Typography,
} from '@arco-design/web-react';
-import { Link } from 'react-router-dom';
-import { IconDelete, IconEdit } from '@arco-design/web-react/icon';
-import { selectSiteConf } from '../globalConf/globalConfSlice';
-import { useAppSelector } from '../../app/hooks';
-import { Cookie, SiteConfig } from '../../utils/type';
-import { useGetCookiesQuery, useDeleteCookieMutation } from './cookieConfigSlice';
-import CookieModal from './CookieModal';
+import { useParams } from 'react-router-dom';
+
import './CookieManager.css';
-interface CookieSite {
- site: SiteConfig;
- cookies: Cookie[];
-}
-
export default function CookieManager() {
- const siteConf = useAppSelector(selectSiteConf);
- const { data: cookieDict } = useGetCookiesQuery();
- const cookiesList = cookieDict ? Object.values(cookieDict) : [];
- const cookieSite = Object.values(siteConf).filter((site) => site.enable_cookie);
- const cookieSiteList: CookieSite[] = cookieSite.map((site) => ({
- site,
- cookies: cookiesList.filter((cookie) => cookie.site_name === site.name),
- }));
- const [showModal, setShowModal] = useState(false);
- const [siteName, setSiteName] = useState('');
- const [deleteCookie] = useDeleteCookieMutation();
+ const { siteName } = useParams();
+
+ let data = [
+ {
+ id: 3,
+ site_name: 'rss',
+ friendly_name: 'rss [{"ewqe":"e]',
+ last_usage: '1970-01-01T00:00:00',
+ status: '',
+ cd_milliseconds: 10000,
+ is_universal: false,
+ is_anonymous: false,
+ tags: {},
+ },
+ ];
+ if (siteName) {
+ data = data.filter((tSite) => tSite.site_name === siteName);
+ }
+
+ const columns: TableColumnProps[] = [
+ {
+ title: 'ID',
+ dataIndex: 'id',
+ },
+ {
+ title: 'Cookie 名称',
+ dataIndex: 'friendly_name',
+ },
+ {
+ title: '所属站点',
+ dataIndex: 'site_name',
+ },
+
+ ];
+ console.log(data);
- const handleAddCookie = (newSiteName: string) => () => {
- setSiteName(newSiteName);
- setShowModal(true);
- };
- const handleDelCookie = (cookieId: string) => () => {
- deleteCookie({
- cookieId,
- });
- };
return (
<>
Cookie 管理
-
- {cookieSiteList && cookieSiteList.map(({ cookies, site }) => (
-
-
- 添加
-
- )}
- >
-
- {cookies.map((cookie) => (
-
-
-
-
-
-
({
- label: entry[0].toString(),
- value: typeof (entry[1]) === 'object' ? JSON.stringify(entry[1]) : entry[1].toString(),
- }))}
- />
- )}
- >
- {cookie.friendly_name}
-
-
-
-
-
-
-
-
- ))}
-
-
- ))}
-
-
+
>
);
}
diff --git a/admin-frontend/src/pages/Home.tsx b/admin-frontend/src/pages/Home.tsx
index 0332914..cc5eb9b 100644
--- a/admin-frontend/src/pages/Home.tsx
+++ b/admin-frontend/src/pages/Home.tsx
@@ -39,7 +39,7 @@ export default function Home() {
} else if (path.startsWith('/home/groups/')) {
currentKey = 'subs';
} else if (path.startsWith('/home/cookie/')) {
- currentKey = 'cookie';
+ currentKey = path.substring(6);
}
const [selectedTab, changeSelectTab] = useState(currentKey);
@@ -52,6 +52,8 @@ export default function Home() {
navigate('/home/weight');
} else if (tab === 'cookie') {
navigate('/home/cookie');
+ } else if (tab.startsWith('cookie/')) {
+ navigate(`/home/${tab}`);
}
};
@@ -140,7 +142,7 @@ export default function Home() {
)}
>
{Object.values(siteConf).filter((site) => site.enable_cookie).map((site) => (
-