feat: 参考原型图 ui优化提交 企业端-企业中心 相关的页面
This commit is contained in:
@@ -17,7 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { Button, Empty, Tag } from '@/components/ui';
|
||||
import { Button, Card, Empty, Tag, Typography } from 'antd';
|
||||
import { Cable, LockKeyhole } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../../helpers/api';
|
||||
@@ -26,8 +26,14 @@ import {
|
||||
PageGuideDrawer,
|
||||
PageGuideTrigger,
|
||||
} from '../../components/common/PageGuide';
|
||||
import './org-connectors.css';
|
||||
import OrgBreadcrumb from './components/OrgBreadcrumb';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import './org-my-capabilities.css';
|
||||
|
||||
const confirmationLabels = {
|
||||
never: '无需确认',
|
||||
write: '写操作前确认',
|
||||
always: '每次调用都确认',
|
||||
};
|
||||
|
||||
const OrgMyConnectors = ({ orgId }) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -109,33 +115,58 @@ const OrgMyConnectors = ({ orgId }) => {
|
||||
],
|
||||
});
|
||||
return (
|
||||
<main className='org-connector-page'>
|
||||
<header className='org-connector-hero'>
|
||||
<div>
|
||||
<OrgBreadcrumb current={t('我的业务系统授权')} />
|
||||
<h1>{t('我的业务系统授权')}</h1>
|
||||
<p>{t('查看专家在任务中可代表你调用的业务系统、方法和确认策略。')}</p>
|
||||
</div>
|
||||
<div className='org-connector-actions'>
|
||||
<PageGuideTrigger guide={guide} />
|
||||
</div>
|
||||
</header>
|
||||
<main className='uc-page org-capabilities-page'>
|
||||
<OrgPageHeader
|
||||
title={t('我的业务系统授权')}
|
||||
subtitle={t('查看专家在任务中可代表你调用的业务系统、方法和确认策略。')}
|
||||
actions={<PageGuideTrigger guide={guide} />}
|
||||
/>
|
||||
<PageGuideDrawer guide={guide} />
|
||||
{loadError ? (
|
||||
<Empty title={t('授权列表加载失败')} description={loadError} />
|
||||
<Card>
|
||||
<Empty
|
||||
description={
|
||||
<>
|
||||
<Typography.Text>{t('授权列表加载失败')}</Typography.Text>
|
||||
<Typography.Paragraph type='secondary'>
|
||||
{loadError}
|
||||
</Typography.Paragraph>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Card>
|
||||
) : items.length === 0 ? (
|
||||
<Empty
|
||||
title={t('当前没有 Connector 授权')}
|
||||
description={t('管理员发布授权并覆盖到你后会显示在这里。')}
|
||||
/>
|
||||
<Card>
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={
|
||||
<>
|
||||
<Typography.Text>
|
||||
{t('当前没有 Connector 授权')}
|
||||
</Typography.Text>
|
||||
<Typography.Paragraph type='secondary'>
|
||||
{t('管理员发布授权并覆盖到你后会显示在这里。')}
|
||||
</Typography.Paragraph>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Card>
|
||||
) : (
|
||||
<section className='org-connector-grid'>
|
||||
<section className='org-capability-grid'>
|
||||
{items.map((item) => (
|
||||
<article className='org-connector-card' key={item.grant.id}>
|
||||
<div className='org-connector-card-top'>
|
||||
<span className='org-connector-icon'>
|
||||
<Card className='org-capability-card' key={item.grant.id}>
|
||||
<div className='org-capability-card-head'>
|
||||
<span className='org-capability-icon'>
|
||||
<Cable size={20} />
|
||||
</span>
|
||||
<div className='org-capability-card-name'>
|
||||
<Typography.Title level={5}>
|
||||
{item.connector_name}
|
||||
</Typography.Title>
|
||||
<Typography.Text type='secondary'>
|
||||
{item.definition_name}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<Tag
|
||||
color={
|
||||
item.grant.access_level === 'write' ? 'orange' : 'green'
|
||||
@@ -144,23 +175,29 @@ const OrgMyConnectors = ({ orgId }) => {
|
||||
{item.grant.access_level}
|
||||
</Tag>
|
||||
</div>
|
||||
<h3>{item.connector_name}</h3>
|
||||
<p>{item.definition_name}</p>
|
||||
<div className='org-connector-tags'>
|
||||
<div className='org-capability-methods'>
|
||||
{item.methods.map((method) => (
|
||||
<Tag key={method}>{method}</Tag>
|
||||
))}
|
||||
</div>
|
||||
<p>
|
||||
<LockKeyhole size={14} /> {t('确认策略')}:{' '}
|
||||
{item.grant.confirmation_policy}
|
||||
</p>
|
||||
<Button disabled={!item.revocable}>
|
||||
{item.revocable
|
||||
? t('撤销个人委托')
|
||||
: t('企业服务账号由管理员管理')}
|
||||
</Button>
|
||||
</article>
|
||||
<div className='org-capability-confirmation'>
|
||||
<LockKeyhole size={14} aria-hidden='true' />
|
||||
<Typography.Text type='secondary'>
|
||||
{t('确认策略')}:{' '}
|
||||
{t(
|
||||
confirmationLabels[item.grant.confirmation_policy] ||
|
||||
item.grant.confirmation_policy,
|
||||
)}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div className='org-capability-card-footer'>
|
||||
<Button disabled={!item.revocable}>
|
||||
{item.revocable
|
||||
? t('撤销个人委托')
|
||||
: t('企业服务账号由管理员管理')}
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user