feat(org): expose enterprise drawing and task logs
This commit is contained in:
@@ -81,7 +81,6 @@ const TaskLogsActions = ({
|
||||
{ key: 'channel_name', title: t('渠道名称') },
|
||||
]
|
||||
: []),
|
||||
{ key: 'platform', title: t('平台') },
|
||||
{ key: 'action', title: t('类型') },
|
||||
{
|
||||
key: 'model',
|
||||
|
||||
@@ -34,7 +34,6 @@ import {
|
||||
Video,
|
||||
Sparkles,
|
||||
Timer,
|
||||
Image as ImageIcon,
|
||||
ImagePlus,
|
||||
Coins,
|
||||
Cpu,
|
||||
@@ -47,7 +46,6 @@ import {
|
||||
IMAGE_ACTION_GENERATE,
|
||||
IMAGE_ACTION_EDIT,
|
||||
} from '../../../constants/common.constant';
|
||||
import { CHANNEL_OPTIONS } from '../../../constants/channel.constants';
|
||||
import { renderQuota } from '../../../helpers';
|
||||
|
||||
// 仅保留与下方 COLOR_CONFIG 一一对应的色值,避免 amber/lime/violet/teal/indigo/light-blue
|
||||
@@ -230,34 +228,6 @@ const renderType = (type, t) => {
|
||||
);
|
||||
};
|
||||
|
||||
const renderPlatform = (platform, t) => {
|
||||
let option = CHANNEL_OPTIONS.find(
|
||||
(opt) => String(opt.value) === String(platform),
|
||||
);
|
||||
if (option) {
|
||||
return (
|
||||
<CustomTag
|
||||
icon={Video}
|
||||
label={option.label}
|
||||
colorKey={option.color || 'cyan'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (platform === 'suno') {
|
||||
return <CustomTag icon={Music} label='Suno' colorKey='green' />;
|
||||
}
|
||||
if (platform === 'image') {
|
||||
return <CustomTag icon={ImageIcon} label={t('图片')} colorKey='cyan' />;
|
||||
}
|
||||
if (platform === 'video') {
|
||||
return <CustomTag icon={Video} label={t('视频')} colorKey='blue' />;
|
||||
}
|
||||
if (platform === 'mj') {
|
||||
return <CustomTag icon={Sparkles} label='Midjourney' colorKey='purple' />;
|
||||
}
|
||||
return <CustomTag icon={HelpCircle} label={t('未知')} colorKey='grey' />;
|
||||
};
|
||||
|
||||
const renderStatus = (type, t) => {
|
||||
const statusConfig = {
|
||||
SUCCESS: { icon: CheckCircle, label: t('成功'), color: 'green' },
|
||||
@@ -292,6 +262,7 @@ export const getTaskLogsColumns = ({
|
||||
copyText,
|
||||
openContentModal,
|
||||
isAdminUser,
|
||||
isRootUser = false,
|
||||
openVideoModal,
|
||||
}) => {
|
||||
return [
|
||||
@@ -344,14 +315,6 @@ export const getTaskLogsColumns = ({
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: COLUMN_KEYS.PLATFORM,
|
||||
title: t('平台'),
|
||||
dataIndex: 'platform',
|
||||
render: (text, record, index) => {
|
||||
return <div>{renderPlatform(text, t)}</div>;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: COLUMN_KEYS.TYPE,
|
||||
title: t('类型'),
|
||||
@@ -394,10 +357,16 @@ export const getTaskLogsColumns = ({
|
||||
return (
|
||||
<Typography.Text
|
||||
ellipsis={{ showTooltip: true }}
|
||||
onClick={() => {
|
||||
openContentModal(JSON.stringify(record, null, 2));
|
||||
}}
|
||||
className='cursor-pointer hover:text-blue-500 dark:hover:text-blue-400 transition-colors font-mono text-xs'
|
||||
onClick={
|
||||
isRootUser
|
||||
? () => openContentModal(JSON.stringify(record, null, 2))
|
||||
: undefined
|
||||
}
|
||||
className={
|
||||
isRootUser
|
||||
? 'cursor-pointer hover:text-blue-500 dark:hover:text-blue-400 transition-colors font-mono text-xs'
|
||||
: 'font-mono text-xs'
|
||||
}
|
||||
>
|
||||
{text}
|
||||
</Typography.Text>
|
||||
|
||||
@@ -54,6 +54,7 @@ const TaskLogsFilters = ({
|
||||
isAdminUser,
|
||||
getFreshInitValues,
|
||||
usageRecordMode = false,
|
||||
hideDateRange = false,
|
||||
t,
|
||||
}) => {
|
||||
const SearchIcon = usageRecordMode ? SearchCheck : Search;
|
||||
@@ -98,29 +99,31 @@ const TaskLogsFilters = ({
|
||||
|
||||
{/* 搜索字段网格 */}
|
||||
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3'>
|
||||
{/* 时间选择器 */}
|
||||
<div className='col-span-1 lg:col-span-2'>
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-cyan-500/20 to-blue-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 blur-sm' />
|
||||
<div className='relative'>
|
||||
<Form.DatePicker
|
||||
field='dateRange'
|
||||
className='w-full'
|
||||
type='dateTimeRange'
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
prefix={<InputPrefix icon={Calendar} />}
|
||||
presets={DATE_RANGE_PRESETS.map((preset) => ({
|
||||
text: t(preset.text),
|
||||
start: preset.start(),
|
||||
end: preset.end(),
|
||||
}))}
|
||||
/>
|
||||
{/* 时间选择器:企业页复用上方消费记录的已提交时间范围 */}
|
||||
{!hideDateRange && (
|
||||
<div className='col-span-1 lg:col-span-2'>
|
||||
<div className='relative group'>
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-cyan-500/20 to-blue-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 blur-sm' />
|
||||
<div className='relative'>
|
||||
<Form.DatePicker
|
||||
field='dateRange'
|
||||
className='w-full'
|
||||
type='dateTimeRange'
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
prefix={<InputPrefix icon={Calendar} />}
|
||||
presets={DATE_RANGE_PRESETS.map((preset) => ({
|
||||
text: t(preset.text),
|
||||
start: preset.start(),
|
||||
end: preset.end(),
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 任务 ID */}
|
||||
<div className='relative group'>
|
||||
|
||||
@@ -41,6 +41,7 @@ const TaskLogsTable = (taskLogsData) => {
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
} = taskLogsData;
|
||||
@@ -54,8 +55,17 @@ const TaskLogsTable = (taskLogsData) => {
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
});
|
||||
}, [t, COLUMN_KEYS, copyText, openContentModal, openVideoModal, isAdminUser]);
|
||||
}, [
|
||||
t,
|
||||
COLUMN_KEYS,
|
||||
copyText,
|
||||
openContentModal,
|
||||
openVideoModal,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
]);
|
||||
|
||||
// Filter columns based on visibility settings
|
||||
const getVisibleColumns = () => {
|
||||
|
||||
@@ -28,8 +28,19 @@ import { useTaskLogsData } from '../../../hooks/task-logs/useTaskLogsData';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { createCardProPagination } from '../../../helpers/utils';
|
||||
|
||||
const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
const taskLogsData = useTaskLogsData();
|
||||
const TaskLogsPage = ({
|
||||
usageRecordMode = false,
|
||||
organizationMode = false,
|
||||
sharedStartTimestamp,
|
||||
sharedEndTimestamp,
|
||||
sharedFilterRevision = 0,
|
||||
}) => {
|
||||
const taskLogsData = useTaskLogsData({
|
||||
organizationMode,
|
||||
sharedStartTimestamp,
|
||||
sharedEndTimestamp,
|
||||
sharedFilterRevision,
|
||||
});
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
return (
|
||||
@@ -81,6 +92,7 @@ const TaskLogsPage = ({ usageRecordMode = false }) => {
|
||||
<TaskLogsFilters
|
||||
{...taskLogsData}
|
||||
usageRecordMode={usageRecordMode}
|
||||
hideDateRange={taskLogsData.usesSharedDateRange}
|
||||
/>
|
||||
}
|
||||
paginationArea={createCardProPagination({
|
||||
|
||||
@@ -31,6 +31,7 @@ const ColumnSelectorModal = ({
|
||||
initDefaultColumns,
|
||||
COLUMN_KEYS,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
copyText,
|
||||
openContentModal,
|
||||
usageRecordMode = false,
|
||||
@@ -43,6 +44,7 @@ const ColumnSelectorModal = ({
|
||||
copyText,
|
||||
openContentModal,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
});
|
||||
|
||||
// 计算"全选"状态时应忽略的 key:当前角色下不可见的管理员专属列
|
||||
|
||||
Reference in New Issue
Block a user