mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-09-20 02:23:38 +08:00
Compare commits
1 Commits
996a3119bf
...
4517f6996b
Author | SHA1 | Date | |
---|---|---|---|
4517f6996b |
@ -1,13 +0,0 @@
|
|||||||
.list-actions-icon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
border-radius: 50%;
|
|
||||||
transition: all 0.1s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-actions-icon:hover {
|
|
||||||
background-color: var(--color-fill-3);
|
|
||||||
}
|
|
@ -4,13 +4,11 @@ import {
|
|||||||
Card, Descriptions, Grid, List, Popconfirm, Popover, Typography,
|
Card, Descriptions, Grid, List, Popconfirm, Popover, Typography,
|
||||||
} from '@arco-design/web-react';
|
} from '@arco-design/web-react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { IconDelete, IconEdit } from '@arco-design/web-react/icon';
|
|
||||||
import { selectSiteConf } from '../globalConf/globalConfSlice';
|
import { selectSiteConf } from '../globalConf/globalConfSlice';
|
||||||
import { useAppSelector } from '../../app/hooks';
|
import { useAppSelector } from '../../app/hooks';
|
||||||
import { Cookie, SiteConfig } from '../../utils/type';
|
import { Cookie, SiteConfig } from '../../utils/type';
|
||||||
import { useGetCookiesQuery, useDeleteCookieMutation } from './cookieConfigSlice';
|
import { useGetCookiesQuery, useDeleteCookieMutation } from './cookieConfigSlice';
|
||||||
import CookieModal from './CookieModal';
|
import CookieModal from './CookieModal';
|
||||||
import './CookieManager.css';
|
|
||||||
|
|
||||||
interface CookieSite {
|
interface CookieSite {
|
||||||
site: SiteConfig;
|
site: SiteConfig;
|
||||||
@ -61,14 +59,9 @@ export default function CookieManager() {
|
|||||||
>
|
>
|
||||||
|
|
||||||
{cookies.map((cookie) => (
|
{cookies.map((cookie) => (
|
||||||
<List
|
<List>
|
||||||
bordered={false}
|
|
||||||
>
|
|
||||||
|
|
||||||
<List.Item
|
<List.Item key={cookie.id}>
|
||||||
key={cookie.id}
|
|
||||||
style={{ padding: '20px 0', borderBottom: '1px solid var(--color-fill-3)' }}
|
|
||||||
>
|
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||||
|
|
||||||
<Popover
|
<Popover
|
||||||
@ -89,20 +82,22 @@ export default function CookieManager() {
|
|||||||
|
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
||||||
<div style={{ display: 'flex' }}>
|
<div>
|
||||||
|
|
||||||
<Link to={`/home/cookie/${cookie.id}`}>
|
<Link to={`/home/cookie/${cookie.id}`}>
|
||||||
<span className="list-actions-icon">
|
<Button
|
||||||
<IconEdit />
|
type="primary"
|
||||||
</span>
|
style={{ marginRight: '10px' }}
|
||||||
|
>
|
||||||
|
关联详情
|
||||||
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`确定删除 Cookie ${cookie.friendly_name} ?`}
|
title={`确定删除 Cookie ${cookie.friendly_name} ?`}
|
||||||
onOk={handleDelCookie(cookie.id.toString())}
|
onOk={handleDelCookie(cookie.id.toString())}
|
||||||
>
|
>
|
||||||
<span className="list-actions-icon">
|
|
||||||
<IconDelete />
|
<Button type="primary" status="danger">删除</Button>
|
||||||
</span>
|
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Button, Space, Table, Typography,
|
Button, Empty, Space, Table, Typography,
|
||||||
} from '@arco-design/web-react';
|
} from '@arco-design/web-react';
|
||||||
import { useDeleteCookieTargetMutation, useGetCookieTargetsQuery } from '../cookieManager/cookieConfigSlice';
|
import { useDeleteCookieTargetMutation, useGetCookieTargetsQuery } from '../cookieManager/cookieConfigSlice';
|
||||||
import { CookieTarget } from '../../utils/type';
|
import { CookieTarget } from '../../utils/type';
|
||||||
@ -11,16 +11,15 @@ export default function () {
|
|||||||
const { cookieId } = useParams();
|
const { cookieId } = useParams();
|
||||||
const { data: cookieTargets } = useGetCookieTargetsQuery(cookieId);
|
const { data: cookieTargets } = useGetCookieTargetsQuery(cookieId);
|
||||||
|
|
||||||
|
console.log(cookieTargets);
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
const [deleteCookieTarget] = useDeleteCookieTargetMutation();
|
const [deleteCookieTarget] = useDeleteCookieTargetMutation();
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
console.log('before', showModal);
|
|
||||||
setShowModal(true);
|
setShowModal(true);
|
||||||
console.log('after', showModal);
|
|
||||||
};
|
};
|
||||||
const handleDelete = (record: CookieTarget) => () => {
|
const handleDelete = (record: CookieTarget) => () => {
|
||||||
deleteCookieTarget({
|
deleteCookieTarget({
|
||||||
cookieId: record.cookieId,
|
cookieId,
|
||||||
target: record.target.target,
|
target: record.target.target,
|
||||||
platformName: record.target.platform_name,
|
platformName: record.target.platform_name,
|
||||||
});
|
});
|
||||||
@ -50,7 +49,7 @@ export default function () {
|
|||||||
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
if (cookieId) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span>
|
<span>
|
||||||
@ -63,12 +62,18 @@ export default function () {
|
|||||||
rowKey={(record: CookieTarget) => `${record.target.platform_name}-${record.target.target}`}
|
rowKey={(record: CookieTarget) => `${record.target.platform_name}-${record.target.target}`}
|
||||||
scroll={{ x: true }}
|
scroll={{ x: true }}
|
||||||
/>
|
/>
|
||||||
|
{
|
||||||
|
cookieTargets && cookieTargets.length > 0
|
||||||
|
&& (
|
||||||
<CookieTargetModal
|
<CookieTargetModal
|
||||||
key={cookieId}
|
|
||||||
visible={showModal}
|
visible={showModal}
|
||||||
setVisible={setShowModal}
|
setVisible={setShowModal}
|
||||||
cookieId={cookieId}
|
cookieId={cookieId}
|
||||||
/>
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
return <Empty />;
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import React
|
import React
|
||||||
from 'react';
|
from 'react';
|
||||||
import { Modal, Select } from '@arco-design/web-react';
|
import { Modal, Select } from '@arco-design/web-react';
|
||||||
import { SubscribeConfig, SubscribeGroupDetail } from '../../utils/type';
|
import { SubscribeGroupDetail } from '../../utils/type';
|
||||||
import { useNewCookieTargetMutation } from '../cookieManager/cookieConfigSlice';
|
import { useNewCookieTargetMutation } from '../cookieManager/cookieConfigSlice';
|
||||||
import { useGetSubsQuery } from '../subsribeConfigManager/subscribeConfigSlice';
|
import { useGetSubsQuery } from '../subsribeConfigManager/subscribeConfigSlice';
|
||||||
|
|
||||||
interface SubscribeModalProp {
|
interface SubscribeModalProp {
|
||||||
cookieId: number;
|
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
setVisible: (arg0: boolean) => void;
|
setVisible: (arg0: boolean) => void;
|
||||||
|
cookieId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ({ cookieId, visible, setVisible }: SubscribeModalProp) {
|
export default function ({ visible, setVisible, cookieId }: SubscribeModalProp) {
|
||||||
const [newCookieTarget] = useNewCookieTargetMutation();
|
const [newCookieTarget] = useNewCookieTargetMutation();
|
||||||
|
|
||||||
const { data: subs } = useGetSubsQuery();
|
const { data: subs } = useGetSubsQuery();
|
||||||
const pureSubs:SubscribeConfig[] = subs ? Object.values(subs)
|
const pureSubs = subs ? Object.values(subs)
|
||||||
.reduce((
|
.reduce((pv:Array, cv:SubscribeGroupDetail) => pv.concat(cv.subscribes), []) : [];
|
||||||
pv:Array<SubscribeConfig>,
|
|
||||||
cv:SubscribeGroupDetail,
|
|
||||||
) => pv.concat(cv.subscribes), []) : [];
|
|
||||||
const [index, setIndex] = React.useState(-1);
|
const [index, setIndex] = React.useState(-1);
|
||||||
const handleSubmit = (idx:number) => {
|
const handleSubmit = (idx:number) => {
|
||||||
const postPromise: ReturnType<typeof newCookieTarget> = newCookieTarget({
|
const postPromise: ReturnType<typeof newCookieTarget> = newCookieTarget({
|
||||||
@ -43,16 +40,18 @@ export default function ({ cookieId, visible, setVisible }: SubscribeModalProp)
|
|||||||
placeholder="选择要关联的 target"
|
placeholder="选择要关联的 target"
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
onChange={setIndex}
|
onChange={setIndex}
|
||||||
|
|
||||||
>
|
>
|
||||||
{pureSubs.length
|
{
|
||||||
&& pureSubs.map((sub, idx) => (
|
pureSubs.map((sub, idx) => (
|
||||||
<Option
|
<Option
|
||||||
key={JSON.stringify(sub)}
|
key={JSON.stringify(sub)}
|
||||||
value={idx}
|
value={idx}
|
||||||
>
|
>
|
||||||
{JSON.stringify(sub)}
|
{JSON.stringify(sub)}
|
||||||
</Option>
|
</Option>
|
||||||
))}
|
))
|
||||||
|
}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import React, { ReactNode, useEffect, useState } from 'react';
|
import React, { ReactNode, useEffect, useState } from 'react';
|
||||||
import { Breadcrumb, Layout, Menu } from '@arco-design/web-react';
|
import { Breadcrumb, Layout, Menu } from '@arco-design/web-react';
|
||||||
import {
|
import { IconRobot, IconDashboard, IconUser } from '@arco-design/web-react/icon';
|
||||||
IconRobot, IconDashboard, IconIdcard,
|
|
||||||
} from '@arco-design/web-react/icon';
|
|
||||||
import './Home.css';
|
import './Home.css';
|
||||||
|
// import SubscribeManager from '../features/subsribeConfigManager/SubscribeManager';
|
||||||
import {
|
import {
|
||||||
Link, Navigate, Outlet, useLocation, useNavigate,
|
Link, Navigate, Outlet, useLocation, useNavigate,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
@ -96,7 +95,7 @@ export default function Home() {
|
|||||||
<Breadcrumb style={{ margin: '16px 0' }}>
|
<Breadcrumb style={{ margin: '16px 0' }}>
|
||||||
<Breadcrumb.Item>
|
<Breadcrumb.Item>
|
||||||
<Link to="/home/cookie">
|
<Link to="/home/cookie">
|
||||||
<IconIdcard />
|
<IconUser />
|
||||||
Cookie 管理
|
Cookie 管理
|
||||||
</Link>
|
</Link>
|
||||||
</Breadcrumb.Item>
|
</Breadcrumb.Item>
|
||||||
@ -117,28 +116,25 @@ export default function Home() {
|
|||||||
>
|
>
|
||||||
<Menu
|
<Menu
|
||||||
defaultSelectedKeys={[selectedTab]}
|
defaultSelectedKeys={[selectedTab]}
|
||||||
onClickMenuItem={(key) => {
|
onClickMenuItem={(key) => { handleTabSelect(key); }}
|
||||||
handleTabSelect(key);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Menu.Item key="groups">
|
<Menu.Item key="groups">
|
||||||
<IconRobot />
|
<IconRobot />
|
||||||
订阅管理
|
订阅管理
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="cookie">
|
|
||||||
<IconIdcard />
|
|
||||||
Cookie 管理
|
|
||||||
</Menu.Item>
|
|
||||||
<Menu.Item key="weight">
|
<Menu.Item key="weight">
|
||||||
<IconDashboard />
|
<IconDashboard />
|
||||||
调度权重
|
调度权重
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
<Menu.Item key="cookie">
|
||||||
|
<IconUser />
|
||||||
|
Cookie 管理
|
||||||
|
</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
</Layout.Sider>
|
</Layout.Sider>
|
||||||
<Layout.Content style={{ padding: '0 1em' }}>
|
<Layout.Content style={{ padding: '0 1em' }}>
|
||||||
<Layout style={{ height: '100%' }}>
|
<Layout style={{ height: '100%' }}>
|
||||||
{breadcrumbContent}
|
{ breadcrumbContent }
|
||||||
<Layout.Content style={{ margin: '0.5em', padding: '2em' }}>
|
<Layout.Content style={{ margin: '0.5em', padding: '2em' }}>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Layout.Content>
|
</Layout.Content>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user