+
{dragSortKey?
actionRef={actionRef}
columns={newColumns}
@@ -164,7 +161,7 @@ const PageList = >(props: React.PropsWithChild
request={request}
dragSortKey={dragSortKey}
onDragSortEnd={onDragSortEnd}
- scroll={{ y: tableHeight }}
+ scroll={noScroll ? undefined :{ y: tableHeight }}
options={{
reload: false,
density: false,
@@ -177,7 +174,7 @@ const PageList = >(props: React.PropsWithChild
actionRef={actionRef}
columns={newColumns}
virtual
- scroll={{x:tableWidth,y: tableHeight }}
+ scroll={noScroll ? undefined : {x:tableWidth,y: tableHeight }}
size="middle"
rowSelection={rowSelection}
tableAlertRender={false}
@@ -194,7 +191,7 @@ const PageList = >(props: React.PropsWithChild
):null,
]}
toolbar={{
- actions:[...[beforeSearchNode],...[searchPlaceholder? debounce(onSearchWordChange, 100)(e) : undefined } onPressEnter={()=>actionRef.current?.reload?.()} allowClear placeholder={searchPlaceholder} prefix={{actionRef.current?.reload?.()}}/>}/>:null]],
+ actions:[...[beforeSearchNode],...[searchPlaceholder? debounce(onSearchWordChange, 100)(e) : undefined } onPressEnter={()=>manualReloadTable ? manualReloadTable():actionRef.current?.reload?.()} allowClear placeholder={searchPlaceholder} prefix={{actionRef.current?.reload?.()}}/>}/>:null]],
}}
options={{
reload: false,
diff --git a/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx b/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx
index 99d65ad..c8e6a8c 100644
--- a/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx
+++ b/frontend/packages/common/src/components/aoplatform/PublishApprovalModalContent.tsx
@@ -56,12 +56,6 @@ const apiColumns = [
]
const upstreamColumns = [
- {
- title:'环境',
- dataIndex:['partition','name'],
- copyable: true,
- ellipsis:true
- },
{
title:'上游类型',
dataIndex:'type',
@@ -101,19 +95,20 @@ type PublishApprovalModalProps = {
type:'approval'|'view'|'add'|'publish'|'online'
data:PublishApprovalInfoType | PublishApprovalInfoType &{id?:string} | PublishVersionTableListItem
insideSystem?:boolean
- systemId:string
+ serviceId:string
+ teamId:string
clusterPublishStatus?:SystemInsidePublishOnlineItems[]
}
export type PublishApprovalModalHandle = {
save:(operate:'pass'|'refuse') =>Promise
- publish:(notSave?:boolean)=>Promise
+ publish:(notSave?:boolean)=>Promise>
online:()=>Promise
}
export const PublishApprovalModalContent = forwardRef((props, ref) => {
const { message } = App.useApp()
- const { type,data,insideSystem = false,systemId} = props
+ const { type,data,insideSystem = false,serviceId, teamId} = props
const [form] = Form.useForm();
const {fetchData} = useFetch()
@@ -129,7 +124,7 @@ export const PublishApprovalModalContent = forwardRef>(`project/publish/${operate === 'pass' ? 'accept' : 'refuse'}`,{method: 'PUT',eoBody:({comments:value.opinion}), eoParams:{id:data!.id, project:systemId},eoTransformKeys:['versionRemark']}).then(response=>{
+ return fetchData>(`service/publish/${operate === 'pass' ? 'accept' : 'refuse'}`,{method: 'PUT',eoBody:({comments:value.opinion}), eoParams:{id:data!.id, project:serviceId},eoTransformKeys:['versionRemark']}).then(response=>{
const {code,msg} = response
if(code === STATUS_CODE.SUCCESS){
message.success(msg || '操作成功!')
@@ -142,20 +137,20 @@ export const PublishApprovalModalContent = forwardRef {form.scrollToField(err.errorFields[0].name[0]); return Promise.reject(err)})
}
- const publish:(notSave?:boolean)=>Promise = (notSave)=>{
+ const publish:(notSave?:boolean)=>Promise> = (notSave)=>{
return new Promise((resolve, reject)=>{
form.validateFields().then((value)=>{
const body = {...value, ...(type === 'publish'&&{release:data.id})}
fetchData>(
- notSave ? 'project/publish/apply' : 'project/publish/release',{method: 'POST',eoBody:body, eoParams:{project:systemId},eoTransformKeys:['versionRemark']}).then(response=>{
- const {code,msg} = response
- if(code === STATUS_CODE.SUCCESS){
- message.success(msg || '操作成功!')
- resolve(true)
- }else{
- message.error(msg || '操作失败')
- reject(msg || '操作失败')
- }
+ notSave ? 'service/publish/apply' : 'service/publish/release/do',{method: 'POST',eoBody:body, eoParams:{service:serviceId, team:teamId},eoTransformKeys:['versionRemark']}).then(response=>{
+ const {code,msg} = response
+ if(code === STATUS_CODE.SUCCESS){
+ message.success(msg || '操作成功!')
+ resolve(response)
+ }else{
+ message.error(msg || '操作失败')
+ reject(msg || '操作失败')
+ }
}).catch((errorInfo)=> reject(errorInfo))
}).catch((errorInfo)=> reject(errorInfo))
})
@@ -164,7 +159,7 @@ export const PublishApprovalModalContent = forwardRefPromise = ()=>{
return new Promise((resolve, reject)=>{
form.validateFields().then(()=>{
- fetchData>('project/publish/execute',{method: 'PUT', eoParams:{project:systemId,id:(data as PublishVersionTableListItem).flowId},eoTransformKeys:['versionRemark']}).then(response=>{
+ fetchData>('service/publish/execute',{method: 'PUT', eoParams:{project:serviceId,id:(data as PublishVersionTableListItem).flowId},eoTransformKeys:['versionRemark']}).then(response=>{
const {code,msg} = response
if(code === STATUS_CODE.SUCCESS){
message.success(msg || '操作成功!')
diff --git a/frontend/packages/common/src/components/aoplatform/ScrollableSection.tsx b/frontend/packages/common/src/components/aoplatform/ScrollableSection.tsx
index 43013b3..32b3c94 100644
--- a/frontend/packages/common/src/components/aoplatform/ScrollableSection.tsx
+++ b/frontend/packages/common/src/components/aoplatform/ScrollableSection.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-03-13 17:27:29
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-04-01 16:41:51
- * @FilePath: \frontend\packages\core\src\components\ScrollableSection.tsx
- */
+
import {FC, useRef, useEffect, Children, cloneElement, isValidElement } from 'react';
interface ScrollableSectionProps {
diff --git a/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx b/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx
index 68cca34..efa25e8 100644
--- a/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx
+++ b/frontend/packages/common/src/components/aoplatform/SubscribeApprovalModalContent.tsx
@@ -9,7 +9,8 @@ type SubscribeApprovalModalProps = {
type:'approval'|'view'
data?:SubscribeApprovalInfoType
inSystem?:boolean
- systemId?:string
+ serviceId:string
+ teamId:string
}
export type SubscribeApprovalModalHandle = {
@@ -17,14 +18,13 @@ export type SubscribeApprovalModalHandle = {
}
type FieldType = {
- partition?:Array<{id:string,name:string,checked:boolean}>
reason?:string;
opinion?:string;
};
const list = [
{
- title:'申请方系统',key:'applyProject'
+ title:'申请方应用',key:'application'
},
{
title:'申请方所属团队',key:'applyTeam'
@@ -38,16 +38,13 @@ const list = [
{
title:'申请服务',key:'service'
},
- {
- title:'服务所属系统',key:'project'
- },
{
title:'服务所属团队',key:'team'
}
]
export const SubscribeApprovalModalContent = forwardRef((props, ref) => {
const { message } = App.useApp()
- const {data, type,inSystem=false,systemId} = props
+ const {data, type,inSystem=false, teamId, serviceId} = props
const [form] = Form.useForm();
const {fetchData} = useFetch()
@@ -66,7 +63,7 @@ export const SubscribeApprovalModalContent = forwardRef>(`${inSystem?'project/':''}approval/subscribe`,{method: 'POST',eoBody:({partition:value.partitions,opinion:value.opinion,operate}), eoParams:(inSystem ? {application:data!.id, project:systemId} : {id:data!.id})}).then(response=>{
+ fetchData>(`${inSystem?'service/':''}approval/subscribe`,{method: 'POST',eoBody:({opinion:value.opinion,operate}), eoParams:(inSystem ? {apply:data!.id, team:teamId} : {id:data!.id,team:teamId})}).then(response=>{
const {code,msg} = response
if(code === STATUS_CODE.SUCCESS){
message.success(msg || '操作成功!')
@@ -86,7 +83,7 @@ export const SubscribeApprovalModalContent = forwardRef{
- form.setFieldsValue({opinion:'',...data,...(data?.areasList && data?.areasList?.length === 1 ? {partition:[data.areasList[0].id]} : {})})
+ form.setFieldsValue({opinion:'',...data})
},[])
return (
@@ -111,16 +108,6 @@ export const SubscribeApprovalModalContent = forwardRef
-
- label="申请的环境"
- name="partition"
- rules={[{ required: true, message: '必填项' }]}
- >
- ({label:x.name,value:x.id}))}
- />
-
-
label="申请原因"
name="reason"
diff --git a/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx b/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx
index 235c1e5..4d0223d 100644
--- a/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx
+++ b/frontend/packages/common/src/components/aoplatform/TableBtnWithPermission.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-03-08 10:28:15
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-05-29 18:26:28
- * @FilePath: \frontend\packages\core\src\components\TableBtnWithPermission.tsx
- */
+
import { Button, Tooltip } from "antd"
import { useState, useMemo, useEffect } from "react"
import { useGlobalContext } from "@common/contexts/GlobalStateContext"
diff --git a/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx b/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx
index d5c8d55..cbc4e2f 100644
--- a/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx
+++ b/frontend/packages/common/src/components/aoplatform/TagWithPermission.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-04-19 10:21:03
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-05-29 18:48:57
- * @FilePath: \frontend\packages\common\src\components\aoplatform\TagWithPermission.tsx
- */
+
import { Tag, TagProps } from "antd";
import { useState, useMemo, useEffect } from "react";
import { PERMISSION_DEFINITION } from "@common/const/permissions";
diff --git a/frontend/packages/common/src/components/aoplatform/ThemeSwitcher.tsx b/frontend/packages/common/src/components/aoplatform/ThemeSwitcher.tsx
new file mode 100644
index 0000000..367bea9
--- /dev/null
+++ b/frontend/packages/common/src/components/aoplatform/ThemeSwitcher.tsx
@@ -0,0 +1,34 @@
+
+import React, { useEffect, useState } from 'react';
+
+const ThemeSwitcher = () => {
+ const [darkMode, setDarkMode] = useState(true);
+
+ useEffect(() => {
+ let isDarkMode = localStorage.getItem('dark-mode');
+ if(isDarkMode !== undefined && isDarkMode !== null){
+ setDarkMode(isDarkMode === 'true')
+ }else{
+ localStorage.setItem('dark-mode', (darkMode).toString());
+ }
+ }, []);
+
+ useEffect(()=>{
+ document.documentElement.classList.toggle('dark', darkMode);
+ },[darkMode])
+
+ const toggleDarkMode = () => {
+ setDarkMode(!darkMode);
+ localStorage.setItem('dark-mode', (!darkMode).toString());
+ document.documentElement.classList.toggle('dark', !darkMode);
+ };
+
+ return (
+ //
+ <>>
+ );
+};
+
+export default ThemeSwitcher;
\ No newline at end of file
diff --git a/frontend/packages/common/src/components/aoplatform/TimePicker.tsx b/frontend/packages/common/src/components/aoplatform/TimePicker.tsx
index 6ff6926..ef440fa 100644
--- a/frontend/packages/common/src/components/aoplatform/TimePicker.tsx
+++ b/frontend/packages/common/src/components/aoplatform/TimePicker.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-02-19 18:11:53
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-05-29 18:13:58
- * @FilePath: \frontend\packages\common\src\components\aoplatform\TimePicker.tsx
- */
+
import {forwardRef} from 'react';
import type { PickerProps } from 'antd/es/date-picker/generatePicker';
import type { Moment } from 'moment';
diff --git a/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx b/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx
index 60755b1..e66dd9c 100644
--- a/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx
+++ b/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-03-18 10:52:38
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-06-07 09:16:13
- * @FilePath: \frontend\packages\common\src\components\aoplatform\TimeRangeSelector.tsx
- */
+
import { useState } from 'react';
import { Radio, DatePicker, GetProps, RadioChangeEvent } from 'antd';
import dayjs, { Dayjs } from 'dayjs';
diff --git a/frontend/packages/common/src/components/aoplatform/TransferTable.tsx b/frontend/packages/common/src/components/aoplatform/TransferTable.tsx
index 37b44ad..69bbc14 100644
--- a/frontend/packages/common/src/components/aoplatform/TransferTable.tsx
+++ b/frontend/packages/common/src/components/aoplatform/TransferTable.tsx
@@ -1,16 +1,10 @@
-/*
- * @Date: 2024-01-31 15:00:10
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-05-17 16:42:12
- * @FilePath: \frontend\packages\core\src\components\TransferTable.tsx
- */
+
import { Input,Table} from "antd";
import {forwardRef, KeyboardEventHandler, Ref, useCallback, useEffect, useImperativeHandle, useRef, useState} from "react";
import styles from './TransferTable.module.css'
import {CloseOutlined, SearchOutlined} from "@ant-design/icons";
import {debounce} from "lodash-es";
import {ColumnsType} from "antd/es/table";
-// import Table from '../../../../../../../github/ant-design/components/table/index';
export type TransferTableProps = {
request?:(k?:string)=>Promise<{data:T[],success:boolean}>
@@ -38,10 +32,8 @@ const TransferTable = forwardRef, Tran
const [loading, setLoading] = useState(false)
const parentRef = useRef(null);
const [tableHeight, setTableHeight] = useState(window.innerHeight * 80 / 100 );
- // const [tableWidth, setTableWidth] = useState(216);
const [tableShow, setTableShow] = useState(false);
- // console.log(tableWidth)
useImperativeHandle(ref, () =>({
selectedData: () => selectedData,
selectedRowKeys: () => selectedRowKeys,}))
diff --git a/frontend/packages/common/src/components/aoplatform/TreeWithMore.tsx b/frontend/packages/common/src/components/aoplatform/TreeWithMore.tsx
index 971c8a5..e2f4199 100644
--- a/frontend/packages/common/src/components/aoplatform/TreeWithMore.tsx
+++ b/frontend/packages/common/src/components/aoplatform/TreeWithMore.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-01-31 15:00:10
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-04-17 16:46:52
- * @FilePath: \frontend\packages\core\src\components\TreeWithMore.tsx
- */
+
import {CheckOutlined, LoadingOutlined, MoreOutlined} from "@ant-design/icons";
import {Dropdown, Input, InputRef, MenuProps} from "antd";
import { ReactNode, useEffect, useRef, useState} from "react";
diff --git a/frontend/packages/common/src/components/aoplatform/UserProfile.tsx b/frontend/packages/common/src/components/aoplatform/UserProfile.tsx
index 6c51363..c6b98f7 100644
--- a/frontend/packages/common/src/components/aoplatform/UserProfile.tsx
+++ b/frontend/packages/common/src/components/aoplatform/UserProfile.tsx
@@ -2,10 +2,11 @@ import {App, Form, Input, Upload, UploadFile, UploadProps} from "antd";
import {forwardRef, useEffect, useImperativeHandle, useState} from "react";
import {useFetch} from "@common/hooks/http.ts";
import {RcFile, UploadChangeParam} from "antd/es/upload";
-import {LoadingOutlined, PlusOutlined} from "@ant-design/icons";
+import {LoadingOutlined} from "@ant-design/icons";
import {BasicResponse, STATUS_CODE} from "@common/const/const.ts";
import { UserInfoType, UserProfileHandle, UserProfileProps } from "@common/const/type";
import { getImgBase64 } from "@common/utils/dataTransfer";
+import { Icon } from "@iconify/react/dist/iconify.js";
export const UserProfile = forwardRef((props,ref)=>{
const { message } = App.useApp()
@@ -60,7 +61,7 @@ export const UserProfile = forwardRef((props
const uploadButton = (
);
diff --git a/frontend/packages/common/src/components/aoplatform/WithPermission.tsx b/frontend/packages/common/src/components/aoplatform/WithPermission.tsx
index 815a1dc..c094cd5 100644
--- a/frontend/packages/common/src/components/aoplatform/WithPermission.tsx
+++ b/frontend/packages/common/src/components/aoplatform/WithPermission.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-02-26 15:18:46
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-06-05 15:49:03
- * @FilePath: \frontend\packages\common\src\components\aoplatform\WithPermission.tsx
- */
+
import { Tooltip } from "antd";
import { ReactElement, cloneElement, useEffect, useMemo, useState } from "react";
import { useGlobalContext } from "../../contexts/GlobalStateContext";
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 7c79a0a..2e573d3 100644
--- a/frontend/packages/common/src/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx
+++ b/frontend/packages/common/src/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-01-31 15:00:11
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-04-01 16:29:06
- * @FilePath: \frontend\packages\core\src\components\formily2-customize\ArrayItemBlankComponent.tsx
- */
+
import {forwardRef, useImperativeHandle, useState} from 'react'
import { Input } from 'antd'
diff --git a/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomCodeboxComponent.tsx b/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomCodeboxComponent.tsx
index cce47df..43853bb 100644
--- a/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomCodeboxComponent.tsx
+++ b/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomCodeboxComponent.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-01-31 15:00:11
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-06-04 18:15:06
- * @FilePath: \frontend\packages\common\src\components\aoplatform\formily2-customize\CustomCodeboxComponent.tsx
- */
+
import {forwardRef, useImperativeHandle, useState} from 'react'
import { Codebox } from '@common/components/postcat/api/Codebox'
diff --git a/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomDialogComponent.tsx b/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomDialogComponent.tsx
index 79fdc72..938fac7 100644
--- a/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomDialogComponent.tsx
+++ b/frontend/packages/common/src/components/aoplatform/formily2-customize/CustomDialogComponent.tsx
@@ -1,9 +1,4 @@
-/*
- * @Date: 2024-01-31 15:00:11
- * @LastEditors: maggieyyy
- * @LastEditTime: 2024-06-05 15:15:58
- * @FilePath: \frontend\packages\common\src\components\aoplatform\formily2-customize\CustomDialogComponent.tsx
- */
+
import {forwardRef,useImperativeHandle} from 'react'
import { createSchemaField } from '@formily/react'
import {
diff --git a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx
index c09181f..9f9c5a7 100644
--- a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx
+++ b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginConfig.tsx
@@ -42,11 +42,39 @@ import {SimpleMapComponent} from "@common/components/aoplatform/formily2-customi
import {CustomDialogComponent} from "@common/components/aoplatform/formily2-customize/CustomDialogComponent.tsx";
import {ArrayItemBlankComponent} from "@common/components/aoplatform/formily2-customize/ArrayItemBlankComponent.tsx";
import {DefaultOptionType} from "antd/es/cascader";
-import {createSchemaField, FormProvider} from "@formily/react";
+import {createSchemaField, FormProvider, RecursionField, useField, useForm} from "@formily/react";
import {BasicResponse, STATUS_CODE} from "@common/const/const.ts";
import {useFetch} from "@common/hooks/http.ts";
import {App} from "antd";
-import { cloneDeep } from "lodash-es";
+
+
+
+export const DynamicRender = (props) => {
+ const {schema} = props
+ const field = useField()
+ const form = useForm()
+ const [renderSchema, setRenderSchema] = useState({})
+
+ useEffect(() => {
+ form.clearFormGraph(`${field.address}.*`)
+ try{
+ const parsedSchema = JSON.parse(schema)
+ setRenderSchema(parsedSchema[form?.values?.driver])
+ }catch(e){
+ console.error('渲染出错',e?.message)
+ }
+ }, [form.values.driver])
+
+ return (
+
+ )
+}
+
+
export type IntelligentPluginConfigProps = {
type:'add'|'edit'
@@ -62,511 +90,6 @@ export type IntelligentPluginConfigHandle = {
save:()=>Promise
}
-const finalSchema = {
- "type": "object",
- "properties": {
- "layout": {
- "type": "void",
- "x-component": "FormLayout",
- "x-component-props": {
- "labelCol": 6,
- "wrapperCol": 10,
- "layout": "vertical"
- },
- "properties": {
- "id": {
- "type": "string",
- "title": "ID",
- "required": true,
- "pattern": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 4,
- "wrapperCol": 20,
- "labelAlign": "left"
- },
- "x-component": "Input",
- "x-component-props": {
- "placeholder": "支持字母开头、英文数字中横线下划线组合"
- },
- "x-disabled": false
- },
- "title": {
- "type": "string",
- "title": "名称",
- "required": true,
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 4,
- "wrapperCol": 20,
- "labelAlign": "left"
- },
- "x-component": "Input",
- "x-component-props": {
- "placeholder": "请输入名称"
- }
- },
- "driver": {
- "type": "string",
- "title": "Driver",
- "required": true,
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 4,
- "wrapperCol": 20,
- "labelAlign": "left"
- },
- "x-component": "Select",
- "x-component-props": {
- "disabled": false
- },
- "x-display": "hidden",
- "enum": [
- {
- "label": "文件",
- "value": "file"
- }
- ]
- },
- "description": {
- "type": "string",
- "title": "描述",
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 4,
- "wrapperCol": 20,
- "labelAlign": "left"
- },
- "x-component": "Input.TextArea",
- "x-component-props": {
- "placeholder": "请输入描述"
- }
- },
- "config": {
- "type": "object",
- "x-component": "void",
- "properties": {
- "tabForm": {
- "type": "void",
- "x-component": "FormTab",
- "x-component-props": {
- "formTab": "{{formTab}}",
- "centered": false
- },
- "properties": {
- "0a3d7fcc-a59f-435f-8be0-9ff2cd0809c6": {
- "type": "object",
- "x-component": "FormTab.TabPane",
- "x-component-props": {
- "tab": "华南",
- "forceRender": true
- },
- "properties": {
- "_apinto_show": {
- "type": "boolean",
- "title": "启用",
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 4,
- "wrapperCol": 20,
- "labelAlign": "left"
- },
- "x-component": "Switch",
- "x-index": 0
- },
- "_apinto_backend": {
- "type": "void",
- "x-component": "void",
- "x-reactions": {
- "dependencies": [
- "._apinto_show"
- ],
- "fulfill": {
- "state": {
- "visible": "{{!!$deps[0]}}"
- }
- }
- },
- "properties": {
- "dir": {
- "name": "dir",
- "required": true,
- "title": "存放目录",
- "type": "string",
- "x-component": "Input",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 2,
- "x-validator": []
- },
- "expore": {
- "default": "3",
- "description": "单位:天",
- "name": "expore",
- "required": true,
- "title": "过期时间",
- "type": "number",
- "x-component": "NumberPicker",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 4,
- "x-validator": "integer"
- },
- "file": {
- "name": "file",
- "required": true,
- "title": "文件名称",
- "type": "string",
- "x-component": "Input",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 1,
- "x-validator": []
- },
- "formatter": {
- "title": "格式化配置",
- "type": "object",
- "x-component": "CustomCodeboxComponent",
- "x-component-props": {
- "mode": "json"
- },
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- }
- },
- "period": {
- "default": "hour",
- "enum": [
- {
- "children": [],
- "label": "小时",
- "value": "hour"
- },
- {
- "children": [],
- "label": "天",
- "value": "day"
- }
- ],
- "name": "period",
- "required": true,
- "title": "日志分割周期",
- "x-component": "Select",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 3,
- "x-validator": []
- },
- "scopes": {
- "items": {
- "properties": {
- "remove": {
- "type": "void",
- "x-component": "ArrayItems.Remove",
- "x-decorator": "FormItem"
- },
- "select": {
- "enum": [
- {
- "label": "Access日志",
- "value": "access_log"
- }
- ],
- "type": "string",
- "x-component": "Select",
- "x-decorator": "FormItem"
- },
- "sort": {
- "type": "void",
- "x-component": "ArrayItems.SortHandle",
- "x-decorator": "FormItem"
- }
- },
- "type": "void",
- "x-component": "Space"
- },
- "name": "scopes",
- "properties": {
- "add": {
- "title": "添加条目",
- "type": "void",
- "x-component": "ArrayItems.Addition",
- "x-component-props": {
- "defaultValue": "access_log"
- }
- }
- },
- "required": true,
- "title": "作用范围",
- "type": "array",
- "x-component": "ArrayItems",
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 0
- },
- "type": {
- "default": "line",
- "enum": [
- {
- "children": [],
- "label": "单行",
- "value": "line"
- },
- {
- "children": [],
- "label": "Json",
- "value": "json"
- }
- ],
- "name": "type",
- "required": true,
- "title": "输出格式",
- "x-component": "Select",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 5,
- "x-validator": []
- }
- }
- }
- }
- },
- "8bfbba9e-5931-40ac-8ac4-084d1ff36409": {
- "type": "object",
- "x-component": "FormTab.TabPane",
- "x-component-props": {
- "tab": "华北",
- "forceRender": true
- },
- "properties": {
- "_apinto_show": {
- "type": "boolean",
- "title": "启用",
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 4,
- "wrapperCol": 20,
- "labelAlign": "left"
- },
- "x-component": "Switch",
- "x-index": 0
- },
- "_apinto_backend": {
- "type": "void",
- "x-component": "void",
- "x-reactions": {
- "dependencies": [
- "._apinto_show"
- ],
- "fulfill": {
- "state": {
- "visible": "{{!!$deps[0]}}"
- }
- }
- },
- "properties": {
- "dir": {
- "name": "dir",
- "required": true,
- "title": "存放目录",
- "type": "string",
- "x-component": "Input",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 2,
- "x-validator": []
- },
- "expore": {
- "default": "3",
- "description": "单位:天",
- "name": "expore",
- "required": true,
- "title": "过期时间",
- "type": "number",
- "x-component": "NumberPicker",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 4,
- "x-validator": "integer"
- },
- "file": {
- "name": "file",
- "required": true,
- "title": "文件名称",
- "type": "string",
- "x-component": "Input",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 1,
- "x-validator": []
- },
- "formatter": {
- "title": "格式化配置",
- "type": "object",
- "x-component": "CustomCodeboxComponent",
- "x-component-props": {
- "mode": "json"
- },
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- }
- },
- "period": {
- "default": "hour",
- "enum": [
- {
- "children": [],
- "label": "小时",
- "value": "hour"
- },
- {
- "children": [],
- "label": "天",
- "value": "day"
- }
- ],
- "name": "period",
- "required": true,
- "title": "日志分割周期",
- "x-component": "Select",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 3,
- "x-validator": []
- },
- "scopes": {
- "items": {
- "properties": {
- "remove": {
- "type": "void",
- "x-component": "ArrayItems.Remove",
- "x-decorator": "FormItem"
- },
- "select": {
- "enum": [
- {
- "label": "Access日志",
- "value": "access_log"
- }
- ],
- "type": "string",
- "x-component": "Select",
- "x-decorator": "FormItem"
- },
- "sort": {
- "type": "void",
- "x-component": "ArrayItems.SortHandle",
- "x-decorator": "FormItem"
- }
- },
- "type": "void",
- "x-component": "Space"
- },
- "name": "scopes",
- "properties": {
- "add": {
- "title": "添加条目",
- "type": "void",
- "x-component": "ArrayItems.Addition",
- "x-component-props": {
- "defaultValue": "access_log"
- }
- }
- },
- "required": true,
- "title": "作用范围",
- "type": "array",
- "x-component": "ArrayItems",
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 0
- },
- "type": {
- "default": "line",
- "enum": [
- {
- "children": [],
- "label": "单行",
- "value": "line"
- },
- {
- "children": [],
- "label": "Json",
- "value": "json"
- }
- ],
- "name": "type",
- "required": true,
- "title": "输出格式",
- "x-component": "Select",
- "x-component-props": {},
- "x-decorator": "FormItem",
- "x-decorator-props": {
- "labelCol": 6,
- "wrapperCol": 10
- },
- "x-index": 5,
- "x-validator": []
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
const SchemaField = createSchemaField({
components: {
ArrayCards,
@@ -608,14 +131,14 @@ const SchemaField = createSchemaField({
CustomCodeboxComponent,
SimpleMapComponent,
CustomDialogComponent,
- ArrayItemBlankComponent
+ ArrayItemBlankComponent,
+ DynamicRender
}
})
export const IntelligentPluginConfig = forwardRef((props,ref)=>{
- const { type,renderSchema,tabData,moduleId,driverSelectionOptions,initFormValue} = props
+ const { type,renderSchema,moduleId,driverSelectionOptions,initFormValue} = props
const { message } = App.useApp()
- const [schema, setSchema] = useState({})
const {fetchData} = useFetch()
const form = createForm({ validateFirst: type === 'edit' })
form.setInitialValues(initFormValue || {})
@@ -694,104 +217,24 @@ export const IntelligentPluginConfig = forwardRef{
- const newSchema:{[k:string]:unknown} = {}
- if(!tabData || tabData.length === 0) return
- for(const tab of tabData){
- newSchema[tab.value!] = {
- type: 'object',
- 'x-component': 'FormTab.TabPane',
- 'x-component-props': {
- tab: tab.label,
- forceRender:true
- },
- properties:{
- _apinto_show:{
- type: 'boolean',
- title: '启用',
- 'x-decorator': 'FormItem',
- 'x-decorator-props': {
- labelCol:4,
- wrapperCol: 20,
- labelAlign:'left'
- },
- 'x-component': 'Switch',
- 'x-index':0,
},
- _apinto_backend: {
+ container: {
type: 'void',
- 'x-component': 'void',
- 'x-reactions': {
- dependencies: ['._apinto_show'],
- fulfill: {
- state: {
- visible: '{{!!$deps[0]}}',
- },
- },
- },
- properties: renderSchema[form.values.driver]?.properties,
- }
- }
- }
- }
-
- const newSchema2 = {...pluginEditSchema,
- properties:{
- ...pluginEditSchema.properties,
- layout:{...pluginEditSchema.properties.layout,
- properties:{
- ...pluginEditSchema.properties.layout.properties,
- config: {
- type: 'object',
- 'x-component': 'void',
- properties: {
- tabForm:{
- type: 'void',
- 'x-component': 'FormTab',
- 'x-component-props': {
- formTab: '{{formTab}}',
- centered:false,
- },
- properties: newSchema
- }
- }
- }
+ 'x-component': 'DynamicRender',
+ 'x-component-props': {
+ schema: JSON.stringify(renderSchema),
}
}
}
}
-
- setSchema(newSchema2)
}
+}
+
- useEffect(() => {
- getNewSchema()
- }, [tabData,renderSchema,form.values.driver]);
-
const save :()=>Promise = ()=>{
return new Promise((resolve, reject)=>{
form.validate().then(()=>{
- const res = form.values
- const newData = JSON.parse(JSON.stringify(res)); // 深拷贝对象,避免直接修改 Proxy
- const config = newData.config;
-
- for (const tab in config) {
- if (config[tab]._apinto_show) {
- delete config[tab]._apinto_show; // 删除 _apinto_show 属性
- } else {
- delete config[tab]; // 删除整个 tab
- }
- }
-
- fetchData>(type === 'add'?`dynamic/${moduleId}`:`dynamic/${moduleId}/config`,{method:type === 'add'? 'POST' : 'PUT',eoBody:newData, eoParams:{...(type !== 'add' && {id:initFormValue.id})}}).then(response=>{
+ fetchData>(type === 'add'?`dynamic/${moduleId}`:`dynamic/${moduleId}/config`,{method:type === 'add'? 'POST' : 'PUT',eoBody:form.values, eoParams:{...(type !== 'add' && {id:initFormValue.id})}}).then(response=>{
const {code,msg} = response
if(code === STATUS_CODE.SUCCESS){
message.success(msg || '操作成功!')
@@ -840,8 +283,8 @@ export const IntelligentPluginConfig = forwardRef
)
diff --git a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx
index be6f968..9efd309 100644
--- a/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx
+++ b/frontend/packages/common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx
@@ -1,16 +1,15 @@
import PageList from "@common/components/aoplatform/PageList.tsx";
-import {App, Button, Divider, Select, Spin} from "antd";
+import {App, Divider, Spin} from "antd";
import {useEffect, useRef, useState} from "react";
-import {Link, useLocation, useParams} from "react-router-dom";
+import { useLocation, useOutletContext, useParams} from "react-router-dom";
import {useBreadcrumb} from "@common/contexts/BreadcrumbContext.tsx";
import {ActionType, ParamsType, ProColumns} 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 {IntelligentPluginPublish, IntelligentPluginPublishHandle} from "./IntelligentPluginPublish.tsx";
import {BasicResponse, STATUS_CODE} from "@common/const/const.ts";
import {useFetch} from "@common/hooks/http.ts";
-import {EntityItem, PartitionItem} from "@common/const/type.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";
@@ -72,41 +71,47 @@ export const StatusColorClass = {
"待发布":'text-[#46BE11]',
"未发布":'text-[#03a9f4]'
}
+
+
+export type DynamicPublish = {
+ code:number,
+ msg:string,
+ data:{
+ success:Array