Add an input to allow the user to choose the new column name.
This commit is contained in:
parent
2f0a40e9bb
commit
d3670ddf21
|
@ -55,6 +55,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const refreshDefinitions = async () => {
|
const refreshDefinitions = async () => {
|
||||||
|
console.log("woot")
|
||||||
await tables.fetch()
|
await tables.fetch()
|
||||||
await datasources.fetch()
|
await datasources.fetch()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
<script>
|
<script>
|
||||||
import { ModalContent, notifications } from "@budibase/bbui"
|
import {
|
||||||
|
ModalContent,
|
||||||
|
notifications,
|
||||||
|
Input,
|
||||||
|
InlineAlert,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
const { API, dispatch, definition, rows } = getContext("grid")
|
const { API, dispatch, definition, rows } = getContext("grid")
|
||||||
|
|
||||||
export let column
|
export let column
|
||||||
|
|
||||||
|
let newColumnName = `${column.schema.name} (migrated)`
|
||||||
|
|
||||||
const migrateUserColumn = async () => {
|
const migrateUserColumn = async () => {
|
||||||
let subtype = "users"
|
let subtype = "users"
|
||||||
if (column.schema.relationshipType === "one-to-many") {
|
if (column.schema.relationshipType === "one-to-many") {
|
||||||
|
@ -17,7 +24,7 @@
|
||||||
tableId: $definition._id,
|
tableId: $definition._id,
|
||||||
oldColumn: column.schema,
|
oldColumn: column.schema,
|
||||||
newColumn: {
|
newColumn: {
|
||||||
name: `${column.schema.name} migrated`,
|
name: newColumnName,
|
||||||
type: "bb_reference",
|
type: "bb_reference",
|
||||||
subtype,
|
subtype,
|
||||||
},
|
},
|
||||||
|
@ -38,5 +45,14 @@
|
||||||
onConfirm={migrateUserColumn}
|
onConfirm={migrateUserColumn}
|
||||||
size="M"
|
size="M"
|
||||||
>
|
>
|
||||||
TODO: copy here
|
This operation will kick off a migration of the column "{column.schema.name}"
|
||||||
|
to a new column, with the name provided - this operation may take a moment to
|
||||||
|
complete.
|
||||||
|
|
||||||
|
<InlineAlert
|
||||||
|
type="error"
|
||||||
|
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."
|
||||||
|
/>
|
||||||
|
<Input bind:value={newColumnName} label="New column name" />
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
Loading…
Reference in New Issue