Merge pull request #137 from APIParkLab/feature/v1.3/mj

fix: role list scroll bug and add translation
This commit is contained in:
Maggie
2024-11-28 10:47:44 +08:00
committed by GitHub
12 changed files with 55 additions and 24 deletions
@@ -147,7 +147,7 @@ export const PublishApprovalModalContent = forwardRef<PublishApprovalModalHandle
title: typeof x.title === 'string' ? $t(x.title) : x.title,
...(x.dataIndex === 'status' ? {
render:(_,entity)=>(
entity.status === 0 ? '正常' : '无效')
entity.status === 0 ? $t('正常') : $t('无效'))
}:{})
}
}),[state.language])
@@ -446,7 +446,40 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => {
export const useGlobalContext = () => {
const context = useContext(GlobalContext);
if (!context) {
throw new Error('useGlobalContext must be used within a GlobalProvider');
console.warn('useGlobalContext must be used within a GlobalProvider. Returning default context.');
return {
state: {
isAuthenticated: false,
userData: null,
version: '1.0.0',
updateDate: '',
powered: '',
mainPage: '',
language: 'en-US',
pluginsLoaded: false,
},
dispatch: () => {},
accessData: new Map(),
pluginAccessDictionary: {},
menuList: [],
getGlobalAccessData: async () => ({ access: [] }),
getTeamAccessData: () => {},
getPluginAccessDictionary: () => {},
getMenuList: () => {},
resetAccess: () => {},
cleanTeamAccessData: () => {},
checkPermission: () => false,
teamDataFlushed: false,
accessInit: false,
aiConfigFlushed: false,
setAiConfigFlushed: () => {},
routeConfig: [],
setRouterConfig: () => {},
addRouteConfig: () => {},
fetchData: async () => ({}),
$t: (key: string) => key,
};
}
return context;
};
@@ -45,6 +45,8 @@
"成功": "K43fcaf94",
"上线失败": "Kc71c6a9",
"失败": "K56c686f8",
"正常": "Ke039b9b5",
"无效": "K1da86266",
"申请系统": "K1ff96ff",
"所属团队": "K9bf855d6",
"申请人": "K11b994ed",
@@ -486,7 +488,6 @@
"集群": "Ke93d36ed",
"修改配置": "K877985b7",
"设置访问 API 的集群,让 API 在分布式环境中稳定运行,并且能够根据业务需求进行灵活扩展和优化。": "Kdf66a675",
"正常": "Ke039b9b5",
"异常": "K23a3bd72",
"私有网络": "Ke1b1865",
"公共网络": "K4786c57c",
@@ -746,6 +746,6 @@
"Kc4391744": "Attribute Value",
"K678e13fc": "Configure (0)",
"K508d8bf4": "Integration Address",
"K67f4e9bb": "The domain name for obtaining API market documentation information when integrating with external platforms"
"K67f4e9bb": "The domain name for obtaining API market documentation information when integrating with external platforms",
"K1da86266": "Invalid"
}
@@ -767,7 +767,8 @@
"K7ca9a795": "属性名",
"Kc4391744": "属性値",
"K678e13fc": "設定 (0)",
"K508d8bf4": "統合アドレス",
"K67f4e9bb": "外部プラットフォームと統合する際に、API市場のドキュメント情報を取得するためのドメイン名"
"K508d8bf4": "統合アドレス",
"K67f4e9bb": "外部プラットフォームと統合する際に、API市場のドキュメント情報を取得するためのドメイン名",
"K1da86266": "無効"
}
@@ -1,4 +1 @@
{
"K508d8bf4": "集成地址",
"K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名"
}
{}
@@ -1,4 +1 @@
{
"K508d8bf4": "集成地址",
"K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名"
}
{}
@@ -2,6 +2,7 @@
"K630c9e6d": "APIPark",
"Ka3e9f580": "发布名称",
"Kb2480682": "策略列表",
"K1da86266": "无效",
"K76036e25": "HTTP 请求头",
"K44607e3f": "全等匹配",
"Kc287500a": "前缀匹配",
@@ -1,4 +1 @@
{
"K508d8bf4": "集成地址",
"K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名"
}
{}
@@ -768,6 +768,6 @@
"Kc4391744": "屬性值",
"K678e13fc": "配置(0)",
"K508d8bf4": "集成地址",
"K67f4e9bb": "與外部平台集成時,用於獲取 API 市場文檔信息的域名"
"K67f4e9bb": "與外部平台集成時,用於獲取 API 市場文檔信息的域名",
"K1da86266": "無效"
}
@@ -39,7 +39,7 @@ const DataMaskingConfig = forwardRef<DataMaskingConfigHandle>((_,ref) => {
form.setFieldsValue({
...data.strategy,
type:'data-masking',
filters:data.strategy.filters.map((x)=>{x._eoKey = uuidv4(); return x})
filters:data.strategy.filters?.map((x)=>{x._eoKey = uuidv4(); return x})
})
},0)
}else{
@@ -125,9 +125,10 @@ const RoleList = ()=>{
pageTitle={$t('角色')}
description={$t("设置角色的权限范围。")}
showBorder={false}
scrollPage={false}
scrollPage={true}
>
<div className="pr-PAGE_INSIDE_X">
<div className="pr-PAGE_INSIDE_X overflow-y-scroll h-full">
<div>
<h3 className="mt-0">{$t('系统级别角色')}</h3>
<PageList
id="global_role"
@@ -145,6 +146,8 @@ const RoleList = ()=>{
onRowClick={(row:RoleTableListItem)=> navigateTo(`/role/system/config/${row.id}`)}
tableClickAccess="system.organization.role.system.edit"
/>
</div>
<div>
<h3 className=" pt-btnbase ">{$t('团队级别角色')}</h3>
<PageList
id="global_role"
@@ -163,6 +166,7 @@ const RoleList = ()=>{
tableClickAccess="system.organization.role.team.edit"
/>
</div>
</div>
</InsidePage>
</>)
}