mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
Merge pull request #29 from maggieyyy/main
fix:change route & permission btn & datasource access
This commit is contained in:
@@ -357,7 +357,7 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
key:uuidv4()
|
||||
},
|
||||
APP_MODE === 'pro' &&{
|
||||
path:'dashboard',
|
||||
path:'analytics',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/Dashboard.tsx')),
|
||||
key:uuidv4(),
|
||||
children:[
|
||||
|
||||
@@ -56,8 +56,8 @@ const themeToken = {
|
||||
]),
|
||||
getNavItem(<a>{$t('API 市场')}</a>, 'serviceHub','/serviceHub',<Icon icon="ic:baseline-hub" width="18" height="18"/>,undefined,undefined,'system.workspace.api_market.view'),
|
||||
|
||||
getNavItem($t('仪表盘'), 'mainPage', APP_MODE === 'pro' ? '/dashboard' : '/dashboard/total',<Icon icon="ic:baseline-bar-chart" width="18" height="18"/>,[
|
||||
getNavItem(<a >{$t('运行视图')}</a>, 'dashboard',APP_MODE === 'pro' ? '/dashboard' : '/dashboard/total' ,<ProjectFilled />,undefined,undefined,'system.dashboard.run_view.view'),
|
||||
getNavItem($t('仪表盘'), 'mainPage', APP_MODE === 'pro' ? '/analytics' : '/analytics/total',<Icon icon="ic:baseline-bar-chart" width="18" height="18"/>,[
|
||||
getNavItem(<a >{$t('运行视图')}</a>, 'analytics',APP_MODE === 'pro' ? '/analytics' : '/analytics/total' ,<ProjectFilled />,undefined,undefined,'system.dashboard.run_view.view'),
|
||||
APP_MODE === 'pro' ? getNavItem(<a >{$t('系统拓扑图')}</a>, 'systemrunning','/systemrunning',<ProjectFilled />,undefined,undefined,'system.dashboard.systemrunning.view') : null,
|
||||
],undefined,'system.dashboard.run_view.view'),
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import { Tooltip } from "antd";
|
||||
import { Button, Tooltip, Upload } from "antd";
|
||||
import { ReactElement, cloneElement, useEffect, useMemo, useState } from "react";
|
||||
import { useGlobalContext } from "../../contexts/GlobalStateContext";
|
||||
import { PERMISSION_DEFINITION } from "@common/const/permissions";
|
||||
@@ -37,7 +37,7 @@ const WithPermission = ({access, tooltip, children,disabled, showDisabled = true
|
||||
{editAccess && disabled && <Tooltip title={tooltip}>
|
||||
{ cloneElement(children, {disabled:true})}
|
||||
</Tooltip>}
|
||||
{!editAccess && (children?.type?.displayName !== 'Button' && children?.type?.displayName !== 'Upload' && showDisabled ) && <Tooltip title={tooltip ?? $t("暂无操作权限,请联系管理员分配。")}>
|
||||
{!editAccess && (children?.type !== Button && children?.type !== Upload && showDisabled ) && <Tooltip title={tooltip ?? $t("暂无操作权限,请联系管理员分配。")}>
|
||||
{ cloneElement(children, {disabled:true})}
|
||||
</Tooltip>}
|
||||
|
||||
|
||||
@@ -145,12 +145,12 @@ export const PERMISSION_DEFINITION = [
|
||||
}
|
||||
},
|
||||
"system.devops.data_source.view":{
|
||||
"grented":{
|
||||
"granted":{
|
||||
"anyOf":[{"backend":['system.devops.data_source.view']}]
|
||||
}
|
||||
},
|
||||
"system.devops.data_source.edit":{
|
||||
"grented":{
|
||||
"granted":{
|
||||
"anyOf":[{"backend":['system.devops.data_source.manager']}]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -358,7 +358,7 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
key:uuidv4()
|
||||
},
|
||||
{
|
||||
path:'dashboard',
|
||||
path:'analytics',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/Dashboard.tsx')),
|
||||
key:uuidv4(),
|
||||
children:[
|
||||
|
||||
@@ -90,7 +90,7 @@ const QuickGuideContent = ({changeGuideShow}:{changeGuideShow:Dispatch<SetStateA
|
||||
gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 0fr))',
|
||||
gridAutoRows: '1fr'
|
||||
}}>
|
||||
<Card title={$t("运行视图")} className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible cursor-pointer w-[300px] transition duration-500 hover:shadow-[0_5px_20px_0_rgba(0,0,0,0.15)] hover:scale-[1.05]" classNames={{header:'border-b-[0px] p-[20px] pb-[10px] text-[14px] font-normal', body:"p-[20px] pt-0 text-[12px] text-[#666]"}} onClick={()=>{window.open('https://docs.apipark.com/docs/quick/','_blank')}}>
|
||||
<Card title={$t("运行视图")} className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible cursor-pointer w-[300px] transition duration-500 hover:shadow-[0_5px_20px_0_rgba(0,0,0,0.15)] hover:scale-[1.05]" classNames={{header:'border-b-[0px] p-[20px] pb-[10px] text-[14px] font-normal', body:"p-[20px] pt-0 text-[12px] text-[#666]"}} onClick={()=>{window.open('https://docs.apipark.com/docs/quick/pre-work/monitor','_blank')}}>
|
||||
<span className="">{$t('仪表盘中提供了多种统计图表,帮助我们了解 API 的运行情况。')}</span>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -52,22 +52,22 @@ const SystemConfig = forwardRef<SystemConfigHandle>((_,ref) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.size > MAX_SIZE) {
|
||||
try {
|
||||
const compressedBase64 = await compressImage(file, MAX_SIZE);
|
||||
setImageBase64(`data:${file.type};base64,${compressedBase64}`);
|
||||
form.setFieldValue('logo', `data:${file.type};base64,${compressedBase64}`);
|
||||
} catch (error) {
|
||||
console.error('压缩图片时出错', error);
|
||||
}
|
||||
} else {
|
||||
// if (file.size > MAX_SIZE) {
|
||||
// try {
|
||||
// const compressedBase64 = await compressImage(file, MAX_SIZE);
|
||||
// setImageBase64(`data:${file.type};base64,${compressedBase64}`);
|
||||
// form.setFieldValue('logo', `data:${file.type};base64,${compressedBase64}`);
|
||||
// } catch (error) {
|
||||
// console.error('压缩图片时出错', error);
|
||||
// }
|
||||
// } else {
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e: ProgressEvent<FileReader>) => {
|
||||
setImageBase64(e.target?.result as string);
|
||||
form.setFieldValue('logo', e.target?.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
// }
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ const SystemInsideRouterList:FC = ()=>{
|
||||
const [curApi, setCurApi] = useState<SystemApiTableListItem>()
|
||||
|
||||
const getRoutesList = (): Promise<{ data: SystemApiTableListItem[], success: boolean }>=> {
|
||||
//console.log(sorter, filter)
|
||||
if(!tableHttpReload){
|
||||
setTableHttpReload(true)
|
||||
return Promise.resolve({
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function DashboardTabPage(){
|
||||
return (<>
|
||||
{APP_MODE === 'pro' ? <Tabs activeKey={activeKey} onChange={(val)=>{
|
||||
setActiveKey(val);
|
||||
navigateTo(`/dashboard/${val === 'total' ? val :`${val}/list`}`)
|
||||
navigateTo(`/analytics/${val === 'total' ? val :`${val}/list`}`)
|
||||
}}
|
||||
items={monitorTabItems} className="h-auto mt-[6px]" size="small" tabBarStyle={{paddingLeft:'10px',marginTop:'0px',marginBottom:'0px'}} />
|
||||
: <Outlet />} </>)
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function DashboardTotal() {
|
||||
// ...跳转到详情页...
|
||||
const { start:startTime, end:endTime, clusters} = body
|
||||
navigateTo(
|
||||
`/dashboard/${type}/list?${objectToSearchParameters({id:val.id,clusters:clusters || undefined, start: startTime?.toString(), end: endTime?.toString(), name:val.name}).toString()}`)
|
||||
`/analytics/${type}/list?${objectToSearchParameters({id:val.id,clusters:clusters || undefined, start: startTime?.toString(), end: endTime?.toString(), name:val.name}).toString()}`)
|
||||
};
|
||||
|
||||
return <MonitorTotalPage fetchPieData={fetchPieData} fetchInvokeData={fetchInvokeData} fetchMessageData={fetchMessageData} fetchTableData={fetchTableData} goToDetail={goToDetail}/>
|
||||
|
||||
Reference in New Issue
Block a user