mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-26 16:01:56 +08:00
fix: system logs lack of edit permission
This commit is contained in:
+14
-14
@@ -1,21 +1,21 @@
|
||||
import { LoadingOutlined } from '@ant-design/icons'
|
||||
import { ActionType, ParamsType } from '@ant-design/pro-components'
|
||||
import { DrawerWithFooter } from '@common/components/aoplatform/DrawerWithFooter.tsx'
|
||||
import PageList, { PageProColumns } from '@common/components/aoplatform/PageList.tsx'
|
||||
import TableBtnWithPermission from '@common/components/aoplatform/TableBtnWithPermission.tsx'
|
||||
import WithPermission from '@common/components/aoplatform/WithPermission.tsx'
|
||||
import { BasicResponse, COLUMNS_TITLE, DELETE_TIPS, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const.tsx'
|
||||
import { EntityItem } from '@common/const/type.ts'
|
||||
import { useBreadcrumb } from '@common/contexts/BreadcrumbContext.tsx'
|
||||
import { useGlobalContext } from '@common/contexts/GlobalStateContext.tsx'
|
||||
import { useFetch } from '@common/hooks/http.ts'
|
||||
import { $t } from '@common/locales/index.ts'
|
||||
import { RouterParams } from '@core/components/aoplatform/RenderRoutes.tsx'
|
||||
import { App, Divider, Spin } from 'antd'
|
||||
import { DefaultOptionType } from 'antd/es/cascader'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useLocation, useOutletContext, useParams } from 'react-router-dom'
|
||||
import { useBreadcrumb } from '@common/contexts/BreadcrumbContext.tsx'
|
||||
import { ActionType, ParamsType } from '@ant-design/pro-components'
|
||||
import { RouterParams } from '@core/components/aoplatform/RenderRoutes.tsx'
|
||||
import { DefaultOptionType } from 'antd/es/cascader'
|
||||
import { IntelligentPluginConfig, IntelligentPluginConfigHandle } from './IntelligentPluginConfig.tsx'
|
||||
import { BasicResponse, COLUMNS_TITLE, DELETE_TIPS, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const.tsx'
|
||||
import { useFetch } from '@common/hooks/http.ts'
|
||||
import { EntityItem } from '@common/const/type.ts'
|
||||
import WithPermission from '@common/components/aoplatform/WithPermission.tsx'
|
||||
import TableBtnWithPermission from '@common/components/aoplatform/TableBtnWithPermission.tsx'
|
||||
import { DrawerWithFooter } from '@common/components/aoplatform/DrawerWithFooter.tsx'
|
||||
import { LoadingOutlined } from '@ant-design/icons'
|
||||
import { $t } from '@common/locales/index.ts'
|
||||
import { useGlobalContext } from '@common/contexts/GlobalStateContext.tsx'
|
||||
|
||||
type DynamicTableField = {
|
||||
name: string
|
||||
@@ -233,7 +233,7 @@ export default function IntelligentPluginList() {
|
||||
onClick={() => {
|
||||
openDrawer('edit', entity)
|
||||
}}
|
||||
btnTitle={$t('查看')}
|
||||
btnTitle={$t('查看 ')}
|
||||
/>,
|
||||
<Divider type="vertical" className="mx-0" key="div2" />,
|
||||
<TableBtnWithPermission
|
||||
|
||||
@@ -219,22 +219,22 @@ export const PERMISSION_DEFINITION = [
|
||||
anyOf: [{ backend: ['system.settings.log_configuration.view'] }]
|
||||
}
|
||||
},
|
||||
'system.devops.log_configuration.add': {
|
||||
'system.settings.log_configuration.add': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.log_configuration.manager'] }]
|
||||
}
|
||||
},
|
||||
'system.devops.log_configuration.edit': {
|
||||
'system.settings.log_configuration.edit': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.log_configuration.manager'] }]
|
||||
}
|
||||
},
|
||||
'system.devops.log_configuration.publish': {
|
||||
'system.settings.log_configuration.publish': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.log_configuration.manager'] }]
|
||||
}
|
||||
},
|
||||
'system.devops.log_configuration.delete': {
|
||||
'system.settings.log_configuration.delete': {
|
||||
granted: {
|
||||
anyOf: [{ backend: ['system.settings.log_configuration.manager'] }]
|
||||
}
|
||||
|
||||
@@ -1,93 +1,95 @@
|
||||
import InsidePage from '@common/components/aoplatform/InsidePage'
|
||||
import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const'
|
||||
import { DynamicMenuItem } from '@common/const/type'
|
||||
import { useGlobalContext } from '@common/contexts/GlobalStateContext'
|
||||
import { useFetch } from '@common/hooks/http'
|
||||
import { $t } from '@common/locales'
|
||||
import { getItem } from '@common/utils/navigation'
|
||||
import { RouterParams } from '@core/components/aoplatform/RenderRoutes'
|
||||
import { Menu, MenuProps, Skeleton, message } from 'antd'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { Link, Outlet, useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import { Menu, MenuProps, Skeleton, message } from "antd";
|
||||
import { Link, Outlet, useNavigate, useParams } from "react-router-dom";
|
||||
import InsidePage from "@common/components/aoplatform/InsidePage";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from "@common/const/const";
|
||||
import { DynamicMenuItem, } from "@common/const/type";
|
||||
import { useFetch } from "@common/hooks/http";
|
||||
import { getItem } from "@common/utils/navigation";
|
||||
import { RouterParams } from "@core/components/aoplatform/RenderRoutes";
|
||||
import { $t } from "@common/locales";
|
||||
import { useGlobalContext } from "@common/contexts/GlobalStateContext";
|
||||
const LogSettings = () => {
|
||||
const { moduleId } = useParams<RouterParams>()
|
||||
const [menuItems, setMenuItems] = useState<MenuProps['items']>([])
|
||||
const [activeMenu, setActiveMenu] = useState<string>()
|
||||
const { fetchData } = useFetch()
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const navigateTo = useNavigate()
|
||||
const { state } = useGlobalContext()
|
||||
|
||||
const LogSettings = ()=>{
|
||||
const {moduleId} = useParams<RouterParams>();
|
||||
const [menuItems, setMenuItems ] = useState<MenuProps['items']>([])
|
||||
const [activeMenu, setActiveMenu] = useState<string>()
|
||||
const {fetchData} = useFetch()
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const navigateTo = useNavigate()
|
||||
const {state} = useGlobalContext()
|
||||
|
||||
const getDynamicMenuList = ()=>{
|
||||
return fetchData<BasicResponse<{ dynamics:DynamicMenuItem[] }>>(`simple/dynamics/log`,{method:'GET'}).then(response=>{
|
||||
const {code,data,msg} = response
|
||||
if(code === STATUS_CODE.SUCCESS){
|
||||
|
||||
setMenuItems(data.dynamics)
|
||||
if(!activeMenu || activeMenu.length === 0){
|
||||
navigateTo(`/logsettings/template/${data.dynamics[0].name}`)
|
||||
}
|
||||
return Promise.resolve(data.dynamics)
|
||||
}else{
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
return Promise.reject(msg || $t(RESPONSE_TIPS.error))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const menuData = useMemo(()=>{
|
||||
const newMenu = menuItems?.map((x:DynamicMenuItem)=>{
|
||||
return getItem(
|
||||
<Link to={`template/${x.name}`}>{$t(x.title)}</Link>,
|
||||
x.name,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'system.settings.log_configuration.view')
|
||||
})
|
||||
return newMenu
|
||||
},[state.language,menuItems])
|
||||
|
||||
const onMenuClick: MenuProps['onClick'] = ({key}) => {
|
||||
setActiveMenu(key)
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setActiveMenu(moduleId)
|
||||
}, [ moduleId]);
|
||||
|
||||
useEffect(()=>{
|
||||
setLoading(true)
|
||||
Promise.all([getDynamicMenuList()]).finally(()=>setLoading(false))
|
||||
},[])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Skeleton className='m-btnbase w-calc-100vw-minus-padding-r' active loading={loading}>
|
||||
<InsidePage
|
||||
pageTitle={$t('日志配置')}
|
||||
description={'APIPark '+$t("提供详尽的 API 调用日志,帮助企业监控、分析和审计 API 的运行状况。")}
|
||||
>
|
||||
<div className="flex h-full">
|
||||
<Menu
|
||||
className="h-full overflow-y-auto"
|
||||
selectedKeys={[activeMenu || '']}
|
||||
onClick={onMenuClick}
|
||||
style={{ width: 220 }}
|
||||
mode="inline"
|
||||
items={menuData}
|
||||
/>
|
||||
<div className={`w-full flex flex-1 flex-col h-full overflow-auto bg-MAIN_BG pt-btnbase pl-btnbase pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B overflow-x-hidden`}>
|
||||
<Outlet context={{accessPrefix:'system.devops.log_configuration'}}/>
|
||||
</div>
|
||||
</div>
|
||||
</InsidePage>
|
||||
</Skeleton>
|
||||
</>
|
||||
const getDynamicMenuList = () => {
|
||||
return fetchData<BasicResponse<{ dynamics: DynamicMenuItem[] }>>(`simple/dynamics/log`, { method: 'GET' }).then(
|
||||
(response) => {
|
||||
const { code, data, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
setMenuItems(data.dynamics)
|
||||
if (!activeMenu || activeMenu.length === 0) {
|
||||
navigateTo(`/logsettings/template/${data.dynamics[0].name}`)
|
||||
}
|
||||
return Promise.resolve(data.dynamics)
|
||||
} else {
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
return Promise.reject(msg || $t(RESPONSE_TIPS.error))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const menuData = useMemo(() => {
|
||||
const newMenu = menuItems?.map((x: DynamicMenuItem) => {
|
||||
return getItem(
|
||||
<Link to={`template/${x.name}`}>{$t(x.title)}</Link>,
|
||||
x.name,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'system.settings.log_configuration.view'
|
||||
)
|
||||
})
|
||||
return newMenu
|
||||
}, [state.language, menuItems])
|
||||
|
||||
const onMenuClick: MenuProps['onClick'] = ({ key }) => {
|
||||
setActiveMenu(key)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setActiveMenu(moduleId)
|
||||
}, [moduleId])
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true)
|
||||
Promise.all([getDynamicMenuList()]).finally(() => setLoading(false))
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Skeleton className="m-btnbase w-calc-100vw-minus-padding-r" active loading={loading}>
|
||||
<InsidePage
|
||||
pageTitle={$t('日志配置')}
|
||||
description={'APIPark ' + $t('提供详尽的 API 调用日志,帮助企业监控、分析和审计 API 的运行状况。')}
|
||||
>
|
||||
<div className="flex h-full">
|
||||
<Menu
|
||||
className="overflow-y-auto h-full"
|
||||
selectedKeys={[activeMenu || '']}
|
||||
onClick={onMenuClick}
|
||||
style={{ width: 220 }}
|
||||
mode="inline"
|
||||
items={menuData}
|
||||
/>
|
||||
<div
|
||||
className={`flex overflow-auto overflow-x-hidden flex-col flex-1 w-full h-full bg-MAIN_BG pt-btnbase pl-btnbase pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B`}
|
||||
>
|
||||
<Outlet context={{ accessPrefix: 'system.settings.log_configuration' }} />
|
||||
</div>
|
||||
</div>
|
||||
</InsidePage>
|
||||
</Skeleton>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default LogSettings;
|
||||
export default LogSettings
|
||||
|
||||
@@ -1,95 +1,89 @@
|
||||
import InsidePage from '@common/components/aoplatform/InsidePage'
|
||||
import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from '@common/const/const'
|
||||
import { DynamicMenuItem } from '@common/const/type'
|
||||
import { useGlobalContext } from '@common/contexts/GlobalStateContext'
|
||||
import { useFetch } from '@common/hooks/http'
|
||||
import { $t } from '@common/locales'
|
||||
import { getItem } from '@common/utils/navigation'
|
||||
import { RouterParams } from '@core/components/aoplatform/RenderRoutes'
|
||||
import { Menu, MenuProps, Skeleton, message } from 'antd'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { Link, Outlet, useNavigate, useParams } from 'react-router-dom'
|
||||
|
||||
import { Menu, MenuProps, Skeleton, message } from "antd";
|
||||
import { Link, Outlet, useNavigate, useParams } from "react-router-dom";
|
||||
import InsidePage from "@common/components/aoplatform/InsidePage";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from "@common/const/const";
|
||||
import { DynamicMenuItem } from "@common/const/type";
|
||||
import { useFetch } from "@common/hooks/http";
|
||||
import { getItem } from "@common/utils/navigation";
|
||||
import { RouterParams } from "@core/components/aoplatform/RenderRoutes";
|
||||
import { $t } from "@common/locales";
|
||||
import { useGlobalContext } from "@common/contexts/GlobalStateContext";
|
||||
const LogSettings = () => {
|
||||
const { moduleId } = useParams<RouterParams>()
|
||||
const [menuItems, setMenuItems] = useState<MenuProps['items']>([])
|
||||
const [activeMenu, setActiveMenu] = useState<string>()
|
||||
const { fetchData } = useFetch()
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const navigateTo = useNavigate()
|
||||
const { state } = useGlobalContext()
|
||||
|
||||
const LogSettings = ()=>{
|
||||
const {moduleId} = useParams<RouterParams>();
|
||||
const [menuItems, setMenuItems ] = useState<MenuProps['items']>([])
|
||||
const [activeMenu, setActiveMenu] = useState<string>()
|
||||
const {fetchData} = useFetch()
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
const navigateTo = useNavigate()
|
||||
const {state} = useGlobalContext()
|
||||
|
||||
const getDynamicMenuList = ()=>{
|
||||
setLoading(true)
|
||||
fetchData<BasicResponse<{ dynamics:DynamicMenuItem[] }>>(`simple/dynamics/resource`,{method:'GET'}).then(response=>{
|
||||
const {code,data,msg} = response
|
||||
if(code === STATUS_CODE.SUCCESS){
|
||||
|
||||
|
||||
setMenuItems(data.dynamics)
|
||||
if(!activeMenu || activeMenu.length === 0){
|
||||
navigateTo(`/resourcesettings/template/${data.dynamics[0].name}`)
|
||||
}
|
||||
}else{
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
}
|
||||
}).finally(()=>setLoading(false))
|
||||
}
|
||||
const getDynamicMenuList = () => {
|
||||
setLoading(true)
|
||||
fetchData<BasicResponse<{ dynamics: DynamicMenuItem[] }>>(`simple/dynamics/resource`, { method: 'GET' })
|
||||
.then((response) => {
|
||||
const { code, data, msg } = response
|
||||
if (code === STATUS_CODE.SUCCESS) {
|
||||
setMenuItems(data.dynamics)
|
||||
if (!activeMenu || activeMenu.length === 0) {
|
||||
navigateTo(`/resourcesettings/template/${data.dynamics[0].name}`)
|
||||
}
|
||||
} else {
|
||||
message.error(msg || $t(RESPONSE_TIPS.error))
|
||||
}
|
||||
})
|
||||
.finally(() => setLoading(false))
|
||||
}
|
||||
|
||||
|
||||
const menuData = useMemo(()=>{
|
||||
const newMenu = menuItems?.map((x:DynamicMenuItem)=>{
|
||||
|
||||
return getItem(
|
||||
<Link to={`template/${x.name}`}>{$t(x.title)}</Link>,
|
||||
x.name,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'system.settings.log_configuration.view')
|
||||
})
|
||||
return newMenu
|
||||
},[state.language,menuItems])
|
||||
const menuData = useMemo(() => {
|
||||
const newMenu = menuItems?.map((x: DynamicMenuItem) => {
|
||||
return getItem(
|
||||
<Link to={`template/${x.name}`}>{$t(x.title)}</Link>,
|
||||
x.name,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'system.settings.log_configuration.view'
|
||||
)
|
||||
})
|
||||
return newMenu
|
||||
}, [state.language, menuItems])
|
||||
|
||||
const onMenuClick: MenuProps['onClick'] = ({ key }) => {
|
||||
setActiveMenu(key)
|
||||
}
|
||||
|
||||
const onMenuClick: MenuProps['onClick'] = ({key}) => {
|
||||
setActiveMenu(key)
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setActiveMenu(moduleId)
|
||||
}, [ moduleId]);
|
||||
|
||||
useEffect(()=>{
|
||||
setLoading(true)
|
||||
getDynamicMenuList()
|
||||
},[])
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Skeleton className='m-btnbase w-calc-100vw-minus-padding-r' active loading={loading}>
|
||||
<InsidePage
|
||||
pageTitle={$t('资源配置')}
|
||||
>
|
||||
<div className="flex h-full">
|
||||
<Menu
|
||||
className="h-full overflow-y-auto"
|
||||
selectedKeys={[activeMenu || '']}
|
||||
onClick={onMenuClick}
|
||||
style={{ width: 220 }}
|
||||
mode="inline"
|
||||
items={menuData}
|
||||
/>
|
||||
<div className={`w-full flex flex-1 flex-col h-full overflow-auto bg-MAIN_BG`}>
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
</InsidePage>
|
||||
</Skeleton>
|
||||
</>
|
||||
)
|
||||
useEffect(() => {
|
||||
setActiveMenu(moduleId)
|
||||
}, [moduleId])
|
||||
|
||||
useEffect(() => {
|
||||
setLoading(true)
|
||||
getDynamicMenuList()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Skeleton className="m-btnbase w-calc-100vw-minus-padding-r" active loading={loading}>
|
||||
<InsidePage pageTitle={$t('资源配置')}>
|
||||
<div className="flex h-full">
|
||||
<Menu
|
||||
className="overflow-y-auto h-full"
|
||||
selectedKeys={[activeMenu || '']}
|
||||
onClick={onMenuClick}
|
||||
style={{ width: 220 }}
|
||||
mode="inline"
|
||||
items={menuData}
|
||||
/>
|
||||
<div className={`flex overflow-auto flex-col flex-1 w-full h-full bg-MAIN_BG`}>
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
</InsidePage>
|
||||
</Skeleton>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default LogSettings;
|
||||
export default LogSettings
|
||||
|
||||
Reference in New Issue
Block a user