new file: .gitignore new file: backend/.env.example new file: backend/.gitignore new file: backend/ecosystem.config.js new file: backend/nodemon.json new file: backend/package-lock.json new file: backend/package.json new file: backend/src/config/database.ts new file: backend/src/config/dynamicSwagger.ts new file: backend/src/config/environment.ts new file: backend/src/config/swagger.ts new file: backend/src/controllers/apiKeyController.ts new file: backend/src/controllers/authController.ts new file: backend/src/controllers/databaseController.ts new file: backend/src/controllers/databaseManagementController.ts new file: backend/src/controllers/dynamicApiController.ts new file: backend/src/controllers/endpointController.ts new file: backend/src/controllers/folderController.ts new file: backend/src/controllers/logsController.ts new file: backend/src/controllers/userController.ts new file: backend/src/middleware/apiKey.ts new file: backend/src/middleware/auth.ts new file: backend/src/middleware/logging.ts new file: backend/src/migrations/001_initial_schema.sql new file: backend/src/migrations/002_add_logging.sql new file: backend/src/migrations/003_add_scripting.sql new file: backend/src/migrations/004_add_superadmin.sql new file: backend/src/migrations/run.ts new file: backend/src/migrations/seed.ts new file: backend/src/routes/apiKeys.ts new file: backend/src/routes/auth.ts new file: backend/src/routes/databaseManagement.ts new file: backend/src/routes/databases.ts new file: backend/src/routes/dynamic.ts new file: backend/src/routes/endpoints.ts new file: backend/src/routes/folders.ts new file: backend/src/routes/logs.ts new file: backend/src/routes/users.ts new file: backend/src/server.ts new file: backend/src/services/DatabasePoolManager.ts new file: backend/src/services/ScriptExecutor.ts new file: backend/src/services/SqlExecutor.ts new file: backend/src/types/index.ts new file: backend/tsconfig.json new file: frontend/.gitignore new file: frontend/index.html new file: frontend/nginx.conf new file: frontend/package-lock.json new file: frontend/package.json new file: frontend/postcss.config.js new file: frontend/src/App.tsx new file: frontend/src/components/CodeEditor.tsx
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { X } from 'lucide-react';
|
|
|
|
interface DialogProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
title: string;
|
|
message: string;
|
|
type?: 'alert' | 'confirm';
|
|
onConfirm?: () => void;
|
|
confirmText?: string;
|
|
cancelText?: string;
|
|
}
|
|
|
|
export default function Dialog({
|
|
isOpen,
|
|
onClose,
|
|
title,
|
|
message,
|
|
type = 'alert',
|
|
onConfirm,
|
|
confirmText = 'OK',
|
|
cancelText = 'Отмена',
|
|
}: DialogProps) {
|
|
if (!isOpen) return null;
|
|
|
|
const handleConfirm = () => {
|
|
if (onConfirm) {
|
|
onConfirm();
|
|
}
|
|
onClose();
|
|
};
|
|
|
|
return (
|
|
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100] p-4">
|
|
<div className="bg-white rounded-lg max-w-md w-full shadow-xl">
|
|
<div className="flex items-center justify-between p-4 border-b border-gray-200">
|
|
<h3 className="text-lg font-semibold text-gray-900">{title}</h3>
|
|
<button
|
|
onClick={onClose}
|
|
className="text-gray-400 hover:text-gray-600 transition-colors"
|
|
>
|
|
<X size={20} />
|
|
</button>
|
|
</div>
|
|
|
|
<div className="p-6">
|
|
<p className="text-gray-700 whitespace-pre-wrap">{message}</p>
|
|
</div>
|
|
|
|
<div className="flex gap-3 p-4 border-t border-gray-200 justify-end">
|
|
{type === 'confirm' && (
|
|
<button onClick={onClose} className="btn btn-secondary">
|
|
{cancelText}
|
|
</button>
|
|
)}
|
|
<button onClick={handleConfirm} className="btn btn-primary">
|
|
{confirmText}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|