Переработано окно эндпоинта, добавлены элементы дебага, добавлена возможность сохранять и загружать конфигурацию эндпоинта, добавлено отображение ошибок при загрузке конфигурации. Исправлены мелкие баги.

This commit is contained in:
2026-03-01 16:00:26 +03:00
parent 7e2e0103fe
commit 6766cd81a1
15 changed files with 1677 additions and 172 deletions

View File

@@ -1,5 +1,5 @@
import axios from 'axios';
import { AuthResponse, User, Endpoint, Folder, ApiKey, Database, QueryTestResult } from '@/types';
import { AuthResponse, User, Endpoint, Folder, ApiKey, Database, QueryTestResult, ImportPreviewResponse } from '@/types';
const api = axios.create({
baseURL: '/api',
@@ -109,15 +109,37 @@ export const endpointsApi = {
test: (data: {
database_id: string;
execution_type?: 'sql' | 'script';
execution_type?: 'sql' | 'script' | 'aql';
sql_query?: string;
parameters?: any[];
endpoint_parameters?: any[];
script_language?: 'javascript' | 'python';
script_code?: string;
script_queries?: any[];
aql_method?: string;
aql_endpoint?: string;
aql_body?: string;
aql_query_params?: Record<string, string>;
}) =>
api.post<QueryTestResult>('/endpoints/test', data),
exportEndpoint: (id: string) =>
api.get(`/endpoints/${id}/export`, { responseType: 'blob' }),
importPreview: (file: File) =>
file.arrayBuffer().then(buffer =>
api.post<ImportPreviewResponse>('/endpoints/import/preview', buffer, {
headers: { 'Content-Type': 'application/octet-stream' },
})
),
importConfirm: (data: {
file_data: string;
database_mapping: Record<string, string>;
folder_id?: string | null;
override_path?: string;
}) =>
api.post<Endpoint>('/endpoints/import', data),
};
// Folders API