fix(ui): mark required fields and show inline errors in database, schedule and API dialogs

Migrates to FormField + Label required + useFieldErrors:
- Databases: new database, new MySQL user, new PostgreSQL user
- Backups: new backup schedule
- Templates: deploy drawer variables (shared required marker, inline errors)
- Settings: create API key, create/edit webhook subscription (URL check)
- Domains: add-domain server errors about the domain show at the field
This commit is contained in:
Juan Denis committed 2026-11-10 08:23:04 -05:00
1 parent fbaca87ead
commit 37e5787c87
24 files changed
+315 -197

No files matched your search

+1 -1
View File
@@ -1 +1 @@
40
38
@@ -1,3 +1,4 @@
import { useId } from 'react';
import { useTranslation } from 'react-i18next';
import Modal from '@/components/Modal';
import { FormField } from '@/components/FormField';
@@ -5,6 +6,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import useForm from '@/hooks/useForm';
import useFieldErrors from '@/hooks/useFieldErrors';
export default function AddScheduleModal({ open, onClose, onCreate, onCreated, remoteEnabled, timezone }) {
const { t } = useTranslation();
@@ -13,9 +15,28 @@ export default function AddScheduleModal({ open, onClose, onCreate, onCreated, r
onSubmit: async (values) => {
await onCreate(values);
form.reset();
fe.reset();
onCreated();
},
});
const fieldId = useId();
const required = t('common.validation.required', 'This field is required.');
const fe = useFieldErrors({
name: form.values.name.trim() ? null : required,
target: form.values.target.trim() ? null : required,
scheduleTime: form.values.scheduleTime ? null : required,
}, fieldId);
const submit = (e) => {
if (!fe.attempt()) { e.preventDefault(); return undefined; }
return form.handleSubmit(e);
};
const close = () => { fe.reset(); onClose(); };
const err = (name) => fe.error(name) || form.getFieldError(name);
// Wraps getFieldProps so edits/blur also drive the inline-error timing.
const props = (name) => {
const p = form.getFieldProps(name);
return { ...p, onBlur: () => { p.onBlur(); fe.touch(name); }, 'aria-invalid': Boolean(err(name)) };
};
const targetLabel = form.values.backupType === 'files'
? t('app.backups.schedulePaths', 'Paths (comma-separated)')
: form.values.backupType === 'database'
@@ -23,11 +44,11 @@ export default function AddScheduleModal({ open, onClose, onCreate, onCreated, r
: t('app.backups.applicationName', 'Service name');
return (
<Modal open={open} onClose={() => { if (!form.isSubmitting) onClose(); }} title={t('app.backups.addBackupSchedule', 'New backup schedule')}>
<form onSubmit={form.handleSubmit} data-walkthrough="backup-schedule-form">
<Modal open={open} onClose={() => { if (!form.isSubmitting) close(); }} title={t('app.backups.addBackupSchedule', 'New backup schedule')}>
<form onSubmit={submit} noValidate data-walkthrough="backup-schedule-form">
{form.submitError && <p className="error-message" role="alert">{form.submitError}</p>}
<FormField htmlFor="backup-schedule-name" label={t('app.backups.scheduleName', 'Schedule name')} error={form.getFieldError('name')} required>
<Input id="backup-schedule-name" type="text" {...form.getFieldProps('name')} placeholder={t('app.backups.dailyAppBackup', 'Daily service backup')} required />
<FormField htmlFor={`${fieldId}-name`} label={t('app.backups.scheduleName', 'Schedule name')} error={err('name')} required>
<Input id={`${fieldId}-name`} type="text" {...props('name')} placeholder={t('app.backups.dailyAppBackup', 'Daily service backup')} />
</FormField>
<FormField htmlFor="backup-schedule-type" label={t('app.backups.backupType', 'Backup type')} error={form.getFieldError('backupType')}>
<Select
@@ -45,11 +66,11 @@ export default function AddScheduleModal({ open, onClose, onCreate, onCreated, r
</SelectContent>
</Select>
</FormField>
<FormField htmlFor="backup-schedule-target" label={targetLabel} error={form.getFieldError('target')} required>
<Input id="backup-schedule-target" type="text" {...form.getFieldProps('target')} placeholder={form.values.backupType === 'files' ? '/etc/nginx,/var/www/config' : form.values.backupType === 'database' ? 'mysql:mydb' : 'my-app'} required />
<FormField htmlFor={`${fieldId}-target`} label={targetLabel} error={err('target')} required>
<Input id={`${fieldId}-target`} type="text" {...props('target')} placeholder={form.values.backupType === 'files' ? '/etc/nginx,/var/www/config' : form.values.backupType === 'database' ? 'mysql:mydb' : 'my-app'} />
</FormField>
<FormField htmlFor="backup-schedule-time" label={t('common.labels.time', 'Time')} error={form.getFieldError('scheduleTime')} hint={timezone} required>
<Input id="backup-schedule-time" type="time" {...form.getFieldProps('scheduleTime')} required />
<FormField htmlFor={`${fieldId}-scheduleTime`} label={t('common.labels.time', 'Time')} error={err('scheduleTime')} hint={timezone} required>
<Input id={`${fieldId}-scheduleTime`} type="time" {...props('scheduleTime')} />
</FormField>
{remoteEnabled && (
<FormField>
@@ -60,7 +81,7 @@ export default function AddScheduleModal({ open, onClose, onCreate, onCreated, r
</FormField>
)}
<div className="modal-actions">
<Button type="button" variant="outline" onClick={onClose} disabled={form.isSubmitting}>{t('common.actions.cancel', 'Cancel')}</Button>
<Button type="button" variant="outline" onClick={close} disabled={form.isSubmitting}>{t('common.actions.cancel', 'Cancel')}</Button>
<Button type="submit" disabled={form.isSubmitting} data-walkthrough="backup-schedule-submit">{t('app.backups.addSchedule', 'Create schedule')}</Button>
</div>
</form>
+59 -52
View File
@@ -6,6 +6,8 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
import CopyField from '@/components/CopyField';
import { FormField, FormRow } from '@/components/FormField';
import useFieldErrors from '@/hooks/useFieldErrors';
import { EngineIcon } from '../icons/DatabaseBrands';
import { ENGINE_META } from './dbAdapter';
import { useTranslation } from 'react-i18next';
@@ -121,6 +123,11 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const [createdInfo, setCreatedInfo] = useState(null);
const fe = useFieldErrors({
name: !formData.name.trim()
? t('app.modals.databaseNameRequired', 'Enter the database name.')
: (/^[a-zA-Z0-9_]+$/.test(formData.name) ? null : t('app.modals.databaseNameInvalid', 'Use only letters, numbers and underscores.')),
}, fieldId);
// Attaching is optional, so a failed app lookup must not block the create —
// the selector just stays empty.
@@ -137,6 +144,7 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
async function handleSubmit(e) {
e.preventDefault();
if (!fe.attempt()) return;
setError('');
setLoading(true);
try {
@@ -160,6 +168,7 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
}
}
} catch (err) {
if (fe.fromServer(err)) return;
setError(err.message || 'Failed to create database');
} finally {
setLoading(false);
@@ -185,26 +194,23 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
return (
<Modal open onClose={onClose} title={t('app.modals.newDatabase', 'New database')}>
{error && <div className="error-message">{error}</div>}
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>{t('app.modals.engine', 'Engine')}</label>
<form onSubmit={handleSubmit} noValidate>
<FormField label={t('app.modals.engine', 'Engine')}>
<EnginePicker
value={engine}
onChange={setEngine}
status={status}
onInstallEngine={onInstallEngine ? () => { onClose(); onInstallEngine(); } : null}
/>
</div>
</FormField>
<div className="form-group">
<label htmlFor={`${fieldId}-name`}>{t('app.modals.databaseName', 'Database name *')}</label>
<Input id={`${fieldId}-name`} type="text" value={formData.name} onChange={(e) => setFormData({ ...formData, name: e.target.value })} placeholder="my_database" required pattern="[a-zA-Z0-9_]+" autoFocus />
</div>
<FormField label={t('app.modals.databaseName', 'Database name')} htmlFor={`${fieldId}-name`} required error={fe.error('name')}>
<Input id={`${fieldId}-name`} type="text" value={formData.name} onChange={(e) => { fe.clear('name'); setFormData({ ...formData, name: e.target.value }); }} onBlur={() => fe.touch('name')} placeholder="my_database" autoFocus />
</FormField>
{isMySQL ? (
<div className="form-row">
<div className="form-group">
<label htmlFor="dbx-new-charset">{t('app.modals.characterSet', 'Character set')}</label>
<FormRow>
<FormField label={t('app.modals.characterSet', 'Character set')} htmlFor="dbx-new-charset">
<Select value={formData.charset} onValueChange={(value) => setFormData({ ...formData, charset: value })}>
<SelectTrigger id="dbx-new-charset"><SelectValue /></SelectTrigger>
<SelectContent>
@@ -213,9 +219,8 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
<SelectItem value="latin1">latin1</SelectItem>
</SelectContent>
</Select>
</div>
<div className="form-group">
<label htmlFor="dbx-new-collation">{t('app.modals.collation', 'Collation')}</label>
</FormField>
<FormField label={t('app.modals.collation', 'Collation')} htmlFor="dbx-new-collation">
<Select value={formData.collation} onValueChange={(value) => setFormData({ ...formData, collation: value })}>
<SelectTrigger id="dbx-new-collation"><SelectValue /></SelectTrigger>
<SelectContent>
@@ -224,11 +229,10 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
<SelectItem value="utf8_general_ci">utf8_general_ci</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</FormField>
</FormRow>
) : (
<div className="form-group">
<label htmlFor="dbx-new-encoding">{t('app.modals.encoding', 'Encoding')}</label>
<FormField label={t('app.modals.encoding', 'Encoding')} htmlFor="dbx-new-encoding">
<Select value={formData.encoding} onValueChange={(value) => setFormData({ ...formData, encoding: value })}>
<SelectTrigger id="dbx-new-encoding"><SelectValue /></SelectTrigger>
<SelectContent>
@@ -237,11 +241,16 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
<SelectItem value="SQL_ASCII">SQL_ASCII</SelectItem>
</SelectContent>
</Select>
</div>
</FormField>
)}
<div className="form-group">
<label htmlFor="dbx-attach-app">{t('app.modals.attachToApplication', 'Attach to service')}</label>
<FormField
label={t('app.modals.attachToApplication', 'Attach to service')}
htmlFor="dbx-attach-app"
hint={appsLoading
? t('app.modals.loadingServices', 'Loading services…')
: t('app.modals.attachServiceHint', 'Optional. An attached database is listed on the service and is cleaned up with it.')}
>
<Select
value={applicationId === '' ? NONE : String(applicationId)}
onValueChange={(value) => setApplicationId(value === NONE ? '' : value)}
@@ -253,12 +262,7 @@ export function CreateDatabaseModal({ engine: initialEngine = 'mysql', status, o
{apps.map((app) => <SelectItem key={app.id} value={String(app.id)}>{app.name}</SelectItem>)}
</SelectContent>
</Select>
<span className="form-help">
{appsLoading
? t('app.modals.loadingServices', 'Loading services…')
: t('app.modals.attachServiceHint', 'Optional. An attached database is listed on the service and is cleaned up with it.')}
</span>
</div>
</FormField>
<div className="form-group">
<label className="checkbox-label">
@@ -282,6 +286,9 @@ export function CreateMySQLUserModal({ databases, onClose, onCreated }) {
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const [createdInfo, setCreatedInfo] = useState(null);
const fe = useFieldErrors({
username: formData.username.trim() ? null : t('app.remoteAccess.usernameRequired', 'Enter a username.'),
}, fieldId);
async function generatePassword() {
try {
@@ -294,12 +301,14 @@ export function CreateMySQLUserModal({ databases, onClose, onCreated }) {
async function handleSubmit(e) {
e.preventDefault();
if (!fe.attempt()) return;
setError('');
setLoading(true);
try {
const result = await api.createMySQLUser(formData);
if (result.success) setCreatedInfo({ username: formData.username, password: result.password, host: formData.host });
} catch (err) {
if (fe.fromServer(err)) return;
setError(err.message || 'Failed to create user');
} finally {
setLoading(false);
@@ -319,20 +328,17 @@ export function CreateMySQLUserModal({ databases, onClose, onCreated }) {
return (
<Modal open onClose={onClose} title={t('app.modals.createMysqlUser', 'New MySQL user')}>
{error && <div className="error-message">{error}</div>}
<form onSubmit={handleSubmit}>
<div className="form-group">
<label htmlFor={`${fieldId}-username`}>{t('app.modals.username', 'Username *')}</label>
<Input id={`${fieldId}-username`} type="text" value={formData.username} onChange={(e) => setFormData({ ...formData, username: e.target.value })} placeholder="db_user" required autoFocus />
</div>
<div className="form-group">
<label htmlFor={`${fieldId}-password`}>{t('common.labels.password', 'Password')}</label>
<form onSubmit={handleSubmit} noValidate>
<FormField label={t('app.modals.username', 'Username')} htmlFor={`${fieldId}-username`} required error={fe.error('username')}>
<Input id={`${fieldId}-username`} type="text" value={formData.username} onChange={(e) => { fe.clear('username'); setFormData({ ...formData, username: e.target.value }); }} onBlur={() => fe.touch('username')} placeholder="db_user" autoFocus />
</FormField>
<FormField label={t('common.labels.password', 'Password')} htmlFor={`${fieldId}-password`}>
<div className="input-with-button">
<Input id={`${fieldId}-password`} type="text" value={formData.password} onChange={(e) => setFormData({ ...formData, password: e.target.value })} placeholder={t('app.modals.leaveEmptyToAutoGenerate', 'Leave empty to auto-generate')} />
<Button type="button" variant="outline" size="sm" onClick={generatePassword}>{t('app.modals.generate', 'Generate')}</Button>
</div>
</div>
<div className="form-group">
<label htmlFor="dbx-mysql-user-host">{t('app.modals.host', 'Host')}</label>
</FormField>
<FormField label={t('app.modals.host', 'Host')} htmlFor="dbx-mysql-user-host">
<Select value={formData.host} onValueChange={(value) => setFormData({ ...formData, host: value })}>
<SelectTrigger id="dbx-mysql-user-host"><SelectValue /></SelectTrigger>
<SelectContent>
@@ -341,16 +347,15 @@ export function CreateMySQLUserModal({ databases, onClose, onCreated }) {
<SelectItem value="127.0.0.1">127.0.0.1</SelectItem>
</SelectContent>
</Select>
</div>
<div className="form-group">
<label htmlFor="dbx-mysql-user-db">{t('app.modals.grantPrivilegesOnDatabase', 'Grant privileges on database')}</label>
</FormField>
<FormField label={t('app.modals.grantPrivilegesOnDatabase', 'Grant privileges on database')} htmlFor="dbx-mysql-user-db">
<DatabaseSelect
id="dbx-mysql-user-db"
databases={databases}
value={formData.database}
onChange={(value) => setFormData({ ...formData, database: value })}
/>
</div>
</FormField>
<div className="modal-actions">
<Button type="button" variant="outline" onClick={onClose}>{t('common.actions.cancel', 'Cancel')}</Button>
<Button type="submit" disabled={loading}>{loading ? t('app.modals.creating', 'Creating…') : t('app.modals.createUser', 'Create user')}</Button>
@@ -367,6 +372,9 @@ export function CreatePostgreSQLUserModal({ databases, onClose, onCreated }) {
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const [createdInfo, setCreatedInfo] = useState(null);
const fe = useFieldErrors({
username: formData.username.trim() ? null : t('app.remoteAccess.usernameRequired', 'Enter a username.'),
}, fieldId);
async function generatePassword() {
try {
@@ -379,12 +387,14 @@ export function CreatePostgreSQLUserModal({ databases, onClose, onCreated }) {
async function handleSubmit(e) {
e.preventDefault();
if (!fe.attempt()) return;
setError('');
setLoading(true);
try {
const result = await api.createPostgreSQLUser(formData);
if (result.success) setCreatedInfo({ username: formData.username, password: result.password });
} catch (err) {
if (fe.fromServer(err)) return;
setError(err.message || 'Failed to create user');
} finally {
setLoading(false);
@@ -404,27 +414,24 @@ export function CreatePostgreSQLUserModal({ databases, onClose, onCreated }) {
return (
<Modal open onClose={onClose} title={t('app.modals.createPostgresqlUser', 'New PostgreSQL user')}>
{error && <div className="error-message">{error}</div>}
<form onSubmit={handleSubmit}>
<div className="form-group">
<label htmlFor={`${fieldId}-username`}>{t('app.modals.username', 'Username *')}</label>
<Input id={`${fieldId}-username`} type="text" value={formData.username} onChange={(e) => setFormData({ ...formData, username: e.target.value })} placeholder="db_user" required autoFocus />
</div>
<div className="form-group">
<label htmlFor={`${fieldId}-password`}>{t('common.labels.password', 'Password')}</label>
<form onSubmit={handleSubmit} noValidate>
<FormField label={t('app.modals.username', 'Username')} htmlFor={`${fieldId}-username`} required error={fe.error('username')}>
<Input id={`${fieldId}-username`} type="text" value={formData.username} onChange={(e) => { fe.clear('username'); setFormData({ ...formData, username: e.target.value }); }} onBlur={() => fe.touch('username')} placeholder="db_user" autoFocus />
</FormField>
<FormField label={t('common.labels.password', 'Password')} htmlFor={`${fieldId}-password`}>
<div className="input-with-button">
<Input id={`${fieldId}-password`} type="text" value={formData.password} onChange={(e) => setFormData({ ...formData, password: e.target.value })} placeholder={t('app.modals.leaveEmptyToAutoGenerate', 'Leave empty to auto-generate')} />
<Button type="button" variant="outline" size="sm" onClick={generatePassword}>{t('app.modals.generate', 'Generate')}</Button>
</div>
</div>
<div className="form-group">
<label htmlFor="dbx-pg-user-db">{t('app.modals.grantPrivilegesOnDatabase', 'Grant privileges on database')}</label>
</FormField>
<FormField label={t('app.modals.grantPrivilegesOnDatabase', 'Grant privileges on database')} htmlFor="dbx-pg-user-db">
<DatabaseSelect
id="dbx-pg-user-db"
databases={databases}
value={formData.database}
onChange={(value) => setFormData({ ...formData, database: value })}
/>
</div>
</FormField>
<div className="modal-actions">
<Button type="button" variant="outline" onClick={onClose}>{t('common.actions.cancel', 'Cancel')}</Button>
<Button type="submit" disabled={loading}>{loading ? t('app.modals.creating', 'Creating…') : t('app.modals.createUser', 'Create user')}</Button>
@@ -5,6 +5,8 @@ import ApiKeyScopesModal from '../api/ApiKeyScopesModal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { FormField } from '../FormField';
import useFieldErrors from '../../hooks/useFieldErrors';
import CopyField from '../CopyField';
import { useTranslation } from 'react-i18next';
@@ -23,9 +25,13 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
const [expiresAt, setExpiresAt] = useState('');
const [saving, setSaving] = useState(false);
const fe = useFieldErrors({
name: name.trim() ? null : t('common.validation.required', 'This field is required.'),
}, fieldId);
const handleSubmit = async (e) => {
e.preventDefault();
if (!name.trim()) return;
if (!fe.attempt()) return;
setSaving(true);
try {
await onSubmit({
@@ -57,19 +63,18 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
return (
<Modal open={true} onClose={onClose} title={t('app.apiKeyModal.createApiKey', 'Create API key')} className="api-key-modal">
<form onSubmit={handleSubmit}>
<form onSubmit={handleSubmit} noValidate>
<div className="modal-body">
<div className="form-group">
<Label htmlFor={`${fieldId}-name`}>{t('common.labels.name', 'Name')}</Label>
<FormField label={t('common.labels.name', 'Name')} htmlFor={`${fieldId}-name`} required error={fe.error('name')}>
<Input
id={`${fieldId}-name`}
type="text"
value={name}
onChange={e => setName(e.target.value)}
onChange={e => { fe.clear('name'); setName(e.target.value); }}
onBlur={() => fe.touch('name')}
placeholder={t('app.apiKeyModal.eGCiCdPipelineMonitoring', 'e.g. CI/CD Pipeline, Monitoring Script')}
required
/>
</div>
</FormField>
<div className="form-group">
<Label>{t('app.apiKeyModal.tier', 'Tier')}</Label>
@@ -93,20 +98,22 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
<ApiKeyScopesModal value={scopes} onChange={setScopes} />
</div>
<div className="form-group">
<Label htmlFor={`${fieldId}-expires`}>{t('app.apiKeyModal.expirationOptional', 'Expiration (optional)')}</Label>
<FormField
label={t('app.apiKeyModal.expirationOptional', 'Expiration (optional)')}
htmlFor={`${fieldId}-expires`}
hint={t('app.apiKeyModal.leaveEmptyForNoExpiration', 'Leave empty for no expiration')}
>
<Input
id={`${fieldId}-expires`}
type="datetime-local"
value={expiresAt}
onChange={e => setExpiresAt(e.target.value)}
/>
<span className="form-help">{t('app.apiKeyModal.leaveEmptyForNoExpiration', 'Leave empty for no expiration')}</span>
</div>
</FormField>
</div>
<div className="modal-footer">
<Button type="button" variant="outline" onClick={onClose}>{t('common.actions.cancel', 'Cancel')}</Button>
<Button type="submit" variant="default" disabled={saving || !name.trim()}>
<Button type="submit" variant="default" disabled={saving}>
{saving ? t('app.apiKeyModal.creating', 'Creating…') : t('app.apiKeyModal.createKey', 'Create key')}
</Button>
</div>
@@ -3,7 +3,8 @@ import api from '../../services/api';
import Modal from '../Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { FormField, FormRow } from '../FormField';
import useFieldErrors from '../../hooks/useFieldErrors';
import { Checkbox } from '@/components/ui/checkbox';
import { useTranslation } from 'react-i18next';
@@ -32,6 +33,15 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
}
}, [subscription]);
const isUrl = (value) => { try { return /^https?:$/.test(new URL(value).protocol); } catch { return false; } };
const fe = useFieldErrors({
name: name.trim() ? null : t('common.validation.required', 'This field is required.'),
url: !url.trim()
? t('common.validation.required', 'This field is required.')
: (isUrl(url.trim()) ? null : t('common.validation.urlInvalid', 'Enter a valid URL, e.g. https://example.com/webhook.')),
events: selectedEvents.length ? null : t('app.webhookSubscriptionModal.eventsRequired', 'Select at least one event.'),
}, fieldId);
const handleEventToggle = (eventType) => {
setSelectedEvents(prev =>
prev.includes(eventType)
@@ -54,7 +64,7 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
const handleSubmit = async (e) => {
e.preventDefault();
if (!name.trim() || !url.trim() || selectedEvents.length === 0) return;
if (!fe.attempt()) return;
setSaving(true);
try {
await onSubmit({
@@ -78,35 +88,32 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
return (
<Modal open={true} onClose={onClose} title={subscription ? t('app.webhookSubscriptionModal.editSubscription', 'Edit subscription') : t('app.webhookSubscriptionModal.createWebhookSubscription', 'Create webhook subscription')} className="webhook-modal">
<form onSubmit={handleSubmit}>
<form onSubmit={handleSubmit} noValidate>
<div className="modal-body">
<div className="form-group">
<Label htmlFor={`${fieldId}-name`}>{t('common.labels.name', 'Name')}</Label>
<FormField label={t('common.labels.name', 'Name')} htmlFor={`${fieldId}-name`} required error={fe.error('name')}>
<Input
id={`${fieldId}-name`}
type="text"
value={name}
onChange={e => setName(e.target.value)}
onChange={e => { fe.clear('name'); setName(e.target.value); }}
onBlur={() => fe.touch('name')}
placeholder={t('app.webhookSubscriptionModal.eGSlackNotificationsCiTrigger', 'e.g. Slack Notifications, CI Trigger')}
required
/>
</div>
</FormField>
<div className="form-group">
<Label htmlFor={`${fieldId}-url`}>{t('app.webhookSubscriptionModal.payloadUrl', 'Payload URL')}</Label>
<FormField label={t('app.webhookSubscriptionModal.payloadUrl', 'Payload URL')} htmlFor={`${fieldId}-url`} required error={fe.error('url')}>
<Input
id={`${fieldId}-url`}
type="url"
value={url}
onChange={e => setUrl(e.target.value)}
onChange={e => { fe.clear('url'); setUrl(e.target.value); }}
onBlur={() => fe.touch('url')}
placeholder="https://example.com/webhook"
required
/>
</div>
</FormField>
<div className="form-group">
<Label>{t('app.webhookSubscriptionModal.events', 'Events')}</Label>
<div className="webhook-modal__events">
<FormField label={t('app.webhookSubscriptionModal.events', 'Events')} htmlFor={`${fieldId}-events`} required error={fe.error('events')}>
<div className="webhook-modal__events" id={`${fieldId}-events`} tabIndex={-1} role="group">
{Object.entries(groupedEvents).map(([category, events]) => {
const categoryEvents = events.map(e => e.type);
const allSelected = categoryEvents.every(e => selectedEvents.includes(e));
@@ -135,11 +142,10 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
);
})}
</div>
</div>
</FormField>
<div className="form-row">
<div className="form-group">
<Label htmlFor={`${fieldId}-retry-count`}>{t('app.webhookSubscriptionModal.retryCount', 'Retry count')}</Label>
<FormRow>
<FormField label={t('app.webhookSubscriptionModal.retryCount', 'Retry count')} htmlFor={`${fieldId}-retry-count`}>
<Input
id={`${fieldId}-retry-count`}
type="number"
@@ -148,9 +154,8 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
min={0}
max={10}
/>
</div>
<div className="form-group">
<Label htmlFor={`${fieldId}-timeout`}>{t('app.webhookSubscriptionModal.timeoutSeconds', 'Timeout (seconds)')}</Label>
</FormField>
<FormField label={t('app.webhookSubscriptionModal.timeoutSeconds', 'Timeout (seconds)')} htmlFor={`${fieldId}-timeout`}>
<Input
id={`${fieldId}-timeout`}
type="number"
@@ -159,16 +164,12 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
min={1}
max={30}
/>
</div>
</div>
</FormField>
</FormRow>
</div>
<div className="modal-footer">
<Button type="button" variant="outline" onClick={onClose}>{t('common.actions.cancel', 'Cancel')}</Button>
<Button
type="submit"
variant="default"
disabled={saving || !name.trim() || !url.trim() || selectedEvents.length === 0}
>
<Button type="submit" variant="default" disabled={saving}>
{saving ? t('common.saving', 'Saving…') : (subscription ? t('app.webhookSubscriptionModal.update', 'Update') : t('common.actions.create', 'Create'))}
</Button>
</div>
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "قم بإنشاء مستخدم بنفس الاسم والامتيازات الكاملة",
"creating": "جارٍ الإنشاء…",
"databaseCreated": "تم إنشاء قاعدة البيانات",
"databaseName": "اسم قاعدة البيانات *",
"databaseName": "اسم قاعدة البيانات",
"encoding": "الترميز",
"engine": "محرك",
"fromTheTemplateCatalog": "من كتالوج القالب",
@@ -3766,7 +3766,9 @@
"running": "قيد التشغيل",
"saveTheseCredentialsThePasswordWon": "احفظ بيانات الاعتماد هذه — لن يتم عرض كلمة المرور مرة أخرى.",
"userCreated": "تم إنشاء المستخدم",
"username": "اسم المستخدم *"
"username": "اسم المستخدم",
"databaseNameInvalid": "استخدم الأحرف والأرقام والشرطة السفلية فقط.",
"databaseNameRequired": "أدخل اسم قاعدة البيانات."
},
"modeToggle": {
"assistant": "مساعد",
@@ -7663,7 +7665,8 @@
"payloadUrl": "الحمولة URL",
"retryCount": "إعادة المحاولة العد",
"timeoutSeconds": "المهلة (ثواني)",
"update": "تحديث"
"update": "تحديث",
"eventsRequired": "حدّد حدثًا واحدًا على الأقل."
},
"webhooksTab": {
"active": "نشط",
@@ -8130,7 +8133,8 @@
"domainEmpty": "أدخل نطاقًا.",
"domainInvalid": "أدخل نطاقًا صالحًا.",
"emailInvalid": "أدخل عنوان بريد إلكتروني صالحًا.",
"required": "هذا الحقل مطلوب."
"required": "هذا الحقل مطلوب.",
"urlInvalid": "أدخل عنوان URL صالحًا، مثل https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "একই নাম এবং সম্পূর্ণ অধিকার সহ ব্যবহারকারী তৈরি করুন",
"creating": "তৈরি হচ্ছে…",
"databaseCreated": "ডাটাবেস তৈরি করা হয়েছে",
"databaseName": "ডাটাবেসের নাম *",
"databaseName": "ডাটাবেসের নাম",
"encoding": "এনকোডিং",
"engine": "ইঞ্জিন",
"fromTheTemplateCatalog": "টেমপ্লেট ক্যাটালগ থেকে",
@@ -3766,7 +3766,9 @@
"running": "চলছে",
"saveTheseCredentialsThePasswordWon": "এই শংসাপত্রগুলি সংরক্ষণ করুন — পাসওয়ার্ডটি আর দেখানো হবে না৷",
"userCreated": "ব্যবহারকারী তৈরি করা হয়েছে",
"username": "ব্যবহারকারীর নাম *"
"username": "ব্যবহারকারীর নাম",
"databaseNameInvalid": "শুধু অক্ষর, সংখ্যা ও আন্ডারস্কোর ব্যবহার করুন।",
"databaseNameRequired": "ডাটাবেসের নাম লিখুন।"
},
"modeToggle": {
"assistant": "সহকারী",
@@ -7663,7 +7665,8 @@
"payloadUrl": "পেলোড URL",
"retryCount": "গণনা পুনরায় চেষ্টা করুন",
"timeoutSeconds": "সময়সীমা (সেকেন্ড)",
"update": "আপডেট করুন"
"update": "আপডেট করুন",
"eventsRequired": "কমপক্ষে একটি ইভেন্ট নির্বাচন করুন।"
},
"webhooksTab": {
"active": "সক্রিয়",
@@ -8130,7 +8133,8 @@
"domainEmpty": "একটি ডোমেইন লিখুন।",
"domainInvalid": "একটি বৈধ ডোমেইন লিখুন।",
"emailInvalid": "একটি বৈধ ইমেইল ঠিকানা লিখুন।",
"required": "এই ঘরটি পূরণ করা আবশ্যক।"
"required": "এই ঘরটি পূরণ করা আবশ্যক।",
"urlInvalid": "একটি বৈধ URL লিখুন, যেমন https://example.com/webhook।"
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Erstellen Sie einen Benutzer mit demselben Namen und vollständigen Berechtigungen",
"creating": "Wird erstellt…",
"databaseCreated": "Datenbank erstellt",
"databaseName": "Datenbankname *",
"databaseName": "Datenbankname",
"encoding": "Kodierung",
"engine": "Motor",
"fromTheTemplateCatalog": "aus dem Vorlagenkatalog",
@@ -3766,7 +3766,9 @@
"running": "läuft",
"saveTheseCredentialsThePasswordWon": "Speichern Sie diese Anmeldedaten – das Passwort wird nicht mehr angezeigt.",
"userCreated": "Benutzer erstellt",
"username": "Benutzername *"
"username": "Benutzername",
"databaseNameInvalid": "Verwende nur Buchstaben, Zahlen und Unterstriche.",
"databaseNameRequired": "Gib den Datenbanknamen ein."
},
"modeToggle": {
"assistant": "Assistent",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Payload-URL",
"retryCount": "Anzahl der Wiederholungen",
"timeoutSeconds": "Timeout (Sekunden)",
"update": "Aktualisieren"
"update": "Aktualisieren",
"eventsRequired": "Wähle mindestens ein Ereignis aus."
},
"webhooksTab": {
"active": "Aktiv",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Gib eine Domain ein.",
"domainInvalid": "Gib eine gültige Domain ein.",
"emailInvalid": "Gib eine gültige E-Mail-Adresse ein.",
"required": "Dieses Feld ist erforderlich."
"required": "Dieses Feld ist erforderlich.",
"urlInvalid": "Gib eine gültige URL ein, z. B. https://example.com/webhook."
}
},
"errors": {
+7 -3
View File
@@ -3860,7 +3860,9 @@
"createUserWithSameNameAnd": "Create user with same name and full privileges",
"creating": "Creating…",
"databaseCreated": "Database created",
"databaseName": "Database name *",
"databaseName": "Database name",
"databaseNameInvalid": "Use only letters, numbers and underscores.",
"databaseNameRequired": "Enter the database name.",
"databaseUserNotCreated": "Database created, but its user was not: {{error}}",
"encoding": "Encoding",
"engine": "Engine",
@@ -3878,7 +3880,7 @@
"running": "running",
"saveTheseCredentialsThePasswordWon": "Save these credentials. The password won't be shown again.",
"userCreated": "User created",
"username": "Username *"
"username": "Username"
},
"modeToggle": {
"assistant": "Assistant",
@@ -8054,6 +8056,7 @@
"eGSlackNotificationsCiTrigger": "e.g. Slack Notifications, CI Trigger",
"editSubscription": "Edit subscription",
"events": "Events",
"eventsRequired": "Select at least one event.",
"payloadUrl": "Payload URL",
"retryCount": "Retry count",
"timeoutSeconds": "Timeout (seconds)",
@@ -8573,7 +8576,8 @@
"domainEmpty": "Enter a domain.",
"domainInvalid": "Enter a valid domain.",
"emailInvalid": "Enter a valid email address.",
"required": "This field is required."
"required": "This field is required.",
"urlInvalid": "Enter a valid URL, e.g. https://example.com/webhook."
}
},
"effectiveEnv": {
+9 -5
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Crear un usuario con el mismo nombre y privilegios completos",
"creating": "Creando…",
"databaseCreated": "Base de datos creada",
"databaseName": "Nombre de la base de datos *",
"databaseName": "Nombre de la base de datos",
"encoding": "Codificación",
"engine": "Motor",
"fromTheTemplateCatalog": "del catálogo de plantillas",
@@ -3766,8 +3766,10 @@
"running": "en ejecución",
"saveTheseCredentialsThePasswordWon": "Guarda estas credenciales: la contraseña no se volverá a mostrar.",
"userCreated": "Usuario creado",
"username": "Nombre de usuario *",
"databaseUserNotCreated": "Base de datos creada, pero su usuario no: {{error}}"
"username": "Nombre de usuario",
"databaseUserNotCreated": "Base de datos creada, pero su usuario no: {{error}}",
"databaseNameInvalid": "Usa solo letras, números y guiones bajos.",
"databaseNameRequired": "Introduce el nombre de la base de datos."
},
"modeToggle": {
"assistant": "Asistente",
@@ -7664,7 +7666,8 @@
"payloadUrl": "URL del payload",
"retryCount": "Número de reintentos",
"timeoutSeconds": "Tiempo de espera (segundos)",
"update": "Actualizar"
"update": "Actualizar",
"eventsRequired": "Selecciona al menos un evento."
},
"webhooksTab": {
"active": "Activo",
@@ -8131,7 +8134,8 @@
"domainEmpty": "Introduce un dominio.",
"domainInvalid": "Introduce un dominio válido.",
"emailInvalid": "Introduce una dirección de correo válida.",
"required": "Este campo es obligatorio."
"required": "Este campo es obligatorio.",
"urlInvalid": "Introduce una URL válida, p. ej. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Créer un utilisateur avec le même nom et tous les privilèges",
"creating": "Création…",
"databaseCreated": "Base de données créée",
"databaseName": "Nom de la base de données *",
"databaseName": "Nom de la base de données",
"encoding": "Codage",
"engine": "Moteur",
"fromTheTemplateCatalog": "du catalogue de modèles",
@@ -3766,7 +3766,9 @@
"running": "en cours d'exécution",
"saveTheseCredentialsThePasswordWon": "Enregistrez ces informations d'identification : le mot de passe ne sera plus affiché.",
"userCreated": "Utilisateur créé",
"username": "Nom d'utilisateur *"
"username": "Nom d'utilisateur",
"databaseNameInvalid": "Utilisez uniquement des lettres, des chiffres et des tirets bas.",
"databaseNameRequired": "Saisissez le nom de la base de données."
},
"modeToggle": {
"assistant": "Assistant",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Charge utile URL",
"retryCount": "Nombre de tentatives",
"timeoutSeconds": "Délai d'expiration (secondes)",
"update": "Mettre à jour"
"update": "Mettre à jour",
"eventsRequired": "Sélectionnez au moins un événement."
},
"webhooksTab": {
"active": "Actif",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Saisissez un domaine.",
"domainInvalid": "Saisissez un domaine valide.",
"emailInvalid": "Saisissez une adresse e-mail valide.",
"required": "Ce champ est obligatoire."
"required": "Ce champ est obligatoire.",
"urlInvalid": "Saisissez une URL valide, par ex. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Buat pengguna dengan nama yang sama dan hak penuh",
"creating": "Membuat…",
"databaseCreated": "Basis data dibuat",
"databaseName": "Nama basis data *",
"databaseName": "Nama basis data",
"encoding": "Pengkodean",
"engine": "Mesin",
"fromTheTemplateCatalog": "dari katalog templat",
@@ -3766,7 +3766,9 @@
"running": "berjalan",
"saveTheseCredentialsThePasswordWon": "Simpan kredensial ini — kata sandi tidak akan ditampilkan lagi.",
"userCreated": "Pengguna dibuat",
"username": "Nama belakang *"
"username": "Nama belakang",
"databaseNameInvalid": "Gunakan hanya huruf, angka, dan garis bawah.",
"databaseNameRequired": "Masukkan nama basis data."
},
"modeToggle": {
"assistant": "Asisten",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Muatan URL",
"retryCount": "Coba Lagi Hitung",
"timeoutSeconds": "Batas waktu (detik)",
"update": "Perbarui"
"update": "Perbarui",
"eventsRequired": "Pilih setidaknya satu peristiwa."
},
"webhooksTab": {
"active": "Aktif",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Masukkan domain.",
"domainInvalid": "Masukkan domain yang valid.",
"emailInvalid": "Masukkan alamat email yang valid.",
"required": "Kolom ini wajib diisi."
"required": "Kolom ini wajib diisi.",
"urlInvalid": "Masukkan URL yang valid, mis. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Crea utente con lo stesso nome e privilegi completi",
"creating": "Creazione…",
"databaseCreated": "Banca dati creata",
"databaseName": "Nome della banca dati *",
"databaseName": "Nome della banca dati",
"encoding": "Codifica",
"engine": "Motore",
"fromTheTemplateCatalog": "dal catalogo dei modelli",
@@ -3766,7 +3766,9 @@
"running": "in esecuzione",
"saveTheseCredentialsThePasswordWon": "Salva queste credenziali: la password non verrà mostrata più.",
"userCreated": "Utente creato",
"username": "Nome utente *"
"username": "Nome utente",
"databaseNameInvalid": "Usa solo lettere, numeri e caratteri di sottolineatura.",
"databaseNameRequired": "Inserisci il nome del database."
},
"modeToggle": {
"assistant": "Assistente",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Carico utile URL",
"retryCount": "Conteggio tentativi",
"timeoutSeconds": "Timeout (secondi)",
"update": "Aggiorna"
"update": "Aggiorna",
"eventsRequired": "Seleziona almeno un evento."
},
"webhooksTab": {
"active": "Attivo",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Inserisci un dominio.",
"domainInvalid": "Inserisci un dominio valido.",
"emailInvalid": "Inserisci un indirizzo e-mail valido.",
"required": "Questo campo è obbligatorio."
"required": "Questo campo è obbligatorio.",
"urlInvalid": "Inserisci un URL valido, ad es. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "동일한 이름과 모든 권한을 가진 사용자 생성",
"creating": "생성 중…",
"databaseCreated": "데이터베이스가 생성되었습니다.",
"databaseName": "데이터베이스 이름 *",
"databaseName": "데이터베이스 이름",
"encoding": "인코딩",
"engine": "엔진",
"fromTheTemplateCatalog": "템플릿 카탈로그에서",
@@ -3766,7 +3766,9 @@
"running": "실행 중",
"saveTheseCredentialsThePasswordWon": "이 자격 증명을 저장하세요. 비밀번호는 다시 표시되지 않습니다.",
"userCreated": "사용자가 생성되었습니다.",
"username": "사용자 이름 *"
"username": "사용자 이름",
"databaseNameInvalid": "문자, 숫자, 밑줄만 사용하세요.",
"databaseNameRequired": "데이터베이스 이름을 입력하세요."
},
"modeToggle": {
"assistant": "어시스턴트",
@@ -7663,7 +7665,8 @@
"payloadUrl": "페이로드 URL",
"retryCount": "재시도 횟수",
"timeoutSeconds": "시간 초과(초)",
"update": "업데이트"
"update": "업데이트",
"eventsRequired": "이벤트를 하나 이상 선택하세요."
},
"webhooksTab": {
"active": "활성",
@@ -8130,7 +8133,8 @@
"domainEmpty": "도메인을 입력하세요.",
"domainInvalid": "올바른 도메인을 입력하세요.",
"emailInvalid": "올바른 이메일 주소를 입력하세요.",
"required": "필수 입력 항목입니다."
"required": "필수 입력 항목입니다.",
"urlInvalid": "https://example.com/webhook 같은 올바른 URL을 입력하세요."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Utwórz użytkownika o tej samej nazwie i pełnych uprawnieniach",
"creating": "Tworzenie…",
"databaseCreated": "Utworzono bazę danych",
"databaseName": "Nazwa bazy danych *",
"databaseName": "Nazwa bazy danych",
"encoding": "Kodowanie",
"engine": "Silnik",
"fromTheTemplateCatalog": "z katalogu szablonów",
@@ -3766,7 +3766,9 @@
"running": "działa",
"saveTheseCredentialsThePasswordWon": "Zapisz te dane uwierzytelniające — hasło nie będzie wyświetlane ponownie.",
"userCreated": "Utworzono użytkownika",
"username": "Nazwa użytkownika *"
"username": "Nazwa użytkownika",
"databaseNameInvalid": "Używaj tylko liter, cyfr i podkreślników.",
"databaseNameRequired": "Podaj nazwę bazy danych."
},
"modeToggle": {
"assistant": "Asystent",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Ładunek URL",
"retryCount": "Liczba ponownych prób",
"timeoutSeconds": "Limit czasu (sekundy)",
"update": "Aktualizuj"
"update": "Aktualizuj",
"eventsRequired": "Wybierz co najmniej jedno zdarzenie."
},
"webhooksTab": {
"active": "Aktywny",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Podaj domenę.",
"domainInvalid": "Podaj prawidłową domenę.",
"emailInvalid": "Podaj prawidłowy adres e-mail.",
"required": "To pole jest wymagane."
"required": "To pole jest wymagane.",
"urlInvalid": "Podaj prawidłowy adres URL, np. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Crie um usuário com o mesmo nome e privilégios totais",
"creating": "Criando…",
"databaseCreated": "Banco de dados criado",
"databaseName": "Nome do banco de dados *",
"databaseName": "Nome do banco de dados",
"encoding": "Codificação",
"engine": "Motor",
"fromTheTemplateCatalog": "do catálogo de modelos",
@@ -3766,7 +3766,9 @@
"running": "em execução",
"saveTheseCredentialsThePasswordWon": "Salve essas credenciais – a senha não será mostrada novamente.",
"userCreated": "Usuário criado",
"username": "Nome de usuário *"
"username": "Nome de usuário",
"databaseNameInvalid": "Use apenas letras, números e sublinhados.",
"databaseNameRequired": "Digite o nome do banco de dados."
},
"modeToggle": {
"assistant": "Assistente",
@@ -7663,7 +7665,8 @@
"payloadUrl": "URL de carga útil",
"retryCount": "Contagem de novas tentativas",
"timeoutSeconds": "Tempo limite (segundos)",
"update": "Atualizar"
"update": "Atualizar",
"eventsRequired": "Selecione pelo menos um evento."
},
"webhooksTab": {
"active": "Ativo",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Informe um domínio.",
"domainInvalid": "Informe um domínio válido.",
"emailInvalid": "Informe um endereço de e-mail válido.",
"required": "Este campo é obrigatório."
"required": "Este campo é obrigatório.",
"urlInvalid": "Insira uma URL válida, por ex. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Создайте пользователя с тем же именем и полными привилегиями.",
"creating": "Создание…",
"databaseCreated": "База данных создана",
"databaseName": "Имя базы данных *",
"databaseName": "Имя базы данных",
"encoding": "Кодирование",
"engine": "Двигатель",
"fromTheTemplateCatalog": "из каталога шаблонов",
@@ -3766,7 +3766,9 @@
"running": "запущен",
"saveTheseCredentialsThePasswordWon": "Сохраните эти учетные данные — пароль больше не будет отображаться.",
"userCreated": "Пользователь создан",
"username": "Имя пользователя *"
"username": "Имя пользователя",
"databaseNameInvalid": "Используйте только буквы, цифры и подчёркивания.",
"databaseNameRequired": "Введите имя базы данных."
},
"modeToggle": {
"assistant": "Ассистент",
@@ -7663,7 +7665,8 @@
"payloadUrl": "URL-адрес полезной нагрузки",
"retryCount": "Количество повторов",
"timeoutSeconds": "Тайм-аут (секунды)",
"update": "Обновить"
"update": "Обновить",
"eventsRequired": "Выберите хотя бы одно событие."
},
"webhooksTab": {
"active": "Активен",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Укажите домен.",
"domainInvalid": "Укажите корректный домен.",
"emailInvalid": "Укажите корректный адрес электронной почты.",
"required": "Это поле обязательно."
"required": "Это поле обязательно.",
"urlInvalid": "Введите корректный URL, например https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "สร้างผู้ใช้ที่มีชื่อเดียวกันและสิทธิ์เต็ม",
"creating": "กำลังสร้าง…",
"databaseCreated": "สร้างฐานข้อมูลแล้ว",
"databaseName": "ชื่อฐานข้อมูล *",
"databaseName": "ชื่อฐานข้อมูล",
"encoding": "การเข้ารหัส",
"engine": "เครื่องยนต์",
"fromTheTemplateCatalog": "จากแค็ตตาล็อกเทมเพลต",
@@ -3766,7 +3766,9 @@
"running": "กำลังทำงาน",
"saveTheseCredentialsThePasswordWon": "บันทึกข้อมูลประจำตัวเหล่านี้ - รหัสผ่านจะไม่แสดงอีก",
"userCreated": "ผู้ใช้สร้างขึ้น",
"username": "ชื่อผู้ใช้ *"
"username": "ชื่อผู้ใช้",
"databaseNameInvalid": "ใช้ได้เฉพาะตัวอักษร ตัวเลข และขีดล่าง",
"databaseNameRequired": "กรอกชื่อฐานข้อมูล"
},
"modeToggle": {
"assistant": "ผู้ช่วย",
@@ -7663,7 +7665,8 @@
"payloadUrl": "เพย์โหลด URL",
"retryCount": "ลองนับอีกครั้ง",
"timeoutSeconds": "หมดเวลา (วินาที)",
"update": "อัปเดต"
"update": "อัปเดต",
"eventsRequired": "เลือกอย่างน้อยหนึ่งเหตุการณ์"
},
"webhooksTab": {
"active": "ใช้งานอยู่",
@@ -8130,7 +8133,8 @@
"domainEmpty": "ป้อนโดเมน",
"domainInvalid": "ป้อนโดเมนที่ถูกต้อง",
"emailInvalid": "ป้อนที่อยู่อีเมลที่ถูกต้อง",
"required": "จำเป็นต้องกรอกช่องนี้"
"required": "จำเป็นต้องกรอกช่องนี้",
"urlInvalid": "กรอก URL ที่ถูกต้อง เช่น https://example.com/webhook"
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Aynı ada ve tüm ayrıcalıklara sahip bir kullanıcı oluşturun",
"creating": "Oluşturuluyor…",
"databaseCreated": "Veritabanı oluşturuldu",
"databaseName": "Veritabanı adı *",
"databaseName": "Veritabanı adı",
"encoding": "Kodlama",
"engine": "Motor",
"fromTheTemplateCatalog": "şablon kataloğundan",
@@ -3766,7 +3766,9 @@
"running": "çalışıyor",
"saveTheseCredentialsThePasswordWon": "Bu kimlik bilgilerini kaydedin; şifre bir daha gösterilmeyecektir.",
"userCreated": "Kullanıcı oluşturuldu",
"username": "Kullanıcı adı *"
"username": "Kullanıcı adı",
"databaseNameInvalid": "Yalnızca harf, rakam ve alt çizgi kullanın.",
"databaseNameRequired": "Veritabanı adını girin."
},
"modeToggle": {
"assistant": "Asistan",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Yük URL",
"retryCount": "Yeniden Deneme Sayısı",
"timeoutSeconds": "Zaman aşımı (saniye)",
"update": "Güncelle"
"update": "Güncelle",
"eventsRequired": "En az bir olay seçin."
},
"webhooksTab": {
"active": "Etkin",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Bir alan adı girin.",
"domainInvalid": "Geçerli bir alan adı girin.",
"emailInvalid": "Geçerli bir e-posta adresi girin.",
"required": "Bu alan zorunludur."
"required": "Bu alan zorunludur.",
"urlInvalid": "Geçerli bir URL girin, ör. https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "Tạo người dùng có cùng tên và đầy đủ đặc quyền",
"creating": "Đang tạo…",
"databaseCreated": "Đã tạo cơ sở dữ liệu",
"databaseName": "Tên cơ sở dữ liệu *",
"databaseName": "Tên cơ sở dữ liệu",
"encoding": "Mã hóa",
"engine": "Động cơ",
"fromTheTemplateCatalog": "từ danh mục mẫu",
@@ -3766,7 +3766,9 @@
"running": "đang chạy",
"saveTheseCredentialsThePasswordWon": "Lưu các thông tin xác thực này — mật khẩu sẽ không được hiển thị lại.",
"userCreated": "Người dùng đã tạo",
"username": "Tên người dùng *"
"username": "Tên người dùng",
"databaseNameInvalid": "Chỉ dùng chữ cái, chữ số và dấu gạch dưới.",
"databaseNameRequired": "Nhập tên cơ sở dữ liệu."
},
"modeToggle": {
"assistant": "Trợ lý",
@@ -7663,7 +7665,8 @@
"payloadUrl": "Tải trọng URL",
"retryCount": "Đếm lại",
"timeoutSeconds": "Thời gian chờ (giây)",
"update": "Cập nhật"
"update": "Cập nhật",
"eventsRequired": "Chọn ít nhất một sự kiện."
},
"webhooksTab": {
"active": "Hoạt động",
@@ -8130,7 +8133,8 @@
"domainEmpty": "Nhập tên miền.",
"domainInvalid": "Nhập tên miền hợp lệ.",
"emailInvalid": "Nhập địa chỉ email hợp lệ.",
"required": "Trường này là bắt buộc."
"required": "Trường này là bắt buộc.",
"urlInvalid": "Nhập URL hợp lệ, ví dụ https://example.com/webhook."
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "创建具有相同名称和完全权限的用户",
"creating": "正在创建…",
"databaseCreated": "数据库已创建",
"databaseName": "数据库名称 *",
"databaseName": "数据库名称",
"encoding": "编码",
"engine": "引擎",
"fromTheTemplateCatalog": "从模板目录",
@@ -3766,7 +3766,9 @@
"running": "运行中",
"saveTheseCredentialsThePasswordWon": "保存这些凭据 - 密码将不会再次显示。",
"userCreated": "用户已创建",
"username": "用户名 *"
"username": "用户名",
"databaseNameInvalid": "只能使用字母、数字和下划线。",
"databaseNameRequired": "请输入数据库名称。"
},
"modeToggle": {
"assistant": "助手",
@@ -7663,7 +7665,8 @@
"payloadUrl": "负载网址",
"retryCount": "重试次数",
"timeoutSeconds": "超时(秒)",
"update": "更新"
"update": "更新",
"eventsRequired": "请至少选择一个事件。"
},
"webhooksTab": {
"active": "活动",
@@ -8130,7 +8133,8 @@
"domainEmpty": "请输入域名。",
"domainInvalid": "请输入有效的域名。",
"emailInvalid": "请输入有效的电子邮件地址。",
"required": "此字段为必填项。"
"required": "此字段为必填项。",
"urlInvalid": "请输入有效的 URL,例如 https://example.com/webhook。"
}
},
"errors": {
+8 -4
View File
@@ -3749,7 +3749,7 @@
"createUserWithSameNameAnd": "建立具有相同名稱和完全權限的使用者",
"creating": "正在建立…",
"databaseCreated": "資料庫已建立",
"databaseName": "資料庫名稱 *",
"databaseName": "資料庫名稱",
"encoding": "編碼",
"engine": "引擎",
"fromTheTemplateCatalog": "從範本目錄",
@@ -3766,7 +3766,9 @@
"running": "執行中",
"saveTheseCredentialsThePasswordWon": "儲存這些憑證 - 密碼將不會再次顯示。",
"userCreated": "使用者已建立",
"username": "使用者名稱 *"
"username": "使用者名稱",
"databaseNameInvalid": "只能使用字母、數字和底線。",
"databaseNameRequired": "請輸入資料庫名稱。"
},
"modeToggle": {
"assistant": "助理",
@@ -7663,7 +7665,8 @@
"payloadUrl": "酬載網址",
"retryCount": "重試次數",
"timeoutSeconds": "逾時(秒)",
"update": "更新"
"update": "更新",
"eventsRequired": "請至少選擇一個事件。"
},
"webhooksTab": {
"active": "使用中",
@@ -8130,7 +8133,8 @@
"domainEmpty": "請輸入網域。",
"domainInvalid": "請輸入有效的網域。",
"emailInvalid": "請輸入有效的電子郵件地址。",
"required": "此欄位為必填。"
"required": "此欄位為必填。",
"urlInvalid": "請輸入有效的 URL,例如 https://example.com/webhook。"
}
},
"errors": {
+11 -4
View File
@@ -265,7 +265,14 @@ const Domains = () => {
setIsPrimary(false);
loadData();
} catch (err) {
setError(err.message);
// Field-keyed errors, or a message that is plainly about the
// domain name (duplicate / invalid), land at the field; anything
// else stays in the banner.
const msg = err?.message || '';
const pinned = addErrors.fromServer(err)
|| (/\b(domain|hostname)\b/i.test(msg) && /already|exists|invalid|in use|taken|not allowed/i.test(msg)
&& addErrors.fromServer({ errors: { domain: msg } }));
if (!pinned) setError(msg);
} finally {
setActionLoading(false);
}
@@ -916,9 +923,9 @@ const Domains = () => {
{/* ── Add Domain Modal ───────────────────────────── */}
<Modal open={showAddModal} onClose={closeAdd} title={t('app.domains.addDomain2', 'Add domain')}>
<form onSubmit={handleAddDomain}>
<form onSubmit={handleAddDomain} noValidate>
<FormField label={t('app.domains.application', 'Service')} htmlFor={`${fieldId}-app`} required error={addErrors.error('app')}>
<Select value={selectedAppId} onValueChange={setSelectedAppId}>
<Select value={selectedAppId} onValueChange={(v) => { addErrors.clear('app'); setSelectedAppId(v); }}>
<SelectTrigger id={`${fieldId}-app`} onBlur={() => addErrors.touch('app')}><SelectValue placeholder={t('app.domains.selectAnApplication', 'Select a service')} /></SelectTrigger>
<SelectContent>
{apps.map(app => (
@@ -934,7 +941,7 @@ const Domains = () => {
id={`${fieldId}-domain`}
exclude={domains.map((d) => d.name)}
rejectExisting
onChange={(name, info) => { setDomainName(name); setDomainInfo(info); }}
onChange={(name, info) => { addErrors.clear('domain'); setDomainName(name); setDomainInfo(info); }}
disabled={actionLoading}
/>
</div>
+28 -21
View File
@@ -22,6 +22,8 @@ import {
import { useTableChrome, GridViewPicker, GridToolsMenu, GridFilterButton } from '@/components/ds/grid';
import ServerPicker from '@/components/ServerPicker';
import PortField from '@/components/PortField';
import { FormField } from '@/components/FormField';
import useFieldErrors from '@/hooks/useFieldErrors';
import { LOCAL_SERVER_ID } from '@/utils/serverTarget';
import { useTopbarChrome } from '@/hooks/useTopbarActions';
import { applyTableSorts, useTableSort } from '@/hooks/useTableSort';
@@ -753,8 +755,17 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
const domainPreview = baseDomain && appName && isLocalTarget && !isRepo
? `${appName}.${baseDomain}` : null;
const visibleVars = (template.variables || []).filter(v => !v.hidden);
// A password with a default is auto-generated, so it may stay empty.
const isRequiredVar = (v) => v.required && !(v.type === 'password' && v.default);
const fe = useFieldErrors(Object.fromEntries(visibleVars.map(v => [
`var-${v.name}`,
isRequiredVar(v) && !variables[v.name] ? t('common.validation.required', 'This field is required.') : null,
])), fieldId);
async function handleInstall(e) {
e.preventDefault();
if (!fe.attempt()) return;
setInstalling(true);
setErrors([]);
@@ -837,8 +848,6 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
}
}
const visibleVars = (template.variables || []).filter(v => !v.hidden);
return (
<Drawer
flush
@@ -850,7 +859,7 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
width={520}
className="sk-formdrawer"
>
<form onSubmit={handleInstall} className="sk-formdrawer__form">
<form onSubmit={handleInstall} className="sk-formdrawer__form" noValidate>
<div className="sk-formdrawer__body">
{errors.length > 0 && (
<div className="alert alert-danger">
@@ -937,18 +946,20 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
<div className="sk-formdrawer__field">
<span className="sk-formdrawer__label">{t('app.templates.configuration', 'Settings')}</span>
{visibleVars.map(variable => (
<div key={variable.name} className="form-group">
<label htmlFor={`${fieldId}-var-${variable.name}`}>
{variable.name}
{variable.required && ' *'}
</label>
<FormField
key={variable.name}
label={variable.name}
htmlFor={`${fieldId}-var-${variable.name}`}
required={isRequiredVar(variable)}
hint={variable.description || undefined}
error={fe.error(`var-${variable.name}`)}
>
{variable.options ? (
<Select
value={variables[variable.name] || ''}
onValueChange={(v) => setVariables({...variables, [variable.name]: v})}
required={variable.required}
onValueChange={(v) => { fe.clear(`var-${variable.name}`); setVariables({...variables, [variable.name]: v}); }}
>
<SelectTrigger id={`${fieldId}-var-${variable.name}`} aria-label={variable.name}>
<SelectTrigger id={`${fieldId}-var-${variable.name}`} aria-label={variable.name} onBlur={() => fe.touch(`var-${variable.name}`)}>
<SelectValue placeholder={t('app.templates.select', 'Select…')} />
</SelectTrigger>
<SelectContent>
@@ -963,34 +974,30 @@ const InstallModal = ({ template, onClose, onSuccess, renderIcon }) => {
<PortField
id={`${fieldId}-var-${variable.name}`}
value={variables[variable.name] || ''}
onChange={(port) => setVariables({...variables, [variable.name]: port === '' ? '' : String(port)})}
onChange={(port) => { fe.clear(`var-${variable.name}`); setVariables({...variables, [variable.name]: port === '' ? '' : String(port)}); }}
host={isLocalTarget}
placeholder={variable.default || ''}
required={variable.required}
/>
) : variable.type === 'password' ? (
<Input
id={`${fieldId}-var-${variable.name}`}
type="password"
value={variables[variable.name] || ''}
onChange={(e) => setVariables({...variables, [variable.name]: e.target.value})}
onChange={(e) => { fe.clear(`var-${variable.name}`); setVariables({...variables, [variable.name]: e.target.value}); }}
onBlur={() => fe.touch(`var-${variable.name}`)}
placeholder={variable.default ? '(auto-generated)' : ''}
required={variable.required && !variable.default}
/>
) : (
<Input
id={`${fieldId}-var-${variable.name}`}
type="text"
value={variables[variable.name] || ''}
onChange={(e) => setVariables({...variables, [variable.name]: e.target.value})}
onChange={(e) => { fe.clear(`var-${variable.name}`); setVariables({...variables, [variable.name]: e.target.value}); }}
onBlur={() => fe.touch(`var-${variable.name}`)}
placeholder={variable.default || ''}
required={variable.required}
/>
)}
{variable.description && (
<span className="form-help">{variable.description}</span>
)}
</div>
</FormField>
))}
</div>
)}