diff --git a/frontend/packages/common/src/components/aoplatform/InsidePage.tsx b/frontend/packages/common/src/components/aoplatform/InsidePage.tsx index dc97b7fc..696fcee4 100644 --- a/frontend/packages/common/src/components/aoplatform/InsidePage.tsx +++ b/frontend/packages/common/src/components/aoplatform/InsidePage.tsx @@ -37,13 +37,13 @@ const InsidePage:FC = ({showBanner=true,pageTitle,tagList,showB //
{ showBanner &&
-
+ {!pageTitle && !description && !backUrl &&!customBtn ? <>:
{backUrl &&
}
-

{pageTitle}

+
{pageTitle}
{tagList && tagList?.length > 0 && tagList?.map((tag)=>{ return ( {tag.label}) })} @@ -53,10 +53,10 @@ const InsidePage:FC = ({showBanner=true,pageTitle,tagList,showB }}>{btnTitle}} {customBtn}
-

+

{description} -

-
+
+
}
}
{children}
diff --git a/frontend/packages/common/src/components/aoplatform/PolicyPublishModalContent.tsx b/frontend/packages/common/src/components/aoplatform/PolicyPublishModalContent.tsx index c8df5598..e058d11f 100644 --- a/frontend/packages/common/src/components/aoplatform/PolicyPublishModalContent.tsx +++ b/frontend/packages/common/src/components/aoplatform/PolicyPublishModalContent.tsx @@ -47,7 +47,6 @@ export const PolicyPublishModalContent = forwardRef diff --git a/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx b/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx index 97baa331..8e7588d7 100644 --- a/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx +++ b/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx @@ -6,7 +6,7 @@ import {BasicResponse, FORM_ERROR_TIPS, PLACEHOLDER, RESPONSE_TIPS, STATUS_CODE, import WithPermission from "@common/components/aoplatform/WithPermission.tsx"; import { SYSTEM_PUBLISH_ONLINE_COLUMNS } from "@core/const/system/const.tsx"; import { $t } from "@common/locales"; -import { ApprovalRouteColumns, ApprovalStatusColorClass, ApprovalUpstreamColumns, ChangeTypeEnum } from "@common/const/approval/const"; +import { ApprovalPolicyColumns, ApprovalRouteColumns, ApprovalStatusColorClass, ApprovalUpstreamColumns, ChangeTypeEnum } from "@common/const/approval/const"; import { useGlobalContext } from "@common/contexts/GlobalStateContext"; import { LoadingOutlined } from "@ant-design/icons"; import { SystemInsidePublishOnlineItems } from "@core/pages/system/publish/SystemInsidePublishOnline"; @@ -140,6 +140,19 @@ export const PublishApprovalModalContent = forwardRefApprovalPolicyColumns.map((x)=>{ + return { + ...x, + title: typeof x.title === 'string' ? $t(x.title) : x.title, + ...(x.dataIndex === 'status' ? { + render:(_,entity)=>( + entity.status === 0 ? '正常' : '无效') + }:{}) + } + }),[state.language]) + + return ( <> {!insidePage && <> @@ -219,6 +232,16 @@ export const PublishApprovalModalContent = forwardRef } + {$t('策略列表')}: + + {/* } clusterPublishStatus?:SystemInsidePublishOnlineItems[], error:string diff --git a/frontend/packages/common/src/const/permissions.ts b/frontend/packages/common/src/const/permissions.ts index a8121a7d..f1e6f43c 100644 --- a/frontend/packages/common/src/const/permissions.ts +++ b/frontend/packages/common/src/const/permissions.ts @@ -239,6 +239,31 @@ export const PERMISSION_DEFINITION = [ "anyOf": [{ "backend": ["system.settings.log_configuration.manager"] }] } }, + "system.devops.policy.view": { + "granted": { + "anyOf": [{ "backend": ["system.settings.strategy.view"] }] + } + }, + "system.devops.policy.add": { + "granted": { + "anyOf": [{ "backend": ["system.settings.strategy.manager"] }] + } + }, + "system.devops.policy.edit": { + "granted": { + "anyOf": [{ "backend": ["system.settings.strategy.manager"] }] + } + }, + "system.devops.policy.publish": { + "granted": { + "anyOf": [{ "backend": ["system.settings.strategy.manager"] }] + } + }, + "system.devops.policy.delete": { + "granted": { + "anyOf": [{ "backend": ["system.settings.strategy.manager"] }] + } + }, "system.workspace.application.view_all": { "granted": { "anyOf": [{ "backend": ["system.workspace.application.view_all"] }] @@ -429,6 +454,31 @@ export const PERMISSION_DEFINITION = [ "anyOf": [{ "backend": ["system.workspace.service.manager_all","team.team.service.manager","team.service.service.manager"] }] } }, + "team.service.policy.view": { + "granted": { + "anyOf": [{ "backend": ["team.service.strategy.view"] }] + } + }, + "team.service.policy.add": { + "granted": { + "anyOf": [{ "backend": ["team.service.strategy.manager"] }] + } + }, + "team.service.policy.edit": { + "granted": { + "anyOf": [{ "backend": ["team.service.strategy.manager"] }] + } + }, + "team.service.policy.publish": { + "granted": { + "anyOf": [{ "backend": ["team.service.strategy.manager"] }] + } + }, + "team.service.policy.delete": { + "granted": { + "anyOf": [{ "backend": ["team.service.strategy.manager"] }] + } + }, "team.application.subscription.view": { "granted": { "anyOf": [{ "backend": ["system.workspace.application.view_all","team.consumer.subscription.view_subscribed_service"] }] diff --git a/frontend/packages/common/src/const/permissions.yaml b/frontend/packages/common/src/const/permissions.yaml deleted file mode 100644 index f81d25ca..00000000 --- a/frontend/packages/common/src/const/permissions.yaml +++ /dev/null @@ -1,204 +0,0 @@ -system: - - name: organization - cname: '组织管理' - value: 'organization' - children: - - name: member - cname: '成员' - value: 'member' - access: - - system.settings.account.view - - system.organization.member.add - - system.organization.member.edit - - system.organization.member.delete - - system.organization.member.block - - system.organization.member.department.add - - system.organization.member.department.edit - - system.organization.member.department.delete - - name: team_manager - cname: '团队管理' - desc: '团队管理' - - system.workspace.team.view_all - - system.organization.team.add - - system.organization.team.edit - - system.organization.team.delete - - system.organization.team.running - - name: role_manager - cname: '角色管理' - desc: '角色管理' - - system.organization.role.view - - system.organization.role.system.view - - system.organization.role.system.add - - system.organization.role.system.edit - - system.organization.role.system.delete - - system.organization.role.team.view - - system.organization.role.team.add - - system.organization.role.team.edit - - system.organization.role.team.delete - - name: API Market - cname: 'API市场' - value: 'api_market' - children: - - name: service classification - cname: '服务分类' - value: 'service_classification' - children: - - system.api_market.service_classification.view - - system.api_market.service_classification.add - - system.api_market.service_classification.edit - - system.api_market.service_classification.delete - - name: devops - cname: 运维 - value: 'devops' - children: - - name: cluster - cname: 集群 - value: 'cluster' - children: - - system.settings.api_gateway.view - - system.devops.cluster.add - - system.devops.cluster.edit - - system.devops.cluster.delete - - name: ssl certificate - cname: 证书 - value: 'ssl_certificate' - children: - - system.settings.ssl_certificate.view - - system.devops.ssl_certificate.add - - system.devops.ssl_certificate.edit - - system.devops.ssl_certificate.delete - - name: log configuration - cname: 日志 - value: 'log_configuration' - children: - - system.settings.log_configuration.view - - system.devops.log_configuration.add - - system.devops.log_configuration.edit - - system.devops.log_configuration.publish - - system.devops.log_configuration.delete - - name: workspace - cname: 工作空间 - value: 'workspace' - children: - - name: application - cname: 应用 - value: 'application' - children: - - system.workspace.application.view_all - - name: service - cname: 服务 - value: 'service' - children: - - system.workspace.service.view_all - - name: team - cname: 团队 - value: 'team' - children: - - system.workspace.team.view_all - - name: api market - cname: API市场 - value: 'api_market' - children: - - system.api_portal.api_portal.view -team: - - name: service - cname: 服务 - value: 'service' - children: - - name: api - cname: API - value: 'api' - children: - - team.service.api_doc.view - - team.service.api_doc.add - - team.service.api_doc.edit - - name: route - cname: route - value: 'route' - children: - - team.service.router.view - - team.service.router.add - - team.service.router.edit - - team.service.router.delete - - name: upstream - cname: 上游 - value: 'upstream' - children: - - team.service.upstream.view - - team.service.upstream.add - - team.service.upstream.edit - - team.service.upstream.delete - - name: release - cname: 发布 - value: 'release' - children: - - team.service.release.view - - team.service.release.add - - team.service.release.rollback - - team.service.release.delete - - team.service.release.approval - - team.service.release.online - - team.service.release.cancel - - team.service.release.stop - - name: subscription management - cname: 订阅方管理 - value: 'subscription' - children: - - team.service.subscription.view - - team.service.subscription.approval - - team.service.subscription.add - - team.service.subscription.delete - - name: service - cname: 服务管理 - value: 'service' - children: - - team.service.service.view - - team.service.service.add - - team.service.service.edit - - team.service.service.delete - - name: application - cname: 应用 - value: 'application' - children: - - name: subscription Service - cname: 订阅服务 - value: 'subscription' - children: - - team.application.subscription.view - - team.application.subscription.add - - team.application.subscription.edit - - team.application.subscription.delete - - name: authorization - cname: 访问授权 - value: 'authorization' - children: - - team.consumer.authorization.view - - team.consumer.authorization.manager - - team.application.authorization.add - - team.application.authorization.edit - - team.application.authorization.delete - - name: application - cname: 应用 - value: 'application' - children: - - team.application.application.view - - team.application.application.add - - team.application.application.edit - - team.application.application.delete - - name: team - cname: 团队 - value: 'team' - children: - - name: member - cname: 成员 - value: 'member' - children: - - team.team.member.view - - team.team.member.add - - team.team.member.edit - - name: team - cname: 团队管理 - value: 'team' - children: - - team.team.team.view - - team.team.team.edit diff --git a/frontend/packages/common/src/const/policy/type.ts b/frontend/packages/common/src/const/policy/type.ts index f91403aa..084d5f90 100644 --- a/frontend/packages/common/src/const/policy/type.ts +++ b/frontend/packages/common/src/const/policy/type.ts @@ -1,5 +1,6 @@ import { DefaultOptionType } from "antd/es/select"; import { StrategyStatusEnum } from "./consts"; +import { EntityItem } from "../type"; export type DataMaskRuleTableProps = { disabled?: boolean; @@ -58,18 +59,18 @@ export type DataMaskStrategyItem = { name:string priority:number isStop:boolean - isDeleted:boolean + isDelete:boolean publishStatus:keyof typeof StrategyStatusEnum filters:string conf:string - operator:string + updater:EntityItem updateTime:string } export type FilterFormField= { name: string; - value:string[] |string; + values:string[] |string; label:string title:string } @@ -92,7 +93,8 @@ export type FilterFormField= { export type FilterFormType = { name:string - value:unknown + values:unknown + type?:string } export type FilterFormProps = { @@ -102,6 +104,7 @@ export type FilterFormType = { disabled: boolean; onFilterFormChange: (form: FilterFormType) => void; setFormCanSubmit:(canSubmit:boolean)=>void + serviceId?:string } export type FilterFormHandle = { @@ -115,6 +118,7 @@ export type FilterFormType = { disabled:boolean option:unknown onShowValueChange?:(value:string)=>void + serviceId?:string } export type RemoteTitleType = { diff --git a/frontend/packages/common/src/contexts/GlobalStateContext.tsx b/frontend/packages/common/src/contexts/GlobalStateContext.tsx index 8fa8215e..713c9ffd 100644 --- a/frontend/packages/common/src/contexts/GlobalStateContext.tsx +++ b/frontend/packages/common/src/contexts/GlobalStateContext.tsx @@ -12,7 +12,7 @@ import { RouteConfig } from "@common/const/type"; import { ProtectedRoute } from "@core/components/aoplatform/RenderRoutes"; import Login from "@core/pages/Login"; import { useLocaleContext } from "./LocaleContext"; - +import Root from "@core/pages/Root" interface GlobalState { isAuthenticated: boolean; userData: UserData | null; @@ -21,6 +21,7 @@ interface GlobalState { powered:string; mainPage:string; language:string; + pluginsLoaded:boolean } interface UserData { @@ -36,6 +37,7 @@ export type GlobalAction = | { type: 'UPDATE_POWER'; powered: string } | { type: 'UPDATE_MAIN_PAGE'; mainPage: string } | { type: 'UPDATE_LANGUAGE'; language: string } + | { type: 'SET_PLUGINS_LOADED'; pluginsLoaded: boolean } const mockData = [ @@ -270,6 +272,11 @@ const globalReducer = (state: GlobalState, action: GlobalAction): GlobalState => ...state, language: action.language, }; + case 'SET_PLUGINS_LOADED': + return { + ...state, + pluginsLoaded: action.pluginsLoaded, + }; default: return state; } @@ -277,7 +284,7 @@ const globalReducer = (state: GlobalState, action: GlobalAction): GlobalState => export const DefaultRouteConfig = [ - { path: '/', pathMatch: 'full', component: ,key:'root',}, + { path: '/', pathMatch: 'full', component: ,key:'root',}, { path: '/login', component: ,key:'login'}, { path: '/', pathMatch:'prefix',component: ,key:'basciLayout',children:[ { path: '*', component: , key: 'errorBoundary' } @@ -288,13 +295,14 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => { const { message } = App.useApp() const { setLocale } = useLocaleContext(); const [state, dispatch] = useReducer(globalReducer, { - isAuthenticated: true, //mock用 + isAuthenticated: false, //mock用 userData: null, version: '1.0.0', updateDate: '2024-07-01', powered:'Powered by https://apipark.com', mainPage:'/guide/page', - language:'en-US' + language:'en-US', + pluginsLoaded:false }); const [accessData,setAccessData] = useState>(new Map()) const [pluginAccessDictionary, setPluginAccessDictionary] = useState<{[k:string]:string}>({}) diff --git a/frontend/packages/common/src/locales/keyHashMap.json b/frontend/packages/common/src/locales/keyHashMap.json index 6fd4a111..013310fb 100644 --- a/frontend/packages/common/src/locales/keyHashMap.json +++ b/frontend/packages/common/src/locales/keyHashMap.json @@ -333,6 +333,7 @@ "API 路由": "K51d1eb5d", "API 文档": "Ka2b6d281", "使用说明": "Kdefa9caa", + "服务策略": "K52f72551", "发布": "K36856e71", "订阅管理": "K6382bbfd", "订阅审核": "K31af5b99", @@ -384,6 +385,8 @@ "发布申请": "K56b4254f", "API 调用地址": "Kea2f9279", "API base URL 一般设置为API 网关的外部网络访问地址,或者是API网关绑定的域名。": "K7fc496a1", + "集成地址": "K508d8bf4", + "与外部平台集成时,获取 API 市场中文档信息的域名": "K67f4e9bb", "常规设置": "K8ab0fc95", "API 请求设置": "Kb66fec9d", "服务分类": "K4de0af74", @@ -463,7 +466,6 @@ "添加部门": "K26c698bb", "添加子部门": "Kb9cf2a7d", "重命名": "Kc83551f5", - "该数据删除后将无法找回,请确认是否删除?": "K5cfdd950", "成员": "K74aef1ad", "设置成员和对应的角色,成员只能够看到权限范围内的功能和数据。": "K3f1077c9", "搜索部门": "Kdce62a6", @@ -560,7 +562,6 @@ "删除服务": "Kde6bae17", "删除操作不可恢复,请谨慎操作!": "K885ea699", "上游": "Kda8d5ea1", - "服务策略": "K52f72551", "服务提供了高性能 API 网关,并且可以无缝接入多种大型 AI 模型,并将这些 AI 能力打包成 API 进行调用,从而大幅简化了 AI 模型的使用门槛。同时,我们的平台提供了完善的 API 管理功能,支持 API 的创建、监控、访问控制等,保障开发者可以高效、安全地开发和管理 API 服务。": "K12f58863", "添加服务": "K2d6658ed", "输入名称、ID、所属团队、负责人查找服务": "K7b8f623f", diff --git a/frontend/packages/common/src/locales/scan/en-US.json b/frontend/packages/common/src/locales/scan/en-US.json index a693bcda..712a426c 100644 --- a/frontend/packages/common/src/locales/scan/en-US.json +++ b/frontend/packages/common/src/locales/scan/en-US.json @@ -744,5 +744,8 @@ "K8457ea34": "All (0)", "K7ca9a795": "Attribute Name", "Kc4391744": "Attribute Value", - "K678e13fc": "Configure (0)" + "K678e13fc": "Configure (0)", + "K508d8bf4": "Integration Address", + "K67f4e9bb": "The domain name for obtaining API market documentation information when integrating with external platforms" + } diff --git a/frontend/packages/common/src/locales/scan/ja-JP.json b/frontend/packages/common/src/locales/scan/ja-JP.json index 8559a6bb..42b46394 100644 --- a/frontend/packages/common/src/locales/scan/ja-JP.json +++ b/frontend/packages/common/src/locales/scan/ja-JP.json @@ -766,5 +766,8 @@ "K8457ea34": "すべて (0)", "K7ca9a795": "属性名", "Kc4391744": "属性値", - "K678e13fc": "設定 (0)" + "K678e13fc": "設定 (0)", + "K508d8bf4": "統合アドレス", + "K67f4e9bb": "外部プラットフォームと統合する際に、API市場のドキュメント情報を取得するためのドメイン名" + } diff --git a/frontend/packages/common/src/locales/scan/newJson/en-US.json b/frontend/packages/common/src/locales/scan/newJson/en-US.json index 9e26dfee..140d2c42 100644 --- a/frontend/packages/common/src/locales/scan/newJson/en-US.json +++ b/frontend/packages/common/src/locales/scan/newJson/en-US.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "K508d8bf4": "集成地址", + "K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名" +} \ No newline at end of file diff --git a/frontend/packages/common/src/locales/scan/newJson/ja-JP.json b/frontend/packages/common/src/locales/scan/newJson/ja-JP.json index 9e26dfee..140d2c42 100644 --- a/frontend/packages/common/src/locales/scan/newJson/ja-JP.json +++ b/frontend/packages/common/src/locales/scan/newJson/ja-JP.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "K508d8bf4": "集成地址", + "K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名" +} \ No newline at end of file diff --git a/frontend/packages/common/src/locales/scan/newJson/zh-CN.json b/frontend/packages/common/src/locales/scan/newJson/zh-CN.json index 878c5a8e..5b99ccce 100644 --- a/frontend/packages/common/src/locales/scan/newJson/zh-CN.json +++ b/frontend/packages/common/src/locales/scan/newJson/zh-CN.json @@ -42,6 +42,8 @@ "K49731763": "请输入IP地址或CIDR范围,每条以换行分割", "K83237c89": "输入的IP或CIDR不符合格式", "K5ae2c87a": "请正确输入路径,如/usr/*或*/usr/*", + "K508d8bf4": "集成地址", + "K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名", "Kc82b8374": "编辑策略", "K4b34a5e5": "策略类型", "K57f0fee8": "匹配条件", diff --git a/frontend/packages/common/src/locales/scan/newJson/zh-TW.json b/frontend/packages/common/src/locales/scan/newJson/zh-TW.json index 9e26dfee..140d2c42 100644 --- a/frontend/packages/common/src/locales/scan/newJson/zh-TW.json +++ b/frontend/packages/common/src/locales/scan/newJson/zh-TW.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "K508d8bf4": "集成地址", + "K67f4e9bb": "与外部平台集成时,获取 API 市场中文档信息的域名" +} \ No newline at end of file diff --git a/frontend/packages/common/src/locales/scan/oldJson/en-US.json b/frontend/packages/common/src/locales/scan/oldJson/en-US.json index f4755dd7..6599b2f7 100644 --- a/frontend/packages/common/src/locales/scan/oldJson/en-US.json +++ b/frontend/packages/common/src/locales/scan/oldJson/en-US.json @@ -10,6 +10,7 @@ "K1deaa2dd": "User", "K631d646f": "Open API", "K1196b104": "APIPark", + "K5cfdd950": "This data cannot be recovered after deletion. Are you sure you want to delete?", "Kb9052305": "Search Username, Email", "K40a89bd8": "Enter Name, ID to Search Member" } \ No newline at end of file diff --git a/frontend/packages/common/src/locales/scan/oldJson/ja-JP.json b/frontend/packages/common/src/locales/scan/oldJson/ja-JP.json index 56a74a5c..d468aa53 100644 --- a/frontend/packages/common/src/locales/scan/oldJson/ja-JP.json +++ b/frontend/packages/common/src/locales/scan/oldJson/ja-JP.json @@ -16,6 +16,7 @@ "K9bdd8403": "API を安全に呼び出すためには、アプリケーションとトークンを作成する必要があります。", "Kc8239422": "チームにはユーザー、アプリケーション、サービスが含まれ、異なるチームのアプリケーションとサービスのデータは分離されています。企業内の部門/プロジェクトグループ/チームの管理に使用できます。", "Ka0a8840a": "他のアプリケーションのサブスクリプション申請をレビューし、承認後に API リクエストが発行できます。", + "K5cfdd950": "このデータを削除すると、復元できません。削除しますか?", "Kb9052305": "ユーザー名またはメールを検索", "K5ece3bac": "チームとメンバーを設定してから、チーム内でサービスとアプリケーションを作成し、API をサブスクライブできます。メンバーは所属チーム内のサービスとアプリケーションのみを表示できます。", "K1512e983": "アプリケーション呼び出し統計", diff --git a/frontend/packages/common/src/locales/scan/oldJson/zh-CN.json b/frontend/packages/common/src/locales/scan/oldJson/zh-CN.json index 502e8f18..991aad93 100644 --- a/frontend/packages/common/src/locales/scan/oldJson/zh-CN.json +++ b/frontend/packages/common/src/locales/scan/oldJson/zh-CN.json @@ -16,6 +16,7 @@ "K9bdd8403": "为了安全地调用 API,你需要创建一个消费者以及Token。", "Kc8239422": "团队中包含了人员、消费者和服务,不同团队之间的消费者和服务数据是隔离的,可用于管理企业内部不同的部门/项目组/团队。", "Ka0a8840a": "审核其他消费者的订阅申请,审核通过后的才可发起 API 请求。", + "K5cfdd950": "该数据删除后将无法找回,是否删除?", "Kb9052305": "搜索用户名、邮箱", "K5ece3bac": "设置团队和成员,然后你可以在团队内创建服务和消费者、订阅API,成员只能看到所属团队内的服务和消费者。", "K1512e983": "消费者调用统计", diff --git a/frontend/packages/common/src/locales/scan/oldJson/zh-TW.json b/frontend/packages/common/src/locales/scan/oldJson/zh-TW.json index 46e9364a..357d2bae 100644 --- a/frontend/packages/common/src/locales/scan/oldJson/zh-TW.json +++ b/frontend/packages/common/src/locales/scan/oldJson/zh-TW.json @@ -16,6 +16,7 @@ "K9bdd8403": "為了安全地調用 API,你需要創建一個應用以及Token。", "Kc8239422": "團隊中包含了人員、應用程式和服務,不同團隊之間的應用程式和服務數據是隔離的,可用於管理企業內部不同的部門/項目組/團隊。", "Ka0a8840a": "審核其他應用程式的訂閱申請,審核通過後的才可發起 API 請求。", + "K5cfdd950": "該數據刪除後將無法找回,是否刪除?", "Kb9052305": "搜索用戶名、電郵", "K5ece3bac": "設置團隊和成員,然後你可以在團隊內創建服務和應用程式、訂閱API,成員只能看到所屬團隊內的服務和應用程式。", "K1512e983": "應用程式調用統計", diff --git a/frontend/packages/common/src/locales/scan/zh-TW.json b/frontend/packages/common/src/locales/scan/zh-TW.json index 6c5787a9..5e7bd1d7 100644 --- a/frontend/packages/common/src/locales/scan/zh-TW.json +++ b/frontend/packages/common/src/locales/scan/zh-TW.json @@ -766,5 +766,8 @@ "K8457ea34": "所有(0)", "K7ca9a795": "屬性名稱", "Kc4391744": "屬性值", - "K678e13fc": "配置(0)" + "K678e13fc": "配置(0)", + "K508d8bf4": "集成地址", + "K67f4e9bb": "與外部平台集成時,用於獲取 API 市場文檔信息的域名" + } diff --git a/frontend/packages/core/src/components/aoplatform/RenderRoutes.tsx b/frontend/packages/core/src/components/aoplatform/RenderRoutes.tsx index 29ae48b1..9f66e989 100644 --- a/frontend/packages/core/src/components/aoplatform/RenderRoutes.tsx +++ b/frontend/packages/core/src/components/aoplatform/RenderRoutes.tsx @@ -15,7 +15,7 @@ import { LoadingOutlined } from '@ant-design/icons'; const RenderRoutes = ()=> { const { loadPlugins,loadExecutedPlugin } = usePluginLoader(ApiparkPluginDriver(routerMap), routerMap) - const { routeConfig } = useGlobalContext(); + const { routeConfig,dispatch,state } = useGlobalContext(); const [router, setRouter] = useState(null); useEffect(()=>{ @@ -28,10 +28,11 @@ const RenderRoutes = ()=> { if (routeConfig && routeConfig.length > 0) { const routerInstance = createBrowserRouter(generateRoutes(routeConfig)); setRouter(routerInstance); + dispatch({ type: 'SET_PLUGINS_LOADED', pluginsLoaded: true }); } }, [routeConfig]); - if (!router) { + if (!router || !state?.pluginsLoaded) { return } spinning={true} className='w-full h-full flex items-center justify-center'>; } @@ -77,7 +78,9 @@ const generateRoutes = (routerConfig: RouteConfig[]):RouteObject[] => { { path: route.path, element: {routeElement} , - children: route.children ? generateRoutes(route.children as RouteConfig[]) : undefined,} + children: route.children ? generateRoutes(route.children as RouteConfig[]) : undefined, + exact:route?.pathMatch === 'full' + } ); } ) @@ -85,8 +88,8 @@ const generateRoutes = (routerConfig: RouteConfig[]):RouteObject[] => { // 保护的路由组件 export function ProtectedRoute() { - const {state} = useGlobalContext() - return state.isAuthenticated? : ; + // return state.isAuthenticated? : ; + return } export default RenderRoutes diff --git a/frontend/packages/core/src/const/const.tsx b/frontend/packages/core/src/const/const.tsx index 5428b72a..bf4b7923 100644 --- a/frontend/packages/core/src/const/const.tsx +++ b/frontend/packages/core/src/const/const.tsx @@ -1,3 +1,4 @@ +import component from '@common/components/aoplatform/prompt-editor/plugins/workflow-variable-block/component'; import { RouterMapConfig } from '@common/const/type'; import { ProtectedRoute } from '@core/components/aoplatform/RenderRoutes'; import { AiServiceProvider } from '@core/contexts/AiServiceContext'; @@ -6,6 +7,7 @@ import { TeamProvider } from '@core/contexts/TeamContext'; import AiServiceOutlet from '@core/pages/aiService/AiServiceOutlet'; import Guide from '@core/pages/guide/Guide'; import Login from '@core/pages/Login'; +import ServicePolicyLayout from '@core/pages/policy/ServicePolicyLayout'; import SystemOutlet from '@core/pages/system/SystemOutlet'; import { TenantManagementProvider } from '@market/contexts/TenantManagementContext'; import { lazy } from 'react'; @@ -171,10 +173,29 @@ import { Outlet, Navigate } from 'react-router-dom'; }, { path:'servicepolicy', - key: 'servicePolicy', - lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/servicePolicy')), - children:[ - + key: 'servicepolicy', + component:, + children:[{ + path:'datamasking', + component:, + key:'dataMasking', + children:[ + { + path:'list', + lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/servicePolicy')), + key:'dataMaskingList' + }, + { + path:'create', + lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/dataMasking/DataMaskingConfig')), + key:'dataMaskingAdd' + }, + { + path:':policyId', + lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/dataMasking/DataMaskingConfig')), + key:'dataMaskingAdd' + }] + } ] }, ] @@ -265,11 +286,30 @@ import { Outlet, Navigate } from 'react-router-dom'; }, { path:'servicepolicy', - key: 'servicePolicy', - lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/servicePolicy')), - children:[ - - ] + key: 'servicepolicy', + component:, + children:[{ + path:'datamasking', + component:, + key:'dataMasking', + children:[ + { + path:'list', + lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/servicePolicy')), + key:'dataMaskingList' + }, + { + path:'create', + lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/dataMasking/DataMaskingConfig')), + key:'dataMaskingAdd' + }, + { + path:':policyId', + lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/policy/dataMasking/DataMaskingConfig')), + key:'dataMaskingAdd' + }] + } + ] }, ] } diff --git a/frontend/packages/core/src/pages/Login.tsx b/frontend/packages/core/src/pages/Login.tsx index 120b28f2..0af56a93 100644 --- a/frontend/packages/core/src/pages/Login.tsx +++ b/frontend/packages/core/src/pages/Login.tsx @@ -1,5 +1,5 @@ import {FC, useCallback, useEffect, useRef, useState} from "react"; -import {App, Button, Divider, Form, FormInstance, Input, Tooltip} from "antd"; +import {App, Button, Divider, Form, FormInstance, Input, Spin, Tooltip} from "antd"; import {useGlobalContext} from "@common/contexts/GlobalStateContext.tsx"; import {useFetch} from "@common/hooks/http.ts"; import {BasicResponse, STATUS_CODE} from "@common/const/const.tsx"; @@ -9,6 +9,7 @@ import Logo from '@common/assets/layout-logo.png' import { $t } from "@common/locales"; import { Icon } from "@iconify/react/dist/iconify.js"; import LanguageSetting from "@common/components/aoplatform/LanguageSetting"; +import { LoadingOutlined } from "@ant-design/icons"; const Login:FC = ()=> { const {state, dispatch} = useGlobalContext() @@ -17,20 +18,21 @@ const Login:FC = ()=> { const navigate = useNavigate(); const formRef = useRef(null); const [loading,setLoading] = useState() - // const { encryptByEnAES } = useCrypto(); const [allowGuest, setAllowGuest] = useState(false) + const [spinning,setSpinning] = useState(false) const check = useCallback(()=>{ + state.isAuthenticated &&setSpinning(true) fetchData, status:string}>>('account/login',{method:'GET'}).then(response=>{ const {code,data} = response - if(code === STATUS_CODE.SUCCESS && data.status !== 'anonymous'){ dispatch({type:'LOGIN'}) - navigate(state.mainPage) + navigate(state.mainPage,{replace:true}) }else{ dispatch({type:'LOGOUT'}) setAllowGuest(data.channel.filter(x=>x.name === 'guest_access').length > 0) + setSpinning(false) } }) },[]) @@ -100,6 +102,8 @@ const Login:FC = ()=> { }, []); return ( + spinning? + } spinning={spinning} className='w-full h-full flex items-center justify-center'> :
) } - ],[state.language]) + ],[state.language,handleDeleteFilter]) useEffect(()=>{ getFilterOptions() },[state.language]) + useEffect(()=>{ + setSelectedOptionNameSet(new Set(value?.map(x=>x.name) || [])) + },[value]) return (
{ @@ -116,7 +119,7 @@ const FilterTable: React.FC = ({ className={`mt-btnybase border-solid border-[1px] border-BORDER border-b-0 rounded ${disabled ? '' : 'mt-btnbase'}`} pagination={false} size='small' - columns={columns} dataSource={value} rowKey='id' /> } + columns={columns} dataSource={value} rowKey='_eoKey' /> }
= ({ selectedOptionNameSet={selectedOptionNameSet} disabled={disabled} setFormCanSubmit={setFormCanSubmit} + serviceId={serviceId} />
diff --git a/frontend/packages/core/src/pages/policy/ServicePolicyLayout.tsx b/frontend/packages/core/src/pages/policy/ServicePolicyLayout.tsx new file mode 100644 index 00000000..8ae89112 --- /dev/null +++ b/frontend/packages/core/src/pages/policy/ServicePolicyLayout.tsx @@ -0,0 +1,15 @@ +import { useEffect } from "react"; +import { Outlet, useLocation, useNavigate } from "react-router-dom"; + +export default function ServicePolicyLayout(){ + const location = useLocation() + const pathName = location.pathname + const navigator = useNavigate() + useEffect(()=>{ + const tmpPath = pathName.split('/') + if(tmpPath[tmpPath.length -1 ] === 'servicepolicy'){ + navigator('datamasking/list') + } + },[pathName]) + return () +} \ No newline at end of file diff --git a/frontend/packages/core/src/pages/policy/dataMasking/DataMasking.tsx b/frontend/packages/core/src/pages/policy/dataMasking/DataMasking.tsx index 23dc41b0..5973b939 100644 --- a/frontend/packages/core/src/pages/policy/dataMasking/DataMasking.tsx +++ b/frontend/packages/core/src/pages/policy/dataMasking/DataMasking.tsx @@ -1,10 +1,10 @@ import { ActionType } from "@ant-design/pro-components"; -import { useMemo, useRef, useState } from "react"; -import { Button, message, Switch } from 'antd' +import { useEffect, useMemo, useRef, useState } from "react"; +import { App, Button, message, Switch } from 'antd' import PageList, { PageProColumns } from "@common/components/aoplatform/PageList"; import { $t } from "@common/locales"; import { useGlobalContext } from "@common/contexts/GlobalStateContext"; -import { BasicResponse, RESPONSE_TIPS, STATUS_CODE } from "@common/const/const.tsx"; +import { BasicResponse, DELETE_TIPS, RESPONSE_TIPS, STATUS_CODE } from "@common/const/const.tsx"; import { useFetch } from "@common/hooks/http"; import WithPermission from "@common/components/aoplatform/WithPermission.tsx"; import TableBtnWithPermission from "@common/components/aoplatform/TableBtnWithPermission"; @@ -14,6 +14,7 @@ import { PolicyPublishInfoType, PolicyPublishModalHandle, RouterParams } from "@ import { DrawerWithFooter } from "@common/components/aoplatform/DrawerWithFooter"; import { DataMaskStrategyItem } from "@common/const/policy/type"; import {PolicyPublishModalContent} from '@common/components/aoplatform/PolicyPublishModalContent' +import { checkAccess } from "@common/utils/permission"; const DataMasking = (props: any) => { @@ -24,12 +25,14 @@ const DataMasking = (props: any) => { rowOperation = [] } = props; const { serviceId, teamId } = useParams() - const { state } = useGlobalContext() + const { state,accessData } = useGlobalContext() const navigator = useNavigate() const [drawerVisible, setDrawerVisible] = useState(false) const [drawerData, setDrawerData] = useState() const [isOkToPublish, setIsOkToPublish] = useState(false) const drawerRef = useRef(null) + const { modal } = App.useApp() + /** * 列表ref */ @@ -52,7 +55,7 @@ const DataMasking = (props: any) => { const res = DATA_MASSKING_TABLE_COLUMNS.map(x => { // 启动列渲染 if (x.dataIndex === 'isStop') { - x.render = (text: any, record: any) => { changeOpenApiStatus(e, record) }} /> + x.render = (text: any, record: any) => { changeOpenApiStatus(e, record) }} /> } // 处理数列渲染 if (x.dataIndex === 'treatmentNumber') { @@ -77,11 +80,11 @@ const DataMasking = (props: any) => { fixed: 'right', valueType: 'option', render: (_: React.ReactNode, entity: any) => [ - ...(rowOperation.length && rowOperation.find((item: string) => item === 'edit') ? [ { openEditModal(entity) }} btnTitle="编辑" />] : []), - // ...(rowOperation.length && rowOperation.find((item: string) => item === 'logs') ? [ { openLogsModal(entity) }} btnTitle="详情" />] : []), + ...(rowOperation.length && rowOperation.find((item: string) => item === 'edit') ? [ { openEditModal(entity) }} btnTitle="编辑" />] : []), + // ...(rowOperation.length && rowOperation.find((item: string) => item === 'logs') ? [ { openLogsModal(entity) }} btnTitle="详情" />] : []), ...(rowOperation.length && rowOperation.find((item: string) => item === 'delete') ? [ - entity.isDeleted ? { restorePolicy(entity) }} btnTitle="恢复" /> : - { deletePolicy(entity) }} btnTitle="删除" /> + entity.isDelete ? { restorePolicy(entity) }} btnTitle="恢复" /> : + { openModal('delete',entity) }} btnTitle="删除" /> ] : []), ], } @@ -101,9 +104,9 @@ const DataMasking = (props: any) => { */ const changeOpenApiStatus = (enabled: boolean, entity: any) => { fetchData>( - `strategy/${serviceId === undefined? 'global':'service'}/data-masking/${enabled ? 'disable' : 'enable'}`, + `strategy/${serviceId === undefined? 'global':'service'}/data-masking/${enabled ? 'enable' :'disable' }`, { - method: 'PUT', + method: 'PATCH', eoParams: { service:serviceId, team:teamId, @@ -159,14 +162,14 @@ const DataMasking = (props: any) => { keyword: searchWord, service:serviceId, team:teamId,}, - eoTransformKeys: ['is_stop', 'is_deleted', 'update_time','publish_status','processed_total'] + eoTransformKeys: ['is_stop', 'is_delete', 'update_time','publish_status','processed_total'] } ).then(response => { const { code,data, msg } = response if (code === STATUS_CODE.SUCCESS) { // 保存数据 return { - data:data.strategies, + data:data.list, total:data.total, success: true } @@ -186,7 +189,7 @@ const DataMasking = (props: any) => { * @param type */ const addPolicy = () => { - navigator('/globalpolicy/datamasking/create') + navigator('../create') } /** @@ -213,7 +216,7 @@ const DataMasking = (props: any) => { * 编辑 */ const openEditModal = (entity: any) => { - navigator(`/globalpolicy/datamasking/${entity.id}`) + navigator(`../${entity.id}`) } /** @@ -224,12 +227,47 @@ const DataMasking = (props: any) => { console.log('日志', entity); } + + + const openModal =async (type:'delete',entity?:DataMaskStrategyItem)=>{ + if(entity?.publishStatus === 'online'){ + return deletePolicy(entity!).then((res)=>{if(res === true) manualReloadTable()}) + } + let title:string = '' + let content:string|React.ReactNode = '' + switch (type){ + case 'delete': + title=$t('删除') + content=$t(DELETE_TIPS.default) + break; + } + + modal.confirm({ + title, + content, + onOk:()=>{ + switch (type){ + case 'delete': + return deletePolicy(entity!).then((res)=>{if(res === true) manualReloadTable()}) + } + }, + width:600, + okText:$t('确认'), + okButtonProps:{ + disabled : !checkAccess( `${ serviceId === undefined ? 'system.devops':'team.service'}.policy.edit`, accessData) + }, + cancelText:$t('取消'), + closable:true, + icon:<>, + }) +} + /** * 删除 * @param entity */ const deletePolicy = (entity: DataMaskStrategyItem) => { - fetchData>( + return fetchData>( `strategy/${serviceId === undefined? 'global':'service'}/data-masking`, { method: 'DELETE', @@ -242,11 +280,12 @@ const DataMasking = (props: any) => { const { code, msg } = response if (code === STATUS_CODE.SUCCESS) { message.success(msg || $t(RESPONSE_TIPS.success)) - manualReloadTable() + return Promise.resolve(true) } else { message.error(msg || $t(RESPONSE_TIPS.error)) + return Promise.reject(msg || $t(RESPONSE_TIPS.error)) } - }) + }).catch((errorInfo)=> Promise.reject(errorInfo)) } /** @@ -295,11 +334,11 @@ const DataMasking = (props: any) => { sort:Record, filter:Record) => getPolicyList(params,sort, filter)} addNewBtnTitle={$t("添加策略")} - addNewBtnAccess="system.organization.member.edit" + addNewBtnAccess={`${ serviceId === undefined ? 'system.devops':'team.service'}.policy.edit`} onAddNewBtnClick={() => { addPolicy() }} searchPlaceholder={$t("输入名称、筛选条件查找")} afterNewBtn={ - publishBtn && [ + publishBtn && [ ] } @@ -316,7 +355,7 @@ const DataMasking = (props: any) => { okBtnTitle={$t('发布')} open={drawerVisible} submitDisabled={!isOkToPublish} - submitAccess={`team.service.release.add`} + submitAccess={`${ serviceId === undefined ? 'system.devops':'team.service'}.policy.publish`} onSubmit={onSubmit} > [] = [ }, { title: ('更新者'), - dataIndex: 'operator', + dataIndex: ['updater','name'], width: 140, ellipsis: true }, diff --git a/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingConfig.tsx b/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingConfig.tsx index fdeb9416..edccdf47 100644 --- a/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingConfig.tsx +++ b/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingConfig.tsx @@ -11,8 +11,9 @@ import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "r import { useParams, useNavigate } from "react-router-dom" import DataMaskRuleTable from "./DataMaskingRuleTable" import FilterTable from "../FilterTable" -import { DataMaskingConfigHandle ,DataMaskingConfigFieldType} from "@common/const/policy/type" +import { DataMaskingConfigHandle ,DataMaskingConfigFieldType, PolicyMatchType} from "@common/const/policy/type" import {PolicyOptions} from '@common/const/policy/consts' +import {v4 as uuidv4} from 'uuid' const DataMaskingConfig = forwardRef((_,ref) => { const { message,modal } = App.useApp() @@ -37,7 +38,8 @@ const DataMaskingConfig = forwardRef((_,ref) => { setTimeout(()=>{ form.setFieldsValue({ ...data.strategy, - type:'data-masking' + type:'data-masking', + filters:data.strategy.filters.map((x)=>{x._eoKey = uuidv4(); return x}) }) },0) }else{ @@ -48,16 +50,22 @@ const DataMaskingConfig = forwardRef((_,ref) => { const onFinish:()=>Promise = () => { return form.validateFields().then((value)=>{ + if(value.filters){ + value.filters = value.filters.map((x:PolicyMatchType)=>({ + ...x, + values:x.name === 'ip' ? x.values?.[0].split('\n'): (x.values.indexOf('ALL')!== -1 ? ['ALL']:x.values)})) + } return fetchData>( `strategy/${serviceId === undefined? 'global':'service'}/data-masking`, { method:policyId === undefined? 'POST' : 'PUT', - eoParams: {service:serviceId,team:teamId, policyId:policyId}, + eoParams: {service:serviceId,team:teamId, strategy:policyId}, eoBody:({...value}) }).then(response=>{ const {code,data,msg} = response if(code === STATUS_CODE.SUCCESS){ message.success(msg || $t(RESPONSE_TIPS.success)) + navigator('../list') return Promise.resolve(true) }else{ message.error(msg || $t(RESPONSE_TIPS.error)) @@ -84,14 +92,13 @@ const DataMaskingConfig = forwardRef((_,ref) => { return ( - } spinning={loading} wrapperClassName=' pb-PAGE_INSIDE_B pr-PAGE_INSIDE_X'> - - +
((_,ref) => { - label={$t("优先级")} name={'priority'} @@ -145,19 +151,19 @@ const DataMaskingConfig = forwardRef((_,ref) => { label={$t("数据脱敏规则")} - name="rules" + name={["config","rules"]} rules={[{required: true}]} > - + - diff --git a/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingRuleForm.tsx b/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingRuleForm.tsx index 4ad2707a..baed9c5b 100644 --- a/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingRuleForm.tsx +++ b/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingRuleForm.tsx @@ -95,8 +95,8 @@ const DataMaskRuleForm: React.FC = ({ editData, ruleList, case 'shuffling': break; default: - submitData.mask.begin = formData.mask.begin; - submitData.mask.length = formData.mask.length; + submitData.mask.begin = Number(formData.mask.begin) || 0; + submitData.mask.length = Number(formData.mask.length) || 0; break; } return submitData; diff --git a/frontend/packages/core/src/pages/policy/globalPolicy.tsx b/frontend/packages/core/src/pages/policy/globalPolicy.tsx index 0193dc44..01cd4ce7 100644 --- a/frontend/packages/core/src/pages/policy/globalPolicy.tsx +++ b/frontend/packages/core/src/pages/policy/globalPolicy.tsx @@ -4,10 +4,12 @@ import PolicyTabContainer from "./policyTabContainer.tsx"; import DataMasking from "./dataMasking/DataMasking.tsx"; import { useGlobalContext } from "@common/contexts/GlobalStateContext.tsx"; import { useMemo } from "react"; - +import { useParams } from "react-router-dom"; +import { RouterParams } from "@common/const/type.ts"; const PartitionInsideGlobalPolicy = () => { const {state} = useGlobalContext() + const {serviceId} = useParams() /** * tab列表 */ @@ -20,7 +22,6 @@ const PartitionInsideGlobalPolicy = () => { ],[state.language]) return ( - <> { > - ) } diff --git a/frontend/packages/core/src/pages/policy/servicePolicy.tsx b/frontend/packages/core/src/pages/policy/servicePolicy.tsx index 1fbfacea..793c1d0b 100644 --- a/frontend/packages/core/src/pages/policy/servicePolicy.tsx +++ b/frontend/packages/core/src/pages/policy/servicePolicy.tsx @@ -1,6 +1,6 @@ import { $t } from "@common/locales/index.ts"; import DataMasking from "./dataMasking/DataMasking"; -import PolicyTabContainer from "./globalPolicy.tsx"; +import PolicyTabContainer from "./policyTabContainer.tsx"; const servicePolicy = () => { /** @@ -10,9 +10,10 @@ const servicePolicy = () => { { key: 'dataMasking', label: $t('数据脱敏'), - children:
+ children:
} ] + return ( <> diff --git a/frontend/packages/core/src/pages/system/SystemInsidePage.tsx b/frontend/packages/core/src/pages/system/SystemInsidePage.tsx index 9dd929d9..89ac2c36 100644 --- a/frontend/packages/core/src/pages/system/SystemInsidePage.tsx +++ b/frontend/packages/core/src/pages/system/SystemInsidePage.tsx @@ -63,7 +63,7 @@ const SystemInsidePage: FC = () => { getItem({$t('API 文档')}, 'api', undefined, undefined, undefined, 'team.service.api_doc.view'), getItem({$t('上游')}, 'upstream', undefined, undefined, undefined, 'team.service.upstream.view'), getItem({$t('使用说明')}, 'document', undefined, undefined, undefined, 'team.service.service_intro.view'), - getItem({$t('服务策略')}, 'servicePolicy', undefined, undefined, undefined, 'team.service.service_intro.view'), + getItem({$t('服务策略')}, 'servicepolicy', undefined, undefined, undefined, 'team.service.policy.view'), getItem({$t('发布')}, 'publish', undefined, undefined, undefined, 'team.service.release.view'), ], 'group'), @@ -111,6 +111,8 @@ const SystemInsidePage: FC = () => { setShowMenu(!routeId && !currentUrl.includes('route/create')) if (apiId !== undefined) { setActiveMenu('api') + } else if(currentUrl.includes('servicepolicy')){ + setActiveMenu('servicepolicy') } else if (serviceId !== currentUrl.split('/')[currentUrl.split('/').length - 1]) { setActiveMenu(currentUrl.split('/')[currentUrl.split('/').length - 1]) } else { diff --git a/frontend/packages/dashboard/src/component/MonitorApiPage.tsx b/frontend/packages/dashboard/src/component/MonitorApiPage.tsx index 89b8465d..67d157b8 100644 --- a/frontend/packages/dashboard/src/component/MonitorApiPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorApiPage.tsx @@ -28,7 +28,7 @@ export type MonitorApiPageProps = { detailEntityName:string } -export type MonitorApiQueryData = SearchBody & { path?:string, apis?:string[], projects?:string[] } +export type MonitorApiQueryData = SearchBody & { path?:string, apis?:string[], services?:string[] } export default function MonitorApiPage(props:MonitorApiPageProps){ const {fetchTableData,detailDrawerContent,fullScreen,setFullScreen,setDetailId,timeButton,setTimeButton,detailEntityName,setDetailEntityName} = props @@ -51,7 +51,7 @@ export default function MonitorApiPage(props:MonitorApiPageProps){ }, []); const getApiList = (projectIds?:string[])=>{ - return fetchData<{apis:EntityItem[]}>('simple/project/apis',{method:'POST',eoBody:({projects:projectIds || queryData?.projects})}).then((resp) => { + return fetchData<{apis:EntityItem[]}>('simple/service/apis',{method:'POST',eoBody:({services:projectIds || queryData?.services})}).then((resp) => { const {code,data,msg} = resp if(code === STATUS_CODE.SUCCESS){ setApiOptionList(data.apis?.map((x:EntityItem)=>({label:x.name, value:x.id}))) @@ -65,10 +65,10 @@ export default function MonitorApiPage(props:MonitorApiPageProps){ } const getProjectList = ()=>{ - return fetchData<{projects:EntityItem[]}>('simple/projects',{method:'GET'}).then((resp) => { + return fetchData<{services:EntityItem[]}>('simple/services',{method:'GET'}).then((resp) => { const {code,data,msg} = resp if(code === STATUS_CODE.SUCCESS){ - setProjectOptionList(data.projects?.map((x:EntityItem)=>({label:x.name, value:x.id}))) + setProjectOptionList(data.services?.map((x:EntityItem)=>({label:x.name, value:x.id}))) }else{ message.error(msg || $t(RESPONSE_TIPS.dataError)) return setProjectOptionList([]) @@ -164,13 +164,13 @@ export default function MonitorApiPage(props:MonitorApiPageProps){