IsDeleted sütunu eklendi
This commit is contained in:
parent
41c7d862dc
commit
6aa5e2b1ca
4 changed files with 57 additions and 4 deletions
|
|
@ -17588,6 +17588,12 @@
|
||||||
"en": "Columns load after selecting a Select Command",
|
"en": "Columns load after selecting a Select Command",
|
||||||
"tr": "Select Command seçince sütunlar yüklenir"
|
"tr": "Select Command seçince sütunlar yüklenir"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.Wizard.Step3.SelectTable",
|
||||||
|
"en": "Select Table",
|
||||||
|
"tr": "Tablo Seç"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.Wizard.Step3.IncludeInEditingForm",
|
"key": "ListForms.Wizard.Step3.IncludeInEditingForm",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import { number, object, string } from 'yup'
|
||||||
import { cascadeFilterOperator, columnLookupDataSourceTypeListOptions } from '../options'
|
import { cascadeFilterOperator, columnLookupDataSourceTypeListOptions } from '../options'
|
||||||
import { FormFieldEditProps } from './FormFields'
|
import { FormFieldEditProps } from './FormFields'
|
||||||
import { ColumnCascadeFilterOperatorEnum, UiLookupDataSourceTypeEnum } from '@/proxy/form/models'
|
import { ColumnCascadeFilterOperatorEnum, UiLookupDataSourceTypeEnum } from '@/proxy/form/models'
|
||||||
|
import { buildLookupQuery } from '../../lookupQuery'
|
||||||
|
|
||||||
const schema = object().shape({
|
const schema = object().shape({
|
||||||
lookupDto: object()
|
lookupDto: object()
|
||||||
|
|
@ -190,7 +191,12 @@ function TablePickerModal({
|
||||||
</div>
|
</div>
|
||||||
{keyCol && nameCol && (
|
{keyCol && nameCol && (
|
||||||
<div className="rounded bg-gray-50 dark:bg-gray-800 px-2 py-1.5 text-[10px] font-mono text-gray-500 dark:text-gray-400 break-all">
|
<div className="rounded bg-gray-50 dark:bg-gray-800 px-2 py-1.5 text-[10px] font-mono text-gray-500 dark:text-gray-400 break-all">
|
||||||
{`SELECT "${keyCol}" AS "Key", "${nameCol}" AS "Name" FROM "${pickerTable?.tableName}" ORDER BY "${nameCol}";`}
|
{buildLookupQuery({
|
||||||
|
keyColumn: keyCol,
|
||||||
|
nameColumn: nameCol,
|
||||||
|
tableName: pickerTable?.tableName,
|
||||||
|
columns: pickerColumns,
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
|
|
@ -198,7 +204,12 @@ function TablePickerModal({
|
||||||
disabled={!keyCol || !nameCol}
|
disabled={!keyCol || !nameCol}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onSelect(
|
onSelect(
|
||||||
`SELECT "${keyCol}" AS "Key", "${nameCol}" AS "Name" FROM "${pickerTable?.tableName}" ORDER BY "${nameCol}";`,
|
buildLookupQuery({
|
||||||
|
keyColumn: keyCol,
|
||||||
|
nameColumn: nameCol,
|
||||||
|
tableName: pickerTable?.tableName,
|
||||||
|
columns: pickerColumns,
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
className="mt-1 w-full py-1.5 text-xs font-semibold rounded bg-indigo-600 text-white hover:bg-indigo-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
|
className="mt-1 w-full py-1.5 text-xs font-semibold rounded bg-indigo-600 text-white hover:bg-indigo-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
|
||||||
|
|
|
||||||
25
ui/src/views/admin/listForm/lookupQuery.ts
Normal file
25
ui/src/views/admin/listForm/lookupQuery.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import type { DatabaseColumnDto } from '@/proxy/sql-query-manager/models'
|
||||||
|
|
||||||
|
const IS_DELETED_COLUMN = 'IsDeleted'
|
||||||
|
|
||||||
|
export function tableHasIsDeletedColumn(columns: DatabaseColumnDto[]) {
|
||||||
|
return columns.some(
|
||||||
|
(column) => column.columnName.toLowerCase() === IS_DELETED_COLUMN.toLowerCase(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildLookupQuery({
|
||||||
|
keyColumn,
|
||||||
|
nameColumn,
|
||||||
|
tableName,
|
||||||
|
columns,
|
||||||
|
}: {
|
||||||
|
keyColumn: string
|
||||||
|
nameColumn: string
|
||||||
|
tableName?: string
|
||||||
|
columns: DatabaseColumnDto[]
|
||||||
|
}) {
|
||||||
|
const whereClause = tableHasIsDeletedColumn(columns) ? ` WHERE "${IS_DELETED_COLUMN}" = 0` : ''
|
||||||
|
|
||||||
|
return `SELECT "${keyColumn}" AS "Key", "${nameColumn}" AS "Name" FROM "${tableName}"${whereClause} ORDER BY "${nameColumn}";`
|
||||||
|
}
|
||||||
|
|
@ -30,6 +30,7 @@ import {
|
||||||
FaCode,
|
FaCode,
|
||||||
} from 'react-icons/fa'
|
} from 'react-icons/fa'
|
||||||
import { UiLookupDataSourceTypeEnum } from '@/proxy/form/models'
|
import { UiLookupDataSourceTypeEnum } from '@/proxy/form/models'
|
||||||
|
import { buildLookupQuery } from '../lookupQuery'
|
||||||
|
|
||||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||||
export interface WizardGroupItem {
|
export interface WizardGroupItem {
|
||||||
|
|
@ -516,14 +517,24 @@ function SortableItem({
|
||||||
</div>
|
</div>
|
||||||
{pickerKeyCol && pickerNameCol && (
|
{pickerKeyCol && pickerNameCol && (
|
||||||
<div className="rounded bg-gray-50 dark:bg-gray-800 px-2 py-1.5 text-[10px] font-mono text-gray-500 dark:text-gray-400 break-all">
|
<div className="rounded bg-gray-50 dark:bg-gray-800 px-2 py-1.5 text-[10px] font-mono text-gray-500 dark:text-gray-400 break-all">
|
||||||
{`SELECT "${pickerKeyCol}" AS "Key", "${pickerNameCol}" AS "Name" FROM "${pickerTable?.tableName}" ORDER BY "${pickerNameCol}";`}
|
{buildLookupQuery({
|
||||||
|
keyColumn: pickerKeyCol,
|
||||||
|
nameColumn: pickerNameCol,
|
||||||
|
tableName: pickerTable?.tableName,
|
||||||
|
columns: pickerColumns,
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!pickerKeyCol || !pickerNameCol}
|
disabled={!pickerKeyCol || !pickerNameCol}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const q = `SELECT "${pickerKeyCol}" AS "Key", "${pickerNameCol}" AS "Name" FROM "${pickerTable?.tableName}" ORDER BY "${pickerNameCol}";`
|
const q = buildLookupQuery({
|
||||||
|
keyColumn: pickerKeyCol,
|
||||||
|
nameColumn: pickerNameCol,
|
||||||
|
tableName: pickerTable?.tableName,
|
||||||
|
columns: pickerColumns,
|
||||||
|
})
|
||||||
onLookupQueryChange(q)
|
onLookupQueryChange(q)
|
||||||
setIsTablePickerOpen(false)
|
setIsTablePickerOpen(false)
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue