diff --git a/src/pages/ApiKeys/index.tsx b/src/pages/ApiKeys/index.tsx index d4aa60e..a2bd544 100644 --- a/src/pages/ApiKeys/index.tsx +++ b/src/pages/ApiKeys/index.tsx @@ -65,7 +65,6 @@ const ApiKeys: React.FC = () => { const values = await form.validateFields(); const req: CreateApiKeyRequest = { name: values.name, - keyType: "custom", projectIds: (values.projectIds as string[] | undefined)?.join(",") || "", readOnly: values.readOnly ?? false, }; @@ -107,27 +106,12 @@ const ApiKeys: React.FC = () => { }); }; - const getKeyTypeTag = (keyType: string) => { - const colorMap: Record = { - anon: "blue", - service: "red", - custom: "default", - }; - return {t(`key_type_${keyType}`)}; - }; - const columns = [ { title: t("name"), dataIndex: "name", key: "name", }, - { - title: t("key_type"), - dataIndex: "keyType", - key: "keyType", - render: (keyType: string) => getKeyTypeTag(keyType), - }, { title: t("key_prefix"), dataIndex: "keyPrefix", @@ -169,16 +153,14 @@ const ApiKeys: React.FC = () => { {t("regenerate")} - {record.keyType === "custom" && ( - handleDelete(record.id)} - > - - - )} + handleDelete(record.id)} + > + + ), }, @@ -216,7 +198,7 @@ const ApiKeys: React.FC = () => { message={t("api_key_frontend_warning")} style={{marginBottom: 16}} /> -
+ diff --git a/src/pages/DataModeling/index.tsx b/src/pages/DataModeling/index.tsx index f694c5f..6356a6f 100644 --- a/src/pages/DataModeling/index.tsx +++ b/src/pages/DataModeling/index.tsx @@ -10,7 +10,7 @@ import EnumForm from "@/pages/DataModeling/components/EnumForm"; import type {Enum} from "@/types/data-modeling.d.ts"; import ERDiagram from "@/pages/DataModeling/components/ERDiagramView"; import {useProject} from "@/store/appStore"; -import {AppstoreOutlined, UnorderedListOutlined} from "@ant-design/icons"; +import {AppstoreOutlined, ReloadOutlined, UnorderedListOutlined} from "@ant-design/icons"; import ERView from "@/pages/DataView/components/ERView.tsx"; import {spacing} from "@/theme/designTokens"; @@ -51,6 +51,10 @@ const ModelingPage: React.FC = () => { setNativeQueryIsEditing(prev => !prev); }, []); + const handleRefresh = useCallback(() => { + setSelectModelVersion(v => v + 1); + }, []); + const handleCancelNativeQueryEdit = useCallback(() => { setNativeQueryIsEditing(false); }, []); @@ -118,6 +122,10 @@ const ModelingPage: React.FC = () => { title={t('data_modeling')} extra={[ + @@ -182,17 +193,6 @@ const FunctionsPage: React.FC = () => { } loading={loading} > - - } - value={searchName} - onChange={(e) => { setSearchName(e.target.value); setPage(1); }} - style={{width: 220}} - allowClear - /> - - { config.pagesUrlTemplate || '/pages/{{projectId}}', projectId, ); - const functionsUrl = resolveUrl( - config.edgeUrlTemplate || '/functions/{{projectId}}/{{name}}', - projectId, - ); return ( { 请先选择项目 )} -
- 函数入口 - {projectId ? ( - {functionsUrl} - ) : ( - 请先选择项目 - )} -
); diff --git a/src/pages/Storage/components/FileBrowser.tsx b/src/pages/Storage/components/FileBrowser.tsx index 9d10092..23aa0e5 100644 --- a/src/pages/Storage/components/FileBrowser.tsx +++ b/src/pages/Storage/components/FileBrowser.tsx @@ -36,6 +36,7 @@ const FileBrowser: React.FC = ({bucketName, projectId, visibil const [createFolderVisible, setCreateFolderVisible] = useState(false); const [folderName, setFolderName] = useState(''); const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [uploadFileList, setUploadFileList] = useState([]); const loadFiles = useCallback(async () => { setLoading(true); @@ -67,6 +68,10 @@ const FileBrowser: React.FC = ({bucketName, projectId, visibil const handleUpload = () => { setUploadVisible(true); }; + const handleUploadClose = () => { + setUploadVisible(false); + setUploadFileList([]); + }; const handleCreateFolder = () => { setCreateFolderVisible(true); @@ -285,9 +290,9 @@ const FileBrowser: React.FC = ({bucketName, projectId, visibil setUploadVisible(false)} + onCancel={handleUploadClose} footer={[ - , ]} @@ -295,6 +300,8 @@ const FileBrowser: React.FC = ({bucketName, projectId, visibil setUploadFileList(fileList)} customRequest={async ({file, onSuccess, onError}) => { try { const fileObj = file as File; diff --git a/src/services/function.ts b/src/services/function.ts index 35537a6..0143216 100644 --- a/src/services/function.ts +++ b/src/services/function.ts @@ -42,11 +42,6 @@ export interface FunctionInvokeResult { meta?: FunctionInvokeMeta; } -export interface InvokeTokenResponse { - invokeToken: string; - runtimeUrl: string; -} - export interface PageDTO { list: T[]; total: number; @@ -83,74 +78,15 @@ export const deleteFunction = ( return api.delete(`/projects/${projectId}/functions/${encodeURIComponent(name)}`); }; -// ---- Invoke Token (Edge Function) ---- - -/** - * Get an invoke-token for edge function direct invocation. - * Returns invokeToken + runtimeUrl for direct Deno Runtime call. - */ -export const getInvokeToken = ( - projectId: string, - name: string, -): Promise => { - return api.post(`/projects/${projectId}/functions/${encodeURIComponent(name)}/invoke-token`); -}; - -// ---- Invoke (Edge Function — direct Deno call) ---- +// ---- Invoke (via Java server proxy → Deno Runtime) ---- /** - * Invoke a function via edge route (direct Deno Runtime call). - * 1. Get invoke-token from Java server - * 2. Call Deno Runtime directly with the token + * Invoke a function via the Java server, which proxies to the Deno Runtime. */ export const invokeFunction = async ( projectId: string, name: string, data: any, -): Promise => { - // 1. Get invoke-token from Java server - const {invokeToken, runtimeUrl} = await getInvokeToken(projectId, name); - - // 2. Call Deno Runtime directly - const response = await fetch(runtimeUrl, { - method: 'POST', - headers: { - 'Authorization': `Bearer ${invokeToken}`, - 'Content-Type': 'application/json', - }, - body: JSON.stringify(data), - }); - - // 3. Parse response - let meta: FunctionInvokeMeta | undefined; - const metaStr = response.headers.get('x-function-meta'); - if (metaStr) { - try { - meta = JSON.parse(metaStr); - } catch { /* ignore */ - } - } - - let responseData: any; - try { - responseData = await response.json(); - } catch { - responseData = await response.text(); - } - - return {status: response.status, data: responseData, meta}; -}; - -// ---- Invoke (Legacy — via Java server, kept as fallback) ---- - -/** - * Invoke a function via Java server (legacy path). - * Use invokeFunction() for edge function direct invocation instead. - */ -export const invokeFunctionViaServer = async ( - projectId: string, - name: string, - data: any, ): Promise => { const response = await api.rawPost( `/projects/${projectId}/functions/${encodeURIComponent(name)}/invoke`, diff --git a/src/types/api-key.d.ts b/src/types/api-key.d.ts index b2f94f9..942a463 100644 --- a/src/types/api-key.d.ts +++ b/src/types/api-key.d.ts @@ -5,7 +5,6 @@ export interface ApiKey { id: string; name: string; keyPrefix: string; - keyType: 'anon' | 'service' | 'custom'; projectIds?: string; readOnly: boolean; expiresAt: string | null; @@ -20,7 +19,6 @@ export interface ApiKey { */ export interface CreateApiKeyRequest { name: string; - keyType?: string; projectIds?: string; readOnly?: boolean; } diff --git a/vite.config.ts b/vite.config.ts index 43dba93..5ddb14a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -180,7 +180,7 @@ export default defineConfig({ server: { host: "0.0.0.0", proxy: { - "/api": { + "/api/": { target: "http://localhost:8080", ws: true, changeOrigin: true, @@ -191,7 +191,7 @@ export default defineConfig({ changeOrigin: true, }, // Pages fallback → Java server (when local files not found) - "/pages": { + "/pages/": { target: "http://localhost:8080", changeOrigin: true, },