diff --git a/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx b/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx index 3866f308..ee2a67d2 100644 --- a/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx +++ b/frontend/packages/common/src/components/aoplatform/BasicLayout.tsx @@ -41,7 +41,7 @@ const themeToken = { const navigator = useNavigate() const location = useLocation() const currentUrl = location.pathname - const { state,accessData,checkPermission} = useGlobalContext() + const { state,accessData,checkPermission,accessInit} = useGlobalContext() const [pathname, setPathname] = useState(currentUrl); const mainPage = project === 'core' ?'/service/list':'/serviceHub/list' @@ -70,15 +70,15 @@ const themeToken = { ],undefined,'system.api_market.service_classification.view'), getNavItem($t('运维与集成'), 'maintenanceCenter','/cluster', null, [ - getNavItem({$t('监控报表')}, 'dashboardsetting','/dashboardsetting',,undefined,undefined,'system.devops.dashboardsetting.view'), getNavItem({$t('集群')}, 'cluster','/cluster',,undefined,undefined,'system.devops.cluster.view'), + getNavItem({$t('监控报表')}, 'dashboardsetting','/dashboardsetting',,undefined,undefined,'system.devops.dashboardsetting.view'), getNavItem({$t('证书')}, 'cert','/cert',,undefined,undefined,'system.devops.ssl_certificate.view'), getNavItem({$t('日志')}, 'logsettings','/logsettings',,undefined,undefined,'system.devops.log_configuration.view'), APP_MODE === 'pro' ? getNavItem({$t('资源')}, 'resourcesettings','/resourcesettings',null,undefined,undefined,'system.partition.self.view'):null, APP_MODE === 'pro' ? getNavItem({$t('Open API')}, 'openapi','/openapi',null,undefined,undefined,'system.openapi.self.view'):null, ]), ]), - ],[state.language]) + ],[state.language,accessInit]) useEffect(() => { diff --git a/frontend/packages/common/src/components/aoplatform/EditableTable.tsx b/frontend/packages/common/src/components/aoplatform/EditableTable.tsx index 6479420a..72e5ed49 100644 --- a/frontend/packages/common/src/components/aoplatform/EditableTable.tsx +++ b/frontend/packages/common/src/components/aoplatform/EditableTable.tsx @@ -78,7 +78,7 @@ const EditableTable = ({ }} btnTitle="增加"/>, - (config.index !== configurations.length - 1 )&& { setConfigurations((prev)=>{ const tmpPreData = [...prev]; diff --git a/frontend/packages/common/src/components/aoplatform/PageList.tsx b/frontend/packages/common/src/components/aoplatform/PageList.tsx index faf68877..e632d43e 100644 --- a/frontend/packages/common/src/components/aoplatform/PageList.tsx +++ b/frontend/packages/common/src/components/aoplatform/PageList.tsx @@ -59,7 +59,7 @@ const PageList = >(props: React.PropsWithChild const [tableWidth, setTableWidth] = useState(undefined); const actionRef = useRef(); const [allowTableClick,setAllowTableClick] = useState(false) - const {accessData,checkPermission} = useGlobalContext() + const {accessData,checkPermission,accessInit} = useGlobalContext() const [minTableWidth, setMinTableWidth] = useState(0) // 使用useImperativeHandle来自定义暴露给父组件的实例值 @@ -68,7 +68,7 @@ const PageList = >(props: React.PropsWithChild const lastAccess = useMemo(()=>{ if(!tableClickAccess) return true return checkPermission(tableClickAccess as keyof typeof PERMISSION_DEFINITION[0]) -},[allowTableClick, accessData]) +},[allowTableClick, accessData,accessInit]) useEffect(()=>{ tableClickAccess ? setAllowTableClick(lastAccess) : setAllowTableClick(true) diff --git a/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx b/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx index 0a1dbf89..8c72617b 100644 --- a/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx +++ b/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx @@ -22,6 +22,7 @@ const TableIconName={ 'add':'ic:baseline-add', 'edit':'ic:baseline-edit', 'delete':'ic:baseline-delete', + 'remove':'ic:baseline-minus', 'copy':'ic:baseline-file-copy', 'view':'ic:baseline-remove-red-eye', 'publish':'ic:baseline-publish', @@ -35,12 +36,13 @@ const TableIconName={ const TableBtnWithPermission = ({btnTitle, access, tooltip, disabled, navigateTo, onClick,className,btnType}:TableBtnWithPermissionProps) => { const [btnAccess, setBtnAccess] = useState(false) - const {accessData,checkPermission} = useGlobalContext() + const {accessData,checkPermission,accessInit} = useGlobalContext() const navigate = useNavigate() const lastAccess = useMemo(()=>{ + if(!accessInit) return false if(!access) return true return checkPermission(access) - },[access, accessData,checkPermission]) + },[access, accessData,checkPermission,accessInit]) useEffect(()=>{ access ? setBtnAccess(lastAccess) : setBtnAccess(true) diff --git a/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx b/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx index cbc4e2f3..4c6c4b92 100644 --- a/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx +++ b/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx @@ -10,11 +10,11 @@ export interface TagWithPermission extends TagProps{ export default function TagWithPermission(props:TagWithPermission){ const {access,onClose} = props const [editAccess, setEditAccess] = useState(access ? false:true) - const {accessData,checkPermission} = useGlobalContext() + const {accessData,checkPermission,accessInit} = useGlobalContext() const lastAccess = useMemo(()=>{ if(!access) return true return checkPermission(access as keyof typeof PERMISSION_DEFINITION[0]) - },[access, accessData,checkPermission]) + },[access, accessData,checkPermission,accessInit]) useEffect(()=>{ access ? setEditAccess(lastAccess) : setEditAccess(true) diff --git a/frontend/packages/common/src/components/aoplatform/WithPermission.tsx b/frontend/packages/common/src/components/aoplatform/WithPermission.tsx index 20fea9e7..db43f4f4 100644 --- a/frontend/packages/common/src/components/aoplatform/WithPermission.tsx +++ b/frontend/packages/common/src/components/aoplatform/WithPermission.tsx @@ -16,12 +16,12 @@ type WithPermissionProps = { const WithPermission = ({access, tooltip, children,disabled, showDisabled = true}:WithPermissionProps) => { const [editAccess, setEditAccess] = useState(access ? false:true) - const {accessData,checkPermission} = useGlobalContext() + const {accessData,checkPermission,accessInit} = useGlobalContext() const lastAccess = useMemo(()=>{ if(!access) return true return checkPermission(access as keyof typeof PERMISSION_DEFINITION[0]) - },[access, accessData,checkPermission]) + },[access, accessData,checkPermission,accessInit]) useEffect(()=>{ // 先判断权限,无论权限是否为true,如果disabled为true时则必须为ture diff --git a/frontend/packages/common/src/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx b/frontend/packages/common/src/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx index 2e573d39..79266618 100644 --- a/frontend/packages/common/src/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx +++ b/frontend/packages/common/src/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx @@ -2,6 +2,7 @@ import {forwardRef, useImperativeHandle, useState} from 'react' import { Input } from 'antd' +import { Icon } from '@iconify/react/dist/iconify.js' export const ArrayItemBlankComponent = forwardRef( (props: { [k: string]: any }, ref) => { const { onChange, value, dataFormat } = props @@ -135,27 +136,9 @@ export const ArrayItemBlankComponent = forwardRef( {index !== resList.length - 1 && (
{n[dataFormat[0].key] && ( - addLine(index)} - > - - - - - - + addLine(index as unknown as number)} width="14" height="14"/> )} - removeLine(index)} - > - - - - - - + removeLine(index as unknown as number)} width="14" height="14"/>
)} diff --git a/frontend/packages/common/src/components/aoplatform/formily2-customize/SimpleMapComponent.tsx b/frontend/packages/common/src/components/aoplatform/formily2-customize/SimpleMapComponent.tsx index d1bad90c..926a47d1 100644 --- a/frontend/packages/common/src/components/aoplatform/formily2-customize/SimpleMapComponent.tsx +++ b/frontend/packages/common/src/components/aoplatform/formily2-customize/SimpleMapComponent.tsx @@ -2,6 +2,7 @@ import {forwardRef, useImperativeHandle, useState} from 'react' import { Input } from '@formily/antd-v5' import { $t } from '@common/locales' +import { Icon } from '@iconify/react/dist/iconify.js' export const SimpleMapComponent = forwardRef( (props: { [k: string]: unknown }, ref) => { const { @@ -89,27 +90,9 @@ export const SimpleMapComponent = forwardRef( {index !== kvList.length - 1 && (
{n.key && ( - addLine(index)} - > - - - - - - + addLine(index as unknown as number)} width="14" height="14"/> )} - removeLine(index)} - > - - - - - - + removeLine(index as unknown as number)} width="14" height="14"/>
)} diff --git a/frontend/packages/common/src/contexts/GlobalStateContext.tsx b/frontend/packages/common/src/contexts/GlobalStateContext.tsx index 0ab3888c..708ae186 100644 --- a/frontend/packages/common/src/contexts/GlobalStateContext.tsx +++ b/frontend/packages/common/src/contexts/GlobalStateContext.tsx @@ -38,7 +38,7 @@ export const GlobalContext = createContext<{ dispatch: Dispatch; accessData:Map; pluginAccessDictionary:{[k:string]:string}; - getGlobalAccessData:()=>void; + getGlobalAccessData:()=>Promise<{ access:string[]}>; getTeamAccessData:(teamId:string)=>void; getPluginAccessDictionary:(pluginData:{[k:string]:string})=>void resetAccess:()=>void @@ -117,12 +117,16 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => { let getGlobalAccessPromise: Promise> | null = null const getGlobalAccessData = ()=>{ + if(getGlobalAccessPromise){ + return getGlobalAccessPromise + } getGlobalAccessPromise = new Promise((resolve, reject) => fetchData>('profile/permission/system',{method:'GET'},).then(response=>{ const {code,data,msg} = response if(code === STATUS_CODE.SUCCESS){ setAccessInit(true) setAccessData(prevData => new Map(prevData).set('system', data.access)) resolve(data.response) + getGlobalAccessPromise = null }else{ message.error(msg || RESPONSE_TIPS.error) reject(data.msg || RESPONSE_TIPS.error) @@ -156,16 +160,11 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => { const resetAccess = ()=>{ setAccessData(new Map()) + setAccessInit(false) setPluginAccessDictionary({}) } - const checkPermission = async (access:keyof typeof PERMISSION_DEFINITION[0] | Array)=>{ - if( !accessInit && getGlobalAccessPromise){ - await getGlobalAccessPromise - } - if( !accessInit && !getGlobalAccessPromise){ - await getGlobalAccessData() - } + const checkPermission = (access:keyof typeof PERMISSION_DEFINITION[0] | Array)=>{ let revs = false; if (Array.isArray(access)) { revs = access.some(item => checkAccess(item, accessData)); diff --git a/frontend/packages/common/src/utils/permission.ts b/frontend/packages/common/src/utils/permission.ts index 5f5dbb05..28710851 100644 --- a/frontend/packages/common/src/utils/permission.ts +++ b/frontend/packages/common/src/utils/permission.ts @@ -12,7 +12,8 @@ export const checkAccess:(access:AccessDataType, accessData:Map console.warn('权限字段有误:',access) return false } - const neededBackendAccessArr = PERMISSION_DEFINITION[0]?.[access]?.granted.anyOf[0].backend || [] + console.log(access, PERMISSION_DEFINITION) + const neededBackendAccessArr = PERMISSION_DEFINITION[0]?.[access]?.granted?.anyOf[0].backend || [] return accessData?.has(accLevel)&& accessData.get(accLevel)!.length > 0 ? hasIntersection(neededBackendAccessArr, accessData.get(accLevel)!) : false } diff --git a/frontend/packages/core/src/const/team/const.tsx b/frontend/packages/core/src/const/team/const.tsx index 97dba627..c57936f3 100644 --- a/frontend/packages/core/src/const/team/const.tsx +++ b/frontend/packages/core/src/const/team/const.tsx @@ -165,7 +165,7 @@ export const TEAM_MEMBER_MODAL_TABLE_COLUMNS:ColumnsType = [ getItem($t('管理'), 'grp', null, [ getItem({$t('成员')}, 'member',undefined, undefined, undefined,'team.team.member.view'), - getItem({$t('设置')}, 'setting',undefined,undefined,undefined,'team.team.team.edit')], + getItem({$t('设置')}, 'setting',undefined,undefined,undefined,'team.team.team.view')], 'group'), ]; \ No newline at end of file diff --git a/frontend/packages/core/src/index.css b/frontend/packages/core/src/index.css index 2b601c3d..acb3395d 100644 --- a/frontend/packages/core/src/index.css +++ b/frontend/packages/core/src/index.css @@ -349,6 +349,7 @@ p{ } */ .ant-table-cell { + a{ color:var(--primary-color) !important; } @@ -662,7 +663,7 @@ p{ .ant-pro-table-list-toolbar-setting-items{ position:absolute; - top:14px; + top:18px; right:16px; z-index:9; .ant-pro-table-list-toolbar-setting-item{ @@ -775,7 +776,6 @@ p{ padding:0 !important; } .eo_page_list .ant-pro-table-list-toolbar-container{ - /* padding:12px 20px 12px 12px !important; */ padding-block:0px !important; flex-direction: row-reverse; @@ -1103,6 +1103,11 @@ p{ } } +.eo_page_list .ant-table-tbody:not(tbody) .ant-table-cell{ + display: flex; + align-items: center; +} + .ant-alert-info{ background: #1784FC1A !important; } @@ -1214,11 +1219,6 @@ p{ font-weight: bold; } -/* .eo_page_list.role_table .ant-pro-table-list-toolbar-container{ - padding-left:0 !important; - padding-right:0 !important; -} */ - div.preview-document{ p{ diff --git a/frontend/packages/core/src/pages/partitions/DashboardSettingEdit.tsx b/frontend/packages/core/src/pages/partitions/DashboardSettingEdit.tsx index ec7e8069..3b889312 100644 --- a/frontend/packages/core/src/pages/partitions/DashboardSettingEdit.tsx +++ b/frontend/packages/core/src/pages/partitions/DashboardSettingEdit.tsx @@ -50,8 +50,7 @@ export type DashboardSettingEditProps = {
diff --git a/frontend/packages/core/src/pages/system/SystemConfig.tsx b/frontend/packages/core/src/pages/system/SystemConfig.tsx index d3c718c4..a0242e45 100644 --- a/frontend/packages/core/src/pages/system/SystemConfig.tsx +++ b/frontend/packages/core/src/pages/system/SystemConfig.tsx @@ -40,7 +40,7 @@ const SystemConfig = forwardRef((_,ref) => { const [tagOptionList, setTagOptionList] = useState([]) const [serviceClassifyOptionList, setServiceClassifyOptionList] = useState() const [uploadLoading, setUploadLoading] = useState(false) - const {checkPermission} = useGlobalContext() + const {checkPermission,accessInit, getGlobalAccessData} = useGlobalContext() useImperativeHandle(ref, () => ({ save:onFinish @@ -186,7 +186,13 @@ const SystemConfig = forwardRef((_,ref) => { } useEffect(() => { - getTeamOptionList() + if(accessInit){ + getTeamOptionList + }else{ + getGlobalAccessData()?.then(()=>{ + getTeamOptionList() + }) + } getTagAndServiceClassifyList() if (serviceId !== undefined) { setOnEdit(true); diff --git a/frontend/packages/core/src/pages/system/SystemInsidePage.tsx b/frontend/packages/core/src/pages/system/SystemInsidePage.tsx index 9185a2df..577755ac 100644 --- a/frontend/packages/core/src/pages/system/SystemInsidePage.tsx +++ b/frontend/packages/core/src/pages/system/SystemInsidePage.tsx @@ -23,7 +23,7 @@ const SystemInsidePage:FC = ()=> { const currentUrl = location.pathname const {fetchData} = useFetch() const { setPrefixForce,setApiPrefix ,systemInfo,setSystemInfo} = useSystemContext() - const { accessData,checkPermission} = useGlobalContext() + const { accessData,checkPermission,accessInit} = useGlobalContext() const [activeMenu, setActiveMenu] = useState() const navigateTo = useNavigate() @@ -70,7 +70,7 @@ const SystemInsidePage:FC = ()=> { return pre ?? 'api' }) return filteredMenu || [] - },[accessData]) + },[accessData,accessInit]) const onMenuClick: MenuProps['onClick'] = ({key}) => { setActiveMenu(key) diff --git a/frontend/packages/core/src/pages/system/SystemList.tsx b/frontend/packages/core/src/pages/system/SystemList.tsx index 06ba92a0..7f33f205 100644 --- a/frontend/packages/core/src/pages/system/SystemList.tsx +++ b/frontend/packages/core/src/pages/system/SystemList.tsx @@ -29,9 +29,15 @@ const SystemList:FC = ()=>{ const [memberValueEnum, setMemberValueEnum] = useState<{[k:string]:{text:string}}>({}) const [open, setOpen] = useState(false); const drawerFormRef = useRef(null) - const {checkPermission} = useGlobalContext() + const {checkPermission,accessInit, getGlobalAccessData} = useGlobalContext() const getSystemList = ()=>{ + if(!accessInit){ + getGlobalAccessData()?.then(()=>{ + getSystemList() + }) + return + } if(!tableHttpReload){ setTableHttpReload(true) return Promise.resolve({ @@ -55,6 +61,12 @@ const SystemList:FC = ()=>{ } const getTeamsList = ()=>{ + if(!accessInit){ + getGlobalAccessData()?.then(()=>{ + getTeamsList() + }) + return + } fetchData>(!checkPermission('system.workspace.team.view_all') ?'simple/teams/mine' :'simple/teams',{method:'GET',eoTransformKeys:[]}).then(response=>{ const {code,data,msg} = response setTeamList(data.teams) diff --git a/frontend/packages/core/src/pages/team/TeamConfig.tsx b/frontend/packages/core/src/pages/team/TeamConfig.tsx index 85a9190a..79a4c074 100644 --- a/frontend/packages/core/src/pages/team/TeamConfig.tsx +++ b/frontend/packages/core/src/pages/team/TeamConfig.tsx @@ -1,4 +1,4 @@ -import { forwardRef, useEffect, useImperativeHandle, useState} from "react"; +import { forwardRef, useEffect, useImperativeHandle, useMemo, useState} from "react"; import {App, Button, Form, Input, Row, Select} from "antd"; import {Link, useLocation, useNavigate, useParams} from "react-router-dom"; import {RouterParams} from "@core/components/aoplatform/RenderRoutes.tsx"; @@ -34,8 +34,12 @@ const TeamConfig= forwardRef((props,ref) => { const [managerOption, setManagerOption] = useState([]) const { setBreadcrumb} = useBreadcrumb() const { setTeamInfo } =useTeamContext() - const {checkPermission} = useGlobalContext() - const pageType= checkPermission('system.organization.team.view') ? 'manage' : 'myteam' + const {checkPermission,accessInit} = useGlobalContext() + const pageType= useMemo(()=>{ + if(!accessInit) return 'myteam' + return checkPermission('system.organization.team.view') ? 'manage' : 'myteam' + },[checkPermission,accessInit]) + const [canDelete, setCanDelete] = useState(false) const navigateTo = useNavigate() useImperativeHandle(ref, () => ({ diff --git a/frontend/packages/core/src/pages/team/TeamInsidePage.tsx b/frontend/packages/core/src/pages/team/TeamInsidePage.tsx index 4e28e3c2..1f19c98b 100644 --- a/frontend/packages/core/src/pages/team/TeamInsidePage.tsx +++ b/frontend/packages/core/src/pages/team/TeamInsidePage.tsx @@ -21,8 +21,8 @@ const TeamInsidePage:FC = ()=> { const {teamId} = useParams(); const {fetchData} = useFetch() const location = useLocation() - const { teamInfo ,setTeamInfo } = useTeamContext() - const {getTeamAccessData,cleanTeamAccessData,accessData,checkPermission,teamDataFlushed} = useGlobalContext() + const { teamInfo ,setTeamInfo ,} = useTeamContext() + const {getTeamAccessData,cleanTeamAccessData,accessData,checkPermission,teamDataFlushed,accessInit} = useGlobalContext() const navigateTo = useNavigate() const [activeMenu, setActiveMenu] = useState() @@ -52,7 +52,7 @@ const TeamInsidePage:FC = ()=> { return pre }) return filteredMenu || [] - },[accessData]) + },[accessData,accessInit]) const getTeamInfo = ()=>{ setTeamInfo?.(undefined) diff --git a/frontend/packages/core/src/pages/team/TeamList.tsx b/frontend/packages/core/src/pages/team/TeamList.tsx index a5a40d0e..a366979a 100644 --- a/frontend/packages/core/src/pages/team/TeamList.tsx +++ b/frontend/packages/core/src/pages/team/TeamList.tsx @@ -28,12 +28,16 @@ const TeamList:FC = ()=>{ const {fetchData} = useFetch() const [memberValueEnum, setMemberValueEnum] = useState<{[k:string]:{text:string}}>({}) const teamConfigRef = useRef(null) - const {accessData,checkPermission} = useGlobalContext() + const {accessData,checkPermission,accessInit, getGlobalAccessData} = useGlobalContext() const [curTeam, setCurTeam] = useState({} as TeamConfigFieldType) const [modalVisible, setModalVisible] = useState(false) const [modalType, setModalType] = useState<'add'|'edit'>('add') const getTeamList = ()=>{ + if(!accessInit){ + getGlobalAccessData()?.then(()=>{getTeamList()}) + return + } return fetchData>(!checkPermission('system.workspace.team.view_all') ? 'teams':'manager/teams',{method:'GET',eoParams:{keyword:searchWord},eoTransformKeys:['create_time','service_num','can_delete']}).then(response=>{ const {code,data,msg} = response if(code === STATUS_CODE.SUCCESS){ diff --git a/frontend/packages/dashboard/src/component/MonitorApiPage.tsx b/frontend/packages/dashboard/src/component/MonitorApiPage.tsx index 117a4b7f..6ef53e5a 100644 --- a/frontend/packages/dashboard/src/component/MonitorApiPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorApiPage.tsx @@ -151,7 +151,7 @@ export default function MonitorApiPage(props:MonitorApiPageProps){ } return ( -
+
> valueType: 'option', render: (_: React.ReactNode, entity: unknown) => [ // onRowClick(entity)} btnTitle="查看"/>, - onRowClick(entity)} btnTitle="查看"/>, + APP_MODE === 'pro' ? onRowClick(entity)} btnTitle="查看"/> : null ], } ] @@ -86,7 +86,7 @@ const MonitorTable = forwardRef> besidesTableHeight={inModal ? 64+56+258: undefined} ref={tableRef} showPagination={showPagination} - columns = {[...(TableType[type] || []),...(APP_MODE === 'pro' ? operation : [])]} + columns = {[...(TableType[type] || []),...operation]} request={getTableDataSource} dataSource={tableListDataSource} // tableClickAccess="system.dashboard.self.view" diff --git a/frontend/packages/dashboard/src/component/MonitorTotalPage.tsx b/frontend/packages/dashboard/src/component/MonitorTotalPage.tsx index b7559429..b2772e9b 100644 --- a/frontend/packages/dashboard/src/component/MonitorTotalPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorTotalPage.tsx @@ -209,17 +209,17 @@ const MonitorTotalPage = (props:MonitorTotalPageProps) => { { label:$t('API 请求量 Top10'), key:'api', - children:{APP_MODE !== 'pro' ? null : getDetailData(record as MonitorApiData,'api')}} request={()=>getTablesData(queryData||{},'api')}/> + children:{APP_MODE !== 'pro' ? null : getDetailData(record as MonitorApiData,'api')}} request={()=>getTablesData(queryData||{},'api')}/> }, { label:$t('应用调用量 Top10'), key:'subscribers', - children:{APP_MODE !== 'pro' ? null : getDetailData(record as MonitorSubscriberData,'subscriber')}} request={()=>getTablesData(queryData||{},'subscriber')} /> + children:{APP_MODE !== 'pro' ? null : getDetailData(record as MonitorSubscriberData,'subscriber')}} request={()=>getTablesData(queryData||{},'subscriber')} /> }, { label:$t('服务被调用量 Top10'), key:'providers', - children:{APP_MODE !== 'pro' ? null : getDetailData(record as MonitorSubscriberData,'provider')}} request={()=>getTablesData(queryData||{},'provider')} /> + children:{APP_MODE !== 'pro' ? null : getDetailData(record as MonitorSubscriberData,'provider')}} request={()=>getTablesData(queryData||{},'provider')} /> } ] @@ -231,7 +231,7 @@ const MonitorTotalPage = (props:MonitorTotalPageProps) => { } return ( -
+
{ {service.apiNum ?? '-'} - {service.subscriberNum ?? '-'} + {service.subscriberNum ?? '-'}
diff --git a/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx b/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx index 26ea7eb7..58a0940b 100644 --- a/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx +++ b/frontend/packages/market/src/pages/serviceHub/management/ServiceHubManagement.tsx @@ -13,6 +13,7 @@ import { useTenantManagementContext } from "../../../contexts/TenantManagementCo import { Icon } from "@iconify/react/dist/iconify.js"; import { useGlobalContext } from "@common/contexts/GlobalStateContext"; import { $t } from "@common/locales"; +import WithPermission from "@common/components/aoplatform/WithPermission"; export default function ServiceHubManagement() { const { message ,modal} = App.useApp() @@ -26,11 +27,15 @@ export default function ServiceHubManagement() { const [teamList, setTeamList] = useState([]) const {setAppName} = useTenantManagementContext() const navigateTo = useNavigate() - const {getTeamAccessData,cleanTeamAccessData,checkPermission} = useGlobalContext() + const {getTeamAccessData,cleanTeamAccessData,checkPermission,getGlobalAccessData,accessInit} = useGlobalContext() type MenuItem = Required['items'][number]; const getServiceList = ()=>{ + if(!accessInit){ + getGlobalAccessData()?.then(()=>{getServiceList()}) + return + } setServiceLoading(true) return fetchData>(!checkPermission('system.workspace.application.view_all') ? 'my_apps':'apps',{method:'GET',eoParams:{ team:teamId,keyword:''},eoTransformKeys:['api_num','subscribe_num','subscribe_verify_num']}).then(response=>{ const {code,data,msg} = response @@ -50,6 +55,10 @@ const getServiceList = ()=>{ const getTeamsList = ()=>{ + if(!accessInit){ + getGlobalAccessData()?.then(()=>{getTeamsList()}) + return + } setPageLoading(true) fetchData>(!checkPermission('system.workspace.team.view_all') ?'simple/teams/mine' :'simple/teams',{method:'GET',eoTransformKeys:['app_num','subscribe_num']}).then(response=>{ const {code,data,msg} = response @@ -159,9 +168,9 @@ useEffect(() => { const item = serviceList[index]; return (
{ - item.type === 'addNewItem' ?{openModal('add')}}> + item.type === 'addNewItem' ?{openModal('add')}}>
{$t('添加应用')}
-
: {setAppName(item.name);navigateTo(`/tenantManagement/${teamId}/inside/${item.id}/service`)}}> +
: {setAppName(item.name);navigateTo(`/tenantManagement/${teamId}/inside/${item.id}/service`)}}> {item.description || $t('暂无服务描述')} }
@@ -205,7 +214,7 @@ const CardTitle = (service:ServiceHubAppListItem)=>{

{service.name}

- {(service.subscribeNum + service.subscribeVerifyNum)?? '-'} + {(service.subscribeNum + service.subscribeVerifyNum)?? '-'}