Make sure the user cannot enter the same column name as the old column for the migrated column.
This commit is contained in:
parent
d3670ddf21
commit
f4c6ab7f48
|
@ -18,7 +18,6 @@
|
||||||
export let orderable = true
|
export let orderable = true
|
||||||
|
|
||||||
const {
|
const {
|
||||||
API,
|
|
||||||
reorder,
|
reorder,
|
||||||
isReordering,
|
isReordering,
|
||||||
isResizing,
|
isResizing,
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
export let column
|
export let column
|
||||||
|
|
||||||
let newColumnName = `${column.schema.name} (migrated)`
|
let newColumnName = `${column.schema.name} (migrated)`
|
||||||
|
$: newAndOldNameMatch = column.schema.name === newColumnName
|
||||||
|
|
||||||
const migrateUserColumn = async () => {
|
const migrateUserColumn = async () => {
|
||||||
let subtype = "users"
|
let subtype = "users"
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
confirmText="Continue"
|
confirmText="Continue"
|
||||||
cancelText="Cancel"
|
cancelText="Cancel"
|
||||||
onConfirm={migrateUserColumn}
|
onConfirm={migrateUserColumn}
|
||||||
|
disabled={newAndOldNameMatch}
|
||||||
size="M"
|
size="M"
|
||||||
>
|
>
|
||||||
This operation will kick off a migration of the column "{column.schema.name}"
|
This operation will kick off a migration of the column "{column.schema.name}"
|
||||||
|
@ -54,5 +56,11 @@
|
||||||
header="Are you sure?"
|
header="Are you sure?"
|
||||||
message="This will leave bindings which utilised the user relationship column in a state where they will need to be updated to use the new column instead."
|
message="This will leave bindings which utilised the user relationship column in a state where they will need to be updated to use the new column instead."
|
||||||
/>
|
/>
|
||||||
<Input bind:value={newColumnName} label="New column name" />
|
<Input
|
||||||
|
bind:value={newColumnName}
|
||||||
|
label="New column name"
|
||||||
|
error={newAndOldNameMatch
|
||||||
|
? "New column name can't be the same as the existing column name"
|
||||||
|
: undefined}
|
||||||
|
/>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
Loading…
Reference in New Issue