Merge #7 into develop_web from feature/20251219_zy
feat(web): api key * feature/20251219_zy: (1 commits) feat(web): api key Signed-off-by: zhaoying <zhaoying@redbearai.com> Merged-by: zhaoying <zhaoying@redbearai.com> CR-link: https://codeup.aliyun.com/redbearai/python/redbear-mem-open/change/7
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { forwardRef, useImperativeHandle, useState } from 'react';
|
||||
import { Switch, Button } from 'antd';
|
||||
import { Switch, Button, Tooltip } from 'antd';
|
||||
import clsx from 'clsx';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { ApiKey, ApiKeyModalRef } from '../types';
|
||||
@@ -51,8 +51,8 @@ const ApiKeyDetailModal = forwardRef<ApiKeyModalRef, { handleCopy: (content: str
|
||||
{ key === 'created_at'
|
||||
? formatDateTime(data[key], 'YYYY-MM-DD HH:mm:ss')
|
||||
: key === 'is_expired'
|
||||
? <Tag>{data[key] ? t('apiKey.inactive') : t('apiKey.active')}</Tag>
|
||||
: String(data[key as keyof ApiKey])
|
||||
? <Tag color={data[key] ? 'error' : 'processing'}>{data[key] ? t('apiKey.inactive') : t('apiKey.active')}</Tag>
|
||||
: <Tooltip title={String(data[key as keyof ApiKey])}>{String(data[key as keyof ApiKey])}</Tooltip>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@@ -91,7 +91,7 @@ const ApiKeyDetailModal = forwardRef<ApiKeyModalRef, { handleCopy: (content: str
|
||||
<div className="rb:flex rb:justify-between rb:gap-5 rb:font-regular rb:text-[14px] rb:mt-3">
|
||||
<span className="rb:text-[#5B6167]">{t(`apiKey.expires_at`)}</span>
|
||||
<span>
|
||||
{data.expires_at ? formatDateTime(data.expires_at as number, 'yyyy-MM-DD') : '-'}
|
||||
{data.expires_at ? formatDateTime(data.expires_at as number, 'YYYY-MM-DD HH:mm:ss') : '-'}
|
||||
</span>
|
||||
</div>
|
||||
</>}
|
||||
|
||||
@@ -72,12 +72,12 @@ const ApiKeyManagement: React.FC = () => {
|
||||
<div key={key} className={clsx("rb:flex rb:justify-between rb:gap-5 rb:font-regular rb:text-[14px]", {
|
||||
'rb:mt-3': index !== 0
|
||||
})}>
|
||||
<span className="rb:text-[#5B6167]">{t(`apiKey.${key}`)}</span>
|
||||
<span>
|
||||
<span className="rb:text-[#5B6167] rb:w-20">{t(`apiKey.${key}`)}</span>
|
||||
<span className="rb:flex-1 rb:text-left rb:py-px rb:rounded rb:font-medium">
|
||||
{ key === 'created_at'
|
||||
? formatDateTime(apiKeyItem[key], 'YYYY-MM-DD HH:mm:ss')
|
||||
: key === 'is_expired'
|
||||
? <Tag>{apiKeyItem[key] ? t('apiKey.inactive') : t('apiKey.active')}</Tag>
|
||||
? <Tag color={apiKeyItem[key] ? 'error' : 'processing'}>{apiKeyItem[key] ? t('apiKey.inactive') : t('apiKey.active')}</Tag>
|
||||
: String(apiKeyItem[key as keyof ApiKey])
|
||||
}
|
||||
</span>
|
||||
|
||||
@@ -45,6 +45,7 @@ const ApiKeyModal = forwardRef<ApiKeyModalRef, ApiKeyModalProps>(({
|
||||
...values,
|
||||
type: application.type,
|
||||
resource_id: application.id,
|
||||
scopes: ['app']
|
||||
})
|
||||
.then(() => {
|
||||
handleClose()
|
||||
|
||||
Reference in New Issue
Block a user