Remove DEFAULT_VALUES flag check

This commit is contained in:
Adria Navarro 2025-01-13 17:23:12 +01:00
parent c79ebad924
commit 378e611222
2 changed files with 51 additions and 57 deletions

View File

@ -168,7 +168,6 @@
// used to select what different options can be displayed for column type // used to select what different options can be displayed for column type
$: canBeDisplay = $: canBeDisplay =
canBeDisplayColumn(editableColumn) && !editableColumn.autocolumn canBeDisplayColumn(editableColumn) && !editableColumn.autocolumn
$: defaultValuesEnabled = isEnabled("DEFAULT_VALUES")
$: canHaveDefault = !required && canHaveDefaultColumn(editableColumn.type) $: canHaveDefault = !required && canHaveDefaultColumn(editableColumn.type)
$: canBeRequired = $: canBeRequired =
editableColumn?.type !== FieldType.LINK && editableColumn?.type !== FieldType.LINK &&
@ -300,7 +299,7 @@
} }
// Ensure we don't have a default value if we can't have one // Ensure we don't have a default value if we can't have one
if (!canHaveDefault || !defaultValuesEnabled) { if (!canHaveDefault) {
delete saveColumn.default delete saveColumn.default
} }
@ -848,7 +847,6 @@
</div> </div>
{/if} {/if}
{#if defaultValuesEnabled}
{#if editableColumn.type === FieldType.OPTIONS} {#if editableColumn.type === FieldType.OPTIONS}
<Select <Select
disabled={!canHaveDefault} disabled={!canHaveDefault}
@ -893,7 +891,6 @@
allowJS allowJS
/> />
{/if} {/if}
{/if}
</Layout> </Layout>
<div class="action-buttons"> <div class="action-buttons">

View File

@ -7,22 +7,19 @@ import {
FIELDS, FIELDS,
isAutoColumnUserRelationship, isAutoColumnUserRelationship,
} from "@/constants/backend" } from "@/constants/backend"
import { isEnabled } from "@/helpers/featureFlags"
export function getAutoColumnInformation(enabled = true) { export function getAutoColumnInformation(enabled = true) {
let info = {} let info = {}
for (const [key, subtype] of Object.entries(AUTO_COLUMN_SUB_TYPES)) { for (const [key, subtype] of Object.entries(AUTO_COLUMN_SUB_TYPES)) {
// Because it's possible to replicate the functionality of CREATED_AT and // Because it's possible to replicate the functionality of CREATED_AT and
// CREATED_BY columns, we disable their creation when the DEFAULT_VALUES // CREATED_BY columns with user column default values, we disable their creation
// feature flag is enabled.
if (isEnabled("DEFAULT_VALUES")) {
if ( if (
subtype === AUTO_COLUMN_SUB_TYPES.CREATED_AT || subtype === AUTO_COLUMN_SUB_TYPES.CREATED_AT ||
subtype === AUTO_COLUMN_SUB_TYPES.CREATED_BY subtype === AUTO_COLUMN_SUB_TYPES.CREATED_BY
) { ) {
continue continue
} }
}
info[subtype] = { enabled, name: AUTO_COLUMN_DISPLAY_NAMES[key] } info[subtype] = { enabled, name: AUTO_COLUMN_DISPLAY_NAMES[key] }
} }
return info return info