diff --git a/backend/storage/settings.json b/backend/storage/settings.json index 98f127d..afc8999 100644 --- a/backend/storage/settings.json +++ b/backend/storage/settings.json @@ -1,4 +1,468 @@ { + "_prisma_migrations": { + "slug": "_prisma_migrations", + "table": { + "name": "_prisma_migrations", + "pk": "id", + "verbose": "_prisma_migrations" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "varchar(36)", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "checksum", + "verbose": "checksum", + "control": { + "text": true + }, + "type": "varchar(64)", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "finished_at", + "verbose": "finished_at", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": true, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "migration_name", + "verbose": "migration_name", + "control": { + "text": true + }, + "type": "varchar(255)", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "logs", + "verbose": "logs", + "control": { + "text": true + }, + "type": "text", + "allowNull": true, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "rolled_back_at", + "verbose": "rolled_back_at", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": true, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "started_at", + "verbose": "started_at", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "now()", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "applied_steps_count", + "verbose": "applied_steps_count", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": "0", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, + "system_settings": { + "slug": "system_settings", + "table": { + "name": "system_settings", + "pk": "id", + "verbose": "system_settings" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "label", + "verbose": "label", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "value", + "verbose": "value", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, + "users": { + "slug": "users", + "table": { + "name": "users", + "pk": "id", + "verbose": "users" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "email", + "verbose": "email", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "password", + "verbose": "password", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "role", + "verbose": "role", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": "'default'::text", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, + "organization_users": { + "slug": "organization_users", + "table": { + "name": "organization_users", + "pk": "id", + "verbose": "organization_users" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "user_id", + "verbose": "user_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, "organizations": { "slug": "organizations", "table": { @@ -331,154 +795,6 @@ "readonly": false } }, - "organization_workspaces": { - "slug": "organization_workspaces", - "table": { - "name": "organization_workspaces", - "pk": "id", - "verbose": "organization_workspaces" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "name", - "verbose": "name", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "slug", - "verbose": "slug", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "uuid", - "verbose": "uuid", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "fname", - "verbose": "fname", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "workspace_documents": { "slug": "workspace_documents", "table": { @@ -759,222 +1075,6 @@ "readonly": false } }, - "users": { - "slug": "users", - "table": { - "name": "users", - "pk": "id", - "verbose": "users" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "email", - "verbose": "email", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "password", - "verbose": "password", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "role", - "verbose": "role", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": "'default'::text", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, - "system_settings": { - "slug": "system_settings", - "table": { - "name": "system_settings", - "pk": "id", - "verbose": "system_settings" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "label", - "verbose": "label", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "value", - "verbose": "value", - "control": { - "text": true - }, - "type": "text", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "jobs": { "slug": "jobs", "table": { @@ -1139,6 +1239,154 @@ "readonly": false } }, + "organization_workspaces": { + "slug": "organization_workspaces", + "table": { + "name": "organization_workspaces", + "pk": "id", + "verbose": "organization_workspaces" + }, + "columns": [ + { + "name": "id", + "verbose": "id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "name", + "verbose": "name", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "slug", + "verbose": "slug", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "uuid", + "verbose": "uuid", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "organization_id", + "verbose": "organization_id", + "control": { + "text": true + }, + "type": "integer", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "createdAt", + "verbose": "createdAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "lastUpdatedAt", + "verbose": "lastUpdatedAt", + "control": { + "text": true + }, + "type": "timestamp", + "allowNull": false, + "defaultValue": "CURRENT_TIMESTAMP", + "listview": { + "show": true + }, + "editview": { + "show": true + } + }, + { + "name": "fname", + "verbose": "fname", + "control": { + "text": true + }, + "type": "text", + "allowNull": false, + "defaultValue": null, + "listview": { + "show": true + }, + "editview": { + "show": true + } + } + ], + "mainview": { + "show": true + }, + "listview": { + "order": {}, + "page": 25 + }, + "editview": { + "readonly": false + } + }, "organization_notifications": { "slug": "organization_notifications", "table": { @@ -1303,106 +1551,6 @@ "readonly": false } }, - "organization_users": { - "slug": "organization_users", - "table": { - "name": "organization_users", - "pk": "id", - "verbose": "organization_users" - }, - "columns": [ - { - "name": "id", - "verbose": "id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "user_id", - "verbose": "user_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "organization_id", - "verbose": "organization_id", - "control": { - "text": true - }, - "type": "integer", - "allowNull": false, - "defaultValue": null, - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "createdAt", - "verbose": "createdAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - }, - { - "name": "lastUpdatedAt", - "verbose": "lastUpdatedAt", - "control": { - "text": true - }, - "type": "timestamp", - "allowNull": false, - "defaultValue": "CURRENT_TIMESTAMP", - "listview": { - "show": true - }, - "editview": { - "show": true - } - } - ], - "mainview": { - "show": true - }, - "listview": { - "order": {}, - "page": 25 - }, - "editview": { - "readonly": false - } - }, "organization_rag_tests": { "slug": "organization_rag_tests", "table": { diff --git a/frontend/src/pages/SystemSettings/Settings/index.tsx b/frontend/src/pages/SystemSettings/Settings/index.tsx index 1997eaa..eac978f 100644 --- a/frontend/src/pages/SystemSettings/Settings/index.tsx +++ b/frontend/src/pages/SystemSettings/Settings/index.tsx @@ -1,21 +1,23 @@ import { useState } from 'react'; import { APP_NAME } from '../../../utils/constants'; import System from '../../../models/system'; -import { ExternalLink, Eye, EyeOff } from 'react-feather'; import paths from '../../../utils/paths'; +import { + CaretDown, + EyeSlash, + Eye, + ArrowSquareOut, +} from '@phosphor-icons/react'; +import showToast from '../../../utils/toast'; export default function Settings({ settings }: { settings: any[] }) { - const [result, setResult] = useState<{ - show: boolean; - success: boolean; - error: null | string; - }>({ show: false, success: false, error: null }); + const [hasChanges, setHasChanges] = useState(false); + const getSetting = (label: string) => { return settings.find((setting) => setting.label === label); }; const handleSubmit = async (e: any) => { e.preventDefault(); - setResult({ show: false, success: false, error: null }); const form = new FormData(e.target); const data = { allow_account_creation: form.get('allow_account_creation') === 'yes', @@ -26,111 +28,119 @@ export default function Settings({ settings }: { settings: any[] }) { data.open_ai_api_key = form.get('open_ai_api_key') || null; const { success, error } = await System.updateSettings(data); - setResult({ show: true, success, error }); + + if (success) { + showToast('Settings updated successfully', 'success'); + setHasChanges(false); + } else { + showToast(`Error updating settings: ${error}`, 'error'); + } }; return ( -
- Settings updated successfully. -
- ) : ( -- {result.error} -
- )} - > - )} - - -+
Database Debug Credentials
-+
Use these credentials to for direct application database access.
Changes done via the database admin UI will not impact
@@ -160,36 +169,33 @@ function DebugCredentials({ settings }: { settings: {} }) {