From ebab6ea114052fcecb71f24c83354749d9e0b477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Fri, 5 Jun 2026 12:30:40 +0300 Subject: [PATCH] =?UTF-8?q?Wizard=20=C3=BCzerindeki=20problemler=20gideril?= =?UTF-8?q?di.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Seeds/HostData.json | 2 +- .../PlatformConsts.cs | 8 +- .../Seeds/TenantData.json | 6 +- ui/src/views/admin/listForm/wizard/Wizard.tsx | 111 +++++++++++------- .../admin/listForm/wizard/WizardStep1.tsx | 11 +- .../admin/listForm/wizard/WizardStep2.tsx | 2 + .../admin/listForm/wizard/WizardStep4.tsx | 4 +- .../admin/listForm/wizard/WizardStep5.tsx | 4 +- .../developerKit/SqlTableDesignerDialog.tsx | 9 +- ui/src/views/shared/MenuAddDialog.tsx | 27 ++++- 10 files changed, 121 insertions(+), 63 deletions(-) diff --git a/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json b/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json index 1a14771..bd5602b 100644 --- a/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json +++ b/api/src/Sozsoft.Platform.DbMigrator/Seeds/HostData.json @@ -674,7 +674,7 @@ "code": "Abp.Account.EnableLocalLogin", "nameKey": "Abp.Account.EnableLocalLogin", "descriptionKey": "Abp.Account.EnableLocalLogin.Description", - "defaultValue": "False", + "defaultValue": "True", "isVisibleToClients": false, "providers": "G|D", "isInherited": false, diff --git a/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs index 9f91613..1cdb54f 100644 --- a/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Sozsoft.Platform.Domain.Shared/PlatformConsts.cs @@ -773,10 +773,10 @@ public static class PlatformConsts { public static class ParameterTypes { - public const string Static = "S"; - public const string Query = "Q"; - public const string Path = "P"; - public const string Body = "B"; + public const string Static = "Static"; + public const string Query = "Query"; + public const string Path = "Path"; + public const string Body = "Body"; } } diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json b/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json index 4a07c17..91b047a 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Seeds/TenantData.json @@ -324,16 +324,16 @@ "Url": "/dil/", "Method": "GET", "DataSourceCode": "Default", - "Sql": "SELECT * FROM Plat_H_Language WHERE IsEnabled = @IsEnabled AND CultureName = @CultureName", + "Sql": "SELECT * FROM Sas_H_Language WHERE IsEnabled = @IsEnabled AND CultureName = @CultureName", "ParametersJson": [ { - "Type": "P", + "Type": "Path", "Name": "CultureName", "DefaultValue": "ar", "Path": "/dil/:CultureName/" }, { - "Type": "S", + "Type": "Static", "Name": "IsEnabled", "DefaultValue": "true" } diff --git a/ui/src/views/admin/listForm/wizard/Wizard.tsx b/ui/src/views/admin/listForm/wizard/Wizard.tsx index 60f9aee..ad2a018 100644 --- a/ui/src/views/admin/listForm/wizard/Wizard.tsx +++ b/ui/src/views/admin/listForm/wizard/Wizard.tsx @@ -3,6 +3,7 @@ import { ROUTES_ENUM } from '@/routes/route.constant' import { SelectBoxOption } from '@/types/shared' import { useLocalization } from '@/utils/hooks/useLocalization' import { Form, Formik, FormikProps } from 'formik' +import type { KeyboardEvent } from 'react' import { useEffect, useRef, useState } from 'react' import { Helmet } from 'react-helmet' import { useLocation, useNavigate } from 'react-router-dom' @@ -516,24 +517,38 @@ const Wizard = () => { .trim() const handleWizardNameChange = (name: string) => { + const formik = formikRef.current const spacedLabel = toSpacedLabel(name) + const previousSpacedLabel = toSpacedLabel(formik?.values.wizardName ?? '') const derived = deriveListFormCode(name) - formikRef.current?.setFieldValue('wizardName', name) - formikRef.current?.setFieldValue('listFormCode', derived) - formikRef.current?.setFieldValue('menuCode', derived) - formikRef.current?.setFieldValue('languageTextMenuEn', spacedLabel) - formikRef.current?.setFieldValue('languageTextMenuTr', spacedLabel) - formikRef.current?.setFieldValue('languageTextTitleEn', spacedLabel) - formikRef.current?.setFieldValue('languageTextTitleTr', spacedLabel) - formikRef.current?.setFieldValue('languageTextDescEn', spacedLabel) - formikRef.current?.setFieldValue('languageTextDescTr', spacedLabel) + const setAutoText = (field: keyof Pick< + ListFormWizardDto, + | 'languageTextMenuEn' + | 'languageTextMenuTr' + | 'languageTextTitleEn' + | 'languageTextTitleTr' + | 'languageTextDescEn' + | 'languageTextDescTr' + >) => { + const current = formik?.values[field] + if (!current || current === previousSpacedLabel) { + formik?.setFieldValue(field, spacedLabel) + } + } + + formik?.setFieldValue('wizardName', name) + formik?.setFieldValue('listFormCode', derived) + formik?.setFieldValue('menuCode', derived) + setAutoText('languageTextMenuEn') + setAutoText('languageTextMenuTr') + setAutoText('languageTextTitleEn') + setAutoText('languageTextTitleTr') + setAutoText('languageTextDescEn') + setAutoText('languageTextDescTr') } - const handleMenuParentChange = (code: string) => { - formikRef.current?.setFieldValue('menuParentCode', code) - if (!code) return - const rootCode = findRootCode(rawMenuItems, code) + const applyPermissionGroupFromRoot = (rootCode: string) => { const rootItem = rawMenuItems.find((i) => i.code === rootCode) // 1. Use group field if set @@ -565,6 +580,28 @@ const Wizard = () => { formikRef.current?.setFieldValue('permissionGroupName', rootCode) } + const handleMenuParentChange = (code: string) => { + formikRef.current?.setFieldValue('menuParentCode', code) + if (!code) return + applyPermissionGroupFromRoot(findRootCode(rawMenuItems, code)) + } + + const handleMenuCreated = async (menu: { + code: string + parentCode?: string + menuTextEn: string + menuTextTr: string + }) => { + formikRef.current?.setFieldValue('menuParentCode', menu.code) + formikRef.current?.setFieldValue('languageTextMenuParentEn', menu.menuTextEn) + formikRef.current?.setFieldValue('languageTextMenuParentTr', menu.menuTextTr) + + const rootCode = menu.parentCode ? findRootCode(rawMenuItems, menu.parentCode) : menu.code + applyPermissionGroupFromRoot(rootCode) + + await getMenuList() + } + const handleNext = async () => { if (!formikRef.current) return const errors = await formikRef.current.validateForm() @@ -586,6 +623,19 @@ const Wizard = () => { const handleBack = () => setCurrentStep(0) const { getConfig } = useStoreActions((a) => a.abpConfig) + const preventEnterSubmit = (event: KeyboardEvent) => { + if (event.key !== 'Enter') return + + const target = event.target as HTMLElement + const tagName = target.tagName.toLowerCase() + const isTextArea = tagName === 'textarea' + const isExplicitSubmit = target.getAttribute('type') === 'submit' + + if (!isTextArea && !isExplicitSubmit) { + event.preventDefault() + } + } + const handleNext2 = async () => { if (!formikRef.current) return const errors = await formikRef.current.validateForm() @@ -704,40 +754,12 @@ const Wizard = () => { innerRef={formikRef} initialValues={{ ...initialValues }} validationSchema={listFormValidationSchema} - onSubmit={async (values, { setSubmitting }) => { - setSubmitting(true) - - try { - // 🔴 1. Kaydet (bekle) - await postListFormWizard({ ...values }) - - // 🔴 2. Config güncelle (bekle) - await getConfig(true) - - // 🔴 3. Navigate - navigate( - ROUTES_ENUM.protected.admin.list.replace(':listFormCode', values.listFormCode), - { replace: true }, - ) - - // 🔴 4. Toast (istersen navigate öncesi de olabilir) - toast.push( - - {translate('::ListForms.FormBilgileriKaydedildi')} - , - { placement: 'top-end' }, - ) - } catch (error: any) { - toast.push(, { - placement: 'top-end', - }) - } finally { - setSubmitting(false) - } + onSubmit={(_, { setSubmitting }) => { + setSubmitting(false) }} > {({ touched, errors, isSubmitting, values }) => ( -
+ = 2 ? undefined : 'sm'}> {/* ─── Step 1: Basic Info ─────────────────────────────── */} {currentStep === 0 && ( @@ -752,6 +774,7 @@ const Wizard = () => { isLoadingMenu={isLoadingMenu} onMenuParentChange={handleMenuParentChange} onClearMenuParent={() => formikRef.current?.setFieldValue('menuParentCode', '')} + onMenuCreated={handleMenuCreated} onReloadMenu={getMenuList} permissionGroupList={permissionGroupList} isLoadingPermissionGroup={isLoadingPermissionGroup} diff --git a/ui/src/views/admin/listForm/wizard/WizardStep1.tsx b/ui/src/views/admin/listForm/wizard/WizardStep1.tsx index c7bbb94..fc0cc3a 100644 --- a/ui/src/views/admin/listForm/wizard/WizardStep1.tsx +++ b/ui/src/views/admin/listForm/wizard/WizardStep1.tsx @@ -414,6 +414,14 @@ export interface WizardStep1Props { isLoadingMenu: boolean onMenuParentChange: (code: string) => void onClearMenuParent: () => void + onMenuCreated: (menu: { + code: string + parentCode?: string + menuTextEn: string + menuTextTr: string + icon?: string + shortName?: string + }) => void | Promise onReloadMenu: () => void permissionGroupList: SelectBoxOption[] isLoadingPermissionGroup: boolean @@ -432,6 +440,7 @@ const WizardStep1 = ({ isLoadingMenu, onMenuParentChange, onClearMenuParent, + onMenuCreated, onReloadMenu, permissionGroupList, isLoadingPermissionGroup, @@ -544,7 +553,7 @@ const WizardStep1 = ({ initialParentCode={menuDialogParentCode} initialOrder={menuDialogInitialOrder} rawItems={rawMenuItems} - onSaved={onReloadMenu} + onSaved={onMenuCreated} /> diff --git a/ui/src/views/admin/listForm/wizard/WizardStep2.tsx b/ui/src/views/admin/listForm/wizard/WizardStep2.tsx index 34819e2..a862fef 100644 --- a/ui/src/views/admin/listForm/wizard/WizardStep2.tsx +++ b/ui/src/views/admin/listForm/wizard/WizardStep2.tsx @@ -719,6 +719,7 @@ const WizardStep2 = ({
- diff --git a/ui/src/views/admin/listForm/wizard/WizardStep5.tsx b/ui/src/views/admin/listForm/wizard/WizardStep5.tsx index c45a0bf..4435f7b 100644 --- a/ui/src/views/admin/listForm/wizard/WizardStep5.tsx +++ b/ui/src/views/admin/listForm/wizard/WizardStep5.tsx @@ -340,10 +340,10 @@ function WizardStep5({ widgets, translate, onChange, onBack, onNext }: Props) {

Silmek istediÄŸinize emin misiniz?

- - diff --git a/ui/src/views/developerKit/SqlTableDesignerDialog.tsx b/ui/src/views/developerKit/SqlTableDesignerDialog.tsx index a6b3981..d3df652 100644 --- a/ui/src/views/developerKit/SqlTableDesignerDialog.tsx +++ b/ui/src/views/developerKit/SqlTableDesignerDialog.tsx @@ -1943,7 +1943,14 @@ const SqlTableDesignerDialog = ({ initialParentCode={selectedMenuCode} initialOrder={999} rawItems={rawMenuItems} - onSaved={() => reloadMenus()} + onSaved={(menu) => + reloadMenus((items) => { + const savedMenu = items.find((item) => item.code === menu.code) + if (savedMenu?.code && savedMenu.shortName) { + onMenuCodeSelect(savedMenu.code) + } + }) + } />
diff --git a/ui/src/views/shared/MenuAddDialog.tsx b/ui/src/views/shared/MenuAddDialog.tsx index 3c0e37d..3a346c6 100644 --- a/ui/src/views/shared/MenuAddDialog.tsx +++ b/ui/src/views/shared/MenuAddDialog.tsx @@ -128,7 +128,14 @@ export interface MenuAddDialogProps { initialParentCode: string initialOrder: number rawItems: (MenuItem & { id?: string })[] - onSaved: () => void + onSaved: (menu: { + code: string + parentCode?: string + menuTextEn: string + menuTextTr: string + icon?: string + shortName?: string + }) => void | Promise } export function MenuAddDialog({ @@ -172,7 +179,7 @@ export function MenuAddDialog({ if (shortNameRequired && !form.shortName.trim()) return setSaving(true) try { - await menuService.createWithLanguageKeyText({ + const savedMenu = { code: form.code.trim(), displayName: form.code.trim(), parentCode: form.parentCode.trim() || undefined, @@ -182,9 +189,18 @@ export function MenuAddDialog({ isDisabled: false, menuTextTr: form.menuTextTr.trim(), menuTextEn: form.menuTextEn.trim(), - } as MenuDto) + } as MenuDto - onSaved() + await menuService.createWithLanguageKeyText(savedMenu) + + await onSaved({ + code: savedMenu.code!, + parentCode: savedMenu.parentCode, + menuTextEn: savedMenu.menuTextEn!, + menuTextTr: savedMenu.menuTextTr!, + icon: savedMenu.icon, + shortName: savedMenu.shortName, + }) onClose() } catch (e: any) { toast.push(, { placement: 'top-end' }) @@ -342,10 +358,11 @@ export function MenuAddDialog({ {/* Footer */}
-